]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Merge branches 'core/iommu', 'x86/amd-iommu' and 'x86/iommu' into x86-v28-for-linus...
authorIngo Molnar <mingo@elte.hu>
Fri, 10 Oct 2008 17:47:12 +0000 (19:47 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 10 Oct 2008 17:47:12 +0000 (19:47 +0200)
Conflicts:
arch/x86/kernel/pci-gart_64.c
include/asm-x86/dma-mapping.h

758 files changed:
.mailmap
Documentation/00-INDEX
Documentation/DMA-mapping.txt
Documentation/HOWTO
Documentation/SubmitChecklist
Documentation/cpu-freq/index.txt
Documentation/hwmon/adt7473
Documentation/hwmon/sysfs-interface
Documentation/ioctl/cdrom.txt
Documentation/kernel-parameters.txt
Documentation/sysctl/kernel.txt
Documentation/usb/anchors.txt
Documentation/video4linux/CARDLIST.em28xx
Documentation/video4linux/gspca.txt
Documentation/x86/00-INDEX [new file with mode: 0644]
Documentation/x86/boot.txt [moved from Documentation/x86/i386/boot.txt with 99% similarity]
Documentation/x86/mtrr.txt [moved from Documentation/mtrr.txt with 99% similarity]
Documentation/x86/pat.txt
Documentation/x86/usb-legacy-support.txt [moved from Documentation/x86/i386/usb-legacy-support.txt with 100% similarity]
Documentation/x86/x86_64/boot-options.txt
Documentation/x86/zero-page.txt [moved from Documentation/x86/i386/zero-page.txt with 100% similarity]
MAINTAINERS
Makefile
arch/arm/kernel/kgdb.c
arch/arm/mach-davinci/psc.c
arch/arm/mach-pxa/time.c
arch/arm/mach-sa1100/generic.c
arch/arm/mach-sa1100/include/mach/jornada720.h
arch/arm/mach-sa1100/jornada720_ssp.c
arch/arm/mach-versatile/core.c
arch/arm/plat-omap/devices.c
arch/avr32/boards/atstk1000/atstk1002.c
arch/avr32/boot/images/.gitignore [new file with mode: 0644]
arch/avr32/kernel/.gitignore [new file with mode: 0644]
arch/avr32/kernel/avr32_ksyms.c
arch/avr32/kernel/syscall-stubs.S
arch/avr32/kernel/syscall_table.S
arch/avr32/kernel/traps.c
arch/avr32/lib/findbit.S
arch/ia64/include/asm/sections.h
arch/ia64/kernel/efi.c
arch/ia64/kernel/head.S
arch/ia64/kernel/setup.c
arch/ia64/kernel/vmlinux.lds.S
arch/ia64/kvm/kvm-ia64.c
arch/ia64/mm/contig.c
arch/ia64/mm/discontig.c
arch/m32r/Kconfig
arch/m32r/kernel/entry.S
arch/m32r/kernel/head.S
arch/m32r/kernel/irq.c
arch/m32r/kernel/m32r_ksyms.c
arch/m32r/kernel/process.c
arch/m32r/kernel/smp.c
arch/m32r/kernel/time.c
arch/m32r/kernel/traps.c
arch/m32r/lib/delay.c
arch/mips/Kconfig
arch/mips/au1000/common/gpio.c
arch/mips/kernel/Makefile
arch/mips/kernel/cevt-r4k.c
arch/mips/kernel/cevt-smtc.c [new file with mode: 0644]
arch/mips/kernel/cpu-probe.c
arch/mips/kernel/entry.S
arch/mips/kernel/genex.S
arch/mips/kernel/head.S
arch/mips/kernel/kgdb.c
arch/mips/kernel/mips-mt-fpaff.c
arch/mips/kernel/process.c
arch/mips/kernel/ptrace.c
arch/mips/kernel/smtc.c
arch/mips/kernel/traps.c
arch/mips/kernel/vmlinux.lds.S
arch/mips/lib/csum_partial.S
arch/mips/mti-malta/Makefile
arch/mips/mti-malta/malta-smtc.c
arch/mips/pci/Makefile
arch/mips/pci/pci-bcm47xx.c [new file with mode: 0644]
arch/mips/pci/pci-ip27.c
arch/mips/sibyte/swarm/Makefile
arch/mips/sibyte/swarm/platform.c [new file with mode: 0644]
arch/mips/vr41xx/common/irq.c
arch/mn10300/kernel/irq.c
arch/mn10300/kernel/time.c
arch/mn10300/unit-asb2303/unit-init.c
arch/mn10300/unit-asb2305/unit-init.c
arch/powerpc/boot/Makefile
arch/powerpc/boot/dts/holly.dts
arch/powerpc/boot/dts/mpc8610_hpcd.dts
arch/powerpc/include/asm/elf.h
arch/powerpc/include/asm/sections.h
arch/powerpc/kernel/idle.c
arch/powerpc/kernel/kgdb.c
arch/powerpc/kernel/module_64.c
arch/powerpc/platforms/fsl_uli1575.c
arch/s390/kernel/time.c
arch/s390/lib/delay.c
arch/sparc64/kernel/irq.c
arch/sparc64/kernel/of_device.c
arch/sparc64/kernel/pci.c
arch/sparc64/kernel/pci_psycho.c
arch/sparc64/kernel/traps.c
arch/x86/Kconfig
arch/x86/Kconfig.cpu
arch/x86/boot/compressed/head_32.S
arch/x86/boot/compressed/misc.c
arch/x86/boot/compressed/relocs.c
arch/x86/boot/header.S
arch/x86/configs/i386_defconfig
arch/x86/configs/x86_64_defconfig
arch/x86/ia32/ia32_aout.c
arch/x86/ia32/ia32_signal.c
arch/x86/ia32/sys_ia32.c
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/alternative.c
arch/x86/kernel/amd_iommu.c
arch/x86/kernel/aperture_64.c
arch/x86/kernel/apm_32.c
arch/x86/kernel/asm-offsets_64.c
arch/x86/kernel/bios_uv.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/common_64.c
arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/cpu/mtrr/generic.c
arch/x86/kernel/cpu/mtrr/if.c
arch/x86/kernel/cpu/mtrr/main.c
arch/x86/kernel/cpu/perfctr-watchdog.c
arch/x86/kernel/cpuid.c
arch/x86/kernel/crash_dump_64.c
arch/x86/kernel/ds.c
arch/x86/kernel/efi.c
arch/x86/kernel/entry_64.S
arch/x86/kernel/head64.c
arch/x86/kernel/head_32.S
arch/x86/kernel/head_64.S
arch/x86/kernel/ioport.c
arch/x86/kernel/ipi.c
arch/x86/kernel/irq_32.c
arch/x86/kernel/irq_64.c
arch/x86/kernel/kdebugfs.c
arch/x86/kernel/kgdb.c
arch/x86/kernel/kvm.c
arch/x86/kernel/ldt.c
arch/x86/kernel/nmi.c
arch/x86/kernel/olpc.c
arch/x86/kernel/paravirt.c
arch/x86/kernel/paravirt_patch_32.c
arch/x86/kernel/pci-dma.c
arch/x86/kernel/pci-gart_64.c
arch/x86/kernel/pcspeaker.c
arch/x86/kernel/process.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/reboot.c
arch/x86/kernel/setup.c
arch/x86/kernel/setup_percpu.c
arch/x86/kernel/sigframe.h
arch/x86/kernel/signal_32.c
arch/x86/kernel/signal_64.c
arch/x86/kernel/smpboot.c
arch/x86/kernel/sys_i386_32.c
arch/x86/kernel/sys_x86_64.c
arch/x86/kernel/syscall_64.c
arch/x86/kernel/time_32.c
arch/x86/kernel/tls.c
arch/x86/kernel/traps_64.c
arch/x86/kernel/tsc.c
arch/x86/kernel/visws_quirks.c
arch/x86/kernel/vm86_32.c
arch/x86/kernel/vmi_32.c
arch/x86/kernel/vsmp_64.c
arch/x86/lib/msr-on-cpu.c
arch/x86/lib/string_32.c
arch/x86/lib/strstr_32.c
arch/x86/mach-default/setup.c
arch/x86/mm/discontig_32.c
arch/x86/mm/dump_pagetables.c
arch/x86/mm/fault.c
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c
arch/x86/mm/ioremap.c
arch/x86/mm/numa_64.c
arch/x86/mm/pageattr-test.c
arch/x86/mm/pageattr.c
arch/x86/mm/pat.c
arch/x86/mm/pgtable.c
arch/x86/mm/pgtable_32.c
arch/x86/oprofile/nmi_int.c
arch/x86/oprofile/op_model_p4.c
arch/x86/pci/amd_bus.c
arch/x86/pci/irq.c
arch/x86/power/hibernate_asm_32.S
arch/x86/xen/enlighten.c
arch/x86/xen/setup.c
drivers/accessibility/braille/braille_console.c
drivers/acpi/glue.c
drivers/acpi/sleep/proc.c
drivers/ata/Kconfig
drivers/ata/ahci.c
drivers/ata/ata_piix.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-scsi.c
drivers/ata/libata.h
drivers/ata/pata_bf54x.c
drivers/ata/pata_sil680.c
drivers/ata/sata_fsl.c
drivers/ata/sata_inic162x.c
drivers/ata/sata_mv.c
drivers/ata/sata_nv.c
drivers/ata/sata_promise.c
drivers/ata/sata_qstor.c
drivers/ata/sata_sil.c
drivers/ata/sata_sil24.c
drivers/ata/sata_sis.c
drivers/ata/sata_svw.c
drivers/ata/sata_uli.c
drivers/ata/sata_via.c
drivers/ata/sata_vsc.c
drivers/bluetooth/bpa10x.c
drivers/bluetooth/btusb.c
drivers/char/agp/agp.h
drivers/char/agp/alpha-agp.c
drivers/char/agp/amd-k7-agp.c
drivers/char/agp/amd64-agp.c
drivers/char/agp/ati-agp.c
drivers/char/agp/efficeon-agp.c
drivers/char/agp/generic.c
drivers/char/agp/hp-agp.c
drivers/char/agp/i460-agp.c
drivers/char/agp/intel-agp.c
drivers/char/agp/nvidia-agp.c
drivers/char/agp/parisc-agp.c
drivers/char/agp/sis-agp.c
drivers/char/agp/sworks-agp.c
drivers/char/agp/uninorth-agp.c
drivers/char/agp/via-agp.c
drivers/char/tty_io.c
drivers/clocksource/acpi_pm.c
drivers/crypto/talitos.c
drivers/dma/dw_dmac.c
drivers/hwmon/abituguru3.c
drivers/hwmon/ad7414.c
drivers/hwmon/atxp1.c
drivers/hwmon/it87.c
drivers/i2c/busses/i2c-powermac.c
drivers/i2c/i2c-dev.c
drivers/ide/Kconfig
drivers/ide/ide-cd.c
drivers/ide/ide-dma.c
drivers/ide/ide-probe.c
drivers/ide/ide-tape.c
drivers/ide/mips/Makefile
drivers/ide/mips/swarm.c [deleted file]
drivers/infiniband/hw/mlx4/qp.c
drivers/infiniband/hw/nes/nes_cm.c
drivers/infiniband/ulp/ipoib/ipoib.h
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
drivers/input/mouse/bcm5974.c
drivers/input/touchscreen/jornada720_ts.c
drivers/leds/leds-fsg.c
drivers/leds/leds-pca955x.c
drivers/md/dm-mpath.c
drivers/md/dm.c
drivers/md/md.c
drivers/media/common/tuners/tuner-xc2028.h
drivers/media/dvb/b2c2/flexcop-fe-tuner.c
drivers/media/dvb/dvb-core/dmxdev.c
drivers/media/dvb/dvb-core/dvb_demux.c
drivers/media/dvb/frontends/s5h1420.c
drivers/media/dvb/frontends/s5h1420.h
drivers/media/dvb/siano/sms-cards.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/cafe_ccic.c
drivers/media/video/cpia2/cpia2_usb.c
drivers/media/video/cx18/cx18-cards.c
drivers/media/video/em28xx/em28xx-audio.c
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-dvb.c
drivers/media/video/gspca/gspca.c
drivers/media/video/gspca/pac7311.c
drivers/media/video/gspca/sonixb.c
drivers/media/video/gspca/sonixj.c
drivers/media/video/gspca/spca561.c
drivers/media/video/gspca/zc3xx.c
drivers/media/video/ov511.c
drivers/media/video/pvrusb2/pvrusb2-devattr.c
drivers/media/video/s2255drv.c
drivers/media/video/uvc/uvc_ctrl.c
drivers/media/video/w9968cf.c
drivers/media/video/wm8739.c
drivers/media/video/zoran_card.c
drivers/media/video/zoran_driver.c
drivers/mfd/Kconfig
drivers/mfd/asic3.c
drivers/misc/eeepc-laptop.c
drivers/mmc/card/block.c
drivers/mmc/card/mmc_test.c
drivers/mmc/host/atmel-mci.c
drivers/mmc/host/tmio_mmc.h
drivers/net/bnx2.h
drivers/net/e100.c
drivers/net/e1000/e1000_hw.c
drivers/net/e1000e/e1000.h
drivers/net/e1000e/ethtool.c
drivers/net/e1000e/ich8lan.c
drivers/net/e1000e/netdev.c
drivers/net/e1000e/param.c
drivers/net/forcedeth.c
drivers/net/hp-plus.c
drivers/net/mlx4/mr.c
drivers/net/wireless/ath9k/core.c
drivers/net/wireless/ath9k/core.h
drivers/net/wireless/ath9k/main.c
drivers/net/wireless/ath9k/xmit.c
drivers/net/wireless/b43/rfkill.c
drivers/net/wireless/b43legacy/rfkill.c
drivers/net/wireless/zd1211rw/zd_usb.c
drivers/pci/pci-sysfs.c
drivers/pci/pcie/aspm.c
drivers/pci/search.c
drivers/pcmcia/ds.c
drivers/pnp/Makefile
drivers/pnp/pnpacpi/core.c
drivers/pnp/pnpbios/core.c
drivers/rtc/rtc-dev.c
drivers/s390/cio/ccwgroup.c
drivers/s390/cio/cio.c
drivers/s390/cio/qdio_setup.c
drivers/scsi/libsas/sas_ata.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qlogicpti.c
drivers/scsi/scsi_lib.c
drivers/serial/atmel_serial.c
drivers/spi/orion_spi.c
drivers/spi/pxa2xx_spi.c
drivers/ssb/main.c
drivers/usb/core/hcd.c
drivers/usb/core/hub.c
drivers/usb/gadget/fsl_usb2_udc.c
drivers/usb/gadget/omap_udc.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-sched.c
drivers/usb/musb/Kconfig
drivers/usb/musb/musb_core.c
drivers/usb/musb/omap2430.c
drivers/usb/musb/omap2430.h
drivers/usb/serial/cp2101.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio.h
drivers/usb/serial/option.c
drivers/usb/serial/sierra.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/usb-serial.c
drivers/usb/storage/Kconfig
drivers/usb/storage/Makefile
drivers/usb/storage/unusual_devs.h
drivers/usb/storage/usb.c
drivers/video/console/fbcon.c
drivers/video/console/fbcon.h
drivers/watchdog/geodewdt.c
drivers/watchdog/ibmasr.c
drivers/watchdog/pnx4008_wdt.c
drivers/watchdog/rc32434_wdt.c
drivers/watchdog/rdc321x_wdt.c
drivers/watchdog/wdt285.c
fs/9p/vfs_inode.c
fs/dcache.c
fs/exec.c
fs/inotify_user.c
fs/ramfs/file-nommu.c
fs/splice.c
fs/ubifs/debug.c
fs/ubifs/dir.c
fs/ubifs/find.c
fs/ubifs/gc.c
fs/ubifs/super.c
fs/ubifs/tnc.c
fs/xfs/linux-2.6/xfs_aops.c
fs/xfs/linux-2.6/xfs_super.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_dfrag.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_log.c
fs/xfs/xfs_log_priv.h
fs/xfs/xfs_vnodeops.c
include/asm-generic/bug.h
include/asm-mips/cevt-r4k.h [new file with mode: 0644]
include/asm-mips/irqflags.h
include/asm-mips/mipsregs.h
include/asm-mips/pgtable-32.h
include/asm-mips/smtc.h
include/asm-mips/sn/mapped_kernel.h
include/asm-mips/stackframe.h
include/asm-x86/a.out-core.h
include/asm-x86/a.out.h
include/asm-x86/acpi.h
include/asm-x86/agp.h
include/asm-x86/alternative.h
include/asm-x86/amd_iommu.h
include/asm-x86/amd_iommu_types.h
include/asm-x86/apic.h
include/asm-x86/apicdef.h
include/asm-x86/arch_hooks.h
include/asm-x86/asm.h
include/asm-x86/atomic_32.h
include/asm-x86/atomic_64.h
include/asm-x86/auxvec.h
include/asm-x86/bios_ebda.h
include/asm-x86/bitops.h
include/asm-x86/boot.h
include/asm-x86/bootparam.h
include/asm-x86/bug.h
include/asm-x86/bugs.h
include/asm-x86/byteorder.h
include/asm-x86/cache.h
include/asm-x86/cacheflush.h
include/asm-x86/calgary.h
include/asm-x86/checksum_32.h
include/asm-x86/checksum_64.h
include/asm-x86/cmpxchg_32.h
include/asm-x86/cmpxchg_64.h
include/asm-x86/compat.h
include/asm-x86/cpu.h
include/asm-x86/cpufeature.h
include/asm-x86/current.h
include/asm-x86/debugreg.h
include/asm-x86/delay.h
include/asm-x86/desc.h
include/asm-x86/desc_defs.h
include/asm-x86/device.h
include/asm-x86/div64.h
include/asm-x86/dma-mapping.h
include/asm-x86/dma.h
include/asm-x86/dmi.h
include/asm-x86/ds.h
include/asm-x86/dwarf2.h
include/asm-x86/e820.h
include/asm-x86/edac.h
include/asm-x86/efi.h
include/asm-x86/elf.h
include/asm-x86/emergency-restart.h
include/asm-x86/fb.h
include/asm-x86/fixmap.h
include/asm-x86/fixmap_32.h
include/asm-x86/fixmap_64.h
include/asm-x86/floppy.h
include/asm-x86/ftrace.h
include/asm-x86/futex.h
include/asm-x86/gart.h
include/asm-x86/genapic_32.h
include/asm-x86/genapic_64.h
include/asm-x86/geode.h
include/asm-x86/gpio.h
include/asm-x86/hardirq_32.h
include/asm-x86/hardirq_64.h
include/asm-x86/highmem.h
include/asm-x86/hpet.h
include/asm-x86/hugetlb.h
include/asm-x86/hw_irq.h
include/asm-x86/hypertransport.h
include/asm-x86/i387.h
include/asm-x86/i8253.h
include/asm-x86/i8259.h
include/asm-x86/ia32.h
include/asm-x86/ia32_unistd.h
include/asm-x86/idle.h
include/asm-x86/intel_arch_perfmon.h
include/asm-x86/io.h
include/asm-x86/io_32.h
include/asm-x86/io_64.h
include/asm-x86/io_apic.h
include/asm-x86/ioctls.h
include/asm-x86/iommu.h
include/asm-x86/ipcbuf.h
include/asm-x86/ipi.h
include/asm-x86/irq.h
include/asm-x86/irq_regs_32.h
include/asm-x86/irq_vectors.h
include/asm-x86/ist.h
include/asm-x86/k8.h
include/asm-x86/kdebug.h
include/asm-x86/kexec.h
include/asm-x86/kgdb.h
include/asm-x86/kmap_types.h
include/asm-x86/kprobes.h
include/asm-x86/kvm.h
include/asm-x86/kvm_host.h
include/asm-x86/kvm_para.h
include/asm-x86/kvm_x86_emulate.h
include/asm-x86/ldt.h
include/asm-x86/lguest.h
include/asm-x86/lguest_hcall.h
include/asm-x86/linkage.h
include/asm-x86/local.h
include/asm-x86/mach-bigsmp/mach_apic.h
include/asm-x86/mach-bigsmp/mach_apicdef.h
include/asm-x86/mach-bigsmp/mach_ipi.h
include/asm-x86/mach-default/apm.h
include/asm-x86/mach-default/mach_apic.h
include/asm-x86/mach-default/mach_apicdef.h
include/asm-x86/mach-default/mach_ipi.h
include/asm-x86/mach-default/mach_mpparse.h
include/asm-x86/mach-default/mach_mpspec.h
include/asm-x86/mach-default/mach_timer.h
include/asm-x86/mach-default/mach_traps.h
include/asm-x86/mach-default/mach_wakecpu.h
include/asm-x86/mach-es7000/mach_apic.h
include/asm-x86/mach-es7000/mach_apicdef.h
include/asm-x86/mach-es7000/mach_ipi.h
include/asm-x86/mach-es7000/mach_mpparse.h
include/asm-x86/mach-es7000/mach_wakecpu.h
include/asm-x86/mach-generic/gpio.h
include/asm-x86/mach-generic/irq_vectors_limits.h
include/asm-x86/mach-generic/mach_apic.h
include/asm-x86/mach-generic/mach_apicdef.h
include/asm-x86/mach-generic/mach_ipi.h
include/asm-x86/mach-generic/mach_mpparse.h
include/asm-x86/mach-generic/mach_mpspec.h
include/asm-x86/mach-numaq/mach_apic.h
include/asm-x86/mach-numaq/mach_apicdef.h
include/asm-x86/mach-numaq/mach_ipi.h
include/asm-x86/mach-numaq/mach_mpparse.h
include/asm-x86/mach-numaq/mach_wakecpu.h
include/asm-x86/mach-rdc321x/gpio.h
include/asm-x86/mach-summit/irq_vectors_limits.h
include/asm-x86/mach-summit/mach_apic.h
include/asm-x86/mach-summit/mach_apicdef.h
include/asm-x86/mach-summit/mach_ipi.h
include/asm-x86/mach-summit/mach_mpparse.h
include/asm-x86/math_emu.h
include/asm-x86/mc146818rtc.h
include/asm-x86/mca.h
include/asm-x86/mca_dma.h
include/asm-x86/mce.h
include/asm-x86/mman.h
include/asm-x86/mmconfig.h
include/asm-x86/mmu.h
include/asm-x86/mmu_context.h
include/asm-x86/mmu_context_32.h
include/asm-x86/mmu_context_64.h
include/asm-x86/mmx.h
include/asm-x86/mmzone_32.h
include/asm-x86/mmzone_64.h
include/asm-x86/module.h
include/asm-x86/mpspec.h
include/asm-x86/mpspec_def.h
include/asm-x86/msgbuf.h
include/asm-x86/msidef.h
include/asm-x86/msr-index.h
include/asm-x86/msr.h
include/asm-x86/mtrr.h
include/asm-x86/mutex_32.h
include/asm-x86/mutex_64.h
include/asm-x86/nmi.h
include/asm-x86/nops.h
include/asm-x86/numa_32.h
include/asm-x86/numa_64.h
include/asm-x86/numaq.h
include/asm-x86/olpc.h
include/asm-x86/page.h
include/asm-x86/page_32.h
include/asm-x86/page_64.h
include/asm-x86/param.h
include/asm-x86/paravirt.h
include/asm-x86/parport.h
include/asm-x86/pat.h
include/asm-x86/pci-direct.h
include/asm-x86/pci.h
include/asm-x86/pci_32.h
include/asm-x86/pci_64.h
include/asm-x86/pda.h
include/asm-x86/percpu.h
include/asm-x86/pgalloc.h
include/asm-x86/pgtable-2level-defs.h
include/asm-x86/pgtable-2level.h
include/asm-x86/pgtable-3level-defs.h
include/asm-x86/pgtable-3level.h
include/asm-x86/pgtable.h
include/asm-x86/pgtable_32.h
include/asm-x86/pgtable_64.h
include/asm-x86/posix_types_32.h
include/asm-x86/posix_types_64.h
include/asm-x86/prctl.h
include/asm-x86/processor-flags.h
include/asm-x86/processor.h
include/asm-x86/proto.h
include/asm-x86/ptrace-abi.h
include/asm-x86/ptrace.h
include/asm-x86/pvclock-abi.h
include/asm-x86/pvclock.h
include/asm-x86/reboot.h
include/asm-x86/reboot_fixups.h
include/asm-x86/required-features.h
include/asm-x86/resume-trace.h
include/asm-x86/rio.h
include/asm-x86/rwlock.h
include/asm-x86/rwsem.h
include/asm-x86/scatterlist.h
include/asm-x86/seccomp_32.h
include/asm-x86/seccomp_64.h
include/asm-x86/segment.h
include/asm-x86/sembuf.h
include/asm-x86/serial.h
include/asm-x86/setup.h
include/asm-x86/shmbuf.h
include/asm-x86/shmparam.h
include/asm-x86/sigcontext.h
include/asm-x86/sigcontext32.h
include/asm-x86/siginfo.h
include/asm-x86/signal.h
include/asm-x86/smp.h
include/asm-x86/socket.h
include/asm-x86/sockios.h
include/asm-x86/sparsemem.h
include/asm-x86/spinlock.h
include/asm-x86/spinlock_types.h
include/asm-x86/srat.h
include/asm-x86/stacktrace.h
include/asm-x86/stat.h
include/asm-x86/statfs.h
include/asm-x86/string_32.h
include/asm-x86/string_64.h
include/asm-x86/suspend_32.h
include/asm-x86/suspend_64.h
include/asm-x86/swiotlb.h
include/asm-x86/sync_bitops.h
include/asm-x86/syscall.h [new file with mode: 0644]
include/asm-x86/syscalls.h [new file with mode: 0644]
include/asm-x86/system.h
include/asm-x86/system_64.h
include/asm-x86/tce.h
include/asm-x86/termbits.h
include/asm-x86/termios.h
include/asm-x86/therm_throt.h
include/asm-x86/thread_info.h
include/asm-x86/time.h
include/asm-x86/timer.h
include/asm-x86/timex.h
include/asm-x86/tlb.h
include/asm-x86/tlbflush.h
include/asm-x86/topology.h
include/asm-x86/trampoline.h
include/asm-x86/traps.h
include/asm-x86/tsc.h
include/asm-x86/types.h
include/asm-x86/uaccess.h
include/asm-x86/uaccess_32.h
include/asm-x86/uaccess_64.h
include/asm-x86/ucontext.h
include/asm-x86/unaligned.h
include/asm-x86/unistd_32.h
include/asm-x86/unistd_64.h
include/asm-x86/unwind.h
include/asm-x86/user32.h
include/asm-x86/user_32.h
include/asm-x86/user_64.h
include/asm-x86/uv/bios.h
include/asm-x86/uv/uv_bau.h
include/asm-x86/uv/uv_hub.h
include/asm-x86/uv/uv_mmrs.h
include/asm-x86/vdso.h
include/asm-x86/vga.h
include/asm-x86/vgtod.h
include/asm-x86/visws/cobalt.h
include/asm-x86/visws/lithium.h
include/asm-x86/visws/piix4.h
include/asm-x86/vm86.h
include/asm-x86/vmi_time.h
include/asm-x86/vsyscall.h
include/asm-x86/xen/events.h
include/asm-x86/xen/grant_table.h
include/asm-x86/xen/hypercall.h
include/asm-x86/xen/hypervisor.h
include/asm-x86/xen/interface.h
include/asm-x86/xen/interface_32.h
include/asm-x86/xen/interface_64.h
include/asm-x86/xen/page.h
include/linux/ata.h
include/linux/cnt32_to_63.h [moved from arch/arm/include/asm/cnt32_to_63.h with 87% similarity]
include/linux/hrtimer.h
include/linux/ide.h
include/linux/libata.h
include/linux/mlx4/device.h
include/linux/pci.h
include/linux/pnp.h
include/linux/ramfs.h
include/linux/smb.h
include/linux/stacktrace.h
include/net/9p/9p.h
include/net/9p/transport.h
include/net/sctp/sm.h
init/main.c
kernel/cgroup.c
kernel/exit.c
kernel/hrtimer.c
kernel/kexec.c
kernel/kgdb.c
kernel/posix-timers.c
kernel/sched.c
kernel/sched_rt.c
kernel/time/clockevents.c
kernel/time/tick-broadcast.c
kernel/time/tick-common.c
kernel/time/tick-internal.h
kernel/time/tick-sched.c
kernel/trace/trace_sysprof.c
mm/highmem.c
mm/memcontrol.c
mm/page_alloc.c
mm/page_isolation.c
mm/slob.c
mm/slub.c
mm/tiny-shmem.c
net/9p/client.c
net/9p/conv.c
net/9p/mod.c
net/9p/trans_fd.c
net/9p/trans_virtio.c
net/ax25/af_ax25.c
net/ax25/ax25_std_timer.c
net/core/dev.c
net/core/rtnetlink.c
net/ipv4/tcp_hybla.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv4/udp.c
net/ipv6/netfilter/ip6t_hbh.c
net/ipv6/route.c
net/ipv6/tcp_ipv6.c
net/iucv/iucv.c
net/key/af_key.c
net/netrom/af_netrom.c
net/sched/sch_generic.c
net/sctp/associola.c
net/sctp/output.c
net/sctp/sm_make_chunk.c
net/sctp/sm_statefuns.c
net/socket.c
net/xfrm/xfrm_output.c
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kernel-doc
scripts/mod/modpost.c
security/selinux/ss/services.c
sound/core/pcm.c
sound/core/pcm_native.c
sound/core/rawmidi.c
sound/pci/hda/patch_sigmatel.c
sound/ppc/awacs.c
sound/soc/at32/at32-pcm.c
sound/soc/codecs/cs4270.c
sound/soc/codecs/wm8753.c

index 726084286d33e626ddc2bf69db078cdc972c0e4e..dfab12f809ed9c678638844ced3717742986ab26 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -96,4 +96,6 @@ Tejun Heo <htejun@gmail.com>
 Thomas Graf <tgraf@suug.ch>
 Tony Luck <tony.luck@intel.com>
 Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com>
+Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
+Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
 Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
index 5b5aba404aacb69160f0d88301be0a76aea78682..73060819ed99c6889c716cf922e1997f37f4a0b0 100644 (file)
@@ -251,8 +251,6 @@ mono.txt
        - how to execute Mono-based .NET binaries with the help of BINFMT_MISC.
 moxa-smartio
        - file with info on installing/using Moxa multiport serial driver.
-mtrr.txt
-       - how to use PPro Memory Type Range Registers to increase performance.
 mutex-design.txt
        - info on the generic mutex subsystem.
 namespaces/
index b463ecd0c7cebf36f53104015afcbeeccf4b934d..c74fec8c2351168d1329c527183f3a975234030e 100644 (file)
@@ -740,7 +740,7 @@ failure can be determined by:
        dma_addr_t dma_handle;
 
        dma_handle = pci_map_single(pdev, addr, size, direction);
-       if (pci_dma_mapping_error(dma_handle)) {
+       if (pci_dma_mapping_error(pdev, dma_handle)) {
                /*
                 * reduce current DMA mapping usage,
                 * delay and try again later or
index c2371c5a98f99b5eaa785bd0affd6c40187e84e3..48a3955f05fcd9c5f7548aadf7557062f1aabdb1 100644 (file)
@@ -77,7 +77,8 @@ documentation files are also added which explain how to use the feature.
 When a kernel change causes the interface that the kernel exposes to
 userspace to change, it is recommended that you send the information or
 a patch to the manual pages explaining the change to the manual pages
-maintainer at mtk.manpages@gmail.com.
+maintainer at mtk.manpages@gmail.com, and CC the list
+linux-api@vger.kernel.org.
 
 Here is a list of files that are in the kernel source tree that are
 required reading:
index da10e0714241fbef07ac394a741e3276723591fb..21f0795af20f1a6a3c34569f10ac05d72e8b75b4 100644 (file)
@@ -67,6 +67,8 @@ kernel patches.
 
 19: All new userspace interfaces are documented in Documentation/ABI/.
     See Documentation/ABI/README for more information.
+    Patches that change userspace interfaces should be CCed to
+    linux-api@vger.kernel.org.
 
 20: Check that it all passes `make headers_check'.
 
index ffdb5323df378b84963e4f91cd1470ff17865b6d..3d0b915035b9f28fbcff7d83a91ef016d4d7b2ad 100644 (file)
@@ -35,11 +35,9 @@ Mailing List
 ------------
 There is a CPU frequency changing CVS commit and general list where
 you can report bugs, problems or submit patches. To post a message,
-send an email to cpufreq@lists.linux.org.uk, to subscribe go to
-http://lists.linux.org.uk/mailman/listinfo/cpufreq. Previous post to the
-mailing list are available to subscribers at
-http://lists.linux.org.uk/mailman/private/cpufreq/.
-
+send an email to cpufreq@vger.kernel.org, to subscribe go to
+http://vger.kernel.org/vger-lists.html#cpufreq and follow the
+instructions there.
 
 Links
 -----
@@ -50,7 +48,7 @@ how to access the CVS repository:
 * http://cvs.arm.linux.org.uk/
 
 the CPUFreq Mailing list:
-* http://lists.linux.org.uk/mailman/listinfo/cpufreq
+* http://vger.kernel.org/vger-lists.html#cpufreq
 
 Clock and voltage scaling for the SA-1100:
 * http://www.lartmaker.nl/projects/scaling
index 2126de34c71161a3e6f22ddbfe082725b01cfc24..1cbf671822e23d063c648984c145149792978c62 100644 (file)
@@ -14,14 +14,14 @@ Description
 
 This driver implements support for the Analog Devices ADT7473 chip family.
 
-The LM85 uses the 2-wire interface compatible with the SMBUS 2.0
+The ADT7473 uses the 2-wire interface compatible with the SMBUS 2.0
 specification. Using an analog to digital converter it measures three (3)
-temperatures and two (2) voltages. It has three (3) 16-bit counters for
+temperatures and two (2) voltages. It has four (4) 16-bit counters for
 measuring fan speed. There are three (3) PWM outputs that can be used
 to control fan speed.
 
 A sophisticated control system for the PWM outputs is designed into the
-LM85 that allows fan speed to be adjusted automatically based on any of the
+ADT7473 that allows fan speed to be adjusted automatically based on any of the
 three temperature sensors. Each PWM output is individually adjustable and
 programmable. Once configured, the ADT7473 will adjust the PWM outputs in
 response to the measured temperatures without further host intervention.
@@ -46,14 +46,6 @@ from the raw value to get the temperature value.
 The Analog Devices datasheet is very detailed and describes a procedure for
 determining an optimal configuration for the automatic PWM control.
 
-Hardware Configurations
------------------------
-
-The ADT7473 chips have an optional SMBALERT output that can be used to
-signal the chipset in case a limit is exceeded or the temperature sensors
-fail. Individual sensor interrupts can be masked so they won't trigger
-SMBALERT. The SMBALERT output if configured replaces the PWM2 function.
-
 Configuration Notes
 -------------------
 
@@ -61,8 +53,8 @@ Besides standard interfaces driver adds the following:
 
 * PWM Control
 
-* pwm#_auto_point1_pwm and pwm#_auto_point1_temp and
-* pwm#_auto_point2_pwm and pwm#_auto_point2_temp -
+* pwm#_auto_point1_pwm and temp#_auto_point1_temp and
+* pwm#_auto_point2_pwm and temp#_auto_point2_temp -
 
 point1: Set the pwm speed at a lower temperature bound.
 point2: Set the pwm speed at a higher temperature bound.
index 2d845730d4e0e81c65ff5ceb5299a79724daf62f..6dbfd5efd991de9f6a69eaa831d1a45634ba5979 100644 (file)
@@ -329,6 +329,10 @@ power[1-*]_average         Average power use
                                Unit: microWatt
                                RO
 
+power[1-*]_average_interval    Power use averaging interval
+                               Unit: milliseconds
+                               RW
+
 power[1-*]_average_highest     Historical average maximum power use
                                Unit: microWatt
                                RO
@@ -353,6 +357,14 @@ power[1-*]_reset_history   Reset input_highest, input_lowest,
                                average_highest and average_lowest.
                                WO
 
+**********
+* Energy *
+**********
+
+energy[1-*]_input              Cumulative energy use
+                               Unit: microJoule
+                               RO
+
 **********
 * Alarms *
 **********
index 62d4af44ec4a2e0a4987d48687dc0bd1d01dcbf0..59df81c8da2b86dd71394ccb85ab34bc1cba4595 100644 (file)
@@ -271,14 +271,14 @@ CDROMCLOSETRAY                    pendant of CDROMEJECT
 
        usage:
 
-         ioctl(fd, CDROMEJECT, 0);
+         ioctl(fd, CDROMCLOSETRAY, 0);
 
        inputs:         none
 
        outputs:        none
 
        error returns:
-         ENOSYS        cd drive not capable of ejecting
+         ENOSYS        cd drive not capable of closing the tray
          EBUSY         other processes are accessing drive, or door is locked
 
        notes:
index 040ce30632b57d925029a17294fd39e06bbda6bd..a2701cb6b37a961a0267819a09f5759a49901c32 100644 (file)
@@ -468,12 +468,6 @@ and is between 256 and 4096 characters. It is defined in the file
                        Range: 0 - 8192
                        Default: 64
 
-       disable_8254_timer
-       enable_8254_timer
-                       [IA32/X86_64] Disable/Enable interrupt 0 timer routing
-                       over the 8254 in addition to over the IO-APIC. The
-                       kernel tries to set a sensible default.
-
        hpet=           [X86-32,HPET] option to control HPET usage
                        Format: { enable (default) | disable | force }
                        disable: disable HPET and use PIT instead
@@ -1887,6 +1881,12 @@ and is between 256 and 4096 characters. It is defined in the file
        shapers=        [NET]
                        Maximal number of shapers.
 
+       show_msr=       [x86] show boot-time MSR settings
+                       Format: { <integer> }
+                       Show boot-time (BIOS-initialized) MSR settings.
+                       The parameter means the number of CPUs to show,
+                       for example 1 means boot CPU only.
+
        sim710=         [SCSI,HW]
                        See header of drivers/scsi/sim710.c.
 
index 276a7e6378227b5931be236104509fe62da2d4ad..e1ff0d920a5ce48b2a05d8f71584668e2817cf49 100644 (file)
@@ -351,9 +351,10 @@ kernel.  This value defaults to SHMMAX.
 
 softlockup_thresh:
 
-This value can be used to lower the softlockup tolerance
-threshold. The default threshold is 10s.  If a cpu is locked up
-for 10s, the kernel complains.  Valid values are 1-60s.
+This value can be used to lower the softlockup tolerance threshold.  The
+default threshold is 60 seconds.  If a cpu is locked up for 60 seconds,
+the kernel complains.  Valid values are 1-60 seconds.  Setting this
+tunable to zero will disable the softlockup detection altogether.
 
 ==============================================================
 
index 7304bcf5a3062fd58e70cfce160d85cab0dff7d5..5e6b64c20d258dbadf9b46f72f8717779ea05a6c 100644 (file)
@@ -42,9 +42,21 @@ This function kills all URBs associated with an anchor. The URBs
 are called in the reverse temporal order they were submitted.
 This way no data can be reordered.
 
+usb_unlink_anchored_urbs()
+--------------------------
+
+This function unlinks all URBs associated with an anchor. The URBs
+are processed in the reverse temporal order they were submitted.
+This is similar to usb_kill_anchored_urbs(), but it will not sleep.
+Therefore no guarantee is made that the URBs have been unlinked when
+the call returns. They may be unlinked later but will be unlinked in
+finite time.
+
 usb_wait_anchor_empty_timeout()
 -------------------------------
 
 This function waits for all URBs associated with an anchor to finish
 or a timeout, whichever comes first. Its return value will tell you
 whether the timeout was reached.
+
+
index 89c7f32abf9f2d8a43f98dc892b8ca9b8bad9a24..53449cb99b17c71e3714949b090fd2252e7e4492 100644 (file)
@@ -46,7 +46,7 @@
  45 -> Pinnacle PCTV DVB-T                      (em2870)
  46 -> Compro, VideoMate U3                     (em2870)        [185b:2870]
  47 -> KWorld DVB-T 305U                        (em2880)        [eb1a:e305]
- 48 -> KWorld DVB-T 310U                        (em2880)
+ 48 -> KWorld DVB-T 310U                        (em2880)        [eb1a:e310]
  49 -> MSI DigiVox A/D                          (em2880)        [eb1a:e310]
  50 -> MSI DigiVox A/D II                       (em2880)        [eb1a:e320]
  51 -> Terratec Hybrid XS Secam                 (em2880)        [0ccd:004c]
index 0f03900c48fbceac0fe2caf9979c14fc3421fb0f..9a3e4d797fa858d0925e30d64be6c381fe6bae24 100644 (file)
@@ -190,6 +190,7 @@ pac7311             093a:260f       SnakeCam
 pac7311                093a:2621       PAC731x
 pac7311                093a:2624       PAC7302
 pac7311                093a:2626       Labtec 2200
+pac7311                093a:262a       Webcam 300k
 zc3xx          0ac8:0302       Z-star Vimicro zc0302
 vc032x         0ac8:0321       Vimicro generic vc0321
 vc032x         0ac8:0323       Vimicro Vc0323
diff --git a/Documentation/x86/00-INDEX b/Documentation/x86/00-INDEX
new file mode 100644 (file)
index 0000000..dbe3377
--- /dev/null
@@ -0,0 +1,4 @@
+00-INDEX
+       - this file
+mtrr.txt
+       - how to use x86 Memory Type Range Registers to increase performance
similarity index 99%
rename from Documentation/x86/i386/boot.txt
rename to Documentation/x86/boot.txt
index 147bfe511cdda0d923ca1094a27daac02225af53..83c0033ee9e01d26866494b58115a1da9b2c429a 100644 (file)
@@ -308,7 +308,7 @@ Protocol:   2.00+
 
 Field name:    start_sys
 Type:          read
-Offset/size:   0x20c/4
+Offset/size:   0x20c/2
 Protocol:      2.00+
 
   The load low segment (0x1000).  Obsolete.
similarity index 99%
rename from Documentation/mtrr.txt
rename to Documentation/x86/mtrr.txt
index c39ac395970ecfa7ee58dada23478c886952a415..cc071dc333c213676f2af659f318d7f836f2278a 100644 (file)
@@ -18,7 +18,7 @@ Richard Gooch
   The AMD K6-2 (stepping 8 and above) and K6-3 processors have two
   MTRRs. These are supported.  The AMD Athlon family provide 8 Intel
   style MTRRs.
-  
+
   The Centaur C6 (WinChip) has 8 MCRs, allowing write-combining. These
   are supported.
 
@@ -87,7 +87,7 @@ reg00: base=0x00000000 (   0MB), size=  64MB: write-back, count=1
 reg01: base=0xfb000000 (4016MB), size=  16MB: write-combining, count=1
 reg02: base=0xfb000000 (4016MB), size=   4kB: uncachable, count=1
 
-Some cards (especially Voodoo Graphics boards) need this 4 kB area 
+Some cards (especially Voodoo Graphics boards) need this 4 kB area
 excluded from the beginning of the region because it is used for
 registers.
 
index 17965f927c1583e61281e5701b951253c95bf278..c93ff5f4c0ddc0e979daa1ad0e950c8c1c6e31c1 100644 (file)
@@ -14,6 +14,10 @@ PAT allows for different types of memory attributes. The most commonly used
 ones that will be supported at this time are Write-back, Uncached,
 Write-combined and Uncached Minus.
 
+
+PAT APIs
+--------
+
 There are many different APIs in the kernel that allows setting of memory
 attributes at the page level. In order to avoid aliasing, these interfaces
 should be used thoughtfully. Below is a table of interfaces available,
@@ -26,38 +30,38 @@ address range to avoid any aliasing.
 API                    |    RAM   |  ACPI,...  |  Reserved/Holes  |
 -----------------------|----------|------------|------------------|
                        |          |            |                  |
-ioremap                |    --    |    UC      |       UC         |
+ioremap                |    --    |    UC-     |       UC-        |
                        |          |            |                  |
 ioremap_cache          |    --    |    WB      |       WB         |
                        |          |            |                  |
-ioremap_nocache        |    --    |    UC      |       UC         |
+ioremap_nocache        |    --    |    UC-     |       UC-        |
                        |          |            |                  |
 ioremap_wc             |    --    |    --      |       WC         |
                        |          |            |                  |
-set_memory_uc          |    UC    |    --      |       --         |
+set_memory_uc          |    UC-   |    --      |       --         |
  set_memory_wb         |          |            |                  |
                        |          |            |                  |
 set_memory_wc          |    WC    |    --      |       --         |
  set_memory_wb         |          |            |                  |
                        |          |            |                  |
-pci sysfs resource     |    --    |    --      |       UC         |
+pci sysfs resource     |    --    |    --      |       UC-        |
                        |          |            |                  |
 pci sysfs resource_wc  |    --    |    --      |       WC         |
  is IORESOURCE_PREFETCH|          |            |                  |
                        |          |            |                  |
-pci proc               |    --    |    --      |       UC         |
+pci proc               |    --    |    --      |       UC-        |
  !PCIIOC_WRITE_COMBINE |          |            |                  |
                        |          |            |                  |
 pci proc               |    --    |    --      |       WC         |
  PCIIOC_WRITE_COMBINE  |          |            |                  |
                        |          |            |                  |
-/dev/mem               |    --    |    UC      |       UC         |
+/dev/mem               |    --    |  WB/WC/UC- |    WB/WC/UC-     |
  read-write            |          |            |                  |
                        |          |            |                  |
-/dev/mem               |    --    |    UC      |       UC         |
+/dev/mem               |    --    |    UC-     |       UC-        |
  mmap SYNC flag        |          |            |                  |
                        |          |            |                  |
-/dev/mem               |    --    |  WB/WC/UC  |    WB/WC/UC      |
+/dev/mem               |    --    |  WB/WC/UC- |    WB/WC/UC-     |
  mmap !SYNC flag       |          |(from exist-|  (from exist-    |
  and                   |          |  ing alias)|    ing alias)    |
  any alias to this area|          |            |                  |
@@ -68,7 +72,7 @@ pci proc               |    --    |    --      |       WC         |
  and                   |          |            |                  |
  MTRR says WB          |          |            |                  |
                        |          |            |                  |
-/dev/mem               |    --    |    --      |    UC_MINUS      |
+/dev/mem               |    --    |    --      |       UC-        |
  mmap !SYNC flag       |          |            |                  |
  no alias to this area |          |            |                  |
  and                   |          |            |                  |
@@ -98,3 +102,35 @@ types.
 
 Drivers should use set_memory_[uc|wc] to set access type for RAM ranges.
 
+
+PAT debugging
+-------------
+
+With CONFIG_DEBUG_FS enabled, PAT memtype list can be examined by
+
+# mount -t debugfs debugfs /sys/kernel/debug
+# cat /sys/kernel/debug/x86/pat_memtype_list
+PAT memtype list:
+uncached-minus @ 0x7fadf000-0x7fae0000
+uncached-minus @ 0x7fb19000-0x7fb1a000
+uncached-minus @ 0x7fb1a000-0x7fb1b000
+uncached-minus @ 0x7fb1b000-0x7fb1c000
+uncached-minus @ 0x7fb1c000-0x7fb1d000
+uncached-minus @ 0x7fb1d000-0x7fb1e000
+uncached-minus @ 0x7fb1e000-0x7fb25000
+uncached-minus @ 0x7fb25000-0x7fb26000
+uncached-minus @ 0x7fb26000-0x7fb27000
+uncached-minus @ 0x7fb27000-0x7fb28000
+uncached-minus @ 0x7fb28000-0x7fb2e000
+uncached-minus @ 0x7fb2e000-0x7fb2f000
+uncached-minus @ 0x7fb2f000-0x7fb30000
+uncached-minus @ 0x7fb31000-0x7fb32000
+uncached-minus @ 0x80000000-0x90000000
+
+This list shows physical address ranges and various PAT settings used to
+access those physical address ranges.
+
+Another, more verbose way of getting PAT related debug messages is with
+"debugpat" boot parameter. With this parameter, various debug messages are
+printed to dmesg log.
+
index b0c7b6c4abda9362e38955dfee572a064dd6b992..72ffb5373ec73ac9ee8c9d05491effa7b5f8a42c 100644 (file)
@@ -54,10 +54,6 @@ APICs
                 apicmaintimer. Useful when your PIT timer is totally
                 broken.
 
-   disable_8254_timer / enable_8254_timer
-                Enable interrupt 0 timer routing over the 8254 in addition to over
-                the IO-APIC. The kernel tries to set a sensible default.
-
 Early Console
 
    syntax: earlyprintk=vga
index 9ac82eab82ee11c85c25acd2e74fba8b03d4d978..3c124d7989e0d36edd4b549ba940b41e81374c6a 100644 (file)
@@ -271,20 +271,20 @@ W:        http://www.lesswatts.org/projects/acpi/
 S:     Supported
 
 ACPI WMI DRIVER
-P:      Carlos Corbacho
-M:      carlos@strangeworlds.co.uk
-L:      linux-acpi@vger.kernel.org
-W:      http://www.lesswatts.org/projects/acpi/
-S:      Maintained
+P:     Carlos Corbacho
+M:     carlos@strangeworlds.co.uk
+L:     linux-acpi@vger.kernel.org
+W:     http://www.lesswatts.org/projects/acpi/
+S:     Maintained
 
 AD1889 ALSA SOUND DRIVER
-P:     Kyle McMartin
-M:     kyle@mcmartin.ca
-P:     Thibaut Varene
-M:     T-Bone@parisc-linux.org
-W:     http://wiki.parisc-linux.org/AD1889
-L:     linux-parisc@vger.kernel.org
-S:     Maintained
+P:     Kyle McMartin
+M:     kyle@mcmartin.ca
+P:     Thibaut Varene
+M:     T-Bone@parisc-linux.org
+W:     http://wiki.parisc-linux.org/AD1889
+L:     linux-parisc@vger.kernel.org
+S:     Maintained
 
 ADM1025 HARDWARE MONITOR DRIVER
 P:     Jean Delvare
@@ -474,11 +474,11 @@ L:        linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
 S:     Maintained
 
 ARM/ATMEL AT91RM9200 ARM ARCHITECTURE
-P:      Andrew Victor
-M:      linux@maxim.org.za
-L:      linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
-W:      http://maxim.org.za/at91_26.html
-S:      Maintained
+P:     Andrew Victor
+M:     linux@maxim.org.za
+L:     linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
+W:     http://maxim.org.za/at91_26.html
+S:     Maintained
 
 ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE
 P:     Lennert Buytenhek
@@ -533,10 +533,10 @@ L:        linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
 S:     Maintained
 
 ARM/HP JORNADA 7XX MACHINE SUPPORT
-P:      Kristoffer Ericson
-M:      kristoffer.ericson@gmail.com
-W:      www.jlime.com
-S:      Maintained
+P:     Kristoffer Ericson
+M:     kristoffer.ericson@gmail.com
+W:     www.jlime.com
+S:     Maintained
 
 ARM/INTEL IOP32X ARM ARCHITECTURE
 P:     Lennert Buytenhek
@@ -1018,7 +1018,7 @@ T:        git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
 S:     Maintained
 
 CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER
-P:     Jonathan Corbet
+P:     Jonathan Corbet
 M:     corbet@lwn.net
 L:     video4linux-list@redhat.com
 S:     Maintained
@@ -1199,9 +1199,7 @@ M:        hpa@zytor.com
 S:     Maintained
 
 CPUSETS
-P:     Paul Jackson
 P:     Paul Menage
-M:     pj@sgi.com
 M:     menage@google.com
 L:     linux-kernel@vger.kernel.org
 W:     http://www.bullopensource.org/cpuset/
@@ -1360,7 +1358,7 @@ P:        Digi International, Inc
 M:     Eng.Linux@digi.com
 L:     Eng.Linux@digi.com
 W:     http://www.digi.com
-S:     Orphaned
+S:     Orphan
 
 DIRECTORY NOTIFICATION
 P:     Stephen Rothwell
@@ -1424,12 +1422,12 @@ L:      linux-acpi@vger.kernel.org
 S:     Supported
 
 DOCUMENTATION (/Documentation directory)
-P:     Michael Kerrisk
-M:     mtk.manpages@gmail.com
-P:     Randy Dunlap
-M:     rdunlap@xenotime.net
-L:     linux-doc@vger.kernel.org
-S:     Maintained
+P:     Michael Kerrisk
+M:     mtk.manpages@gmail.com
+P:     Randy Dunlap
+M:     rdunlap@xenotime.net
+L:     linux-doc@vger.kernel.org
+S:     Maintained
 
 DOUBLETALK DRIVER
 P:     James R. Van Zandt
@@ -1460,7 +1458,7 @@ S:        Maintained
 DVB SUBSYSTEM AND DRIVERS
 P:     LinuxTV.org Project
 M:     v4l-dvb-maintainer@linuxtv.org
-L:     linux-dvb@linuxtv.org (subscription required)
+L:     linux-dvb@linuxtv.org (subscription required)
 W:     http://linuxtv.org/
 T:     git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
 S:     Maintained
@@ -1798,7 +1796,7 @@ FUTURE DOMAIN TMC-16x0 SCSI DRIVER (16-bit)
 P:     Rik Faith
 M:     faith@cs.unc.edu
 L:     linux-scsi@vger.kernel.org
-S:     Odd fixes (e.g., new signatures)
+S:     Odd Fixes (e.g., new signatures)
 
 GDT SCSI DISK ARRAY CONTROLLER DRIVER
 P:     Achim Leubner
@@ -1839,10 +1837,10 @@ S:      Maintained
 HARDWARE MONITORING
 L:     lm-sensors@lm-sensors.org
 W:     http://www.lm-sensors.org/
-S:     Orphaned
+S:     Orphan
 
 HARDWARE RANDOM NUMBER GENERATOR CORE
-S:     Orphaned
+S:     Orphan
 
 HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
 P:     Robert Love
@@ -1985,7 +1983,7 @@ S:        Maintained
 I2C/SMBUS STUB DRIVER
 P:     Mark M. Hoffman
 M:     mhoffman@lightlink.com
-L:     lm-sensors@lm-sensors.org
+L:     i2c@lm-sensors.org
 S:     Maintained
 
 I2C SUBSYSTEM
@@ -2109,7 +2107,7 @@ M:        rolandd@cisco.com
 P:     Sean Hefty
 M:     sean.hefty@intel.com
 P:     Hal Rosenstock
-M:     hal.rosenstock@gmail.com 
+M:     hal.rosenstock@gmail.com
 L:     general@lists.openfabrics.org
 W:     http://www.openib.org/
 T:     git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
@@ -2697,17 +2695,18 @@ S:      Maintained
 
 MARVELL YUKON / SYSKONNECT DRIVER
 P:     Mirko Lindner
-M:     mlindner@syskonnect.de
+M:     mlindner@syskonnect.de
 P:     Ralph Roesler
-M:     rroesler@syskonnect.de
-W:     http://www.syskonnect.com
-S:     Supported
+M:     rroesler@syskonnect.de
+W:     http://www.syskonnect.com
+S:     Supported
 
 MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
 P:     Michael Kerrisk
 M:     mtk.manpages@gmail.com
-W:     http://www.kernel.org/doc/man-pages
-S:     Supported
+W:     http://www.kernel.org/doc/man-pages
+L:     linux-man@vger.kernel.org
+S:     Supported
 
 MARVELL LIBERTAS WIRELESS DRIVER
 P:     Dan Williams
@@ -2736,7 +2735,7 @@ S:        Maintained
 MEGARAID SCSI DRIVERS
 P:     Neela Syam Kolli
 M:     megaraidlinux@lsi.com
-S:     linux-scsi@vger.kernel.org
+L:     linux-scsi@vger.kernel.org
 W:     http://megaraid.lsilogic.com
 S:     Maintained
 
@@ -2854,7 +2853,7 @@ MULTIMEDIA CARD (MMC) ETC. OVER SPI
 P:     David Brownell
 M:     dbrownell@users.sourceforge.net
 L:     linux-kernel@vger.kernel.org
-S:     Odd fixes
+S:     Odd Fixes
 
 MULTISOUND SOUND DRIVER
 P:     Andrew Veliath
@@ -2868,10 +2867,10 @@ L:      linux-kernel@vger.kernel.org
 S:     Maintained
 
 MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
-P:     Felipe Balbi
-M:     felipe.balbi@nokia.com
-L:     linux-usb@vger.kernel.org
-S:     Maintained
+P:     Felipe Balbi
+M:     felipe.balbi@nokia.com
+L:     linux-usb@vger.kernel.org
+S:     Maintained
 
 MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
 P:     Andrew Gallatin
@@ -2883,7 +2882,7 @@ W:        http://www.myri.com/scs/download-Myri10GE.html
 S:     Supported
 
 NATSEMI ETHERNET DRIVER (DP8381x)
-P:     Tim Hockin
+P:     Tim Hockin
 M:     thockin@hockin.org
 S:     Maintained
 
@@ -3102,7 +3101,7 @@ M:        laforge@gnumonks.org
 S:     Maintained
 
 OMNIVISION OV7670 SENSOR DRIVER
-P:     Jonathan Corbet
+P:     Jonathan Corbet
 M:     corbet@lwn.net
 L:     video4linux-list@redhat.com
 S:     Maintained
@@ -3212,7 +3211,7 @@ T:        git kernel.org:/pub/scm/linux/kernel/git/jbarnes/pci-2.6.git
 S:     Supported
 
 PCI HOTPLUG CORE
-P:     Kristen Carlson Accardi
+P:     Kristen Carlson Accardi
 M:     kristen.c.accardi@intel.com
 S:     Supported
 
@@ -3651,7 +3650,7 @@ M:        jmorris@namei.org
 P:     Eric Paris
 M:     eparis@parisplace.org
 L:     linux-kernel@vger.kernel.org (kernel issues)
-L:     selinux@tycho.nsa.gov (subscribers-only, general discussion)
+L:     selinux@tycho.nsa.gov (subscribers-only, general discussion)
 W:     http://www.nsa.gov/selinux
 S:     Supported
 
@@ -3727,7 +3726,7 @@ S:        Maintained
 SIS 96X I2C/SMBUS DRIVER
 P:     Mark M. Hoffman
 M:     mhoffman@lightlink.com
-L:     lm-sensors@lm-sensors.org
+L:     i2c@lm-sensors.org
 S:     Maintained
 
 SIS FRAMEBUFFER DRIVER
@@ -3769,10 +3768,10 @@ M:      bn@niasdigital.com
 S:     Maintained
 
 SOC-CAMERA V4L2 SUBSYSTEM
-P:     Guennadi Liakhovetski
-M:     g.liakhovetski@gmx.de
-L:     video4linux-list@redhat.com
-S:     Maintained
+P:     Guennadi Liakhovetski
+M:     g.liakhovetski@gmx.de
+L:     video4linux-list@redhat.com
+S:     Maintained
 
 SOFTWARE RAID (Multiple Disks) SUPPORT
 P:     Ingo Molnar
@@ -3834,11 +3833,12 @@ S:      Maintained
 
 SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT
 P:     Liam Girdwood
-M:     liam.girdwood@wolfsonmicro.com
+M:     lrg@slimlogic.co.uk
 P:     Mark Brown
 M:     broonie@opensource.wolfsonmicro.com
 T:     git opensource.wolfsonmicro.com/linux-2.6-asoc
 L:     alsa-devel@alsa-project.org (subscribers-only)
+W:     http://alsa-project.org/main/index.php/ASoC
 S:     Supported
 
 SPI SUBSYSTEM
@@ -3926,7 +3926,7 @@ S:        Maintained
 
 STARMODE RADIO IP (STRIP) PROTOCOL DRIVER
 W:     http://mosquitonet.Stanford.EDU/strip.html
-S:     Unsupported ?
+S:     Orphan
 
 STRADIS MPEG-2 DECODER DRIVER
 P:     Nathan Laredo
@@ -4007,9 +4007,9 @@ T:        git repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
 S:     Maintained
 
 TI FLASH MEDIA INTERFACE DRIVER
-P:      Alex Dubov
-M:      oakad@yahoo.com
-S:      Maintained
+P:     Alex Dubov
+M:     oakad@yahoo.com
+S:     Maintained
 
 TI OMAP MMC INTERFACE DRIVER
 P:     Carlos Aguiar, Anderson Briglia and Syed Khasim
@@ -4155,13 +4155,13 @@ USB BLOCK DRIVER (UB ub)
 P:     Pete Zaitcev
 M:     zaitcev@redhat.com
 L:     linux-kernel@vger.kernel.org
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Supported
 
 USB CDC ETHERNET DRIVER
 P:     Greg Kroah-Hartman
 M:     greg@kroah.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Maintained
 W:     http://www.kroah.com/linux-usb/
 
@@ -4188,13 +4188,13 @@ S:      Maintained
 USB EHCI DRIVER
 P:     David Brownell
 M:     dbrownell@users.sourceforge.net
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Odd Fixes
 
 USB ET61X[12]51 DRIVER
 P:     Luca Risolia
 M:     luca.risolia@studio.unibo.it
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 L:     video4linux-list@redhat.com
 W:     http://www.linux-projects.org
 S:     Maintained
@@ -4202,33 +4202,33 @@ S:      Maintained
 USB GADGET/PERIPHERAL SUBSYSTEM
 P:     David Brownell
 M:     dbrownell@users.sourceforge.net
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 W:     http://www.linux-usb.org/gadget
 S:     Maintained
 
 USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
 P:     Jiri Kosina
 M:     jkosina@suse.cz
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 T:     git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git
 S:     Maintained
 
 USB ISP116X DRIVER
 P:     Olav Kongas
 M:     ok@artecdesign.ee
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Maintained
 
 USB KAWASAKI LSI DRIVER
 P:     Oliver Neukum
 M:     oliver@neukum.name
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Maintained
 
 USB MASS STORAGE DRIVER
 P:     Matthew Dharm
 M:     mdharm-usb@one-eyed-alien.net
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 L:     usb-storage@lists.one-eyed-alien.net
 S:     Maintained
 W:     http://www.one-eyed-alien.net/~mdharm/linux-usb/
@@ -4236,26 +4236,26 @@ W:      http://www.one-eyed-alien.net/~mdharm/linux-usb/
 USB OHCI DRIVER
 P:     David Brownell
 M:     dbrownell@users.sourceforge.net
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Odd Fixes
 
 USB OPTION-CARD DRIVER
 P:     Matthias Urlichs
 M:     smurf@smurf.noris.de
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Maintained
 
 USB OV511 DRIVER
 P:     Mark McClelland
 M:     mmcclell@bigfoot.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 W:     http://alpha.dyndns.org/ov511/
 S:     Maintained
 
 USB PEGASUS DRIVER
 P:     Petko Manolov
 M:     petkan@users.sourceforge.net
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 L:     netdev@vger.kernel.org
 W:     http://pegasus2.sourceforge.net/
 S:     Maintained
@@ -4263,13 +4263,13 @@ S:      Maintained
 USB PRINTER DRIVER (usblp)
 P:     Pete Zaitcev
 M:     zaitcev@redhat.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Supported
 
 USB RTL8150 DRIVER
 P:     Petko Manolov
 M:     petkan@users.sourceforge.net
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 L:     netdev@vger.kernel.org
 W:     http://pegasus2.sourceforge.net/
 S:     Maintained
@@ -4277,20 +4277,20 @@ S:      Maintained
 USB SE401 DRIVER
 P:     Jeroen Vreeken
 M:     pe1rxq@amsat.org
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 W:     http://www.chello.nl/~j.vreeken/se401/
 S:     Maintained
 
 USB SERIAL BELKIN F5U103 DRIVER
 P:     William Greathouse
 M:     wgreathouse@smva.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Maintained
 
 USB SERIAL CYPRESS M8 DRIVER
 P:     Lonnie Mendez
 M:     dignome@gmail.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Maintained
 W:     http://geocities.com/i0xox0i
 W:     http://firstlight.net/cvs
@@ -4305,39 +4305,39 @@ USB SERIAL DIGI ACCELEPORT DRIVER
 P:     Peter Berger and Al Borchers
 M:     pberger@brimson.com
 M:     alborchers@steinerpoint.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Maintained
 
 USB SERIAL DRIVER
 P:     Greg Kroah-Hartman
 M:     gregkh@suse.de
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Supported
 
 USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER
 P:     Gary Brubaker
 M:     xavyer@ix.netcom.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Maintained
 
 USB SERIAL KEYSPAN DRIVER
 P:     Greg Kroah-Hartman
 M:     greg@kroah.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 W:     http://www.kroah.com/linux/
 S:     Maintained
 
 USB SERIAL WHITEHEAT DRIVER
 P:     Support Department
 M:     support@connecttech.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 W:     http://www.connecttech.com
 S:     Supported
 
 USB SN9C1xx DRIVER
 P:     Luca Risolia
 M:     luca.risolia@studio.unibo.it
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 L:     video4linux-list@redhat.com
 W:     http://www.linux-projects.org
 S:     Maintained
@@ -4345,7 +4345,7 @@ S:        Maintained
 USB SUBSYSTEM
 P:     Greg Kroah-Hartman
 M:     gregkh@suse.de
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 W:     http://www.linux-usb.org
 T:     quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
 S:     Supported
@@ -4353,7 +4353,7 @@ S:        Supported
 USB UHCI DRIVER
 P:     Alan Stern
 M:     stern@rowland.harvard.edu
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 S:     Maintained
 
 USB "USBNET" DRIVER FRAMEWORK
@@ -4374,7 +4374,7 @@ S:        Maintained
 USB W996[87]CF DRIVER
 P:     Luca Risolia
 M:     luca.risolia@studio.unibo.it
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 L:     video4linux-list@redhat.com
 W:     http://www.linux-projects.org
 S:     Maintained
@@ -4388,7 +4388,7 @@ S:        Maintained
 USB ZC0301 DRIVER
 P:     Luca Risolia
 M:     luca.risolia@studio.unibo.it
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 L:     video4linux-list@redhat.com
 W:     http://www.linux-projects.org
 S:     Maintained
@@ -4396,14 +4396,14 @@ S:      Maintained
 USB ZD1201 DRIVER
 P:     Jeroen Vreeken
 M:     pe1rxq@amsat.org
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 W:     http://linux-lc100020.sourceforge.net
 S:     Maintained
 
 USB ZR364XX DRIVER
 P:     Antoine Jacquet
 M:     royale@zerezo.com
-L:      linux-usb@vger.kernel.org
+L:     linux-usb@vger.kernel.org
 L:     video4linux-list@redhat.com
 W:     http://royale.zerezo.com/zr364xx/
 S:     Maintained
index 4ff83ea36c1920e585a63937e9887d703af04089..16e3fbb968a8966bc58570ca117349631e81f2d7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 27
-EXTRAVERSION = -rc6
+EXTRAVERSION =
 NAME = Rotary Wombat
 
 # *DOCUMENTATION*
index aaffaecffcd13699dfd0cd51d2eaf61608e4a94d..ba8ccfede964d93a81c061633bd969916d85ebd5 100644 (file)
@@ -111,8 +111,6 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,
        case 'D':
        case 'k':
        case 'c':
-               kgdb_contthread = NULL;
-
                /*
                 * Try to read optional parameter, pc unchanged if no parm.
                 * If this was a compiled breakpoint, we need to move
index 720c48b9ee0404257cd218a3fe26b66a035a653d..aa2fc375a3257fcb4a1e5b8e468dc1af7c494650 100644 (file)
@@ -70,9 +70,6 @@ void davinci_psc_config(unsigned int domain, unsigned int id, char enable)
 {
        u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl, mdstat_mask;
 
-       if (id < 0)
-               return;
-
        mdctl = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + MDCTL + 4 * id);
        if (enable)
                mdctl |= 0x00000003;    /* Enable Module */
index 67e18509d7bfe6103b4d5062a307c0fe12c029e8..b0d6b32654cf622d13a9ac91073a2f1426381d97 100644 (file)
@@ -17,9 +17,9 @@
 #include <linux/interrupt.h>
 #include <linux/clockchips.h>
 #include <linux/sched.h>
+#include <linux/cnt32_to_63.h>
 
 #include <asm/div64.h>
-#include <asm/cnt32_to_63.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 #include <mach/pxa-regs.h>
index 1362994c78aa1ede98cdc4661cb1cb56623378e0..b422526f6d8baa3fb504b23ddc24ffc57f41512e 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/ioport.h>
 #include <linux/sched.h>       /* just for sched_clock() - funny that */
 #include <linux/platform_device.h>
+#include <linux/cnt32_to_63.h>
 
 #include <asm/div64.h>
-#include <asm/cnt32_to_63.h>
 #include <mach/hardware.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
index bc120850d313c1ea44e88fa99b76f93f833e6be9..cc6b4bfcecf6625edb3ad2a9b392b64f661db292 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * arch/arm/mach-sa1100/include/mach/jornada720.h
  *
- * This file contains SSP/MCU communication definitions for HP Jornada 710/720/728
+ * SSP/MCU communication definitions for HP Jornada 710/720/728
  *
- * Copyright (C) 2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
- *  Copyright (C) 2000 John Ankcorn <jca@lcs.mit.edu>
+ * Copyright 2007,2008 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
+ *  Copyright 2000 John Ankcorn <jca@lcs.mit.edu>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -25,3 +25,8 @@
 #define PWMOFF                 0xDF
 #define TXDUMMY                        0x11
 #define ERRORCODE              0x00
+
+extern void jornada_ssp_start(void);
+extern void jornada_ssp_end(void);
+extern int jornada_ssp_inout(u8 byte);
+extern int jornada_ssp_byte(u8 byte);
index 06ea7abd917009401e3bc1e5d0498ec8ed705507..28cf3696797705a3b263f14854675498d279f068 100644 (file)
@@ -21,8 +21,8 @@
 #include <linux/slab.h>
 
 #include <mach/hardware.h>
-#include <asm/hardware/ssp.h>
 #include <mach/jornada720.h>
+#include <asm/hardware/ssp.h>
 
 static DEFINE_SPINLOCK(jornada_ssp_lock);
 static unsigned long jornada_ssp_flags;
@@ -109,12 +109,12 @@ EXPORT_SYMBOL(jornada_ssp_inout);
  * jornada_ssp_start - enable mcu
  *
  */
-int jornada_ssp_start()
+void jornada_ssp_start(void)
 {
        spin_lock_irqsave(&jornada_ssp_lock, jornada_ssp_flags);
        GPCR = GPIO_GPIO25;
        udelay(50);
-       return 0;
+       return;
 };
 EXPORT_SYMBOL(jornada_ssp_start);
 
@@ -122,11 +122,11 @@ EXPORT_SYMBOL(jornada_ssp_start);
  * jornada_ssp_end - disable mcu and turn off lock
  *
  */
-int jornada_ssp_end()
+void jornada_ssp_end(void)
 {
        GPSR = GPIO_GPIO25;
        spin_unlock_irqrestore(&jornada_ssp_lock, jornada_ssp_flags);
-       return 0;
+       return;
 };
 EXPORT_SYMBOL(jornada_ssp_end);
 
index d75e795c893e494b725f4ad177350651e32a60e6..b638f10411e8e27b573f926133e141922512204b 100644 (file)
@@ -28,8 +28,8 @@
 #include <linux/amba/clcd.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
+#include <linux/cnt32_to_63.h>
 
-#include <asm/cnt32_to_63.h>
 #include <asm/system.h>
 #include <mach/hardware.h>
 #include <asm/io.h>
index bc1cf30c83e0d36360eab2b64b19309f58c3c90f..01da719a745366309dedb2a78ac17216dbbd342b 100644 (file)
@@ -316,19 +316,6 @@ static inline void omap_init_mmc_conf(const struct omap_mmc_config *mmc_conf)
                                omap_cfg_reg(MMC_DAT3);
                        }
                }
-#if defined(CONFIG_ARCH_OMAP2420)
-               if (mmc_conf->mmc[0].internal_clock) {
-                       /*
-                        * Use internal loop-back in MMC/SDIO
-                        * Module Input Clock selection
-                        */
-                       if (cpu_is_omap24xx()) {
-                               u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
-                               v |= (1 << 24); /* not used in 243x */
-                               omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
-                       }
-               }
-#endif
        }
 
 #ifdef CONFIG_ARCH_OMAP16XX
index ee4c292683e15a698656d22ba8068c89d5c9710b..dfc3443e23aa3df4cb0033c579a5f7a3d4679623 100644 (file)
@@ -325,7 +325,7 @@ static int __init atstk1002_init(void)
 #ifdef CONFIG_BOARD_ATSTK100X_SPI1
        at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
 #endif
-#ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
+#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
        at32_add_device_mci(0, MCI_PDATA);
 #endif
 #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM
diff --git a/arch/avr32/boot/images/.gitignore b/arch/avr32/boot/images/.gitignore
new file mode 100644 (file)
index 0000000..64ea9d0
--- /dev/null
@@ -0,0 +1,4 @@
+uImage
+uImage.srec
+vmlinux.cso
+sfdwarf.log
diff --git a/arch/avr32/kernel/.gitignore b/arch/avr32/kernel/.gitignore
new file mode 100644 (file)
index 0000000..c5f676c
--- /dev/null
@@ -0,0 +1 @@
+vmlinux.lds
index 84a7d44edc67e8acc981bb9b76343c747d76ab46..11e310c567a967bee5bb8ad31c13ed4c9a389cd8 100644 (file)
@@ -58,6 +58,7 @@ EXPORT_SYMBOL(find_first_zero_bit);
 EXPORT_SYMBOL(find_next_zero_bit);
 EXPORT_SYMBOL(find_first_bit);
 EXPORT_SYMBOL(find_next_bit);
+EXPORT_SYMBOL(generic_find_next_le_bit);
 EXPORT_SYMBOL(generic_find_next_zero_le_bit);
 
 /* I/O primitives (lib/io-*.S) */
index 890286a1e62b8c88147a4de13575814008a0e77c..673178e235f3a485005ecfd43415f86fad13ab9e 100644 (file)
@@ -109,3 +109,12 @@ __sys_epoll_pwait:
        rcall   sys_epoll_pwait
        sub     sp, -4
        popm    pc
+
+       .global __sys_sync_file_range
+       .type   __sys_sync_file_range,@function
+__sys_sync_file_range:
+       pushm   lr
+       st.w    --sp, ARG6
+       rcall   sys_sync_file_range
+       sub     sp, -4
+       popm    pc
index 478bda4c4a09a9ac57f119b4c8529d970cbc48e2..7ee0057613b3a70789663f604651bdbc319e2551 100644 (file)
@@ -275,7 +275,7 @@ sys_call_table:
        .long   sys_set_robust_list
        .long   sys_get_robust_list     /* 260 */
        .long   __sys_splice
-       .long   sys_sync_file_range
+       .long   __sys_sync_file_range
        .long   sys_tee
        .long   sys_vmsplice
        .long   __sys_epoll_pwait       /* 265 */
index b835c4c0136882e8320ddde56fe14d98d3f1201c..0d987373bc01b6b6424824711903b501294776da 100644 (file)
@@ -116,15 +116,15 @@ asmlinkage void do_nmi(unsigned long ecr, struct pt_regs *regs)
        switch (ret) {
        case NOTIFY_OK:
        case NOTIFY_STOP:
-               return;
+               break;
        case NOTIFY_BAD:
                die("Fatal Non-Maskable Interrupt", regs, SIGINT);
        default:
+               printk(KERN_ALERT "Got NMI, but nobody cared. Disabling...\n");
+               nmi_disable();
                break;
        }
-
-       printk(KERN_ALERT "Got NMI, but nobody cared. Disabling...\n");
-       nmi_disable();
+       nmi_exit();
 }
 
 asmlinkage void do_critical_exception(unsigned long ecr, struct pt_regs *regs)
index c6b91dee857c822c507764e1c2a054a3ee02a5ba..997b33b2288a6989aa3bdac94b0417967d7f6208 100644 (file)
@@ -123,6 +123,36 @@ ENTRY(find_next_bit)
        brgt    1b
        retal   r11
 
+ENTRY(generic_find_next_le_bit)
+       lsr     r8, r10, 5
+       sub     r9, r11, r10
+       retle   r11
+
+       lsl     r8, 2
+       add     r12, r8
+       andl    r10, 31, COH
+       breq    1f
+
+       /* offset is not word-aligned. Handle the first (32 - r10) bits */
+       ldswp.w r8, r12[0]
+       sub     r12, -4
+       lsr     r8, r8, r10
+       brne    .L_found
+
+       /* r9 = r9 - (32 - r10) = r9 + r10 - 32 */
+       add     r9, r10
+       sub     r9, 32
+       retle   r11
+
+       /* Main loop. offset must be word-aligned */
+1:     ldswp.w r8, r12[0]
+       cp.w    r8, 0
+       brne    .L_found
+       sub     r12, -4
+       sub     r9, 32
+       brgt    1b
+       retal   r11
+
 ENTRY(generic_find_next_zero_le_bit)
        lsr     r8, r10, 5
        sub     r9, r11, r10
index f6679989103689c24f01315b8f1e41c078b79ce2..1a873b36a4a1cd75f94bb196f1a7997d9ef621f3 100644 (file)
@@ -11,6 +11,9 @@
 #include <asm-generic/sections.h>
 
 extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[];
+#ifdef CONFIG_SMP
+extern char __cpu0_per_cpu[];
+#endif
 extern char __start___vtop_patchlist[], __end___vtop_patchlist[];
 extern char __start___rse_patchlist[], __end___rse_patchlist[];
 extern char __start___mckinley_e9_bundles[], __end___mckinley_e9_bundles[];
index d45f215bc8fce2ee175d018c8298a506437eb0be..51b75cea701866629449f7945ddef10079faa7ab 100644 (file)
@@ -1232,9 +1232,10 @@ efi_initialize_iomem_resources(struct resource *code_resource,
                                if (md->attribute & EFI_MEMORY_WP) {
                                        name = "System ROM";
                                        flags |= IORESOURCE_READONLY;
-                               } else {
+                               } else if (md->attribute == EFI_MEMORY_UC)
+                                       name = "Uncached RAM";
+                               else
                                        name = "System RAM";
-                               }
                                break;
 
                        case EFI_ACPI_MEMORY_NVS:
index 8bdea8eb62e366abc0350bd53261146d445ab41a..66e491d8baac3130a4dd68581662395b94a951b4 100644 (file)
@@ -367,16 +367,17 @@ start_ap:
        ;;
 #else
 (isAP) br.few 2f
-       mov r20=r19
-       sub r19=r19,r18
+       movl r20=__cpu0_per_cpu
        ;;
        shr.u r18=r18,3
 1:
-       ld8 r21=[r20],8;;
-       st8[r19]=r21,8
+       ld8 r21=[r19],8;;
+       st8[r20]=r21,8
        adds r18=-1,r18;;
        cmp4.lt p7,p6=0,r18
 (p7)   br.cond.dptk.few 1b
+       mov r19=r20
+       ;;
 2:
 #endif
        tpa r19=r19
index c27d5b2c182b4c7edd4de5609ce2a2c856a55ddb..de636b215677e801c23076d74f6d5a2d29e68efb 100644 (file)
@@ -616,7 +616,9 @@ setup_arch (char **cmdline_p)
                ia64_mca_init();
 
        platform_setup(cmdline_p);
+#ifndef CONFIG_IA64_HP_SIM
        check_sal_cache_flush();
+#endif
        paging_init();
 }
 
index de71da811cd68de596ed1c88b0cdcb6b2a714c29..10a7d47e8510b47fc4ce18ef4a385718d269bb1e 100644 (file)
@@ -215,9 +215,6 @@ SECTIONS
   /* Per-cpu data: */
   percpu : { } :percpu
   . = ALIGN(PERCPU_PAGE_SIZE);
-#ifdef CONFIG_SMP
-  . = . + PERCPU_PAGE_SIZE;    /* cpu0 per-cpu space */
-#endif
   __phys_per_cpu_start = .;
   .data.percpu PERCPU_ADDR : AT(__phys_per_cpu_start - LOAD_OFFSET)
        {
@@ -233,6 +230,11 @@ SECTIONS
   data : { } :data
   .data : AT(ADDR(.data) - LOAD_OFFSET)
        {
+#ifdef CONFIG_SMP
+  . = ALIGN(PERCPU_PAGE_SIZE);
+               __cpu0_per_cpu = .;
+  . = . + PERCPU_PAGE_SIZE;    /* cpu0 per-cpu space */
+#endif
                DATA_DATA
                *(.data1)
                *(.gnu.linkonce.d*)
index 7a37d06376be893799fa2bfdb30311251a3edbeb..cd0d1a7284b78afbe673424b4463d3f6463621de 100644 (file)
@@ -38,6 +38,7 @@
 #include <asm/cacheflush.h>
 #include <asm/div64.h>
 #include <asm/tlb.h>
+#include <asm/elf.h>
 
 #include "misc.h"
 #include "vti.h"
@@ -61,12 +62,6 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
        { NULL }
 };
 
-
-struct fdesc{
-    unsigned long ip;
-    unsigned long gp;
-};
-
 static void kvm_flush_icache(unsigned long start, unsigned long len)
 {
        int l;
index e566ff43884afcd97b17ff8bb71ebd95deda9ee6..0ee085efbe29eeedae56194dc1f167cf38d91ac6 100644 (file)
@@ -163,7 +163,7 @@ per_cpu_init (void)
         * get_zeroed_page().
         */
        if (first_time) {
-               void *cpu0_data = __phys_per_cpu_start - PERCPU_PAGE_SIZE;
+               void *cpu0_data = __cpu0_per_cpu;
 
                first_time=0;
 
index 78026aabaa7f03671d8b62d304d28d02c3817746..d8c5fcd89e5bf4aa2fc07611708ff0c1c8a55b74 100644 (file)
@@ -144,7 +144,7 @@ static void *per_cpu_node_setup(void *cpu_data, int node)
 
        for_each_possible_early_cpu(cpu) {
                if (cpu == 0) {
-                       void *cpu0_data = __phys_per_cpu_start - PERCPU_PAGE_SIZE;
+                       void *cpu0_data = __cpu0_per_cpu;
                        __per_cpu_offset[cpu] = (char*)cpu0_data -
                                __per_cpu_start;
                } else if (node == node_cpuid[cpu].nid) {
index a5f864c445b2fe1a28f511dd2c033e4430fc0814..f57113f1f892b091e7439ee18448459b6df25678 100644 (file)
@@ -216,10 +216,6 @@ config MEMORY_SIZE
        default "01000000" if PLAT_M32104UT
        default "00800000" if PLAT_OAKS32R
 
-config NOHIGHMEM
-       bool
-       default y
-
 config ARCH_DISCONTIGMEM_ENABLE
        bool "Internal RAM Support"
        depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104
@@ -410,11 +406,7 @@ config PCI_DIRECT
 source "drivers/pci/Kconfig"
 
 config ISA
-       bool "ISA support"
-       help
-         Find out whether you have ISA slots on your motherboard.  ISA is the
-         name of a bus system, i.e. the way the CPU talks to the other stuff
-         inside your box.  If you have ISA, say Y, otherwise N.
+       bool
 
 source "drivers/pcmcia/Kconfig"
 
index d4eaa2fd1818fea9b90e7c8bbdbe2bd7757ca99b..612d35b082a6826d59dda272612df7d295fa2e8c 100644 (file)
@@ -143,7 +143,7 @@ ret_from_intr:
        and3    r4, r4, #0x8000         ; check BSM bit
 #endif
        beqz    r4, resume_kernel
-ENTRY(resume_userspace)
+resume_userspace:
        DISABLE_INTERRUPTS(r4)          ; make sure we don't miss an interrupt
                                        ; setting need_resched or sigpending
                                        ; between sampling and the iret
index dab7436d7bbe85e2997c18b43b5082e4eece4255..40180778a5c723e069cfc96739a0600f10b6e02b 100644 (file)
@@ -29,7 +29,6 @@ __INITDATA
        .global _end
 ENTRY(stext)
 ENTRY(_stext)
-ENTRY(startup_32)
        /* Setup up the stack pointer */
        LDIMM   (r0, spi_stack_top)
        LDIMM   (r1, spu_stack_top)
index d0c5b0b7da2f0f571fa8e37c44b5f1a41ac5f363..2aeae4670098245f7072ca69b4e732955e4d25d5 100644 (file)
@@ -22,9 +22,6 @@
 #include <linux/module.h>
 #include <asm/uaccess.h>
 
-atomic_t irq_err_count;
-atomic_t irq_mis_count;
-
 /*
  * Generic, controller-independent functions:
  */
@@ -63,9 +60,6 @@ int show_interrupts(struct seq_file *p, void *v)
                seq_putc(p, '\n');
 skip:
                spin_unlock_irqrestore(&irq_desc[i].lock, flags);
-       } else if (i == NR_IRQS) {
-               seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
-               seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
        }
        return 0;
 }
index 16bcb189a38319c0831dc0dd6fc1fa505eedc64d..22624b51d4d3ecf3222ce82de0464719bb731d49 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/delay.h>
 #include <asm/irq.h>
 #include <asm/tlbflush.h>
+#include <asm/pgtable.h>
 
 /* platform dependent support */
 EXPORT_SYMBOL(boot_cpu_data);
@@ -65,6 +66,7 @@ EXPORT_SYMBOL(memset);
 EXPORT_SYMBOL(copy_page);
 EXPORT_SYMBOL(clear_page);
 EXPORT_SYMBOL(strlen);
+EXPORT_SYMBOL(empty_zero_page);
 
 EXPORT_SYMBOL(_inb);
 EXPORT_SYMBOL(_inw);
index a689e2978b6e382bdad4f9fcd56fbf194a1ddb6f..5be4faaf5b1c49c03391bb298e6f83122d6d88ab 100644 (file)
@@ -35,8 +35,6 @@
 
 #include <linux/err.h>
 
-static int hlt_counter=0;
-
 /*
  * Return saved PC of a blocked thread.
  */
@@ -48,31 +46,16 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
 /*
  * Powermanagement idle function, if any..
  */
-void (*pm_idle)(void) = NULL;
-EXPORT_SYMBOL(pm_idle);
+static void (*pm_idle)(void) = NULL;
 
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 
-void disable_hlt(void)
-{
-       hlt_counter++;
-}
-
-EXPORT_SYMBOL(disable_hlt);
-
-void enable_hlt(void)
-{
-       hlt_counter--;
-}
-
-EXPORT_SYMBOL(enable_hlt);
-
 /*
  * We use this is we don't have any better
  * idle routine..
  */
-void default_idle(void)
+static void default_idle(void)
 {
        /* M32R_FIXME: Please use "cpu_sleep" mode.  */
        cpu_relax();
@@ -260,15 +243,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long spu,
        return 0;
 }
 
-/*
- * Capture the user space registers if the task is not running (in user space)
- */
-int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
-{
-       /* M32R_FIXME */
-       return 1;
-}
-
 asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2,
        unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6,
        struct pt_regs regs)
index 7577f971ea4e3360d37ced6a7fa5f5ef1c401cec..929e5c9d3ad9c6467a5b28d24cd039a9597f1bc0 100644 (file)
@@ -84,7 +84,7 @@ void smp_send_timer(void);
 void smp_ipi_timer_interrupt(struct pt_regs *);
 void smp_local_timer_interrupt(void);
 
-void send_IPI_allbutself(int, int);
+static void send_IPI_allbutself(int, int);
 static void send_IPI_mask(cpumask_t, int, int);
 unsigned long send_IPI_mask_phys(cpumask_t, int, int);
 
@@ -722,7 +722,7 @@ void smp_local_timer_interrupt(void)
  * ---------- --- --------------------------------------------------------
  *
  *==========================================================================*/
-void send_IPI_allbutself(int ipi_num, int try)
+static void send_IPI_allbutself(int ipi_num, int try)
 {
        cpumask_t cpumask;
 
index 994cc15563558b03cd8c6aef4deff3d74424779a..6ea017727cced935c638a876dc193e7ef4e3288e 100644 (file)
@@ -34,7 +34,6 @@
 #include <asm/hw_irq.h>
 
 #ifdef CONFIG_SMP
-extern void send_IPI_allbutself(int, int);
 extern void smp_local_timer_interrupt(void);
 #endif
 
@@ -188,7 +187,7 @@ static long last_rtc_update = 0;
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "do_timer()" routine every clocktick
  */
-irqreturn_t timer_interrupt(int irq, void *dev_id)
+static irqreturn_t timer_interrupt(int irq, void *dev_id)
 {
 #ifndef CONFIG_SMP
        profile_tick(CPU_PROFILING);
@@ -228,7 +227,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-struct irqaction irq0 = {
+static struct irqaction irq0 = {
        .handler = timer_interrupt,
        .flags = IRQF_DISABLED,
        .mask = CPU_MASK_NONE,
index 46159a4e644b81f8bf0191641ac4fecfc58b0f82..03b14e55cd894791ab25e25fb5bfbc8827baf140 100644 (file)
@@ -61,7 +61,7 @@ extern unsigned long  eit_vector[];
        ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \
        + 0xff000000UL
 
-void   set_eit_vector_entries(void)
+static void set_eit_vector_entries(void)
 {
        extern void default_eit_handler(void);
        extern void system_call(void);
@@ -121,9 +121,9 @@ void __init trap_init(void)
        cpu_init();
 }
 
-int kstack_depth_to_print = 24;
+static int kstack_depth_to_print = 24;
 
-void show_trace(struct task_struct *task, unsigned long *stack)
+static void show_trace(struct task_struct *task, unsigned long *stack)
 {
        unsigned long addr;
 
@@ -224,7 +224,7 @@ bad:
        printk("\n");
 }
 
-DEFINE_SPINLOCK(die_lock);
+static DEFINE_SPINLOCK(die_lock);
 
 void die(const char * str, struct pt_regs * regs, long err)
 {
index 59bfc34e0d9f8aa86ded52d4145592af889aec1f..ced549be80f5e9055528918394caaeca6d04270f 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/param.h>
+#include <linux/module.h>
 #ifdef CONFIG_SMP
 #include <linux/sched.h>
 #include <asm/current.h>
@@ -121,3 +122,4 @@ void __ndelay(unsigned long nsecs)
 {
        __const_udelay(nsecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
 }
+EXPORT_SYMBOL(__ndelay);
index 49896a2a1d722e0760a866487f8b80b7d8af8fb0..1e06d233fa8310eaf77acfde003cbf8cd346fc54 100644 (file)
@@ -211,6 +211,7 @@ config MIPS_MALTA
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_SUPPORTS_MIPS_CMP if BROKEN  # because SYNC_R4K is broken
        select SYS_SUPPORTS_MULTITHREADING
        select SYS_SUPPORTS_SMARTMIPS
        help
@@ -1403,7 +1404,6 @@ config MIPS_MT_SMTC
        depends on CPU_MIPS32_R2
        #depends on CPU_MIPS64_R2               # once there is hardware ...
        depends on SYS_SUPPORTS_MULTITHREADING
-       select GENERIC_CLOCKEVENTS_BROADCAST
        select CPU_MIPSR2_IRQ_VI
        select CPU_MIPSR2_IRQ_EI
        select MIPS_MT
@@ -1451,32 +1451,17 @@ config MIPS_VPE_LOADER
          Includes a loader for loading an elf relocatable object
          onto another VPE and running it.
 
-config MIPS_MT_SMTC_INSTANT_REPLAY
-       bool "Low-latency Dispatch of Deferred SMTC IPIs"
-       depends on MIPS_MT_SMTC && !PREEMPT
-       default y
-       help
-         SMTC pseudo-interrupts between TCs are deferred and queued
-         if the target TC is interrupt-inhibited (IXMT). In the first
-         SMTC prototypes, these queued IPIs were serviced on return
-         to user mode, or on entry into the kernel idle loop. The
-         INSTANT_REPLAY option dispatches them as part of local_irq_restore()
-         processing, which adds runtime overhead (hence the option to turn
-         it off), but ensures that IPIs are handled promptly even under
-         heavy I/O interrupt load.
-
 config MIPS_MT_SMTC_IM_BACKSTOP
        bool "Use per-TC register bits as backstop for inhibited IM bits"
        depends on MIPS_MT_SMTC
-       default y
+       default n
        help
          To support multiple TC microthreads acting as "CPUs" within
          a VPE, VPE-wide interrupt mask bits must be specially manipulated
          during interrupt handling. To support legacy drivers and interrupt
          controller management code, SMTC has a "backstop" to track and
          if necessary restore the interrupt mask. This has some performance
-         impact on interrupt service overhead. Disable it only if you know
-         what you are doing.
+         impact on interrupt service overhead.
 
 config MIPS_MT_SMTC_IRQAFF
        bool "Support IRQ affinity API"
@@ -1486,10 +1471,8 @@ config MIPS_MT_SMTC_IRQAFF
          Enables SMP IRQ affinity API (/proc/irq/*/smp_affinity, etc.)
          for SMTC Linux kernel. Requires platform support, of which
          an example can be found in the MIPS kernel i8259 and Malta
-         platform code.  It is recommended that MIPS_MT_SMTC_INSTANT_REPLAY
-         be enabled if MIPS_MT_SMTC_IRQAFF is used. Adds overhead to
-         interrupt dispatch, and should be used only if you know what
-         you are doing.
+         platform code.  Adds some overhead to interrupt dispatch, and
+         should be used only if you know what you are doing.
 
 config MIPS_VPE_LOADER_TOM
        bool "Load VPE program into memory hidden from linux"
@@ -1517,6 +1500,18 @@ config MIPS_APSP_KSPD
          "exit" syscall notifying other kernel modules the SP program is
          exiting.  You probably want to say yes here.
 
+config MIPS_CMP
+       bool "MIPS CMP framework support"
+       depends on SYS_SUPPORTS_MIPS_CMP
+       select SYNC_R4K if BROKEN
+       select SYS_SUPPORTS_SMP
+       select SYS_SUPPORTS_SCHED_SMT if SMP
+       select WEAK_ORDERING
+       default n
+       help
+         This is a placeholder option for the GCMP work. It will need to
+         be handled differently...
+
 config SB1_PASS_1_WORKAROUNDS
        bool
        depends on CPU_SB1_PASS_1
@@ -1693,6 +1688,9 @@ config SMP
 config SMP_UP
        bool
 
+config SYS_SUPPORTS_MIPS_CMP
+       bool
+
 config SYS_SUPPORTS_SMP
        bool
 
@@ -1740,17 +1738,6 @@ config NR_CPUS
          performance should round up your number of processors to the next
          power of two.
 
-config MIPS_CMP
-       bool "MIPS CMP framework support"
-       depends on SMP
-       select SYNC_R4K
-       select SYS_SUPPORTS_SCHED_SMT
-       select WEAK_ORDERING
-       default n
-       help
-         This is a placeholder option for the GCMP work. It will need to
-         be handled differently...
-
 source "kernel/time/Kconfig"
 
 #
index b485d94ce8a5055d4e28b35f8dec1c7fc3b2af9e..e660ddd611c465dc6665ecf7d1346f82a5e77b98 100644 (file)
@@ -48,7 +48,7 @@ static void au1xxx_gpio2_write(unsigned gpio, int value)
 {
        gpio -= AU1XXX_GPIO_BASE;
 
-       gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | (value << gpio);
+       gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio);
 }
 
 static int au1xxx_gpio2_direction_input(unsigned gpio)
@@ -61,7 +61,8 @@ static int au1xxx_gpio2_direction_input(unsigned gpio)
 static int au1xxx_gpio2_direction_output(unsigned gpio, int value)
 {
        gpio -= AU1XXX_GPIO_BASE;
-       gpio2->dir = (0x01 << gpio) | (value << gpio);
+       gpio2->dir |= 0x01 << gpio;
+       gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio);
        return 0;
 }
 
@@ -90,6 +91,7 @@ static int au1xxx_gpio1_direction_input(unsigned gpio)
 static int au1xxx_gpio1_direction_output(unsigned gpio, int value)
 {
        gpio1->trioutclr = (0x01 & gpio);
+       au1xxx_gpio1_write(gpio, value);
        return 0;
 }
 
index 706f9397479770265d69b0307df9d76ea3739178..25775cb54000dd3871673c512e43cf59398c6461 100644 (file)
@@ -10,6 +10,7 @@ obj-y         += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
 
 obj-$(CONFIG_CEVT_BCM1480)     += cevt-bcm1480.o
 obj-$(CONFIG_CEVT_R4K)         += cevt-r4k.o
+obj-$(CONFIG_MIPS_MT_SMTC)     += cevt-smtc.o
 obj-$(CONFIG_CEVT_DS1287)      += cevt-ds1287.o
 obj-$(CONFIG_CEVT_GT641XX)     += cevt-gt641xx.o
 obj-$(CONFIG_CEVT_SB1250)      += cevt-sb1250.o
index 24a2d907aa0de4c022c0d5e89227dceae2a8a572..4a4c59f2737a5d0bcdc8fc48f4f8e28ea217f528 100644 (file)
 
 #include <asm/smtc_ipi.h>
 #include <asm/time.h>
+#include <asm/cevt-r4k.h>
+
+/*
+ * The SMTC Kernel for the 34K, 1004K, et. al. replaces several
+ * of these routines with SMTC-specific variants.
+ */
+
+#ifndef CONFIG_MIPS_MT_SMTC
 
 static int mips_next_event(unsigned long delta,
                            struct clock_event_device *evt)
@@ -19,60 +27,27 @@ static int mips_next_event(unsigned long delta,
        unsigned int cnt;
        int res;
 
-#ifdef CONFIG_MIPS_MT_SMTC
-       {
-       unsigned long flags, vpflags;
-       local_irq_save(flags);
-       vpflags = dvpe();
-#endif
        cnt = read_c0_count();
        cnt += delta;
        write_c0_compare(cnt);
        res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0;
-#ifdef CONFIG_MIPS_MT_SMTC
-       evpe(vpflags);
-       local_irq_restore(flags);
-       }
-#endif
        return res;
 }
 
-static void mips_set_mode(enum clock_event_mode mode,
-                          struct clock_event_device *evt)
+#endif /* CONFIG_MIPS_MT_SMTC */
+
+void mips_set_clock_mode(enum clock_event_mode mode,
+                               struct clock_event_device *evt)
 {
        /* Nothing to do ...  */
 }
 
-static DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
-static int cp0_timer_irq_installed;
+DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
+int cp0_timer_irq_installed;
 
-/*
- * Timer ack for an R4k-compatible timer of a known frequency.
- */
-static void c0_timer_ack(void)
-{
-       write_c0_compare(read_c0_compare());
-}
+#ifndef CONFIG_MIPS_MT_SMTC
 
-/*
- * Possibly handle a performance counter interrupt.
- * Return true if the timer interrupt should not be checked
- */
-static inline int handle_perf_irq(int r2)
-{
-       /*
-        * The performance counter overflow interrupt may be shared with the
-        * timer interrupt (cp0_perfcount_irq < 0). If it is and a
-        * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
-        * and we can't reliably determine if a counter interrupt has also
-        * happened (!r2) then don't check for a timer interrupt.
-        */
-       return (cp0_perfcount_irq < 0) &&
-               perf_irq() == IRQ_HANDLED &&
-               !r2;
-}
-
-static irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
+irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
 {
        const int r2 = cpu_has_mips_r2;
        struct clock_event_device *cd;
@@ -93,12 +68,8 @@ static irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
         * interrupt.  Being the paranoiacs we are we check anyway.
         */
        if (!r2 || (read_c0_cause() & (1 << 30))) {
-               c0_timer_ack();
-#ifdef CONFIG_MIPS_MT_SMTC
-               if (cpu_data[cpu].vpe_id)
-                       goto out;
-               cpu = 0;
-#endif
+               /* Clear Count/Compare Interrupt */
+               write_c0_compare(read_c0_compare());
                cd = &per_cpu(mips_clockevent_device, cpu);
                cd->event_handler(cd);
        }
@@ -107,65 +78,16 @@ out:
        return IRQ_HANDLED;
 }
 
-static struct irqaction c0_compare_irqaction = {
+#endif /* Not CONFIG_MIPS_MT_SMTC */
+
+struct irqaction c0_compare_irqaction = {
        .handler = c0_compare_interrupt,
-#ifdef CONFIG_MIPS_MT_SMTC
-       .flags = IRQF_DISABLED,
-#else
        .flags = IRQF_DISABLED | IRQF_PERCPU,
-#endif
        .name = "timer",
 };
 
-#ifdef CONFIG_MIPS_MT_SMTC
-DEFINE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device);
-
-static void smtc_set_mode(enum clock_event_mode mode,
-                          struct clock_event_device *evt)
-{
-}
-
-static void mips_broadcast(cpumask_t mask)
-{
-       unsigned int cpu;
-
-       for_each_cpu_mask(cpu, mask)
-               smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0);
-}
-
-static void setup_smtc_dummy_clockevent_device(void)
-{
-       //uint64_t mips_freq = mips_hpt_^frequency;
-       unsigned int cpu = smp_processor_id();
-       struct clock_event_device *cd;
 
-       cd = &per_cpu(smtc_dummy_clockevent_device, cpu);
-
-       cd->name                = "SMTC";
-       cd->features            = CLOCK_EVT_FEAT_DUMMY;
-
-       /* Calculate the min / max delta */
-       cd->mult        = 0; //div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
-       cd->shift               = 0; //32;
-       cd->max_delta_ns        = 0; //clockevent_delta2ns(0x7fffffff, cd);
-       cd->min_delta_ns        = 0; //clockevent_delta2ns(0x30, cd);
-
-       cd->rating              = 200;
-       cd->irq                 = 17; //-1;
-//     if (cpu)
-//             cd->cpumask     = CPU_MASK_ALL; // cpumask_of_cpu(cpu);
-//     else
-               cd->cpumask     = cpumask_of_cpu(cpu);
-
-       cd->set_mode            = smtc_set_mode;
-
-       cd->broadcast           = mips_broadcast;
-
-       clockevents_register_device(cd);
-}
-#endif
-
-static void mips_event_handler(struct clock_event_device *dev)
+void mips_event_handler(struct clock_event_device *dev)
 {
 }
 
@@ -177,7 +99,23 @@ static int c0_compare_int_pending(void)
        return (read_c0_cause() >> cp0_compare_irq) & 0x100;
 }
 
-static int c0_compare_int_usable(void)
+/*
+ * Compare interrupt can be routed and latched outside the core,
+ * so a single execution hazard barrier may not be enough to give
+ * it time to clear as seen in the Cause register.  4 time the
+ * pipeline depth seems reasonably conservative, and empirically
+ * works better in configurations with high CPU/bus clock ratios.
+ */
+
+#define compare_change_hazard() \
+       do { \
+               irq_disable_hazard(); \
+               irq_disable_hazard(); \
+               irq_disable_hazard(); \
+               irq_disable_hazard(); \
+       } while (0)
+
+int c0_compare_int_usable(void)
 {
        unsigned int delta;
        unsigned int cnt;
@@ -187,7 +125,7 @@ static int c0_compare_int_usable(void)
         */
        if (c0_compare_int_pending()) {
                write_c0_compare(read_c0_count());
-               irq_disable_hazard();
+               compare_change_hazard();
                if (c0_compare_int_pending())
                        return 0;
        }
@@ -196,7 +134,7 @@ static int c0_compare_int_usable(void)
                cnt = read_c0_count();
                cnt += delta;
                write_c0_compare(cnt);
-               irq_disable_hazard();
+               compare_change_hazard();
                if ((int)(read_c0_count() - cnt) < 0)
                    break;
                /* increase delta if the timer was already expired */
@@ -205,11 +143,12 @@ static int c0_compare_int_usable(void)
        while ((int)(read_c0_count() - cnt) <= 0)
                ;       /* Wait for expiry  */
 
+       compare_change_hazard();
        if (!c0_compare_int_pending())
                return 0;
 
        write_c0_compare(read_c0_count());
-       irq_disable_hazard();
+       compare_change_hazard();
        if (c0_compare_int_pending())
                return 0;
 
@@ -219,6 +158,8 @@ static int c0_compare_int_usable(void)
        return 1;
 }
 
+#ifndef CONFIG_MIPS_MT_SMTC
+
 int __cpuinit mips_clockevent_init(void)
 {
        uint64_t mips_freq = mips_hpt_frequency;
@@ -229,17 +170,6 @@ int __cpuinit mips_clockevent_init(void)
        if (!cpu_has_counter || !mips_hpt_frequency)
                return -ENXIO;
 
-#ifdef CONFIG_MIPS_MT_SMTC
-       setup_smtc_dummy_clockevent_device();
-
-       /*
-        * On SMTC we only register VPE0's compare interrupt as clockevent
-        * device.
-        */
-       if (cpu)
-               return 0;
-#endif
-
        if (!c0_compare_int_usable())
                return -ENXIO;
 
@@ -265,13 +195,9 @@ int __cpuinit mips_clockevent_init(void)
 
        cd->rating              = 300;
        cd->irq                 = irq;
-#ifdef CONFIG_MIPS_MT_SMTC
-       cd->cpumask             = CPU_MASK_ALL;
-#else
        cd->cpumask             = cpumask_of_cpu(cpu);
-#endif
        cd->set_next_event      = mips_next_event;
-       cd->set_mode            = mips_set_mode;
+       cd->set_mode            = mips_set_clock_mode;
        cd->event_handler       = mips_event_handler;
 
        clockevents_register_device(cd);
@@ -281,12 +207,9 @@ int __cpuinit mips_clockevent_init(void)
 
        cp0_timer_irq_installed = 1;
 
-#ifdef CONFIG_MIPS_MT_SMTC
-#define CPUCTR_IMASKBIT (0x100 << cp0_compare_irq)
-       setup_irq_smtc(irq, &c0_compare_irqaction, CPUCTR_IMASKBIT);
-#else
        setup_irq(irq, &c0_compare_irqaction);
-#endif
 
        return 0;
 }
+
+#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 (file)
index 0000000..5162fe4
--- /dev/null
@@ -0,0 +1,321 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 MIPS Technologies, Inc.
+ * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org>
+ * Copyright (C) 2008 Kevin D. Kissell, Paralogos sarl
+ */
+#include <linux/clockchips.h>
+#include <linux/interrupt.h>
+#include <linux/percpu.h>
+
+#include <asm/smtc_ipi.h>
+#include <asm/time.h>
+#include <asm/cevt-r4k.h>
+
+/*
+ * Variant clock event timer support for SMTC on MIPS 34K, 1004K
+ * or other MIPS MT cores.
+ *
+ * Notes on SMTC Support:
+ *
+ * SMTC has multiple microthread TCs pretending to be Linux CPUs.
+ * But there's only one Count/Compare pair per VPE, and Compare
+ * interrupts are taken opportunisitically by available TCs
+ * bound to the VPE with the Count register.  The new timer
+ * framework provides for global broadcasts, but we really
+ * want VPE-level multicasts for best behavior. So instead
+ * of invoking the high-level clock-event broadcast code,
+ * this version of SMTC support uses the historical SMTC
+ * multicast mechanisms "under the hood", appearing to the
+ * generic clock layer as if the interrupts are per-CPU.
+ *
+ * The approach taken here is to maintain a set of NR_CPUS
+ * virtual timers, and track which "CPU" needs to be alerted
+ * at each event.
+ *
+ * It's unlikely that we'll see a MIPS MT core with more than
+ * 2 VPEs, but we *know* that we won't need to handle more
+ * VPEs than we have "CPUs".  So NCPUs arrays of NCPUs elements
+ * is always going to be overkill, but always going to be enough.
+ */
+
+unsigned long smtc_nexttime[NR_CPUS][NR_CPUS];
+static int smtc_nextinvpe[NR_CPUS];
+
+/*
+ * Timestamps stored are absolute values to be programmed
+ * into Count register.  Valid timestamps will never be zero.
+ * If a Zero Count value is actually calculated, it is converted
+ * to be a 1, which will introduce 1 or two CPU cycles of error
+ * roughly once every four billion events, which at 1000 HZ means
+ * about once every 50 days.  If that's actually a problem, one
+ * could alternate squashing 0 to 1 and to -1.
+ */
+
+#define MAKEVALID(x) (((x) == 0L) ? 1L : (x))
+#define ISVALID(x) ((x) != 0L)
+
+/*
+ * Time comparison is subtle, as it's really truncated
+ * modular arithmetic.
+ */
+
+#define IS_SOONER(a, b, reference) \
+    (((a) - (unsigned long)(reference)) < ((b) - (unsigned long)(reference)))
+
+/*
+ * CATCHUP_INCREMENT, used when the function falls behind the counter.
+ * Could be an increasing function instead of a constant;
+ */
+
+#define CATCHUP_INCREMENT 64
+
+static int mips_next_event(unsigned long delta,
+                               struct clock_event_device *evt)
+{
+       unsigned long flags;
+       unsigned int mtflags;
+       unsigned long timestamp, reference, previous;
+       unsigned long nextcomp = 0L;
+       int vpe = current_cpu_data.vpe_id;
+       int cpu = smp_processor_id();
+       local_irq_save(flags);
+       mtflags = dmt();
+
+       /*
+        * Maintain the per-TC virtual timer
+        * and program the per-VPE shared Count register
+        * as appropriate here...
+        */
+       reference = (unsigned long)read_c0_count();
+       timestamp = MAKEVALID(reference + delta);
+       /*
+        * To really model the clock, we have to catch the case
+        * where the current next-in-VPE timestamp is the old
+        * timestamp for the calling CPE, but the new value is
+        * in fact later.  In that case, we have to do a full
+        * scan and discover the new next-in-VPE CPU id and
+        * timestamp.
+        */
+       previous = smtc_nexttime[vpe][cpu];
+       if (cpu == smtc_nextinvpe[vpe] && ISVALID(previous)
+           && IS_SOONER(previous, timestamp, reference)) {
+               int i;
+               int soonest = cpu;
+
+               /*
+                * Update timestamp array here, so that new
+                * value gets considered along with those of
+                * other virtual CPUs on the VPE.
+                */
+               smtc_nexttime[vpe][cpu] = timestamp;
+               for_each_online_cpu(i) {
+                       if (ISVALID(smtc_nexttime[vpe][i])
+                           && IS_SOONER(smtc_nexttime[vpe][i],
+                               smtc_nexttime[vpe][soonest], reference)) {
+                                   soonest = i;
+                       }
+               }
+               smtc_nextinvpe[vpe] = soonest;
+               nextcomp = smtc_nexttime[vpe][soonest];
+       /*
+        * Otherwise, we don't have to process the whole array rank,
+        * we just have to see if the event horizon has gotten closer.
+        */
+       } else {
+               if (!ISVALID(smtc_nexttime[vpe][smtc_nextinvpe[vpe]]) ||
+                   IS_SOONER(timestamp,
+                       smtc_nexttime[vpe][smtc_nextinvpe[vpe]], reference)) {
+                           smtc_nextinvpe[vpe] = cpu;
+                           nextcomp = timestamp;
+               }
+               /*
+                * Since next-in-VPE may me the same as the executing
+                * virtual CPU, we update the array *after* checking
+                * its value.
+                */
+               smtc_nexttime[vpe][cpu] = timestamp;
+       }
+
+       /*
+        * It may be that, in fact, we don't need to update Compare,
+        * but if we do, we want to make sure we didn't fall into
+        * a crack just behind Count.
+        */
+       if (ISVALID(nextcomp)) {
+               write_c0_compare(nextcomp);
+               ehb();
+               /*
+                * We never return an error, we just make sure
+                * that we trigger the handlers as quickly as
+                * we can if we fell behind.
+                */
+               while ((nextcomp - (unsigned long)read_c0_count())
+                       > (unsigned long)LONG_MAX) {
+                       nextcomp += CATCHUP_INCREMENT;
+                       write_c0_compare(nextcomp);
+                       ehb();
+               }
+       }
+       emt(mtflags);
+       local_irq_restore(flags);
+       return 0;
+}
+
+
+void smtc_distribute_timer(int vpe)
+{
+       unsigned long flags;
+       unsigned int mtflags;
+       int cpu;
+       struct clock_event_device *cd;
+       unsigned long nextstamp = 0L;
+       unsigned long reference;
+
+
+repeat:
+       for_each_online_cpu(cpu) {
+           /*
+            * Find virtual CPUs within the current VPE who have
+            * unserviced timer requests whose time is now past.
+            */
+           local_irq_save(flags);
+           mtflags = dmt();
+           if (cpu_data[cpu].vpe_id == vpe &&
+               ISVALID(smtc_nexttime[vpe][cpu])) {
+               reference = (unsigned long)read_c0_count();
+               if ((smtc_nexttime[vpe][cpu] - reference)
+                        > (unsigned long)LONG_MAX) {
+                           smtc_nexttime[vpe][cpu] = 0L;
+                           emt(mtflags);
+                           local_irq_restore(flags);
+                           /*
+                            * We don't send IPIs to ourself.
+                            */
+                           if (cpu != smp_processor_id()) {
+                               smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0);
+                           } else {
+                               cd = &per_cpu(mips_clockevent_device, cpu);
+                               cd->event_handler(cd);
+                           }
+               } else {
+                       /* Local to VPE but Valid Time not yet reached. */
+                       if (!ISVALID(nextstamp) ||
+                           IS_SOONER(smtc_nexttime[vpe][cpu], nextstamp,
+                           reference)) {
+                               smtc_nextinvpe[vpe] = cpu;
+                               nextstamp = smtc_nexttime[vpe][cpu];
+                       }
+                       emt(mtflags);
+                       local_irq_restore(flags);
+               }
+           } else {
+               emt(mtflags);
+               local_irq_restore(flags);
+
+           }
+       }
+       /* Reprogram for interrupt at next soonest timestamp for VPE */
+       if (ISVALID(nextstamp)) {
+               write_c0_compare(nextstamp);
+               ehb();
+               if ((nextstamp - (unsigned long)read_c0_count())
+                       > (unsigned long)LONG_MAX)
+                               goto repeat;
+       }
+}
+
+
+irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
+{
+       int cpu = smp_processor_id();
+
+       /* If we're running SMTC, we've got MIPS MT and therefore MIPS32R2 */
+       handle_perf_irq(1);
+
+       if (read_c0_cause() & (1 << 30)) {
+               /* Clear Count/Compare Interrupt */
+               write_c0_compare(read_c0_compare());
+               smtc_distribute_timer(cpu_data[cpu].vpe_id);
+       }
+       return IRQ_HANDLED;
+}
+
+
+int __cpuinit mips_clockevent_init(void)
+{
+       uint64_t mips_freq = mips_hpt_frequency;
+       unsigned int cpu = smp_processor_id();
+       struct clock_event_device *cd;
+       unsigned int irq;
+       int i;
+       int j;
+
+       if (!cpu_has_counter || !mips_hpt_frequency)
+               return -ENXIO;
+       if (cpu == 0) {
+               for (i = 0; i < num_possible_cpus(); i++) {
+                       smtc_nextinvpe[i] = 0;
+                       for (j = 0; j < num_possible_cpus(); j++)
+                               smtc_nexttime[i][j] = 0L;
+               }
+               /*
+                * SMTC also can't have the usablility test
+                * run by secondary TCs once Compare is in use.
+                */
+               if (!c0_compare_int_usable())
+                       return -ENXIO;
+       }
+
+       /*
+        * With vectored interrupts things are getting platform specific.
+        * get_c0_compare_int is a hook to allow a platform to return the
+        * interrupt number of it's liking.
+        */
+       irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
+       if (get_c0_compare_int)
+               irq = get_c0_compare_int();
+
+       cd = &per_cpu(mips_clockevent_device, cpu);
+
+       cd->name                = "MIPS";
+       cd->features            = CLOCK_EVT_FEAT_ONESHOT;
+
+       /* Calculate the min / max delta */
+       cd->mult        = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
+       cd->shift               = 32;
+       cd->max_delta_ns        = clockevent_delta2ns(0x7fffffff, cd);
+       cd->min_delta_ns        = clockevent_delta2ns(0x300, cd);
+
+       cd->rating              = 300;
+       cd->irq                 = irq;
+       cd->cpumask             = cpumask_of_cpu(cpu);
+       cd->set_next_event      = mips_next_event;
+       cd->set_mode            = mips_set_clock_mode;
+       cd->event_handler       = mips_event_handler;
+
+       clockevents_register_device(cd);
+
+       /*
+        * On SMTC we only want to do the data structure
+        * initialization and IRQ setup once.
+        */
+       if (cpu)
+               return 0;
+       /*
+        * And we need the hwmask associated with the c0_compare
+        * vector to be initialized.
+        */
+       irq_hwmask[irq] = (0x100 << cp0_compare_irq);
+       if (cp0_timer_irq_installed)
+               return 0;
+
+       cp0_timer_irq_installed = 1;
+
+       setup_irq(irq, &c0_compare_irqaction);
+
+       return 0;
+}
index 335a6ae3d594044fa0ca99e44ee189631238b609..e621fda8ab37fad4847cb3a19ee238f415f82a91 100644 (file)
@@ -45,18 +45,7 @@ static void r39xx_wait(void)
        local_irq_enable();
 }
 
-/*
- * There is a race when WAIT instruction executed with interrupt
- * enabled.
- * But it is implementation-dependent wheter the pipelie restarts when
- * a non-enabled interrupt is requested.
- */
-static void r4k_wait(void)
-{
-       __asm__("       .set    mips3                   \n"
-               "       wait                            \n"
-               "       .set    mips0                   \n");
-}
+extern void r4k_wait(void);
 
 /*
  * This variant is preferable as it allows testing need_resched and going to
@@ -65,14 +54,18 @@ static void r4k_wait(void)
  * interrupt is requested" restriction in the MIPS32/MIPS64 architecture makes
  * using this version a gamble.
  */
-static void r4k_wait_irqoff(void)
+void r4k_wait_irqoff(void)
 {
        local_irq_disable();
        if (!need_resched())
-               __asm__("       .set    mips3           \n"
+               __asm__("       .set    push            \n"
+                       "       .set    mips3           \n"
                        "       wait                    \n"
-                       "       .set    mips0           \n");
+                       "       .set    pop             \n");
        local_irq_enable();
+       __asm__("       .globl __pastwait       \n"
+               "__pastwait:                    \n");
+       return;
 }
 
 /*
@@ -128,7 +121,7 @@ static int __init wait_disable(char *s)
 
 __setup("nowait", wait_disable);
 
-static inline void check_wait(void)
+void __init check_wait(void)
 {
        struct cpuinfo_mips *c = &current_cpu_data;
 
@@ -242,7 +235,6 @@ static inline void check_errata(void)
 
 void __init check_bugs32(void)
 {
-       check_wait();
        check_errata();
 }
 
index e29598ae939d21b7d8e7442300a8741ce612f24a..ffa331029e086ce3720dc1ac9d60b936d68dba0a 100644 (file)
@@ -79,11 +79,6 @@ FEXPORT(syscall_exit)
 
 FEXPORT(restore_all)                   # restore full frame
 #ifdef CONFIG_MIPS_MT_SMTC
-/* Detect and execute deferred IPI "interrupts" */
-       LONG_L  s0, TI_REGS($28)
-       LONG_S  sp, TI_REGS($28)
-       jal     deferred_smtc_ipi
-       LONG_S  s0, TI_REGS($28)
 #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
 /* Re-arm any temporarily masked interrupts not explicitly "acked" */
        mfc0    v0, CP0_TCSTATUS
@@ -112,6 +107,11 @@ FEXPORT(restore_all)                       # restore full frame
        xor     t0, t0, t3
        mtc0    t0, CP0_TCCONTEXT
 #endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */
+/* Detect and execute deferred IPI "interrupts" */
+       LONG_L  s0, TI_REGS($28)
+       LONG_S  sp, TI_REGS($28)
+       jal     deferred_smtc_ipi
+       LONG_S  s0, TI_REGS($28)
 #endif /* CONFIG_MIPS_MT_SMTC */
        .set    noat
        RESTORE_TEMP
index c6ada98ee042039a968e57d57f800ee1c8313ed6..01dcbe38fa019dc20ac8d4999b818f62ec0ff970 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/stackframe.h>
 #include <asm/war.h>
 #include <asm/page.h>
+#include <asm/thread_info.h>
 
 #define PANIC_PIC(msg)                                 \
                .set push;                              \
@@ -126,7 +127,42 @@ handle_vcei:
 
        __FINIT
 
+       .align  5       /* 32 byte rollback region */
+LEAF(r4k_wait)
+       .set    push
+       .set    noreorder
+       /* start of rollback region */
+       LONG_L  t0, TI_FLAGS($28)
+       nop
+       andi    t0, _TIF_NEED_RESCHED
+       bnez    t0, 1f
+        nop
+       nop
+       nop
+       .set    mips3
+       wait
+       /* end of rollback region (the region size must be power of two) */
+       .set    pop
+1:
+       jr      ra
+       END(r4k_wait)
+
+       .macro  BUILD_ROLLBACK_PROLOGUE handler
+       FEXPORT(rollback_\handler)
+       .set    push
+       .set    noat
+       MFC0    k0, CP0_EPC
+       PTR_LA  k1, r4k_wait
+       ori     k0, 0x1f        /* 32 byte rollback region */
+       xori    k0, 0x1f
+       bne     k0, k1, 9f
+       MTC0    k0, CP0_EPC
+9:
+       .set pop
+       .endm
+
        .align  5
+BUILD_ROLLBACK_PROLOGUE handle_int
 NESTED(handle_int, PT_SIZE, sp)
 #ifdef CONFIG_TRACE_IRQFLAGS
        /*
@@ -201,6 +237,7 @@ NESTED(except_vec_ejtag_debug, 0, sp)
  * This prototype is copied to ebase + n*IntCtl.VS and patched
  * to invoke the handler
  */
+BUILD_ROLLBACK_PROLOGUE except_vec_vi
 NESTED(except_vec_vi, 0, sp)
        SAVE_SOME
        SAVE_AT
@@ -245,8 +282,8 @@ NESTED(except_vec_vi_handler, 0, sp)
        and     t0, a0, t1
 #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
        mfc0    t2, CP0_TCCONTEXT
-       or      t0, t0, t2
-       mtc0    t0, CP0_TCCONTEXT
+       or      t2, t0, t2
+       mtc0    t2, CP0_TCCONTEXT
 #endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */
        xor     t1, t1, t0
        mtc0    t1, CP0_STATUS
index 361364501d34926deea6d59456cce24f0674e538..492a0a8d70fbf9ddc6e695ae8250e562f03f0ab5 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/irqflags.h>
 #include <asm/regdef.h>
 #include <asm/page.h>
+#include <asm/pgtable-bits.h>
 #include <asm/mipsregs.h>
 #include <asm/stackframe.h>
 
index 8f6d58ede33cea5f42424fb27becd432e7b1f7b3..6e152c80cd4a5bb3d0a73816311a850181371b81 100644 (file)
@@ -236,8 +236,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
 
                atomic_set(&kgdb_cpu_doing_single_step, -1);
                if (remcom_in_buffer[0] == 's')
-                       if (kgdb_contthread)
-                               atomic_set(&kgdb_cpu_doing_single_step, cpu);
+                       atomic_set(&kgdb_cpu_doing_single_step, cpu);
 
                return 0;
        }
index df4d3f2f740c54fa73b413e8b8c8d91601b95c74..dc9eb72ed9de956164f557b0757496dae6638c2e 100644 (file)
@@ -159,7 +159,7 @@ __setup("fpaff=", fpaff_thresh);
 /*
  * FPU Use Factor empirically derived from experiments on 34K
  */
-#define FPUSEFACTOR 333
+#define FPUSEFACTOR 2000
 
 static __init int mt_fp_affinity_init(void)
 {
index b16facd9ea8ecae7b27116952090beca25450c78..22fc19bbe87f3744ee24ef7dbc81a315b293fc1d 100644 (file)
@@ -55,7 +55,7 @@ void __noreturn cpu_idle(void)
        while (1) {
                tick_nohz_stop_sched_tick(1);
                while (!need_resched()) {
-#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
+#ifdef CONFIG_MIPS_MT_SMTC
                        extern void smtc_idle_loop_hook(void);
 
                        smtc_idle_loop_hook();
@@ -145,17 +145,18 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
         */
        p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1);
        childregs->cp0_status &= ~(ST0_CU2|ST0_CU1);
-       clear_tsk_thread_flag(p, TIF_USEDFPU);
 
-#ifdef CONFIG_MIPS_MT_FPAFF
+#ifdef CONFIG_MIPS_MT_SMTC
        /*
-        * FPU affinity support is cleaner if we track the
-        * user-visible CPU affinity from the very beginning.
-        * The generic cpus_allowed mask will already have
-        * been copied from the parent before copy_thread
-        * is invoked.
+        * SMTC restores TCStatus after Status, and the CU bits
+        * are aliased there.
         */
-       p->thread.user_cpus_allowed = p->cpus_allowed;
+       childregs->cp0_tcstatus &= ~(ST0_CU2|ST0_CU1);
+#endif
+       clear_tsk_thread_flag(p, TIF_USEDFPU);
+
+#ifdef CONFIG_MIPS_MT_FPAFF
+       clear_tsk_thread_flag(p, TIF_FPUBOUND);
 #endif /* CONFIG_MIPS_MT_FPAFF */
 
        if (clone_flags & CLONE_SETTLS)
index 35234b92b9a58f9d5c9e8a2063c292e35c3ac327..96ffc9c6d194d6ba5d2a8be948481652adbb34a2 100644 (file)
@@ -238,7 +238,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                case FPC_EIR: { /* implementation / version register */
                        unsigned int flags;
 #ifdef CONFIG_MIPS_MT_SMTC
-                       unsigned int irqflags;
+                       unsigned long irqflags;
                        unsigned int mtflags;
 #endif /* CONFIG_MIPS_MT_SMTC */
 
index a516286532ab092637cab432cd8742a0800e6fb0..897fb2b4751c95715af0b798d79db5cf899a5e5d 100644 (file)
@@ -1,4 +1,21 @@
-/* Copyright (C) 2004 Mips Technologies, Inc */
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * Copyright (C) 2004 Mips Technologies, Inc
+ * Copyright (C) 2008 Kevin D. Kissell
+ */
 
 #include <linux/clockchips.h>
 #include <linux/kernel.h>
@@ -21,7 +38,6 @@
 #include <asm/time.h>
 #include <asm/addrspace.h>
 #include <asm/smtc.h>
-#include <asm/smtc_ipi.h>
 #include <asm/smtc_proc.h>
 
 /*
@@ -58,11 +74,6 @@ unsigned long irq_hwmask[NR_IRQS];
 
 asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS];
 
-/*
- * Clock interrupt "latch" buffers, per "CPU"
- */
-
-static atomic_t ipi_timer_latch[NR_CPUS];
 
 /*
  * Number of InterProcessor Interrupt (IPI) message buffers to allocate
@@ -70,7 +81,7 @@ static atomic_t ipi_timer_latch[NR_CPUS];
 
 #define IPIBUF_PER_CPU 4
 
-static struct smtc_ipi_q IPIQ[NR_CPUS];
+struct smtc_ipi_q IPIQ[NR_CPUS];
 static struct smtc_ipi_q freeIPIq;
 
 
@@ -282,7 +293,7 @@ static void smtc_configure_tlb(void)
  * phys_cpu_present_map and the logical/physical mappings.
  */
 
-int __init mipsmt_build_cpu_map(int start_cpu_slot)
+int __init smtc_build_cpu_map(int start_cpu_slot)
 {
        int i, ntcs;
 
@@ -325,7 +336,12 @@ static void smtc_tc_setup(int vpe, int tc, int cpu)
        write_tc_c0_tcstatus((read_tc_c0_tcstatus()
                        & ~(TCSTATUS_TKSU | TCSTATUS_DA | TCSTATUS_IXMT))
                        | TCSTATUS_A);
-       write_tc_c0_tccontext(0);
+       /*
+        * TCContext gets an offset from the base of the IPIQ array
+        * to be used in low-level code to detect the presence of
+        * an active IPI queue
+        */
+       write_tc_c0_tccontext((sizeof(struct smtc_ipi_q) * cpu) << 16);
        /* Bind tc to vpe */
        write_tc_c0_tcbind(vpe);
        /* 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)
                cpu_data[cpu].options &= ~MIPS_CPU_FPU;
        cpu_data[cpu].vpe_id = vpe;
        cpu_data[cpu].tc_id = tc;
+       /* Multi-core SMTC hasn't been tested, but be prepared */
+       cpu_data[cpu].core = (read_vpe_c0_ebase() >> 1) & 0xff;
 }
 
+/*
+ * Tweak to get Count registes in as close a sync as possible.
+ * Value seems good for 34K-class cores.
+ */
+
+#define CP0_SKEW 8
 
-void mipsmt_prepare_cpus(void)
+void smtc_prepare_cpus(int cpus)
 {
        int i, vpe, tc, ntc, nvpe, tcpervpe[NR_CPUS], slop, cpu;
        unsigned long flags;
@@ -363,13 +387,13 @@ void mipsmt_prepare_cpus(void)
                IPIQ[i].head = IPIQ[i].tail = NULL;
                spin_lock_init(&IPIQ[i].lock);
                IPIQ[i].depth = 0;
-               atomic_set(&ipi_timer_latch[i], 0);
        }
 
        /* cpu_data index starts at zero */
        cpu = 0;
        cpu_data[cpu].vpe_id = 0;
        cpu_data[cpu].tc_id = 0;
+       cpu_data[cpu].core = (read_c0_ebase() >> 1) & 0xff;
        cpu++;
 
        /* Report on boot-time options */
@@ -484,7 +508,8 @@ void mipsmt_prepare_cpus(void)
                        write_vpe_c0_compare(0);
                        /* Propagate Config7 */
                        write_vpe_c0_config7(read_c0_config7());
-                       write_vpe_c0_count(read_c0_count());
+                       write_vpe_c0_count(read_c0_count() + CP0_SKEW);
+                       ehb();
                }
                /* enable multi-threading within VPE */
                write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() | VPECONTROL_TE);
@@ -556,7 +581,7 @@ void mipsmt_prepare_cpus(void)
 void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
 {
        extern u32 kernelsp[NR_CPUS];
-       long flags;
+       unsigned long flags;
        int mtflags;
 
        LOCK_MT_PRA();
@@ -585,24 +610,22 @@ void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
 
 void smtc_init_secondary(void)
 {
-       /*
-        * Start timer on secondary VPEs if necessary.
-        * plat_timer_setup has already have been invoked by init/main
-        * on "boot" TC.  Like per_cpu_trap_init() hack, this assumes that
-        * SMTC init code assigns TCs consdecutively and in ascending order
-        * to across available VPEs.
-        */
-       if (((read_c0_tcbind() & TCBIND_CURTC) != 0) &&
-           ((read_c0_tcbind() & TCBIND_CURVPE)
-           != cpu_data[smp_processor_id() - 1].vpe_id)){
-               write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
-       }
-
        local_irq_enable();
 }
 
 void smtc_smp_finish(void)
 {
+       int cpu = smp_processor_id();
+
+       /*
+        * Lowest-numbered CPU per VPE starts a clock tick.
+        * Like per_cpu_trap_init() hack, this assumes that
+        * SMTC init code assigns TCs consdecutively and
+        * in ascending order across available VPEs.
+        */
+       if (cpu > 0 && (cpu_data[cpu].vpe_id != cpu_data[cpu - 1].vpe_id))
+               write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
+
        printk("TC %d going on-line as CPU %d\n",
                cpu_data[smp_processor_id()].tc_id, smp_processor_id());
 }
@@ -753,8 +776,10 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
 {
        int tcstatus;
        struct smtc_ipi *pipi;
-       long flags;
+       unsigned long flags;
        int mtflags;
+       unsigned long tcrestart;
+       extern void r4k_wait_irqoff(void), __pastwait(void);
 
        if (cpu == smp_processor_id()) {
                printk("Cannot Send IPI to self!\n");
@@ -771,8 +796,6 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
        pipi->arg = (void *)action;
        pipi->dest = cpu;
        if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) {
-               if (type == SMTC_CLOCK_TICK)
-                       atomic_inc(&ipi_timer_latch[cpu]);
                /* If not on same VPE, enqueue and send cross-VPE interrupt */
                smtc_ipi_nq(&IPIQ[cpu], pipi);
                LOCK_CORE_PRA();
@@ -800,22 +823,29 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
 
                if ((tcstatus & TCSTATUS_IXMT) != 0) {
                        /*
-                        * Spin-waiting here can deadlock,
-                        * so we queue the message for the target TC.
+                        * If we're in the the irq-off version of the wait
+                        * loop, we need to force exit from the wait and
+                        * do a direct post of the IPI.
+                        */
+                       if (cpu_wait == r4k_wait_irqoff) {
+                               tcrestart = read_tc_c0_tcrestart();
+                               if (tcrestart >= (unsigned long)r4k_wait_irqoff
+                                   && tcrestart < (unsigned long)__pastwait) {
+                                       write_tc_c0_tcrestart(__pastwait);
+                                       tcstatus &= ~TCSTATUS_IXMT;
+                                       write_tc_c0_tcstatus(tcstatus);
+                                       goto postdirect;
+                               }
+                       }
+                       /*
+                        * Otherwise we queue the message for the target TC
+                        * to pick up when he does a local_irq_restore()
                         */
                        write_tc_c0_tchalt(0);
                        UNLOCK_CORE_PRA();
-                       /* Try to reduce redundant timer interrupt messages */
-                       if (type == SMTC_CLOCK_TICK) {
-                           if (atomic_postincrement(&ipi_timer_latch[cpu])!=0){
-                               smtc_ipi_nq(&freeIPIq, pipi);
-                               return;
-                           }
-                       }
                        smtc_ipi_nq(&IPIQ[cpu], pipi);
                } else {
-                       if (type == SMTC_CLOCK_TICK)
-                               atomic_inc(&ipi_timer_latch[cpu]);
+postdirect:
                        post_direct_ipi(cpu, pipi);
                        write_tc_c0_tchalt(0);
                        UNLOCK_CORE_PRA();
@@ -883,7 +913,7 @@ static void ipi_call_interrupt(void)
        smp_call_function_interrupt();
 }
 
-DECLARE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device);
+DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
 
 void ipi_decode(struct smtc_ipi *pipi)
 {
@@ -891,20 +921,13 @@ void ipi_decode(struct smtc_ipi *pipi)
        struct clock_event_device *cd;
        void *arg_copy = pipi->arg;
        int type_copy = pipi->type;
-       int ticks;
-
        smtc_ipi_nq(&freeIPIq, pipi);
        switch (type_copy) {
        case SMTC_CLOCK_TICK:
                irq_enter();
                kstat_this_cpu.irqs[MIPS_CPU_IRQ_BASE + 1]++;
-               cd = &per_cpu(smtc_dummy_clockevent_device, cpu);
-               ticks = atomic_read(&ipi_timer_latch[cpu]);
-               atomic_sub(ticks, &ipi_timer_latch[cpu]);
-               while (ticks) {
-                       cd->event_handler(cd);
-                       ticks--;
-               }
+               cd = &per_cpu(mips_clockevent_device, cpu);
+               cd->event_handler(cd);
                irq_exit();
                break;
 
@@ -937,24 +960,48 @@ void ipi_decode(struct smtc_ipi *pipi)
        }
 }
 
+/*
+ * Similar to smtc_ipi_replay(), but invoked from context restore,
+ * so it reuses the current exception frame rather than set up a
+ * new one with self_ipi.
+ */
+
 void deferred_smtc_ipi(void)
 {
-       struct smtc_ipi *pipi;
-       unsigned long flags;
-/* DEBUG */
-       int q = smp_processor_id();
+       int cpu = smp_processor_id();
 
        /*
         * Test is not atomic, but much faster than a dequeue,
         * and the vast majority of invocations will have a null queue.
+        * If irq_disabled when this was called, then any IPIs queued
+        * after we test last will be taken on the next irq_enable/restore.
+        * If interrupts were enabled, then any IPIs added after the
+        * last test will be taken directly.
         */
-       if (IPIQ[q].head != NULL) {
-               while((pipi = smtc_ipi_dq(&IPIQ[q])) != NULL) {
-                       /* ipi_decode() should be called with interrupts off */
-                       local_irq_save(flags);
+
+       while (IPIQ[cpu].head != NULL) {
+               struct smtc_ipi_q *q = &IPIQ[cpu];
+               struct smtc_ipi *pipi;
+               unsigned long flags;
+
+               /*
+                * It may be possible we'll come in with interrupts
+                * already enabled.
+                */
+               local_irq_save(flags);
+
+               spin_lock(&q->lock);
+               pipi = __smtc_ipi_dq(q);
+               spin_unlock(&q->lock);
+               if (pipi != NULL)
                        ipi_decode(pipi);
-                       local_irq_restore(flags);
-               }
+               /*
+                * The use of the __raw_local restore isn't
+                * as obviously necessary here as in smtc_ipi_replay(),
+                * but it's more efficient, given that we're already
+                * running down the IPI queue.
+                */
+               __raw_local_irq_restore(flags);
        }
 }
 
@@ -975,7 +1022,7 @@ static irqreturn_t ipi_interrupt(int irq, void *dev_idm)
        struct smtc_ipi *pipi;
        unsigned long tcstatus;
        int sent;
-       long flags;
+       unsigned long flags;
        unsigned int mtflags;
        unsigned int vpflags;
 
@@ -1066,55 +1113,53 @@ static void setup_cross_vpe_interrupts(unsigned int nvpe)
 
 /*
  * SMTC-specific hacks invoked from elsewhere in the kernel.
- *
- * smtc_ipi_replay is called from raw_local_irq_restore which is only ever
- * called with interrupts disabled.  We do rely on interrupts being disabled
- * here because using spin_lock_irqsave()/spin_unlock_irqrestore() would
- * result in a recursive call to raw_local_irq_restore().
  */
 
-static void __smtc_ipi_replay(void)
+ /*
+  * smtc_ipi_replay is called from raw_local_irq_restore
+  */
+
+void smtc_ipi_replay(void)
 {
        unsigned int cpu = smp_processor_id();
 
        /*
         * To the extent that we've ever turned interrupts off,
         * we may have accumulated deferred IPIs.  This is subtle.
-        * If we use the smtc_ipi_qdepth() macro, we'll get an
-        * exact number - but we'll also disable interrupts
-        * and create a window of failure where a new IPI gets
-        * queued after we test the depth but before we re-enable
-        * interrupts. So long as IXMT never gets set, however,
         * we should be OK:  If we pick up something and dispatch
         * it here, that's great. If we see nothing, but concurrent
         * with this operation, another TC sends us an IPI, IXMT
         * is clear, and we'll handle it as a real pseudo-interrupt
-        * and not a pseudo-pseudo interrupt.
+        * and not a pseudo-pseudo interrupt.  The important thing
+        * is to do the last check for queued message *after* the
+        * re-enabling of interrupts.
         */
-       if (IPIQ[cpu].depth > 0) {
-               while (1) {
-                       struct smtc_ipi_q *q = &IPIQ[cpu];
-                       struct smtc_ipi *pipi;
-                       extern void self_ipi(struct smtc_ipi *);
-
-                       spin_lock(&q->lock);
-                       pipi = __smtc_ipi_dq(q);
-                       spin_unlock(&q->lock);
-                       if (!pipi)
-                               break;
+       while (IPIQ[cpu].head != NULL) {
+               struct smtc_ipi_q *q = &IPIQ[cpu];
+               struct smtc_ipi *pipi;
+               unsigned long flags;
+
+               /*
+                * It's just possible we'll come in with interrupts
+                * already enabled.
+                */
+               local_irq_save(flags);
+
+               spin_lock(&q->lock);
+               pipi = __smtc_ipi_dq(q);
+               spin_unlock(&q->lock);
+               /*
+                ** But use a raw restore here to avoid recursion.
+                */
+               __raw_local_irq_restore(flags);
 
+               if (pipi) {
                        self_ipi(pipi);
                        smtc_cpu_stats[cpu].selfipis++;
                }
        }
 }
 
-void smtc_ipi_replay(void)
-{
-       raw_local_irq_disable();
-       __smtc_ipi_replay();
-}
-
 EXPORT_SYMBOL(smtc_ipi_replay);
 
 void smtc_idle_loop_hook(void)
@@ -1193,40 +1238,13 @@ void smtc_idle_loop_hook(void)
                }
        }
 
-       /*
-        * Now that we limit outstanding timer IPIs, check for hung TC
-        */
-       for (tc = 0; tc < NR_CPUS; tc++) {
-               /* Don't check ourself - we'll dequeue IPIs just below */
-               if ((tc != smp_processor_id()) &&
-                   atomic_read(&ipi_timer_latch[tc]) > timerq_limit) {
-                   if (clock_hang_reported[tc] == 0) {
-                       pdb_msg += sprintf(pdb_msg,
-                               "TC %d looks hung with timer latch at %d\n",
-                               tc, atomic_read(&ipi_timer_latch[tc]));
-                       clock_hang_reported[tc]++;
-                       }
-               }
-       }
        emt(mtflags);
        local_irq_restore(flags);
        if (pdb_msg != &id_ho_db_msg[0])
                printk("CPU%d: %s", smp_processor_id(), id_ho_db_msg);
 #endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */
 
-       /*
-        * Replay any accumulated deferred IPIs. If "Instant Replay"
-        * is in use, there should never be any.
-        */
-#ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
-       {
-               unsigned long flags;
-
-               local_irq_save(flags);
-               __smtc_ipi_replay();
-               local_irq_restore(flags);
-       }
-#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
+       smtc_ipi_replay();
 }
 
 void smtc_soft_dump(void)
@@ -1242,10 +1260,6 @@ void smtc_soft_dump(void)
                printk("%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
        }
        smtc_ipi_qdump();
-       printk("Timer IPI Backlogs:\n");
-       for (i=0; i < NR_CPUS; i++) {
-               printk("%d: %d\n", i, atomic_read(&ipi_timer_latch[i]));
-       }
        printk("%d Recoveries of \"stolen\" FPU\n",
               atomic_read(&smtc_fpu_recoveries));
 }
index 6bee29097a565e71459f80ee75c3affd3d0ed25b..b602ac6eb47d8a41454d0bd5e48b7931d6f4ee7f 100644 (file)
@@ -46,6 +46,9 @@
 #include <asm/types.h>
 #include <asm/stacktrace.h>
 
+extern void check_wait(void);
+extern asmlinkage void r4k_wait(void);
+extern asmlinkage void rollback_handle_int(void);
 extern asmlinkage void handle_int(void);
 extern asmlinkage void handle_tlbm(void);
 extern asmlinkage void handle_tlbl(void);
@@ -822,8 +825,10 @@ static void mt_ase_fp_affinity(void)
                if (cpus_intersects(current->cpus_allowed, mt_fpu_cpumask)) {
                        cpumask_t tmask;
 
-                       cpus_and(tmask, current->thread.user_cpus_allowed,
-                                mt_fpu_cpumask);
+                       current->thread.user_cpus_allowed
+                               = current->cpus_allowed;
+                       cpus_and(tmask, current->cpus_allowed,
+                               mt_fpu_cpumask);
                        set_cpus_allowed(current, tmask);
                        set_thread_flag(TIF_FPUBOUND);
                }
@@ -1251,6 +1256,9 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
 
                extern char except_vec_vi, except_vec_vi_lui;
                extern char except_vec_vi_ori, except_vec_vi_end;
+               extern char rollback_except_vec_vi;
+               char *vec_start = (cpu_wait == r4k_wait) ?
+                       &rollback_except_vec_vi : &except_vec_vi;
 #ifdef CONFIG_MIPS_MT_SMTC
                /*
                 * 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)
                 * Status.IM bit to be masked before going there.
                 */
                extern char except_vec_vi_mori;
-               const int mori_offset = &except_vec_vi_mori - &except_vec_vi;
+               const int mori_offset = &except_vec_vi_mori - vec_start;
 #endif /* CONFIG_MIPS_MT_SMTC */
-               const int handler_len = &except_vec_vi_end - &except_vec_vi;
-               const int lui_offset = &except_vec_vi_lui - &except_vec_vi;
-               const int ori_offset = &except_vec_vi_ori - &except_vec_vi;
+               const int handler_len = &except_vec_vi_end - vec_start;
+               const int lui_offset = &except_vec_vi_lui - vec_start;
+               const int ori_offset = &except_vec_vi_ori - vec_start;
 
                if (handler_len > VECTORSPACING) {
                        /*
@@ -1272,7 +1280,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
                        panic("VECTORSPACING too small");
                }
 
-               memcpy(b, &except_vec_vi, handler_len);
+               memcpy(b, vec_start, handler_len);
 #ifdef CONFIG_MIPS_MT_SMTC
                BUG_ON(n > 7);  /* Vector index %d exceeds SMTC maximum. */
 
@@ -1554,6 +1562,10 @@ void __init trap_init(void)
        extern char except_vec3_generic, except_vec3_r4000;
        extern char except_vec4;
        unsigned long i;
+       int rollback;
+
+       check_wait();
+       rollback = (cpu_wait == r4k_wait);
 
 #if defined(CONFIG_KGDB)
        if (kgdb_early_setup)
@@ -1618,7 +1630,7 @@ void __init trap_init(void)
        if (board_be_init)
                board_be_init();
 
-       set_except_vector(0, handle_int);
+       set_except_vector(0, rollback ? rollback_handle_int : handle_int);
        set_except_vector(1, handle_tlbm);
        set_except_vector(2, handle_tlbl);
        set_except_vector(3, handle_tlbs);
index b5470ceb418b301847f385d72e306eff0b1bf6dc..afb119f35682680c2eb5eeddb20137aab7e64aa9 100644 (file)
@@ -36,6 +36,7 @@ SECTIONS
                SCHED_TEXT
                LOCK_TEXT
                KPROBES_TEXT
+               *(.text.*)
                *(.fixup)
                *(.gnu.warning)
        } :text = 0
index 8d7784122c143b7a36689d82dbe057928244a355..edac9892c51a19a5e8084ad26ca5584d54c78499 100644 (file)
 #ifdef USE_DOUBLE
 
 #define LOAD   ld
+#define LOAD32 lwu
 #define ADD    daddu
 #define NBYTES 8
 
 #else
 
 #define LOAD   lw
+#define LOAD32 lw
 #define ADD    addu
 #define NBYTES 4
 
        ADD     sum, v1;                                        \
        .set    pop
 
+#define ADDC32(sum,reg)                                                \
+       .set    push;                                           \
+       .set    noat;                                           \
+       addu    sum, reg;                                       \
+       sltu    v1, sum, reg;                                   \
+       addu    sum, v1;                                        \
+       .set    pop
+
 #define CSUM_BIGCHUNK1(src, offset, sum, _t0, _t1, _t2, _t3)   \
        LOAD    _t0, (offset + UNIT(0))(src);                   \
        LOAD    _t1, (offset + UNIT(1))(src);                   \
@@ -132,7 +142,7 @@ LEAF(csum_partial)
        beqz    t8, .Lqword_align
         andi   t8, src, 0x8
 
-       lw      t0, 0x00(src)
+       LOAD32  t0, 0x00(src)
        LONG_SUBU       a1, a1, 0x4
        ADDC(sum, t0)
        PTR_ADDU        src, src, 0x4
@@ -211,7 +221,7 @@ LEAF(csum_partial)
        LONG_SRL        t8, t8, 0x2
 
 .Lend_words:
-       lw      t0, (src)
+       LOAD32  t0, (src)
        LONG_SUBU       t8, t8, 0x1
        ADDC(sum, t0)
        .set    reorder                         /* DADDI_WAR */
@@ -230,6 +240,9 @@ LEAF(csum_partial)
        /* Still a full word to go  */
        ulw     t1, (src)
        PTR_ADDIU       src, 4
+#ifdef USE_DOUBLE
+       dsll    t1, t1, 32                      /* clear lower 32bit */
+#endif
        ADDC(sum, t1)
 
 1:     move    t1, zero
@@ -280,7 +293,7 @@ LEAF(csum_partial)
 1:
        .set    reorder
        /* Add the passed partial csum.  */
-       ADDC(sum, a2)
+       ADDC32(sum, a2)
        jr      ra
        .set    noreorder
        END(csum_partial)
@@ -681,7 +694,7 @@ EXC(        sb      t0, NBYTES-2(dst), .Ls_exc)
        .set    pop
 1:
        .set reorder
-       ADDC(sum, psum)
+       ADDC32(sum, psum)
        jr      ra
        .set noreorder
 
index 3b7dd722c32a68ff83881d3200e769660678b899..cef2db8d22253185d8d66402e4e300422fcd4645 100644 (file)
@@ -15,6 +15,6 @@ obj-$(CONFIG_EARLY_PRINTK)    += malta-console.o
 obj-$(CONFIG_PCI)              += malta-pci.o
 
 # FIXME FIXME FIXME
-obj-$(CONFIG_MIPS_MT_SMTC)     += malta_smtc.o
+obj-$(CONFIG_MIPS_MT_SMTC)     += malta-smtc.o
 
 EXTRA_CFLAGS += -Werror
index 5ea705e49454e3ce49b27fb6b2f80a9f796f6950..f84a46a8ae6e5261d0c8669b2726ed353cda7dc3 100644 (file)
@@ -84,12 +84,17 @@ static void msmtc_cpus_done(void)
 
 static void __init msmtc_smp_setup(void)
 {
-       mipsmt_build_cpu_map(0);
+       /*
+        * we won't get the definitive value until
+        * we've run smtc_prepare_cpus later, but
+        * we would appear to need an upper bound now.
+        */
+       smp_num_siblings = smtc_build_cpu_map(0);
 }
 
 static void __init msmtc_prepare_cpus(unsigned int max_cpus)
 {
-       mipsmt_prepare_cpus();
+       smtc_prepare_cpus(max_cpus);
 }
 
 struct plat_smp_ops msmtc_smp_ops = {
index 15e01aec37fdcab3e67e6e5d8390c925c138e20c..c8c32f417b6ce84c32087585456f6e78ae47e58b 100644 (file)
@@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927)      += ops-tx3927.o
 obj-$(CONFIG_PCI_VR41XX)       += ops-vr41xx.o pci-vr41xx.o
 obj-$(CONFIG_MARKEINS)         += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
 obj-$(CONFIG_PCI_TX4927)       += ops-tx4927.o
+obj-$(CONFIG_BCM47XX)          += pci-bcm47xx.o
 
 #
 # 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 (file)
index 0000000..bea9b6c
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ *  Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ *
+ *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
+ *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
+ *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
+ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
+ *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  You should have received a copy of the  GNU General Public License along
+ *  with this program; if not, write  to the Free Software Foundation, Inc.,
+ *  675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/ssb/ssb.h>
+
+int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+       return 0;
+}
+
+int pcibios_plat_dev_init(struct pci_dev *dev)
+{
+       int res;
+       u8 slot, pin;
+
+       res = ssb_pcibios_plat_dev_init(dev);
+       if (res < 0) {
+               printk(KERN_ALERT "PCI: Failed to init device %s\n",
+                      pci_name(dev));
+               return res;
+       }
+
+       pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
+       slot = PCI_SLOT(dev->devfn);
+       res = ssb_pcibios_map_irq(dev, slot, pin);
+
+       /* IRQ-0 and IRQ-1 are software interrupts. */
+       if (res < 2) {
+               printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
+                      pci_name(dev));
+               return res;
+       }
+
+       dev->irq = res;
+       return 0;
+}
+
index bd78368c82bf2001a035a54bb9ff94942ba4cbd0..f97ab14610129bca9c2b696de7bd59f0dcb8d8f6 100644 (file)
@@ -142,26 +142,48 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid)
  * on any one of the hubs connected to its xbow.
  */
 int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+       return 0;
+}
+
+/* Most MIPS systems have straight-forward swizzling needs.  */
+static inline u8 bridge_swizzle(u8 pin, u8 slot)
+{
+       return (((pin - 1) + slot) % 4) + 1;
+}
+
+static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev)
+{
+       while (dev->bus->parent) {
+               /* Move up the chain of bridges. */
+               dev = dev->bus->self;
+       }
+
+       return dev;
+}
+
+/* Do platform specific device initialization at pci_enable_device() time */
+int pcibios_plat_dev_init(struct pci_dev *dev)
 {
        struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
-       int irq = bc->pci_int[slot];
+       struct pci_dev *rdev = bridge_root_dev(dev);
+       int slot = PCI_SLOT(rdev->devfn);
+       int irq;
 
+       irq = bc->pci_int[slot];
        if (irq == -1) {
-               irq = bc->pci_int[slot] = request_bridge_irq(bc);
+               irq = request_bridge_irq(bc);
                if (irq < 0)
-                       panic("Can't allocate interrupt for PCI device %s\n",
-                             pci_name(dev));
+                       return irq;
+
+               bc->pci_int[slot] = irq;
        }
 
        irq_to_bridge[irq] = bc;
        irq_to_slot[irq] = slot;
 
-       return irq;
-}
+       dev->irq = irq;
 
-/* Do platform specific device initialization at pci_enable_device() time */
-int pcibios_plat_dev_init(struct pci_dev *dev)
-{
        return 0;
 }
 
index f18ba9201bbcd7eda4a1336c545694f84841abcd..7b45f199d92a2d897f56af13fc1b4b9504c306b1 100644 (file)
@@ -1,3 +1,4 @@
-obj-y                          := setup.o rtc_xicor1241.o rtc_m41t81.o
+obj-y                          := platform.o setup.o rtc_xicor1241.o \
+                                  rtc_m41t81.o
 
 obj-$(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 (file)
index 0000000..54847fe
--- /dev/null
@@ -0,0 +1,85 @@
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/ata_platform.h>
+
+#include <asm/sibyte/board.h>
+#include <asm/sibyte/sb1250_genbus.h>
+#include <asm/sibyte/sb1250_regs.h>
+
+#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR)
+
+#define DRV_NAME       "pata-swarm"
+
+#define SWARM_IDE_SHIFT        5
+#define SWARM_IDE_BASE 0x1f0
+#define SWARM_IDE_CTRL 0x3f6
+
+static struct resource swarm_pata_resource[] = {
+       {
+               .name   = "Swarm GenBus IDE",
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .name   = "Swarm GenBus IDE",
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .name   = "Swarm GenBus IDE",
+               .flags  = IORESOURCE_IRQ,
+               .start  = K_INT_GB_IDE,
+               .end    = K_INT_GB_IDE,
+       },
+};
+
+static struct pata_platform_info pata_platform_data = {
+       .ioport_shift   = SWARM_IDE_SHIFT,
+};
+
+static struct platform_device swarm_pata_device = {
+       .name           = "pata_platform",
+       .id             = -1,
+       .resource       = swarm_pata_resource,
+       .num_resources  = ARRAY_SIZE(swarm_pata_resource),
+       .dev  = {
+               .platform_data          = &pata_platform_data,
+               .coherent_dma_mask      = ~0,   /* grumble */
+       },
+};
+
+static int __init swarm_pata_init(void)
+{
+       u8 __iomem *base;
+       phys_t offset, size;
+       struct resource *r;
+
+       if (!SIBYTE_HAVE_IDE)
+               return -ENODEV;
+
+       base = ioremap(A_IO_EXT_BASE, 0x800);
+       offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
+       size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
+       iounmap(base);
+
+       offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE;
+       size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE;
+       if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) {
+               pr_info(DRV_NAME ": PATA interface at GenBus disabled\n");
+
+               return -EBUSY;
+       }
+
+       pr_info(DRV_NAME ": PATA interface at GenBus slot %i\n", IDE_CS);
+
+       r = swarm_pata_resource;
+       r[0].start = offset + (SWARM_IDE_BASE << SWARM_IDE_SHIFT);
+       r[0].end   = offset + ((SWARM_IDE_BASE + 8) << SWARM_IDE_SHIFT) - 1;
+       r[1].start = offset + (SWARM_IDE_CTRL << SWARM_IDE_SHIFT);
+       r[1].end   = offset + ((SWARM_IDE_CTRL + 1) << SWARM_IDE_SHIFT) - 1;
+
+       return platform_device_register(&swarm_pata_device);
+}
+
+device_initcall(swarm_pata_init);
+
+#endif /* defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR) */
index cba36a247e32b634e21e0e03e2c39c27aa4342ea..92dd1a0ca3523023a30d887067c9e280864cfce5 100644 (file)
@@ -72,6 +72,7 @@ static void irq_dispatch(unsigned int irq)
        cascade = irq_cascade + irq;
        if (cascade->get_irq != NULL) {
                unsigned int source_irq = irq;
+               int ret;
                desc = irq_desc + source_irq;
                if (desc->chip->mask_ack)
                        desc->chip->mask_ack(source_irq);
@@ -79,8 +80,9 @@ static void irq_dispatch(unsigned int irq)
                        desc->chip->mask(source_irq);
                        desc->chip->ack(source_irq);
                }
-               irq = cascade->get_irq(irq);
-               if (irq < 0)
+               ret = cascade->get_irq(irq);
+               irq = ret;
+               if (ret < 0)
                        atomic_inc(&irq_err_count);
                else
                        irq_dispatch(irq);
index 761c434a2488fb39cd515d5232b109ade7443084..56c64ccc9c21cd2ee530baab8f0b7fcfbea5ce7c 100644 (file)
@@ -20,22 +20,8 @@ EXPORT_SYMBOL(__mn10300_irq_enabled_epsw);
 atomic_t irq_err_count;
 
 /*
- * MN10300 INTC controller operations
+ * MN10300 interrupt controller operations
  */
-static void mn10300_cpupic_disable(unsigned int irq)
-{
-       u16 tmp = GxICR(irq);
-       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_DETECT;
-       tmp = GxICR(irq);
-}
-
-static void mn10300_cpupic_enable(unsigned int irq)
-{
-       u16 tmp = GxICR(irq);
-       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE;
-       tmp = GxICR(irq);
-}
-
 static void mn10300_cpupic_ack(unsigned int irq)
 {
        u16 tmp;
@@ -60,26 +46,54 @@ static void mn10300_cpupic_mask_ack(unsigned int irq)
 static void mn10300_cpupic_unmask(unsigned int irq)
 {
        u16 tmp = GxICR(irq);
-       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT;
+       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE;
        tmp = GxICR(irq);
 }
 
-static void mn10300_cpupic_end(unsigned int irq)
+static void mn10300_cpupic_unmask_clear(unsigned int irq)
 {
+       /* the MN10300 PIC latches its interrupt request bit, even after the
+        * device has ceased to assert its interrupt line and the interrupt
+        * channel has been disabled in the PIC, so for level-triggered
+        * interrupts we need to clear the request bit when we re-enable */
        u16 tmp = GxICR(irq);
-       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE;
+       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT;
        tmp = GxICR(irq);
 }
 
-static struct irq_chip mn10300_cpu_pic = {
-       .name           = "cpu",
-       .disable        = mn10300_cpupic_disable,
-       .enable         = mn10300_cpupic_enable,
+/*
+ * MN10300 PIC level-triggered IRQ handling.
+ *
+ * The PIC has no 'ACK' function per se.  It is possible to clear individual
+ * channel latches, but each latch relatches whether or not the channel is
+ * masked, so we need to clear the latch when we unmask the channel.
+ *
+ * Also for this reason, we don't supply an ack() op (it's unused anyway if
+ * mask_ack() is provided), and mask_ack() just masks.
+ */
+static struct irq_chip mn10300_cpu_pic_level = {
+       .name           = "cpu_l",
+       .disable        = mn10300_cpupic_mask,
+       .enable         = mn10300_cpupic_unmask_clear,
+       .ack            = NULL,
+       .mask           = mn10300_cpupic_mask,
+       .mask_ack       = mn10300_cpupic_mask,
+       .unmask         = mn10300_cpupic_unmask_clear,
+};
+
+/*
+ * MN10300 PIC edge-triggered IRQ handling.
+ *
+ * We use the latch clearing function of the PIC as the 'ACK' function.
+ */
+static struct irq_chip mn10300_cpu_pic_edge = {
+       .name           = "cpu_e",
+       .disable        = mn10300_cpupic_mask,
+       .enable         = mn10300_cpupic_unmask,
        .ack            = mn10300_cpupic_ack,
        .mask           = mn10300_cpupic_mask,
        .mask_ack       = mn10300_cpupic_mask_ack,
        .unmask         = mn10300_cpupic_unmask,
-       .end            = mn10300_cpupic_end,
 };
 
 /*
@@ -114,7 +128,8 @@ void set_intr_level(int irq, u16 level)
  */
 void set_intr_postackable(int irq)
 {
-       set_irq_handler(irq, handle_level_irq);
+       set_irq_chip_and_handler(irq, &mn10300_cpu_pic_level,
+                                handle_level_irq);
 }
 
 /*
@@ -126,8 +141,12 @@ void __init init_IRQ(void)
 
        for (irq = 0; irq < NR_IRQS; irq++)
                if (irq_desc[irq].chip == &no_irq_type)
-                       set_irq_chip_and_handler(irq, &mn10300_cpu_pic,
-                                                handle_edge_irq);
+                       /* due to the PIC latching interrupt requests, even
+                        * when the IRQ is disabled, IRQ_PENDING is superfluous
+                        * and we can use handle_level_irq() for edge-triggered
+                        * interrupts */
+                       set_irq_chip_and_handler(irq, &mn10300_cpu_pic_edge,
+                                                handle_level_irq);
        unit_init_IRQ();
 }
 
index babb7c2ac37701be5065da1e9cba3d1659cf636c..e4606586f94ce5e08d35720ca8b4f7512db4aa34 100644 (file)
@@ -1,6 +1,6 @@
 /* MN10300 Low level time management
  *
- * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
+ * Copyright (C) 2007-2008 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells (dhowells@redhat.com)
  * - Derived from arch/i386/kernel/time.c
  *
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/profile.h>
+#include <linux/cnt32_to_63.h>
 #include <asm/irq.h>
 #include <asm/div64.h>
 #include <asm/processor.h>
@@ -40,27 +41,54 @@ static struct irqaction timer_irq = {
        .name           = "timer",
 };
 
+static unsigned long sched_clock_multiplier;
+
 /*
  * scheduler clock - returns current time in nanosec units.
  */
 unsigned long long sched_clock(void)
 {
        union {
-               unsigned long long l;
-               u32 w[2];
-       } quot;
+               unsigned long long ll;
+               unsigned l[2];
+       } tsc64, result;
+       unsigned long tsc, tmp;
+       unsigned product[3]; /* 96-bit intermediate value */
+
+       /* read the TSC value
+        */
+       tsc = 0 - get_cycles(); /* get_cycles() counts down */
 
-       quot.w[0] = mn10300_last_tsc - get_cycles();
-       quot.w[1] = 1000000000;
+       /* expand to 64-bits.
+        * - sched_clock() must be called once a minute or better or the
+        *   following will go horribly wrong - see cnt32_to_63()
+        */
+       tsc64.ll = cnt32_to_63(tsc) & 0x7fffffffffffffffULL;
 
-       asm("mulu %2,%3,%0,%1"
-           : "=r"(quot.w[1]), "=r"(quot.w[0])
-           : "0"(quot.w[1]), "1"(quot.w[0])
+       /* scale the 64-bit TSC value to a nanosecond value via a 96-bit
+        * intermediate
+        */
+       asm("mulu       %2,%0,%3,%0     \n"     /* LSW * mult ->  0:%3:%0 */
+           "mulu       %2,%1,%2,%1     \n"     /* MSW * mult -> %2:%1:0 */
+           "add        %3,%1           \n"
+           "addc       0,%2            \n"     /* result in %2:%1:%0 */
+           : "=r"(product[0]), "=r"(product[1]), "=r"(product[2]), "=r"(tmp)
+           :  "0"(tsc64.l[0]),  "1"(tsc64.l[1]),  "2"(sched_clock_multiplier)
            : "cc");
 
-       do_div(quot.l, MN10300_TSCCLK);
+       result.l[0] = product[1] << 16 | product[0] >> 16;
+       result.l[1] = product[2] << 16 | product[1] >> 16;
 
-       return quot.l;
+       return result.ll;
+}
+
+/*
+ * initialise the scheduler clock
+ */
+static void __init mn10300_sched_clock_init(void)
+{
+       sched_clock_multiplier =
+               __muldiv64u(NSEC_PER_SEC, 1 << 16, MN10300_TSCCLK);
 }
 
 /*
@@ -128,4 +156,6 @@ void __init time_init(void)
        /* start the watchdog timer */
        watchdog_go();
 #endif
+
+       mn10300_sched_clock_init();
 }
index 14b2c817cff8a83e04a6b85be9de5513e7146599..70e8cb4ea266153e0d0217933ff84e4f61bed7e1 100644 (file)
@@ -51,7 +51,7 @@ void __init unit_init_IRQ(void)
                switch (GET_XIRQ_TRIGGER(extnum)) {
                case XIRQ_TRIGGER_HILEVEL:
                case XIRQ_TRIGGER_LOWLEVEL:
-                       set_irq_handler(XIRQ2IRQ(extnum), handle_level_irq);
+                       set_intr_postackable(XIRQ2IRQ(extnum));
                        break;
                default:
                        break;
index 6a352414a3584933b2192f5a391c337e0fddfd63..72812a9439ac0d26ea30f4cf2fc62099efc3735c 100644 (file)
@@ -52,7 +52,7 @@ void __init unit_init_IRQ(void)
                switch (GET_XIRQ_TRIGGER(extnum)) {
                case XIRQ_TRIGGER_HILEVEL:
                case XIRQ_TRIGGER_LOWLEVEL:
-                       set_irq_handler(XIRQ2IRQ(extnum), handle_level_irq);
+                       set_intr_postackable(XIRQ2IRQ(extnum));
                        break;
                default:
                        break;
index 717a3bc1352e542d410e3713e2222e7ea2745516..65d1a8454d2cfb11e54ffa3082c16bc3316bd4da 100644 (file)
@@ -195,7 +195,7 @@ image-$(CONFIG_PPC_CELLEB)          += zImage.pseries
 image-$(CONFIG_PPC_CHRP)               += zImage.chrp
 image-$(CONFIG_PPC_EFIKA)              += zImage.chrp
 image-$(CONFIG_PPC_PMAC)               += zImage.pmac
-image-$(CONFIG_PPC_HOLLY)              += zImage.holly
+image-$(CONFIG_PPC_HOLLY)              += dtbImage.holly
 image-$(CONFIG_PPC_PRPMC2800)          += dtbImage.prpmc2800
 image-$(CONFIG_PPC_ISERIES)            += zImage.iseries
 image-$(CONFIG_DEFAULT_UIMAGE)         += uImage
index f87fe7b9ced946e6e5a1ac699d97af48404397cb..c6e11ebecebbe46ccd57d2aaf0cc98c05b594c61 100644 (file)
                        reg = <0x00007400 0x00000400>;
                        big-endian;
                };
+       };
 
-               pci@1000 {
-                       device_type = "pci";
-                       compatible = "tsi109-pci", "tsi108-pci";
-                       #interrupt-cells = <1>;
-                       #size-cells = <2>;
-                       #address-cells = <3>;
-                       reg = <0x00001000 0x00001000>;
-                       bus-range = <0x0 0x0>;
-                       /*----------------------------------------------------+
-                       | PCI memory range.
-                       | 01 denotes I/O space
-                       | 02 denotes 32-bit memory space
-                       +----------------------------------------------------*/
-                       ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000
-                                 0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>;
-                       clock-frequency = <133333332>;
-                       interrupt-parent = <&MPIC>;
+       pci@c0001000 {
+               device_type = "pci";
+               compatible = "tsi109-pci", "tsi108-pci";
+               #interrupt-cells = <1>;
+               #size-cells = <2>;
+               #address-cells = <3>;
+               reg = <0xc0001000 0x00001000>;
+               bus-range = <0x0 0x0>;
+               /*----------------------------------------------------+
+               | PCI memory range.
+               | 01 denotes I/O space
+               | 02 denotes 32-bit memory space
+               +----------------------------------------------------*/
+               ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000
+                         0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>;
+               clock-frequency = <133333332>;
+               interrupt-parent = <&MPIC>;
+               interrupts = <0x17 0x2>;
+               interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+               /*----------------------------------------------------+
+               | The INTA, INTB, INTC, INTD are shared.
+               +----------------------------------------------------*/
+               interrupt-map = <
+                       0x800 0x0 0x0 0x1 &RT0 0x24 0x0
+                       0x800 0x0 0x0 0x2 &RT0 0x25 0x0
+                       0x800 0x0 0x0 0x3 &RT0 0x26 0x0
+                       0x800 0x0 0x0 0x4 &RT0 0x27 0x0
+
+                       0x1000 0x0 0x0 0x1 &RT0 0x25 0x0
+                       0x1000 0x0 0x0 0x2 &RT0 0x26 0x0
+                       0x1000 0x0 0x0 0x3 &RT0 0x27 0x0
+                       0x1000 0x0 0x0 0x4 &RT0 0x24 0x0
+
+                       0x1800 0x0 0x0 0x1 &RT0 0x26 0x0
+                       0x1800 0x0 0x0 0x2 &RT0 0x27 0x0
+                       0x1800 0x0 0x0 0x3 &RT0 0x24 0x0
+                       0x1800 0x0 0x0 0x4 &RT0 0x25 0x0
+
+                       0x2000 0x0 0x0 0x1 &RT0 0x27 0x0
+                       0x2000 0x0 0x0 0x2 &RT0 0x24 0x0
+                       0x2000 0x0 0x0 0x3 &RT0 0x25 0x0
+                       0x2000 0x0 0x0 0x4 &RT0 0x26 0x0
+                       >;
+
+               RT0: router@1180 {
+                       device_type = "pic-router";
+                       interrupt-controller;
+                       big-endian;
+                       clock-frequency = <0>;
+                       #address-cells = <0>;
+                       #interrupt-cells = <2>;
                        interrupts = <0x17 0x2>;
-                       interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
-                       /*----------------------------------------------------+
-                       | The INTA, INTB, INTC, INTD are shared.
-                       +----------------------------------------------------*/
-                       interrupt-map = <
-                               0x800 0x0 0x0 0x1 &RT0 0x24 0x0
-                               0x800 0x0 0x0 0x2 &RT0 0x25 0x0
-                               0x800 0x0 0x0 0x3 &RT0 0x26 0x0
-                               0x800 0x0 0x0 0x4 &RT0 0x27 0x0
-
-                               0x1000 0x0 0x0 0x1 &RT0 0x25 0x0
-                               0x1000 0x0 0x0 0x2 &RT0 0x26 0x0
-                               0x1000 0x0 0x0 0x3 &RT0 0x27 0x0
-                               0x1000 0x0 0x0 0x4 &RT0 0x24 0x0
-
-                               0x1800 0x0 0x0 0x1 &RT0 0x26 0x0
-                               0x1800 0x0 0x0 0x2 &RT0 0x27 0x0
-                               0x1800 0x0 0x0 0x3 &RT0 0x24 0x0
-                               0x1800 0x0 0x0 0x4 &RT0 0x25 0x0
-
-                               0x2000 0x0 0x0 0x1 &RT0 0x27 0x0
-                               0x2000 0x0 0x0 0x2 &RT0 0x24 0x0
-                               0x2000 0x0 0x0 0x3 &RT0 0x25 0x0
-                               0x2000 0x0 0x0 0x4 &RT0 0x26 0x0
-                               >;
-
-                       RT0: router@1180 {
-                               device_type = "pic-router";
-                               interrupt-controller;
-                               big-endian;
-                               clock-frequency = <0>;
-                               #address-cells = <0>;
-                               #interrupt-cells = <2>;
-                               interrupts = <0x17 0x2>;
-                               interrupt-parent = <&MPIC>;
-                       };
+                       interrupt-parent = <&MPIC>;
                };
        };
 
index 3b3a1062cb250886e7d056169ab5e343afe14d5d..584a4f184eb26cddbac0d50c7feb52f406ab7e05 100644 (file)
                                cell-index = <0>;
                                reg = <0x0 0x80>;
                                interrupt-parent = <&mpic>;
-                               interrupts = <60 2>;
+                               interrupts = <76 2>;
                        };
                        dma-channel@1 {
                                compatible = "fsl,mpc8610-dma-channel",
                                cell-index = <1>;
                                reg = <0x80 0x80>;
                                interrupt-parent = <&mpic>;
-                               interrupts = <61 2>;
+                               interrupts = <77 2>;
                        };
                        dma-channel@2 {
                                compatible = "fsl,mpc8610-dma-channel",
                                cell-index = <2>;
                                reg = <0x100 0x80>;
                                interrupt-parent = <&mpic>;
-                               interrupts = <62 2>;
+                               interrupts = <78 2>;
                        };
                        dma-channel@3 {
                                compatible = "fsl,mpc8610-dma-channel",
                                cell-index = <3>;
                                reg = <0x180 0x80>;
                                interrupt-parent = <&mpic>;
-                               interrupts = <63 2>;
+                               interrupts = <79 2>;
                        };
                };
 
index 80d1f399ee513a944aae0b7366a55d588393fac9..64c6ee22eefd6ba4cb6dd5da54bd801440111c2a 100644 (file)
@@ -409,6 +409,13 @@ do {                                                                       \
 /* Keep this the last entry.  */
 #define R_PPC64_NUM            107
 
+/* There's actually a third entry here, but it's unused */
+struct ppc64_opd_entry
+{
+       unsigned long funcaddr;
+       unsigned long r2;
+};
+
 #ifdef  __KERNEL__
 
 #ifdef CONFIG_SPU_BASE
index 7710e9e6660fc52ef703c540a95b16a892ba3fca..07956f3e78444f5f63390d8d328c000af957061f 100644 (file)
@@ -2,6 +2,8 @@
 #define _ASM_POWERPC_SECTIONS_H
 #ifdef __KERNEL__
 
+#include <linux/elf.h>
+#include <linux/uaccess.h>
 #include <asm-generic/sections.h>
 
 #ifdef __powerpc64__
@@ -17,7 +19,15 @@ static inline int in_kernel_text(unsigned long addr)
 }
 
 #undef dereference_function_descriptor
-void *dereference_function_descriptor(void *);
+static inline void *dereference_function_descriptor(void *ptr)
+{
+       struct ppc64_opd_entry *desc = ptr;
+       void *p;
+
+       if (!probe_kernel_address(&desc->funcaddr, p))
+               ptr = p;
+       return ptr;
+}
 
 #endif
 
index d308a9f70f1b81b970ef0f13df10454f0deee3d9..31982d05d81a8814d73dfc8b5a562cd90b66e5d3 100644 (file)
 #include <asm/smp.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-/* this is used for software suspend, and that shuts down
- * CPUs even while the system is still booting... */
-#define cpu_should_die()       (cpu_is_offline(smp_processor_id()) && \
-                                  (system_state == SYSTEM_RUNNING     \
-                                || system_state == SYSTEM_BOOTING))
+#define cpu_should_die()       cpu_is_offline(smp_processor_id())
 #else
 #define cpu_should_die()       0
 #endif
index b4fdf2f2743ca6cb7497bba075f80b9b413d01dc..fe8f71dd0b3f1bd711ca4a480cdcdc2943007c9f 100644 (file)
@@ -347,9 +347,8 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
                        linux_regs->msr |= MSR_SE;
 #endif
                        kgdb_single_step = 1;
-                       if (kgdb_contthread)
-                               atomic_set(&kgdb_cpu_doing_single_step,
-                                          raw_smp_processor_id());
+                       atomic_set(&kgdb_cpu_doing_single_step,
+                                  raw_smp_processor_id());
                }
                return 0;
        }
index ad79de272ff3ec7f7ee14062f48eed082511e2e0..1af2377e49929dc367d49b4588fd2ba6d23d7e91 100644 (file)
@@ -21,9 +21,7 @@
 #include <linux/err.h>
 #include <linux/vmalloc.h>
 #include <linux/bug.h>
-#include <linux/uaccess.h>
 #include <asm/module.h>
-#include <asm/sections.h>
 #include <asm/firmware.h>
 #include <asm/code-patching.h>
 #include <linux/sort.h>
 #define DEBUGP(fmt , ...)
 #endif
 
-/* There's actually a third entry here, but it's unused */
-struct ppc64_opd_entry
-{
-       unsigned long funcaddr;
-       unsigned long r2;
-};
-
 /* Like PPC32, we need little trampolines to do > 24-bit jumps (into
    the kernel itself).  But on PPC64, these need to be used for every
    jump, actually, to reset r2 (TOC+0x8000). */
@@ -452,13 +443,3 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
 
        return 0;
 }
-
-void *dereference_function_descriptor(void *ptr)
-{
-       struct ppc64_opd_entry *desc = ptr;
-       void *p;
-
-       if (!probe_kernel_address(&desc->funcaddr, p))
-               ptr = p;
-       return ptr;
-}
index ef74a0763ec124a063c67992b99ac9e8f6d6f316..8c619963becceed0ac702c5b4662387adcbe720f 100644 (file)
@@ -219,11 +219,21 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
        int i;
        u8 *dummy;
        struct pci_bus *bus = dev->bus;
+       resource_size_t end = 0;
+
+       for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCES+3; i++) {
+               unsigned long flags = pci_resource_flags(dev, i);
+               if ((flags & (IORESOURCE_MEM|IORESOURCE_PREFETCH)) == IORESOURCE_MEM)
+                       end = pci_resource_end(dev, i);
+       }
 
        for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
                if ((bus->resource[i]) &&
                        (bus->resource[i]->flags & IORESOURCE_MEM)) {
-                       dummy = ioremap(bus->resource[i]->end - 3, 0x4);
+                       if (bus->resource[i]->end == end)
+                               dummy = ioremap(bus->resource[i]->start, 0x4);
+                       else
+                               dummy = ioremap(bus->resource[i]->end - 3, 0x4);
                        if (dummy) {
                                in_8(dummy);
                                iounmap(dummy);
index ca114fe46ffbd5ed69033d37ebd13783c2f2a5f1..06acb1a18bbcb44458a8f04da85f00f54345ca1b 100644 (file)
@@ -169,6 +169,8 @@ void init_cpu_timer(void)
 
 static void clock_comparator_interrupt(__u16 code)
 {
+       if (S390_lowcore.clock_comparator == -1ULL)
+               set_clock_comparator(S390_lowcore.clock_comparator);
 }
 
 static void etr_timing_alert(struct etr_irq_parm *);
index fc6ab6094df811c4511b37ceb7d9783170d98e5a..0953cee05efc2d40cefcf8819c650de563462f6b 100644 (file)
@@ -1,14 +1,9 @@
 /*
- *  arch/s390/lib/delay.c
  *    Precise Delay Loops for S390
  *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *
- *  Derived from "arch/i386/lib/delay.c"
- *    Copyright (C) 1993 Linus Torvalds
- *    Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *    Copyright IBM Corp. 1999,2008
+ *    Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
+ *              Heiko Carstens <heiko.carstens@de.ibm.com>,
  */
 
 #include <linux/sched.h>
@@ -29,30 +24,31 @@ void __delay(unsigned long loops)
        asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1));
 }
 
-/*
- * Waits for 'usecs' microseconds using the TOD clock comparator.
- */
-void __udelay(unsigned long usecs)
+static void __udelay_disabled(unsigned long usecs)
 {
-       u64 end, time, old_cc = 0;
-       unsigned long flags, cr0, mask, dummy;
-       int irq_context;
+       unsigned long mask, cr0, cr0_saved;
+       u64 clock_saved;
 
-       irq_context = in_interrupt();
-       if (!irq_context)
-               local_bh_disable();
-       local_irq_save(flags);
-       if (raw_irqs_disabled_flags(flags)) {
-               old_cc = local_tick_disable();
-               S390_lowcore.clock_comparator = -1ULL;
-               __ctl_store(cr0, 0, 0);
-               dummy = (cr0 & 0xffff00e0) | 0x00000800;
-               __ctl_load(dummy , 0, 0);
-               mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT;
-       } else
-               mask = psw_kernel_bits | PSW_MASK_WAIT |
-                       PSW_MASK_EXT | PSW_MASK_IO;
+       clock_saved = local_tick_disable();
+       set_clock_comparator(get_clock() + ((u64) usecs << 12));
+       __ctl_store(cr0_saved, 0, 0);
+       cr0 = (cr0_saved & 0xffff00e0) | 0x00000800;
+       __ctl_load(cr0 , 0, 0);
+       mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT;
+       trace_hardirqs_on();
+       __load_psw_mask(mask);
+       local_irq_disable();
+       __ctl_load(cr0_saved, 0, 0);
+       local_tick_enable(clock_saved);
+       set_clock_comparator(S390_lowcore.clock_comparator);
+}
 
+static void __udelay_enabled(unsigned long usecs)
+{
+       unsigned long mask;
+       u64 end, time;
+
+       mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO;
        end = get_clock() + ((u64) usecs << 12);
        do {
                time = end < S390_lowcore.clock_comparator ?
@@ -62,13 +58,37 @@ void __udelay(unsigned long usecs)
                __load_psw_mask(mask);
                local_irq_disable();
        } while (get_clock() < end);
+       set_clock_comparator(S390_lowcore.clock_comparator);
+}
 
-       if (raw_irqs_disabled_flags(flags)) {
-               __ctl_load(cr0, 0, 0);
-               local_tick_enable(old_cc);
+/*
+ * Waits for 'usecs' microseconds using the TOD clock comparator.
+ */
+void __udelay(unsigned long usecs)
+{
+       unsigned long flags;
+
+       preempt_disable();
+       local_irq_save(flags);
+       if (in_irq()) {
+               __udelay_disabled(usecs);
+               goto out;
+       }
+       if (in_softirq()) {
+               if (raw_irqs_disabled_flags(flags))
+                       __udelay_disabled(usecs);
+               else
+                       __udelay_enabled(usecs);
+               goto out;
        }
-       if (!irq_context)
+       if (raw_irqs_disabled_flags(flags)) {
+               local_bh_disable();
+               __udelay_disabled(usecs);
                _local_bh_enable();
-       set_clock_comparator(S390_lowcore.clock_comparator);
+               goto out;
+       }
+       __udelay_enabled(usecs);
+out:
        local_irq_restore(flags);
+       preempt_enable();
 }
index 23963882bc18f203cd27850300cbb80755df025e..7495bc774685d53df0385bebec0cad80e4a9e27d 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/linkage.h>
 #include <linux/ptrace.h>
 #include <linux/errno.h>
 #include <linux/kernel_stat.h>
@@ -866,7 +867,7 @@ static void kill_prom_timer(void)
        : "g1", "g2");
 }
 
-void init_irqwork_curcpu(void)
+void notrace init_irqwork_curcpu(void)
 {
        int cpu = hard_smp_processor_id();
 
@@ -897,7 +898,7 @@ static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type
        }
 }
 
-void __cpuinit sun4v_register_mondo_queues(int this_cpu)
+void __cpuinit notrace sun4v_register_mondo_queues(int this_cpu)
 {
        struct trap_per_cpu *tb = &trap_block[this_cpu];
 
index f845f150f565b26a019dea86afa7a6b9d2970ce7..100ebd527499991f39b094709fe597fa77f571f6 100644 (file)
@@ -169,7 +169,7 @@ static unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long fla
 
 static int of_bus_pci_match(struct device_node *np)
 {
-       if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) {
+       if (!strcmp(np->name, "pci")) {
                const char *model = of_get_property(np, "model", NULL);
 
                if (model && !strcmp(model, "SUNW,simba"))
@@ -200,7 +200,7 @@ static int of_bus_simba_match(struct device_node *np)
        /* Treat PCI busses lacking ranges property just like
         * simba.
         */
-       if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) {
+       if (!strcmp(np->name, "pci")) {
                if (!of_find_property(np, "ranges", NULL))
                        return 1;
        }
@@ -429,7 +429,7 @@ static int __init use_1to1_mapping(struct device_node *pp)
         * it lacks a ranges property, and this will include
         * cases like Simba.
         */
-       if (!strcmp(pp->type, "pci") || !strcmp(pp->type, "pciex"))
+       if (!strcmp(pp->name, "pci"))
                return 0;
 
        return 1;
@@ -714,8 +714,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
                                break;
                        }
                } else {
-                       if (!strcmp(pp->type, "pci") ||
-                           !strcmp(pp->type, "pciex")) {
+                       if (!strcmp(pp->name, "pci")) {
                                unsigned int this_orig_irq = irq;
 
                                irq = pci_irq_swizzle(dp, pp, irq);
index 55096195458fa0d358364075c5c7f06617112a55..80dad76f8b81c24b55cc3d26177cae9b7fa7ca79 100644 (file)
@@ -425,7 +425,7 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
        dev->current_state = 4;         /* unknown power state */
        dev->error_state = pci_channel_io_normal;
 
-       if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
+       if (!strcmp(node->name, "pci")) {
                /* a PCI-PCI bridge */
                dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
                dev->rom_base_reg = PCI_ROM_ADDRESS1;
index e205ade69cfc0392b4b702539b191ecfb5a1bc83..f85b6bebb0be1c7548366e982270ed4e85c3a320 100644 (file)
@@ -575,7 +575,7 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
 {
        unsigned long csr_reg, csr, csr_error_bits;
        irqreturn_t ret = IRQ_NONE;
-       u16 stat;
+       u16 stat, *addr;
 
        if (is_pbm_a) {
                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
                        printk("%s: PCI SERR signal asserted.\n", pbm->name);
                ret = IRQ_HANDLED;
        }
-       pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat);
+       addr = psycho_pci_config_mkaddr(pbm, pbm->pci_first_busno,
+                                       0, PCI_STATUS);
+       pci_config_read16(addr, &stat);
        if (stat & (PCI_STATUS_PARITY |
                    PCI_STATUS_SIG_TARGET_ABORT |
                    PCI_STATUS_REC_TARGET_ABORT |
@@ -605,7 +607,7 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
                    PCI_STATUS_SIG_SYSTEM_ERROR)) {
                printk("%s: PCI bus error, PCI_STATUS[%04x]\n",
                       pbm->name, stat);
-               pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff);
+               pci_config_write16(addr, 0xffff);
                ret = IRQ_HANDLED;
        }
        return ret;
index 3d924121c7960dd5b577c291a9a2dd716a272b2d..c824df13f589a31bdd048ddc1464f8d7e1c9e6d9 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/linkage.h>
 #include <linux/kernel.h>
 #include <linux/signal.h>
 #include <linux/smp.h>
@@ -2453,7 +2454,7 @@ struct trap_per_cpu trap_block[NR_CPUS];
 /* This can get invoked before sched_init() so play it super safe
  * and use hard_smp_processor_id().
  */
-void init_cur_cpu_trap(struct thread_info *t)
+void notrace init_cur_cpu_trap(struct thread_info *t)
 {
        int cpu = hard_smp_processor_id();
        struct trap_per_cpu *p = &trap_block[cpu];
index 39fd3f42696d861727572fc29bf0c9a608281573..0d7cdbbfc1ee7768280ba807f0ebfa8e30070bb4 100644 (file)
@@ -29,6 +29,7 @@ config X86
        select HAVE_FTRACE
        select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
        select HAVE_ARCH_KGDB if !X86_VOYAGER
+       select HAVE_ARCH_TRACEHOOK
        select HAVE_GENERIC_DMA_COHERENT if X86_32
        select HAVE_EFFICIENT_UNALIGNED_ACCESS
 
@@ -1021,7 +1022,7 @@ config HAVE_ARCH_ALLOC_REMAP
 
 config ARCH_FLATMEM_ENABLE
        def_bool y
-       depends on X86_32 && ARCH_SELECT_MEMORY_MODEL && X86_PC && !NUMA
+       depends on X86_32 && ARCH_SELECT_MEMORY_MODEL && !NUMA
 
 config ARCH_DISCONTIGMEM_ENABLE
        def_bool y
@@ -1037,7 +1038,7 @@ config ARCH_SPARSEMEM_DEFAULT
 
 config ARCH_SPARSEMEM_ENABLE
        def_bool y
-       depends on X86_64 || NUMA || (EXPERIMENTAL && X86_PC)
+       depends on X86_64 || NUMA || (EXPERIMENTAL && X86_PC) || X86_GENERICARCH
        select SPARSEMEM_STATIC if X86_32
        select SPARSEMEM_VMEMMAP_ENABLE if X86_64
 
@@ -1118,10 +1119,10 @@ config MTRR
          You can safely say Y even if your machine doesn't have MTRRs, you'll
          just add about 9 KB to your kernel.
 
-         See <file:Documentation/mtrr.txt> for more information.
+         See <file:Documentation/x86/mtrr.txt> for more information.
 
 config MTRR_SANITIZER
-       bool
+       def_bool y
        prompt "MTRR cleanup support"
        depends on MTRR
        help
@@ -1132,7 +1133,7 @@ config MTRR_SANITIZER
          The largest mtrr entry size for a continous block can be set with
          mtrr_chunk_size.
 
-         If unsure, say N.
+         If unsure, say Y.
 
 config MTRR_SANITIZER_ENABLE_DEFAULT
        int "MTRR cleanup enable value (0-1)"
@@ -1192,7 +1193,6 @@ config IRQBALANCE
 config SECCOMP
        def_bool y
        prompt "Enable seccomp to safely compute untrusted bytecode"
-       depends on PROC_FS
        help
          This kernel feature is useful for number crunching applications
          that may need to compute untrusted bytecode during their
@@ -1200,7 +1200,7 @@ config SECCOMP
          the process as file descriptors supporting the read/write
          syscalls, it's possible to isolate those applications in
          their own address space using seccomp. Once seccomp is
-         enabled via /proc/<pid>/seccomp, it cannot be disabled
+         enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
          and the task is only allowed to execute a few safe syscalls
          defined by each seccomp mode.
 
@@ -1357,14 +1357,14 @@ config PHYSICAL_ALIGN
          Don't change this unless you know what you are doing.
 
 config HOTPLUG_CPU
-       bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
-       depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER
+       bool "Support for hot-pluggable CPUs"
+       depends on SMP && HOTPLUG && !X86_VOYAGER
        ---help---
-         Say Y here to experiment with turning CPUs off and on, and to
-         enable suspend on SMP systems. CPUs can be controlled through
-         /sys/devices/system/cpu.
-         Say N if you want to disable CPU hotplug and don't need to
-         suspend.
+         Say Y here to allow turning CPUs off and on. CPUs can be
+         controlled through /sys/devices/system/cpu.
+         ( Note: power management support will enable this option
+           automatically on SMP systems. )
+         Say N if you want to disable CPU hotplug.
 
 config COMPAT_VDSO
        def_bool y
@@ -1379,6 +1379,51 @@ config COMPAT_VDSO
 
          If unsure, say Y.
 
+config CMDLINE_BOOL
+       bool "Built-in kernel command line"
+       default n
+       help
+         Allow for specifying boot arguments to the kernel at
+         build time.  On some systems (e.g. embedded ones), it is
+         necessary or convenient to provide some or all of the
+         kernel boot arguments with the kernel itself (that is,
+         to not rely on the boot loader to provide them.)
+
+         To compile command line arguments into the kernel,
+         set this option to 'Y', then fill in the
+         the boot arguments in CONFIG_CMDLINE.
+
+         Systems with fully functional boot loaders (i.e. non-embedded)
+         should leave this option set to 'N'.
+
+config CMDLINE
+       string "Built-in kernel command string"
+       depends on CMDLINE_BOOL
+       default ""
+       help
+         Enter arguments here that should be compiled into the kernel
+         image and used at boot time.  If the boot loader provides a
+         command line at boot time, it is appended to this string to
+         form the full kernel command line, when the system boots.
+
+         However, you can use the CONFIG_CMDLINE_OVERRIDE option to
+         change this behavior.
+
+         In most cases, the command line (whether built-in or provided
+         by the boot loader) should specify the device for the root
+         file system.
+
+config CMDLINE_OVERRIDE
+       bool "Built-in command line overrides boot loader arguments"
+       default n
+       depends on CMDLINE_BOOL
+       help
+         Set this option to 'Y' to have the kernel ignore the boot loader
+         command line, and use ONLY the built-in command line.
+
+         This is used to work around broken boot loaders.  This should
+         be set to 'N' under normal conditions.
+
 endmenu
 
 config ARCH_ENABLE_MEMORY_HOTPLUG
@@ -1774,7 +1819,7 @@ config COMPAT_FOR_U64_ALIGNMENT
 
 config SYSVIPC_COMPAT
        def_bool y
-       depends on X86_64 && COMPAT && SYSVIPC
+       depends on COMPAT && SYSVIPC
 
 endmenu
 
index b225219c448ca4cc44c7de2402b8c894e8b5da3e..60a85768cfcba7b78c15f183fe99017e35792880 100644 (file)
@@ -418,3 +418,21 @@ config X86_MINIMUM_CPU_FAMILY
 config X86_DEBUGCTLMSR
        def_bool y
        depends on !(MK6 || MWINCHIPC6 || MWINCHIP2 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386)
+
+config X86_DS
+       bool "Debug Store support"
+       default y
+       help
+         Add support for Debug Store.
+         This allows the kernel to provide a memory buffer to the hardware
+         to store various profiling and tracing events.
+
+config X86_PTRACE_BTS
+       bool "ptrace interface to Branch Trace Store"
+       default y
+       depends on (X86_DS && X86_DEBUGCTLMSR)
+       help
+         Add a ptrace interface to allow collecting an execution trace
+         of the traced task.
+         This collects control flow changes in a (cyclic) buffer and allows
+         debuggers to fill in the gaps and show an execution trace of the debuggee.
index ba7736cf2ec73e8977e447a8ab852d083f079c42..29c5fbf08392359ec77f4149b7b45c24cd8d071b 100644 (file)
@@ -137,14 +137,15 @@ relocated:
  */
        movl output_len(%ebx), %eax
        pushl %eax
+                       # push arguments for decompress_kernel:
        pushl %ebp      # output address
        movl input_len(%ebx), %eax
        pushl %eax      # input_len
        leal input_data(%ebx), %eax
        pushl %eax      # input_data
        leal boot_heap(%ebx), %eax
-       pushl %eax      # heap area as third argument
-       pushl %esi      # real mode pointer as second arg
+       pushl %eax      # heap area
+       pushl %esi      # real mode pointer
        call decompress_kernel
        addl $20, %esp
        popl %ecx
index 9fea737064798bfd10ab78cf729b14cfd8b87681..5780d361105bf4863328243386ed69ecdbc89889 100644 (file)
@@ -16,7 +16,7 @@
  */
 #undef CONFIG_PARAVIRT
 #ifdef CONFIG_X86_32
-#define _ASM_DESC_H_ 1
+#define ASM_X86__DESC_H 1
 #endif
 
 #ifdef CONFIG_X86_64
@@ -27,7 +27,7 @@
 #include <linux/linkage.h>
 #include <linux/screen_info.h>
 #include <linux/elf.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/page.h>
 #include <asm/boot.h>
 #include <asm/bootparam.h>
@@ -251,7 +251,7 @@ static void __putstr(int error, const char *s)
                                y--;
                        }
                } else {
-                       vidmem [(x + cols * y) * 2] = c;
+                       vidmem[(x + cols * y) * 2] = c;
                        if (++x >= cols) {
                                x = 0;
                                if (++y >= lines) {
@@ -277,7 +277,8 @@ static void *memset(void *s, int c, unsigned n)
        int i;
        char *ss = s;
 
-       for (i = 0; i < n; i++) ss[i] = c;
+       for (i = 0; i < n; i++)
+               ss[i] = c;
        return s;
 }
 
@@ -287,7 +288,8 @@ static void *memcpy(void *dest, const void *src, unsigned n)
        const char *s = src;
        char *d = dest;
 
-       for (i = 0; i < n; i++) d[i] = s[i];
+       for (i = 0; i < n; i++)
+               d[i] = s[i];
        return dest;
 }
 
index a1310c52fc0c6ac6bf97feb276700e9f0662793e..857e492c571e05ac7714d4b54144acc9560110e1 100644 (file)
@@ -492,7 +492,7 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
                        continue;
                }
                sh_symtab = sec_symtab->symtab;
-               sym_strtab = sec->link->strtab;
+               sym_strtab = sec_symtab->link->strtab;
                for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
                        Elf32_Rel *rel;
                        Elf32_Sym *sym;
index af86e431acfae2af91957a9932c3bf5fb96bd5fb..b993062e9a5f7fae2d2492abd78cfb9933a0f01a 100644 (file)
@@ -30,7 +30,6 @@ SYSSEG                = DEF_SYSSEG            /* system loaded at 0x10000 (65536) */
 SYSSIZE                = DEF_SYSSIZE           /* system size: # of 16-byte clicks */
                                        /* to be loaded */
 ROOT_DEV       = 0                     /* ROOT_DEV is now written by "build" */
-SWAP_DEV       = 0                     /* SWAP_DEV is now written by "build" */
 
 #ifndef SVGA_MODE
 #define SVGA_MODE ASK_VGA
index 104275e191a8edc97d2de46c390c011f85206c8a..ef9a52005ec9f726dbf018d43021fd1b3bf3edf8 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.27-rc4
-# Mon Aug 25 15:04:00 2008
+# Linux kernel version: 2.6.27-rc5
+# Wed Sep  3 17:23:09 2008
 #
 # CONFIG_64BIT is not set
 CONFIG_X86_32=y
@@ -202,7 +202,7 @@ CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
 # CONFIG_M586 is not set
 # CONFIG_M586TSC is not set
 # CONFIG_M586MMX is not set
-# CONFIG_M686 is not set
+CONFIG_M686=y
 # CONFIG_MPENTIUMII is not set
 # CONFIG_MPENTIUMIII is not set
 # CONFIG_MPENTIUMM is not set
@@ -221,13 +221,14 @@ CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
 # CONFIG_MVIAC3_2 is not set
 # CONFIG_MVIAC7 is not set
 # CONFIG_MPSC is not set
-CONFIG_MCORE2=y
+# CONFIG_MCORE2 is not set
 # CONFIG_GENERIC_CPU is not set
 CONFIG_X86_GENERIC=y
 CONFIG_X86_CPU=y
 CONFIG_X86_CMPXCHG=y
 CONFIG_X86_L1_CACHE_SHIFT=7
 CONFIG_X86_XADD=y
+# CONFIG_X86_PPRO_FENCE is not set
 CONFIG_X86_WP_WORKS_OK=y
 CONFIG_X86_INVLPG=y
 CONFIG_X86_BSWAP=y
@@ -235,14 +236,15 @@ CONFIG_X86_POPAD_OK=y
 CONFIG_X86_INTEL_USERCOPY=y
 CONFIG_X86_USE_PPRO_CHECKSUM=y
 CONFIG_X86_TSC=y
+CONFIG_X86_CMOV=y
 CONFIG_X86_MINIMUM_CPU_FAMILY=4
 CONFIG_X86_DEBUGCTLMSR=y
 CONFIG_HPET_TIMER=y
 CONFIG_HPET_EMULATE_RTC=y
 CONFIG_DMI=y
 # CONFIG_IOMMU_HELPER is not set
-CONFIG_NR_CPUS=4
-# CONFIG_SCHED_SMT is not set
+CONFIG_NR_CPUS=64
+CONFIG_SCHED_SMT=y
 CONFIG_SCHED_MC=y
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
@@ -254,7 +256,8 @@ CONFIG_VM86=y
 # CONFIG_TOSHIBA is not set
 # CONFIG_I8K is not set
 CONFIG_X86_REBOOTFIXUPS=y
-# CONFIG_MICROCODE is not set
+CONFIG_MICROCODE=y
+CONFIG_MICROCODE_OLD_INTERFACE=y
 CONFIG_X86_MSR=y
 CONFIG_X86_CPUID=y
 # CONFIG_NOHIGHMEM is not set
@@ -2115,7 +2118,7 @@ CONFIG_IO_DELAY_0X80=y
 CONFIG_DEFAULT_IO_DELAY_TYPE=0
 CONFIG_DEBUG_BOOT_PARAMS=y
 # CONFIG_CPA_DEBUG is not set
-# CONFIG_OPTIMIZE_INLINING is not set
+CONFIG_OPTIMIZE_INLINING=y
 
 #
 # Security options
index 678c8acefe04da2ed74ee16e8f64077190e3f5f9..e620ea6e2a7a7d7093cdfb829a39487fe2645ee7 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.27-rc4
-# Mon Aug 25 14:40:46 2008
+# Linux kernel version: 2.6.27-rc5
+# Wed Sep  3 17:13:39 2008
 #
 CONFIG_64BIT=y
 # CONFIG_X86_32 is not set
@@ -218,17 +218,14 @@ CONFIG_X86_PC=y
 # CONFIG_MVIAC3_2 is not set
 # CONFIG_MVIAC7 is not set
 # CONFIG_MPSC is not set
-CONFIG_MCORE2=y
-# CONFIG_GENERIC_CPU is not set
+# CONFIG_MCORE2 is not set
+CONFIG_GENERIC_CPU=y
 CONFIG_X86_CPU=y
-CONFIG_X86_L1_CACHE_BYTES=64
-CONFIG_X86_INTERNODE_CACHE_BYTES=64
+CONFIG_X86_L1_CACHE_BYTES=128
+CONFIG_X86_INTERNODE_CACHE_BYTES=128
 CONFIG_X86_CMPXCHG=y
-CONFIG_X86_L1_CACHE_SHIFT=6
+CONFIG_X86_L1_CACHE_SHIFT=7
 CONFIG_X86_WP_WORKS_OK=y
-CONFIG_X86_INTEL_USERCOPY=y
-CONFIG_X86_USE_PPRO_CHECKSUM=y
-CONFIG_X86_P6_NOP=y
 CONFIG_X86_TSC=y
 CONFIG_X86_CMPXCHG64=y
 CONFIG_X86_CMOV=y
@@ -243,9 +240,8 @@ CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y
 CONFIG_AMD_IOMMU=y
 CONFIG_SWIOTLB=y
 CONFIG_IOMMU_HELPER=y
-# CONFIG_MAXSMP is not set
-CONFIG_NR_CPUS=4
-# CONFIG_SCHED_SMT is not set
+CONFIG_NR_CPUS=64
+CONFIG_SCHED_SMT=y
 CONFIG_SCHED_MC=y
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
@@ -254,7 +250,8 @@ CONFIG_X86_LOCAL_APIC=y
 CONFIG_X86_IO_APIC=y
 # CONFIG_X86_MCE is not set
 # CONFIG_I8K is not set
-# CONFIG_MICROCODE is not set
+CONFIG_MICROCODE=y
+CONFIG_MICROCODE_OLD_INTERFACE=y
 CONFIG_X86_MSR=y
 CONFIG_X86_CPUID=y
 CONFIG_NUMA=y
@@ -290,7 +287,7 @@ CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
 CONFIG_MTRR=y
 # CONFIG_MTRR_SANITIZER is not set
-# CONFIG_X86_PAT is not set
+CONFIG_X86_PAT=y
 CONFIG_EFI=y
 CONFIG_SECCOMP=y
 # CONFIG_HZ_100 is not set
@@ -2089,7 +2086,7 @@ CONFIG_IO_DELAY_0X80=y
 CONFIG_DEFAULT_IO_DELAY_TYPE=0
 CONFIG_DEBUG_BOOT_PARAMS=y
 # CONFIG_CPA_DEBUG is not set
-# CONFIG_OPTIMIZE_INLINING is not set
+CONFIG_OPTIMIZE_INLINING=y
 
 #
 # Security options
index a0e1dbe67dc145cd437661ea2f472c9865e08578..127ec3f072144b7976d19533989cd97cc41da327 100644 (file)
@@ -85,8 +85,10 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
        dump->regs.ax = regs->ax;
        dump->regs.ds = current->thread.ds;
        dump->regs.es = current->thread.es;
-       asm("movl %%fs,%0" : "=r" (fs)); dump->regs.fs = fs;
-       asm("movl %%gs,%0" : "=r" (gs)); dump->regs.gs = gs;
+       savesegment(fs, fs);
+       dump->regs.fs = fs;
+       savesegment(gs, gs);
+       dump->regs.gs = gs;
        dump->regs.orig_ax = regs->orig_ax;
        dump->regs.ip = regs->ip;
        dump->regs.cs = regs->cs;
@@ -430,8 +432,9 @@ beyond_if:
        current->mm->start_stack =
                (unsigned long)create_aout_tables((char __user *)bprm->p, bprm);
        /* start thread */
-       asm volatile("movl %0,%%fs" :: "r" (0)); \
-       asm volatile("movl %0,%%es; movl %0,%%ds": :"r" (__USER32_DS));
+       loadsegment(fs, 0);
+       loadsegment(ds, __USER32_DS);
+       loadsegment(es, __USER32_DS);
        load_gs_index(0);
        (regs)->ip = ex.a_entry;
        (regs)->sp = current->mm->start_stack;
index 20af4c79579a88ce1da6860e774c7440bc793b56..f1a2ac777fafa0a6b6f14b8296eae650eb45e6ee 100644 (file)
@@ -206,7 +206,7 @@ struct rt_sigframe
        { unsigned int cur;                                             \
          unsigned short pre;                                           \
          err |= __get_user(pre, &sc->seg);                             \
-         asm volatile("movl %%" #seg ",%0" : "=r" (cur));              \
+         savesegment(seg, cur);                                        \
          pre |= mask;                                                  \
          if (pre != cur) loadsegment(seg, pre); }
 
@@ -235,7 +235,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
         */
        err |= __get_user(gs, &sc->gs);
        gs |= 3;
-       asm("movl %%gs,%0" : "=r" (oldgs));
+       savesegment(gs, oldgs);
        if (gs != oldgs)
                load_gs_index(gs);
 
@@ -355,14 +355,13 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
 {
        int tmp, err = 0;
 
-       tmp = 0;
-       __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
+       savesegment(gs, tmp);
        err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
-       __asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp));
+       savesegment(fs, tmp);
        err |= __put_user(tmp, (unsigned int __user *)&sc->fs);
-       __asm__("movl %%ds,%0" : "=r"(tmp): "0"(tmp));
+       savesegment(ds, tmp);
        err |= __put_user(tmp, (unsigned int __user *)&sc->ds);
-       __asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp));
+       savesegment(es, tmp);
        err |= __put_user(tmp, (unsigned int __user *)&sc->es);
 
        err |= __put_user((u32)regs->di, &sc->di);
@@ -498,8 +497,8 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
        regs->dx = 0;
        regs->cx = 0;
 
-       asm volatile("movl %0,%%ds" :: "r" (__USER32_DS));
-       asm volatile("movl %0,%%es" :: "r" (__USER32_DS));
+       loadsegment(ds, __USER32_DS);
+       loadsegment(es, __USER32_DS);
 
        regs->cs = __USER32_CS;
        regs->ss = __USER32_DS;
@@ -591,8 +590,8 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
        regs->dx = (unsigned long) &frame->info;
        regs->cx = (unsigned long) &frame->uc;
 
-       asm volatile("movl %0,%%ds" :: "r" (__USER32_DS));
-       asm volatile("movl %0,%%es" :: "r" (__USER32_DS));
+       loadsegment(ds, __USER32_DS);
+       loadsegment(es, __USER32_DS);
 
        regs->cs = __USER32_CS;
        regs->ss = __USER32_DS;
index d3c64088b981f02fe5614ec53c3539b5bd3b703a..beda4232ce695cc2f42aea28dea84dad02a38235 100644 (file)
@@ -556,15 +556,6 @@ asmlinkage long sys32_rt_sigqueueinfo(int pid, int sig,
        return ret;
 }
 
-/* These are here just in case some old ia32 binary calls it. */
-asmlinkage long sys32_pause(void)
-{
-       current->state = TASK_INTERRUPTIBLE;
-       schedule();
-       return -ERESTARTNOHAND;
-}
-
-
 #ifdef CONFIG_SYSCTL_SYSCALL
 struct sysctl_ia32 {
        unsigned int    name;
index bfd10fd211cd30f4e0867c8bbfd8458461aec3c8..7d40ef7b36e3dac8b857a9fb4013cf901cf906e9 100644 (file)
@@ -58,7 +58,6 @@ EXPORT_SYMBOL(acpi_disabled);
 #ifdef CONFIG_X86_64
 
 #include <asm/proto.h>
-#include <asm/genapic.h>
 
 #else                          /* X86 */
 
@@ -97,8 +96,6 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
 #warning ACPI uses CMPXCHG, i486 and later hardware
 #endif
 
-static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
-
 /* --------------------------------------------------------------------------
                               Boot-time Configuration
    -------------------------------------------------------------------------- */
@@ -160,6 +157,8 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size)
 struct acpi_mcfg_allocation *pci_mmcfg_config;
 int pci_mmcfg_config_num;
 
+static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
+
 static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg)
 {
        if (!strcmp(mcfg->header.oem_id, "SGI"))
@@ -1603,6 +1602,14 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
         * is not connected at all.  Force ignoring BIOS IRQ0 pin2
         * override in that cases.
         */
+       {
+        .callback = dmi_ignore_irq0_timer_override,
+        .ident = "HP nx6115 laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6115"),
+                    },
+        },
        {
         .callback = dmi_ignore_irq0_timer_override,
         .ident = "HP NX6125 laptop",
@@ -1619,6 +1626,14 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
                     DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"),
                     },
         },
+       {
+        .callback = dmi_ignore_irq0_timer_override,
+        .ident = "HP 6715b laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
+                    },
+        },
        {}
 };
 
index 65a0c1b4869636122fc22dec84de26788662a2d4..fb04e49776ba308b2cd8f86315bcb7692122ce80 100644 (file)
@@ -231,25 +231,25 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end)
                        continue;
                if (*ptr > text_end)
                        continue;
-               text_poke(*ptr, ((unsigned char []){0xf0}), 1); /* add lock prefix */
+               /* turn DS segment override prefix into lock prefix */
+               text_poke(*ptr, ((unsigned char []){0xf0}), 1);
        };
 }
 
 static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end)
 {
        u8 **ptr;
-       char insn[1];
 
        if (noreplace_smp)
                return;
 
-       add_nops(insn, 1);
        for (ptr = start; ptr < end; ptr++) {
                if (*ptr < text)
                        continue;
                if (*ptr > text_end)
                        continue;
-               text_poke(*ptr, insn, 1);
+               /* turn lock prefix into DS segment override prefix */
+               text_poke(*ptr, ((unsigned char []){0x3E}), 1);
        };
 }
 
index 3b346c6f551491516329b522af166c0b296b3a53..34e4d112b1ef1bf54720a17f71756f8dd1394dfa 100644 (file)
@@ -201,10 +201,10 @@ static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd)
  */
 static int iommu_completion_wait(struct amd_iommu *iommu)
 {
-       int ret, ready = 0;
+       int ret = 0, ready = 0;
        unsigned status = 0;
        struct iommu_cmd cmd;
-       unsigned long i = 0;
+       unsigned long flags, i = 0;
 
        memset(&cmd, 0, sizeof(cmd));
        cmd.data[0] = CMD_COMPL_WAIT_INT_MASK;
@@ -212,10 +212,12 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
 
        iommu->need_sync = 0;
 
-       ret = iommu_queue_command(iommu, &cmd);
+       spin_lock_irqsave(&iommu->lock, flags);
+
+       ret = __iommu_queue_command(iommu, &cmd);
 
        if (ret)
-               return ret;
+               goto out;
 
        while (!ready && (i < EXIT_LOOP_COUNT)) {
                ++i;
@@ -230,6 +232,8 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
 
        if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit()))
                printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n");
+out:
+       spin_unlock_irqrestore(&iommu->lock, flags);
 
        return 0;
 }
@@ -240,6 +244,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
 static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
 {
        struct iommu_cmd cmd;
+       int ret;
 
        BUG_ON(iommu == NULL);
 
@@ -247,9 +252,11 @@ static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
        CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY);
        cmd.data[0] = devid;
 
+       ret = iommu_queue_command(iommu, &cmd);
+
        iommu->need_sync = 1;
 
-       return iommu_queue_command(iommu, &cmd);
+       return ret;
 }
 
 /*
@@ -259,6 +266,7 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
                u64 address, u16 domid, int pde, int s)
 {
        struct iommu_cmd cmd;
+       int ret;
 
        memset(&cmd, 0, sizeof(cmd));
        address &= PAGE_MASK;
@@ -271,9 +279,11 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
        if (pde) /* PDE bit - we wan't flush everything not only the PTEs */
                cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK;
 
+       ret = iommu_queue_command(iommu, &cmd);
+
        iommu->need_sync = 1;
 
-       return iommu_queue_command(iommu, &cmd);
+       return ret;
 }
 
 /*
index 44e21826db1145a00659c89c5c45232ff3e70d2a..9a32b37ee2eec2f176708d7fccd5b7dadcf0e3ab 100644 (file)
@@ -455,11 +455,11 @@ out:
                   force_iommu ||
                   valid_agp ||
                   fallback_aper_force) {
-               printk(KERN_ERR
+               printk(KERN_INFO
                        "Your BIOS doesn't leave a aperture memory hole\n");
-               printk(KERN_ERR
+               printk(KERN_INFO
                        "Please enable the IOMMU option in the BIOS setup\n");
-               printk(KERN_ERR
+               printk(KERN_INFO
                        "This costs you %d MB of RAM\n",
                                32 << fallback_aper_order);
 
index 9ee24e6bc4b0e5a661c4ac3dd669c60bf1f82a45..5145a6e72bbbf7f6a4e93d85aed20c769f0883dc 100644 (file)
 #include <linux/suspend.h>
 #include <linux/kthread.h>
 #include <linux/jiffies.h>
-#include <linux/smp_lock.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
 #include <asm/desc.h>
 #include <asm/i8253.h>
+#include <asm/olpc.h>
 #include <asm/paravirt.h>
 #include <asm/reboot.h>
 
@@ -2217,7 +2217,7 @@ static int __init apm_init(void)
 
        dmi_check_system(apm_dmi_table);
 
-       if (apm_info.bios.version == 0 || paravirt_enabled()) {
+       if (apm_info.bios.version == 0 || paravirt_enabled() || machine_is_olpc()) {
                printk(KERN_INFO "apm: BIOS not found.\n");
                return -ENODEV;
        }
index aa89387006fe3a730b9b7eba9b7b55cc3c1beb4d..505543a75a561f1cfc207d4f88dffbd2718bc724 100644 (file)
@@ -22,7 +22,7 @@
 
 #define __NO_STUBS 1
 #undef __SYSCALL
-#undef _ASM_X86_64_UNISTD_H_
+#undef ASM_X86__UNISTD_64_H
 #define __SYSCALL(nr, sym) [nr] = 1,
 static char syscalls[] = {
 #include <asm/unistd.h>
index c639bd55391cc1e8b679e2be8ee1373e5c093e2f..fdd585f9c53dd371d41392b4e955278d913979f0 100644 (file)
@@ -25,11 +25,11 @@ x86_bios_strerror(long status)
 {
        const char *str;
        switch (status) {
-       case  0: str = "Call completed without error"; break;
-       case -1: str = "Not implemented"; break;
-       case -2: str = "Invalid argument"; break;
-       case -3: str = "Call completed with error"; break;
-       default: str = "Unknown BIOS status code"; break;
+       case  0: str = "Call completed without error";  break;
+       case -1: str = "Not implemented";               break;
+       case -2: str = "Invalid argument";              break;
+       case -3: str = "Call completed with error";     break;
+       default: str = "Unknown BIOS status code";      break;
        }
        return str;
 }
index 8aab8517642e7ba34c3c91da7403c4892b01b53d..4e456bd955bb8389c4c7536d23635fdc97ec67f5 100644 (file)
@@ -344,31 +344,15 @@ static void __init early_cpu_detect(void)
 
 /*
  * The NOPL instruction is supposed to exist on all CPUs with
- * family >= 6, unfortunately, that's not true in practice because
+ * family >= 6; unfortunately, that's not true in practice because
  * of early VIA chips and (more importantly) broken virtualizers that
- * are not easy to detect.  Hence, probe for it based on first
- * principles.
+ * are not easy to detect.  In the latter case it doesn't even *fail*
+ * reliably, so probing for it doesn't even work.  Disable it completely
+ * unless we can find a reliable way to detect all the broken cases.
  */
 static void __cpuinit detect_nopl(struct cpuinfo_x86 *c)
 {
-       const u32 nopl_signature = 0x888c53b1; /* Random number */
-       u32 has_nopl = nopl_signature;
-
        clear_cpu_cap(c, X86_FEATURE_NOPL);
-       if (c->x86 >= 6) {
-               asm volatile("\n"
-                            "1:      .byte 0x0f,0x1f,0xc0\n" /* nopl %eax */
-                            "2:\n"
-                            "        .section .fixup,\"ax\"\n"
-                            "3:      xor %0,%0\n"
-                            "        jmp 2b\n"
-                            "        .previous\n"
-                            _ASM_EXTABLE(1b,3b)
-                            : "+a" (has_nopl));
-
-               if (has_nopl == nopl_signature)
-                       set_cpu_cap(c, X86_FEATURE_NOPL);
-       }
 }
 
 static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
index a11f5d4477cd797432d8a54df202dd558bdec5d5..305b465889b096a5205556ca02accf1466abe780 100644 (file)
@@ -430,6 +430,49 @@ static __init int setup_noclflush(char *arg)
 }
 __setup("noclflush", setup_noclflush);
 
+struct msr_range {
+       unsigned min;
+       unsigned max;
+};
+
+static struct msr_range msr_range_array[] __cpuinitdata = {
+       { 0x00000000, 0x00000418},
+       { 0xc0000000, 0xc000040b},
+       { 0xc0010000, 0xc0010142},
+       { 0xc0011000, 0xc001103b},
+};
+
+static void __cpuinit print_cpu_msr(void)
+{
+       unsigned index;
+       u64 val;
+       int i;
+       unsigned index_min, index_max;
+
+       for (i = 0; i < ARRAY_SIZE(msr_range_array); i++) {
+               index_min = msr_range_array[i].min;
+               index_max = msr_range_array[i].max;
+               for (index = index_min; index < index_max; index++) {
+                       if (rdmsrl_amd_safe(index, &val))
+                               continue;
+                       printk(KERN_INFO " MSR%08x: %016llx\n", index, val);
+               }
+       }
+}
+
+static int show_msr __cpuinitdata;
+static __init int setup_show_msr(char *arg)
+{
+       int num;
+
+       get_option(&arg, &num);
+
+       if (num > 0)
+               show_msr = num;
+       return 1;
+}
+__setup("show_msr=", setup_show_msr);
+
 void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
 {
        if (c->x86_model_id[0])
@@ -439,6 +482,14 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
                printk(KERN_CONT " stepping %02x\n", c->x86_mask);
        else
                printk(KERN_CONT "\n");
+
+#ifdef CONFIG_SMP
+       if (c->cpu_index < show_msr)
+               print_cpu_msr();
+#else
+       if (show_msr)
+               print_cpu_msr();
+#endif
 }
 
 static __init int setup_disablecpuid(char *arg)
index f1685fb91fbd313058b92af93ee055af160a2447..b8e05ee4f7361a1dc57ce28ff9d2e5e5526f776d 100644 (file)
@@ -171,7 +171,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
        }
 
        if (c->x86 != 0xF) {
-               printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@lists.linux.org.uk>\n");
+               printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@vger.kernel.org>\n");
                return 0;
        }
 
index 15e13c01cc3621ce3d4d610ab34225437eb8f413..3b5f06423e7774f2801e31e811c631df90344e36 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/cpufeature.h>
 
 #define PFX            "speedstep-centrino: "
-#define MAINTAINER     "cpufreq@lists.linux.org.uk"
+#define MAINTAINER     "cpufreq@vger.kernel.org"
 
 #define dprintk(msg...) \
        cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg)
index b75f2569b8f8ba1940d55ce3616f25a91c7c6d75..f113ef4595f6ca81dd810058337f4118590083b3 100644 (file)
@@ -222,10 +222,11 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
                        set_cpu_cap(c, X86_FEATURE_BTS);
                if (!(l1 & (1<<12)))
                        set_cpu_cap(c, X86_FEATURE_PEBS);
+               ds_init_intel(c);
        }
 
        if (cpu_has_bts)
-               ds_init_intel(c);
+               ptrace_bts_init_intel(c);
 
        /*
         * See if we have a good local APIC by checking for buggy Pentia,
index cb7d3b6a80eb879670bd8a74864d01b587561dec..4e8d77f01eeb0913527373ed38a71795cc0b7be1 100644 (file)
@@ -401,12 +401,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
                tmp |= ~((1<<(hi - 1)) - 1);
 
                if (tmp != mask_lo) {
-                       static int once = 1;
-
-                       if (once) {
-                               printk(KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n");
-                               once = 0;
-                       }
+                       WARN_ONCE(1, KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n");
                        mask_lo = tmp;
                }
        }
index 84c480bb3715af21405c6d55fab0f3160cbf3a59..4c4214690dd10a4c32fc787e03bce6e7cba315d9 100644 (file)
@@ -405,9 +405,9 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset)
                        }
                        /* RED-PEN: base can be > 32bit */ 
                        len += seq_printf(seq, 
-                                  "reg%02i: base=0x%05lx000 (%4luMB), size=%4lu%cB: %s, count=%d\n",
+                                  "reg%02i: base=0x%06lx000 (%5luMB), size=%5lu%cB, count=%d: %s\n",
                             i, base, base >> (20 - PAGE_SHIFT), size, factor,
-                            mtrr_attrib_to_str(type), mtrr_usage_table[i]);
+                            mtrr_usage_table[i], mtrr_attrib_to_str(type));
                }
        }
        return 0;
index b117d7f8a5640fe51091f46247671dff5d61524e..c78c04821ea18a58266b812fef480aa0b5ec0fbb 100644 (file)
@@ -729,7 +729,7 @@ struct var_mtrr_range_state {
        mtrr_type type;
 };
 
-struct var_mtrr_range_state __initdata range_state[RANGE_NUM];
+static struct var_mtrr_range_state __initdata range_state[RANGE_NUM];
 static int __initdata debug_print;
 
 static int __init
@@ -759,7 +759,8 @@ x86_get_mtrr_mem_range(struct res_range *range, int nr_range,
        /* take out UC ranges */
        for (i = 0; i < num_var_ranges; i++) {
                type = range_state[i].type;
-               if (type != MTRR_TYPE_UNCACHABLE)
+               if (type != MTRR_TYPE_UNCACHABLE &&
+                   type != MTRR_TYPE_WRPROT)
                        continue;
                size = range_state[i].size_pfn;
                if (!size)
@@ -834,7 +835,14 @@ static int __init enable_mtrr_cleanup_setup(char *str)
                enable_mtrr_cleanup = 1;
        return 0;
 }
-early_param("enble_mtrr_cleanup", enable_mtrr_cleanup_setup);
+early_param("enable_mtrr_cleanup", enable_mtrr_cleanup_setup);
+
+static int __init mtrr_cleanup_debug_setup(char *str)
+{
+       debug_print = 1;
+       return 0;
+}
+early_param("mtrr_cleanup_debug", mtrr_cleanup_debug_setup);
 
 struct var_mtrr_state {
        unsigned long   range_startk;
@@ -898,6 +906,27 @@ set_var_mtrr_all(unsigned int address_bits)
        }
 }
 
+static unsigned long to_size_factor(unsigned long sizek, char *factorp)
+{
+       char factor;
+       unsigned long base = sizek;
+
+       if (base & ((1<<10) - 1)) {
+               /* not MB alignment */
+               factor = 'K';
+       } else if (base & ((1<<20) - 1)){
+               factor = 'M';
+               base >>= 10;
+       } else {
+               factor = 'G';
+               base >>= 20;
+       }
+
+       *factorp = factor;
+
+       return base;
+}
+
 static unsigned int __init
 range_to_mtrr(unsigned int reg, unsigned long range_startk,
              unsigned long range_sizek, unsigned char type)
@@ -919,13 +948,21 @@ range_to_mtrr(unsigned int reg, unsigned long range_startk,
                        align = max_align;
 
                sizek = 1 << align;
-               if (debug_print)
+               if (debug_print) {
+                       char start_factor = 'K', size_factor = 'K';
+                       unsigned long start_base, size_base;
+
+                       start_base = to_size_factor(range_startk, &start_factor),
+                       size_base = to_size_factor(sizek, &size_factor),
+
                        printk(KERN_DEBUG "Setting variable MTRR %d, "
-                               "base: %ldMB, range: %ldMB, type %s\n",
-                               reg, range_startk >> 10, sizek >> 10,
+                               "base: %ld%cB, range: %ld%cB, type %s\n",
+                               reg, start_base, start_factor,
+                               size_base, size_factor,
                                (type == MTRR_TYPE_UNCACHABLE)?"UC":
                                    ((type == MTRR_TYPE_WRBACK)?"WB":"Other")
                                );
+               }
                save_var_mtrr(reg++, range_startk, sizek, type);
                range_startk += sizek;
                range_sizek -= sizek;
@@ -970,6 +1007,8 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek,
        /* try to append some small hole */
        range0_basek = state->range_startk;
        range0_sizek = ALIGN(state->range_sizek, chunk_sizek);
+
+       /* no increase */
        if (range0_sizek == state->range_sizek) {
                if (debug_print)
                        printk(KERN_DEBUG "rangeX: %016lx - %016lx\n",
@@ -980,13 +1019,40 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek,
                return 0;
        }
 
-       range0_sizek -= chunk_sizek;
-       if (range0_sizek && sizek) {
-           while (range0_basek + range0_sizek > (basek + sizek)) {
-               range0_sizek -= chunk_sizek;
-               if (!range0_sizek)
-                       break;
-           }
+       /* only cut back, when it is not the last */
+       if (sizek) {
+               while (range0_basek + range0_sizek > (basek + sizek)) {
+                       if (range0_sizek >= chunk_sizek)
+                               range0_sizek -= chunk_sizek;
+                       else
+                               range0_sizek = 0;
+
+                       if (!range0_sizek)
+                               break;
+               }
+       }
+
+second_try:
+       range_basek = range0_basek + range0_sizek;
+
+       /* one hole in the middle */
+       if (range_basek > basek && range_basek <= (basek + sizek))
+               second_sizek = range_basek - basek;
+
+       if (range0_sizek > state->range_sizek) {
+
+               /* one hole in middle or at end */
+               hole_sizek = range0_sizek - state->range_sizek - second_sizek;
+
+               /* hole size should be less than half of range0 size */
+               if (hole_sizek >= (range0_sizek >> 1) &&
+                   range0_sizek >= chunk_sizek) {
+                       range0_sizek -= chunk_sizek;
+                       second_sizek = 0;
+                       hole_sizek = 0;
+
+                       goto second_try;
+               }
        }
 
        if (range0_sizek) {
@@ -996,50 +1062,28 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek,
                                (range0_basek + range0_sizek)<<10);
                state->reg = range_to_mtrr(state->reg, range0_basek,
                                range0_sizek, MTRR_TYPE_WRBACK);
-
-       }
-
-       range_basek = range0_basek + range0_sizek;
-       range_sizek = chunk_sizek;
-
-       if (range_basek + range_sizek > basek &&
-           range_basek + range_sizek <= (basek + sizek)) {
-               /* one hole */
-               second_basek = basek;
-               second_sizek = range_basek + range_sizek - basek;
        }
 
-       /* if last piece, only could one hole near end */
-       if ((second_basek || !basek) &&
-           range_sizek - (state->range_sizek - range0_sizek) - second_sizek <
-           (chunk_sizek >> 1)) {
-               /*
-                * one hole in middle (second_sizek is 0) or at end
-                * (second_sizek is 0 )
-                */
-               hole_sizek = range_sizek - (state->range_sizek - range0_sizek)
-                                - second_sizek;
-               hole_basek = range_basek + range_sizek - hole_sizek
-                                - second_sizek;
-       } else {
-               /* fallback for big hole, or several holes */
+       if (range0_sizek < state->range_sizek) {
+               /* need to handle left over */
                range_sizek = state->range_sizek - range0_sizek;
-               second_basek = 0;
-               second_sizek = 0;
+
+               if (debug_print)
+                       printk(KERN_DEBUG "range: %016lx - %016lx\n",
+                                range_basek<<10,
+                                (range_basek + range_sizek)<<10);
+               state->reg = range_to_mtrr(state->reg, range_basek,
+                                range_sizek, MTRR_TYPE_WRBACK);
        }
 
-       if (debug_print)
-               printk(KERN_DEBUG "range: %016lx - %016lx\n", range_basek<<10,
-                        (range_basek + range_sizek)<<10);
-       state->reg = range_to_mtrr(state->reg, range_basek, range_sizek,
-                                        MTRR_TYPE_WRBACK);
        if (hole_sizek) {
+               hole_basek = range_basek - hole_sizek - second_sizek;
                if (debug_print)
                        printk(KERN_DEBUG "hole: %016lx - %016lx\n",
-                                hole_basek<<10, (hole_basek + hole_sizek)<<10);
-               state->reg = range_to_mtrr(state->reg, hole_basek, hole_sizek,
-                                                MTRR_TYPE_UNCACHABLE);
-
+                                hole_basek<<10,
+                                (hole_basek + hole_sizek)<<10);
+               state->reg = range_to_mtrr(state->reg, hole_basek,
+                                hole_sizek, MTRR_TYPE_UNCACHABLE);
        }
 
        return second_sizek;
@@ -1154,11 +1198,11 @@ struct mtrr_cleanup_result {
 };
 
 /*
- * gran_size: 1M, 2M, ..., 2G
- * chunk size: gran_size, ..., 4G
- * so we need (2+13)*6
+ * gran_size: 64K, 128K, 256K, 512K, 1M, 2M, ..., 2G
+ * chunk size: gran_size, ..., 2G
+ * so we need (1+16)*8
  */
-#define NUM_RESULT     90
+#define NUM_RESULT     136
 #define PSHIFT         (PAGE_SHIFT - 10)
 
 static struct mtrr_cleanup_result __initdata result[NUM_RESULT];
@@ -1168,13 +1212,14 @@ static unsigned long __initdata min_loss_pfn[RANGE_NUM];
 static int __init mtrr_cleanup(unsigned address_bits)
 {
        unsigned long extra_remove_base, extra_remove_size;
-       unsigned long i, base, size, def, dummy;
+       unsigned long base, size, def, dummy;
        mtrr_type type;
        int nr_range, nr_range_new;
        u64 chunk_size, gran_size;
        unsigned long range_sums, range_sums_new;
        int index_good;
        int num_reg_good;
+       int i;
 
        /* extra one for all 0 */
        int num[MTRR_NUM_TYPES + 1];
@@ -1204,6 +1249,8 @@ static int __init mtrr_cleanup(unsigned address_bits)
                        continue;
                if (!size)
                        type = MTRR_NUM_TYPES;
+               if (type == MTRR_TYPE_WRPROT)
+                       type = MTRR_TYPE_UNCACHABLE;
                num[type]++;
        }
 
@@ -1216,23 +1263,57 @@ static int __init mtrr_cleanup(unsigned address_bits)
                num_var_ranges - num[MTRR_NUM_TYPES])
                return 0;
 
+       /* print original var MTRRs at first, for debugging: */
+       printk(KERN_DEBUG "original variable MTRRs\n");
+       for (i = 0; i < num_var_ranges; i++) {
+               char start_factor = 'K', size_factor = 'K';
+               unsigned long start_base, size_base;
+
+               size_base = range_state[i].size_pfn << (PAGE_SHIFT - 10);
+               if (!size_base)
+                       continue;
+
+               size_base = to_size_factor(size_base, &size_factor),
+               start_base = range_state[i].base_pfn << (PAGE_SHIFT - 10);
+               start_base = to_size_factor(start_base, &start_factor),
+               type = range_state[i].type;
+
+               printk(KERN_DEBUG "reg %d, base: %ld%cB, range: %ld%cB, type %s\n",
+                       i, start_base, start_factor,
+                       size_base, size_factor,
+                       (type == MTRR_TYPE_UNCACHABLE) ? "UC" :
+                           ((type == MTRR_TYPE_WRPROT) ? "WP" :
+                            ((type == MTRR_TYPE_WRBACK) ? "WB" : "Other"))
+                       );
+       }
+
        memset(range, 0, sizeof(range));
        extra_remove_size = 0;
-       if (mtrr_tom2) {
-               extra_remove_base = 1 << (32 - PAGE_SHIFT);
+       extra_remove_base = 1 << (32 - PAGE_SHIFT);
+       if (mtrr_tom2)
                extra_remove_size =
                        (mtrr_tom2 >> PAGE_SHIFT) - extra_remove_base;
-       }
        nr_range = x86_get_mtrr_mem_range(range, 0, extra_remove_base,
                                          extra_remove_size);
+       /*
+        * [0, 1M) should always be coverred by var mtrr with WB
+        * and fixed mtrrs should take effective before var mtrr for it
+        */
+       nr_range = add_range_with_merge(range, nr_range, 0,
+                                       (1ULL<<(20 - PAGE_SHIFT)) - 1);
+       /* sort the ranges */
+       sort(range, nr_range, sizeof(struct res_range), cmp_range, NULL);
+
        range_sums = sum_ranges(range, nr_range);
        printk(KERN_INFO "total RAM coverred: %ldM\n",
               range_sums >> (20 - PAGE_SHIFT));
 
        if (mtrr_chunk_size && mtrr_gran_size) {
                int num_reg;
+               char gran_factor, chunk_factor, lose_factor;
+               unsigned long gran_base, chunk_base, lose_base;
 
-               debug_print = 1;
+               debug_print++;
                /* convert ranges to var ranges state */
                num_reg = x86_setup_var_mtrrs(range, nr_range, mtrr_chunk_size,
                                              mtrr_gran_size);
@@ -1256,34 +1337,48 @@ static int __init mtrr_cleanup(unsigned address_bits)
                        result[i].lose_cover_sizek =
                                (range_sums - range_sums_new) << PSHIFT;
 
-               printk(KERN_INFO "%sgran_size: %ldM \tchunk_size: %ldM \t",
-                        result[i].bad?"*BAD*":" ", result[i].gran_sizek >> 10,
-                        result[i].chunk_sizek >> 10);
-               printk(KERN_CONT "num_reg: %d  \tlose cover RAM: %s%ldM \n",
+               gran_base = to_size_factor(result[i].gran_sizek, &gran_factor),
+               chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor),
+               lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
+               printk(KERN_INFO "%sgran_size: %ld%c \tchunk_size: %ld%c \t",
+                        result[i].bad?"*BAD*":" ",
+                        gran_base, gran_factor, chunk_base, chunk_factor);
+               printk(KERN_CONT "num_reg: %d  \tlose cover RAM: %s%ld%c\n",
                         result[i].num_reg, result[i].bad?"-":"",
-                        result[i].lose_cover_sizek >> 10);
+                        lose_base, lose_factor);
                if (!result[i].bad) {
                        set_var_mtrr_all(address_bits);
                        return 1;
                }
                printk(KERN_INFO "invalid mtrr_gran_size or mtrr_chunk_size, "
                       "will find optimal one\n");
-               debug_print = 0;
+               debug_print--;
                memset(result, 0, sizeof(result[0]));
        }
 
        i = 0;
        memset(min_loss_pfn, 0xff, sizeof(min_loss_pfn));
        memset(result, 0, sizeof(result));
-       for (gran_size = (1ULL<<20); gran_size < (1ULL<<32); gran_size <<= 1) {
-               for (chunk_size = gran_size; chunk_size < (1ULL<<33);
+       for (gran_size = (1ULL<<16); gran_size < (1ULL<<32); gran_size <<= 1) {
+               char gran_factor;
+               unsigned long gran_base;
+
+               if (debug_print)
+                       gran_base = to_size_factor(gran_size >> 10, &gran_factor);
+
+               for (chunk_size = gran_size; chunk_size < (1ULL<<32);
                     chunk_size <<= 1) {
                        int num_reg;
 
-                       if (debug_print)
-                               printk(KERN_INFO
-                              "\ngran_size: %lldM   chunk_size_size: %lldM\n",
-                                      gran_size >> 20, chunk_size >> 20);
+                       if (debug_print) {
+                               char chunk_factor;
+                               unsigned long chunk_base;
+
+                               chunk_base = to_size_factor(chunk_size>>10, &chunk_factor),
+                               printk(KERN_INFO "\n");
+                               printk(KERN_INFO "gran_size: %ld%c   chunk_size: %ld%c \n",
+                                      gran_base, gran_factor, chunk_base, chunk_factor);
+                       }
                        if (i >= NUM_RESULT)
                                continue;
 
@@ -1326,12 +1421,18 @@ static int __init mtrr_cleanup(unsigned address_bits)
 
        /* print out all */
        for (i = 0; i < NUM_RESULT; i++) {
-               printk(KERN_INFO "%sgran_size: %ldM \tchunk_size: %ldM \t",
-                      result[i].bad?"*BAD* ":" ", result[i].gran_sizek >> 10,
-                      result[i].chunk_sizek >> 10);
-               printk(KERN_CONT "num_reg: %d \tlose RAM: %s%ldM\n",
-                      result[i].num_reg, result[i].bad?"-":"",
-                      result[i].lose_cover_sizek >> 10);
+               char gran_factor, chunk_factor, lose_factor;
+               unsigned long gran_base, chunk_base, lose_base;
+
+               gran_base = to_size_factor(result[i].gran_sizek, &gran_factor),
+               chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor),
+               lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
+               printk(KERN_INFO "%sgran_size: %ld%c \tchunk_size: %ld%c \t",
+                        result[i].bad?"*BAD*":" ",
+                        gran_base, gran_factor, chunk_base, chunk_factor);
+               printk(KERN_CONT "num_reg: %d  \tlose cover RAM: %s%ld%c\n",
+                        result[i].num_reg, result[i].bad?"-":"",
+                        lose_base, lose_factor);
        }
 
        /* try to find the optimal index */
@@ -1339,10 +1440,8 @@ static int __init mtrr_cleanup(unsigned address_bits)
                nr_mtrr_spare_reg = num_var_ranges - 1;
        num_reg_good = -1;
        for (i = num_var_ranges - nr_mtrr_spare_reg; i > 0; i--) {
-               if (!min_loss_pfn[i]) {
+               if (!min_loss_pfn[i])
                        num_reg_good = i;
-                       break;
-               }
        }
 
        index_good = -1;
@@ -1358,21 +1457,26 @@ static int __init mtrr_cleanup(unsigned address_bits)
        }
 
        if (index_good != -1) {
+               char gran_factor, chunk_factor, lose_factor;
+               unsigned long gran_base, chunk_base, lose_base;
+
                printk(KERN_INFO "Found optimal setting for mtrr clean up\n");
                i = index_good;
-               printk(KERN_INFO "gran_size: %ldM \tchunk_size: %ldM \t",
-                               result[i].gran_sizek >> 10,
-                               result[i].chunk_sizek >> 10);
-               printk(KERN_CONT "num_reg: %d \tlose RAM: %ldM\n",
-                               result[i].num_reg,
-                               result[i].lose_cover_sizek >> 10);
+               gran_base = to_size_factor(result[i].gran_sizek, &gran_factor),
+               chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor),
+               lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
+               printk(KERN_INFO "gran_size: %ld%c \tchunk_size: %ld%c \t",
+                        gran_base, gran_factor, chunk_base, chunk_factor);
+               printk(KERN_CONT "num_reg: %d  \tlose RAM: %ld%c\n",
+                        result[i].num_reg, lose_base, lose_factor);
                /* convert ranges to var ranges state */
                chunk_size = result[i].chunk_sizek;
                chunk_size <<= 10;
                gran_size = result[i].gran_sizek;
                gran_size <<= 10;
-               debug_print = 1;
+               debug_print++;
                x86_setup_var_mtrrs(range, nr_range, chunk_size, gran_size);
+               debug_print--;
                set_var_mtrr_all(address_bits);
                return 1;
        }
index 05cc22dbd4ffdebff8738662c74fd954be8fd432..6bff382094f58a2a40b0adebdf5fb264905614ba 100644 (file)
@@ -295,13 +295,19 @@ static int setup_k7_watchdog(unsigned nmi_hz)
        /* setup the timer */
        wrmsr(evntsel_msr, evntsel, 0);
        write_watchdog_counter(perfctr_msr, "K7_PERFCTR0",nmi_hz);
-       apic_write(APIC_LVTPC, APIC_DM_NMI);
-       evntsel |= K7_EVNTSEL_ENABLE;
-       wrmsr(evntsel_msr, evntsel, 0);
 
+       /* initialize the wd struct before enabling */
        wd->perfctr_msr = perfctr_msr;
        wd->evntsel_msr = evntsel_msr;
        wd->cccr_msr = 0;  /* unused */
+
+       /* ok, everything is initialized, announce that we're set */
+       cpu_nmi_set_wd_enabled();
+
+       apic_write(APIC_LVTPC, APIC_DM_NMI);
+       evntsel |= K7_EVNTSEL_ENABLE;
+       wrmsr(evntsel_msr, evntsel, 0);
+
        return 1;
 }
 
@@ -379,13 +385,19 @@ static int setup_p6_watchdog(unsigned nmi_hz)
        wrmsr(evntsel_msr, evntsel, 0);
        nmi_hz = adjust_for_32bit_ctr(nmi_hz);
        write_watchdog_counter32(perfctr_msr, "P6_PERFCTR0",nmi_hz);
-       apic_write(APIC_LVTPC, APIC_DM_NMI);
-       evntsel |= P6_EVNTSEL0_ENABLE;
-       wrmsr(evntsel_msr, evntsel, 0);
 
+       /* initialize the wd struct before enabling */
        wd->perfctr_msr = perfctr_msr;
        wd->evntsel_msr = evntsel_msr;
        wd->cccr_msr = 0;  /* unused */
+
+       /* ok, everything is initialized, announce that we're set */
+       cpu_nmi_set_wd_enabled();
+
+       apic_write(APIC_LVTPC, APIC_DM_NMI);
+       evntsel |= P6_EVNTSEL0_ENABLE;
+       wrmsr(evntsel_msr, evntsel, 0);
+
        return 1;
 }
 
@@ -432,6 +444,27 @@ static const struct wd_ops p6_wd_ops = {
 #define P4_CCCR_ENABLE         (1 << 12)
 #define P4_CCCR_OVF            (1 << 31)
 
+#define P4_CONTROLS 18
+static unsigned int p4_controls[18] = {
+       MSR_P4_BPU_CCCR0,
+       MSR_P4_BPU_CCCR1,
+       MSR_P4_BPU_CCCR2,
+       MSR_P4_BPU_CCCR3,
+       MSR_P4_MS_CCCR0,
+       MSR_P4_MS_CCCR1,
+       MSR_P4_MS_CCCR2,
+       MSR_P4_MS_CCCR3,
+       MSR_P4_FLAME_CCCR0,
+       MSR_P4_FLAME_CCCR1,
+       MSR_P4_FLAME_CCCR2,
+       MSR_P4_FLAME_CCCR3,
+       MSR_P4_IQ_CCCR0,
+       MSR_P4_IQ_CCCR1,
+       MSR_P4_IQ_CCCR2,
+       MSR_P4_IQ_CCCR3,
+       MSR_P4_IQ_CCCR4,
+       MSR_P4_IQ_CCCR5,
+};
 /*
  * Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter
  * CRU_ESCR0 (with any non-null event selector) through a complemented
@@ -473,6 +506,26 @@ static int setup_p4_watchdog(unsigned nmi_hz)
                evntsel_msr = MSR_P4_CRU_ESCR0;
                cccr_msr = MSR_P4_IQ_CCCR0;
                cccr_val = P4_CCCR_OVF_PMI0 | P4_CCCR_ESCR_SELECT(4);
+
+               /*
+                * If we're on the kdump kernel or other situation, we may
+                * still have other performance counter registers set to
+                * interrupt and they'll keep interrupting forever because
+                * of the P4_CCCR_OVF quirk. So we need to ACK all the
+                * pending interrupts and disable all the registers here,
+                * before reenabling the NMI delivery. Refer to p4_rearm()
+                * about the P4_CCCR_OVF quirk.
+                */
+               if (reset_devices) {
+                       unsigned int low, high;
+                       int i;
+
+                       for (i = 0; i < P4_CONTROLS; i++) {
+                               rdmsr(p4_controls[i], low, high);
+                               low &= ~(P4_CCCR_ENABLE | P4_CCCR_OVF);
+                               wrmsr(p4_controls[i], low, high);
+                       }
+               }
        } else {
                /* logical cpu 1 */
                perfctr_msr = MSR_P4_IQ_PERFCTR1;
@@ -499,12 +552,17 @@ static int setup_p4_watchdog(unsigned nmi_hz)
        wrmsr(evntsel_msr, evntsel, 0);
        wrmsr(cccr_msr, cccr_val, 0);
        write_watchdog_counter(perfctr_msr, "P4_IQ_COUNTER0", nmi_hz);
-       apic_write(APIC_LVTPC, APIC_DM_NMI);
-       cccr_val |= P4_CCCR_ENABLE;
-       wrmsr(cccr_msr, cccr_val, 0);
+
        wd->perfctr_msr = perfctr_msr;
        wd->evntsel_msr = evntsel_msr;
        wd->cccr_msr = cccr_msr;
+
+       /* ok, everything is initialized, announce that we're set */
+       cpu_nmi_set_wd_enabled();
+
+       apic_write(APIC_LVTPC, APIC_DM_NMI);
+       cccr_val |= P4_CCCR_ENABLE;
+       wrmsr(cccr_msr, cccr_val, 0);
        return 1;
 }
 
@@ -620,13 +678,17 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz)
        wrmsr(evntsel_msr, evntsel, 0);
        nmi_hz = adjust_for_32bit_ctr(nmi_hz);
        write_watchdog_counter32(perfctr_msr, "INTEL_ARCH_PERFCTR0", nmi_hz);
-       apic_write(APIC_LVTPC, APIC_DM_NMI);
-       evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE;
-       wrmsr(evntsel_msr, evntsel, 0);
 
        wd->perfctr_msr = perfctr_msr;
        wd->evntsel_msr = evntsel_msr;
        wd->cccr_msr = 0;  /* unused */
+
+       /* ok, everything is initialized, announce that we're set */
+       cpu_nmi_set_wd_enabled();
+
+       apic_write(APIC_LVTPC, APIC_DM_NMI);
+       evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE;
+       wrmsr(evntsel_msr, evntsel, 0);
        intel_arch_wd_ops.checkbit = 1ULL << (eax.split.bit_width - 1);
        return 1;
 }
index 8e9cd6a8ec120951c4683b410572d63b0c3d0824..6a44d646599156cc5910cce8f503832688c973a5 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/smp_lock.h>
 #include <linux/major.h>
 #include <linux/fs.h>
-#include <linux/smp_lock.h>
 #include <linux/device.h>
 #include <linux/cpu.h>
 #include <linux/notifier.h>
index 15e6c6bc4a46644490cfe565c342b562cddb383d..e90a60ef10c2b641f524844e4902969cdd8235b4 100644 (file)
@@ -7,9 +7,8 @@
 
 #include <linux/errno.h>
 #include <linux/crash_dump.h>
-
-#include <asm/uaccess.h>
-#include <asm/io.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
 /**
  * copy_oldmem_page - copy one page from "oldmem"
@@ -25,7 +24,7 @@
  * in the current kernel. We stitch up a pte, similar to kmap_atomic.
  */
 ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
-                               size_t csize, unsigned long offset, int userbuf)
+               size_t csize, unsigned long offset, int userbuf)
 {
        void  *vaddr;
 
@@ -33,14 +32,16 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
                return 0;
 
        vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+       if (!vaddr)
+               return -ENOMEM;
 
        if (userbuf) {
-               if (copy_to_user(buf, (vaddr + offset), csize)) {
+               if (copy_to_user(buf, vaddr + offset, csize)) {
                        iounmap(vaddr);
                        return -EFAULT;
                }
        } else
-       memcpy(buf, (vaddr + offset), csize);
+               memcpy(buf, vaddr + offset, csize);
 
        iounmap(vaddr);
        return csize;
index 11c11b8ec48dd59f1494c2051433dd8f6f2a7777..2b69994fd3a800458f4d81abbebad357405eac69 100644 (file)
@@ -2,26 +2,49 @@
  * Debug Store support
  *
  * This provides a low-level interface to the hardware's Debug Store
- * feature that is used for last branch recording (LBR) and
+ * feature that is used for branch trace store (BTS) and
  * precise-event based sampling (PEBS).
  *
- * Different architectures use a different DS layout/pointer size.
- * The below functions therefore work on a void*.
+ * It manages:
+ * - per-thread and per-cpu allocation of BTS and PEBS
+ * - buffer memory allocation (optional)
+ * - buffer overflow handling
+ * - buffer access
  *
+ * It assumes:
+ * - get_task_struct on all parameter tasks
+ * - current is allowed to trace parameter tasks
  *
- * Since there is no user for PEBS, yet, only LBR (or branch
- * trace store, BTS) is supported.
  *
- *
- * Copyright (C) 2007 Intel Corporation.
- * Markus Metzger <markus.t.metzger@intel.com>, Dec 2007
+ * Copyright (C) 2007-2008 Intel Corporation.
+ * Markus Metzger <markus.t.metzger@intel.com>, 2007-2008
  */
 
+
+#ifdef CONFIG_X86_DS
+
 #include <asm/ds.h>
 
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/slab.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+
+
+/*
+ * The configuration for a particular DS hardware implementation.
+ */
+struct ds_configuration {
+       /* the size of the DS structure in bytes */
+       unsigned char  sizeof_ds;
+       /* the size of one pointer-typed field in the DS structure in bytes;
+          this covers the first 8 fields related to buffer management. */
+       unsigned char  sizeof_field;
+       /* the size of a BTS/PEBS record in bytes */
+       unsigned char  sizeof_rec[2];
+};
+static struct ds_configuration ds_cfg;
 
 
 /*
  *   (interrupt occurs when write pointer passes interrupt pointer)
  * - value to which counter is reset following counter overflow
  *
- * On later architectures, the last branch recording hardware uses
- * 64bit pointers even in 32bit mode.
- *
- *
- * Branch Trace Store (BTS) records store information about control
- * flow changes. They at least provide the following information:
- * - source linear address
- * - destination linear address
+ * Later architectures use 64bit pointers throughout, whereas earlier
+ * architectures use 32bit pointers in 32bit mode.
  *
- * Netburst supported a predicated bit that had been dropped in later
- * architectures. We do not suppor it.
  *
+ * We compute the base address for the first 8 fields based on:
+ * - the field size stored in the DS configuration
+ * - the relative field position
+ * - an offset giving the start of the respective region
  *
- * In order to abstract from the actual DS and BTS layout, we describe
- * the access to the relevant fields.
- * Thanks to Andi Kleen for proposing this design.
+ * This offset is further used to index various arrays holding
+ * information for BTS and PEBS at the respective index.
  *
- * The implementation, however, is not as general as it might seem. In
- * order to stay somewhat simple and efficient, we assume an
- * underlying unsigned type (mostly a pointer type) and we expect the
- * field to be at least as big as that type.
+ * On later 32bit processors, we only access the lower 32bit of the
+ * 64bit pointer fields. The upper halves will be zeroed out.
  */
 
-/*
- * A special from_ip address to indicate that the BTS record is an
- * info record that needs to be interpreted or skipped.
- */
-#define BTS_ESCAPE_ADDRESS (-1)
+enum ds_field {
+       ds_buffer_base = 0,
+       ds_index,
+       ds_absolute_maximum,
+       ds_interrupt_threshold,
+};
 
-/*
- * A field access descriptor
- */
-struct access_desc {
-       unsigned char offset;
-       unsigned char size;
+enum ds_qualifier {
+       ds_bts  = 0,
+       ds_pebs
 };
 
+static inline unsigned long ds_get(const unsigned char *base,
+                                  enum ds_qualifier qual, enum ds_field field)
+{
+       base += (ds_cfg.sizeof_field * (field + (4 * qual)));
+       return *(unsigned long *)base;
+}
+
+static inline void ds_set(unsigned char *base, enum ds_qualifier qual,
+                         enum ds_field field, unsigned long value)
+{
+       base += (ds_cfg.sizeof_field * (field + (4 * qual)));
+       (*(unsigned long *)base) = value;
+}
+
+
 /*
- * The configuration for a particular DS/BTS hardware implementation.
+ * Locking is done only for allocating BTS or PEBS resources and for
+ * guarding context and buffer memory allocation.
+ *
+ * Most functions require the current task to own the ds context part
+ * they are going to access. All the locking is done when validating
+ * access to the context.
  */
-struct ds_configuration {
-       /* the DS configuration */
-       unsigned char  sizeof_ds;
-       struct access_desc bts_buffer_base;
-       struct access_desc bts_index;
-       struct access_desc bts_absolute_maximum;
-       struct access_desc bts_interrupt_threshold;
-       /* the BTS configuration */
-       unsigned char  sizeof_bts;
-       struct access_desc from_ip;
-       struct access_desc to_ip;
-       /* BTS variants used to store additional information like
-          timestamps */
-       struct access_desc info_type;
-       struct access_desc info_data;
-       unsigned long debugctl_mask;
-};
+static spinlock_t ds_lock = __SPIN_LOCK_UNLOCKED(ds_lock);
 
 /*
- * The global configuration used by the below accessor functions
+ * Validate that the current task is allowed to access the BTS/PEBS
+ * buffer of the parameter task.
+ *
+ * Returns 0, if access is granted; -Eerrno, otherwise.
  */
-static struct ds_configuration ds_cfg;
+static inline int ds_validate_access(struct ds_context *context,
+                                    enum ds_qualifier qual)
+{
+       if (!context)
+               return -EPERM;
+
+       if (context->owner[qual] == current)
+               return 0;
+
+       return -EPERM;
+}
+
 
 /*
- * Accessor functions for some DS and BTS fields using the above
- * global ptrace_bts_cfg.
+ * We either support (system-wide) per-cpu or per-thread allocation.
+ * We distinguish the two based on the task_struct pointer, where a
+ * NULL pointer indicates per-cpu allocation for the current cpu.
+ *
+ * Allocations are use-counted. As soon as resources are allocated,
+ * further allocations must be of the same type (per-cpu or
+ * per-thread). We model this by counting allocations (i.e. the number
+ * of tracers of a certain type) for one type negatively:
+ *   =0  no tracers
+ *   >0  number of per-thread tracers
+ *   <0  number of per-cpu tracers
+ *
+ * The below functions to get and put tracers and to check the
+ * allocation type require the ds_lock to be held by the caller.
+ *
+ * Tracers essentially gives the number of ds contexts for a certain
+ * type of allocation.
  */
-static inline unsigned long get_bts_buffer_base(char *base)
+static long tracers;
+
+static inline void get_tracer(struct task_struct *task)
 {
-       return *(unsigned long *)(base + ds_cfg.bts_buffer_base.offset);
+       tracers += (task ? 1 : -1);
 }
-static inline void set_bts_buffer_base(char *base, unsigned long value)
+
+static inline void put_tracer(struct task_struct *task)
 {
-       (*(unsigned long *)(base + ds_cfg.bts_buffer_base.offset)) = value;
+       tracers -= (task ? 1 : -1);
 }
-static inline unsigned long get_bts_index(char *base)
+
+static inline int check_tracer(struct task_struct *task)
 {
-       return *(unsigned long *)(base + ds_cfg.bts_index.offset);
+       return (task ? (tracers >= 0) : (tracers <= 0));
 }
-static inline void set_bts_index(char *base, unsigned long value)
+
+
+/*
+ * The DS context is either attached to a thread or to a cpu:
+ * - in the former case, the thread_struct contains a pointer to the
+ *   attached context.
+ * - in the latter case, we use a static array of per-cpu context
+ *   pointers.
+ *
+ * Contexts are use-counted. They are allocated on first access and
+ * deallocated when the last user puts the context.
+ *
+ * We distinguish between an allocating and a non-allocating get of a
+ * context:
+ * - the allocating get is used for requesting BTS/PEBS resources. It
+ *   requires the caller to hold the global ds_lock.
+ * - the non-allocating get is used for all other cases. A
+ *   non-existing context indicates an error. It acquires and releases
+ *   the ds_lock itself for obtaining the context.
+ *
+ * A context and its DS configuration are allocated and deallocated
+ * together. A context always has a DS configuration of the
+ * appropriate size.
+ */
+static DEFINE_PER_CPU(struct ds_context *, system_context);
+
+#define this_system_context per_cpu(system_context, smp_processor_id())
+
+/*
+ * Returns the pointer to the parameter task's context or to the
+ * system-wide context, if task is NULL.
+ *
+ * Increases the use count of the returned context, if not NULL.
+ */
+static inline struct ds_context *ds_get_context(struct task_struct *task)
 {
-       (*(unsigned long *)(base + ds_cfg.bts_index.offset)) = value;
+       struct ds_context *context;
+
+       spin_lock(&ds_lock);
+
+       context = (task ? task->thread.ds_ctx : this_system_context);
+       if (context)
+               context->count++;
+
+       spin_unlock(&ds_lock);
+
+       return context;
 }
-static inline unsigned long get_bts_absolute_maximum(char *base)
+
+/*
+ * Same as ds_get_context, but allocates the context and it's DS
+ * structure, if necessary; returns NULL; if out of memory.
+ *
+ * pre: requires ds_lock to be held
+ */
+static inline struct ds_context *ds_alloc_context(struct task_struct *task)
 {
-       return *(unsigned long *)(base + ds_cfg.bts_absolute_maximum.offset);
+       struct ds_context **p_context =
+               (task ? &task->thread.ds_ctx : &this_system_context);
+       struct ds_context *context = *p_context;
+
+       if (!context) {
+               context = kzalloc(sizeof(*context), GFP_KERNEL);
+
+               if (!context)
+                       return NULL;
+
+               context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL);
+               if (!context->ds) {
+                       kfree(context);
+                       return NULL;
+               }
+
+               *p_context = context;
+
+               context->this = p_context;
+               context->task = task;
+
+               if (task)
+                       set_tsk_thread_flag(task, TIF_DS_AREA_MSR);
+
+               if (!task || (task == current))
+                       wrmsr(MSR_IA32_DS_AREA, (unsigned long)context->ds, 0);
+
+               get_tracer(task);
+       }
+
+       context->count++;
+
+       return context;
 }
-static inline void set_bts_absolute_maximum(char *base, unsigned long value)
+
+/*
+ * Decreases the use count of the parameter context, if not NULL.
+ * Deallocates the context, if the use count reaches zero.
+ */
+static inline void ds_put_context(struct ds_context *context)
 {
-       (*(unsigned long *)(base + ds_cfg.bts_absolute_maximum.offset)) = value;
+       if (!context)
+               return;
+
+       spin_lock(&ds_lock);
+
+       if (--context->count)
+               goto out;
+
+       *(context->this) = NULL;
+
+       if (context->task)
+               clear_tsk_thread_flag(context->task, TIF_DS_AREA_MSR);
+
+       if (!context->task || (context->task == current))
+               wrmsrl(MSR_IA32_DS_AREA, 0);
+
+       put_tracer(context->task);
+
+       /* free any leftover buffers from tracers that did not
+        * deallocate them properly. */
+       kfree(context->buffer[ds_bts]);
+       kfree(context->buffer[ds_pebs]);
+       kfree(context->ds);
+       kfree(context);
+ out:
+       spin_unlock(&ds_lock);
 }
-static inline unsigned long get_bts_interrupt_threshold(char *base)
+
+
+/*
+ * Handle a buffer overflow
+ *
+ * task: the task whose buffers are overflowing;
+ *       NULL for a buffer overflow on the current cpu
+ * context: the ds context
+ * qual: the buffer type
+ */
+static void ds_overflow(struct task_struct *task, struct ds_context *context,
+                       enum ds_qualifier qual)
 {
-       return *(unsigned long *)(base + ds_cfg.bts_interrupt_threshold.offset);
+       if (!context)
+               return;
+
+       if (context->callback[qual])
+               (*context->callback[qual])(task);
+
+       /* todo: do some more overflow handling */
 }
-static inline void set_bts_interrupt_threshold(char *base, unsigned long value)
+
+
+/*
+ * Allocate a non-pageable buffer of the parameter size.
+ * Checks the memory and the locked memory rlimit.
+ *
+ * Returns the buffer, if successful;
+ *         NULL, if out of memory or rlimit exceeded.
+ *
+ * size: the requested buffer size in bytes
+ * pages (out): if not NULL, contains the number of pages reserved
+ */
+static inline void *ds_allocate_buffer(size_t size, unsigned int *pages)
 {
-       (*(unsigned long *)(base + ds_cfg.bts_interrupt_threshold.offset)) = value;
+       unsigned long rlim, vm, pgsz;
+       void *buffer;
+
+       pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT;
+
+       rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT;
+       vm   = current->mm->total_vm  + pgsz;
+       if (rlim < vm)
+               return NULL;
+
+       rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT;
+       vm   = current->mm->locked_vm  + pgsz;
+       if (rlim < vm)
+               return NULL;
+
+       buffer = kzalloc(size, GFP_KERNEL);
+       if (!buffer)
+               return NULL;
+
+       current->mm->total_vm  += pgsz;
+       current->mm->locked_vm += pgsz;
+
+       if (pages)
+               *pages = pgsz;
+
+       return buffer;
 }
-static inline unsigned long get_from_ip(char *base)
+
+static int ds_request(struct task_struct *task, void *base, size_t size,
+                     ds_ovfl_callback_t ovfl, enum ds_qualifier qual)
 {
-       return *(unsigned long *)(base + ds_cfg.from_ip.offset);
+       struct ds_context *context;
+       unsigned long buffer, adj;
+       const unsigned long alignment = (1 << 3);
+       int error = 0;
+
+       if (!ds_cfg.sizeof_ds)
+               return -EOPNOTSUPP;
+
+       /* we require some space to do alignment adjustments below */
+       if (size < (alignment + ds_cfg.sizeof_rec[qual]))
+               return -EINVAL;
+
+       /* buffer overflow notification is not yet implemented */
+       if (ovfl)
+               return -EOPNOTSUPP;
+
+
+       spin_lock(&ds_lock);
+
+       if (!check_tracer(task))
+               return -EPERM;
+
+       error = -ENOMEM;
+       context = ds_alloc_context(task);
+       if (!context)
+               goto out_unlock;
+
+       error = -EALREADY;
+       if (context->owner[qual] == current)
+               goto out_unlock;
+       error = -EPERM;
+       if (context->owner[qual] != NULL)
+               goto out_unlock;
+       context->owner[qual] = current;
+
+       spin_unlock(&ds_lock);
+
+
+       error = -ENOMEM;
+       if (!base) {
+               base = ds_allocate_buffer(size, &context->pages[qual]);
+               if (!base)
+                       goto out_release;
+
+               context->buffer[qual]   = base;
+       }
+       error = 0;
+
+       context->callback[qual] = ovfl;
+
+       /* adjust the buffer address and size to meet alignment
+        * constraints:
+        * - buffer is double-word aligned
+        * - size is multiple of record size
+        *
+        * We checked the size at the very beginning; we have enough
+        * space to do the adjustment.
+        */
+       buffer = (unsigned long)base;
+
+       adj = ALIGN(buffer, alignment) - buffer;
+       buffer += adj;
+       size   -= adj;
+
+       size /= ds_cfg.sizeof_rec[qual];
+       size *= ds_cfg.sizeof_rec[qual];
+
+       ds_set(context->ds, qual, ds_buffer_base, buffer);
+       ds_set(context->ds, qual, ds_index, buffer);
+       ds_set(context->ds, qual, ds_absolute_maximum, buffer + size);
+
+       if (ovfl) {
+               /* todo: select a suitable interrupt threshold */
+       } else
+               ds_set(context->ds, qual,
+                      ds_interrupt_threshold, buffer + size + 1);
+
+       /* we keep the context until ds_release */
+       return error;
+
+ out_release:
+       context->owner[qual] = NULL;
+       ds_put_context(context);
+       return error;
+
+ out_unlock:
+       spin_unlock(&ds_lock);
+       ds_put_context(context);
+       return error;
 }
-static inline void set_from_ip(char *base, unsigned long value)
+
+int ds_request_bts(struct task_struct *task, void *base, size_t size,
+                  ds_ovfl_callback_t ovfl)
 {
-       (*(unsigned long *)(base + ds_cfg.from_ip.offset)) = value;
+       return ds_request(task, base, size, ovfl, ds_bts);
 }
-static inline unsigned long get_to_ip(char *base)
+
+int ds_request_pebs(struct task_struct *task, void *base, size_t size,
+                   ds_ovfl_callback_t ovfl)
 {
-       return *(unsigned long *)(base + ds_cfg.to_ip.offset);
+       return ds_request(task, base, size, ovfl, ds_pebs);
 }
-static inline void set_to_ip(char *base, unsigned long value)
+
+static int ds_release(struct task_struct *task, enum ds_qualifier qual)
 {
-       (*(unsigned long *)(base + ds_cfg.to_ip.offset)) = value;
+       struct ds_context *context;
+       int error;
+
+       context = ds_get_context(task);
+       error = ds_validate_access(context, qual);
+       if (error < 0)
+               goto out;
+
+       kfree(context->buffer[qual]);
+       context->buffer[qual] = NULL;
+
+       current->mm->total_vm  -= context->pages[qual];
+       current->mm->locked_vm -= context->pages[qual];
+       context->pages[qual] = 0;
+       context->owner[qual] = NULL;
+
+       /*
+        * we put the context twice:
+        *   once for the ds_get_context
+        *   once for the corresponding ds_request
+        */
+       ds_put_context(context);
+ out:
+       ds_put_context(context);
+       return error;
 }
-static inline unsigned char get_info_type(char *base)
+
+int ds_release_bts(struct task_struct *task)
 {
-       return *(unsigned char *)(base + ds_cfg.info_type.offset);
+       return ds_release(task, ds_bts);
 }
-static inline void set_info_type(char *base, unsigned char value)
+
+int ds_release_pebs(struct task_struct *task)
 {
-       (*(unsigned char *)(base + ds_cfg.info_type.offset)) = value;
+       return ds_release(task, ds_pebs);
 }
-static inline unsigned long get_info_data(char *base)
+
+static int ds_get_index(struct task_struct *task, size_t *pos,
+                       enum ds_qualifier qual)
 {
-       return *(unsigned long *)(base + ds_cfg.info_data.offset);
+       struct ds_context *context;
+       unsigned long base, index;
+       int error;
+
+       context = ds_get_context(task);
+       error = ds_validate_access(context, qual);
+       if (error < 0)
+               goto out;
+
+       base  = ds_get(context->ds, qual, ds_buffer_base);
+       index = ds_get(context->ds, qual, ds_index);
+
+       error = ((index - base) / ds_cfg.sizeof_rec[qual]);
+       if (pos)
+               *pos = error;
+ out:
+       ds_put_context(context);
+       return error;
 }
-static inline void set_info_data(char *base, unsigned long value)
+
+int ds_get_bts_index(struct task_struct *task, size_t *pos)
 {
-       (*(unsigned long *)(base + ds_cfg.info_data.offset)) = value;
+       return ds_get_index(task, pos, ds_bts);
 }
 
+int ds_get_pebs_index(struct task_struct *task, size_t *pos)
+{
+       return ds_get_index(task, pos, ds_pebs);
+}
 
-int ds_allocate(void **dsp, size_t bts_size_in_bytes)
+static int ds_get_end(struct task_struct *task, size_t *pos,
+                     enum ds_qualifier qual)
 {
-       size_t bts_size_in_records;
-       unsigned long bts;
-       void *ds;
+       struct ds_context *context;
+       unsigned long base, end;
+       int error;
+
+       context = ds_get_context(task);
+       error = ds_validate_access(context, qual);
+       if (error < 0)
+               goto out;
+
+       base = ds_get(context->ds, qual, ds_buffer_base);
+       end  = ds_get(context->ds, qual, ds_absolute_maximum);
+
+       error = ((end - base) / ds_cfg.sizeof_rec[qual]);
+       if (pos)
+               *pos = error;
+ out:
+       ds_put_context(context);
+       return error;
+}
 
-       if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts)
-               return -EOPNOTSUPP;
+int ds_get_bts_end(struct task_struct *task, size_t *pos)
+{
+       return ds_get_end(task, pos, ds_bts);
+}
 
-       if (bts_size_in_bytes < 0)
-               return -EINVAL;
+int ds_get_pebs_end(struct task_struct *task, size_t *pos)
+{
+       return ds_get_end(task, pos, ds_pebs);
+}
 
-       bts_size_in_records =
-               bts_size_in_bytes / ds_cfg.sizeof_bts;
-       bts_size_in_bytes =
-               bts_size_in_records * ds_cfg.sizeof_bts;
+static int ds_access(struct task_struct *task, size_t index,
+                    const void **record, enum ds_qualifier qual)
+{
+       struct ds_context *context;
+       unsigned long base, idx;
+       int error;
 
-       if (bts_size_in_bytes <= 0)
+       if (!record)
                return -EINVAL;
 
-       bts = (unsigned long)kzalloc(bts_size_in_bytes, GFP_KERNEL);
-
-       if (!bts)
-               return -ENOMEM;
+       context = ds_get_context(task);
+       error = ds_validate_access(context, qual);
+       if (error < 0)
+               goto out;
 
-       ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL);
+       base = ds_get(context->ds, qual, ds_buffer_base);
+       idx = base + (index * ds_cfg.sizeof_rec[qual]);
 
-       if (!ds) {
-               kfree((void *)bts);
-               return -ENOMEM;
-       }
-
-       set_bts_buffer_base(ds, bts);
-       set_bts_index(ds, bts);
-       set_bts_absolute_maximum(ds, bts + bts_size_in_bytes);
-       set_bts_interrupt_threshold(ds, bts + bts_size_in_bytes + 1);
+       error = -EINVAL;
+       if (idx > ds_get(context->ds, qual, ds_absolute_maximum))
+               goto out;
 
-       *dsp = ds;
-       return 0;
+       *record = (const void *)idx;
+       error = ds_cfg.sizeof_rec[qual];
+ out:
+       ds_put_context(context);
+       return error;
 }
 
-int ds_free(void **dsp)
+int ds_access_bts(struct task_struct *task, size_t index, const void **record)
 {
-       if (*dsp) {
-               kfree((void *)get_bts_buffer_base(*dsp));
-               kfree(*dsp);
-               *dsp = NULL;
-       }
-       return 0;
+       return ds_access(task, index, record, ds_bts);
 }
 
-int ds_get_bts_size(void *ds)
+int ds_access_pebs(struct task_struct *task, size_t index, const void **record)
 {
-       int size_in_bytes;
-
-       if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts)
-               return -EOPNOTSUPP;
-
-       if (!ds)
-               return 0;
-
-       size_in_bytes =
-               get_bts_absolute_maximum(ds) -
-               get_bts_buffer_base(ds);
-       return size_in_bytes;
+       return ds_access(task, index, record, ds_pebs);
 }
 
-int ds_get_bts_end(void *ds)
+static int ds_write(struct task_struct *task, const void *record, size_t size,
+                   enum ds_qualifier qual, int force)
 {
-       int size_in_bytes = ds_get_bts_size(ds);
-
-       if (size_in_bytes <= 0)
-               return size_in_bytes;
+       struct ds_context *context;
+       int error;
 
-       return size_in_bytes / ds_cfg.sizeof_bts;
-}
+       if (!record)
+               return -EINVAL;
 
-int ds_get_bts_index(void *ds)
-{
-       int index_offset_in_bytes;
+       error = -EPERM;
+       context = ds_get_context(task);
+       if (!context)
+               goto out;
 
-       if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts)
-               return -EOPNOTSUPP;
+       if (!force) {
+               error = ds_validate_access(context, qual);
+               if (error < 0)
+                       goto out;
+       }
 
-       index_offset_in_bytes =
-               get_bts_index(ds) -
-               get_bts_buffer_base(ds);
+       error = 0;
+       while (size) {
+               unsigned long base, index, end, write_end, int_th;
+               unsigned long write_size, adj_write_size;
+
+               /*
+                * write as much as possible without producing an
+                * overflow interrupt.
+                *
+                * interrupt_threshold must either be
+                * - bigger than absolute_maximum or
+                * - point to a record between buffer_base and absolute_maximum
+                *
+                * index points to a valid record.
+                */
+               base   = ds_get(context->ds, qual, ds_buffer_base);
+               index  = ds_get(context->ds, qual, ds_index);
+               end    = ds_get(context->ds, qual, ds_absolute_maximum);
+               int_th = ds_get(context->ds, qual, ds_interrupt_threshold);
+
+               write_end = min(end, int_th);
+
+               /* if we are already beyond the interrupt threshold,
+                * we fill the entire buffer */
+               if (write_end <= index)
+                       write_end = end;
+
+               if (write_end <= index)
+                       goto out;
+
+               write_size = min((unsigned long) size, write_end - index);
+               memcpy((void *)index, record, write_size);
+
+               record = (const char *)record + write_size;
+               size  -= write_size;
+               error += write_size;
+
+               adj_write_size = write_size / ds_cfg.sizeof_rec[qual];
+               adj_write_size *= ds_cfg.sizeof_rec[qual];
+
+               /* zero out trailing bytes */
+               memset((char *)index + write_size, 0,
+                      adj_write_size - write_size);
+               index += adj_write_size;
+
+               if (index >= end)
+                       index = base;
+               ds_set(context->ds, qual, ds_index, index);
+
+               if (index >= int_th)
+                       ds_overflow(task, context, qual);
+       }
 
-       return index_offset_in_bytes / ds_cfg.sizeof_bts;
+ out:
+       ds_put_context(context);
+       return error;
 }
 
-int ds_set_overflow(void *ds, int method)
+int ds_write_bts(struct task_struct *task, const void *record, size_t size)
 {
-       switch (method) {
-       case DS_O_SIGNAL:
-               return -EOPNOTSUPP;
-       case DS_O_WRAP:
-               return 0;
-       default:
-               return -EINVAL;
-       }
+       return ds_write(task, record, size, ds_bts, /* force = */ 0);
 }
 
-int ds_get_overflow(void *ds)
+int ds_write_pebs(struct task_struct *task, const void *record, size_t size)
 {
-       return DS_O_WRAP;
+       return ds_write(task, record, size, ds_pebs, /* force = */ 0);
 }
 
-int ds_clear(void *ds)
+int ds_unchecked_write_bts(struct task_struct *task,
+                          const void *record, size_t size)
 {
-       int bts_size = ds_get_bts_size(ds);
-       unsigned long bts_base;
-
-       if (bts_size <= 0)
-               return bts_size;
-
-       bts_base = get_bts_buffer_base(ds);
-       memset((void *)bts_base, 0, bts_size);
-
-       set_bts_index(ds, bts_base);
-       return 0;
+       return ds_write(task, record, size, ds_bts, /* force = */ 1);
 }
 
-int ds_read_bts(void *ds, int index, struct bts_struct *out)
+int ds_unchecked_write_pebs(struct task_struct *task,
+                           const void *record, size_t size)
 {
-       void *bts;
+       return ds_write(task, record, size, ds_pebs, /* force = */ 1);
+}
 
-       if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts)
-               return -EOPNOTSUPP;
+static int ds_reset_or_clear(struct task_struct *task,
+                            enum ds_qualifier qual, int clear)
+{
+       struct ds_context *context;
+       unsigned long base, end;
+       int error;
 
-       if (index < 0)
-               return -EINVAL;
+       context = ds_get_context(task);
+       error = ds_validate_access(context, qual);
+       if (error < 0)
+               goto out;
 
-       if (index >= ds_get_bts_size(ds))
-               return -EINVAL;
+       base = ds_get(context->ds, qual, ds_buffer_base);
+       end  = ds_get(context->ds, qual, ds_absolute_maximum);
 
-       bts = (void *)(get_bts_buffer_base(ds) + (index * ds_cfg.sizeof_bts));
+       if (clear)
+               memset((void *)base, 0, end - base);
 
-       memset(out, 0, sizeof(*out));
-       if (get_from_ip(bts) == BTS_ESCAPE_ADDRESS) {
-               out->qualifier       = get_info_type(bts);
-               out->variant.jiffies = get_info_data(bts);
-       } else {
-               out->qualifier = BTS_BRANCH;
-               out->variant.lbr.from_ip = get_from_ip(bts);
-               out->variant.lbr.to_ip   = get_to_ip(bts);
-       }
+       ds_set(context->ds, qual, ds_index, base);
 
-       return sizeof(*out);;
+       error = 0;
+ out:
+       ds_put_context(context);
+       return error;
 }
 
-int ds_write_bts(void *ds, const struct bts_struct *in)
+int ds_reset_bts(struct task_struct *task)
 {
-       unsigned long bts;
-
-       if (!ds_cfg.sizeof_ds || !ds_cfg.sizeof_bts)
-               return -EOPNOTSUPP;
-
-       if (ds_get_bts_size(ds) <= 0)
-               return -ENXIO;
+       return ds_reset_or_clear(task, ds_bts, /* clear = */ 0);
+}
 
-       bts = get_bts_index(ds);
+int ds_reset_pebs(struct task_struct *task)
+{
+       return ds_reset_or_clear(task, ds_pebs, /* clear = */ 0);
+}
 
-       memset((void *)bts, 0, ds_cfg.sizeof_bts);
-       switch (in->qualifier) {
-       case BTS_INVALID:
-               break;
+int ds_clear_bts(struct task_struct *task)
+{
+       return ds_reset_or_clear(task, ds_bts, /* clear = */ 1);
+}
 
-       case BTS_BRANCH:
-               set_from_ip((void *)bts, in->variant.lbr.from_ip);
-               set_to_ip((void *)bts, in->variant.lbr.to_ip);
-               break;
+int ds_clear_pebs(struct task_struct *task)
+{
+       return ds_reset_or_clear(task, ds_pebs, /* clear = */ 1);
+}
 
-       case BTS_TASK_ARRIVES:
-       case BTS_TASK_DEPARTS:
-               set_from_ip((void *)bts, BTS_ESCAPE_ADDRESS);
-               set_info_type((void *)bts, in->qualifier);
-               set_info_data((void *)bts, in->variant.jiffies);
-               break;
+int ds_get_pebs_reset(struct task_struct *task, u64 *value)
+{
+       struct ds_context *context;
+       int error;
 
-       default:
+       if (!value)
                return -EINVAL;
-       }
 
-       bts = bts + ds_cfg.sizeof_bts;
-       if (bts >= get_bts_absolute_maximum(ds))
-               bts = get_bts_buffer_base(ds);
-       set_bts_index(ds, bts);
+       context = ds_get_context(task);
+       error = ds_validate_access(context, ds_pebs);
+       if (error < 0)
+               goto out;
 
-       return ds_cfg.sizeof_bts;
+       *value = *(u64 *)(context->ds + (ds_cfg.sizeof_field * 8));
+
+       error = 0;
+ out:
+       ds_put_context(context);
+       return error;
 }
 
-unsigned long ds_debugctl_mask(void)
+int ds_set_pebs_reset(struct task_struct *task, u64 value)
 {
-       return ds_cfg.debugctl_mask;
-}
+       struct ds_context *context;
+       int error;
 
-#ifdef __i386__
-static const struct ds_configuration ds_cfg_netburst = {
-       .sizeof_ds = 9 * 4,
-       .bts_buffer_base = { 0, 4 },
-       .bts_index = { 4, 4 },
-       .bts_absolute_maximum = { 8, 4 },
-       .bts_interrupt_threshold = { 12, 4 },
-       .sizeof_bts = 3 * 4,
-       .from_ip = { 0, 4 },
-       .to_ip = { 4, 4 },
-       .info_type = { 4, 1 },
-       .info_data = { 8, 4 },
-       .debugctl_mask = (1<<2)|(1<<3)
-};
+       context = ds_get_context(task);
+       error = ds_validate_access(context, ds_pebs);
+       if (error < 0)
+               goto out;
 
-static const struct ds_configuration ds_cfg_pentium_m = {
-       .sizeof_ds = 9 * 4,
-       .bts_buffer_base = { 0, 4 },
-       .bts_index = { 4, 4 },
-       .bts_absolute_maximum = { 8, 4 },
-       .bts_interrupt_threshold = { 12, 4 },
-       .sizeof_bts = 3 * 4,
-       .from_ip = { 0, 4 },
-       .to_ip = { 4, 4 },
-       .info_type = { 4, 1 },
-       .info_data = { 8, 4 },
-       .debugctl_mask = (1<<6)|(1<<7)
+       *(u64 *)(context->ds + (ds_cfg.sizeof_field * 8)) = value;
+
+       error = 0;
+ out:
+       ds_put_context(context);
+       return error;
+}
+
+static const struct ds_configuration ds_cfg_var = {
+       .sizeof_ds    = sizeof(long) * 12,
+       .sizeof_field = sizeof(long),
+       .sizeof_rec[ds_bts]   = sizeof(long) * 3,
+       .sizeof_rec[ds_pebs]  = sizeof(long) * 10
 };
-#endif /* _i386_ */
-
-static const struct ds_configuration ds_cfg_core2 = {
-       .sizeof_ds = 9 * 8,
-       .bts_buffer_base = { 0, 8 },
-       .bts_index = { 8, 8 },
-       .bts_absolute_maximum = { 16, 8 },
-       .bts_interrupt_threshold = { 24, 8 },
-       .sizeof_bts = 3 * 8,
-       .from_ip = { 0, 8 },
-       .to_ip = { 8, 8 },
-       .info_type = { 8, 1 },
-       .info_data = { 16, 8 },
-       .debugctl_mask = (1<<6)|(1<<7)|(1<<9)
+static const struct ds_configuration ds_cfg_64 = {
+       .sizeof_ds    = 8 * 12,
+       .sizeof_field = 8,
+       .sizeof_rec[ds_bts]   = 8 * 3,
+       .sizeof_rec[ds_pebs]  = 8 * 10
 };
 
 static inline void
@@ -429,14 +821,13 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
        switch (c->x86) {
        case 0x6:
                switch (c->x86_model) {
-#ifdef __i386__
                case 0xD:
                case 0xE: /* Pentium M */
-                       ds_configure(&ds_cfg_pentium_m);
+                       ds_configure(&ds_cfg_var);
                        break;
-#endif /* _i386_ */
                case 0xF: /* Core2 */
-                       ds_configure(&ds_cfg_core2);
+               case 0x1C: /* Atom */
+                       ds_configure(&ds_cfg_64);
                        break;
                default:
                        /* sorry, don't know about them */
@@ -445,13 +836,11 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
                break;
        case 0xF:
                switch (c->x86_model) {
-#ifdef __i386__
                case 0x0:
                case 0x1:
                case 0x2: /* Netburst */
-                       ds_configure(&ds_cfg_netburst);
+                       ds_configure(&ds_cfg_var);
                        break;
-#endif /* _i386_ */
                default:
                        /* sorry, don't know about them */
                        break;
@@ -462,3 +851,14 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
                break;
        }
 }
+
+void ds_free(struct ds_context *context)
+{
+       /* This is called when the task owning the parameter context
+        * is dying. There should not be any user of that context left
+        * to disturb us, anymore. */
+       unsigned long leftovers = context->count;
+       while (leftovers--)
+               ds_put_context(context);
+}
+#endif /* CONFIG_X86_DS */
index 06cc8d4254b180f622a33c879bca97f2c05b1643..945a31cdd81f5493d0de00bf39214f0df371b976 100644 (file)
@@ -414,9 +414,11 @@ void __init efi_init(void)
        if (memmap.map == NULL)
                printk(KERN_ERR "Could not map the EFI memory map!\n");
        memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
+
        if (memmap.desc_size != sizeof(efi_memory_desc_t))
-               printk(KERN_WARNING "Kernel-defined memdesc"
-                      "doesn't match the one from EFI!\n");
+               printk(KERN_WARNING
+                 "Kernel-defined memdesc doesn't match the one from EFI!\n");
+
        if (add_efi_memmap)
                do_add_efi_memmap();
 
index 89434d439605484b48a7b26ba31c55e82c9821c5..cf3a0b2d00599adb2a79fefa991c0d8223059fba 100644 (file)
@@ -275,9 +275,9 @@ ENTRY(native_usergs_sysret64)
 ENTRY(ret_from_fork)
        CFI_DEFAULT_STACK
        push kernel_eflags(%rip)
-       CFI_ADJUST_CFA_OFFSET 4
+       CFI_ADJUST_CFA_OFFSET 8
        popf                            # reset kernel eflags
-       CFI_ADJUST_CFA_OFFSET -4
+       CFI_ADJUST_CFA_OFFSET -8
        call schedule_tail
        GET_THREAD_INFO(%rcx)
        testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx)
index 9bfc4d72fb2e26b757ffad4bffd8b0de7a45de39..d16084f90649181e6e944e104118f7ec5de6a0e3 100644 (file)
@@ -108,12 +108,11 @@ void __init x86_64_start_kernel(char * real_mode_data)
        }
        load_idt((const struct desc_ptr *)&idt_descr);
 
-       early_printk("Kernel alive\n");
+       if (console_loglevel == 10)
+               early_printk("Kernel alive\n");
 
        x86_64_init_pda();
 
-       early_printk("Kernel really alive\n");
-
        x86_64_start_reservations(real_mode_data);
 }
 
index a7010c3a377a436f29552e3b26a2b9a0b7a35084..e835b4eea70be85d0b9fac4f846fdd55becbf189 100644 (file)
@@ -172,10 +172,6 @@ num_subarch_entries = (. - subarch_entries) / 4
  *
  * Note that the stack is not yet set up!
  */
-#define PTE_ATTR       0x007           /* PRESENT+RW+USER */
-#define PDE_ATTR       0x067           /* PRESENT+RW+USER+DIRTY+ACCESSED */
-#define PGD_ATTR       0x001           /* PRESENT (no other attributes) */
-
 default_entry:
 #ifdef CONFIG_X86_PAE
 
@@ -196,9 +192,9 @@ default_entry:
        movl $pa(pg0), %edi
        movl %edi, pa(init_pg_tables_start)
        movl $pa(swapper_pg_pmd), %edx
-       movl $PTE_ATTR, %eax
+       movl $PTE_IDENT_ATTR, %eax
 10:
-       leal PDE_ATTR(%edi),%ecx                /* Create PMD entry */
+       leal PDE_IDENT_ATTR(%edi),%ecx          /* Create PMD entry */
        movl %ecx,(%edx)                        /* Store PMD entry */
                                                /* Upper half already zero */
        addl $8,%edx
@@ -215,7 +211,7 @@ default_entry:
         * End condition: we must map up to and including INIT_MAP_BEYOND_END
         * bytes beyond the end of our own page tables.
         */
-       leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp
+       leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
        cmpl %ebp,%eax
        jb 10b
 1:
@@ -224,7 +220,7 @@ default_entry:
        movl %eax, pa(max_pfn_mapped)
 
        /* Do early initialization of the fixmap area */
-       movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax
+       movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax
        movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8)
 #else  /* Not PAE */
 
@@ -233,9 +229,9 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
        movl $pa(pg0), %edi
        movl %edi, pa(init_pg_tables_start)
        movl $pa(swapper_pg_dir), %edx
-       movl $PTE_ATTR, %eax
+       movl $PTE_IDENT_ATTR, %eax
 10:
-       leal PDE_ATTR(%edi),%ecx                /* Create PDE entry */
+       leal PDE_IDENT_ATTR(%edi),%ecx          /* Create PDE entry */
        movl %ecx,(%edx)                        /* Store identity PDE entry */
        movl %ecx,page_pde_offset(%edx)         /* Store kernel PDE entry */
        addl $4,%edx
@@ -249,7 +245,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
         * bytes beyond the end of our own page tables; the +0x007 is
         * the attribute bits
         */
-       leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp
+       leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
        cmpl %ebp,%eax
        jb 10b
        movl %edi,pa(init_pg_tables_end)
@@ -257,7 +253,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
        movl %eax, pa(max_pfn_mapped)
 
        /* Do early initialization of the fixmap area */
-       movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax
+       movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax
        movl %eax,pa(swapper_pg_dir+0xffc)
 #endif
        jmp 3f
@@ -634,19 +630,19 @@ ENTRY(empty_zero_page)
        /* Page-aligned for the benefit of paravirt? */
        .align PAGE_SIZE_asm
 ENTRY(swapper_pg_dir)
-       .long   pa(swapper_pg_pmd+PGD_ATTR),0           /* low identity map */
+       .long   pa(swapper_pg_pmd+PGD_IDENT_ATTR),0     /* low identity map */
 # if KPMDS == 3
-       .long   pa(swapper_pg_pmd+PGD_ATTR),0
-       .long   pa(swapper_pg_pmd+PGD_ATTR+0x1000),0
-       .long   pa(swapper_pg_pmd+PGD_ATTR+0x2000),0
+       .long   pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
+       .long   pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0
+       .long   pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x2000),0
 # elif KPMDS == 2
        .long   0,0
-       .long   pa(swapper_pg_pmd+PGD_ATTR),0
-       .long   pa(swapper_pg_pmd+PGD_ATTR+0x1000),0
+       .long   pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
+       .long   pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0
 # elif KPMDS == 1
        .long   0,0
        .long   0,0
-       .long   pa(swapper_pg_pmd+PGD_ATTR),0
+       .long   pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
 # else
 #  error "Kernel PMDs should be 1, 2 or 3"
 # endif
index db3280afe886f1b97a9f2c383afc4ac80993a060..26cfdc1d7c7fd9119e2c47c22af144e6f300f7eb 100644 (file)
@@ -110,7 +110,7 @@ startup_64:
        movq    %rdi, %rax
        shrq    $PMD_SHIFT, %rax
        andq    $(PTRS_PER_PMD - 1), %rax
-       leaq    __PAGE_KERNEL_LARGE_EXEC(%rdi), %rdx
+       leaq    __PAGE_KERNEL_IDENT_LARGE_EXEC(%rdi), %rdx
        leaq    level2_spare_pgt(%rip), %rbx
        movq    %rdx, 0(%rbx, %rax, 8)
 ident_complete:
@@ -374,7 +374,7 @@ NEXT_PAGE(level2_ident_pgt)
        /* Since I easily can, map the first 1G.
         * Don't set NX because code runs from these pages.
         */
-       PMDS(0, __PAGE_KERNEL_LARGE_EXEC, PTRS_PER_PMD)
+       PMDS(0, __PAGE_KERNEL_IDENT_LARGE_EXEC, PTRS_PER_PMD)
 
 NEXT_PAGE(level2_kernel_pgt)
        /*
index 50e5e4a31c8500e94b277378b2d3860d673fc225..19191430274496e8d04f4bd4e165f852e6753560 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/thread_info.h>
 #include <linux/syscalls.h>
+#include <asm/syscalls.h>
 
 /* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
 static void set_bitmap(unsigned long *bitmap, unsigned int base,
index 3f7537b669d312e08a6d92e92787feb0ae903549..f1c688e46f35a8443e031b0e8dd572800a86c097 100644 (file)
@@ -20,6 +20,8 @@
 
 #ifdef CONFIG_X86_32
 #include <mach_apic.h>
+#include <mach_ipi.h>
+
 /*
  * the following functions deal with sending IPIs between CPUs.
  *
@@ -147,7 +149,6 @@ void send_IPI_mask_sequence(cpumask_t mask, int vector)
 }
 
 /* must come after the send_IPI functions above for inlining */
-#include <mach_ipi.h>
 static int convert_apicid_to_cpu(int apic_id)
 {
        int i;
index 1cf8c1fcc0889c5a066ddb2b7e150ece69dc1729..b71e02d42f4fd288a21a51f256c422b6d4d74d83 100644 (file)
@@ -325,7 +325,7 @@ skip:
                for_each_online_cpu(j)
                        seq_printf(p, "%10u ",
                                per_cpu(irq_stat,j).irq_call_count);
-               seq_printf(p, "  function call interrupts\n");
+               seq_printf(p, "  Function call interrupts\n");
                seq_printf(p, "TLB: ");
                for_each_online_cpu(j)
                        seq_printf(p, "%10u ",
index 1f78b238d8d2cc8778520e048fe69d36a97209b2..f065fe9071b9f65dcaf1d519c0063065c43cce62 100644 (file)
@@ -129,7 +129,7 @@ skip:
                seq_printf(p, "CAL: ");
                for_each_online_cpu(j)
                        seq_printf(p, "%10u ", cpu_pda(j)->irq_call_count);
-               seq_printf(p, "  function call interrupts\n");
+               seq_printf(p, "  Function call interrupts\n");
                seq_printf(p, "TLB: ");
                for_each_online_cpu(j)
                        seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count);
index f2d43bc7551488a61390c27cd429a9721fefbc26..ff7d3b0124f1db07bbb0750ec0fe0e9237f66574 100644 (file)
@@ -139,6 +139,7 @@ static int __init create_setup_data_nodes(struct dentry *parent)
                if (PageHighMem(pg)) {
                        data = ioremap_cache(pa_data, sizeof(*data));
                        if (!data) {
+                               kfree(node);
                                error = -ENXIO;
                                goto err_dir;
                        }
index f47f0eb886b8ddeab27ec8a8fd319801c45ef503..10435a120d2227bffd79a3df193f4238049ce2b0 100644 (file)
@@ -69,6 +69,9 @@ static int gdb_x86vector = -1;
  */
 void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
 {
+#ifndef CONFIG_X86_32
+       u32 *gdb_regs32 = (u32 *)gdb_regs;
+#endif
        gdb_regs[GDB_AX]        = regs->ax;
        gdb_regs[GDB_BX]        = regs->bx;
        gdb_regs[GDB_CX]        = regs->cx;
@@ -76,9 +79,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
        gdb_regs[GDB_SI]        = regs->si;
        gdb_regs[GDB_DI]        = regs->di;
        gdb_regs[GDB_BP]        = regs->bp;
-       gdb_regs[GDB_PS]        = regs->flags;
        gdb_regs[GDB_PC]        = regs->ip;
 #ifdef CONFIG_X86_32
+       gdb_regs[GDB_PS]        = regs->flags;
        gdb_regs[GDB_DS]        = regs->ds;
        gdb_regs[GDB_ES]        = regs->es;
        gdb_regs[GDB_CS]        = regs->cs;
@@ -94,6 +97,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
        gdb_regs[GDB_R13]       = regs->r13;
        gdb_regs[GDB_R14]       = regs->r14;
        gdb_regs[GDB_R15]       = regs->r15;
+       gdb_regs32[GDB_PS]      = regs->flags;
+       gdb_regs32[GDB_CS]      = regs->cs;
+       gdb_regs32[GDB_SS]      = regs->ss;
 #endif
        gdb_regs[GDB_SP]        = regs->sp;
 }
@@ -112,6 +118,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
  */
 void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
 {
+#ifndef CONFIG_X86_32
+       u32 *gdb_regs32 = (u32 *)gdb_regs;
+#endif
        gdb_regs[GDB_AX]        = 0;
        gdb_regs[GDB_BX]        = 0;
        gdb_regs[GDB_CX]        = 0;
@@ -129,8 +138,10 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
        gdb_regs[GDB_FS]        = 0xFFFF;
        gdb_regs[GDB_GS]        = 0xFFFF;
 #else
-       gdb_regs[GDB_PS]        = *(unsigned long *)(p->thread.sp + 8);
-       gdb_regs[GDB_PC]        = 0;
+       gdb_regs32[GDB_PS]      = *(unsigned long *)(p->thread.sp + 8);
+       gdb_regs32[GDB_CS]      = __KERNEL_CS;
+       gdb_regs32[GDB_SS]      = __KERNEL_DS;
+       gdb_regs[GDB_PC]        = p->thread.ip;
        gdb_regs[GDB_R8]        = 0;
        gdb_regs[GDB_R9]        = 0;
        gdb_regs[GDB_R10]       = 0;
@@ -153,6 +164,9 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
  */
 void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
 {
+#ifndef CONFIG_X86_32
+       u32 *gdb_regs32 = (u32 *)gdb_regs;
+#endif
        regs->ax                = gdb_regs[GDB_AX];
        regs->bx                = gdb_regs[GDB_BX];
        regs->cx                = gdb_regs[GDB_CX];
@@ -160,9 +174,9 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
        regs->si                = gdb_regs[GDB_SI];
        regs->di                = gdb_regs[GDB_DI];
        regs->bp                = gdb_regs[GDB_BP];
-       regs->flags             = gdb_regs[GDB_PS];
        regs->ip                = gdb_regs[GDB_PC];
 #ifdef CONFIG_X86_32
+       regs->flags             = gdb_regs[GDB_PS];
        regs->ds                = gdb_regs[GDB_DS];
        regs->es                = gdb_regs[GDB_ES];
        regs->cs                = gdb_regs[GDB_CS];
@@ -175,6 +189,9 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
        regs->r13               = gdb_regs[GDB_R13];
        regs->r14               = gdb_regs[GDB_R14];
        regs->r15               = gdb_regs[GDB_R15];
+       regs->flags             = gdb_regs32[GDB_PS];
+       regs->cs                = gdb_regs32[GDB_CS];
+       regs->ss                = gdb_regs32[GDB_SS];
 #endif
 }
 
@@ -378,10 +395,8 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                if (remcomInBuffer[0] == 's') {
                        linux_regs->flags |= X86_EFLAGS_TF;
                        kgdb_single_step = 1;
-                       if (kgdb_contthread) {
-                               atomic_set(&kgdb_cpu_doing_single_step,
-                                          raw_smp_processor_id());
-                       }
+                       atomic_set(&kgdb_cpu_doing_single_step,
+                                  raw_smp_processor_id());
                }
 
                get_debugreg(dr6, 6);
@@ -440,12 +455,7 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
                return NOTIFY_DONE;
 
        case DIE_NMI_IPI:
-               if (atomic_read(&kgdb_active) != -1) {
-                       /* KGDB CPU roundup */
-                       kgdb_nmicallback(raw_smp_processor_id(), regs);
-                       was_in_debug_nmi[raw_smp_processor_id()] = 1;
-                       touch_nmi_watchdog();
-               }
+               /* Just ignore, we will handle the roundup on DIE_NMI. */
                return NOTIFY_DONE;
 
        case DIE_NMIUNKNOWN:
@@ -466,9 +476,15 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
 
        case DIE_DEBUG:
                if (atomic_read(&kgdb_cpu_doing_single_step) ==
-                       raw_smp_processor_id() &&
-                       user_mode(regs))
-                       return single_step_cont(regs, args);
+                   raw_smp_processor_id()) {
+                       if (user_mode(regs))
+                               return single_step_cont(regs, args);
+                       break;
+               } else if (test_thread_flag(TIF_SINGLESTEP))
+                       /* This means a user thread is single stepping
+                        * a system call which should be ignored
+                        */
+                       return NOTIFY_DONE;
                /* fall through */
        default:
                if (user_mode(regs))
index 8b7a3cf37d2b8192cbe1a1fe68ff93740dd0d59f..478bca986eca0d5213f3fe992cdb409db3670ce7 100644 (file)
@@ -178,7 +178,7 @@ static void kvm_flush_tlb(void)
        kvm_deferred_mmu_op(&ftlb, sizeof ftlb);
 }
 
-static void kvm_release_pt(u32 pfn)
+static void kvm_release_pt(unsigned long pfn)
 {
        struct kvm_mmu_op_release_pt rpt = {
                .header.op = KVM_MMU_OP_RELEASE_PT,
index b68e21f06f4f84615baf2fbc47179fd437bea321..0ed5f939b9056330cb0eb5eaefe564f405b4a14a 100644 (file)
@@ -18,6 +18,7 @@
 #include <asm/ldt.h>
 #include <asm/desc.h>
 #include <asm/mmu_context.h>
+#include <asm/syscalls.h>
 
 #ifdef CONFIG_SMP
 static void flush_ldt(void *current_mm)
index abb78a2cc4ad5d1a8e43fcf1430dd6245ac57f42..2c97f07f1c2cb76a705e4e421c018837588f1b6c 100644 (file)
@@ -299,6 +299,15 @@ void acpi_nmi_disable(void)
                on_each_cpu(__acpi_nmi_disable, NULL, 1);
 }
 
+/*
+ * This function is called as soon the LAPIC NMI watchdog driver has everything
+ * in place and it's ready to check if the NMIs belong to the NMI watchdog
+ */
+void cpu_nmi_set_wd_enabled(void)
+{
+       __get_cpu_var(wd_enabled) = 1;
+}
+
 void setup_apic_nmi_watchdog(void *unused)
 {
        if (__get_cpu_var(wd_enabled))
@@ -311,8 +320,6 @@ void setup_apic_nmi_watchdog(void *unused)
 
        switch (nmi_watchdog) {
        case NMI_LOCAL_APIC:
-                /* enable it before to avoid race with handler */
-               __get_cpu_var(wd_enabled) = 1;
                if (lapic_watchdog_init(nmi_hz) < 0) {
                        __get_cpu_var(wd_enabled) = 0;
                        return;
index 3e6672274807f414ae243e924495c8e79ce9c983..7a13fac63a1f11ccd8cfe2cf72160117a0477cd2 100644 (file)
@@ -190,12 +190,12 @@ EXPORT_SYMBOL_GPL(olpc_ec_cmd);
 static void __init platform_detect(void)
 {
        size_t propsize;
-       u32 rev;
+       __be32 rev;
 
        if (ofw("getprop", 4, 1, NULL, "board-revision-int", &rev, 4,
                        &propsize) || propsize != 4) {
                printk(KERN_ERR "ofw: getprop call failed!\n");
-               rev = 0;
+               rev = cpu_to_be32(0);
        }
        olpc_platform_info.boardrev = be32_to_cpu(rev);
 }
@@ -203,7 +203,7 @@ static void __init platform_detect(void)
 static void __init platform_detect(void)
 {
        /* stopgap until OFW support is added to the kernel */
-       olpc_platform_info.boardrev = be32_to_cpu(0xc2);
+       olpc_platform_info.boardrev = 0xc2;
 }
 #endif
 
index 300da17e61cbef997d527031a49bb1e81addf897..e2f43768723a57452b15200f9f0f209e4d6622f6 100644 (file)
@@ -330,6 +330,7 @@ struct pv_cpu_ops pv_cpu_ops = {
 #endif
        .wbinvd = native_wbinvd,
        .read_msr = native_read_msr_safe,
+       .read_msr_amd = native_read_msr_amd_safe,
        .write_msr = native_write_msr_safe,
        .read_tsc = native_read_tsc,
        .read_pmc = native_read_pmc,
index 58262218781bd3582b1b99f7d42986170e49e23c..9fe644f4861d4f675206ce16f2c8f7c799a6aae5 100644 (file)
@@ -23,7 +23,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
                        start = start_##ops##_##x;              \
                        end = end_##ops##_##x;                  \
                        goto patch_site
-       switch(type) {
+       switch (type) {
                PATCH_SITE(pv_irq_ops, irq_disable);
                PATCH_SITE(pv_irq_ops, irq_enable);
                PATCH_SITE(pv_irq_ops, restore_fl);
index 4e612d20170af3451f1b3a901e5d56d60739aaa2..0a3824e837b4c1b38d3fdc6b778e4d6ba076f4bc 100644 (file)
@@ -83,7 +83,7 @@ void __init dma32_reserve_bootmem(void)
         * using 512M as goal
         */
        align = 64ULL<<20;
-       size = round_up(dma32_bootmem_size, align);
+       size = roundup(dma32_bootmem_size, align);
        dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align,
                                 512ULL<<20);
        if (dma32_bootmem_ptr)
index d077116fec1b5d3d57d10d3f84104b21a6a2d11b..145f1c83369f17a7e5696a7e241d1d28573606dc 100644 (file)
@@ -650,7 +650,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
        struct pci_dev *dev;
        void *gatt;
        int i, error;
-       unsigned long start_pfn, end_pfn;
 
        printk(KERN_INFO "PCI-DMA: Disabling AGP.\n");
        aper_size = aper_base = info->aper_size = 0;
@@ -697,12 +696,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
        printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n",
               aper_base, aper_size>>10);
 
-       /* need to map that range */
-       end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
-       if (end_pfn > max_low_pfn_mapped) {
-               start_pfn = (aper_base>>PAGE_SHIFT);
-               init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
-       }
        return 0;
 
  nommu:
@@ -745,7 +738,8 @@ void __init gart_iommu_init(void)
 {
        struct agp_kern_info info;
        unsigned long iommu_start;
-       unsigned long aper_size;
+       unsigned long aper_base, aper_size;
+       unsigned long start_pfn, end_pfn;
        unsigned long scratch;
        long i;
 
@@ -783,8 +777,16 @@ void __init gart_iommu_init(void)
                return;
        }
 
+       /* need to map that range */
+       aper_size = info.aper_size << 20;
+       aper_base = info.aper_base;
+       end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
+       if (end_pfn > max_low_pfn_mapped) {
+               start_pfn = (aper_base>>PAGE_SHIFT);
+               init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
+       }
+
        printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
-       aper_size = info.aper_size * 1024 * 1024;
        iommu_size = check_iommu_size(info.aper_base, aper_size);
        iommu_pages = iommu_size >> PAGE_SHIFT;
 
index bc1f2d3ea277817145cc7964f757c18ef3e21a51..a311ffcaad165c13032fc8972abc4bab44d251b4 100644 (file)
@@ -1,20 +1,13 @@
 #include <linux/platform_device.h>
-#include <linux/errno.h>
+#include <linux/err.h>
 #include <linux/init.h>
 
 static __init int add_pcspkr(void)
 {
        struct platform_device *pd;
-       int ret;
 
-       pd = platform_device_alloc("pcspkr", -1);
-       if (!pd)
-               return -ENOMEM;
+       pd = platform_device_register_simple("pcspkr", -1, NULL, 0);
 
-       ret = platform_device_add(pd);
-       if (ret)
-               platform_device_put(pd);
-
-       return ret;
+       return IS_ERR(pd) ? PTR_ERR(pd) : 0;
 }
 device_initcall(add_pcspkr);
index 7fc4d5b0a6a0f99a4d1d9c4df685a5a4d3a135bb..ec7a2ba9bce8062d870448ce5a5292b81b0d6dd8 100644 (file)
@@ -185,7 +185,8 @@ static void mwait_idle(void)
 static void poll_idle(void)
 {
        local_irq_enable();
-       cpu_relax();
+       while (!need_resched())
+               cpu_relax();
 }
 
 /*
@@ -246,6 +247,14 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
        return 1;
 }
 
+static cpumask_t c1e_mask = CPU_MASK_NONE;
+static int c1e_detected;
+
+void c1e_remove_cpu(int cpu)
+{
+       cpu_clear(cpu, c1e_mask);
+}
+
 /*
  * C1E aware idle routine. We check for C1E active in the interrupt
  * pending message MSR. If we detect C1E, then we handle it the same
@@ -253,9 +262,6 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
  */
 static void c1e_idle(void)
 {
-       static cpumask_t c1e_mask = CPU_MASK_NONE;
-       static int c1e_detected;
-
        if (need_resched())
                return;
 
@@ -265,8 +271,10 @@ static void c1e_idle(void)
                rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
                if (lo & K8_INTP_C1E_ACTIVE_MASK) {
                        c1e_detected = 1;
-                       mark_tsc_unstable("TSC halt in C1E");
-                       printk(KERN_INFO "System has C1E enabled\n");
+                       if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
+                               mark_tsc_unstable("TSC halt in AMD C1E");
+                       printk(KERN_INFO "System has AMD C1E enabled\n");
+                       set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E);
                }
        }
 
index 3b7a1ddcc0bce7eca8c989906fa377d4f0322f50..205188db96269c459d0d5cf739c6ce5495e082ea 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/tick.h>
 #include <linux/percpu.h>
 #include <linux/prctl.h>
+#include <linux/dmi.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -55,6 +56,9 @@
 #include <asm/tlbflush.h>
 #include <asm/cpu.h>
 #include <asm/kdebug.h>
+#include <asm/idle.h>
+#include <asm/syscalls.h>
+#include <asm/smp.h>
 
 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
 
@@ -88,6 +92,7 @@ static void cpu_exit_clear(void)
        cpu_clear(cpu, cpu_callin_map);
 
        numa_remove_cpu(cpu);
+       c1e_remove_cpu(cpu);
 }
 
 /* We don't actually take CPU down, just spin without interrupts. */
@@ -159,6 +164,7 @@ void __show_registers(struct pt_regs *regs, int all)
        unsigned long d0, d1, d2, d3, d6, d7;
        unsigned long sp;
        unsigned short ss, gs;
+       const char *board;
 
        if (user_mode_vm(regs)) {
                sp = regs->sp;
@@ -171,11 +177,15 @@ void __show_registers(struct pt_regs *regs, int all)
        }
 
        printk("\n");
-       printk("Pid: %d, comm: %s %s (%s %.*s)\n",
+
+       board = dmi_get_system_info(DMI_PRODUCT_NAME);
+       if (!board)
+               board = "";
+       printk("Pid: %d, comm: %s %s (%s %.*s) %s\n",
                        task_pid_nr(current), current->comm,
                        print_tainted(), init_utsname()->release,
                        (int)strcspn(init_utsname()->version, " "),
-                       init_utsname()->version);
+                       init_utsname()->version, board);
 
        printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
                        (u16)regs->cs, regs->ip, regs->flags,
@@ -275,6 +285,14 @@ void exit_thread(void)
                tss->x86_tss.io_bitmap_base = INVALID_IO_BITMAP_OFFSET;
                put_cpu();
        }
+#ifdef CONFIG_X86_DS
+       /* Free any DS contexts that have not been properly released. */
+       if (unlikely(current->thread.ds_ctx)) {
+               /* we clear debugctl to make sure DS is not used. */
+               update_debugctlmsr(0);
+               ds_free(current->thread.ds_ctx);
+       }
+#endif /* CONFIG_X86_DS */
 }
 
 void flush_thread(void)
@@ -436,6 +454,35 @@ int set_tsc_mode(unsigned int val)
        return 0;
 }
 
+#ifdef CONFIG_X86_DS
+static int update_debugctl(struct thread_struct *prev,
+                       struct thread_struct *next, unsigned long debugctl)
+{
+       unsigned long ds_prev = 0;
+       unsigned long ds_next = 0;
+
+       if (prev->ds_ctx)
+               ds_prev = (unsigned long)prev->ds_ctx->ds;
+       if (next->ds_ctx)
+               ds_next = (unsigned long)next->ds_ctx->ds;
+
+       if (ds_next != ds_prev) {
+               /* we clear debugctl to make sure DS
+                * is not in use when we change it */
+               debugctl = 0;
+               update_debugctlmsr(0);
+               wrmsr(MSR_IA32_DS_AREA, ds_next, 0);
+       }
+       return debugctl;
+}
+#else
+static int update_debugctl(struct thread_struct *prev,
+                       struct thread_struct *next, unsigned long debugctl)
+{
+       return debugctl;
+}
+#endif /* CONFIG_X86_DS */
+
 static noinline void
 __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
                 struct tss_struct *tss)
@@ -446,14 +493,7 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
        prev = &prev_p->thread;
        next = &next_p->thread;
 
-       debugctl = prev->debugctlmsr;
-       if (next->ds_area_msr != prev->ds_area_msr) {
-               /* we clear debugctl to make sure DS
-                * is not in use when we change it */
-               debugctl = 0;
-               update_debugctlmsr(0);
-               wrmsr(MSR_IA32_DS_AREA, next->ds_area_msr, 0);
-       }
+       debugctl = update_debugctl(prev, next, prev->debugctlmsr);
 
        if (next->debugctlmsr != debugctl)
                update_debugctlmsr(next->debugctlmsr);
@@ -477,13 +517,13 @@ __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
                        hard_enable_TSC();
        }
 
-#ifdef X86_BTS
+#ifdef CONFIG_X86_PTRACE_BTS
        if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS))
                ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS);
 
        if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS))
                ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES);
-#endif
+#endif /* CONFIG_X86_PTRACE_BTS */
 
 
        if (!test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) {
index 71553b664e2af8601361a9af3413599b752a3e5c..2a8ccb9238b4719036aef70780b282e60f58acdd 100644 (file)
 #include <linux/kdebug.h>
 #include <linux/tick.h>
 #include <linux/prctl.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
 
-#include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
-#include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/i387.h>
 #include <asm/mmu_context.h>
@@ -51,6 +51,7 @@
 #include <asm/proto.h>
 #include <asm/ia32.h>
 #include <asm/idle.h>
+#include <asm/syscalls.h>
 
 asmlinkage extern void ret_from_fork(void);
 
@@ -88,11 +89,13 @@ void exit_idle(void)
 #ifdef CONFIG_HOTPLUG_CPU
 DECLARE_PER_CPU(int, cpu_state);
 
-#include <asm/nmi.h>
+#include <linux/nmi.h>
 /* We halt the CPU with physical CPU hotplug */
 static inline void play_dead(void)
 {
        idle_task_exit();
+       c1e_remove_cpu(raw_smp_processor_id());
+
        mb();
        /* Ack it */
        __get_cpu_var(cpu_state) = CPU_DEAD;
@@ -151,7 +154,7 @@ void cpu_idle(void)
 }
 
 /* Prints also some state that isn't saved in the pt_regs */
-void __show_regs(struct pt_regs * regs)
+void __show_regs(struct pt_regs *regs)
 {
        unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
        unsigned long d0, d1, d2, d3, d6, d7;
@@ -160,59 +163,61 @@ void __show_regs(struct pt_regs * regs)
 
        printk("\n");
        print_modules();
-       printk("Pid: %d, comm: %.20s %s %s %.*s\n",
+       printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s\n",
                current->pid, current->comm, print_tainted(),
                init_utsname()->release,
                (int)strcspn(init_utsname()->version, " "),
                init_utsname()->version);
-       printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
+       printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
        printk_address(regs->ip, 1);
-       printk("RSP: %04lx:%016lx  EFLAGS: %08lx\n", regs->ss, regs->sp,
-               regs->flags);
-       printk("RAX: %016lx RBX: %016lx RCX: %016lx\n",
+       printk(KERN_INFO "RSP: %04lx:%016lx  EFLAGS: %08lx\n", regs->ss,
+                       regs->sp, regs->flags);
+       printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n",
               regs->ax, regs->bx, regs->cx);
-       printk("RDX: %016lx RSI: %016lx RDI: %016lx\n",
+       printk(KERN_INFO "RDX: %016lx RSI: %016lx RDI: %016lx\n",
               regs->dx, regs->si, regs->di);
-       printk("RBP: %016lx R08: %016lx R09: %016lx\n",
+       printk(KERN_INFO "RBP: %016lx R08: %016lx R09: %016lx\n",
               regs->bp, regs->r8, regs->r9);
-       printk("R10: %016lx R11: %016lx R12: %016lx\n",
-              regs->r10, regs->r11, regs->r12); 
-       printk("R13: %016lx R14: %016lx R15: %016lx\n",
-              regs->r13, regs->r14, regs->r15); 
-
-       asm("movl %%ds,%0" : "=r" (ds)); 
-       asm("movl %%cs,%0" : "=r" (cs)); 
-       asm("movl %%es,%0" : "=r" (es)); 
+       printk(KERN_INFO "R10: %016lx R11: %016lx R12: %016lx\n",
+              regs->r10, regs->r11, regs->r12);
+       printk(KERN_INFO "R13: %016lx R14: %016lx R15: %016lx\n",
+              regs->r13, regs->r14, regs->r15);
+
+       asm("movl %%ds,%0" : "=r" (ds));
+       asm("movl %%cs,%0" : "=r" (cs));
+       asm("movl %%es,%0" : "=r" (es));
        asm("movl %%fs,%0" : "=r" (fsindex));
        asm("movl %%gs,%0" : "=r" (gsindex));
 
        rdmsrl(MSR_FS_BASE, fs);
-       rdmsrl(MSR_GS_BASE, gs); 
-       rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); 
+       rdmsrl(MSR_GS_BASE, gs);
+       rdmsrl(MSR_KERNEL_GS_BASE, shadowgs);
 
        cr0 = read_cr0();
        cr2 = read_cr2();
        cr3 = read_cr3();
        cr4 = read_cr4();
 
-       printk("FS:  %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", 
-              fs,fsindex,gs,gsindex,shadowgs); 
-       printk("CS:  %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, es, cr0); 
-       printk("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4);
+       printk(KERN_INFO "FS:  %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
+              fs, fsindex, gs, gsindex, shadowgs);
+       printk(KERN_INFO "CS:  %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds,
+                       es, cr0);
+       printk(KERN_INFO "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3,
+                       cr4);
 
        get_debugreg(d0, 0);
        get_debugreg(d1, 1);
        get_debugreg(d2, 2);
-       printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
+       printk(KERN_INFO "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
        get_debugreg(d3, 3);
        get_debugreg(d6, 6);
        get_debugreg(d7, 7);
-       printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
+       printk(KERN_INFO "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
 }
 
 void show_regs(struct pt_regs *regs)
 {
-       printk("CPU %d:", smp_processor_id());
+       printk(KERN_INFO "CPU %d:", smp_processor_id());
        __show_regs(regs);
        show_trace(NULL, regs, (void *)(regs + 1), regs->bp);
 }
@@ -238,6 +243,14 @@ void exit_thread(void)
                t->io_bitmap_max = 0;
                put_cpu();
        }
+#ifdef CONFIG_X86_DS
+       /* Free any DS contexts that have not been properly released. */
+       if (unlikely(t->ds_ctx)) {
+               /* we clear debugctl to make sure DS is not used. */
+               update_debugctlmsr(0);
+               ds_free(t->ds_ctx);
+       }
+#endif /* CONFIG_X86_DS */
 }
 
 void flush_thread(void)
@@ -313,10 +326,10 @@ void prepare_to_copy(struct task_struct *tsk)
 
 int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
                unsigned long unused,
-       struct task_struct * p, struct pt_regs * regs)
+       struct task_struct *p, struct pt_regs *regs)
 {
        int err;
-       struct pt_regs * childregs;
+       struct pt_regs *childregs;
        struct task_struct *me = current;
 
        childregs = ((struct pt_regs *)
@@ -361,10 +374,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
                if (test_thread_flag(TIF_IA32))
                        err = do_set_thread_area(p, -1,
                                (struct user_desc __user *)childregs->si, 0);
-               else                    
-#endif  
-                       err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8); 
-               if (err) 
+               else
+#endif
+                       err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8);
+               if (err)
                        goto out;
        }
        err = 0;
@@ -471,13 +484,27 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
        next = &next_p->thread;
 
        debugctl = prev->debugctlmsr;
-       if (next->ds_area_msr != prev->ds_area_msr) {
-               /* we clear debugctl to make sure DS
-                * is not in use when we change it */
-               debugctl = 0;
-               update_debugctlmsr(0);
-               wrmsrl(MSR_IA32_DS_AREA, next->ds_area_msr);
+
+#ifdef CONFIG_X86_DS
+       {
+               unsigned long ds_prev = 0, ds_next = 0;
+
+               if (prev->ds_ctx)
+                       ds_prev = (unsigned long)prev->ds_ctx->ds;
+               if (next->ds_ctx)
+                       ds_next = (unsigned long)next->ds_ctx->ds;
+
+               if (ds_next != ds_prev) {
+                       /*
+                        * We clear debugctl to make sure DS
+                        * is not in use when we change it:
+                        */
+                       debugctl = 0;
+                       update_debugctlmsr(0);
+                       wrmsrl(MSR_IA32_DS_AREA, ds_next);
+               }
        }
+#endif /* CONFIG_X86_DS */
 
        if (next->debugctlmsr != debugctl)
                update_debugctlmsr(next->debugctlmsr);
@@ -515,13 +542,13 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
                memset(tss->io_bitmap, 0xff, prev->io_bitmap_max);
        }
 
-#ifdef X86_BTS
+#ifdef CONFIG_X86_PTRACE_BTS
        if (test_tsk_thread_flag(prev_p, TIF_BTS_TRACE_TS))
                ptrace_bts_take_timestamp(prev_p, BTS_TASK_DEPARTS);
 
        if (test_tsk_thread_flag(next_p, TIF_BTS_TRACE_TS))
                ptrace_bts_take_timestamp(next_p, BTS_TASK_ARRIVES);
-#endif
+#endif /* CONFIG_X86_PTRACE_BTS */
 }
 
 /*
@@ -543,7 +570,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
        unsigned fsindex, gsindex;
 
        /* we're going to use this soon, after a few expensive things */
-       if (next_p->fpu_counter>5)
+       if (next_p->fpu_counter > 5)
                prefetch(next->xstate);
 
        /*
@@ -551,13 +578,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
         */
        load_sp0(tss, next);
 
-       /* 
+       /*
         * Switch DS and ES.
         * This won't pick up thread selector changes, but I guess that is ok.
         */
        savesegment(es, prev->es);
        if (unlikely(next->es | prev->es))
-               loadsegment(es, next->es); 
+               loadsegment(es, next->es);
 
        savesegment(ds, prev->ds);
        if (unlikely(next->ds | prev->ds))
@@ -583,7 +610,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
         */
        arch_leave_lazy_cpu_mode();
 
-       /* 
+       /*
         * Switch FS and GS.
         *
         * Segment register != 0 always requires a reload.  Also
@@ -592,13 +619,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
         */
        if (unlikely(fsindex | next->fsindex | prev->fs)) {
                loadsegment(fs, next->fsindex);
-               /* 
+               /*
                 * Check if the user used a selector != 0; if yes
                 *  clear 64bit base, since overloaded base is always
                 *  mapped to the Null selector
                 */
                if (fsindex)
-                       prev->fs = 0;                           
+                       prev->fs = 0;
        }
        /* when next process has a 64bit base use it */
        if (next->fs)
@@ -608,7 +635,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
        if (unlikely(gsindex | next->gsindex | prev->gs)) {
                load_gs_index(next->gsindex);
                if (gsindex)
-                       prev->gs = 0;                           
+                       prev->gs = 0;
        }
        if (next->gs)
                wrmsrl(MSR_KERNEL_GS_BASE, next->gs);
@@ -617,12 +644,12 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
        /* Must be after DS reload */
        unlazy_fpu(prev_p);
 
-       /* 
+       /*
         * Switch the PDA and FPU contexts.
         */
        prev->usersp = read_pda(oldrsp);
        write_pda(oldrsp, next->usersp);
-       write_pda(pcurrent, next_p); 
+       write_pda(pcurrent, next_p);
 
        write_pda(kernelstack,
                  (unsigned long)task_stack_page(next_p) +
@@ -663,7 +690,7 @@ long sys_execve(char __user *name, char __user * __user *argv,
                char __user * __user *envp, struct pt_regs *regs)
 {
        long error;
-       char * filename;
+       char *filename;
 
        filename = getname(name);
        error = PTR_ERR(filename);
@@ -721,55 +748,55 @@ asmlinkage long sys_vfork(struct pt_regs *regs)
 unsigned long get_wchan(struct task_struct *p)
 {
        unsigned long stack;
-       u64 fp,ip;
+       u64 fp, ip;
        int count = 0;
 
-       if (!p || p == current || p->state==TASK_RUNNING)
-               return 0; 
+       if (!p || p == current || p->state == TASK_RUNNING)
+               return 0;
        stack = (unsigned long)task_stack_page(p);
        if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE)
                return 0;
        fp = *(u64 *)(p->thread.sp);
-       do { 
+       do {
                if (fp < (unsigned long)stack ||
                    fp > (unsigned long)stack+THREAD_SIZE)
-                       return 0; 
+                       return 0;
                ip = *(u64 *)(fp+8);
                if (!in_sched_functions(ip))
                        return ip;
-               fp = *(u64 *)fp; 
-       } while (count++ < 16); 
+               fp = *(u64 *)fp;
+       } while (count++ < 16);
        return 0;
 }
 
 long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
-{ 
-       int ret = 0; 
+{
+       int ret = 0;
        int doit = task == current;
        int cpu;
 
-       switch (code) { 
+       switch (code) {
        case ARCH_SET_GS:
                if (addr >= TASK_SIZE_OF(task))
-                       return -EPERM; 
+                       return -EPERM;
                cpu = get_cpu();
-               /* handle small bases via the GDT because that's faster to 
+               /* handle small bases via the GDT because that's faster to
                   switch. */
-               if (addr <= 0xffffffff) {  
-                       set_32bit_tls(task, GS_TLS, addr); 
-                       if (doit) { 
+               if (addr <= 0xffffffff) {
+                       set_32bit_tls(task, GS_TLS, addr);
+                       if (doit) {
                                load_TLS(&task->thread, cpu);
-                               load_gs_index(GS_TLS_SEL); 
+                               load_gs_index(GS_TLS_SEL);
                        }
-                       task->thread.gsindex = GS_TLS_SEL; 
+                       task->thread.gsindex = GS_TLS_SEL;
                        task->thread.gs = 0;
-               } else { 
+               } else {
                        task->thread.gsindex = 0;
                        task->thread.gs = addr;
                        if (doit) {
                                load_gs_index(0);
                                ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr);
-                       } 
+                       }
                }
                put_cpu();
                break;
@@ -823,8 +850,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
                                rdmsrl(MSR_KERNEL_GS_BASE, base);
                        else
                                base = task->thread.gs;
-               }
-               else
+               } else
                        base = task->thread.gs;
                ret = put_user(base, (unsigned long __user *)addr);
                break;
index e37dccce85db5e15922602b833a3821b78ca4ffd..e375b658efc316e4e14785b7f2a3ad61e763cd82 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/errno.h>
 #include <linux/ptrace.h>
 #include <linux/regset.h>
+#include <linux/tracehook.h>
 #include <linux/user.h>
 #include <linux/elf.h>
 #include <linux/security.h>
@@ -69,7 +70,7 @@ static inline bool invalid_selector(u16 value)
 
 #define FLAG_MASK              FLAG_MASK_32
 
-static long *pt_regs_access(struct pt_regs *regs, unsigned long regno)
+static unsigned long *pt_regs_access(struct pt_regs *regs, unsigned long regno)
 {
        BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0);
        regno >>= 2;
@@ -554,45 +555,115 @@ static int ptrace_set_debugreg(struct task_struct *child,
        return 0;
 }
 
-#ifdef X86_BTS
+#ifdef CONFIG_X86_PTRACE_BTS
+/*
+ * The configuration for a particular BTS hardware implementation.
+ */
+struct bts_configuration {
+       /* the size of a BTS record in bytes; at most BTS_MAX_RECORD_SIZE */
+       unsigned char  sizeof_bts;
+       /* the size of a field in the BTS record in bytes */
+       unsigned char  sizeof_field;
+       /* a bitmask to enable/disable BTS in DEBUGCTL MSR */
+       unsigned long debugctl_mask;
+};
+static struct bts_configuration bts_cfg;
+
+#define BTS_MAX_RECORD_SIZE (8 * 3)
+
+
+/*
+ * Branch Trace Store (BTS) uses the following format. Different
+ * architectures vary in the size of those fields.
+ * - source linear address
+ * - destination linear address
+ * - flags
+ *
+ * Later architectures use 64bit pointers throughout, whereas earlier
+ * architectures use 32bit pointers in 32bit mode.
+ *
+ * We compute the base address for the first 8 fields based on:
+ * - the field size stored in the DS configuration
+ * - the relative field position
+ *
+ * In order to store additional information in the BTS buffer, we use
+ * a special source address to indicate that the record requires
+ * special interpretation.
+ *
+ * Netburst indicated via a bit in the flags field whether the branch
+ * was predicted; this is ignored.
+ */
+
+enum bts_field {
+       bts_from = 0,
+       bts_to,
+       bts_flags,
+
+       bts_escape = (unsigned long)-1,
+       bts_qual = bts_to,
+       bts_jiffies = bts_flags
+};
+
+static inline unsigned long bts_get(const char *base, enum bts_field field)
+{
+       base += (bts_cfg.sizeof_field * field);
+       return *(unsigned long *)base;
+}
 
-static int ptrace_bts_get_size(struct task_struct *child)
+static inline void bts_set(char *base, enum bts_field field, unsigned long val)
 {
-       if (!child->thread.ds_area_msr)
-               return -ENXIO;
+       base += (bts_cfg.sizeof_field * field);;
+       (*(unsigned long *)base) = val;
+}
 
-       return ds_get_bts_index((void *)child->thread.ds_area_msr);
+/*
+ * Translate a BTS record from the raw format into the bts_struct format
+ *
+ * out (out): bts_struct interpretation
+ * raw: raw BTS record
+ */
+static void ptrace_bts_translate_record(struct bts_struct *out, const void *raw)
+{
+       memset(out, 0, sizeof(*out));
+       if (bts_get(raw, bts_from) == bts_escape) {
+               out->qualifier       = bts_get(raw, bts_qual);
+               out->variant.jiffies = bts_get(raw, bts_jiffies);
+       } else {
+               out->qualifier = BTS_BRANCH;
+               out->variant.lbr.from_ip = bts_get(raw, bts_from);
+               out->variant.lbr.to_ip   = bts_get(raw, bts_to);
+       }
 }
 
-static int ptrace_bts_read_record(struct task_struct *child,
-                                 long index,
+static int ptrace_bts_read_record(struct task_struct *child, size_t index,
                                  struct bts_struct __user *out)
 {
        struct bts_struct ret;
-       int retval;
-       int bts_end;
-       int bts_index;
-
-       if (!child->thread.ds_area_msr)
-               return -ENXIO;
+       const void *bts_record;
+       size_t bts_index, bts_end;
+       int error;
 
-       if (index < 0)
-               return -EINVAL;
+       error = ds_get_bts_end(child, &bts_end);
+       if (error < 0)
+               return error;
 
-       bts_end = ds_get_bts_end((void *)child->thread.ds_area_msr);
        if (bts_end <= index)
                return -EINVAL;
 
+       error = ds_get_bts_index(child, &bts_index);
+       if (error < 0)
+               return error;
+
        /* translate the ptrace bts index into the ds bts index */
-       bts_index = ds_get_bts_index((void *)child->thread.ds_area_msr);
-       bts_index -= (index + 1);
-       if (bts_index < 0)
-               bts_index += bts_end;
+       bts_index += bts_end - (index + 1);
+       if (bts_end <= bts_index)
+               bts_index -= bts_end;
 
-       retval = ds_read_bts((void *)child->thread.ds_area_msr,
-                            bts_index, &ret);
-       if (retval < 0)
-               return retval;
+       error = ds_access_bts(child, bts_index, &bts_record);
+       if (error < 0)
+               return error;
+
+       ptrace_bts_translate_record(&ret, bts_record);
 
        if (copy_to_user(out, &ret, sizeof(ret)))
                return -EFAULT;
@@ -600,101 +671,106 @@ static int ptrace_bts_read_record(struct task_struct *child,
        return sizeof(ret);
 }
 
-static int ptrace_bts_clear(struct task_struct *child)
-{
-       if (!child->thread.ds_area_msr)
-               return -ENXIO;
-
-       return ds_clear((void *)child->thread.ds_area_msr);
-}
-
 static int ptrace_bts_drain(struct task_struct *child,
                            long size,
                            struct bts_struct __user *out)
 {
-       int end, i;
-       void *ds = (void *)child->thread.ds_area_msr;
-
-       if (!ds)
-               return -ENXIO;
+       struct bts_struct ret;
+       const unsigned char *raw;
+       size_t end, i;
+       int error;
 
-       end = ds_get_bts_index(ds);
-       if (end <= 0)
-               return end;
+       error = ds_get_bts_index(child, &end);
+       if (error < 0)
+               return error;
 
        if (size < (end * sizeof(struct bts_struct)))
                return -EIO;
 
-       for (i = 0; i < end; i++, out++) {
-               struct bts_struct ret;
-               int retval;
+       error = ds_access_bts(child, 0, (const void **)&raw);
+       if (error < 0)
+               return error;
 
-               retval = ds_read_bts(ds, i, &ret);
-               if (retval < 0)
-                       return retval;
+       for (i = 0; i < end; i++, out++, raw += bts_cfg.sizeof_bts) {
+               ptrace_bts_translate_record(&ret, raw);
 
                if (copy_to_user(out, &ret, sizeof(ret)))
                        return -EFAULT;
        }
 
-       ds_clear(ds);
+       error = ds_clear_bts(child);
+       if (error < 0)
+               return error;
 
        return end;
 }
 
+static void ptrace_bts_ovfl(struct task_struct *child)
+{
+       send_sig(child->thread.bts_ovfl_signal, child, 0);
+}
+
 static int ptrace_bts_config(struct task_struct *child,
                             long cfg_size,
                             const struct ptrace_bts_config __user *ucfg)
 {
        struct ptrace_bts_config cfg;
-       int bts_size, ret = 0;
-       void *ds;
+       int error = 0;
+
+       error = -EOPNOTSUPP;
+       if (!bts_cfg.sizeof_bts)
+               goto errout;
 
+       error = -EIO;
        if (cfg_size < sizeof(cfg))
-               return -EIO;
+               goto errout;
 
+       error = -EFAULT;
        if (copy_from_user(&cfg, ucfg, sizeof(cfg)))
-               return -EFAULT;
+               goto errout;
 
-       if ((int)cfg.size < 0)
-               return -EINVAL;
+       error = -EINVAL;
+       if ((cfg.flags & PTRACE_BTS_O_SIGNAL) &&
+           !(cfg.flags & PTRACE_BTS_O_ALLOC))
+               goto errout;
 
-       bts_size = 0;
-       ds = (void *)child->thread.ds_area_msr;
-       if (ds) {
-               bts_size = ds_get_bts_size(ds);
-               if (bts_size < 0)
-                       return bts_size;
-       }
-       cfg.size = PAGE_ALIGN(cfg.size);
+       if (cfg.flags & PTRACE_BTS_O_ALLOC) {
+               ds_ovfl_callback_t ovfl = NULL;
+               unsigned int sig = 0;
+
+               /* we ignore the error in case we were not tracing child */
+               (void)ds_release_bts(child);
 
-       if (bts_size != cfg.size) {
-               ret = ptrace_bts_realloc(child, cfg.size,
-                                        cfg.flags & PTRACE_BTS_O_CUT_SIZE);
-               if (ret < 0)
+               if (cfg.flags & PTRACE_BTS_O_SIGNAL) {
+                       if (!cfg.signal)
+                               goto errout;
+
+                       sig  = cfg.signal;
+                       ovfl = ptrace_bts_ovfl;
+               }
+
+               error = ds_request_bts(child, /* base = */ NULL, cfg.size, ovfl);
+               if (error < 0)
                        goto errout;
 
-               ds = (void *)child->thread.ds_area_msr;
+               child->thread.bts_ovfl_signal = sig;
        }
 
-       if (cfg.flags & PTRACE_BTS_O_SIGNAL)
-               ret = ds_set_overflow(ds, DS_O_SIGNAL);
-       else
-               ret = ds_set_overflow(ds, DS_O_WRAP);
-       if (ret < 0)
+       error = -EINVAL;
+       if (!child->thread.ds_ctx && cfg.flags)
                goto errout;
 
        if (cfg.flags & PTRACE_BTS_O_TRACE)
-               child->thread.debugctlmsr |= ds_debugctl_mask();
+               child->thread.debugctlmsr |= bts_cfg.debugctl_mask;
        else
-               child->thread.debugctlmsr &= ~ds_debugctl_mask();
+               child->thread.debugctlmsr &= ~bts_cfg.debugctl_mask;
 
        if (cfg.flags & PTRACE_BTS_O_SCHED)
                set_tsk_thread_flag(child, TIF_BTS_TRACE_TS);
        else
                clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS);
 
-       ret = sizeof(cfg);
+       error = sizeof(cfg);
 
 out:
        if (child->thread.debugctlmsr)
@@ -702,10 +778,10 @@ out:
        else
                clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
 
-       return ret;
+       return error;
 
 errout:
-       child->thread.debugctlmsr &= ~ds_debugctl_mask();
+       child->thread.debugctlmsr &= ~bts_cfg.debugctl_mask;
        clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS);
        goto out;
 }
@@ -714,29 +790,40 @@ static int ptrace_bts_status(struct task_struct *child,
                             long cfg_size,
                             struct ptrace_bts_config __user *ucfg)
 {
-       void *ds = (void *)child->thread.ds_area_msr;
        struct ptrace_bts_config cfg;
+       size_t end;
+       const void *base, *max;
+       int error;
 
        if (cfg_size < sizeof(cfg))
                return -EIO;
 
-       memset(&cfg, 0, sizeof(cfg));
+       error = ds_get_bts_end(child, &end);
+       if (error < 0)
+               return error;
 
-       if (ds) {
-               cfg.size = ds_get_bts_size(ds);
+       error = ds_access_bts(child, /* index = */ 0, &base);
+       if (error < 0)
+               return error;
 
-               if (ds_get_overflow(ds) == DS_O_SIGNAL)
-                       cfg.flags |= PTRACE_BTS_O_SIGNAL;
+       error = ds_access_bts(child, /* index = */ end, &max);
+       if (error < 0)
+               return error;
 
-               if (test_tsk_thread_flag(child, TIF_DEBUGCTLMSR) &&
-                   child->thread.debugctlmsr & ds_debugctl_mask())
-                       cfg.flags |= PTRACE_BTS_O_TRACE;
+       memset(&cfg, 0, sizeof(cfg));
+       cfg.size = (max - base);
+       cfg.signal = child->thread.bts_ovfl_signal;
+       cfg.bts_size = sizeof(struct bts_struct);
 
-               if (test_tsk_thread_flag(child, TIF_BTS_TRACE_TS))
-                       cfg.flags |= PTRACE_BTS_O_SCHED;
-       }
+       if (cfg.signal)
+               cfg.flags |= PTRACE_BTS_O_SIGNAL;
 
-       cfg.bts_size = sizeof(struct bts_struct);
+       if (test_tsk_thread_flag(child, TIF_DEBUGCTLMSR) &&
+           child->thread.debugctlmsr & bts_cfg.debugctl_mask)
+               cfg.flags |= PTRACE_BTS_O_TRACE;
+
+       if (test_tsk_thread_flag(child, TIF_BTS_TRACE_TS))
+               cfg.flags |= PTRACE_BTS_O_SCHED;
 
        if (copy_to_user(ucfg, &cfg, sizeof(cfg)))
                return -EFAULT;
@@ -744,89 +831,38 @@ static int ptrace_bts_status(struct task_struct *child,
        return sizeof(cfg);
 }
 
-
 static int ptrace_bts_write_record(struct task_struct *child,
                                   const struct bts_struct *in)
 {
-       int retval;
+       unsigned char bts_record[BTS_MAX_RECORD_SIZE];
 
-       if (!child->thread.ds_area_msr)
-               return -ENXIO;
+       BUG_ON(BTS_MAX_RECORD_SIZE < bts_cfg.sizeof_bts);
 
-       retval = ds_write_bts((void *)child->thread.ds_area_msr, in);
-       if (retval)
-               return retval;
+       memset(bts_record, 0, bts_cfg.sizeof_bts);
+       switch (in->qualifier) {
+       case BTS_INVALID:
+               break;
 
-       return sizeof(*in);
-}
+       case BTS_BRANCH:
+               bts_set(bts_record, bts_from, in->variant.lbr.from_ip);
+               bts_set(bts_record, bts_to,   in->variant.lbr.to_ip);
+               break;
 
-static int ptrace_bts_realloc(struct task_struct *child,
-                             int size, int reduce_size)
-{
-       unsigned long rlim, vm;
-       int ret, old_size;
+       case BTS_TASK_ARRIVES:
+       case BTS_TASK_DEPARTS:
+               bts_set(bts_record, bts_from,    bts_escape);
+               bts_set(bts_record, bts_qual,    in->qualifier);
+               bts_set(bts_record, bts_jiffies, in->variant.jiffies);
+               break;
 
-       if (size < 0)
+       default:
                return -EINVAL;
-
-       old_size = ds_get_bts_size((void *)child->thread.ds_area_msr);
-       if (old_size < 0)
-               return old_size;
-
-       ret = ds_free((void **)&child->thread.ds_area_msr);
-       if (ret < 0)
-               goto out;
-
-       size >>= PAGE_SHIFT;
-       old_size >>= PAGE_SHIFT;
-
-       current->mm->total_vm  -= old_size;
-       current->mm->locked_vm -= old_size;
-
-       if (size == 0)
-               goto out;
-
-       rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT;
-       vm = current->mm->total_vm  + size;
-       if (rlim < vm) {
-               ret = -ENOMEM;
-
-               if (!reduce_size)
-                       goto out;
-
-               size = rlim - current->mm->total_vm;
-               if (size <= 0)
-                       goto out;
-       }
-
-       rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT;
-       vm = current->mm->locked_vm  + size;
-       if (rlim < vm) {
-               ret = -ENOMEM;
-
-               if (!reduce_size)
-                       goto out;
-
-               size = rlim - current->mm->locked_vm;
-               if (size <= 0)
-                       goto out;
        }
 
-       ret = ds_allocate((void **)&child->thread.ds_area_msr,
-                         size << PAGE_SHIFT);
-       if (ret < 0)
-               goto out;
-
-       current->mm->total_vm  += size;
-       current->mm->locked_vm += size;
-
-out:
-       if (child->thread.ds_area_msr)
-               set_tsk_thread_flag(child, TIF_DS_AREA_MSR);
-       else
-               clear_tsk_thread_flag(child, TIF_DS_AREA_MSR);
-
-       return ret;
+       /* The writing task will be the switched-to task on a context
+        * switch. It needs to write into the switched-from task's BTS
+        * buffer. */
+       return ds_unchecked_write_bts(child, bts_record, bts_cfg.sizeof_bts);
 }
 
 void ptrace_bts_take_timestamp(struct task_struct *tsk,
@@ -839,7 +875,66 @@ void ptrace_bts_take_timestamp(struct task_struct *tsk,
 
        ptrace_bts_write_record(tsk, &rec);
 }
-#endif /* X86_BTS */
+
+static const struct bts_configuration bts_cfg_netburst = {
+       .sizeof_bts    = sizeof(long) * 3,
+       .sizeof_field  = sizeof(long),
+       .debugctl_mask = (1<<2)|(1<<3)|(1<<5)
+};
+
+static const struct bts_configuration bts_cfg_pentium_m = {
+       .sizeof_bts    = sizeof(long) * 3,
+       .sizeof_field  = sizeof(long),
+       .debugctl_mask = (1<<6)|(1<<7)
+};
+
+static const struct bts_configuration bts_cfg_core2 = {
+       .sizeof_bts    = 8 * 3,
+       .sizeof_field  = 8,
+       .debugctl_mask = (1<<6)|(1<<7)|(1<<9)
+};
+
+static inline void bts_configure(const struct bts_configuration *cfg)
+{
+       bts_cfg = *cfg;
+}
+
+void __cpuinit ptrace_bts_init_intel(struct cpuinfo_x86 *c)
+{
+       switch (c->x86) {
+       case 0x6:
+               switch (c->x86_model) {
+               case 0xD:
+               case 0xE: /* Pentium M */
+                       bts_configure(&bts_cfg_pentium_m);
+                       break;
+               case 0xF: /* Core2 */
+        case 0x1C: /* Atom */
+                       bts_configure(&bts_cfg_core2);
+                       break;
+               default:
+                       /* sorry, don't know about them */
+                       break;
+               }
+               break;
+       case 0xF:
+               switch (c->x86_model) {
+               case 0x0:
+               case 0x1:
+               case 0x2: /* Netburst */
+                       bts_configure(&bts_cfg_netburst);
+                       break;
+               default:
+                       /* sorry, don't know about them */
+                       break;
+               }
+               break;
+       default:
+               /* sorry, don't know about them */
+               break;
+       }
+}
+#endif /* CONFIG_X86_PTRACE_BTS */
 
 /*
  * Called by kernel/ptrace.c when detaching..
@@ -852,15 +947,15 @@ void ptrace_disable(struct task_struct *child)
 #ifdef TIF_SYSCALL_EMU
        clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
 #endif
-       if (child->thread.ds_area_msr) {
-#ifdef X86_BTS
-               ptrace_bts_realloc(child, 0, 0);
-#endif
-               child->thread.debugctlmsr &= ~ds_debugctl_mask();
-               if (!child->thread.debugctlmsr)
-                       clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
-               clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS);
-       }
+#ifdef CONFIG_X86_PTRACE_BTS
+       (void)ds_release_bts(child);
+
+       child->thread.debugctlmsr &= ~bts_cfg.debugctl_mask;
+       if (!child->thread.debugctlmsr)
+               clear_tsk_thread_flag(child, TIF_DEBUGCTLMSR);
+
+       clear_tsk_thread_flag(child, TIF_BTS_TRACE_TS);
+#endif /* CONFIG_X86_PTRACE_BTS */
 }
 
 #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
@@ -980,7 +1075,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        /*
         * These bits need more cooking - not enabled yet:
         */
-#ifdef X86_BTS
+#ifdef CONFIG_X86_PTRACE_BTS
        case PTRACE_BTS_CONFIG:
                ret = ptrace_bts_config
                        (child, data, (struct ptrace_bts_config __user *)addr);
@@ -992,7 +1087,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_BTS_SIZE:
-               ret = ptrace_bts_get_size(child);
+               ret = ds_get_bts_index(child, /* pos = */ NULL);
                break;
 
        case PTRACE_BTS_GET:
@@ -1001,14 +1096,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_BTS_CLEAR:
-               ret = ptrace_bts_clear(child);
+               ret = ds_clear_bts(child);
                break;
 
        case PTRACE_BTS_DRAIN:
                ret = ptrace_bts_drain
                        (child, data, (struct bts_struct __user *) addr);
                break;
-#endif
+#endif /* CONFIG_X86_PTRACE_BTS */
 
        default:
                ret = ptrace_request(child, request, addr, data);
@@ -1375,30 +1470,6 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
        force_sig_info(SIGTRAP, &info, tsk);
 }
 
-static void syscall_trace(struct pt_regs *regs)
-{
-       if (!(current->ptrace & PT_PTRACED))
-               return;
-
-#if 0
-       printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n",
-              current->comm,
-              regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0),
-              current_thread_info()->flags, current->ptrace);
-#endif
-
-       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-                               ? 0x80 : 0));
-       /*
-        * this isn't the same as continuing with a signal, but it will do
-        * for normal use.  strace only continues with a signal if the
-        * stopping signal is not SIGTRAP.  -brl
-        */
-       if (current->exit_code) {
-               send_sig(current->exit_code, current, 1);
-               current->exit_code = 0;
-       }
-}
 
 #ifdef CONFIG_X86_32
 # define IS_IA32       1
@@ -1432,8 +1503,9 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs)
        if (unlikely(test_thread_flag(TIF_SYSCALL_EMU)))
                ret = -1L;
 
-       if (ret || test_thread_flag(TIF_SYSCALL_TRACE))
-               syscall_trace(regs);
+       if ((ret || test_thread_flag(TIF_SYSCALL_TRACE)) &&
+           tracehook_report_syscall_entry(regs))
+               ret = -1L;
 
        if (unlikely(current->audit_context)) {
                if (IS_IA32)
@@ -1459,7 +1531,7 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
                audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax);
 
        if (test_thread_flag(TIF_SYSCALL_TRACE))
-               syscall_trace(regs);
+               tracehook_report_syscall_exit(regs, 0);
 
        /*
         * If TIF_SYSCALL_EMU is set, we only get here because of
@@ -1475,6 +1547,6 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
         * system call instruction.
         */
        if (test_thread_flag(TIF_SINGLESTEP) &&
-           (current->ptrace & PT_PTRACED))
+           tracehook_consider_fatal_signal(current, SIGTRAP, SIG_DFL))
                send_sigtrap(current, regs, 0);
 }
index 724adfc63cb9a7b60d6ee5c82efd919fe237f69c..f4c93f1cfc194767285bec90047c5db7ed13b758 100644 (file)
@@ -29,7 +29,11 @@ EXPORT_SYMBOL(pm_power_off);
 
 static const struct desc_ptr no_idt = {};
 static int reboot_mode;
-enum reboot_type reboot_type = BOOT_KBD;
+/*
+ * Keyboard reset and triple fault may result in INIT, not RESET, which
+ * doesn't work when we're in vmx root mode.  Try ACPI first.
+ */
+enum reboot_type reboot_type = BOOT_ACPI;
 int reboot_force;
 
 #if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
index 362d4e7f2d389b81e345fa27b13db78e80c5980a..141efab52400fe7919d1ad573ba1b54e407c9ac6 100644 (file)
@@ -223,6 +223,9 @@ unsigned long saved_video_mode;
 #define RAMDISK_LOAD_FLAG              0x4000
 
 static char __initdata command_line[COMMAND_LINE_SIZE];
+#ifdef CONFIG_CMDLINE_BOOL
+static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
+#endif
 
 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
 struct edd edd;
@@ -665,11 +668,28 @@ void __init setup_arch(char **cmdline_p)
        bss_resource.start = virt_to_phys(&__bss_start);
        bss_resource.end = virt_to_phys(&__bss_stop)-1;
 
+#ifdef CONFIG_CMDLINE_BOOL
+#ifdef CONFIG_CMDLINE_OVERRIDE
+       strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
+#else
+       if (builtin_cmdline[0]) {
+               /* append boot loader cmdline to builtin */
+               strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
+               strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
+               strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
+       }
+#endif
+#endif
+
        strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
        *cmdline_p = command_line;
 
        parse_early_param();
 
+#ifdef CONFIG_X86_64
+       check_efer();
+#endif
+
 #if defined(CONFIG_VMI) && defined(CONFIG_X86_32)
        /*
         * Must be before kernel pagetables are setup
@@ -738,7 +758,6 @@ void __init setup_arch(char **cmdline_p)
 #else
        num_physpages = max_pfn;
 
-       check_efer();
 
        /* How many end-of-memory variables you have, grandma! */
        /* need this before calling reserve_initrd */
index 76e305e064f96f9f7ece081665de18e7fb189e9a..0e67f72d931683413160a007d554c44a438c2c28 100644 (file)
@@ -162,9 +162,16 @@ void __init setup_per_cpu_areas(void)
                        printk(KERN_INFO
                               "cpu %d has no node %d or node-local memory\n",
                                cpu, node);
+                       if (ptr)
+                               printk(KERN_DEBUG "per cpu data for cpu%d at %016lx\n",
+                                        cpu, __pa(ptr));
                }
-               else
+               else {
                        ptr = alloc_bootmem_pages_node(NODE_DATA(node), size);
+                       if (ptr)
+                               printk(KERN_DEBUG "per cpu data for cpu%d on node%d at %016lx\n",
+                                        cpu, node, __pa(ptr));
+               }
 #endif
                per_cpu_offset(cpu) = ptr - __per_cpu_start;
                memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
index 72bbb519d2dc1ed74e6f01d39842995871ed9e80..8b4956e800acd4394c06e303989982c85ad04e53 100644 (file)
@@ -24,4 +24,9 @@ struct rt_sigframe {
        struct ucontext uc;
        struct siginfo info;
 };
+
+int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
+               sigset_t *set, struct pt_regs *regs);
+int ia32_setup_frame(int sig, struct k_sigaction *ka,
+               sigset_t *set, struct pt_regs *regs);
 #endif
index 6fb5bcdd893366c66ccae845f2b1a20c076fa2f3..2a2435d3037d9ac9dd8fab949c3c57c775e426e4 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/wait.h>
+#include <linux/tracehook.h>
 #include <linux/elf.h>
 #include <linux/smp.h>
 #include <linux/mm.h>
@@ -26,6 +27,7 @@
 #include <asm/uaccess.h>
 #include <asm/i387.h>
 #include <asm/vdso.h>
+#include <asm/syscalls.h>
 
 #include "sigframe.h"
 
@@ -558,8 +560,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
         * handler too.
         */
        regs->flags &= ~X86_EFLAGS_TF;
-       if (test_thread_flag(TIF_SINGLESTEP))
-               ptrace_notify(SIGTRAP);
 
        spin_lock_irq(&current->sighand->siglock);
        sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
@@ -568,6 +568,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
 
+       tracehook_signal_handler(sig, info, ka, regs,
+                                test_thread_flag(TIF_SINGLESTEP));
+
        return 0;
 }
 
@@ -661,5 +664,10 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
        if (thread_info_flags & _TIF_SIGPENDING)
                do_signal(regs);
 
+       if (thread_info_flags & _TIF_NOTIFY_RESUME) {
+               clear_thread_flag(TIF_NOTIFY_RESUME);
+               tracehook_notify_resume(regs);
+       }
+
        clear_thread_flag(TIF_IRET);
 }
index ca316b5b742ced782dc3ab4b4c8631b5a9d43a6c..694aa888bb1993d7d7a38f8fe09b15a607867c7c 100644 (file)
 #include <linux/errno.h>
 #include <linux/wait.h>
 #include <linux/ptrace.h>
+#include <linux/tracehook.h>
 #include <linux/unistd.h>
 #include <linux/stddef.h>
 #include <linux/personality.h>
 #include <linux/compiler.h>
+#include <linux/uaccess.h>
+
 #include <asm/processor.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
 #include <asm/i387.h>
 #include <asm/proto.h>
 #include <asm/ia32_unistd.h>
 #include <asm/mce.h>
+#include <asm/syscall.h>
+#include <asm/syscalls.h>
 #include "sigframe.h"
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 # define FIX_EFLAGS    __FIX_EFLAGS
 #endif
 
-int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
-               sigset_t *set, struct pt_regs * regs); 
-int ia32_setup_frame(int sig, struct k_sigaction *ka,
-            sigset_t *set, struct pt_regs * regs); 
-
 asmlinkage long
 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
                struct pt_regs *regs)
@@ -128,7 +127,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
        /* Always make any pending restarted system calls return -EINTR */
        current_thread_info()->restart_block.fn = do_no_restart_syscall;
 
-#define COPY(x)                err |= __get_user(regs->x, &sc->x)
+#define COPY(x)                (err |= __get_user(regs->x, &sc->x))
 
        COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
        COPY(dx); COPY(cx); COPY(ip);
@@ -158,7 +157,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
        }
 
        {
-               struct _fpstate __user * buf;
+               struct _fpstate __user *buf;
                err |= __get_user(buf, &sc->fpstate);
 
                if (buf) {
@@ -198,7 +197,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
        current->blocked = set;
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
-       
+
        if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
                goto badframe;
 
@@ -208,16 +207,17 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
        return ax;
 
 badframe:
-       signal_fault(regs,frame,"sigreturn");
+       signal_fault(regs, frame, "sigreturn");
        return 0;
-}      
+}
 
 /*
  * Set up a signal frame.
  */
 
 static inline int
-setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me)
+setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
+               unsigned long mask, struct task_struct *me)
 {
        int err = 0;
 
@@ -273,35 +273,35 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size)
 }
 
 static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
-                          sigset_t *set, struct pt_regs * regs)
+                          sigset_t *set, struct pt_regs *regs)
 {
        struct rt_sigframe __user *frame;
-       struct _fpstate __user *fp = NULL; 
+       struct _fpstate __user *fp = NULL;
        int err = 0;
        struct task_struct *me = current;
 
        if (used_math()) {
-               fp = get_stack(ka, regs, sizeof(struct _fpstate)); 
+               fp = get_stack(ka, regs, sizeof(struct _fpstate));
                frame = (void __user *)round_down(
                        (unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
 
                if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
                        goto give_sigsegv;
 
-               if (save_i387(fp) < 0) 
-                       err |= -1; 
+               if (save_i387(fp) < 0)
+                       err |= -1;
        } else
                frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8;
 
        if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
                goto give_sigsegv;
 
-       if (ka->sa.sa_flags & SA_SIGINFO) { 
+       if (ka->sa.sa_flags & SA_SIGINFO) {
                err |= copy_siginfo_to_user(&frame->info, info);
                if (err)
                        goto give_sigsegv;
        }
-               
+
        /* Create the ucontext.  */
        err |= __put_user(0, &frame->uc.uc_flags);
        err |= __put_user(0, &frame->uc.uc_link);
@@ -311,9 +311,9 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
        err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
        err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0], me);
        err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate);
-       if (sizeof(*set) == 16) { 
+       if (sizeof(*set) == 16) {
                __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
-               __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]); 
+               __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
        } else
                err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
 
@@ -324,7 +324,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
                err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
        } else {
                /* could use a vstub here */
-               goto give_sigsegv; 
+               goto give_sigsegv;
        }
 
        if (err)
@@ -332,7 +332,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 
        /* Set up registers for signal handler */
        regs->di = sig;
-       /* In case the signal handler was declared without prototypes */ 
+       /* In case the signal handler was declared without prototypes */
        regs->ax = 0;
 
        /* This also works for non SA_SIGINFO handlers because they expect the
@@ -354,38 +354,9 @@ give_sigsegv:
        return -EFAULT;
 }
 
-/*
- * Return -1L or the syscall number that @regs is executing.
- */
-static long current_syscall(struct pt_regs *regs)
-{
-       /*
-        * We always sign-extend a -1 value being set here,
-        * so this is always either -1L or a syscall number.
-        */
-       return regs->orig_ax;
-}
-
-/*
- * Return a value that is -EFOO if the system call in @regs->orig_ax
- * returned an error.  This only works for @regs from @current.
- */
-static long current_syscall_ret(struct pt_regs *regs)
-{
-#ifdef CONFIG_IA32_EMULATION
-       if (test_thread_flag(TIF_IA32))
-               /*
-                * Sign-extend the value so (int)-EFOO becomes (long)-EFOO
-                * and will match correctly in comparisons.
-                */
-               return (int) regs->ax;
-#endif
-       return regs->ax;
-}
-
 /*
  * OK, we're invoking a handler
- */    
+ */
 
 static int
 handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
@@ -394,9 +365,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
        int ret;
 
        /* Are we from a system call? */
-       if (current_syscall(regs) >= 0) {
+       if (syscall_get_nr(current, regs) >= 0) {
                /* If so, check system call restarting.. */
-               switch (current_syscall_ret(regs)) {
+               switch (syscall_get_error(current, regs)) {
                case -ERESTART_RESTARTBLOCK:
                case -ERESTARTNOHAND:
                        regs->ax = -EINTR;
@@ -429,7 +400,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
                        ret = ia32_setup_rt_frame(sig, ka, info, oldset, regs);
                else
                        ret = ia32_setup_frame(sig, ka, oldset, regs);
-       } else 
+       } else
 #endif
        ret = setup_rt_frame(sig, ka, info, oldset, regs);
 
@@ -453,15 +424,16 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
                 * handler too.
                 */
                regs->flags &= ~X86_EFLAGS_TF;
-               if (test_thread_flag(TIF_SINGLESTEP))
-                       ptrace_notify(SIGTRAP);
 
                spin_lock_irq(&current->sighand->siglock);
-               sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
+               sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
                if (!(ka->sa.sa_flags & SA_NODEFER))
-                       sigaddset(&current->blocked,sig);
+                       sigaddset(&current->blocked, sig);
                recalc_sigpending();
                spin_unlock_irq(&current->sighand->siglock);
+
+               tracehook_signal_handler(sig, info, ka, regs,
+                                        test_thread_flag(TIF_SINGLESTEP));
        }
 
        return ret;
@@ -518,9 +490,9 @@ static void do_signal(struct pt_regs *regs)
        }
 
        /* Did we come from a system call? */
-       if (current_syscall(regs) >= 0) {
+       if (syscall_get_nr(current, regs) >= 0) {
                /* Restart the system call - no handlers present */
-               switch (current_syscall_ret(regs)) {
+               switch (syscall_get_error(current, regs)) {
                case -ERESTARTNOHAND:
                case -ERESTARTSYS:
                case -ERESTARTNOINTR:
@@ -558,17 +530,23 @@ void do_notify_resume(struct pt_regs *regs, void *unused,
        /* deal with pending signal delivery */
        if (thread_info_flags & _TIF_SIGPENDING)
                do_signal(regs);
+
+       if (thread_info_flags & _TIF_NOTIFY_RESUME) {
+               clear_thread_flag(TIF_NOTIFY_RESUME);
+               tracehook_notify_resume(regs);
+       }
 }
 
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
-{ 
-       struct task_struct *me = current; 
+{
+       struct task_struct *me = current;
        if (show_unhandled_signals && printk_ratelimit()) {
                printk("%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx",
-              me->comm,me->pid,where,frame,regs->ip,regs->sp,regs->orig_ax);
+              me->comm, me->pid, where, frame, regs->ip,
+                  regs->sp, regs->orig_ax);
                print_vma_addr(" in ", regs->ip);
                printk("\n");
        }
 
-       force_sig(SIGSEGV, me); 
-} 
+       force_sig(SIGSEGV, me);
+}
index 7985c5b3f9162ba14c0817ce25f1297b34a87a5c..45531e3ba19436ad72001dfbcf3d5700209dc518 100644 (file)
@@ -88,7 +88,7 @@ static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
 #define get_idle_for_cpu(x)      (per_cpu(idle_thread_array, x))
 #define set_idle_for_cpu(x, p)   (per_cpu(idle_thread_array, x) = (p))
 #else
-struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
+static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
 #define get_idle_for_cpu(x)      (idle_thread_array[(x)])
 #define set_idle_for_cpu(x, p)   (idle_thread_array[(x)] = (p))
 #endif
@@ -129,7 +129,7 @@ static int boot_cpu_logical_apicid;
 static cpumask_t cpu_sibling_setup_map;
 
 /* Set if we find a B stepping CPU */
-int __cpuinitdata smp_b_stepping;
+static int __cpuinitdata smp_b_stepping;
 
 #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32)
 
@@ -1313,16 +1313,13 @@ __init void prefill_possible_map(void)
        if (!num_processors)
                num_processors = 1;
 
-#ifdef CONFIG_HOTPLUG_CPU
        if (additional_cpus == -1) {
                if (disabled_cpus > 0)
                        additional_cpus = disabled_cpus;
                else
                        additional_cpus = 0;
        }
-#else
-       additional_cpus = 0;
-#endif
+
        possible = num_processors + additional_cpus;
        if (possible > NR_CPUS)
                possible = NR_CPUS;
index 7066cb855a60154ea077f855b704bb40c0d58a53..1884a8d12bfaf130d99d7f9602268c5a7048271d 100644 (file)
@@ -22,6 +22,8 @@
 #include <linux/uaccess.h>
 #include <linux/unistd.h>
 
+#include <asm/syscalls.h>
+
 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
                          unsigned long prot, unsigned long flags,
                          unsigned long fd, unsigned long pgoff)
index 3b360ef33817c9b618e661f452e682a43dfe91bc..6bc211accf087ed2be1a381395eae95093f4dbf4 100644 (file)
 #include <linux/utsname.h>
 #include <linux/personality.h>
 #include <linux/random.h>
+#include <linux/uaccess.h>
 
-#include <asm/uaccess.h>
 #include <asm/ia32.h>
+#include <asm/syscalls.h>
 
-asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags,
-       unsigned long fd, unsigned long off)
+asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
+               unsigned long prot, unsigned long flags,
+               unsigned long fd, unsigned long off)
 {
        long error;
-       struct file * file;
+       struct file *file;
 
        error = -EINVAL;
        if (off & ~PAGE_MASK)
@@ -56,9 +58,9 @@ static void find_start_end(unsigned long flags, unsigned long *begin,
                   unmapped base down for this case. This can give
                   conflicts with the heap, but we assume that glibc
                   malloc knows how to fall back to mmap. Give it 1GB
-                  of playground for now. -AK */ 
-               *begin = 0x40000000; 
-               *end = 0x80000000;              
+                  of playground for now. -AK */
+               *begin = 0x40000000;
+               *end = 0x80000000;
                if (current->flags & PF_RANDOMIZE) {
                        new_begin = randomize_range(*begin, *begin + 0x02000000, 0);
                        if (new_begin)
@@ -66,9 +68,9 @@ static void find_start_end(unsigned long flags, unsigned long *begin,
                }
        } else {
                *begin = TASK_UNMAPPED_BASE;
-               *end = TASK_SIZE; 
+               *end = TASK_SIZE;
        }
-} 
+}
 
 unsigned long
 arch_get_unmapped_area(struct file *filp, unsigned long addr,
@@ -78,11 +80,11 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
        struct vm_area_struct *vma;
        unsigned long start_addr;
        unsigned long begin, end;
-       
+
        if (flags & MAP_FIXED)
                return addr;
 
-       find_start_end(flags, &begin, &end); 
+       find_start_end(flags, &begin, &end);
 
        if (len > end)
                return -ENOMEM;
@@ -96,12 +98,12 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
        }
        if (((flags & MAP_32BIT) || test_thread_flag(TIF_IA32))
            && len <= mm->cached_hole_size) {
-               mm->cached_hole_size = 0;
+               mm->cached_hole_size = 0;
                mm->free_area_cache = begin;
        }
        addr = mm->free_area_cache;
-       if (addr < begin) 
-               addr = begin; 
+       if (addr < begin)
+               addr = begin;
        start_addr = addr;
 
 full_search:
@@ -127,7 +129,7 @@ full_search:
                        return addr;
                }
                if (addr + mm->cached_hole_size < vma->vm_start)
-                       mm->cached_hole_size = vma->vm_start - addr;
+                       mm->cached_hole_size = vma->vm_start - addr;
 
                addr = vma->vm_end;
        }
@@ -177,7 +179,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
                vma = find_vma(mm, addr-len);
                if (!vma || addr <= vma->vm_start)
                        /* remember the address as a hint for next time */
-                       return (mm->free_area_cache = addr-len);
+                       return mm->free_area_cache = addr-len;
        }
 
        if (mm->mmap_base < len)
@@ -194,7 +196,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
                vma = find_vma(mm, addr);
                if (!vma || addr+len <= vma->vm_start)
                        /* remember the address as a hint for next time */
-                       return (mm->free_area_cache = addr);
+                       return mm->free_area_cache = addr;
 
                /* remember the largest hole we saw so far */
                if (addr + mm->cached_hole_size < vma->vm_start)
@@ -224,13 +226,13 @@ bottomup:
 }
 
 
-asmlinkage long sys_uname(struct new_utsname __user * name)
+asmlinkage long sys_uname(struct new_utsname __user *name)
 {
        int err;
        down_read(&uts_sem);
-       err = copy_to_user(name, utsname(), sizeof (*name));
+       err = copy_to_user(name, utsname(), sizeof(*name));
        up_read(&uts_sem);
-       if (personality(current->personality) == PER_LINUX32) 
-               err |= copy_to_user(&name->machine, "i686", 5);                 
+       if (personality(current->personality) == PER_LINUX32)
+               err |= copy_to_user(&name->machine, "i686", 5);
        return err ? -EFAULT : 0;
 }
index 170d43c174878ac14b15185affa0a60599e290e2..3d1be4f0fac563f56247204e8d62967872092268 100644 (file)
@@ -8,12 +8,12 @@
 #define __NO_STUBS
 
 #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ;
-#undef _ASM_X86_64_UNISTD_H_
+#undef ASM_X86__UNISTD_64_H
 #include <asm/unistd_64.h>
 
 #undef __SYSCALL
 #define __SYSCALL(nr, sym) [nr] = sym,
-#undef _ASM_X86_64_UNISTD_H_
+#undef ASM_X86__UNISTD_64_H
 
 typedef void (*sys_call_ptr_t)(void);
 
index ffe3c664afc0aae1318c1b26ab272f858d87812b..bbecf8b6bf96392de71968bdfd5da4b8aae006ad 100644 (file)
@@ -36,6 +36,7 @@
 #include <asm/arch_hooks.h>
 #include <asm/hpet.h>
 #include <asm/time.h>
+#include <asm/timer.h>
 
 #include "do_timer.h"
 
index ab6bf375a3077e0e6052f07bff9c5c6a93742e45..6bb7b8579e70e0a73a67ddcb9f69c01696bb6413 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/ldt.h>
 #include <asm/processor.h>
 #include <asm/proto.h>
+#include <asm/syscalls.h>
 
 #include "tls.h"
 
index 513caaca7115eecf5d7a58de7cf12fbe9e60e6e4..7a31f104bef9136538a304715557480243022655 100644 (file)
@@ -32,6 +32,8 @@
 #include <linux/bug.h>
 #include <linux/nmi.h>
 #include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/io.h>
 
 #if defined(CONFIG_EDAC)
 #include <linux/edac.h>
@@ -45,9 +47,6 @@
 #include <asm/unwind.h>
 #include <asm/desc.h>
 #include <asm/i387.h>
-#include <asm/nmi.h>
-#include <asm/smp.h>
-#include <asm/io.h>
 #include <asm/pgalloc.h>
 #include <asm/proto.h>
 #include <asm/pda.h>
@@ -85,7 +84,8 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
 
 void printk_address(unsigned long address, int reliable)
 {
-       printk(" [<%016lx>] %s%pS\n", address, reliable ? "": "? ", (void *) address);
+       printk(" [<%016lx>] %s%pS\n",
+                       address, reliable ?     "" : "? ", (void *) address);
 }
 
 static 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,
                [STACKFAULT_STACK - 1] = "#SS",
                [MCE_STACK - 1] = "#MC",
 #if DEBUG_STKSZ > EXCEPTION_STKSZ
-               [N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]"
+               [N_EXCEPTION_STACKS ...
+                       N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]"
 #endif
        };
        unsigned k;
@@ -163,7 +164,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
 }
 
 /*
- * x86-64 can have up to three kernel stacks: 
+ * x86-64 can have up to three kernel stacks:
  * process stack
  * interrupt stack
  * 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,
                const struct stacktrace_ops *ops, void *data)
 {
        const unsigned cpu = get_cpu();
-       unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr;
+       unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
        unsigned used = 0;
        struct thread_info *tinfo;
 
@@ -237,7 +238,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
        if (!bp) {
                if (task == current) {
                        /* Grab bp right from our regs */
-                       asm("movq %%rbp, %0" : "=r" (bp) :);
+                       asm("movq %%rbp, %0" : "=r" (bp) : );
                } else {
                        /* bp is the last reg pushed by switch_to */
                        bp = *(unsigned long *) task->thread.sp;
@@ -339,9 +340,8 @@ static void
 show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
                unsigned long *stack, unsigned long bp, char *log_lvl)
 {
-       printk("\nCall Trace:\n");
+       printk("Call Trace:\n");
        dump_trace(task, regs, stack, bp, &print_trace_ops, log_lvl);
-       printk("\n");
 }
 
 void show_trace(struct task_struct *task, struct pt_regs *regs,
@@ -357,11 +357,15 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
        unsigned long *stack;
        int i;
        const int cpu = smp_processor_id();
-       unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr);
-       unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
+       unsigned long *irqstack_end =
+               (unsigned long *) (cpu_pda(cpu)->irqstackptr);
+       unsigned long *irqstack =
+               (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
 
-       // debugging aid: "show_stack(NULL, NULL);" prints the
-       // back trace for this cpu.
+       /*
+        * debugging aid: "show_stack(NULL, NULL);" prints the
+        * back trace for this cpu.
+        */
 
        if (sp == NULL) {
                if (task)
@@ -386,6 +390,7 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
                printk(" %016lx", *stack++);
                touch_nmi_watchdog();
        }
+       printk("\n");
        show_trace_log_lvl(task, regs, sp, bp, log_lvl);
 }
 
@@ -404,7 +409,7 @@ void dump_stack(void)
 
 #ifdef CONFIG_FRAME_POINTER
        if (!bp)
-               asm("movq %%rbp, %0" : "=r" (bp):);
+               asm("movq %%rbp, %0" : "=r" (bp) : );
 #endif
 
        printk("Pid: %d, comm: %.20s %s %s %.*s\n",
@@ -414,7 +419,6 @@ void dump_stack(void)
                init_utsname()->version);
        show_trace(NULL, NULL, &stack, bp);
 }
-
 EXPORT_SYMBOL(dump_stack);
 
 void show_registers(struct pt_regs *regs)
@@ -443,7 +447,6 @@ void show_registers(struct pt_regs *regs)
                printk("Stack: ");
                show_stack_log_lvl(NULL, regs, (unsigned long *)sp,
                                regs->bp, "");
-               printk("\n");
 
                printk(KERN_EMERG "Code: ");
 
@@ -493,7 +496,7 @@ unsigned __kprobes long oops_begin(void)
        raw_local_irq_save(flags);
        cpu = smp_processor_id();
        if (!__raw_spin_trylock(&die_lock)) {
-               if (cpu == die_owner) 
+               if (cpu == die_owner)
                        /* nested oops. should stop eventually */;
                else
                        __raw_spin_lock(&die_lock);
@@ -638,7 +641,7 @@ kernel_trap:
 }
 
 #define DO_ERROR(trapnr, signr, str, name) \
-asmlinkage void do_##name(struct pt_regs * regs, long error_code)      \
+asmlinkage void do_##name(struct pt_regs *regs, long error_code)       \
 {                                                                      \
        if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr)  \
                                                        == NOTIFY_STOP) \
@@ -648,7 +651,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code)   \
 }
 
 #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr)                \
-asmlinkage void do_##name(struct pt_regs * regs, long error_code)      \
+asmlinkage void do_##name(struct pt_regs *regs, long error_code)       \
 {                                                                      \
        siginfo_t info;                                                 \
        info.si_signo = signr;                                          \
@@ -683,7 +686,7 @@ asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code)
        preempt_conditional_cli(regs);
 }
 
-asmlinkage void do_double_fault(struct pt_regs * regs, long error_code)
+asmlinkage void do_double_fault(struct pt_regs *regs, long error_code)
 {
        static const char str[] = "double fault";
        struct task_struct *tsk = current;
@@ -778,9 +781,10 @@ io_check_error(unsigned char reason, struct pt_regs *regs)
 }
 
 static notrace __kprobes void
-unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
+unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
 {
-       if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP)
+       if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) ==
+                       NOTIFY_STOP)
                return;
        printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n",
                reason);
@@ -882,7 +886,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
        else if (user_mode(eregs))
                regs = task_pt_regs(current);
        /* Exception from kernel and interrupts are enabled. Move to
-          kernel process stack. */
+          kernel process stack. */
        else if (eregs->flags & X86_EFLAGS_IF)
                regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs));
        if (eregs != regs)
@@ -891,7 +895,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
 }
 
 /* runs on IST stack. */
-asmlinkage void __kprobes do_debug(struct pt_regs * regs,
+asmlinkage void __kprobes do_debug(struct pt_regs *regs,
                                   unsigned long error_code)
 {
        struct task_struct *tsk = current;
@@ -1035,7 +1039,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
 
 asmlinkage void bad_intr(void)
 {
-       printk("bad interrupt"); 
+       printk("bad interrupt");
 }
 
 asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
@@ -1047,7 +1051,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
 
        conditional_sti(regs);
        if (!user_mode(regs) &&
-               kernel_math_error(regs, "kernel simd math error", 19))
+                       kernel_math_error(regs, "kernel simd math error", 19))
                return;
 
        /*
@@ -1092,7 +1096,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
        force_sig_info(SIGFPE, &info, task);
 }
 
-asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs)
+asmlinkage void do_spurious_interrupt_bug(struct pt_regs *regs)
 {
 }
 
@@ -1149,8 +1153,10 @@ void __init trap_init(void)
        set_intr_gate(0, &divide_error);
        set_intr_gate_ist(1, &debug, DEBUG_STACK);
        set_intr_gate_ist(2, &nmi, NMI_STACK);
-       set_system_gate_ist(3, &int3, DEBUG_STACK); /* int3 can be called from all */
-       set_system_gate(4, &overflow); /* int4 can be called from all */
+       /* int3 can be called from all */
+       set_system_gate_ist(3, &int3, DEBUG_STACK);
+       /* int4 can be called from all */
+       set_system_gate(4, &overflow);
        set_intr_gate(5, &bounds);
        set_intr_gate(6, &invalid_op);
        set_intr_gate(7, &device_not_available);
index 8f98e9de1b82f5f6a13015bd34fe428187e79c38..161bb850fc475b074524cfbba13fc161a4e6a439 100644 (file)
@@ -104,7 +104,7 @@ __setup("notsc", notsc_setup);
 /*
  * Read TSC and the reference counters. Take care of SMI disturbance
  */
-static u64 tsc_read_refs(u64 *pm, u64 *hpet)
+static u64 tsc_read_refs(u64 *p, int hpet)
 {
        u64 t1, t2;
        int i;
@@ -112,9 +112,9 @@ static u64 tsc_read_refs(u64 *pm, u64 *hpet)
        for (i = 0; i < MAX_RETRIES; i++) {
                t1 = get_cycles();
                if (hpet)
-                       *hpet = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF;
+                       *p = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF;
                else
-                       *pm = acpi_pm_read_early();
+                       *p = acpi_pm_read_early();
                t2 = get_cycles();
                if ((t2 - t1) < SMI_TRESHOLD)
                        return t2;
@@ -122,6 +122,52 @@ static u64 tsc_read_refs(u64 *pm, u64 *hpet)
        return ULLONG_MAX;
 }
 
+/*
+ * Calculate the TSC frequency from HPET reference
+ */
+static unsigned long calc_hpet_ref(u64 deltatsc, u64 hpet1, u64 hpet2)
+{
+       u64 tmp;
+
+       if (hpet2 < hpet1)
+               hpet2 += 0x100000000ULL;
+       hpet2 -= hpet1;
+       tmp = ((u64)hpet2 * hpet_readl(HPET_PERIOD));
+       do_div(tmp, 1000000);
+       do_div(deltatsc, tmp);
+
+       return (unsigned long) deltatsc;
+}
+
+/*
+ * Calculate the TSC frequency from PMTimer reference
+ */
+static unsigned long calc_pmtimer_ref(u64 deltatsc, u64 pm1, u64 pm2)
+{
+       u64 tmp;
+
+       if (!pm1 && !pm2)
+               return ULONG_MAX;
+
+       if (pm2 < pm1)
+               pm2 += (u64)ACPI_PM_OVRRUN;
+       pm2 -= pm1;
+       tmp = pm2 * 1000000000LL;
+       do_div(tmp, PMTMR_TICKS_PER_SEC);
+       do_div(deltatsc, tmp);
+
+       return (unsigned long) deltatsc;
+}
+
+#define CAL_MS         10
+#define CAL_LATCH      (CLOCK_TICK_RATE / (1000 / CAL_MS))
+#define CAL_PIT_LOOPS  1000
+
+#define CAL2_MS                50
+#define CAL2_LATCH     (CLOCK_TICK_RATE / (1000 / CAL2_MS))
+#define CAL2_PIT_LOOPS 5000
+
+
 /*
  * Try to calibrate the TSC against the Programmable
  * Interrupt Timer and return the frequency of the TSC
@@ -129,7 +175,7 @@ static u64 tsc_read_refs(u64 *pm, u64 *hpet)
  *
  * Return ULONG_MAX on failure to calibrate.
  */
-static unsigned long pit_calibrate_tsc(void)
+static unsigned long pit_calibrate_tsc(u32 latch, unsigned long ms, int loopmin)
 {
        u64 tsc, t1, t2, delta;
        unsigned long tscmin, tscmax;
@@ -144,8 +190,8 @@ static unsigned long pit_calibrate_tsc(void)
         * (LSB then MSB) to begin countdown.
         */
        outb(0xb0, 0x43);
-       outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
-       outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42);
+       outb(latch & 0xff, 0x42);
+       outb(latch >> 8, 0x42);
 
        tsc = t1 = t2 = get_cycles();
 
@@ -166,31 +212,154 @@ static unsigned long pit_calibrate_tsc(void)
        /*
         * Sanity checks:
         *
-        * If we were not able to read the PIT more than 5000
+        * If we were not able to read the PIT more than loopmin
         * times, then we have been hit by a massive SMI
         *
         * If the maximum is 10 times larger than the minimum,
         * then we got hit by an SMI as well.
         */
-       if (pitcnt < 5000 || tscmax > 10 * tscmin)
+       if (pitcnt < loopmin || tscmax > 10 * tscmin)
                return ULONG_MAX;
 
        /* Calculate the PIT value */
        delta = t2 - t1;
-       do_div(delta, 50);
+       do_div(delta, ms);
        return delta;
 }
 
+/*
+ * This reads the current MSB of the PIT counter, and
+ * checks if we are running on sufficiently fast and
+ * non-virtualized hardware.
+ *
+ * Our expectations are:
+ *
+ *  - the PIT is running at roughly 1.19MHz
+ *
+ *  - each IO is going to take about 1us on real hardware,
+ *    but we allow it to be much faster (by a factor of 10) or
+ *    _slightly_ slower (ie we allow up to a 2us read+counter
+ *    update - anything else implies a unacceptably slow CPU
+ *    or PIT for the fast calibration to work.
+ *
+ *  - with 256 PIT ticks to read the value, we have 214us to
+ *    see the same MSB (and overhead like doing a single TSC
+ *    read per MSB value etc).
+ *
+ *  - We're doing 2 reads per loop (LSB, MSB), and we expect
+ *    them each to take about a microsecond on real hardware.
+ *    So we expect a count value of around 100. But we'll be
+ *    generous, and accept anything over 50.
+ *
+ *  - if the PIT is stuck, and we see *many* more reads, we
+ *    return early (and the next caller of pit_expect_msb()
+ *    then consider it a failure when they don't see the
+ *    next expected value).
+ *
+ * These expectations mean that we know that we have seen the
+ * transition from one expected value to another with a fairly
+ * high accuracy, and we didn't miss any events. We can thus
+ * use the TSC value at the transitions to calculate a pretty
+ * good value for the TSC frequencty.
+ */
+static inline int pit_expect_msb(unsigned char val)
+{
+       int count = 0;
+
+       for (count = 0; count < 50000; count++) {
+               /* Ignore LSB */
+               inb(0x42);
+               if (inb(0x42) != val)
+                       break;
+       }
+       return count > 50;
+}
+
+/*
+ * How many MSB values do we want to see? We aim for a
+ * 15ms calibration, which assuming a 2us counter read
+ * error should give us roughly 150 ppm precision for
+ * the calibration.
+ */
+#define QUICK_PIT_MS 15
+#define QUICK_PIT_ITERATIONS (QUICK_PIT_MS * PIT_TICK_RATE / 1000 / 256)
+
+static unsigned long quick_pit_calibrate(void)
+{
+       /* Set the Gate high, disable speaker */
+       outb((inb(0x61) & ~0x02) | 0x01, 0x61);
+
+       /*
+        * Counter 2, mode 0 (one-shot), binary count
+        *
+        * NOTE! Mode 2 decrements by two (and then the
+        * output is flipped each time, giving the same
+        * final output frequency as a decrement-by-one),
+        * so mode 0 is much better when looking at the
+        * individual counts.
+        */
+       outb(0xb0, 0x43);
+
+       /* Start at 0xffff */
+       outb(0xff, 0x42);
+       outb(0xff, 0x42);
+
+       if (pit_expect_msb(0xff)) {
+               int i;
+               u64 t1, t2, delta;
+               unsigned char expect = 0xfe;
+
+               t1 = get_cycles();
+               for (i = 0; i < QUICK_PIT_ITERATIONS; i++, expect--) {
+                       if (!pit_expect_msb(expect))
+                               goto failed;
+               }
+               t2 = get_cycles();
+
+               /*
+                * Make sure we can rely on the second TSC timestamp:
+                */
+               if (!pit_expect_msb(expect))
+                       goto failed;
+
+               /*
+                * Ok, if we get here, then we've seen the
+                * MSB of the PIT decrement QUICK_PIT_ITERATIONS
+                * times, and each MSB had many hits, so we never
+                * had any sudden jumps.
+                *
+                * As a result, we can depend on there not being
+                * any odd delays anywhere, and the TSC reads are
+                * reliable.
+                *
+                * kHz = ticks / time-in-seconds / 1000;
+                * kHz = (t2 - t1) / (QPI * 256 / PIT_TICK_RATE) / 1000
+                * kHz = ((t2 - t1) * PIT_TICK_RATE) / (QPI * 256 * 1000)
+                */
+               delta = (t2 - t1)*PIT_TICK_RATE;
+               do_div(delta, QUICK_PIT_ITERATIONS*256*1000);
+               printk("Fast TSC calibration using PIT\n");
+               return delta;
+       }
+failed:
+       return 0;
+}
 
 /**
  * native_calibrate_tsc - calibrate the tsc on boot
  */
 unsigned long native_calibrate_tsc(void)
 {
-       u64 tsc1, tsc2, delta, pm1, pm2, hpet1, hpet2;
+       u64 tsc1, tsc2, delta, ref1, ref2;
        unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX;
-       unsigned long flags;
-       int hpet = is_hpet_enabled(), i;
+       unsigned long flags, latch, ms, fast_calibrate;
+       int hpet = is_hpet_enabled(), i, loopmin;
+
+       local_irq_save(flags);
+       fast_calibrate = quick_pit_calibrate();
+       local_irq_restore(flags);
+       if (fast_calibrate)
+               return fast_calibrate;
 
        /*
         * Run 5 calibration loops to get the lowest frequency value
@@ -216,7 +385,13 @@ unsigned long native_calibrate_tsc(void)
         * calibration delay loop as we have to wait for a certain
         * amount of time anyway.
         */
-       for (i = 0; i < 5; i++) {
+
+       /* Preset PIT loop values */
+       latch = CAL_LATCH;
+       ms = CAL_MS;
+       loopmin = CAL_PIT_LOOPS;
+
+       for (i = 0; i < 3; i++) {
                unsigned long tsc_pit_khz;
 
                /*
@@ -226,16 +401,16 @@ unsigned long native_calibrate_tsc(void)
                 * read the end value.
                 */
                local_irq_save(flags);
-               tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL);
-               tsc_pit_khz = pit_calibrate_tsc();
-               tsc2 = tsc_read_refs(&pm2, hpet ? &hpet2 : NULL);
+               tsc1 = tsc_read_refs(&ref1, hpet);
+               tsc_pit_khz = pit_calibrate_tsc(latch, ms, loopmin);
+               tsc2 = tsc_read_refs(&ref2, hpet);
                local_irq_restore(flags);
 
                /* Pick the lowest PIT TSC calibration so far */
                tsc_pit_min = min(tsc_pit_min, tsc_pit_khz);
 
                /* hpet or pmtimer available ? */
-               if (!hpet && !pm1 && !pm2)
+               if (!hpet && !ref1 && !ref2)
                        continue;
 
                /* Check, whether the sampling was disturbed by an SMI */
@@ -243,23 +418,41 @@ unsigned long native_calibrate_tsc(void)
                        continue;
 
                tsc2 = (tsc2 - tsc1) * 1000000LL;
+               if (hpet)
+                       tsc2 = calc_hpet_ref(tsc2, ref1, ref2);
+               else
+                       tsc2 = calc_pmtimer_ref(tsc2, ref1, ref2);
 
-               if (hpet) {
-                       if (hpet2 < hpet1)
-                               hpet2 += 0x100000000ULL;
-                       hpet2 -= hpet1;
-                       tsc1 = ((u64)hpet2 * hpet_readl(HPET_PERIOD));
-                       do_div(tsc1, 1000000);
-               } else {
-                       if (pm2 < pm1)
-                               pm2 += (u64)ACPI_PM_OVRRUN;
-                       pm2 -= pm1;
-                       tsc1 = pm2 * 1000000000LL;
-                       do_div(tsc1, PMTMR_TICKS_PER_SEC);
+               tsc_ref_min = min(tsc_ref_min, (unsigned long) tsc2);
+
+               /* Check the reference deviation */
+               delta = ((u64) tsc_pit_min) * 100;
+               do_div(delta, tsc_ref_min);
+
+               /*
+                * If both calibration results are inside a 10% window
+                * then we can be sure, that the calibration
+                * succeeded. We break out of the loop right away. We
+                * use the reference value, as it is more precise.
+                */
+               if (delta >= 90 && delta <= 110) {
+                       printk(KERN_INFO
+                              "TSC: PIT calibration matches %s. %d loops\n",
+                              hpet ? "HPET" : "PMTIMER", i + 1);
+                       return tsc_ref_min;
                }
 
-               do_div(tsc2, tsc1);
-               tsc_ref_min = min(tsc_ref_min, (unsigned long) tsc2);
+               /*
+                * Check whether PIT failed more than once. This
+                * happens in virtualized environments. We need to
+                * give the virtual PC a slightly longer timeframe for
+                * the HPET/PMTIMER to make the result precise.
+                */
+               if (i == 1 && tsc_pit_min == ULONG_MAX) {
+                       latch = CAL2_LATCH;
+                       ms = CAL2_MS;
+                       loopmin = CAL2_PIT_LOOPS;
+               }
        }
 
        /*
@@ -270,7 +463,7 @@ unsigned long native_calibrate_tsc(void)
                printk(KERN_WARNING "TSC: Unable to calibrate against PIT\n");
 
                /* We don't have an alternative source, disable TSC */
-               if (!hpet && !pm1 && !pm2) {
+               if (!hpet && !ref1 && !ref2) {
                        printk("TSC: No reference (HPET/PMTIMER) available\n");
                        return 0;
                }
@@ -278,7 +471,7 @@ unsigned long native_calibrate_tsc(void)
                /* The alternative source failed as well, disable TSC */
                if (tsc_ref_min == ULONG_MAX) {
                        printk(KERN_WARNING "TSC: HPET/PMTIMER calibration "
-                              "failed due to SMI disturbance.\n");
+                              "failed.\n");
                        return 0;
                }
 
@@ -290,44 +483,25 @@ unsigned long native_calibrate_tsc(void)
        }
 
        /* We don't have an alternative source, use the PIT calibration value */
-       if (!hpet && !pm1 && !pm2) {
+       if (!hpet && !ref1 && !ref2) {
                printk(KERN_INFO "TSC: Using PIT calibration value\n");
                return tsc_pit_min;
        }
 
        /* The alternative source failed, use the PIT calibration value */
        if (tsc_ref_min == ULONG_MAX) {
-               printk(KERN_WARNING "TSC: HPET/PMTIMER calibration failed due "
-                      "to SMI disturbance. Using PIT calibration\n");
+               printk(KERN_WARNING "TSC: HPET/PMTIMER calibration failed. "
+                      "Using PIT calibration\n");
                return tsc_pit_min;
        }
 
-       /* Check the reference deviation */
-       delta = ((u64) tsc_pit_min) * 100;
-       do_div(delta, tsc_ref_min);
-
-       /*
-        * If both calibration results are inside a 5% window, the we
-        * use the lower frequency of those as it is probably the
-        * closest estimate.
-        */
-       if (delta >= 95 && delta <= 105) {
-               printk(KERN_INFO "TSC: PIT calibration confirmed by %s.\n",
-                      hpet ? "HPET" : "PMTIMER");
-               printk(KERN_INFO "TSC: using %s calibration value\n",
-                      tsc_pit_min <= tsc_ref_min ? "PIT" :
-                      hpet ? "HPET" : "PMTIMER");
-               return tsc_pit_min <= tsc_ref_min ? tsc_pit_min : tsc_ref_min;
-       }
-
-       printk(KERN_WARNING "TSC: PIT calibration deviates from %s: %lu %lu.\n",
-              hpet ? "HPET" : "PMTIMER", tsc_pit_min, tsc_ref_min);
-
        /*
         * The calibration values differ too much. In doubt, we use
         * the PIT value as we know that there are PMTIMERs around
-        * running at double speed.
+        * running at double speed. At least we let the user know:
         */
+       printk(KERN_WARNING "TSC: PIT calibration deviates from %s: %lu %lu.\n",
+              hpet ? "HPET" : "PMTIMER", tsc_pit_min, tsc_ref_min);
        printk(KERN_INFO "TSC: Using PIT calibration value\n");
        return tsc_pit_min;
 }
index 594ef47f0a639fc66d8967805acc142fec1a8ca9..61a97e616f7034e252fe1e23e8e1fc847fd476f3 100644 (file)
 #include <asm/visws/cobalt.h>
 #include <asm/visws/piix4.h>
 #include <asm/arch_hooks.h>
+#include <asm/io_apic.h>
 #include <asm/fixmap.h>
 #include <asm/reboot.h>
 #include <asm/setup.h>
 #include <asm/e820.h>
-#include <asm/smp.h>
 #include <asm/io.h>
 
 #include <mach_ipi.h>
 
 #include "mach_apic.h"
 
-#include <linux/init.h>
-#include <linux/smp.h>
-
 #include <linux/kernel_stat.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
 
-#include <asm/io.h>
-#include <asm/apic.h>
 #include <asm/i8259.h>
 #include <asm/irq_vectors.h>
-#include <asm/visws/cobalt.h>
 #include <asm/visws/lithium.h>
-#include <asm/visws/piix4.h>
 
 #include <linux/sched.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/pci_ids.h>
 
 extern int no_broadcast;
 
-#include <asm/io.h>
 #include <asm/apic.h>
-#include <asm/arch_hooks.h>
-#include <asm/visws/cobalt.h>
-#include <asm/visws/lithium.h>
 
 char visws_board_type  = -1;
 char visws_board_rev   = -1;
index 38f566fa27d2b35c0e3b95382a38537745cbe53d..4eeb5cf9720d2e7b7099d145e6c87a0c771fed1a 100644 (file)
@@ -46,6 +46,7 @@
 #include <asm/io.h>
 #include <asm/tlbflush.h>
 #include <asm/irq.h>
+#include <asm/syscalls.h>
 
 /*
  * Known problems:
index 6ca515d6db543b9a7739b9f2f9ab39d181ed3f9b..8c9ad02af5a2f5e8da96613d7035b7ce07d83da8 100644 (file)
@@ -235,7 +235,7 @@ static void vmi_write_ldt_entry(struct desc_struct *dt, int entry,
                                const void *desc)
 {
        u32 *ldt_entry = (u32 *)desc;
-       vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
+       vmi_ops.write_ldt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
 }
 
 static 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)
 }
 #endif
 
-static void vmi_allocate_pte(struct mm_struct *mm, u32 pfn)
+static void vmi_allocate_pte(struct mm_struct *mm, unsigned long pfn)
 {
        vmi_set_page_type(pfn, VMI_PAGE_L1);
        vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0);
 }
 
-static void vmi_allocate_pmd(struct mm_struct *mm, u32 pfn)
+static void vmi_allocate_pmd(struct mm_struct *mm, unsigned long pfn)
 {
        /*
         * 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)
        vmi_ops.allocate_page(pfn, VMI_PAGE_L2, 0, 0, 0);
 }
 
-static void vmi_allocate_pmd_clone(u32 pfn, u32 clonepfn, u32 start, u32 count)
+static void vmi_allocate_pmd_clone(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count)
 {
        vmi_set_page_type(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE);
        vmi_check_page_type(clonepfn, VMI_PAGE_L2);
        vmi_ops.allocate_page(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE, clonepfn, start, count);
 }
 
-static void vmi_release_pte(u32 pfn)
+static void vmi_release_pte(unsigned long pfn)
 {
        vmi_ops.release_page(pfn, VMI_PAGE_L1);
        vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
 }
 
-static void vmi_release_pmd(u32 pfn)
+static void vmi_release_pmd(unsigned long pfn)
 {
        vmi_ops.release_page(pfn, VMI_PAGE_L2);
        vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
index 0c029e8959c7f7221d4687b8465812393e1faff0..7766d36983fcd7440f82435bcfbbcd37c1d80a6b 100644 (file)
@@ -61,7 +61,7 @@ static void vsmp_irq_enable(void)
        native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
 }
 
-static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,
+static unsigned __init_or_module vsmp_patch(u8 type, u16 clobbers, void *ibuf,
                                  unsigned long addr, unsigned len)
 {
        switch (type) {
index 01b868ba82f8c21fd8384a426236e3a315f82dea..321cf720dbb637895074315967a9c49d982b14b2 100644 (file)
@@ -16,37 +16,46 @@ static void __rdmsr_on_cpu(void *info)
        rdmsr(rv->msr_no, rv->l, rv->h);
 }
 
-static void __rdmsr_safe_on_cpu(void *info)
+static void __wrmsr_on_cpu(void *info)
 {
        struct msr_info *rv = info;
 
-       rv->err = rdmsr_safe(rv->msr_no, &rv->l, &rv->h);
+       wrmsr(rv->msr_no, rv->l, rv->h);
 }
 
-static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe)
+int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
 {
-       int err = 0;
+       int err;
        struct msr_info rv;
 
        rv.msr_no = msr_no;
-       if (safe) {
-               err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu,
-                                              &rv, 1);
-               err = err ? err : rv.err;
-       } else {
-               err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
-       }
+       err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
        *l = rv.l;
        *h = rv.h;
 
        return err;
 }
 
-static void __wrmsr_on_cpu(void *info)
+int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
+{
+       int err;
+       struct msr_info rv;
+
+       rv.msr_no = msr_no;
+       rv.l = l;
+       rv.h = h;
+       err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
+
+       return err;
+}
+
+/* These "safe" variants are slower and should be used when the target MSR
+   may not actually exist. */
+static void __rdmsr_safe_on_cpu(void *info)
 {
        struct msr_info *rv = info;
 
-       wrmsr(rv->msr_no, rv->l, rv->h);
+       rv->err = rdmsr_safe(rv->msr_no, &rv->l, &rv->h);
 }
 
 static void __wrmsr_safe_on_cpu(void *info)
@@ -56,45 +65,30 @@ static void __wrmsr_safe_on_cpu(void *info)
        rv->err = wrmsr_safe(rv->msr_no, rv->l, rv->h);
 }
 
-static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe)
+int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
 {
-       int err = 0;
+       int err;
        struct msr_info rv;
 
        rv.msr_no = msr_no;
-       rv.l = l;
-       rv.h = h;
-       if (safe) {
-               err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu,
-                                              &rv, 1);
-               err = err ? err : rv.err;
-       } else {
-               err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
-       }
-
-       return err;
-}
+       err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
+       *l = rv.l;
+       *h = rv.h;
 
-int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
-{
-       return _wrmsr_on_cpu(cpu, msr_no, l, h, 0);
+       return err ? err : rv.err;
 }
 
-int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
-{
-       return _rdmsr_on_cpu(cpu, msr_no, l, h, 0);
-}
-
-/* These "safe" variants are slower and should be used when the target MSR
-   may not actually exist. */
 int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
 {
-       return _wrmsr_on_cpu(cpu, msr_no, l, h, 1);
-}
+       int err;
+       struct msr_info rv;
 
-int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
-{
-       return _rdmsr_on_cpu(cpu, msr_no, l, h, 1);
+       rv.msr_no = msr_no;
+       rv.l = l;
+       rv.h = h;
+       err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
+
+       return err ? err : rv.err;
 }
 
 EXPORT_SYMBOL(rdmsr_on_cpu);
index 94972e7c094df3fbbb2030c21a5490f15f5a40ca..82004d2bf05e160bfa6faf15745f38eb4ad89f46 100644 (file)
@@ -22,7 +22,7 @@ char *strcpy(char *dest, const char *src)
                "testb %%al,%%al\n\t"
                "jne 1b"
                : "=&S" (d0), "=&D" (d1), "=&a" (d2)
-               :"0" (src), "1" (dest) : "memory");
+               : "0" (src), "1" (dest) : "memory");
        return dest;
 }
 EXPORT_SYMBOL(strcpy);
@@ -42,7 +42,7 @@ char *strncpy(char *dest, const char *src, size_t count)
                "stosb\n"
                "2:"
                : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3)
-               :"0" (src), "1" (dest), "2" (count) : "memory");
+               : "0" (src), "1" (dest), "2" (count) : "memory");
        return dest;
 }
 EXPORT_SYMBOL(strncpy);
@@ -60,7 +60,7 @@ char *strcat(char *dest, const char *src)
                "testb %%al,%%al\n\t"
                "jne 1b"
                : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
-               : "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu): "memory");
+               : "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu) : "memory");
        return dest;
 }
 EXPORT_SYMBOL(strcat);
@@ -105,9 +105,9 @@ int strcmp(const char *cs, const char *ct)
                "2:\tsbbl %%eax,%%eax\n\t"
                "orb $1,%%al\n"
                "3:"
-               :"=a" (res), "=&S" (d0), "=&D" (d1)
-               :"1" (cs), "2" (ct)
-               :"memory");
+               : "=a" (res), "=&S" (d0), "=&D" (d1)
+               : "1" (cs), "2" (ct)
+               : "memory");
        return res;
 }
 EXPORT_SYMBOL(strcmp);
@@ -130,9 +130,9 @@ int strncmp(const char *cs, const char *ct, size_t count)
                "3:\tsbbl %%eax,%%eax\n\t"
                "orb $1,%%al\n"
                "4:"
-               :"=a" (res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
-               :"1" (cs), "2" (ct), "3" (count)
-               :"memory");
+               : "=a" (res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
+               : "1" (cs), "2" (ct), "3" (count)
+               : "memory");
        return res;
 }
 EXPORT_SYMBOL(strncmp);
@@ -152,9 +152,9 @@ char *strchr(const char *s, int c)
                "movl $1,%1\n"
                "2:\tmovl %1,%0\n\t"
                "decl %0"
-               :"=a" (res), "=&S" (d0)
-               :"1" (s), "0" (c)
-               :"memory");
+               : "=a" (res), "=&S" (d0)
+               : "1" (s), "0" (c)
+               : "memory");
        return res;
 }
 EXPORT_SYMBOL(strchr);
@@ -169,9 +169,9 @@ size_t strlen(const char *s)
                "scasb\n\t"
                "notl %0\n\t"
                "decl %0"
-               :"=c" (res), "=&D" (d0)
-               :"1" (s), "a" (0), "0" (0xffffffffu)
-               :"memory");
+               : "=c" (res), "=&D" (d0)
+               : "1" (s), "a" (0), "0" (0xffffffffu)
+               : "memory");
        return res;
 }
 EXPORT_SYMBOL(strlen);
@@ -189,9 +189,9 @@ void *memchr(const void *cs, int c, size_t count)
                "je 1f\n\t"
                "movl $1,%0\n"
                "1:\tdecl %0"
-               :"=D" (res), "=&c" (d0)
-               :"a" (c), "0" (cs), "1" (count)
-               :"memory");
+               : "=D" (res), "=&c" (d0)
+               : "a" (c), "0" (cs), "1" (count)
+               : "memory");
        return res;
 }
 EXPORT_SYMBOL(memchr);
@@ -228,9 +228,9 @@ size_t strnlen(const char *s, size_t count)
                "cmpl $-1,%1\n\t"
                "jne 1b\n"
                "3:\tsubl %2,%0"
-               :"=a" (res), "=&d" (d0)
-               :"c" (s), "1" (count)
-               :"memory");
+               : "=a" (res), "=&d" (d0)
+               : "c" (s), "1" (count)
+               : "memory");
        return res;
 }
 EXPORT_SYMBOL(strnlen);
index 42e8a50303f32d6000416dfd08c2caec942c20f4..8e2d55f754bff8f7f221cdb96b0c01c2352f32fa 100644 (file)
@@ -23,9 +23,9 @@ __asm__ __volatile__(
        "jne 1b\n\t"
        "xorl %%eax,%%eax\n\t"
        "2:"
-       :"=a" (__res), "=&c" (d0), "=&S" (d1)
-       :"0" (0), "1" (0xffffffff), "2" (cs), "g" (ct)
-       :"dx", "di");
+       : "=a" (__res), "=&c" (d0), "=&S" (d1)
+       : "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct)
+       : "dx", "di");
 return __res;
 }
 
index 3d317836be9ed9e1739e92461d0912dc37c65ffb..3f2cf11f201aaf78ca5999e20d230e36d762ffdd 100644 (file)
 #include <asm/e820.h>
 #include <asm/setup.h>
 
+#include <mach_ipi.h>
+
 #ifdef CONFIG_HOTPLUG_CPU
 #define DEFAULT_SEND_IPI       (1)
 #else
 #define DEFAULT_SEND_IPI       (0)
 #endif
 
-int no_broadcast=DEFAULT_SEND_IPI;
+int no_broadcast = DEFAULT_SEND_IPI;
 
 /**
  * pre_intr_init_hook - initialisation prior to setting up interrupt vectors
index 62fa440678d88268ba9456150eb023c3b7f735d7..847c164725f4661c74ff52d526b46367f2ffb17e 100644 (file)
@@ -328,7 +328,7 @@ void __init initmem_init(unsigned long start_pfn,
 
        get_memcfg_numa();
 
-       kva_pages = round_up(calculate_numa_remap_pages(), PTRS_PER_PTE);
+       kva_pages = roundup(calculate_numa_remap_pages(), PTRS_PER_PTE);
 
        kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE);
        do {
index a20d1fa64b4ea28f22d6c202905a71e78ce744b0..e7277cbcfb40ee1ea455fb63c4c6665656724013 100644 (file)
@@ -148,8 +148,8 @@ static void note_page(struct seq_file *m, struct pg_state *st,
         * we have now. "break" is either changing perms, levels or
         * address space marker.
         */
-       prot = pgprot_val(new_prot) & ~(PTE_PFN_MASK);
-       cur = pgprot_val(st->current_prot) & ~(PTE_PFN_MASK);
+       prot = pgprot_val(new_prot) & PTE_FLAGS_MASK;
+       cur = pgprot_val(st->current_prot) & PTE_FLAGS_MASK;
 
        if (!st->level) {
                /* First entry */
index 455f3fe67b42412c8acda3eb63e33678ebec1845..8f92cac4e6dbe226b85535b46db44259c066b3ad 100644 (file)
@@ -35,6 +35,7 @@
 #include <asm/tlbflush.h>
 #include <asm/proto.h>
 #include <asm-generic/sections.h>
+#include <asm/traps.h>
 
 /*
  * Page fault error code bits
@@ -357,8 +358,6 @@ static int is_errata100(struct pt_regs *regs, unsigned long address)
        return 0;
 }
 
-void do_invalid_op(struct pt_regs *, unsigned long);
-
 static int is_f00f_bug(struct pt_regs *regs, unsigned long address)
 {
 #ifdef CONFIG_X86_F00F_BUG
index d37f29376b0ce455ae3907051a58779f4b995a25..c3789bb193087d99c2946700d14c2474845528c4 100644 (file)
@@ -47,6 +47,7 @@
 #include <asm/paravirt.h>
 #include <asm/setup.h>
 #include <asm/cacheflush.h>
+#include <asm/smp.h>
 
 unsigned int __VMALLOC_RESERVE = 128 << 20;
 
@@ -194,11 +195,30 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
        pgd_t *pgd;
        pmd_t *pmd;
        pte_t *pte;
-       unsigned pages_2m = 0, pages_4k = 0;
+       unsigned pages_2m, pages_4k;
+       int mapping_iter;
+
+       /*
+        * First iteration will setup identity mapping using large/small pages
+        * based on use_pse, with other attributes same as set by
+        * the early code in head_32.S
+        *
+        * Second iteration will setup the appropriate attributes (NX, GLOBAL..)
+        * as desired for the kernel identity mapping.
+        *
+        * This two pass mechanism conforms to the TLB app note which says:
+        *
+        *     "Software should not write to a paging-structure entry in a way
+        *      that would change, for any linear address, both the page size
+        *      and either the page frame or attributes."
+        */
+       mapping_iter = 1;
 
        if (!cpu_has_pse)
                use_pse = 0;
 
+repeat:
+       pages_2m = pages_4k = 0;
        pfn = start_pfn;
        pgd_idx = pgd_index((pfn<<PAGE_SHIFT) + PAGE_OFFSET);
        pgd = pgd_base + pgd_idx;
@@ -224,6 +244,13 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
                        if (use_pse) {
                                unsigned int addr2;
                                pgprot_t prot = PAGE_KERNEL_LARGE;
+                               /*
+                                * first pass will use the same initial
+                                * identity mapping attribute + _PAGE_PSE.
+                                */
+                               pgprot_t init_prot =
+                                       __pgprot(PTE_IDENT_ATTR |
+                                                _PAGE_PSE);
 
                                addr2 = (pfn + PTRS_PER_PTE-1) * PAGE_SIZE +
                                        PAGE_OFFSET + PAGE_SIZE-1;
@@ -233,7 +260,10 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
                                        prot = PAGE_KERNEL_LARGE_EXEC;
 
                                pages_2m++;
-                               set_pmd(pmd, pfn_pmd(pfn, prot));
+                               if (mapping_iter == 1)
+                                       set_pmd(pmd, pfn_pmd(pfn, init_prot));
+                               else
+                                       set_pmd(pmd, pfn_pmd(pfn, prot));
 
                                pfn += PTRS_PER_PTE;
                                continue;
@@ -245,17 +275,43 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
                        for (; pte_ofs < PTRS_PER_PTE && pfn < end_pfn;
                             pte++, pfn++, pte_ofs++, addr += PAGE_SIZE) {
                                pgprot_t prot = PAGE_KERNEL;
+                               /*
+                                * first pass will use the same initial
+                                * identity mapping attribute.
+                                */
+                               pgprot_t init_prot = __pgprot(PTE_IDENT_ATTR);
 
                                if (is_kernel_text(addr))
                                        prot = PAGE_KERNEL_EXEC;
 
                                pages_4k++;
-                               set_pte(pte, pfn_pte(pfn, prot));
+                               if (mapping_iter == 1)
+                                       set_pte(pte, pfn_pte(pfn, init_prot));
+                               else
+                                       set_pte(pte, pfn_pte(pfn, prot));
                        }
                }
        }
-       update_page_count(PG_LEVEL_2M, pages_2m);
-       update_page_count(PG_LEVEL_4K, pages_4k);
+       if (mapping_iter == 1) {
+               /*
+                * update direct mapping page count only in the first
+                * iteration.
+                */
+               update_page_count(PG_LEVEL_2M, pages_2m);
+               update_page_count(PG_LEVEL_4K, pages_4k);
+
+               /*
+                * local global flush tlb, which will flush the previous
+                * mappings present in both small and large page TLB's.
+                */
+               __flush_tlb_all();
+
+               /*
+                * Second iteration will set the actual desired PTE attributes.
+                */
+               mapping_iter = 2;
+               goto repeat;
+       }
 }
 
 /*
@@ -458,11 +514,7 @@ static void __init pagetable_init(void)
 {
        pgd_t *pgd_base = swapper_pg_dir;
 
-       paravirt_pagetable_setup_start(pgd_base);
-
        permanent_kmaps_init(pgd_base);
-
-       paravirt_pagetable_setup_done(pgd_base);
 }
 
 #ifdef CONFIG_ACPI_SLEEP
@@ -722,7 +774,7 @@ void __init setup_bootmem_allocator(void)
        after_init_bootmem = 1;
 }
 
-static void __init find_early_table_space(unsigned long end)
+static void __init find_early_table_space(unsigned long end, int use_pse)
 {
        unsigned long puds, pmds, ptes, tables, start;
 
@@ -732,7 +784,7 @@ static void __init find_early_table_space(unsigned long end)
        pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
        tables += PAGE_ALIGN(pmds * sizeof(pmd_t));
 
-       if (cpu_has_pse) {
+       if (use_pse) {
                unsigned long extra;
 
                extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
@@ -772,12 +824,22 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
        pgd_t *pgd_base = swapper_pg_dir;
        unsigned long start_pfn, end_pfn;
        unsigned long big_page_start;
+#ifdef CONFIG_DEBUG_PAGEALLOC
+       /*
+        * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
+        * This will simplify cpa(), which otherwise needs to support splitting
+        * large pages into small in interrupt context, etc.
+        */
+       int use_pse = 0;
+#else
+       int use_pse = cpu_has_pse;
+#endif
 
        /*
         * Find space for the kernel direct mapping tables.
         */
        if (!after_init_bootmem)
-               find_early_table_space(end);
+               find_early_table_space(end, use_pse);
 
 #ifdef CONFIG_X86_PAE
        set_nx();
@@ -823,7 +885,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
        end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT);
        if (start_pfn < end_pfn)
                kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn,
-                                               cpu_has_pse);
+                                            use_pse);
 
        /* tail is not big page alignment ? */
        start_pfn = end_pfn;
@@ -986,7 +1048,6 @@ void __init mem_init(void)
        if (boot_cpu_data.wp_works_ok < 0)
                test_wp_bit();
 
-       cpa_init();
        save_pg_dir();
        zap_low_mappings();
 }
index d3746efb060d1602a9de63d3be955522f0cd2a5d..fb30486c82f7f7c21e036feebb9cb58f957d8a36 100644 (file)
@@ -225,7 +225,7 @@ void __init init_extra_mapping_uc(unsigned long phys, unsigned long size)
 void __init cleanup_highmap(void)
 {
        unsigned long vaddr = __START_KERNEL_map;
-       unsigned long end = round_up((unsigned long)_end, PMD_SIZE) - 1;
+       unsigned long end = roundup((unsigned long)_end, PMD_SIZE) - 1;
        pmd_t *pmd = level2_kernel_pgt;
        pmd_t *last_pmd = pmd + PTRS_PER_PMD;
 
@@ -271,7 +271,8 @@ static __ref void unmap_low_page(void *adr)
 }
 
 static unsigned long __meminit
-phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end)
+phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end,
+             pgprot_t prot)
 {
        unsigned pages = 0;
        unsigned long last_map_addr = end;
@@ -289,36 +290,43 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end)
                        break;
                }
 
+               /*
+                * We will re-use the existing mapping.
+                * Xen for example has some special requirements, like mapping
+                * pagetable pages as RO. So assume someone who pre-setup
+                * these mappings are more intelligent.
+                */
                if (pte_val(*pte))
                        continue;
 
                if (0)
                        printk("   pte=%p addr=%lx pte=%016lx\n",
                               pte, addr, pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL).pte);
-               set_pte(pte, pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL));
-               last_map_addr = (addr & PAGE_MASK) + PAGE_SIZE;
                pages++;
+               set_pte(pte, pfn_pte(addr >> PAGE_SHIFT, prot));
+               last_map_addr = (addr & PAGE_MASK) + PAGE_SIZE;
        }
+
        update_page_count(PG_LEVEL_4K, pages);
 
        return last_map_addr;
 }
 
 static unsigned long __meminit
-phys_pte_update(pmd_t *pmd, unsigned long address, unsigned long end)
+phys_pte_update(pmd_t *pmd, unsigned long address, unsigned long end,
+               pgprot_t prot)
 {
        pte_t *pte = (pte_t *)pmd_page_vaddr(*pmd);
 
-       return phys_pte_init(pte, address, end);
+       return phys_pte_init(pte, address, end, prot);
 }
 
 static unsigned long __meminit
 phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
-                        unsigned long page_size_mask)
+             unsigned long page_size_mask, pgprot_t prot)
 {
        unsigned long pages = 0;
        unsigned long last_map_addr = end;
-       unsigned long start = address;
 
        int i = pmd_index(address);
 
@@ -326,6 +334,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
                unsigned long pte_phys;
                pmd_t *pmd = pmd_page + pmd_index(address);
                pte_t *pte;
+               pgprot_t new_prot = prot;
 
                if (address >= end) {
                        if (!after_bootmem) {
@@ -339,27 +348,40 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
                        if (!pmd_large(*pmd)) {
                                spin_lock(&init_mm.page_table_lock);
                                last_map_addr = phys_pte_update(pmd, address,
-                                                               end);
+                                                               end, prot);
                                spin_unlock(&init_mm.page_table_lock);
+                               continue;
                        }
-                       /* Count entries we're using from level2_ident_pgt */
-                       if (start == 0)
-                               pages++;
-                       continue;
+                       /*
+                        * If we are ok with PG_LEVEL_2M mapping, then we will
+                        * use the existing mapping,
+                        *
+                        * Otherwise, we will split the large page mapping but
+                        * use the same existing protection bits except for
+                        * large page, so that we don't violate Intel's TLB
+                        * Application note (317080) which says, while changing
+                        * the page sizes, new and old translations should
+                        * not differ with respect to page frame and
+                        * attributes.
+                        */
+                       if (page_size_mask & (1 << PG_LEVEL_2M))
+                               continue;
+                       new_prot = pte_pgprot(pte_clrhuge(*(pte_t *)pmd));
                }
 
                if (page_size_mask & (1<<PG_LEVEL_2M)) {
                        pages++;
                        spin_lock(&init_mm.page_table_lock);
                        set_pte((pte_t *)pmd,
-                               pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
+                               pfn_pte(address >> PAGE_SHIFT,
+                                       __pgprot(pgprot_val(prot) | _PAGE_PSE)));
                        spin_unlock(&init_mm.page_table_lock);
                        last_map_addr = (address & PMD_MASK) + PMD_SIZE;
                        continue;
                }
 
                pte = alloc_low_page(&pte_phys);
-               last_map_addr = phys_pte_init(pte, address, end);
+               last_map_addr = phys_pte_init(pte, address, end, new_prot);
                unmap_low_page(pte);
 
                spin_lock(&init_mm.page_table_lock);
@@ -372,12 +394,12 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
 
 static unsigned long __meminit
 phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end,
-                        unsigned long page_size_mask)
+               unsigned long page_size_mask, pgprot_t prot)
 {
        pmd_t *pmd = pmd_offset(pud, 0);
        unsigned long last_map_addr;
 
-       last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask);
+       last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask, prot);
        __flush_tlb_all();
        return last_map_addr;
 }
@@ -394,6 +416,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
                unsigned long pmd_phys;
                pud_t *pud = pud_page + pud_index(addr);
                pmd_t *pmd;
+               pgprot_t prot = PAGE_KERNEL;
 
                if (addr >= end)
                        break;
@@ -405,10 +428,26 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
                }
 
                if (pud_val(*pud)) {
-                       if (!pud_large(*pud))
+                       if (!pud_large(*pud)) {
                                last_map_addr = phys_pmd_update(pud, addr, end,
-                                                        page_size_mask);
-                       continue;
+                                                        page_size_mask, prot);
+                               continue;
+                       }
+                       /*
+                        * If we are ok with PG_LEVEL_1G mapping, then we will
+                        * use the existing mapping.
+                        *
+                        * Otherwise, we will split the gbpage mapping but use
+                        * the same existing protection  bits except for large
+                        * page, so that we don't violate Intel's TLB
+                        * Application note (317080) which says, while changing
+                        * the page sizes, new and old translations should
+                        * not differ with respect to page frame and
+                        * attributes.
+                        */
+                       if (page_size_mask & (1 << PG_LEVEL_1G))
+                               continue;
+                       prot = pte_pgprot(pte_clrhuge(*(pte_t *)pud));
                }
 
                if (page_size_mask & (1<<PG_LEVEL_1G)) {
@@ -422,7 +461,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
                }
 
                pmd = alloc_low_page(&pmd_phys);
-               last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask);
+               last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask,
+                                             prot);
                unmap_low_page(pmd);
 
                spin_lock(&init_mm.page_table_lock);
@@ -430,6 +470,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
                spin_unlock(&init_mm.page_table_lock);
        }
        __flush_tlb_all();
+
        update_page_count(PG_LEVEL_1G, pages);
 
        return last_map_addr;
@@ -446,27 +487,28 @@ phys_pud_update(pgd_t *pgd, unsigned long addr, unsigned long end,
        return phys_pud_init(pud, addr, end, page_size_mask);
 }
 
-static void __init find_early_table_space(unsigned long end)
+static void __init find_early_table_space(unsigned long end, int use_pse,
+                                         int use_gbpages)
 {
        unsigned long puds, pmds, ptes, tables, start;
 
        puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
-       tables = round_up(puds * sizeof(pud_t), PAGE_SIZE);
-       if (direct_gbpages) {
+       tables = roundup(puds * sizeof(pud_t), PAGE_SIZE);
+       if (use_gbpages) {
                unsigned long extra;
                extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT);
                pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT;
        } else
                pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
-       tables += round_up(pmds * sizeof(pmd_t), PAGE_SIZE);
+       tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE);
 
-       if (cpu_has_pse) {
+       if (use_pse) {
                unsigned long extra;
                extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
                ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
        } else
                ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
-       tables += round_up(ptes * sizeof(pte_t), PAGE_SIZE);
+       tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE);
 
        /*
         * RED-PEN putting page tables only on node 0 could
@@ -528,6 +570,7 @@ static unsigned long __init kernel_physical_mapping_init(unsigned long start,
                pgd_populate(&init_mm, pgd, __va(pud_phys));
                spin_unlock(&init_mm.page_table_lock);
        }
+       __flush_tlb_all();
 
        return last_map_addr;
 }
@@ -571,6 +614,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
 
        struct map_range mr[NR_RANGE_MR];
        int nr_range, i;
+       int use_pse, use_gbpages;
 
        printk(KERN_INFO "init_memory_mapping\n");
 
@@ -584,9 +628,21 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
        if (!after_bootmem)
                init_gbpages();
 
-       if (direct_gbpages)
+#ifdef CONFIG_DEBUG_PAGEALLOC
+       /*
+        * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
+        * This will simplify cpa(), which otherwise needs to support splitting
+        * large pages into small in interrupt context, etc.
+        */
+       use_pse = use_gbpages = 0;
+#else
+       use_pse = cpu_has_pse;
+       use_gbpages = direct_gbpages;
+#endif
+
+       if (use_gbpages)
                page_size_mask |= 1 << PG_LEVEL_1G;
-       if (cpu_has_pse)
+       if (use_pse)
                page_size_mask |= 1 << PG_LEVEL_2M;
 
        memset(mr, 0, sizeof(mr));
@@ -647,7 +703,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
                         (mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k"));
 
        if (!after_bootmem)
-               find_early_table_space(end);
+               find_early_table_space(end, use_pse, use_gbpages);
 
        for (i = 0; i < nr_range; i++)
                last_map_addr = kernel_physical_mapping_init(
@@ -806,8 +862,6 @@ void __init mem_init(void)
                reservedpages << (PAGE_SHIFT-10),
                datasize >> 10,
                initsize >> 10);
-
-       cpa_init();
 }
 
 void free_init_pages(char *what, unsigned long begin, unsigned long end)
index d4b6e6a29ae3597c45071805f734a502a12d6ab2..6ab3196d12b412979cbfba55467968b513670a49 100644 (file)
@@ -83,6 +83,25 @@ int page_is_ram(unsigned long pagenr)
        return 0;
 }
 
+int pagerange_is_ram(unsigned long start, unsigned long end)
+{
+       int ram_page = 0, not_rampage = 0;
+       unsigned long page_nr;
+
+       for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT);
+            ++page_nr) {
+               if (page_is_ram(page_nr))
+                       ram_page = 1;
+               else
+                       not_rampage = 1;
+
+               if (ram_page == not_rampage)
+                       return -1;
+       }
+
+       return ram_page;
+}
+
 /*
  * Fix up the linear direct mapping of the kernel to avoid cache attribute
  * conflicts.
@@ -421,7 +440,7 @@ void unxlate_dev_mem_ptr(unsigned long phys, void *addr)
        return;
 }
 
-int __initdata early_ioremap_debug;
+static int __initdata early_ioremap_debug;
 
 static int __init early_ioremap_debug_setup(char *str)
 {
@@ -547,7 +566,7 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx)
 }
 
 
-int __initdata early_ioremap_nested;
+static int __initdata early_ioremap_nested;
 
 static int __init check_early_ioremap_leak(void)
 {
index a4dd793d6003e6074e12d40441bd2dcb524297ee..cebcbf152d46b06b725b525debc573f3d91da71e 100644 (file)
@@ -79,7 +79,7 @@ static int __init allocate_cachealigned_memnodemap(void)
                return 0;
 
        addr = 0x8000;
-       nodemap_size = round_up(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES);
+       nodemap_size = roundup(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES);
        nodemap_addr = find_e820_area(addr, max_pfn<<PAGE_SHIFT,
                                      nodemap_size, L1_CACHE_BYTES);
        if (nodemap_addr == -1UL) {
@@ -176,10 +176,10 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
        unsigned long start_pfn, last_pfn, bootmap_pages, bootmap_size;
        unsigned long bootmap_start, nodedata_phys;
        void *bootmap;
-       const int pgdat_size = round_up(sizeof(pg_data_t), PAGE_SIZE);
+       const int pgdat_size = roundup(sizeof(pg_data_t), PAGE_SIZE);
        int nid;
 
-       start = round_up(start, ZONE_ALIGN);
+       start = roundup(start, ZONE_ALIGN);
 
        printk(KERN_INFO "Bootmem setup node %d %016lx-%016lx\n", nodeid,
               start, end);
@@ -210,9 +210,9 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
        bootmap_pages = bootmem_bootmap_pages(last_pfn - start_pfn);
        nid = phys_to_nid(nodedata_phys);
        if (nid == nodeid)
-               bootmap_start = round_up(nodedata_phys + pgdat_size, PAGE_SIZE);
+               bootmap_start = roundup(nodedata_phys + pgdat_size, PAGE_SIZE);
        else
-               bootmap_start = round_up(start, PAGE_SIZE);
+               bootmap_start = roundup(start, PAGE_SIZE);
        /*
         * SMP_CACHE_BYTES could be enough, but init_bootmem_node like
         * to use that to align to PAGE_SIZE
index d4aa503caaa29696c055218bdfbd9cd7faf903fb..e1d106909218681f35cd4e736987ce017a7de798 100644 (file)
@@ -32,7 +32,7 @@ enum {
        GPS                     = (1<<30)
 };
 
-#define PAGE_TESTBIT   __pgprot(_PAGE_UNUSED1)
+#define PAGE_CPA_TEST  __pgprot(_PAGE_CPA_TEST)
 
 static int pte_testbit(pte_t pte)
 {
@@ -118,6 +118,7 @@ static int pageattr_test(void)
        unsigned int level;
        int i, k;
        int err;
+       unsigned long test_addr;
 
        if (print)
                printk(KERN_INFO "CPA self-test:\n");
@@ -172,7 +173,8 @@ static int pageattr_test(void)
                        continue;
                }
 
-               err = change_page_attr_set(addr[i], len[i], PAGE_TESTBIT);
+               test_addr = addr[i];
+               err = change_page_attr_set(&test_addr, len[i], PAGE_CPA_TEST, 0);
                if (err < 0) {
                        printk(KERN_ERR "CPA %d failed %d\n", i, err);
                        failed++;
@@ -204,7 +206,8 @@ static int pageattr_test(void)
                        failed++;
                        continue;
                }
-               err = change_page_attr_clear(addr[i], len[i], PAGE_TESTBIT);
+               test_addr = addr[i];
+               err = change_page_attr_clear(&test_addr, len[i], PAGE_CPA_TEST, 0);
                if (err < 0) {
                        printk(KERN_ERR "CPA reverting failed: %d\n", err);
                        failed++;
index 43e2f8483e4f59c33559263c0011e1e5bf041f9d..a9ec89c3fbca32c3fda0e65d8da8846c8f96ed2a 100644 (file)
  * The current flushing context - we pass it instead of 5 arguments:
  */
 struct cpa_data {
-       unsigned long   vaddr;
+       unsigned long   *vaddr;
        pgprot_t        mask_set;
        pgprot_t        mask_clr;
        int             numpages;
-       int             flushtlb;
+       int             flags;
        unsigned long   pfn;
        unsigned        force_split : 1;
+       int             curpage;
 };
 
+/*
+ * Serialize cpa() (for !DEBUG_PAGEALLOC which uses large identity mappings)
+ * using cpa_lock. So that we don't allow any other cpu, with stale large tlb
+ * entries change the page attribute in parallel to some other cpu
+ * splitting a large page entry along with changing the attribute.
+ */
+static DEFINE_SPINLOCK(cpa_lock);
+
+#define CPA_FLUSHTLB 1
+#define CPA_ARRAY 2
+
 #ifdef CONFIG_PROC_FS
 static unsigned long direct_pages_count[PG_LEVEL_NUM];
 
@@ -84,7 +96,7 @@ static inline unsigned long highmap_start_pfn(void)
 
 static inline unsigned long highmap_end_pfn(void)
 {
-       return __pa(round_up((unsigned long)_end, PMD_SIZE)) >> PAGE_SHIFT;
+       return __pa(roundup((unsigned long)_end, PMD_SIZE)) >> PAGE_SHIFT;
 }
 
 #endif
@@ -190,6 +202,41 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
        }
 }
 
+static void cpa_flush_array(unsigned long *start, int numpages, int cache)
+{
+       unsigned int i, level;
+       unsigned long *addr;
+
+       BUG_ON(irqs_disabled());
+
+       on_each_cpu(__cpa_flush_range, NULL, 1);
+
+       if (!cache)
+               return;
+
+       /* 4M threshold */
+       if (numpages >= 1024) {
+               if (boot_cpu_data.x86_model >= 4)
+                       wbinvd();
+               return;
+       }
+       /*
+        * We only need to flush on one CPU,
+        * clflush is a MESI-coherent instruction that
+        * will cause all other CPUs to flush the same
+        * cachelines:
+        */
+       for (i = 0, addr = start; i < numpages; i++, addr++) {
+               pte_t *pte = lookup_address(*addr, &level);
+
+               /*
+                * Only flush present addresses:
+                */
+               if (pte && (pte_val(*pte) & _PAGE_PRESENT))
+                       clflush_cache_range((void *) *addr, PAGE_SIZE);
+       }
+}
+
 /*
  * Certain areas of memory on x86 require very specific protection flags,
  * 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,
                 */
                new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot));
                __set_pmd_pte(kpte, address, new_pte);
-               cpa->flushtlb = 1;
+               cpa->flags |= CPA_FLUSHTLB;
                do_split = 0;
        }
 
@@ -408,84 +455,6 @@ out_unlock:
        return do_split;
 }
 
-static LIST_HEAD(page_pool);
-static unsigned long pool_size, pool_pages, pool_low;
-static unsigned long pool_used, pool_failed;
-
-static void cpa_fill_pool(struct page **ret)
-{
-       gfp_t gfp = GFP_KERNEL;
-       unsigned long flags;
-       struct page *p;
-
-       /*
-        * Avoid recursion (on debug-pagealloc) and also signal
-        * our priority to get to these pagetables:
-        */
-       if (current->flags & PF_MEMALLOC)
-               return;
-       current->flags |= PF_MEMALLOC;
-
-       /*
-        * Allocate atomically from atomic contexts:
-        */
-       if (in_atomic() || irqs_disabled() || debug_pagealloc)
-               gfp =  GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN;
-
-       while (pool_pages < pool_size || (ret && !*ret)) {
-               p = alloc_pages(gfp, 0);
-               if (!p) {
-                       pool_failed++;
-                       break;
-               }
-               /*
-                * If the call site needs a page right now, provide it:
-                */
-               if (ret && !*ret) {
-                       *ret = p;
-                       continue;
-               }
-               spin_lock_irqsave(&pgd_lock, flags);
-               list_add(&p->lru, &page_pool);
-               pool_pages++;
-               spin_unlock_irqrestore(&pgd_lock, flags);
-       }
-
-       current->flags &= ~PF_MEMALLOC;
-}
-
-#define SHIFT_MB               (20 - PAGE_SHIFT)
-#define ROUND_MB_GB            ((1 << 10) - 1)
-#define SHIFT_MB_GB            10
-#define POOL_PAGES_PER_GB      16
-
-void __init cpa_init(void)
-{
-       struct sysinfo si;
-       unsigned long gb;
-
-       si_meminfo(&si);
-       /*
-        * Calculate the number of pool pages:
-        *
-        * Convert totalram (nr of pages) to MiB and round to the next
-        * GiB. Shift MiB to Gib and multiply the result by
-        * POOL_PAGES_PER_GB:
-        */
-       if (debug_pagealloc) {
-               gb = ((si.totalram >> SHIFT_MB) + ROUND_MB_GB) >> SHIFT_MB_GB;
-               pool_size = POOL_PAGES_PER_GB * gb;
-       } else {
-               pool_size = 1;
-       }
-       pool_low = pool_size;
-
-       cpa_fill_pool(NULL);
-       printk(KERN_DEBUG
-              "CPA: page pool initialized %lu of %lu pages preallocated\n",
-              pool_pages, pool_size);
-}
-
 static int split_large_page(pte_t *kpte, unsigned long address)
 {
        unsigned long flags, pfn, pfninc = 1;
@@ -494,28 +463,15 @@ static int split_large_page(pte_t *kpte, unsigned long address)
        pgprot_t ref_prot;
        struct page *base;
 
-       /*
-        * Get a page from the pool. The pool list is protected by the
-        * pgd_lock, which we have to take anyway for the split
-        * operation:
-        */
-       spin_lock_irqsave(&pgd_lock, flags);
-       if (list_empty(&page_pool)) {
-               spin_unlock_irqrestore(&pgd_lock, flags);
-               base = NULL;
-               cpa_fill_pool(&base);
-               if (!base)
-                       return -ENOMEM;
-               spin_lock_irqsave(&pgd_lock, flags);
-       } else {
-               base = list_first_entry(&page_pool, struct page, lru);
-               list_del(&base->lru);
-               pool_pages--;
-
-               if (pool_pages < pool_low)
-                       pool_low = pool_pages;
-       }
+       if (!debug_pagealloc)
+               spin_unlock(&cpa_lock);
+       base = alloc_pages(GFP_KERNEL, 0);
+       if (!debug_pagealloc)
+               spin_lock(&cpa_lock);
+       if (!base)
+               return -ENOMEM;
 
+       spin_lock_irqsave(&pgd_lock, flags);
        /*
         * Check for races, another CPU might have split this page
         * up for us already:
@@ -572,11 +528,8 @@ out_unlock:
         * If we dropped out via the lookup_address check under
         * pgd_lock then stick the page back into the pool:
         */
-       if (base) {
-               list_add(&base->lru, &page_pool);
-               pool_pages++;
-       } else
-               pool_used++;
+       if (base)
+               __free_page(base);
        spin_unlock_irqrestore(&pgd_lock, flags);
 
        return 0;
@@ -584,11 +537,16 @@ out_unlock:
 
 static int __change_page_attr(struct cpa_data *cpa, int primary)
 {
-       unsigned long address = cpa->vaddr;
+       unsigned long address;
        int do_split, err;
        unsigned int level;
        pte_t *kpte, old_pte;
 
+       if (cpa->flags & CPA_ARRAY)
+               address = cpa->vaddr[cpa->curpage];
+       else
+               address = *cpa->vaddr;
+
 repeat:
        kpte = lookup_address(address, &level);
        if (!kpte)
@@ -600,7 +558,7 @@ repeat:
                        return 0;
                WARN(1, KERN_WARNING "CPA: called for zero pte. "
                       "vaddr = %lx cpa->vaddr = %lx\n", address,
-                      cpa->vaddr);
+                      *cpa->vaddr);
                return -EINVAL;
        }
 
@@ -626,7 +584,7 @@ repeat:
                 */
                if (pte_val(old_pte) != pte_val(new_pte)) {
                        set_pte_atomic(kpte, new_pte);
-                       cpa->flushtlb = 1;
+                       cpa->flags |= CPA_FLUSHTLB;
                }
                cpa->numpages = 1;
                return 0;
@@ -650,7 +608,25 @@ repeat:
         */
        err = split_large_page(kpte, address);
        if (!err) {
-               cpa->flushtlb = 1;
+               /*
+                * Do a global flush tlb after splitting the large page
+                * and before we do the actual change page attribute in the PTE.
+                *
+                * With out this, we violate the TLB application note, that says
+                * "The TLBs may contain both ordinary and large-page
+                *  translations for a 4-KByte range of linear addresses. This
+                *  may occur if software modifies the paging structures so that
+                *  the page size used for the address range changes. If the two
+                *  translations differ with respect to page frame or attributes
+                *  (e.g., permissions), processor behavior is undefined and may
+                *  be implementation-specific."
+                *
+                * We do this global tlb flush inside the cpa_lock, so that we
+                * don't allow any other cpu, with stale tlb entries change the
+                * page attribute in parallel, that also falls into the
+                * just split large page entry.
+                */
+               flush_tlb_all();
                goto repeat;
        }
 
@@ -663,6 +639,7 @@ static int cpa_process_alias(struct cpa_data *cpa)
 {
        struct cpa_data alias_cpa;
        int ret = 0;
+       unsigned long temp_cpa_vaddr, vaddr;
 
        if (cpa->pfn >= max_pfn_mapped)
                return 0;
@@ -675,16 +652,24 @@ static int cpa_process_alias(struct cpa_data *cpa)
         * No need to redo, when the primary call touched the direct
         * mapping already:
         */
-       if (!(within(cpa->vaddr, PAGE_OFFSET,
+       if (cpa->flags & CPA_ARRAY)
+               vaddr = cpa->vaddr[cpa->curpage];
+       else
+               vaddr = *cpa->vaddr;
+
+       if (!(within(vaddr, PAGE_OFFSET,
                    PAGE_OFFSET + (max_low_pfn_mapped << PAGE_SHIFT))
 #ifdef CONFIG_X86_64
-               || within(cpa->vaddr, PAGE_OFFSET + (1UL<<32),
+               || within(vaddr, PAGE_OFFSET + (1UL<<32),
                    PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))
 #endif
        )) {
 
                alias_cpa = *cpa;
-               alias_cpa.vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT);
+               temp_cpa_vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT);
+               alias_cpa.vaddr = &temp_cpa_vaddr;
+               alias_cpa.flags &= ~CPA_ARRAY;
+
 
                ret = __change_page_attr_set_clr(&alias_cpa, 0);
        }
@@ -696,7 +681,7 @@ static int cpa_process_alias(struct cpa_data *cpa)
         * No need to redo, when the primary call touched the high
         * mapping already:
         */
-       if (within(cpa->vaddr, (unsigned long) _text, (unsigned long) _end))
+       if (within(vaddr, (unsigned long) _text, (unsigned long) _end))
                return 0;
 
        /*
@@ -707,8 +692,9 @@ static int cpa_process_alias(struct cpa_data *cpa)
                return 0;
 
        alias_cpa = *cpa;
-       alias_cpa.vaddr =
-               (cpa->pfn << PAGE_SHIFT) + __START_KERNEL_map - phys_base;
+       temp_cpa_vaddr = (cpa->pfn << PAGE_SHIFT) + __START_KERNEL_map - phys_base;
+       alias_cpa.vaddr = &temp_cpa_vaddr;
+       alias_cpa.flags &= ~CPA_ARRAY;
 
        /*
         * 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)
                 * preservation check.
                 */
                cpa->numpages = numpages;
+               /* for array changes, we can't use large page */
+               if (cpa->flags & CPA_ARRAY)
+                       cpa->numpages = 1;
 
+               if (!debug_pagealloc)
+                       spin_lock(&cpa_lock);
                ret = __change_page_attr(cpa, checkalias);
+               if (!debug_pagealloc)
+                       spin_unlock(&cpa_lock);
                if (ret)
                        return ret;
 
@@ -746,7 +739,11 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)
                 */
                BUG_ON(cpa->numpages > numpages);
                numpages -= cpa->numpages;
-               cpa->vaddr += cpa->numpages * PAGE_SIZE;
+               if (cpa->flags & CPA_ARRAY)
+                       cpa->curpage++;
+               else
+                       *cpa->vaddr += cpa->numpages * PAGE_SIZE;
+
        }
        return 0;
 }
@@ -757,9 +754,9 @@ static inline int cache_attr(pgprot_t attr)
                (_PAGE_PAT | _PAGE_PAT_LARGE | _PAGE_PWT | _PAGE_PCD);
 }
 
-static int change_page_attr_set_clr(unsigned long addr, int numpages,
+static int change_page_attr_set_clr(unsigned long *addr, int numpages,
                                    pgprot_t mask_set, pgprot_t mask_clr,
-                                   int force_split)
+                                   int force_split, int array)
 {
        struct cpa_data cpa;
        int ret, cache, checkalias;
@@ -774,21 +771,38 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
                return 0;
 
        /* Ensure we are PAGE_SIZE aligned */
-       if (addr & ~PAGE_MASK) {
-               addr &= PAGE_MASK;
-               /*
-                * People should not be passing in unaligned addresses:
-                */
-               WARN_ON_ONCE(1);
+       if (!array) {
+               if (*addr & ~PAGE_MASK) {
+                       *addr &= PAGE_MASK;
+                       /*
+                        * People should not be passing in unaligned addresses:
+                        */
+                       WARN_ON_ONCE(1);
+               }
+       } else {
+               int i;
+               for (i = 0; i < numpages; i++) {
+                       if (addr[i] & ~PAGE_MASK) {
+                               addr[i] &= PAGE_MASK;
+                               WARN_ON_ONCE(1);
+                       }
+               }
        }
 
+       /* Must avoid aliasing mappings in the highmem code */
+       kmap_flush_unused();
+
        cpa.vaddr = addr;
        cpa.numpages = numpages;
        cpa.mask_set = mask_set;
        cpa.mask_clr = mask_clr;
-       cpa.flushtlb = 0;
+       cpa.flags = 0;
+       cpa.curpage = 0;
        cpa.force_split = force_split;
 
+       if (array)
+               cpa.flags |= CPA_ARRAY;
+
        /* No alias checking for _NX bit modifications */
        checkalias = (pgprot_val(mask_set) | pgprot_val(mask_clr)) != _PAGE_NX;
 
@@ -797,7 +811,7 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
        /*
         * Check whether we really changed something:
         */
-       if (!cpa.flushtlb)
+       if (!(cpa.flags & CPA_FLUSHTLB))
                goto out;
 
        /*
@@ -812,27 +826,30 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
         * error case we fall back to cpa_flush_all (which uses
         * wbindv):
         */
-       if (!ret && cpu_has_clflush)
-               cpa_flush_range(addr, numpages, cache);
-       else
+       if (!ret && cpu_has_clflush) {
+               if (cpa.flags & CPA_ARRAY)
+                       cpa_flush_array(addr, numpages, cache);
+               else
+                       cpa_flush_range(*addr, numpages, cache);
+       } else
                cpa_flush_all(cache);
 
 out:
-       cpa_fill_pool(NULL);
-
        return ret;
 }
 
-static inline int change_page_attr_set(unsigned long addr, int numpages,
-                                      pgprot_t mask)
+static inline int change_page_attr_set(unsigned long *addr, int numpages,
+                                      pgprot_t mask, int array)
 {
-       return change_page_attr_set_clr(addr, numpages, mask, __pgprot(0), 0);
+       return change_page_attr_set_clr(addr, numpages, mask, __pgprot(0), 0,
+               array);
 }
 
-static inline int change_page_attr_clear(unsigned long addr, int numpages,
-                                        pgprot_t mask)
+static inline int change_page_attr_clear(unsigned long *addr, int numpages,
+                                        pgprot_t mask, int array)
 {
-       return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask, 0);
+       return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask, 0,
+               array);
 }
 
 int _set_memory_uc(unsigned long addr, int numpages)
@@ -840,8 +857,8 @@ int _set_memory_uc(unsigned long addr, int numpages)
        /*
         * for now UC MINUS. see comments in ioremap_nocache()
         */
-       return change_page_attr_set(addr, numpages,
-                                   __pgprot(_PAGE_CACHE_UC_MINUS));
+       return change_page_attr_set(&addr, numpages,
+                                   __pgprot(_PAGE_CACHE_UC_MINUS), 0);
 }
 
 int set_memory_uc(unsigned long addr, int numpages)
@@ -857,10 +874,48 @@ int set_memory_uc(unsigned long addr, int numpages)
 }
 EXPORT_SYMBOL(set_memory_uc);
 
+int set_memory_array_uc(unsigned long *addr, int addrinarray)
+{
+       unsigned long start;
+       unsigned long end;
+       int i;
+       /*
+        * for now UC MINUS. see comments in ioremap_nocache()
+        */
+       for (i = 0; i < addrinarray; i++) {
+               start = __pa(addr[i]);
+               for (end = start + PAGE_SIZE; i < addrinarray - 1; end += PAGE_SIZE) {
+                       if (end != __pa(addr[i + 1]))
+                               break;
+                       i++;
+               }
+               if (reserve_memtype(start, end, _PAGE_CACHE_UC_MINUS, NULL))
+                       goto out;
+       }
+
+       return change_page_attr_set(addr, addrinarray,
+                                   __pgprot(_PAGE_CACHE_UC_MINUS), 1);
+out:
+       for (i = 0; i < addrinarray; i++) {
+               unsigned long tmp = __pa(addr[i]);
+
+               if (tmp == start)
+                       break;
+               for (end = tmp + PAGE_SIZE; i < addrinarray - 1; end += PAGE_SIZE) {
+                       if (end != __pa(addr[i + 1]))
+                               break;
+                       i++;
+               }
+               free_memtype(tmp, end);
+       }
+       return -EINVAL;
+}
+EXPORT_SYMBOL(set_memory_array_uc);
+
 int _set_memory_wc(unsigned long addr, int numpages)
 {
-       return change_page_attr_set(addr, numpages,
-                                   __pgprot(_PAGE_CACHE_WC));
+       return change_page_attr_set(&addr, numpages,
+                                   __pgprot(_PAGE_CACHE_WC), 0);
 }
 
 int set_memory_wc(unsigned long addr, int numpages)
@@ -878,8 +933,8 @@ EXPORT_SYMBOL(set_memory_wc);
 
 int _set_memory_wb(unsigned long addr, int numpages)
 {
-       return change_page_attr_clear(addr, numpages,
-                                     __pgprot(_PAGE_CACHE_MASK));
+       return change_page_attr_clear(&addr, numpages,
+                                     __pgprot(_PAGE_CACHE_MASK), 0);
 }
 
 int set_memory_wb(unsigned long addr, int numpages)
@@ -890,37 +945,59 @@ int set_memory_wb(unsigned long addr, int numpages)
 }
 EXPORT_SYMBOL(set_memory_wb);
 
+int set_memory_array_wb(unsigned long *addr, int addrinarray)
+{
+       int i;
+
+       for (i = 0; i < addrinarray; i++) {
+               unsigned long start = __pa(addr[i]);
+               unsigned long end;
+
+               for (end = start + PAGE_SIZE; i < addrinarray - 1; end += PAGE_SIZE) {
+                       if (end != __pa(addr[i + 1]))
+                               break;
+                       i++;
+               }
+               free_memtype(start, end);
+       }
+       return change_page_attr_clear(addr, addrinarray,
+                                     __pgprot(_PAGE_CACHE_MASK), 1);
+}
+EXPORT_SYMBOL(set_memory_array_wb);
+
 int set_memory_x(unsigned long addr, int numpages)
 {
-       return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_NX));
+       return change_page_attr_clear(&addr, numpages, __pgprot(_PAGE_NX), 0);
 }
 EXPORT_SYMBOL(set_memory_x);
 
 int set_memory_nx(unsigned long addr, int numpages)
 {
-       return change_page_attr_set(addr, numpages, __pgprot(_PAGE_NX));
+       return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_NX), 0);
 }
 EXPORT_SYMBOL(set_memory_nx);
 
 int set_memory_ro(unsigned long addr, int numpages)
 {
-       return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_RW));
+       return change_page_attr_clear(&addr, numpages, __pgprot(_PAGE_RW), 0);
 }
+EXPORT_SYMBOL_GPL(set_memory_ro);
 
 int set_memory_rw(unsigned long addr, int numpages)
 {
-       return change_page_attr_set(addr, numpages, __pgprot(_PAGE_RW));
+       return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_RW), 0);
 }
+EXPORT_SYMBOL_GPL(set_memory_rw);
 
 int set_memory_np(unsigned long addr, int numpages)
 {
-       return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_PRESENT));
+       return change_page_attr_clear(&addr, numpages, __pgprot(_PAGE_PRESENT), 0);
 }
 
 int set_memory_4k(unsigned long addr, int numpages)
 {
-       return change_page_attr_set_clr(addr, numpages, __pgprot(0),
-                                       __pgprot(0), 1);
+       return change_page_attr_set_clr(&addr, numpages, __pgprot(0),
+                                       __pgprot(0), 1, 0);
 }
 
 int set_pages_uc(struct page *page, int numpages)
@@ -973,22 +1050,38 @@ int set_pages_rw(struct page *page, int numpages)
 
 static int __set_pages_p(struct page *page, int numpages)
 {
-       struct cpa_data cpa = { .vaddr = (unsigned long) page_address(page),
+       unsigned long tempaddr = (unsigned long) page_address(page);
+       struct cpa_data cpa = { .vaddr = &tempaddr,
                                .numpages = numpages,
                                .mask_set = __pgprot(_PAGE_PRESENT | _PAGE_RW),
-                               .mask_clr = __pgprot(0)};
+                               .mask_clr = __pgprot(0),
+                               .flags = 0};
 
-       return __change_page_attr_set_clr(&cpa, 1);
+       /*
+        * No alias checking needed for setting present flag. otherwise,
+        * we may need to break large pages for 64-bit kernel text
+        * mappings (this adds to complexity if we want to do this from
+        * atomic context especially). Let's keep it simple!
+        */
+       return __change_page_attr_set_clr(&cpa, 0);
 }
 
 static int __set_pages_np(struct page *page, int numpages)
 {
-       struct cpa_data cpa = { .vaddr = (unsigned long) page_address(page),
+       unsigned long tempaddr = (unsigned long) page_address(page);
+       struct cpa_data cpa = { .vaddr = &tempaddr,
                                .numpages = numpages,
                                .mask_set = __pgprot(0),
-                               .mask_clr = __pgprot(_PAGE_PRESENT | _PAGE_RW)};
+                               .mask_clr = __pgprot(_PAGE_PRESENT | _PAGE_RW),
+                               .flags = 0};
 
-       return __change_page_attr_set_clr(&cpa, 1);
+       /*
+        * No alias checking needed for setting not present flag. otherwise,
+        * we may need to break large pages for 64-bit kernel text
+        * mappings (this adds to complexity if we want to do this from
+        * atomic context especially). Let's keep it simple!
+        */
+       return __change_page_attr_set_clr(&cpa, 0);
 }
 
 void 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)
 
        /*
         * The return value is ignored as the calls cannot fail.
-        * Large pages are kept enabled at boot time, and are
-        * split up quickly with DEBUG_PAGEALLOC. If a splitup
-        * fails here (due to temporary memory shortage) no damage
-        * is done because we just keep the largepage intact up
-        * to the next attempt when it will likely be split up:
+        * Large pages for identity mappings are not used at boot time
+        * and hence no memory allocations during large page split.
         */
        if (enable)
                __set_pages_p(page, numpages);
@@ -1024,53 +1114,8 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
         * but that can deadlock->flush only current cpu:
         */
        __flush_tlb_all();
-
-       /*
-        * Try to refill the page pool here. We can do this only after
-        * the tlb flush.
-        */
-       cpa_fill_pool(NULL);
 }
 
-#ifdef CONFIG_DEBUG_FS
-static int dpa_show(struct seq_file *m, void *v)
-{
-       seq_puts(m, "DEBUG_PAGEALLOC\n");
-       seq_printf(m, "pool_size     : %lu\n", pool_size);
-       seq_printf(m, "pool_pages    : %lu\n", pool_pages);
-       seq_printf(m, "pool_low      : %lu\n", pool_low);
-       seq_printf(m, "pool_used     : %lu\n", pool_used);
-       seq_printf(m, "pool_failed   : %lu\n", pool_failed);
-
-       return 0;
-}
-
-static int dpa_open(struct inode *inode, struct file *filp)
-{
-       return single_open(filp, dpa_show, NULL);
-}
-
-static const struct file_operations dpa_fops = {
-       .open           = dpa_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
-
-static int __init debug_pagealloc_proc_init(void)
-{
-       struct dentry *de;
-
-       de = debugfs_create_file("debug_pagealloc", 0600, NULL, NULL,
-                                &dpa_fops);
-       if (!de)
-               return -ENOMEM;
-
-       return 0;
-}
-__initcall(debug_pagealloc_proc_init);
-#endif
-
 #ifdef CONFIG_HIBERNATION
 
 bool kernel_page_present(struct page *page)
index 2a50e0fa64a53290726e9eb1d1b4252afcce1fc8..738fd0f2495823189daffbba1e5c836b227e6c25 100644 (file)
@@ -7,24 +7,24 @@
  * Loosely based on earlier PAT patchset from Eric Biederman and Andi Kleen.
  */
 
-#include <linux/mm.h>
+#include <linux/seq_file.h>
+#include <linux/bootmem.h>
+#include <linux/debugfs.h>
 #include <linux/kernel.h>
 #include <linux/gfp.h>
+#include <linux/mm.h>
 #include <linux/fs.h>
-#include <linux/bootmem.h>
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
 
-#include <asm/msr.h>
-#include <asm/tlbflush.h>
+#include <asm/cacheflush.h>
 #include <asm/processor.h>
-#include <asm/page.h>
+#include <asm/tlbflush.h>
 #include <asm/pgtable.h>
-#include <asm/pat.h>
-#include <asm/e820.h>
-#include <asm/cacheflush.h>
 #include <asm/fcntl.h>
+#include <asm/e820.h>
 #include <asm/mtrr.h>
+#include <asm/page.h>
+#include <asm/msr.h>
+#include <asm/pat.h>
 #include <asm/io.h>
 
 #ifdef CONFIG_X86_PAT
@@ -46,6 +46,7 @@ early_param("nopat", nopat);
 
 
 static int debug_enable;
+
 static int __init pat_debug_setup(char *str)
 {
        debug_enable = 1;
@@ -145,14 +146,14 @@ static char *cattr_name(unsigned long flags)
  */
 
 struct memtype {
-       u64 start;
-       u64 end;
-       unsigned long type;
-       struct list_head nd;
+       u64                     start;
+       u64                     end;
+       unsigned long           type;
+       struct list_head        nd;
 };
 
 static LIST_HEAD(memtype_list);
-static DEFINE_SPINLOCK(memtype_lock);  /* protects memtype list */
+static DEFINE_SPINLOCK(memtype_lock);  /* protects memtype list */
 
 /*
  * 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)
        return req_type;
 }
 
-static int chk_conflict(struct memtype *new, struct memtype *entry,
-                       unsigned long *type)
+static int
+chk_conflict(struct memtype *new, struct memtype *entry, unsigned long *type)
 {
        if (new->type != entry->type) {
                if (type) {
@@ -210,6 +211,66 @@ static int chk_conflict(struct memtype *new, struct memtype *entry,
 static struct memtype *cached_entry;
 static u64 cached_start;
 
+/*
+ * For RAM pages, mark the pages as non WB memory type using
+ * PageNonWB (PG_arch_1). We allow only one set_memory_uc() or
+ * set_memory_wc() on a RAM page at a time before marking it as WB again.
+ * This is ok, because only one driver will be owning the page and
+ * doing set_memory_*() calls.
+ *
+ * For now, we use PageNonWB to track that the RAM page is being mapped
+ * as non WB. In future, we will have to use one more flag
+ * (or some other mechanism in page_struct) to distinguish between
+ * UC and WC mapping.
+ */
+static int reserve_ram_pages_type(u64 start, u64 end, unsigned long req_type,
+                                 unsigned long *new_type)
+{
+       struct page *page;
+       u64 pfn, end_pfn;
+
+       for (pfn = (start >> PAGE_SHIFT); pfn < (end >> PAGE_SHIFT); ++pfn) {
+               page = pfn_to_page(pfn);
+               if (page_mapped(page) || PageNonWB(page))
+                       goto out;
+
+               SetPageNonWB(page);
+       }
+       return 0;
+
+out:
+       end_pfn = pfn;
+       for (pfn = (start >> PAGE_SHIFT); pfn < end_pfn; ++pfn) {
+               page = pfn_to_page(pfn);
+               ClearPageNonWB(page);
+       }
+
+       return -EINVAL;
+}
+
+static int free_ram_pages_type(u64 start, u64 end)
+{
+       struct page *page;
+       u64 pfn, end_pfn;
+
+       for (pfn = (start >> PAGE_SHIFT); pfn < (end >> PAGE_SHIFT); ++pfn) {
+               page = pfn_to_page(pfn);
+               if (page_mapped(page) || !PageNonWB(page))
+                       goto out;
+
+               ClearPageNonWB(page);
+       }
+       return 0;
+
+out:
+       end_pfn = pfn;
+       for (pfn = (start >> PAGE_SHIFT); pfn < end_pfn; ++pfn) {
+               page = pfn_to_page(pfn);
+               SetPageNonWB(page);
+       }
+       return -EINVAL;
+}
+
 /*
  * req_type typically has one of the:
  * - _PAGE_CACHE_WB
@@ -226,14 +287,15 @@ static u64 cached_start;
  * it will return a negative return value.
  */
 int reserve_memtype(u64 start, u64 end, unsigned long req_type,
-                       unsigned long *new_type)
+                   unsigned long *new_type)
 {
        struct memtype *new, *entry;
        unsigned long actual_type;
        struct list_head *where;
+       int is_range_ram;
        int err = 0;
 
-       BUG_ON(start >= end); /* end is exclusive */
+       BUG_ON(start >= end); /* end is exclusive */
 
        if (!pat_enabled) {
                /* This is identical to page table setting without PAT */
@@ -266,17 +328,24 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
                        actual_type = _PAGE_CACHE_WB;
                else
                        actual_type = _PAGE_CACHE_UC_MINUS;
-       } else
+       } else {
                actual_type = pat_x_mtrr_type(start, end,
                                              req_type & _PAGE_CACHE_MASK);
+       }
+
+       is_range_ram = pagerange_is_ram(start, end);
+       if (is_range_ram == 1)
+               return reserve_ram_pages_type(start, end, req_type, new_type);
+       else if (is_range_ram < 0)
+               return -EINVAL;
 
        new  = kmalloc(sizeof(struct memtype), GFP_KERNEL);
        if (!new)
                return -ENOMEM;
 
-       new->start = start;
-       new->end = end;
-       new->type = actual_type;
+       new->start      = start;
+       new->end        = end;
+       new->type       = actual_type;
 
        if (new_type)
                *new_type = actual_type;
@@ -335,6 +404,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
                       start, end, cattr_name(new->type), cattr_name(req_type));
                kfree(new);
                spin_unlock(&memtype_lock);
+
                return err;
        }
 
@@ -358,6 +428,7 @@ int free_memtype(u64 start, u64 end)
 {
        struct memtype *entry;
        int err = -EINVAL;
+       int is_range_ram;
 
        if (!pat_enabled)
                return 0;
@@ -366,6 +437,12 @@ int free_memtype(u64 start, u64 end)
        if (is_ISA_range(start, end - 1))
                return 0;
 
+       is_range_ram = pagerange_is_ram(start, end);
+       if (is_range_ram == 1)
+               return free_ram_pages_type(start, end);
+       else if (is_range_ram < 0)
+               return -EINVAL;
+
        spin_lock(&memtype_lock);
        list_for_each_entry(entry, &memtype_list, nd) {
                if (entry->start == start && entry->end == end) {
@@ -386,6 +463,7 @@ int free_memtype(u64 start, u64 end)
        }
 
        dprintk("free_memtype request 0x%Lx-0x%Lx\n", start, end);
+
        return err;
 }
 
@@ -492,9 +570,9 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
 
 void map_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
 {
+       unsigned long want_flags = (pgprot_val(vma_prot) & _PAGE_CACHE_MASK);
        u64 addr = (u64)pfn << PAGE_SHIFT;
        unsigned long flags;
-       unsigned long want_flags = (pgprot_val(vma_prot) & _PAGE_CACHE_MASK);
 
        reserve_memtype(addr, addr + size, want_flags, &flags);
        if (flags != want_flags) {
@@ -514,7 +592,7 @@ void unmap_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
        free_memtype(addr, addr + size);
 }
 
-#if defined(CONFIG_DEBUG_FS)
+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT)
 
 /* get Nth element of the linked list */
 static struct memtype *memtype_get_idx(loff_t pos)
@@ -537,6 +615,7 @@ static struct memtype *memtype_get_idx(loff_t pos)
        }
        spin_unlock(&memtype_lock);
        kfree(print_entry);
+
        return NULL;
 }
 
@@ -567,6 +646,7 @@ static int memtype_seq_show(struct seq_file *seq, void *v)
        seq_printf(seq, "%s @ 0x%Lx-0x%Lx\n", cattr_name(print_entry->type),
                        print_entry->start, print_entry->end);
        kfree(print_entry);
+
        return 0;
 }
 
@@ -598,4 +678,4 @@ static int __init pat_memtype_list_init(void)
 
 late_initcall(pat_memtype_list_init);
 
-#endif /* CONFIG_DEBUG_FS */
+#endif /* CONFIG_DEBUG_FS && CONFIG_X86_PAT */
index d50302774fe2cf7d9796d9856b9c8515e69b5f54..86f2ffc43c3d8b7cc28d2e019f570f1ecc6128c8 100644 (file)
@@ -63,10 +63,8 @@ static inline void pgd_list_del(pgd_t *pgd)
 #define UNSHARED_PTRS_PER_PGD                          \
        (SHARED_KERNEL_PMD ? KERNEL_PGD_BOUNDARY : PTRS_PER_PGD)
 
-static void pgd_ctor(void *p)
+static void pgd_ctor(pgd_t *pgd)
 {
-       pgd_t *pgd = p;
-
        /* If the pgd points to a shared pagetable level (either the
           ptes in non-PAE, or shared PMD in PAE), then just copy the
           references from swapper_pg_dir. */
@@ -87,7 +85,7 @@ static void pgd_ctor(void *p)
                pgd_list_add(pgd);
 }
 
-static void pgd_dtor(void *pgd)
+static void pgd_dtor(pgd_t *pgd)
 {
        unsigned long flags; /* can be called from interrupt context */
 
index cab0abbd1ebe6c42a9adfb46306220a893f86541..0951db9ee5190b351a843a71a755109a6fd1586e 100644 (file)
@@ -123,7 +123,8 @@ static int __init parse_vmalloc(char *arg)
        if (!arg)
                return -EINVAL;
 
-       __VMALLOC_RESERVE = memparse(arg, &arg);
+       /* Add VMALLOC_OFFSET to the parsed value due to vm area guard hole*/
+       __VMALLOC_RESERVE = memparse(arg, &arg) + VMALLOC_OFFSET;
        return 0;
 }
 early_param("vmalloc", parse_vmalloc);
index 0227694f7dab9b156350eaef0e90f79e8ec2ecc4..8a5f1614a3d57cde8d7495c1b71f8e8542e99c64 100644 (file)
@@ -295,10 +295,12 @@ static void nmi_cpu_shutdown(void *dummy)
 
 static void nmi_shutdown(void)
 {
-       struct op_msrs *msrs = &get_cpu_var(cpu_msrs);
+       struct op_msrs *msrs;
+
        nmi_enabled = 0;
        on_each_cpu(nmi_cpu_shutdown, NULL, 1);
        unregister_die_notifier(&profile_exceptions_nb);
+       msrs = &get_cpu_var(cpu_msrs);
        model->shutdown(msrs);
        free_msrs();
        put_cpu_var(cpu_msrs);
index 56b4757a1f4706cef329fac43c38e71fcd491bd6..43ac5af338d8c910c2295a7484453ab6b8a01b2a 100644 (file)
 
 #include <linux/oprofile.h>
 #include <linux/smp.h>
+#include <linux/ptrace.h>
+#include <linux/nmi.h>
 #include <asm/msr.h>
-#include <asm/ptrace.h>
 #include <asm/fixmap.h>
 #include <asm/apic.h>
-#include <asm/nmi.h>
+
 
 #include "op_x86_model.h"
 #include "op_counter.h"
@@ -40,7 +41,7 @@ static unsigned int num_controls = NUM_CONTROLS_NON_HT;
 static inline void setup_num_counters(void)
 {
 #ifdef CONFIG_SMP
-       if (smp_num_siblings == 2){
+       if (smp_num_siblings == 2) {
                num_counters = NUM_COUNTERS_HT2;
                num_controls = NUM_CONTROLS_HT2;
        }
@@ -86,7 +87,7 @@ struct p4_event_binding {
 #define CTR_FLAME_2    (1 << 6)
 #define CTR_IQ_5       (1 << 7)
 
-static struct p4_counter_binding p4_counters [NUM_COUNTERS_NON_HT] = {
+static struct p4_counter_binding p4_counters[NUM_COUNTERS_NON_HT] = {
        { CTR_BPU_0,   MSR_P4_BPU_PERFCTR0,   MSR_P4_BPU_CCCR0 },
        { CTR_MS_0,    MSR_P4_MS_PERFCTR0,    MSR_P4_MS_CCCR0 },
        { 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] = {
        { CTR_IQ_5,    MSR_P4_IQ_PERFCTR5,    MSR_P4_IQ_CCCR5 }
 };
 
-#define NUM_UNUSED_CCCRS       NUM_CCCRS_NON_HT - NUM_COUNTERS_NON_HT
+#define NUM_UNUSED_CCCRS (NUM_CCCRS_NON_HT - NUM_COUNTERS_NON_HT)
 
 /* p4 event codes in libop/op_event.h are indices into this table. */
 
 static struct p4_event_binding p4_events[NUM_EVENTS] = {
-       
+
        { /* BRANCH_RETIRED */
-               0x05, 0x06, 
+               0x05, 0x06,
                { {CTR_IQ_4, MSR_P4_CRU_ESCR2},
                  {CTR_IQ_5, MSR_P4_CRU_ESCR3} }
        },
-       
+
        { /* MISPRED_BRANCH_RETIRED */
-               0x04, 0x03, 
+               0x04, 0x03,
                { { CTR_IQ_4, MSR_P4_CRU_ESCR0},
                  { CTR_IQ_5, MSR_P4_CRU_ESCR1} }
        },
-       
+
        { /* TC_DELIVER_MODE */
                0x01, 0x01,
-               { { CTR_MS_0, MSR_P4_TC_ESCR0},  
+               { { CTR_MS_0, MSR_P4_TC_ESCR0},
                  { CTR_MS_2, MSR_P4_TC_ESCR1} }
        },
-       
+
        { /* BPU_FETCH_REQUEST */
-               0x00, 0x03, 
+               0x00, 0x03,
                { { CTR_BPU_0, MSR_P4_BPU_ESCR0},
                  { CTR_BPU_2, MSR_P4_BPU_ESCR1} }
        },
@@ -146,7 +147,7 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
        },
 
        { /* LOAD_PORT_REPLAY */
-               0x02, 0x04, 
+               0x02, 0x04,
                { { CTR_FLAME_0, MSR_P4_SAAT_ESCR0},
                  { CTR_FLAME_2, MSR_P4_SAAT_ESCR1} }
        },
@@ -170,43 +171,43 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
        },
 
        { /* BSQ_CACHE_REFERENCE */
-               0x07, 0x0c, 
+               0x07, 0x0c,
                { { CTR_BPU_0, MSR_P4_BSU_ESCR0},
                  { CTR_BPU_2, MSR_P4_BSU_ESCR1} }
        },
 
        { /* IOQ_ALLOCATION */
-               0x06, 0x03, 
+               0x06, 0x03,
                { { CTR_BPU_0, MSR_P4_FSB_ESCR0},
                  { 0, 0 } }
        },
 
        { /* IOQ_ACTIVE_ENTRIES */
-               0x06, 0x1a, 
+               0x06, 0x1a,
                { { CTR_BPU_2, MSR_P4_FSB_ESCR1},
                  { 0, 0 } }
        },
 
        { /* FSB_DATA_ACTIVITY */
-               0x06, 0x17, 
+               0x06, 0x17,
                { { CTR_BPU_0, MSR_P4_FSB_ESCR0},
                  { CTR_BPU_2, MSR_P4_FSB_ESCR1} }
        },
 
        { /* BSQ_ALLOCATION */
-               0x07, 0x05, 
+               0x07, 0x05,
                { { CTR_BPU_0, MSR_P4_BSU_ESCR0},
                  { 0, 0 } }
        },
 
        { /* BSQ_ACTIVE_ENTRIES */
                0x07, 0x06,
-               { { CTR_BPU_2, MSR_P4_BSU_ESCR1 /* guess */},  
+               { { CTR_BPU_2, MSR_P4_BSU_ESCR1 /* guess */},
                  { 0, 0 } }
        },
 
        { /* X87_ASSIST */
-               0x05, 0x03, 
+               0x05, 0x03,
                { { CTR_IQ_4, MSR_P4_CRU_ESCR2},
                  { CTR_IQ_5, MSR_P4_CRU_ESCR3} }
        },
@@ -216,21 +217,21 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
                { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
                  { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
        },
-  
+
        { /* PACKED_SP_UOP */
-               0x01, 0x08, 
+               0x01, 0x08,
                { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
                  { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
        },
-  
+
        { /* PACKED_DP_UOP */
-               0x01, 0x0c, 
+               0x01, 0x0c,
                { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
                  { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
        },
 
        { /* SCALAR_SP_UOP */
-               0x01, 0x0a, 
+               0x01, 0x0a,
                { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
                  { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
        },
@@ -242,31 +243,31 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
        },
 
        { /* 64BIT_MMX_UOP */
-               0x01, 0x02, 
+               0x01, 0x02,
                { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
                  { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
        },
-  
+
        { /* 128BIT_MMX_UOP */
-               0x01, 0x1a, 
+               0x01, 0x1a,
                { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
                  { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
        },
 
        { /* X87_FP_UOP */
-               0x01, 0x04, 
+               0x01, 0x04,
                { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
                  { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
        },
-  
+
        { /* X87_SIMD_MOVES_UOP */
-               0x01, 0x2e, 
+               0x01, 0x2e,
                { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
                  { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
        },
-  
+
        { /* MACHINE_CLEAR */
-               0x05, 0x02, 
+               0x05, 0x02,
                { { CTR_IQ_4, MSR_P4_CRU_ESCR2},
                  { CTR_IQ_5, MSR_P4_CRU_ESCR3} }
        },
@@ -276,9 +277,9 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
                { { CTR_BPU_0, MSR_P4_FSB_ESCR0},
                  { CTR_BPU_2, MSR_P4_FSB_ESCR1} }
        },
-  
+
        { /* TC_MS_XFER */
-               0x00, 0x05, 
+               0x00, 0x05,
                { { CTR_MS_0, MSR_P4_MS_ESCR0},
                  { CTR_MS_2, MSR_P4_MS_ESCR1} }
        },
@@ -308,7 +309,7 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
        },
 
        { /* INSTR_RETIRED */
-               0x04, 0x02, 
+               0x04, 0x02,
                { { CTR_IQ_4, MSR_P4_CRU_ESCR0},
                  { CTR_IQ_5, MSR_P4_CRU_ESCR1} }
        },
@@ -319,14 +320,14 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
                  { CTR_IQ_5, MSR_P4_CRU_ESCR1} }
        },
 
-       { /* UOP_TYPE */    
-               0x02, 0x02, 
+       { /* UOP_TYPE */
+               0x02, 0x02,
                { { CTR_IQ_4, MSR_P4_RAT_ESCR0},
                  { CTR_IQ_5, MSR_P4_RAT_ESCR1} }
        },
 
        { /* RETIRED_MISPRED_BRANCH_TYPE */
-               0x02, 0x05, 
+               0x02, 0x05,
                { { CTR_MS_0, MSR_P4_TBPU_ESCR0},
                  { CTR_MS_2, MSR_P4_TBPU_ESCR1} }
        },
@@ -349,8 +350,8 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
 #define ESCR_SET_OS_1(escr, os) ((escr) |= (((os) & 1) << 1))
 #define ESCR_SET_EVENT_SELECT(escr, sel) ((escr) |= (((sel) & 0x3f) << 25))
 #define ESCR_SET_EVENT_MASK(escr, mask) ((escr) |= (((mask) & 0xffff) << 9))
-#define ESCR_READ(escr,high,ev,i) do {rdmsr(ev->bindings[(i)].escr_address, (escr), (high));} while (0)
-#define ESCR_WRITE(escr,high,ev,i) do {wrmsr(ev->bindings[(i)].escr_address, (escr), (high));} while (0)
+#define ESCR_READ(escr, high, ev, i) do {rdmsr(ev->bindings[(i)].escr_address, (escr), (high)); } while (0)
+#define ESCR_WRITE(escr, high, ev, i) do {wrmsr(ev->bindings[(i)].escr_address, (escr), (high)); } while (0)
 
 #define CCCR_RESERVED_BITS 0x38030FFF
 #define CCCR_CLEAR(cccr) ((cccr) &= CCCR_RESERVED_BITS)
@@ -360,15 +361,15 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
 #define CCCR_SET_PMI_OVF_1(cccr) ((cccr) |= (1<<27))
 #define CCCR_SET_ENABLE(cccr) ((cccr) |= (1<<12))
 #define CCCR_SET_DISABLE(cccr) ((cccr) &= ~(1<<12))
-#define CCCR_READ(low, high, i) do {rdmsr(p4_counters[(i)].cccr_address, (low), (high));} while (0)
-#define CCCR_WRITE(low, high, i) do {wrmsr(p4_counters[(i)].cccr_address, (low), (high));} while (0)
+#define CCCR_READ(low, high, i) do {rdmsr(p4_counters[(i)].cccr_address, (low), (high)); } while (0)
+#define CCCR_WRITE(low, high, i) do {wrmsr(p4_counters[(i)].cccr_address, (low), (high)); } while (0)
 #define CCCR_OVF_P(cccr) ((cccr) & (1U<<31))
 #define CCCR_CLEAR_OVF(cccr) ((cccr) &= (~(1U<<31)))
 
-#define CTRL_IS_RESERVED(msrs,c) (msrs->controls[(c)].addr ? 1 : 0)
-#define CTR_IS_RESERVED(msrs,c) (msrs->counters[(c)].addr ? 1 : 0)
-#define CTR_READ(l,h,i) do {rdmsr(p4_counters[(i)].counter_address, (l), (h));} while (0)
-#define CTR_WRITE(l,i) do {wrmsr(p4_counters[(i)].counter_address, -(u32)(l), -1);} while (0)
+#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0)
+#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0)
+#define CTR_READ(l, h, i) do {rdmsr(p4_counters[(i)].counter_address, (l), (h)); } while (0)
+#define CTR_WRITE(l, i) do {wrmsr(p4_counters[(i)].counter_address, -(u32)(l), -1); } while (0)
 #define CTR_OVERFLOW_P(ctr) (!((ctr) & 0x80000000))
 
 
@@ -380,7 +381,7 @@ static unsigned int get_stagger(void)
 #ifdef CONFIG_SMP
        int cpu = smp_processor_id();
        return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu)));
-#endif 
+#endif
        return 0;
 }
 
@@ -395,25 +396,23 @@ static unsigned long reset_value[NUM_COUNTERS_NON_HT];
 
 static void p4_fill_in_addresses(struct op_msrs * const msrs)
 {
-       unsigned int i; 
+       unsigned int i;
        unsigned int addr, cccraddr, stag;
 
        setup_num_counters();
        stag = get_stagger();
 
        /* initialize some registers */
-       for (i = 0; i < num_counters; ++i) {
+       for (i = 0; i < num_counters; ++i)
                msrs->counters[i].addr = 0;
-       }
-       for (i = 0; i < num_controls; ++i) {
+       for (i = 0; i < num_controls; ++i)
                msrs->controls[i].addr = 0;
-       }
-       
+
        /* the counter & cccr registers we pay attention to */
        for (i = 0; i < num_counters; ++i) {
                addr = p4_counters[VIRT_CTR(stag, i)].counter_address;
                cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address;
-               if (reserve_perfctr_nmi(addr)){
+               if (reserve_perfctr_nmi(addr)) {
                        msrs->counters[i].addr = addr;
                        msrs->controls[i].addr = cccraddr;
                }
@@ -447,22 +446,22 @@ static void p4_fill_in_addresses(struct op_msrs * const msrs)
                if (reserve_evntsel_nmi(addr))
                        msrs->controls[i].addr = addr;
        }
-       
+
        for (addr = MSR_P4_MS_ESCR0 + stag;
-            addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) { 
+            addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) {
                if (reserve_evntsel_nmi(addr))
                        msrs->controls[i].addr = addr;
        }
-       
+
        for (addr = MSR_P4_IX_ESCR0 + stag;
-            addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) { 
+            addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) {
                if (reserve_evntsel_nmi(addr))
                        msrs->controls[i].addr = addr;
        }
 
        /* there are 2 remaining non-contiguously located ESCRs */
 
-       if (num_counters == NUM_COUNTERS_NON_HT) {              
+       if (num_counters == NUM_COUNTERS_NON_HT) {
                /* standard non-HT CPUs handle both remaining ESCRs*/
                if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5))
                        msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
@@ -498,20 +497,20 @@ static void pmc_setup_one_p4_counter(unsigned int ctr)
        unsigned int stag;
 
        stag = get_stagger();
-       
+
        /* convert from counter *number* to counter *bit* */
        counter_bit = 1 << VIRT_CTR(stag, ctr);
-       
+
        /* find our event binding structure. */
        if (counter_config[ctr].event <= 0 || counter_config[ctr].event > NUM_EVENTS) {
-               printk(KERN_ERR 
-                      "oprofile: P4 event code 0x%lx out of range\n", 
+               printk(KERN_ERR
+                      "oprofile: P4 event code 0x%lx out of range\n",
                       counter_config[ctr].event);
                return;
        }
-       
+
        ev = &(p4_events[counter_config[ctr].event - 1]);
-       
+
        for (i = 0; i < maxbind; i++) {
                if (ev->bindings[i].virt_counter & counter_bit) {
 
@@ -526,25 +525,24 @@ static void pmc_setup_one_p4_counter(unsigned int ctr)
                                ESCR_SET_OS_1(escr, counter_config[ctr].kernel);
                        }
                        ESCR_SET_EVENT_SELECT(escr, ev->event_select);
-                       ESCR_SET_EVENT_MASK(escr, counter_config[ctr].unit_mask);                       
+                       ESCR_SET_EVENT_MASK(escr, counter_config[ctr].unit_mask);
                        ESCR_WRITE(escr, high, ev, i);
-                      
+
                        /* modify CCCR */
                        CCCR_READ(cccr, high, VIRT_CTR(stag, ctr));
                        CCCR_CLEAR(cccr);
                        CCCR_SET_REQUIRED_BITS(cccr);
                        CCCR_SET_ESCR_SELECT(cccr, ev->escr_select);
-                       if (stag == 0) {
+                       if (stag == 0)
                                CCCR_SET_PMI_OVF_0(cccr);
-                       } else {
+                       else
                                CCCR_SET_PMI_OVF_1(cccr);
-                       }
                        CCCR_WRITE(cccr, high, VIRT_CTR(stag, ctr));
                        return;
                }
        }
 
-       printk(KERN_ERR 
+       printk(KERN_ERR
               "oprofile: P4 event code 0x%lx no binding, stag %d ctr %d\n",
               counter_config[ctr].event, stag, ctr);
 }
@@ -559,14 +557,14 @@ static void p4_setup_ctrs(struct op_msrs const * const msrs)
        stag = get_stagger();
 
        rdmsr(MSR_IA32_MISC_ENABLE, low, high);
-       if (! MISC_PMC_ENABLED_P(low)) {
+       if (!MISC_PMC_ENABLED_P(low)) {
                printk(KERN_ERR "oprofile: P4 PMC not available\n");
                return;
        }
 
        /* clear the cccrs we will use */
        for (i = 0 ; i < num_counters ; i++) {
-               if (unlikely(!CTRL_IS_RESERVED(msrs,i)))
+               if (unlikely(!CTRL_IS_RESERVED(msrs, i)))
                        continue;
                rdmsr(p4_counters[VIRT_CTR(stag, i)].cccr_address, low, high);
                CCCR_CLEAR(low);
@@ -576,14 +574,14 @@ static void p4_setup_ctrs(struct op_msrs const * const msrs)
 
        /* clear all escrs (including those outside our concern) */
        for (i = num_counters; i < num_controls; i++) {
-               if (unlikely(!CTRL_IS_RESERVED(msrs,i)))
+               if (unlikely(!CTRL_IS_RESERVED(msrs, i)))
                        continue;
                wrmsr(msrs->controls[i].addr, 0, 0);
        }
 
        /* setup all counters */
        for (i = 0 ; i < num_counters ; ++i) {
-               if ((counter_config[i].enabled) && (CTRL_IS_RESERVED(msrs,i))) {
+               if ((counter_config[i].enabled) && (CTRL_IS_RESERVED(msrs, i))) {
                        reset_value[i] = counter_config[i].count;
                        pmc_setup_one_p4_counter(i);
                        CTR_WRITE(counter_config[i].count, VIRT_CTR(stag, i));
@@ -603,11 +601,11 @@ static int p4_check_ctrs(struct pt_regs * const regs,
        stag = get_stagger();
 
        for (i = 0; i < num_counters; ++i) {
-               
-               if (!reset_value[i]) 
+
+               if (!reset_value[i])
                        continue;
 
-               /* 
+               /*
                 * there is some eccentricity in the hardware which
                 * requires that we perform 2 extra corrections:
                 *
@@ -616,24 +614,24 @@ static int p4_check_ctrs(struct pt_regs * const regs,
                 *
                 * - write the counter back twice to ensure it gets
                 *   updated properly.
-                * 
+                *
                 * the former seems to be related to extra NMIs happening
                 * during the current NMI; the latter is reported as errata
                 * N15 in intel doc 249199-029, pentium 4 specification
                 * update, though their suggested work-around does not
                 * appear to solve the problem.
                 */
-               
+
                real = VIRT_CTR(stag, i);
 
                CCCR_READ(low, high, real);
-               CTR_READ(ctr, high, real);
+               CTR_READ(ctr, high, real);
                if (CCCR_OVF_P(low) || CTR_OVERFLOW_P(ctr)) {
                        oprofile_add_sample(regs, i);
-                       CTR_WRITE(reset_value[i], real);
+                       CTR_WRITE(reset_value[i], real);
                        CCCR_CLEAR_OVF(low);
                        CCCR_WRITE(low, high, real);
-                       CTR_WRITE(reset_value[i], real);
+                       CTR_WRITE(reset_value[i], real);
                }
        }
 
@@ -683,15 +681,16 @@ static void p4_shutdown(struct op_msrs const * const msrs)
        int i;
 
        for (i = 0 ; i < num_counters ; ++i) {
-               if (CTR_IS_RESERVED(msrs,i))
+               if (CTR_IS_RESERVED(msrs, i))
                        release_perfctr_nmi(msrs->counters[i].addr);
        }
-       /* some of the control registers are specially reserved in
+       /*
+        * some of the control registers are specially reserved in
         * conjunction with the counter registers (hence the starting offset).
         * This saves a few bits.
         */
        for (i = num_counters ; i < num_controls ; ++i) {
-               if (CTRL_IS_RESERVED(msrs,i))
+               if (CTRL_IS_RESERVED(msrs, i))
                        release_evntsel_nmi(msrs->controls[i].addr);
        }
 }
index 6a0fca78c36236aeedb3579a3b306f01426e15e7..22e057665e5517971a67b84a0e60e2ffe87ad151 100644 (file)
@@ -580,7 +580,7 @@ static int __cpuinit amd_cpu_notify(struct notifier_block *self,
                                    unsigned long action, void *hcpu)
 {
        int cpu = (long)hcpu;
-       switch(action) {
+       switch (action) {
        case CPU_ONLINE:
        case CPU_ONLINE_FROZEN:
                smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0);
index 8e077185e185cbc72e58be92fcbd29f05437ed23..006599db0dc7024a9bc9cde36bab97b2dc114b0f 100644 (file)
@@ -1043,35 +1043,44 @@ static void __init pcibios_fixup_irqs(void)
                if (io_apic_assign_pci_irqs) {
                        int irq;
 
-                       if (pin) {
-                               /*
-                                * interrupt pins are numbered starting
-                                * from 1
-                                */
-                               pin--;
-                               irq = IO_APIC_get_PCI_irq_vector(dev->bus->number,
-                                       PCI_SLOT(dev->devfn), pin);
-       /*
-        * Busses behind bridges are typically not listed in the MP-table.
-        * In this case we have to look up the IRQ based on the parent bus,
-        * parent slot, and pin number. The SMP code detects such bridged
-        * busses itself so we should get into this branch reliably.
-        */
-                               if (irq < 0 && dev->bus->parent) { /* go back to the bridge */
-                                       struct pci_dev *bridge = dev->bus->self;
-
-                                       pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-                                       irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
-                                                       PCI_SLOT(bridge->devfn), pin);
-                                       if (irq >= 0)
-                                               dev_warn(&dev->dev, "using bridge %s INT %c to get IRQ %d\n",
-                                                        pci_name(bridge),
-                                                        'A' + pin, irq);
-                               }
-                               if (irq >= 0) {
-                                       dev_info(&dev->dev, "PCI->APIC IRQ transform: INT %c -> IRQ %d\n", 'A' + pin, irq);
-                                       dev->irq = irq;
-                               }
+                       if (!pin)
+                               continue;
+
+                       /*
+                        * interrupt pins are numbered starting from 1
+                        */
+                       pin--;
+                       irq = IO_APIC_get_PCI_irq_vector(dev->bus->number,
+                               PCI_SLOT(dev->devfn), pin);
+                       /*
+                        * Busses behind bridges are typically not listed in the
+                        * MP-table.  In this case we have to look up the IRQ
+                        * based on the parent bus, parent slot, and pin number.
+                        * The SMP code detects such bridged busses itself so we
+                        * should get into this branch reliably.
+                        */
+                       if (irq < 0 && dev->bus->parent) {
+                               /* go back to the bridge */
+                               struct pci_dev *bridge = dev->bus->self;
+                               int bus;
+
+                               pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+                               bus = bridge->bus->number;
+                               irq = IO_APIC_get_PCI_irq_vector(bus,
+                                               PCI_SLOT(bridge->devfn), pin);
+                               if (irq >= 0)
+                                       dev_warn(&dev->dev,
+                                               "using bridge %s INT %c to "
+                                                       "get IRQ %d\n",
+                                                pci_name(bridge),
+                                                'A' + pin, irq);
+                       }
+                       if (irq >= 0) {
+                               dev_info(&dev->dev,
+                                       "PCI->APIC IRQ transform: INT %c "
+                                               "-> IRQ %d\n",
+                                       'A' + pin, irq);
+                               dev->irq = irq;
                        }
                }
 #endif
index 4fc7e872c85e4e103039f582eea5050cfc7f2f4a..d1e9b53f9d3315dce9f618c08acce0e3ded959de 100644 (file)
@@ -1,5 +1,3 @@
-.text
-
 /*
  * This may not use any stack, nor any variable that is not "NoSave":
  *
 #include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/asm-offsets.h>
+#include <asm/processor-flags.h>
 
-       .text
+.text
 
 ENTRY(swsusp_arch_suspend)
-
        movl %esp, saved_context_esp
        movl %ebx, saved_context_ebx
        movl %ebp, saved_context_ebp
        movl %esi, saved_context_esi
        movl %edi, saved_context_edi
-       pushfl ; popl saved_context_eflags
+       pushfl
+       popl saved_context_eflags
 
        call swsusp_save
        ret
@@ -59,7 +58,7 @@ done:
        movl    mmu_cr4_features, %ecx
        jecxz   1f      # cr4 Pentium and higher, skip if zero
        movl    %ecx, %edx
-       andl    $~(1<<7), %edx;  # PGE
+       andl    $~(X86_CR4_PGE), %edx
        movl    %edx, %cr4;  # turn off PGE
 1:
        movl    %cr3, %eax;  # flush TLB
@@ -74,7 +73,8 @@ done:
        movl saved_context_esi, %esi
        movl saved_context_edi, %edi
 
-       pushl saved_context_eflags ; popfl
+       pushl saved_context_eflags
+       popfl
 
        xorl    %eax, %eax
 
index a4e201b47f64ec1fbaf5075da3254c6b72f109b1..7dcd321a0508729ca0d32e37525ca0d5a9d823ed 100644 (file)
@@ -812,7 +812,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
 
 /* Early in boot, while setting up the initial pagetable, assume
    everything is pinned. */
-static __init void xen_alloc_pte_init(struct mm_struct *mm, u32 pfn)
+static __init void xen_alloc_pte_init(struct mm_struct *mm, unsigned long pfn)
 {
 #ifdef CONFIG_FLATMEM
        BUG_ON(mem_map);        /* should only be used early */
@@ -822,7 +822,7 @@ static __init void xen_alloc_pte_init(struct mm_struct *mm, u32 pfn)
 
 /* Early release_pte assumes that all pts are pinned, since there's
    only init_mm and anything attached to that is pinned. */
-static void xen_release_pte_init(u32 pfn)
+static void xen_release_pte_init(unsigned long pfn)
 {
        make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
 }
@@ -838,7 +838,7 @@ static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
 
 /* This needs to make sure the new pte page is pinned iff its being
    attached to a pinned pagetable. */
-static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level)
+static void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn, unsigned level)
 {
        struct page *page = pfn_to_page(pfn);
 
@@ -856,12 +856,12 @@ static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level)
        }
 }
 
-static void xen_alloc_pte(struct mm_struct *mm, u32 pfn)
+static void xen_alloc_pte(struct mm_struct *mm, unsigned long pfn)
 {
        xen_alloc_ptpage(mm, pfn, PT_PTE);
 }
 
-static void xen_alloc_pmd(struct mm_struct *mm, u32 pfn)
+static void xen_alloc_pmd(struct mm_struct *mm, unsigned long pfn)
 {
        xen_alloc_ptpage(mm, pfn, PT_PMD);
 }
@@ -909,7 +909,7 @@ static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd)
 }
 
 /* This should never happen until we're OK to use struct page */
-static void xen_release_ptpage(u32 pfn, unsigned level)
+static void xen_release_ptpage(unsigned long pfn, unsigned level)
 {
        struct page *page = pfn_to_page(pfn);
 
@@ -923,23 +923,23 @@ static void xen_release_ptpage(u32 pfn, unsigned level)
        }
 }
 
-static void xen_release_pte(u32 pfn)
+static void xen_release_pte(unsigned long pfn)
 {
        xen_release_ptpage(pfn, PT_PTE);
 }
 
-static void xen_release_pmd(u32 pfn)
+static void xen_release_pmd(unsigned long pfn)
 {
        xen_release_ptpage(pfn, PT_PMD);
 }
 
 #if PAGETABLE_LEVELS == 4
-static void xen_alloc_pud(struct mm_struct *mm, u32 pfn)
+static void xen_alloc_pud(struct mm_struct *mm, unsigned long pfn)
 {
        xen_alloc_ptpage(mm, pfn, PT_PUD);
 }
 
-static void xen_release_pud(u32 pfn)
+static void xen_release_pud(unsigned long pfn)
 {
        xen_release_ptpage(pfn, PT_PUD);
 }
index b6acc3a0af46d0adeb44a99a8b8d78e1ef8c5140..d679010838883195da63cfa7a7bbef7cfa71fe03 100644 (file)
@@ -42,7 +42,7 @@ char * __init xen_memory_setup(void)
 
        e820.nr_map = 0;
 
-       e820_add_region(0, PFN_PHYS(max_pfn), E820_RAM);
+       e820_add_region(0, PFN_PHYS((u64)max_pfn), E820_RAM);
 
        /*
         * Even though this is normal, usable memory under Xen, reserve
index 0a5f6b2114c592acb481641d0bbadebb7d06ae30..d672cfe7ca5960997949ebede8bda6cd1088bbb8 100644 (file)
@@ -376,6 +376,8 @@ int braille_register_console(struct console *console, int index,
        console->flags |= CON_ENABLED;
        console->index = index;
        braille_co = console;
+       register_keyboard_notifier(&keyboard_notifier_block);
+       register_vt_notifier(&vt_notifier_block);
        return 0;
 }
 
@@ -383,15 +385,8 @@ int braille_unregister_console(struct console *console)
 {
        if (braille_co != console)
                return -EINVAL;
+       unregister_keyboard_notifier(&keyboard_notifier_block);
+       unregister_vt_notifier(&vt_notifier_block);
        braille_co = NULL;
        return 0;
 }
-
-static int __init braille_init(void)
-{
-       register_keyboard_notifier(&keyboard_notifier_block);
-       register_vt_notifier(&vt_notifier_block);
-       return 0;
-}
-
-console_initcall(braille_init);
index 084109507c9f5101a1cdcf678db34005984a2855..8dd3336efd7e242209240010b7fa9710bb2ae6e8 100644 (file)
@@ -165,8 +165,11 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
                                "firmware_node");
                ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
                                "physical_node");
-               if (acpi_dev->wakeup.flags.valid)
+               if (acpi_dev->wakeup.flags.valid) {
                        device_set_wakeup_capable(dev, true);
+                       device_set_wakeup_enable(dev,
+                                               acpi_dev->wakeup.state.enabled);
+               }
        }
 
        return 0;
index 4ebbba2b6b194f4f6c6532ad698d9a0582e2519f..bf5b04de02d1c6e48123454656ab3f36e72bf8b7 100644 (file)
@@ -377,6 +377,14 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
        return 0;
 }
 
+static void physical_device_enable_wakeup(struct acpi_device *adev)
+{
+       struct device *dev = acpi_get_physical_device(adev->handle);
+
+       if (dev && device_can_wakeup(dev))
+               device_set_wakeup_enable(dev, adev->wakeup.state.enabled);
+}
+
 static ssize_t
 acpi_system_write_wakeup_device(struct file *file,
                                const char __user * buffer,
@@ -411,6 +419,7 @@ acpi_system_write_wakeup_device(struct file *file,
                }
        }
        if (found_dev) {
+               physical_device_enable_wakeup(found_dev);
                list_for_each_safe(node, next, &acpi_wakeup_device_list) {
                        struct acpi_device *dev = container_of(node,
                                                               struct
@@ -428,6 +437,7 @@ acpi_system_write_wakeup_device(struct file *file,
                                       dev->pnp.bus_id, found_dev->pnp.bus_id);
                                dev->wakeup.state.enabled =
                                    found_dev->wakeup.state.enabled;
+                               physical_device_enable_wakeup(dev);
                        }
                }
        }
index 11c8c19f0fb7107acfd0c9189c70aeffc5dfba06..f17cd4b572f87324b2d261b491fc1f9f78d8d696 100644 (file)
@@ -663,7 +663,7 @@ config HAVE_PATA_PLATFORM
 
 config PATA_PLATFORM
        tristate "Generic platform device PATA support"
-       depends on EMBEDDED || ARCH_RPC || PPC || HAVE_PATA_PLATFORM
+       depends on EMBEDDED || PPC || HAVE_PATA_PLATFORM
        help
          This option enables support for generic directly connected ATA
          devices commonly found on embedded systems.
index 2e1a7cb2ed5f91553ef9d2a39326233197eae7bd..aeadd00411a187dc164eaa4abe4c3a447af8af59 100644 (file)
@@ -267,8 +267,8 @@ struct ahci_port_priv {
                                                 * per PM slot */
 };
 
-static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
+static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
+static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc);
 static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc);
@@ -316,6 +316,7 @@ static struct device_attribute *ahci_shost_attrs[] = {
 
 static struct device_attribute *ahci_sdev_attrs[] = {
        &dev_attr_sw_activity,
+       &dev_attr_unload_heads,
        NULL
 };
 
@@ -820,10 +821,10 @@ static unsigned ahci_scr_offset(struct ata_port *ap, unsigned int sc_reg)
        return 0;
 }
 
-static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
 {
-       void __iomem *port_mmio = ahci_port_base(ap);
-       int offset = ahci_scr_offset(ap, sc_reg);
+       void __iomem *port_mmio = ahci_port_base(link->ap);
+       int offset = ahci_scr_offset(link->ap, sc_reg);
 
        if (offset) {
                *val = readl(port_mmio + offset);
@@ -832,10 +833,10 @@ static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
        return -EINVAL;
 }
 
-static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 {
-       void __iomem *port_mmio = ahci_port_base(ap);
-       int offset = ahci_scr_offset(ap, sc_reg);
+       void __iomem *port_mmio = ahci_port_base(link->ap);
+       int offset = ahci_scr_offset(link->ap, sc_reg);
 
        if (offset) {
                writel(val, port_mmio + offset);
@@ -973,7 +974,7 @@ static void ahci_disable_alpm(struct ata_port *ap)
        writel(PORT_IRQ_PHYRDY, port_mmio + PORT_IRQ_STAT);
 
        /* go ahead and clean out PhyRdy Change from Serror too */
-       ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18)));
+       ahci_scr_write(&ap->link, SCR_ERROR, ((1 << 16) | (1 << 18)));
 
        /*
         * 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)
        ata_ehi_push_desc(host_ehi, "irq_stat 0x%08x", irq_stat);
 
        /* AHCI needs SError cleared; otherwise, it might lock up */
-       ahci_scr_read(ap, SCR_ERROR, &serror);
-       ahci_scr_write(ap, SCR_ERROR, serror);
+       ahci_scr_read(&ap->link, SCR_ERROR, &serror);
+       ahci_scr_write(&ap->link, SCR_ERROR, serror);
        host_ehi->serror |= serror;
 
        /* some controllers set IRQ_IF_ERR on device errors, ignore it */
@@ -2027,7 +2028,7 @@ static void ahci_port_intr(struct ata_port *ap)
        if ((hpriv->flags & AHCI_HFLAG_NO_HOTPLUG) &&
                (status & PORT_IRQ_PHYRDY)) {
                status &= ~PORT_IRQ_PHYRDY;
-               ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18)));
+               ahci_scr_write(&ap->link, SCR_ERROR, ((1 << 16) | (1 << 18)));
        }
 
        if (unlikely(status & PORT_IRQ_ERROR)) {
index e6b4606e36b68a51448d73b755aab75d91e0fa80..e9e32ed6b1a34ccbd0e61dd846622234b07ca2f5 100644 (file)
@@ -165,8 +165,10 @@ static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev);
 static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev);
 static int ich_pata_cable_detect(struct ata_port *ap);
 static u8 piix_vmw_bmdma_status(struct ata_port *ap);
-static int piix_sidpr_scr_read(struct ata_port *ap, unsigned int reg, u32 *val);
-static int piix_sidpr_scr_write(struct ata_port *ap, unsigned int reg, u32 val);
+static int piix_sidpr_scr_read(struct ata_link *link,
+                              unsigned int reg, u32 *val);
+static int piix_sidpr_scr_write(struct ata_link *link,
+                               unsigned int reg, u32 val);
 #ifdef CONFIG_PM
 static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
 static int piix_pci_device_resume(struct pci_dev *pdev);
@@ -278,12 +280,15 @@ static const struct pci_device_id piix_pci_tbl[] = {
        /* SATA Controller IDE (PCH) */
        { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
        /* SATA Controller IDE (PCH) */
+       { 0x8086, 0x3b21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
+       /* SATA Controller IDE (PCH) */
        { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
        /* SATA Controller IDE (PCH) */
+       { 0x8086, 0x3b28, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
+       /* SATA Controller IDE (PCH) */
        { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
        /* SATA Controller IDE (PCH) */
        { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
-
        { }     /* terminate list */
 };
 
@@ -582,6 +587,7 @@ static const struct ich_laptop ich_laptop[] = {
        { 0x27DF, 0x1025, 0x0110 },     /* ICH7 on Acer 3682WLMi */
        { 0x27DF, 0x1043, 0x1267 },     /* ICH7 on Asus W5F */
        { 0x27DF, 0x103C, 0x30A1 },     /* ICH7 on HP Compaq nc2400 */
+       { 0x27DF, 0x1071, 0xD221 },     /* ICH7 on Hercules EC-900 */
        { 0x24CA, 0x1025, 0x0061 },     /* ICH4 on ACER Aspire 2023WLMi */
        { 0x24CA, 0x1025, 0x003d },     /* ICH4 on ACER TM290 */
        { 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)
  * Serial ATA Index/Data Pair Superset Registers access
  *
  * Beginning from ICH8, there's a sane way to access SCRs using index
- * and data register pair located at BAR5.  This creates an
- * interesting problem of mapping two SCRs to one port.
- *
- * Although they have separate SCRs, the master and slave aren't
- * independent enough to be treated as separate links - e.g. softreset
- * resets both.  Also, there's no protocol defined for hard resetting
- * singled device sharing the virtual port (no defined way to acquire
- * device signature).  This is worked around by merging the SCR values
- * into one sensible value and requesting follow-up SRST after
- * hardreset.
- *
- * SCR merging is perfomed in nibbles which is the unit contents in
- * SCRs are organized.  If two values are equal, the value is used.
- * When they differ, merge table which lists precedence of possible
- * values is consulted and the first match or the last entry when
- * nothing matches is used.  When there's no merge table for the
- * specific nibble, value from the first port is used.
+ * and data register pair located at BAR5 which means that we have
+ * separate SCRs for master and slave.  This is handled using libata
+ * slave_link facility.
  */
 static const int piix_sidx_map[] = {
        [SCR_STATUS]    = 0,
@@ -909,120 +901,38 @@ static const int piix_sidx_map[] = {
        [SCR_CONTROL]   = 1,
 };
 
-static void piix_sidpr_sel(struct ata_device *dev, unsigned int reg)
+static void piix_sidpr_sel(struct ata_link *link, unsigned int reg)
 {
-       struct ata_port *ap = dev->link->ap;
+       struct ata_port *ap = link->ap;
        struct piix_host_priv *hpriv = ap->host->private_data;
 
-       iowrite32(((ap->port_no * 2 + dev->devno) << 8) | piix_sidx_map[reg],
+       iowrite32(((ap->port_no * 2 + link->pmp) << 8) | piix_sidx_map[reg],
                  hpriv->sidpr + PIIX_SIDPR_IDX);
 }
 
-static int piix_sidpr_read(struct ata_device *dev, unsigned int reg)
-{
-       struct piix_host_priv *hpriv = dev->link->ap->host->private_data;
-
-       piix_sidpr_sel(dev, reg);
-       return ioread32(hpriv->sidpr + PIIX_SIDPR_DATA);
-}
-
-static void piix_sidpr_write(struct ata_device *dev, unsigned int reg, u32 val)
-{
-       struct piix_host_priv *hpriv = dev->link->ap->host->private_data;
-
-       piix_sidpr_sel(dev, reg);
-       iowrite32(val, hpriv->sidpr + PIIX_SIDPR_DATA);
-}
-
-static u32 piix_merge_scr(u32 val0, u32 val1, const int * const *merge_tbl)
-{
-       u32 val = 0;
-       int i, mi;
-
-       for (i = 0, mi = 0; i < 32 / 4; i++) {
-               u8 c0 = (val0 >> (i * 4)) & 0xf;
-               u8 c1 = (val1 >> (i * 4)) & 0xf;
-               u8 merged = c0;
-               const int *cur;
-
-               /* if no merge preference, assume the first value */
-               cur = merge_tbl[mi];
-               if (!cur)
-                       goto done;
-               mi++;
-
-               /* if two values equal, use it */
-               if (c0 == c1)
-                       goto done;
-
-               /* choose the first match or the last from the merge table */
-               while (*cur != -1) {
-                       if (c0 == *cur || c1 == *cur)
-                               break;
-                       cur++;
-               }
-               if (*cur == -1)
-                       cur--;
-               merged = *cur;
-       done:
-               val |= merged << (i * 4);
-       }
-
-       return val;
-}
-
-static int piix_sidpr_scr_read(struct ata_port *ap, unsigned int reg, u32 *val)
+static int piix_sidpr_scr_read(struct ata_link *link,
+                              unsigned int reg, u32 *val)
 {
-       const int * const sstatus_merge_tbl[] = {
-               /* DET */ (const int []){ 1, 3, 0, 4, 3, -1 },
-               /* SPD */ (const int []){ 2, 1, 0, -1 },
-               /* IPM */ (const int []){ 6, 2, 1, 0, -1 },
-               NULL,
-       };
-       const int * const scontrol_merge_tbl[] = {
-               /* DET */ (const int []){ 1, 0, 4, 0, -1 },
-               /* SPD */ (const int []){ 0, 2, 1, 0, -1 },
-               /* IPM */ (const int []){ 0, 1, 2, 3, 0, -1 },
-               NULL,
-       };
-       u32 v0, v1;
+       struct piix_host_priv *hpriv = link->ap->host->private_data;
 
        if (reg >= ARRAY_SIZE(piix_sidx_map))
                return -EINVAL;
 
-       if (!(ap->flags & ATA_FLAG_SLAVE_POSS)) {
-               *val = piix_sidpr_read(&ap->link.device[0], reg);
-               return 0;
-       }
-
-       v0 = piix_sidpr_read(&ap->link.device[0], reg);
-       v1 = piix_sidpr_read(&ap->link.device[1], reg);
-
-       switch (reg) {
-       case SCR_STATUS:
-               *val = piix_merge_scr(v0, v1, sstatus_merge_tbl);
-               break;
-       case SCR_ERROR:
-               *val = v0 | v1;
-               break;
-       case SCR_CONTROL:
-               *val = piix_merge_scr(v0, v1, scontrol_merge_tbl);
-               break;
-       }
-
+       piix_sidpr_sel(link, reg);
+       *val = ioread32(hpriv->sidpr + PIIX_SIDPR_DATA);
        return 0;
 }
 
-static int piix_sidpr_scr_write(struct ata_port *ap, unsigned int reg, u32 val)
+static int piix_sidpr_scr_write(struct ata_link *link,
+                               unsigned int reg, u32 val)
 {
+       struct piix_host_priv *hpriv = link->ap->host->private_data;
+
        if (reg >= ARRAY_SIZE(piix_sidx_map))
                return -EINVAL;
 
-       piix_sidpr_write(&ap->link.device[0], reg, val);
-
-       if (ap->flags & ATA_FLAG_SLAVE_POSS)
-               piix_sidpr_write(&ap->link.device[1], reg, val);
-
+       piix_sidpr_sel(link, reg);
+       iowrite32(val, hpriv->sidpr + PIIX_SIDPR_DATA);
        return 0;
 }
 
@@ -1363,28 +1273,28 @@ static const int *__devinit piix_init_sata_map(struct pci_dev *pdev,
        return map;
 }
 
-static void __devinit piix_init_sidpr(struct ata_host *host)
+static int __devinit piix_init_sidpr(struct ata_host *host)
 {
        struct pci_dev *pdev = to_pci_dev(host->dev);
        struct piix_host_priv *hpriv = host->private_data;
-       struct ata_device *dev0 = &host->ports[0]->link.device[0];
+       struct ata_link *link0 = &host->ports[0]->link;
        u32 scontrol;
-       int i;
+       int i, rc;
 
        /* check for availability */
        for (i = 0; i < 4; i++)
                if (hpriv->map[i] == IDE)
-                       return;
+                       return 0;
 
        if (!(host->ports[0]->flags & PIIX_FLAG_SIDPR))
-               return;
+               return 0;
 
        if (pci_resource_start(pdev, PIIX_SIDPR_BAR) == 0 ||
            pci_resource_len(pdev, PIIX_SIDPR_BAR) != PIIX_SIDPR_LEN)
-               return;
+               return 0;
 
        if (pcim_iomap_regions(pdev, 1 << PIIX_SIDPR_BAR, DRV_NAME))
-               return;
+               return 0;
 
        hpriv->sidpr = pcim_iomap_table(pdev)[PIIX_SIDPR_BAR];
 
@@ -1392,7 +1302,7 @@ static void __devinit piix_init_sidpr(struct ata_host *host)
         * Give it a test drive by inhibiting power save modes which
         * we'll do anyway.
         */
-       scontrol = piix_sidpr_read(dev0, SCR_CONTROL);
+       piix_sidpr_scr_read(link0, SCR_CONTROL, &scontrol);
 
        /* if IPM is already 3, SCR access is probably working.  Don't
         * un-inhibit power save modes as BIOS might have inhibited
@@ -1400,18 +1310,30 @@ static void __devinit piix_init_sidpr(struct ata_host *host)
         */
        if ((scontrol & 0xf00) != 0x300) {
                scontrol |= 0x300;
-               piix_sidpr_write(dev0, SCR_CONTROL, scontrol);
-               scontrol = piix_sidpr_read(dev0, SCR_CONTROL);
+               piix_sidpr_scr_write(link0, SCR_CONTROL, scontrol);
+               piix_sidpr_scr_read(link0, SCR_CONTROL, &scontrol);
 
                if ((scontrol & 0xf00) != 0x300) {
                        dev_printk(KERN_INFO, host->dev, "SCR access via "
                                   "SIDPR is available but doesn't work\n");
-                       return;
+                       return 0;
                }
        }
 
-       host->ports[0]->ops = &piix_sidpr_sata_ops;
-       host->ports[1]->ops = &piix_sidpr_sata_ops;
+       /* okay, SCRs available, set ops and ask libata for slave_link */
+       for (i = 0; i < 2; i++) {
+               struct ata_port *ap = host->ports[i];
+
+               ap->ops = &piix_sidpr_sata_ops;
+
+               if (ap->flags & ATA_FLAG_SLAVE_POSS) {
+                       rc = ata_slave_link_init(ap);
+                       if (rc)
+                               return rc;
+               }
+       }
+
+       return 0;
 }
 
 static void piix_iocfg_bit18_quirk(struct pci_dev *pdev)
@@ -1521,7 +1443,9 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
        /* initialize controller */
        if (port_flags & ATA_FLAG_SATA) {
                piix_init_pcs(host, piix_map_db_table[ent->driver_data]);
-               piix_init_sidpr(host);
+               rc = piix_init_sidpr(host);
+               if (rc)
+                       return rc;
        }
 
        /* apply IOCFG bit18 quirk */
index 79e3a8e7a84a36de25dea2bcb7161b7bcdcc6fd5..1ee9499bd343717ca95252a775c01d77ef3f892f 100644 (file)
@@ -163,6 +163,67 @@ MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 
 
+/*
+ * Iterator helpers.  Don't use directly.
+ *
+ * LOCKING:
+ * Host lock or EH context.
+ */
+struct ata_link *__ata_port_next_link(struct ata_port *ap,
+                                     struct ata_link *link, bool dev_only)
+{
+       /* NULL link indicates start of iteration */
+       if (!link) {
+               if (dev_only && sata_pmp_attached(ap))
+                       return ap->pmp_link;
+               return &ap->link;
+       }
+
+       /* we just iterated over the host master link, what's next? */
+       if (link == &ap->link) {
+               if (!sata_pmp_attached(ap)) {
+                       if (unlikely(ap->slave_link) && !dev_only)
+                               return ap->slave_link;
+                       return NULL;
+               }
+               return ap->pmp_link;
+       }
+
+       /* slave_link excludes PMP */
+       if (unlikely(link == ap->slave_link))
+               return NULL;
+
+       /* iterate to the next PMP link */
+       if (++link < ap->pmp_link + ap->nr_pmp_links)
+               return link;
+       return NULL;
+}
+
+/**
+ *     ata_dev_phys_link - find physical link for a device
+ *     @dev: ATA device to look up physical link for
+ *
+ *     Look up physical link which @dev is attached to.  Note that
+ *     this is different from @dev->link only when @dev is on slave
+ *     link.  For all other cases, it's the same as @dev->link.
+ *
+ *     LOCKING:
+ *     Don't care.
+ *
+ *     RETURNS:
+ *     Pointer to the found physical link.
+ */
+struct ata_link *ata_dev_phys_link(struct ata_device *dev)
+{
+       struct ata_port *ap = dev->link->ap;
+
+       if (!ap->slave_link)
+               return dev->link;
+       if (!dev->devno)
+               return &ap->link;
+       return ap->slave_link;
+}
+
 /**
  *     ata_force_cbl - force cable type according to libata.force
  *     @ap: ATA port of interest
@@ -206,7 +267,8 @@ void ata_force_cbl(struct ata_port *ap)
  *     the host link and all fan-out ports connected via PMP.  If the
  *     device part is specified as 0 (e.g. 1.00:), it specifies the
  *     first fan-out link not the host link.  Device number 15 always
- *     points to the host link whether PMP is attached or not.
+ *     points to the host link whether PMP is attached or not.  If the
+ *     controller has slave link, device number 16 points to it.
  *
  *     LOCKING:
  *     EH context.
@@ -214,12 +276,11 @@ void ata_force_cbl(struct ata_port *ap)
 static void ata_force_link_limits(struct ata_link *link)
 {
        bool did_spd = false;
-       int linkno, i;
+       int linkno = link->pmp;
+       int i;
 
        if (ata_is_host_link(link))
-               linkno = 15;
-       else
-               linkno = link->pmp;
+               linkno += 15;
 
        for (i = ata_force_tbl_size - 1; i >= 0; i--) {
                const struct ata_force_ent *fe = &ata_force_tbl[i];
@@ -266,9 +327,9 @@ static void ata_force_xfermask(struct ata_device *dev)
        int alt_devno = devno;
        int i;
 
-       /* allow n.15 for the first device attached to host port */
-       if (ata_is_host_link(dev->link) && devno == 0)
-               alt_devno = 15;
+       /* allow n.15/16 for devices attached to host port */
+       if (ata_is_host_link(dev->link))
+               alt_devno += 15;
 
        for (i = ata_force_tbl_size - 1; i >= 0; i--) {
                const struct ata_force_ent *fe = &ata_force_tbl[i];
@@ -320,9 +381,9 @@ static void ata_force_horkage(struct ata_device *dev)
        int alt_devno = devno;
        int i;
 
-       /* allow n.15 for the first device attached to host port */
-       if (ata_is_host_link(dev->link) && devno == 0)
-               alt_devno = 15;
+       /* allow n.15/16 for devices attached to host port */
+       if (ata_is_host_link(dev->link))
+               alt_devno += 15;
 
        for (i = 0; i < ata_force_tbl_size; i++) {
                const struct ata_force_ent *fe = &ata_force_tbl[i];
@@ -2681,7 +2742,7 @@ static void sata_print_link_status(struct ata_link *link)
                return;
        sata_scr_read(link, SCR_CONTROL, &scontrol);
 
-       if (ata_link_online(link)) {
+       if (ata_phys_link_online(link)) {
                tmp = (sstatus >> 4) & 0xf;
                ata_link_printk(link, KERN_INFO,
                                "SATA link up %s (SStatus %X SControl %X)\n",
@@ -3372,6 +3433,12 @@ int ata_wait_ready(struct ata_link *link, unsigned long deadline,
        unsigned long nodev_deadline = ata_deadline(start, ATA_TMOUT_FF_WAIT);
        int warned = 0;
 
+       /* Slave readiness can't be tested separately from master.  On
+        * M/S emulation configuration, this function should be called
+        * only on the master and it will handle both master and slave.
+        */
+       WARN_ON(link == link->ap->slave_link);
+
        if (time_after(nodev_deadline, deadline))
                nodev_deadline = deadline;
 
@@ -3593,7 +3660,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
        }
 
        /* no point in trying softreset on offline link */
-       if (ata_link_offline(link))
+       if (ata_phys_link_offline(link))
                ehc->i.action &= ~ATA_EH_SOFTRESET;
 
        return 0;
@@ -3671,7 +3738,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
        if (rc)
                goto out;
        /* if link is offline nothing more to do */
-       if (ata_link_offline(link))
+       if (ata_phys_link_offline(link))
                goto out;
 
        /* Link is online.  From this point, -ENODEV too is an error. */
@@ -4868,10 +4935,8 @@ int sata_scr_valid(struct ata_link *link)
 int sata_scr_read(struct ata_link *link, int reg, u32 *val)
 {
        if (ata_is_host_link(link)) {
-               struct ata_port *ap = link->ap;
-
                if (sata_scr_valid(link))
-                       return ap->ops->scr_read(ap, reg, val);
+                       return link->ap->ops->scr_read(link, reg, val);
                return -EOPNOTSUPP;
        }
 
@@ -4897,10 +4962,8 @@ int sata_scr_read(struct ata_link *link, int reg, u32 *val)
 int sata_scr_write(struct ata_link *link, int reg, u32 val)
 {
        if (ata_is_host_link(link)) {
-               struct ata_port *ap = link->ap;
-
                if (sata_scr_valid(link))
-                       return ap->ops->scr_write(ap, reg, val);
+                       return link->ap->ops->scr_write(link, reg, val);
                return -EOPNOTSUPP;
        }
 
@@ -4925,13 +4988,12 @@ int sata_scr_write(struct ata_link *link, int reg, u32 val)
 int sata_scr_write_flush(struct ata_link *link, int reg, u32 val)
 {
        if (ata_is_host_link(link)) {
-               struct ata_port *ap = link->ap;
                int rc;
 
                if (sata_scr_valid(link)) {
-                       rc = ap->ops->scr_write(ap, reg, val);
+                       rc = link->ap->ops->scr_write(link, reg, val);
                        if (rc == 0)
-                               rc = ap->ops->scr_read(ap, reg, &val);
+                               rc = link->ap->ops->scr_read(link, reg, &val);
                        return rc;
                }
                return -EOPNOTSUPP;
@@ -4941,7 +5003,7 @@ int sata_scr_write_flush(struct ata_link *link, int reg, u32 val)
 }
 
 /**
- *     ata_link_online - test whether the given link is online
+ *     ata_phys_link_online - test whether the given link is online
  *     @link: ATA link to test
  *
  *     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)
  *     None.
  *
  *     RETURNS:
- *     1 if the port online status is available and online.
+ *     True if the port online status is available and online.
  */
-int ata_link_online(struct ata_link *link)
+bool ata_phys_link_online(struct ata_link *link)
 {
        u32 sstatus;
 
        if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
            (sstatus & 0xf) == 0x3)
-               return 1;
-       return 0;
+               return true;
+       return false;
 }
 
 /**
- *     ata_link_offline - test whether the given link is offline
+ *     ata_phys_link_offline - test whether the given link is offline
  *     @link: ATA link to test
  *
  *     Test whether @link is offline.  Note that this function
@@ -4976,16 +5038,68 @@ int ata_link_online(struct ata_link *link)
  *     None.
  *
  *     RETURNS:
- *     1 if the port offline status is available and offline.
+ *     True if the port offline status is available and offline.
  */
-int ata_link_offline(struct ata_link *link)
+bool ata_phys_link_offline(struct ata_link *link)
 {
        u32 sstatus;
 
        if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
            (sstatus & 0xf) != 0x3)
-               return 1;
-       return 0;
+               return true;
+       return false;
+}
+
+/**
+ *     ata_link_online - test whether the given link is online
+ *     @link: ATA link to test
+ *
+ *     Test whether @link is online.  This is identical to
+ *     ata_phys_link_online() when there's no slave link.  When
+ *     there's a slave link, this function should only be called on
+ *     the master link and will return true if any of M/S links is
+ *     online.
+ *
+ *     LOCKING:
+ *     None.
+ *
+ *     RETURNS:
+ *     True if the port online status is available and online.
+ */
+bool ata_link_online(struct ata_link *link)
+{
+       struct ata_link *slave = link->ap->slave_link;
+
+       WARN_ON(link == slave); /* shouldn't be called on slave link */
+
+       return ata_phys_link_online(link) ||
+               (slave && ata_phys_link_online(slave));
+}
+
+/**
+ *     ata_link_offline - test whether the given link is offline
+ *     @link: ATA link to test
+ *
+ *     Test whether @link is offline.  This is identical to
+ *     ata_phys_link_offline() when there's no slave link.  When
+ *     there's a slave link, this function should only be called on
+ *     the master link and will return true if both M/S links are
+ *     offline.
+ *
+ *     LOCKING:
+ *     None.
+ *
+ *     RETURNS:
+ *     True if the port offline status is available and offline.
+ */
+bool ata_link_offline(struct ata_link *link)
+{
+       struct ata_link *slave = link->ap->slave_link;
+
+       WARN_ON(link == slave); /* shouldn't be called on slave link */
+
+       return ata_phys_link_offline(link) &&
+               (!slave || ata_phys_link_offline(slave));
 }
 
 #ifdef CONFIG_PM
@@ -5127,11 +5241,11 @@ int ata_port_start(struct ata_port *ap)
  */
 void ata_dev_init(struct ata_device *dev)
 {
-       struct ata_link *link = dev->link;
+       struct ata_link *link = ata_dev_phys_link(dev);
        struct ata_port *ap = link->ap;
        unsigned long flags;
 
-       /* SATA spd limit is bound to the first device */
+       /* SATA spd limit is bound to the attached device, reset together */
        link->sata_spd_limit = link->hw_sata_spd_limit;
        link->sata_spd = 0;
 
@@ -5264,6 +5378,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
        INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan);
        INIT_LIST_HEAD(&ap->eh_done_q);
        init_waitqueue_head(&ap->eh_wait_q);
+       init_completion(&ap->park_req_pending);
        init_timer_deferrable(&ap->fastdrain_timer);
        ap->fastdrain_timer.function = ata_eh_fastdrain_timerfn;
        ap->fastdrain_timer.data = (unsigned long)ap;
@@ -5294,6 +5409,7 @@ static void ata_host_release(struct device *gendev, void *res)
                        scsi_host_put(ap->scsi_host);
 
                kfree(ap->pmp_link);
+               kfree(ap->slave_link);
                kfree(ap);
                host->ports[i] = NULL;
        }
@@ -5414,6 +5530,68 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev,
        return host;
 }
 
+/**
+ *     ata_slave_link_init - initialize slave link
+ *     @ap: port to initialize slave link for
+ *
+ *     Create and initialize slave link for @ap.  This enables slave
+ *     link handling on the port.
+ *
+ *     In libata, a port contains links and a link contains devices.
+ *     There is single host link but if a PMP is attached to it,
+ *     there can be multiple fan-out links.  On SATA, there's usually
+ *     a single device connected to a link but PATA and SATA
+ *     controllers emulating TF based interface can have two - master
+ *     and slave.
+ *
+ *     However, there are a few controllers which don't fit into this
+ *     abstraction too well - SATA controllers which emulate TF
+ *     interface with both master and slave devices but also have
+ *     separate SCR register sets for each device.  These controllers
+ *     need separate links for physical link handling
+ *     (e.g. onlineness, link speed) but should be treated like a
+ *     traditional M/S controller for everything else (e.g. command
+ *     issue, softreset).
+ *
+ *     slave_link is libata's way of handling this class of
+ *     controllers without impacting core layer too much.  For
+ *     anything other than physical link handling, the default host
+ *     link is used for both master and slave.  For physical link
+ *     handling, separate @ap->slave_link is used.  All dirty details
+ *     are implemented inside libata core layer.  From LLD's POV, the
+ *     only difference is that prereset, hardreset and postreset are
+ *     called once more for the slave link, so the reset sequence
+ *     looks like the following.
+ *
+ *     prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) ->
+ *     softreset(M) -> postreset(M) -> postreset(S)
+ *
+ *     Note that softreset is called only for the master.  Softreset
+ *     resets both M/S by definition, so SRST on master should handle
+ *     both (the standard method will work just fine).
+ *
+ *     LOCKING:
+ *     Should be called before host is registered.
+ *
+ *     RETURNS:
+ *     0 on success, -errno on failure.
+ */
+int ata_slave_link_init(struct ata_port *ap)
+{
+       struct ata_link *link;
+
+       WARN_ON(ap->slave_link);
+       WARN_ON(ap->flags & ATA_FLAG_PMP);
+
+       link = kzalloc(sizeof(*link), GFP_KERNEL);
+       if (!link)
+               return -ENOMEM;
+
+       ata_link_init(ap, link, 1);
+       ap->slave_link = link;
+       return 0;
+}
+
 static void ata_host_stop(struct device *gendev, void *res)
 {
        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)
 
                /* init sata_spd_limit to the current value */
                sata_link_init_spd(&ap->link);
+               if (ap->slave_link)
+                       sata_link_init_spd(ap->slave_link);
 
                /* print per-port info to dmesg */
                xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask,
@@ -6260,10 +6440,12 @@ EXPORT_SYMBOL_GPL(ata_base_port_ops);
 EXPORT_SYMBOL_GPL(sata_port_ops);
 EXPORT_SYMBOL_GPL(ata_dummy_port_ops);
 EXPORT_SYMBOL_GPL(ata_dummy_port_info);
+EXPORT_SYMBOL_GPL(__ata_port_next_link);
 EXPORT_SYMBOL_GPL(ata_std_bios_param);
 EXPORT_SYMBOL_GPL(ata_host_init);
 EXPORT_SYMBOL_GPL(ata_host_alloc);
 EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo);
+EXPORT_SYMBOL_GPL(ata_slave_link_init);
 EXPORT_SYMBOL_GPL(ata_host_start);
 EXPORT_SYMBOL_GPL(ata_host_register);
 EXPORT_SYMBOL_GPL(ata_host_activate);
index c1db2f234d2e409d21851c91c77a292cc631406e..f2dd99122bd6fc43652f9f9c948d61a33745e5bc 100644 (file)
@@ -79,6 +79,8 @@ enum {
         */
        ATA_EH_PRERESET_TIMEOUT         = 10000,
        ATA_EH_FASTDRAIN_INTERVAL       =  3000,
+
+       ATA_EH_UA_TRIES                 = 5,
 };
 
 /* The following table determines how we sequence resets.  Each entry
@@ -1356,6 +1358,37 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
        return 0;
 }
 
+/**
+ *     atapi_eh_tur - perform ATAPI TEST_UNIT_READY
+ *     @dev: target ATAPI device
+ *     @r_sense_key: out parameter for sense_key
+ *
+ *     Perform ATAPI TEST_UNIT_READY.
+ *
+ *     LOCKING:
+ *     EH context (may sleep).
+ *
+ *     RETURNS:
+ *     0 on success, AC_ERR_* mask on failure.
+ */
+static unsigned int atapi_eh_tur(struct ata_device *dev, u8 *r_sense_key)
+{
+       u8 cdb[ATAPI_CDB_LEN] = { TEST_UNIT_READY, 0, 0, 0, 0, 0 };
+       struct ata_taskfile tf;
+       unsigned int err_mask;
+
+       ata_tf_init(dev, &tf);
+
+       tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
+       tf.command = ATA_CMD_PACKET;
+       tf.protocol = ATAPI_PROT_NODATA;
+
+       err_mask = ata_exec_internal(dev, &tf, cdb, DMA_NONE, NULL, 0, 0);
+       if (err_mask == AC_ERR_DEV)
+               *r_sense_key = tf.feature >> 4;
+       return err_mask;
+}
+
 /**
  *     atapi_eh_request_sense - perform ATAPI REQUEST_SENSE
  *     @dev: device to perform REQUEST_SENSE to
@@ -1756,7 +1789,7 @@ static unsigned int ata_eh_speed_down_verdict(struct ata_device *dev)
 static unsigned int ata_eh_speed_down(struct ata_device *dev,
                                unsigned int eflags, unsigned int err_mask)
 {
-       struct ata_link *link = dev->link;
+       struct ata_link *link = ata_dev_phys_link(dev);
        int xfer_ok = 0;
        unsigned int verdict;
        unsigned int action = 0;
@@ -1880,7 +1913,8 @@ static void ata_eh_link_autopsy(struct ata_link *link)
        for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
                struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
 
-               if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link)
+               if (!(qc->flags & ATA_QCFLAG_FAILED) ||
+                   ata_dev_phys_link(qc->dev) != link)
                        continue;
 
                /* inherit upper level err_mask */
@@ -1967,6 +2001,23 @@ void ata_eh_autopsy(struct ata_port *ap)
        ata_port_for_each_link(link, ap)
                ata_eh_link_autopsy(link);
 
+       /* Handle the frigging slave link.  Autopsy is done similarly
+        * but actions and flags are transferred over to the master
+        * link and handled from there.
+        */
+       if (ap->slave_link) {
+               struct ata_eh_context *mehc = &ap->link.eh_context;
+               struct ata_eh_context *sehc = &ap->slave_link->eh_context;
+
+               ata_eh_link_autopsy(ap->slave_link);
+
+               ata_eh_about_to_do(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS);
+               mehc->i.action          |= sehc->i.action;
+               mehc->i.dev_action[1]   |= sehc->i.dev_action[1];
+               mehc->i.flags           |= sehc->i.flags;
+               ata_eh_done(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS);
+       }
+
        /* Autopsy of fanout ports can affect host link autopsy.
         * Perform host link autopsy last.
         */
@@ -2001,7 +2052,8 @@ static void ata_eh_link_report(struct ata_link *link)
        for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
                struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
 
-               if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link ||
+               if (!(qc->flags & ATA_QCFLAG_FAILED) ||
+                   ata_dev_phys_link(qc->dev) != link ||
                    ((qc->flags & ATA_QCFLAG_QUIET) &&
                     qc->err_mask == AC_ERR_DEV))
                        continue;
@@ -2068,7 +2120,7 @@ static void ata_eh_link_report(struct ata_link *link)
                char cdb_buf[70] = "";
 
                if (!(qc->flags & ATA_QCFLAG_FAILED) ||
-                   qc->dev->link != link || !qc->err_mask)
+                   ata_dev_phys_link(qc->dev) != link || !qc->err_mask)
                        continue;
 
                if (qc->dma_dir != DMA_NONE) {
@@ -2160,12 +2212,14 @@ void ata_eh_report(struct ata_port *ap)
 }
 
 static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset,
-                       unsigned int *classes, unsigned long deadline)
+                       unsigned int *classes, unsigned long deadline,
+                       bool clear_classes)
 {
        struct ata_device *dev;
 
-       ata_link_for_each_dev(dev, link)
-               classes[dev->devno] = ATA_DEV_UNKNOWN;
+       if (clear_classes)
+               ata_link_for_each_dev(dev, link)
+                       classes[dev->devno] = ATA_DEV_UNKNOWN;
 
        return reset(link, classes, deadline);
 }
@@ -2187,17 +2241,20 @@ int ata_eh_reset(struct ata_link *link, int classify,
                 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
 {
        struct ata_port *ap = link->ap;
+       struct ata_link *slave = ap->slave_link;
        struct ata_eh_context *ehc = &link->eh_context;
+       struct ata_eh_context *sehc = &slave->eh_context;
        unsigned int *classes = ehc->classes;
        unsigned int lflags = link->flags;
        int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
        int max_tries = 0, try = 0;
+       struct ata_link *failed_link;
        struct ata_device *dev;
        unsigned long deadline, now;
        ata_reset_fn_t reset;
        unsigned long flags;
        u32 sstatus;
-       int nr_known, rc;
+       int nr_unknown, rc;
 
        /*
         * Prepare to reset
@@ -2252,8 +2309,30 @@ int ata_eh_reset(struct ata_link *link, int classify,
        }
 
        if (prereset) {
-               rc = prereset(link,
-                             ata_deadline(jiffies, ATA_EH_PRERESET_TIMEOUT));
+               unsigned long deadline = ata_deadline(jiffies,
+                                                     ATA_EH_PRERESET_TIMEOUT);
+
+               if (slave) {
+                       sehc->i.action &= ~ATA_EH_RESET;
+                       sehc->i.action |= ehc->i.action;
+               }
+
+               rc = prereset(link, deadline);
+
+               /* If present, do prereset on slave link too.  Reset
+                * is skipped iff both master and slave links report
+                * -ENOENT or clear ATA_EH_RESET.
+                */
+               if (slave && (rc == 0 || rc == -ENOENT)) {
+                       int tmp;
+
+                       tmp = prereset(slave, deadline);
+                       if (tmp != -ENOENT)
+                               rc = tmp;
+
+                       ehc->i.action |= sehc->i.action;
+               }
+
                if (rc) {
                        if (rc == -ENOENT) {
                                ata_link_printk(link, KERN_DEBUG,
@@ -2302,25 +2381,51 @@ int ata_eh_reset(struct ata_link *link, int classify,
                else
                        ehc->i.flags |= ATA_EHI_DID_SOFTRESET;
 
-               rc = ata_do_reset(link, reset, classes, deadline);
-               if (rc && rc != -EAGAIN)
+               rc = ata_do_reset(link, reset, classes, deadline, true);
+               if (rc && rc != -EAGAIN) {
+                       failed_link = link;
                        goto fail;
+               }
+
+               /* hardreset slave link if existent */
+               if (slave && reset == hardreset) {
+                       int tmp;
+
+                       if (verbose)
+                               ata_link_printk(slave, KERN_INFO,
+                                               "hard resetting link\n");
 
+                       ata_eh_about_to_do(slave, NULL, ATA_EH_RESET);
+                       tmp = ata_do_reset(slave, reset, classes, deadline,
+                                          false);
+                       switch (tmp) {
+                       case -EAGAIN:
+                               rc = -EAGAIN;
+                       case 0:
+                               break;
+                       default:
+                               failed_link = slave;
+                               rc = tmp;
+                               goto fail;
+                       }
+               }
+
+               /* perform follow-up SRST if necessary */
                if (reset == hardreset &&
                    ata_eh_followup_srst_needed(link, rc, classes)) {
-                       /* okay, let's do follow-up softreset */
                        reset = softreset;
 
                        if (!reset) {
                                ata_link_printk(link, KERN_ERR,
                                                "follow-up softreset required "
                                                "but no softreset avaliable\n");
+                               failed_link = link;
                                rc = -EINVAL;
                                goto fail;
                        }
 
                        ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
-                       rc = ata_do_reset(link, reset, classes, deadline);
+                       rc = ata_do_reset(link, reset, classes, deadline, true);
                }
        } else {
                if (verbose)
@@ -2341,7 +2446,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
                dev->pio_mode = XFER_PIO_0;
                dev->flags &= ~ATA_DFLAG_SLEEPING;
 
-               if (ata_link_offline(link))
+               if (ata_phys_link_offline(ata_dev_phys_link(dev)))
                        continue;
 
                /* apply class override */
@@ -2354,6 +2459,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
        /* record current link speed */
        if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0)
                link->sata_spd = (sstatus >> 4) & 0xf;
+       if (slave && sata_scr_read(slave, SCR_STATUS, &sstatus) == 0)
+               slave->sata_spd = (sstatus >> 4) & 0xf;
 
        /* thaw the port */
        if (ata_is_host_link(link))
@@ -2366,12 +2473,17 @@ int ata_eh_reset(struct ata_link *link, int classify,
         * reset and here.  This race is mediated by cross checking
         * link onlineness and classification result later.
         */
-       if (postreset)
+       if (postreset) {
                postreset(link, classes);
+               if (slave)
+                       postreset(slave, classes);
+       }
 
        /* clear cached SError */
        spin_lock_irqsave(link->ap->lock, flags);
        link->eh_info.serror = 0;
+       if (slave)
+               slave->eh_info.serror = 0;
        spin_unlock_irqrestore(link->ap->lock, flags);
 
        /* Make sure onlineness and classification result correspond.
@@ -2381,19 +2493,21 @@ int ata_eh_reset(struct ata_link *link, int classify,
         * link onlineness and classification result, those conditions
         * can be reliably detected and retried.
         */
-       nr_known = 0;
+       nr_unknown = 0;
        ata_link_for_each_dev(dev, link) {
                /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */
-               if (classes[dev->devno] == ATA_DEV_UNKNOWN)
+               if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
                        classes[dev->devno] = ATA_DEV_NONE;
-               else
-                       nr_known++;
+                       if (ata_phys_link_online(ata_dev_phys_link(dev)))
+                               nr_unknown++;
+               }
        }
 
-       if (classify && !nr_known && ata_link_online(link)) {
+       if (classify && nr_unknown) {
                if (try < max_tries) {
                        ata_link_printk(link, KERN_WARNING, "link online but "
                                       "device misclassified, retrying\n");
+                       failed_link = link;
                        rc = -EAGAIN;
                        goto fail;
                }
@@ -2404,6 +2518,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
 
        /* reset successful, schedule revalidation */
        ata_eh_done(link, NULL, ATA_EH_RESET);
+       if (slave)
+               ata_eh_done(slave, NULL, ATA_EH_RESET);
        ehc->last_reset = jiffies;
        ehc->i.action |= ATA_EH_REVALIDATE;
 
@@ -2411,6 +2527,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
  out:
        /* clear hotplug flag */
        ehc->i.flags &= ~ATA_EHI_HOTPLUGGED;
+       if (slave)
+               sehc->i.flags &= ~ATA_EHI_HOTPLUGGED;
 
        spin_lock_irqsave(ap->lock, flags);
        ap->pflags &= ~ATA_PFLAG_RESETTING;
@@ -2431,7 +2549,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
        if (time_before(now, deadline)) {
                unsigned long delta = deadline - now;
 
-               ata_link_printk(link, KERN_WARNING,
+               ata_link_printk(failed_link, KERN_WARNING,
                        "reset failed (errno=%d), retrying in %u secs\n",
                        rc, DIV_ROUND_UP(jiffies_to_msecs(delta), 1000));
 
@@ -2439,13 +2557,92 @@ int ata_eh_reset(struct ata_link *link, int classify,
                        delta = schedule_timeout_uninterruptible(delta);
        }
 
-       if (rc == -EPIPE || try == max_tries - 1)
+       if (try == max_tries - 1) {
                sata_down_spd_limit(link);
+               if (slave)
+                       sata_down_spd_limit(slave);
+       } else if (rc == -EPIPE)
+               sata_down_spd_limit(failed_link);
+
        if (hardreset)
                reset = hardreset;
        goto retry;
 }
 
+static inline void ata_eh_pull_park_action(struct ata_port *ap)
+{
+       struct ata_link *link;
+       struct ata_device *dev;
+       unsigned long flags;
+
+       /*
+        * This function can be thought of as an extended version of
+        * ata_eh_about_to_do() specially crafted to accommodate the
+        * requirements of ATA_EH_PARK handling. Since the EH thread
+        * does not leave the do {} while () loop in ata_eh_recover as
+        * long as the timeout for a park request to *one* device on
+        * the port has not expired, and since we still want to pick
+        * up park requests to other devices on the same port or
+        * timeout updates for the same device, we have to pull
+        * ATA_EH_PARK actions from eh_info into eh_context.i
+        * ourselves at the beginning of each pass over the loop.
+        *
+        * Additionally, all write accesses to &ap->park_req_pending
+        * through INIT_COMPLETION() (see below) or complete_all()
+        * (see ata_scsi_park_store()) are protected by the host lock.
+        * As a result we have that park_req_pending.done is zero on
+        * exit from this function, i.e. when ATA_EH_PARK actions for
+        * *all* devices on port ap have been pulled into the
+        * respective eh_context structs. If, and only if,
+        * park_req_pending.done is non-zero by the time we reach
+        * wait_for_completion_timeout(), another ATA_EH_PARK action
+        * has been scheduled for at least one of the devices on port
+        * ap and we have to cycle over the do {} while () loop in
+        * ata_eh_recover() again.
+        */
+
+       spin_lock_irqsave(ap->lock, flags);
+       INIT_COMPLETION(ap->park_req_pending);
+       ata_port_for_each_link(link, ap) {
+               ata_link_for_each_dev(dev, link) {
+                       struct ata_eh_info *ehi = &link->eh_info;
+
+                       link->eh_context.i.dev_action[dev->devno] |=
+                               ehi->dev_action[dev->devno] & ATA_EH_PARK;
+                       ata_eh_clear_action(link, dev, ehi, ATA_EH_PARK);
+               }
+       }
+       spin_unlock_irqrestore(ap->lock, flags);
+}
+
+static void ata_eh_park_issue_cmd(struct ata_device *dev, int park)
+{
+       struct ata_eh_context *ehc = &dev->link->eh_context;
+       struct ata_taskfile tf;
+       unsigned int err_mask;
+
+       ata_tf_init(dev, &tf);
+       if (park) {
+               ehc->unloaded_mask |= 1 << dev->devno;
+               tf.command = ATA_CMD_IDLEIMMEDIATE;
+               tf.feature = 0x44;
+               tf.lbal = 0x4c;
+               tf.lbam = 0x4e;
+               tf.lbah = 0x55;
+       } else {
+               ehc->unloaded_mask &= ~(1 << dev->devno);
+               tf.command = ATA_CMD_CHK_POWER;
+       }
+
+       tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
+       tf.protocol |= ATA_PROT_NODATA;
+       err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
+       if (park && (err_mask || tf.lbal != 0xc4)) {
+               ata_dev_printk(dev, KERN_ERR, "head unload failed!\n");
+               ehc->unloaded_mask &= ~(1 << dev->devno);
+       }
+}
+
 static int ata_eh_revalidate_and_attach(struct ata_link *link,
                                        struct ata_device **r_failed_dev)
 {
@@ -2472,7 +2669,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
                if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) {
                        WARN_ON(dev->class == ATA_DEV_PMP);
 
-                       if (ata_link_offline(link)) {
+                       if (ata_phys_link_offline(ata_dev_phys_link(dev))) {
                                rc = -EIO;
                                goto err;
                        }
@@ -2610,6 +2807,53 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
        return rc;
 }
 
+/**
+ *     atapi_eh_clear_ua - Clear ATAPI UNIT ATTENTION after reset
+ *     @dev: ATAPI device to clear UA for
+ *
+ *     Resets and other operations can make an ATAPI device raise
+ *     UNIT ATTENTION which causes the next operation to fail.  This
+ *     function clears UA.
+ *
+ *     LOCKING:
+ *     EH context (may sleep).
+ *
+ *     RETURNS:
+ *     0 on success, -errno on failure.
+ */
+static int atapi_eh_clear_ua(struct ata_device *dev)
+{
+       int i;
+
+       for (i = 0; i < ATA_EH_UA_TRIES; i++) {
+               u8 sense_buffer[SCSI_SENSE_BUFFERSIZE];
+               u8 sense_key = 0;
+               unsigned int err_mask;
+
+               err_mask = atapi_eh_tur(dev, &sense_key);
+               if (err_mask != 0 && err_mask != AC_ERR_DEV) {
+                       ata_dev_printk(dev, KERN_WARNING, "TEST_UNIT_READY "
+                               "failed (err_mask=0x%x)\n", err_mask);
+                       return -EIO;
+               }
+
+               if (!err_mask || sense_key != UNIT_ATTENTION)
+                       return 0;
+
+               err_mask = atapi_eh_request_sense(dev, sense_buffer, sense_key);
+               if (err_mask) {
+                       ata_dev_printk(dev, KERN_WARNING, "failed to clear "
+                               "UNIT ATTENTION (err_mask=0x%x)\n", err_mask);
+                       return -EIO;
+               }
+       }
+
+       ata_dev_printk(dev, KERN_WARNING,
+               "UNIT ATTENTION persists after %d tries\n", ATA_EH_UA_TRIES);
+
+       return 0;
+}
+
 static int ata_link_nr_enabled(struct ata_link *link)
 {
        struct ata_device *dev;
@@ -2697,7 +2941,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
                        /* This is the last chance, better to slow
                         * down than lose it.
                         */
-                       sata_down_spd_limit(dev->link);
+                       sata_down_spd_limit(ata_dev_phys_link(dev));
                        ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
                }
        }
@@ -2707,7 +2951,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
                ata_dev_disable(dev);
 
                /* detach if offline */
-               if (ata_link_offline(dev->link))
+               if (ata_phys_link_offline(ata_dev_phys_link(dev)))
                        ata_eh_detach_dev(dev);
 
                /* schedule probe if necessary */
@@ -2755,7 +2999,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
        struct ata_device *dev;
        int nr_failed_devs;
        int rc;
-       unsigned long flags;
+       unsigned long flags, deadline;
 
        DPRINTK("ENTER\n");
 
@@ -2829,6 +3073,56 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
                }
        }
 
+       do {
+               unsigned long now;
+
+               /*
+                * clears ATA_EH_PARK in eh_info and resets
+                * ap->park_req_pending
+                */
+               ata_eh_pull_park_action(ap);
+
+               deadline = jiffies;
+               ata_port_for_each_link(link, ap) {
+                       ata_link_for_each_dev(dev, link) {
+                               struct ata_eh_context *ehc = &link->eh_context;
+                               unsigned long tmp;
+
+                               if (dev->class != ATA_DEV_ATA)
+                                       continue;
+                               if (!(ehc->i.dev_action[dev->devno] &
+                                     ATA_EH_PARK))
+                                       continue;
+                               tmp = dev->unpark_deadline;
+                               if (time_before(deadline, tmp))
+                                       deadline = tmp;
+                               else if (time_before_eq(tmp, jiffies))
+                                       continue;
+                               if (ehc->unloaded_mask & (1 << dev->devno))
+                                       continue;
+
+                               ata_eh_park_issue_cmd(dev, 1);
+                       }
+               }
+
+               now = jiffies;
+               if (time_before_eq(deadline, now))
+                       break;
+
+               deadline = wait_for_completion_timeout(&ap->park_req_pending,
+                                                      deadline - now);
+       } while (deadline);
+       ata_port_for_each_link(link, ap) {
+               ata_link_for_each_dev(dev, link) {
+                       if (!(link->eh_context.unloaded_mask &
+                             (1 << dev->devno)))
+                               continue;
+
+                       ata_eh_park_issue_cmd(dev, 0);
+                       ata_eh_done(link, dev, ATA_EH_PARK);
+               }
+       }
+
        /* the rest */
        ata_port_for_each_link(link, ap) {
                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,
                        ehc->i.flags &= ~ATA_EHI_SETMODE;
                }
 
+               /* If reset has been issued, clear UA to avoid
+                * disrupting the current users of the device.
+                */
+               if (ehc->i.flags & ATA_EHI_DID_RESET) {
+                       ata_link_for_each_dev(dev, link) {
+                               if (dev->class != ATA_DEV_ATAPI)
+                                       continue;
+                               rc = atapi_eh_clear_ua(dev);
+                               if (rc)
+                                       goto dev_fail;
+                       }
+               }
+
+               /* configure link power saving */
                if (ehc->i.action & ATA_EH_LPM)
                        ata_link_for_each_dev(dev, link)
                                ata_dev_enable_pm(dev, ap->pm_policy);
index b9d3ba423cb2d30eefc17bb349bee2376f624343..fccd5e496c6279ddef97b4a853540e31f6e80d05 100644 (file)
@@ -183,6 +183,105 @@ DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
                ata_scsi_lpm_show, ata_scsi_lpm_put);
 EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy);
 
+static ssize_t ata_scsi_park_show(struct device *device,
+                                 struct device_attribute *attr, char *buf)
+{
+       struct scsi_device *sdev = to_scsi_device(device);
+       struct ata_port *ap;
+       struct ata_link *link;
+       struct ata_device *dev;
+       unsigned long flags;
+       unsigned int uninitialized_var(msecs);
+       int rc = 0;
+
+       ap = ata_shost_to_port(sdev->host);
+
+       spin_lock_irqsave(ap->lock, flags);
+       dev = ata_scsi_find_dev(ap, sdev);
+       if (!dev) {
+               rc = -ENODEV;
+               goto unlock;
+       }
+       if (dev->flags & ATA_DFLAG_NO_UNLOAD) {
+               rc = -EOPNOTSUPP;
+               goto unlock;
+       }
+
+       link = dev->link;
+       if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS &&
+           link->eh_context.unloaded_mask & (1 << dev->devno) &&
+           time_after(dev->unpark_deadline, jiffies))
+               msecs = jiffies_to_msecs(dev->unpark_deadline - jiffies);
+       else
+               msecs = 0;
+
+unlock:
+       spin_unlock_irq(ap->lock);
+
+       return rc ? rc : snprintf(buf, 20, "%u\n", msecs);
+}
+
+static ssize_t ata_scsi_park_store(struct device *device,
+                                  struct device_attribute *attr,
+                                  const char *buf, size_t len)
+{
+       struct scsi_device *sdev = to_scsi_device(device);
+       struct ata_port *ap;
+       struct ata_device *dev;
+       long int input;
+       unsigned long flags;
+       int rc;
+
+       rc = strict_strtol(buf, 10, &input);
+       if (rc || input < -2)
+               return -EINVAL;
+       if (input > ATA_TMOUT_MAX_PARK) {
+               rc = -EOVERFLOW;
+               input = ATA_TMOUT_MAX_PARK;
+       }
+
+       ap = ata_shost_to_port(sdev->host);
+
+       spin_lock_irqsave(ap->lock, flags);
+       dev = ata_scsi_find_dev(ap, sdev);
+       if (unlikely(!dev)) {
+               rc = -ENODEV;
+               goto unlock;
+       }
+       if (dev->class != ATA_DEV_ATA) {
+               rc = -EOPNOTSUPP;
+               goto unlock;
+       }
+
+       if (input >= 0) {
+               if (dev->flags & ATA_DFLAG_NO_UNLOAD) {
+                       rc = -EOPNOTSUPP;
+                       goto unlock;
+               }
+
+               dev->unpark_deadline = ata_deadline(jiffies, input);
+               dev->link->eh_info.dev_action[dev->devno] |= ATA_EH_PARK;
+               ata_port_schedule_eh(ap);
+               complete(&ap->park_req_pending);
+       } else {
+               switch (input) {
+               case -1:
+                       dev->flags &= ~ATA_DFLAG_NO_UNLOAD;
+                       break;
+               case -2:
+                       dev->flags |= ATA_DFLAG_NO_UNLOAD;
+                       break;
+               }
+       }
+unlock:
+       spin_unlock_irqrestore(ap->lock, flags);
+
+       return rc ? rc : len;
+}
+DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR,
+           ata_scsi_park_show, ata_scsi_park_store);
+EXPORT_SYMBOL_GPL(dev_attr_unload_heads);
+
 static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
 {
        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,
                        ata_scsi_activity_store);
 EXPORT_SYMBOL_GPL(dev_attr_sw_activity);
 
+struct device_attribute *ata_common_sdev_attrs[] = {
+       &dev_attr_unload_heads,
+       NULL
+};
+EXPORT_SYMBOL_GPL(ata_common_sdev_attrs);
+
 static void ata_scsi_invalid_field(struct scsi_cmnd *cmd,
                                   void (*done)(struct scsi_cmnd *))
 {
@@ -954,6 +1059,9 @@ static int atapi_drain_needed(struct request *rq)
 static int ata_scsi_dev_config(struct scsi_device *sdev,
                               struct ata_device *dev)
 {
+       if (!ata_id_has_unload(dev->id))
+               dev->flags |= ATA_DFLAG_NO_UNLOAD;
+
        /* configure max sectors */
        blk_queue_max_sectors(sdev->request_queue, dev->max_sectors);
 
index ade5c75b61446c75adb4174ea3c967c872c548fa..e96de96e302023a1ca019f7c5a1bbbbd7565a3eb 100644 (file)
@@ -70,6 +70,7 @@ extern int atapi_passthru16;
 extern int libata_fua;
 extern int libata_noacpi;
 extern int libata_allow_tpm;
+extern struct ata_link *ata_dev_phys_link(struct ata_device *dev);
 extern void ata_force_cbl(struct ata_port *ap);
 extern u64 ata_tf_to_lba(const struct ata_taskfile *tf);
 extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf);
@@ -107,6 +108,8 @@ extern void ata_qc_issue(struct ata_queued_cmd *qc);
 extern void __ata_qc_complete(struct ata_queued_cmd *qc);
 extern int atapi_check_dma(struct ata_queued_cmd *qc);
 extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
+extern bool ata_phys_link_online(struct ata_link *link);
+extern bool ata_phys_link_offline(struct ata_link *link);
 extern void ata_dev_init(struct ata_device *dev);
 extern void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp);
 extern int sata_link_init_spd(struct ata_link *link);
index d3932901a3b3511a45e13cc489ce350392b4a0dd..1266924c11f97f7771f4ee99d232df8fbf59aae7 100644 (file)
@@ -1632,6 +1632,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
+       dev_set_drvdata(&pdev->dev, host);
+
        return 0;
 }
 
@@ -1648,6 +1650,7 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
        struct ata_host *host = dev_get_drvdata(dev);
 
        ata_host_detach(host);
+       dev_set_drvdata(&pdev->dev, NULL);
 
        peripheral_free_list(atapi_io_port);
 
@@ -1655,27 +1658,44 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
-int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
+static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
 {
-       return 0;
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       if (host)
+               return ata_host_suspend(host, state);
+       else
+               return 0;
 }
 
-int bfin_atapi_resume(struct platform_device *pdev)
+static int bfin_atapi_resume(struct platform_device *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int ret;
+
+       if (host) {
+               ret = bfin_reset_controller(host);
+               if (ret) {
+                       printk(KERN_ERR DRV_NAME ": Error during HW init\n");
+                       return ret;
+               }
+               ata_host_resume(host);
+       }
+
        return 0;
 }
+#else
+#define bfin_atapi_suspend NULL
+#define bfin_atapi_resume NULL
 #endif
 
 static struct platform_driver bfin_atapi_driver = {
        .probe                  = bfin_atapi_probe,
        .remove                 = __devexit_p(bfin_atapi_remove),
+       .suspend                = bfin_atapi_suspend,
+       .resume                 = bfin_atapi_resume,
        .driver = {
                .name           = DRV_NAME,
                .owner          = THIS_MODULE,
-#ifdef CONFIG_PM
-               .suspend        = bfin_atapi_suspend,
-               .resume         = bfin_atapi_resume,
-#endif
        },
 };
 
index e970b227fbce39037b4f14879eb4152056df59a5..a598bb36aafc5483d4c2e7cff9edaabec691efcd 100644 (file)
@@ -230,7 +230,7 @@ static u8 sil680_init_chip(struct pci_dev *pdev, int *try_mmio)
                tmpbyte & 1, tmpbyte & 0x30);
 
        *try_mmio = 0;
-#ifdef CONFIG_PPC_MERGE
+#ifdef CONFIG_PPC
        if (machine_is(cell))
                *try_mmio = (tmpbyte & 1) || pci_resource_start(pdev, 5);
 #endif
index 3924e7209a4434ef98961ceb404bea2754451bf3..1a56db92ff7ac685bfab920508d6fcc2bc0124a1 100644 (file)
@@ -469,10 +469,10 @@ static bool sata_fsl_qc_fill_rtf(struct ata_queued_cmd *qc)
        return true;
 }
 
-static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
-                              u32 val)
+static int sata_fsl_scr_write(struct ata_link *link,
+                             unsigned int sc_reg_in, u32 val)
 {
-       struct sata_fsl_host_priv *host_priv = ap->host->private_data;
+       struct sata_fsl_host_priv *host_priv = link->ap->host->private_data;
        void __iomem *ssr_base = host_priv->ssr_base;
        unsigned int sc_reg;
 
@@ -493,10 +493,10 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
        return 0;
 }
 
-static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in,
-                       u32 *val)
+static int sata_fsl_scr_read(struct ata_link *link,
+                            unsigned int sc_reg_in, u32 *val)
 {
-       struct sata_fsl_host_priv *host_priv = ap->host->private_data;
+       struct sata_fsl_host_priv *host_priv = link->ap->host->private_data;
        void __iomem *ssr_base = host_priv->ssr_base;
        unsigned int sc_reg;
 
@@ -645,12 +645,12 @@ static int sata_fsl_port_start(struct ata_port *ap)
         * Workaround for 8315DS board 3gbps link-up issue,
         * currently limit SATA port to GEN1 speed
         */
-       sata_fsl_scr_read(ap, SCR_CONTROL, &temp);
+       sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp);
        temp &= ~(0xF << 4);
        temp |= (0x1 << 4);
-       sata_fsl_scr_write(ap, SCR_CONTROL, temp);
+       sata_fsl_scr_write(&ap->link, SCR_CONTROL, temp);
 
-       sata_fsl_scr_read(ap, SCR_CONTROL, &temp);
+       sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp);
        dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n",
                        temp);
 #endif
@@ -868,7 +868,7 @@ issue_srst:
                        ioread32(CQ + hcr_base),
                        ioread32(CA + hcr_base), ioread32(CC + hcr_base));
 
-               sata_fsl_scr_read(ap, SCR_ERROR, &Serror);
+               sata_fsl_scr_read(&ap->link, SCR_ERROR, &Serror);
 
                DPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
                DPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
@@ -972,9 +972,9 @@ static void sata_fsl_error_intr(struct ata_port *ap)
         * Handle & Clear SError
         */
 
-       sata_fsl_scr_read(ap, SCR_ERROR, &SError);
+       sata_fsl_scr_read(&ap->link, SCR_ERROR, &SError);
        if (unlikely(SError & 0xFFFF0000)) {
-               sata_fsl_scr_write(ap, SCR_ERROR, SError);
+               sata_fsl_scr_write(&ap->link, SCR_ERROR, SError);
        }
 
        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)
 
        hstatus = ioread32(hcr_base + HSTATUS);
 
-       sata_fsl_scr_read(ap, SCR_ERROR, &SError);
+       sata_fsl_scr_read(&ap->link, SCR_ERROR, &SError);
 
        if (unlikely(SError & 0xFFFF0000)) {
                DPRINTK("serror @host_intr : 0x%x\n", SError);
index 5032c32fa505f2254439c3b4940aa85f841ff220..fbbd87c96f102d9fc6c11abf5529bbd5d6eba67e 100644 (file)
@@ -269,9 +269,9 @@ static void inic_reset_port(void __iomem *port_base)
        writeb(0xff, port_base + PORT_IRQ_STAT);
 }
 
-static int inic_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val)
+static int inic_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val)
 {
-       void __iomem *scr_addr = inic_port_base(ap) + PORT_SCR;
+       void __iomem *scr_addr = inic_port_base(link->ap) + PORT_SCR;
        void __iomem *addr;
 
        if (unlikely(sc_reg >= ARRAY_SIZE(scr_map)))
@@ -286,9 +286,9 @@ static int inic_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val)
        return 0;
 }
 
-static int inic_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val)
+static int inic_scr_write(struct ata_link *link, unsigned sc_reg, u32 val)
 {
-       void __iomem *scr_addr = inic_port_base(ap) + PORT_SCR;
+       void __iomem *scr_addr = inic_port_base(link->ap) + PORT_SCR;
 
        if (unlikely(sc_reg >= ARRAY_SIZE(scr_map)))
                return -EINVAL;
index c815f8ecf6e64c758eb2a43deebc5c20f259ab03..2b24ae58b52ee557e9d028e06e83de405a121a40 100644 (file)
@@ -493,10 +493,10 @@ struct mv_hw_ops {
        void (*reset_bus)(struct ata_host *host, void __iomem *mmio);
 };
 
-static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val);
-static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
-static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val);
-static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
+static int mv_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val);
+static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val);
+static int mv5_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val);
+static int mv5_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val);
 static int mv_port_start(struct ata_port *ap);
 static void mv_port_stop(struct ata_port *ap);
 static int mv_qc_defer(struct ata_queued_cmd *qc);
@@ -1070,23 +1070,23 @@ static unsigned int mv_scr_offset(unsigned int sc_reg_in)
        return ofs;
 }
 
-static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val)
+static int mv_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val)
 {
        unsigned int ofs = mv_scr_offset(sc_reg_in);
 
        if (ofs != 0xffffffffU) {
-               *val = readl(mv_ap_base(ap) + ofs);
+               *val = readl(mv_ap_base(link->ap) + ofs);
                return 0;
        } else
                return -EINVAL;
 }
 
-static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
+static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val)
 {
        unsigned int ofs = mv_scr_offset(sc_reg_in);
 
        if (ofs != 0xffffffffU) {
-               writelfl(val, mv_ap_base(ap) + ofs);
+               writelfl(val, mv_ap_base(link->ap) + ofs);
                return 0;
        } else
                return -EINVAL;
@@ -2251,11 +2251,11 @@ static unsigned int mv5_scr_offset(unsigned int sc_reg_in)
        return ofs;
 }
 
-static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val)
+static int mv5_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val)
 {
-       struct mv_host_priv *hpriv = ap->host->private_data;
+       struct mv_host_priv *hpriv = link->ap->host->private_data;
        void __iomem *mmio = hpriv->base;
-       void __iomem *addr = mv5_phy_base(mmio, ap->port_no);
+       void __iomem *addr = mv5_phy_base(mmio, link->ap->port_no);
        unsigned int ofs = mv5_scr_offset(sc_reg_in);
 
        if (ofs != 0xffffffffU) {
@@ -2265,11 +2265,11 @@ static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val)
                return -EINVAL;
 }
 
-static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
+static int mv5_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val)
 {
-       struct mv_host_priv *hpriv = ap->host->private_data;
+       struct mv_host_priv *hpriv = link->ap->host->private_data;
        void __iomem *mmio = hpriv->base;
-       void __iomem *addr = mv5_phy_base(mmio, ap->port_no);
+       void __iomem *addr = mv5_phy_base(mmio, link->ap->port_no);
        unsigned int ofs = mv5_scr_offset(sc_reg_in);
 
        if (ofs != 0xffffffffU) {
index 1e1f3f3757ae7bf98fd7ce2d39cfafdc644095f0..fae3841de0d8726468adc4b6a93202f0d4177ed7 100644 (file)
@@ -302,13 +302,15 @@ static void nv_ck804_host_stop(struct ata_host *host);
 static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance);
 static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance);
 static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance);
-static int nv_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-static int nv_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
+static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
+static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
 
 static void nv_nf2_freeze(struct ata_port *ap);
 static void nv_nf2_thaw(struct ata_port *ap);
 static void nv_ck804_freeze(struct ata_port *ap);
 static void nv_ck804_thaw(struct ata_port *ap);
+static int nv_hardreset(struct ata_link *link, unsigned int *class,
+                       unsigned long deadline);
 static int nv_adma_slave_config(struct scsi_device *sdev);
 static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc);
 static void nv_adma_qc_prep(struct ata_queued_cmd *qc);
@@ -403,28 +405,45 @@ static struct scsi_host_template nv_swncq_sht = {
        .slave_configure        = nv_swncq_slave_config,
 };
 
-static struct ata_port_operations nv_generic_ops = {
+/* OSDL bz3352 reports that some nv controllers can't determine device
+ * signature reliably and nv_hardreset is implemented to work around
+ * the problem.  This was reported on nf3 and it's unclear whether any
+ * other controllers are affected.  However, the workaround has been
+ * applied to all variants and there isn't much to gain by trying to
+ * find out exactly which ones are affected at this point especially
+ * because NV has moved over to ahci for newer controllers.
+ */
+static struct ata_port_operations nv_common_ops = {
        .inherits               = &ata_bmdma_port_ops,
-       .hardreset              = ATA_OP_NULL,
+       .hardreset              = nv_hardreset,
        .scr_read               = nv_scr_read,
        .scr_write              = nv_scr_write,
 };
 
+/* OSDL bz11195 reports that link doesn't come online after hardreset
+ * on generic nv's and there have been several other similar reports
+ * on linux-ide.  Disable hardreset for generic nv's.
+ */
+static struct ata_port_operations nv_generic_ops = {
+       .inherits               = &nv_common_ops,
+       .hardreset              = ATA_OP_NULL,
+};
+
 static struct ata_port_operations nv_nf2_ops = {
-       .inherits               = &nv_generic_ops,
+       .inherits               = &nv_common_ops,
        .freeze                 = nv_nf2_freeze,
        .thaw                   = nv_nf2_thaw,
 };
 
 static struct ata_port_operations nv_ck804_ops = {
-       .inherits               = &nv_generic_ops,
+       .inherits               = &nv_common_ops,
        .freeze                 = nv_ck804_freeze,
        .thaw                   = nv_ck804_thaw,
        .host_stop              = nv_ck804_host_stop,
 };
 
 static struct ata_port_operations nv_adma_ops = {
-       .inherits               = &nv_generic_ops,
+       .inherits               = &nv_common_ops,
 
        .check_atapi_dma        = nv_adma_check_atapi_dma,
        .sff_tf_read            = nv_adma_tf_read,
@@ -448,7 +467,7 @@ static struct ata_port_operations nv_adma_ops = {
 };
 
 static struct ata_port_operations nv_swncq_ops = {
-       .inherits               = &nv_generic_ops,
+       .inherits               = &nv_common_ops,
 
        .qc_defer               = ata_std_qc_defer,
        .qc_prep                = nv_swncq_qc_prep,
@@ -1492,21 +1511,21 @@ static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance)
        return ret;
 }
 
-static int nv_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
 
-       *val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4));
+       *val = ioread32(link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
-static int nv_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
 
-       iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4));
+       iowrite32(val, link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
@@ -1586,6 +1605,21 @@ static void nv_mcp55_thaw(struct ata_port *ap)
        ata_sff_thaw(ap);
 }
 
+static int nv_hardreset(struct ata_link *link, unsigned int *class,
+                       unsigned long deadline)
+{
+       int rc;
+
+       /* SATA hardreset fails to retrieve proper device signature on
+        * some controllers.  Request follow up SRST.  For more info,
+        * see http://bugzilla.kernel.org/show_bug.cgi?id=3352
+        */
+       rc = sata_sff_hardreset(link, class, deadline);
+       if (rc)
+               return rc;
+       return -EAGAIN;
+}
+
 static void nv_adma_error_handler(struct ata_port *ap)
 {
        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)
        if (!pp->qc_active)
                return;
 
-       if (ap->ops->scr_read(ap, SCR_ERROR, &serror))
+       if (ap->ops->scr_read(&ap->link, SCR_ERROR, &serror))
                return;
-       ap->ops->scr_write(ap, SCR_ERROR, serror);
+       ap->ops->scr_write(&ap->link, SCR_ERROR, serror);
 
        if (ata_stat & ATA_ERR) {
                ata_ehi_clear_desc(ehi);
index 030665ba76b73a308fd0e35693742140b761792c..750d8cdc00cd1b495eb8c40b7af5e288f18163fe 100644 (file)
@@ -137,8 +137,8 @@ struct pdc_port_priv {
        dma_addr_t              pkt_dma;
 };
 
-static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
+static int pdc_sata_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
+static int pdc_sata_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
 static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 static int pdc_common_port_start(struct ata_port *ap);
 static int pdc_sata_port_start(struct ata_port *ap);
@@ -386,19 +386,21 @@ static int pdc_sata_cable_detect(struct ata_port *ap)
        return ATA_CBL_SATA;
 }
 
-static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int pdc_sata_scr_read(struct ata_link *link,
+                            unsigned int sc_reg, u32 *val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4));
+       *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
-static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int pdc_sata_scr_write(struct ata_link *link,
+                             unsigned int sc_reg, u32 val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       writel(val, ap->ioaddr.scr_addr + (sc_reg * 4));
+       writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
@@ -731,7 +733,7 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc,
        if (sata_scr_valid(&ap->link)) {
                u32 serror;
 
-               pdc_sata_scr_read(ap, SCR_ERROR, &serror);
+               pdc_sata_scr_read(&ap->link, SCR_ERROR, &serror);
                ehi->serror |= serror;
        }
 
index 1600107047cf50e2d544a090c992ee52982307e8..a000c86ac859dfb2c54053cbc66a2a6875d34862 100644 (file)
@@ -111,8 +111,8 @@ struct qs_port_priv {
        qs_state_t              state;
 };
 
-static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
+static int qs_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
+static int qs_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
 static int qs_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 static int qs_port_start(struct ata_port *ap);
 static void qs_host_stop(struct ata_host *host);
@@ -242,11 +242,11 @@ static int qs_prereset(struct ata_link *link, unsigned long deadline)
        return ata_sff_prereset(link, deadline);
 }
 
-static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int qs_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       *val = readl(ap->ioaddr.scr_addr + (sc_reg * 8));
+       *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 8));
        return 0;
 }
 
@@ -256,11 +256,11 @@ static void qs_error_handler(struct ata_port *ap)
        ata_std_error_handler(ap);
 }
 
-static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int qs_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       writel(val, ap->ioaddr.scr_addr + (sc_reg * 8));
+       writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 8));
        return 0;
 }
 
index 88bf4212590f06f9f3f762894b226e012e9f2b18..031d7b7dee34bc09998c9d9cfa4d65891d47aa86 100644 (file)
@@ -115,8 +115,8 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 static int sil_pci_device_resume(struct pci_dev *pdev);
 #endif
 static void sil_dev_config(struct ata_device *dev);
-static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
+static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
+static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
 static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed);
 static void sil_freeze(struct ata_port *ap);
 static void sil_thaw(struct ata_port *ap);
@@ -317,9 +317,9 @@ static inline void __iomem *sil_scr_addr(struct ata_port *ap,
        return NULL;
 }
 
-static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
 {
-       void __iomem *mmio = sil_scr_addr(ap, sc_reg);
+       void __iomem *mmio = sil_scr_addr(link->ap, sc_reg);
 
        if (mmio) {
                *val = readl(mmio);
@@ -328,9 +328,9 @@ static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
        return -EINVAL;
 }
 
-static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 {
-       void __iomem *mmio = sil_scr_addr(ap, sc_reg);
+       void __iomem *mmio = sil_scr_addr(link->ap, sc_reg);
 
        if (mmio) {
                writel(val, mmio);
@@ -352,8 +352,8 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
                 * controllers continue to assert IRQ as long as
                 * SError bits are pending.  Clear SError immediately.
                 */
-               sil_scr_read(ap, SCR_ERROR, &serror);
-               sil_scr_write(ap, SCR_ERROR, serror);
+               sil_scr_read(&ap->link, SCR_ERROR, &serror);
+               sil_scr_write(&ap->link, SCR_ERROR, serror);
 
                /* Sometimes spurious interrupts occur, double check
                 * it's PHYRDY CHG.
index 84ffcc26a74bec944506096c20e578a49c516bcf..4621807a1a6a1ffbc143976474141dd529f3fa7f 100644 (file)
@@ -340,8 +340,8 @@ struct sil24_port_priv {
 };
 
 static void sil24_dev_config(struct ata_device *dev);
-static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val);
-static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val);
+static int sil24_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val);
+static int sil24_scr_write(struct ata_link *link, unsigned sc_reg, u32 val);
 static int sil24_qc_defer(struct ata_queued_cmd *qc);
 static void sil24_qc_prep(struct ata_queued_cmd *qc);
 static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc);
@@ -504,9 +504,9 @@ static int sil24_scr_map[] = {
        [SCR_ACTIVE]    = 3,
 };
 
-static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val)
+static int sil24_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val)
 {
-       void __iomem *scr_addr = sil24_port_base(ap) + PORT_SCONTROL;
+       void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL;
 
        if (sc_reg < ARRAY_SIZE(sil24_scr_map)) {
                void __iomem *addr;
@@ -517,9 +517,9 @@ static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val)
        return -EINVAL;
 }
 
-static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val)
+static int sil24_scr_write(struct ata_link *link, unsigned sc_reg, u32 val)
 {
-       void __iomem *scr_addr = sil24_port_base(ap) + PORT_SCONTROL;
+       void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL;
 
        if (sc_reg < ARRAY_SIZE(sil24_scr_map)) {
                void __iomem *addr;
index 1010b3069bd5164bb9ded003df2d41371c4f91c9..9c43b4e7c4a66d8d45a557141243db6aab81776e 100644 (file)
@@ -64,8 +64,8 @@ enum {
 };
 
 static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
-static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
+static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
+static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
 
 static const struct pci_device_id sis_pci_tbl[] = {
        { 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)
        return addr;
 }
 
-static u32 sis_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static u32 sis_scr_cfg_read(struct ata_link *link,
+                           unsigned int sc_reg, u32 *val)
 {
-       struct pci_dev *pdev = to_pci_dev(ap->host->dev);
-       unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
+       struct pci_dev *pdev = to_pci_dev(link->ap->host->dev);
+       unsigned int cfg_addr = get_scr_cfg_addr(link->ap, sc_reg);
        u32 val2 = 0;
        u8 pmr;
 
@@ -158,10 +159,11 @@ static u32 sis_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
        return 0;
 }
 
-static int sis_scr_cfg_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int sis_scr_cfg_write(struct ata_link *link,
+                            unsigned int sc_reg, u32 val)
 {
-       struct pci_dev *pdev = to_pci_dev(ap->host->dev);
-       unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
+       struct pci_dev *pdev = to_pci_dev(link->ap->host->dev);
+       unsigned int cfg_addr = get_scr_cfg_addr(link->ap, sc_reg);
        u8 pmr;
 
        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)
        return 0;
 }
 
-static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
 {
+       struct ata_port *ap = link->ap;
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        u8 pmr;
 
@@ -187,7 +190,7 @@ static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
                return -EINVAL;
 
        if (ap->flags & SIS_FLAG_CFGSCR)
-               return sis_scr_cfg_read(ap, sc_reg, val);
+               return sis_scr_cfg_read(link, sc_reg, val);
 
        pci_read_config_byte(pdev, SIS_PMR, &pmr);
 
@@ -202,8 +205,9 @@ static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
        return 0;
 }
 
-static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 {
+       struct ata_port *ap = link->ap;
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        u8 pmr;
 
@@ -213,7 +217,7 @@ static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
        pci_read_config_byte(pdev, SIS_PMR, &pmr);
 
        if (ap->flags & SIS_FLAG_CFGSCR)
-               return sis_scr_cfg_write(ap, sc_reg, val);
+               return sis_scr_cfg_write(link, sc_reg, val);
        else {
                iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4));
                if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
index fb13b82aacba7ee255adbf2fef9ca7e5083654ce..609d147813ae380a5408ab5b4f268ee6b7cac811 100644 (file)
@@ -123,20 +123,22 @@ static int k2_sata_check_atapi_dma(struct ata_queued_cmd *qc)
        }
 }
 
-static int k2_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int k2_sata_scr_read(struct ata_link *link,
+                           unsigned int sc_reg, u32 *val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4));
+       *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
 
-static int k2_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int k2_sata_scr_write(struct ata_link *link,
+                            unsigned int sc_reg, u32 val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       writel(val, ap->ioaddr.scr_addr + (sc_reg * 4));
+       writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
index db529b8499482fc08c3f4b6de08fcc4d43a6f2cc..019575bb3e08734dfd0c531025b5dad7e47c4a63 100644 (file)
@@ -57,8 +57,8 @@ struct uli_priv {
 };
 
 static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
-static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
+static int uli_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
+static int uli_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
 
 static const struct pci_device_id uli_pci_tbl[] = {
        { 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)
        return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg);
 }
 
-static u32 uli_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg)
+static u32 uli_scr_cfg_read(struct ata_link *link, unsigned int sc_reg)
 {
-       struct pci_dev *pdev = to_pci_dev(ap->host->dev);
-       unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
+       struct pci_dev *pdev = to_pci_dev(link->ap->host->dev);
+       unsigned int cfg_addr = get_scr_cfg_addr(link->ap, sc_reg);
        u32 val;
 
        pci_read_config_dword(pdev, cfg_addr, &val);
        return val;
 }
 
-static void uli_scr_cfg_write(struct ata_port *ap, unsigned int scr, u32 val)
+static void uli_scr_cfg_write(struct ata_link *link, unsigned int scr, u32 val)
 {
-       struct pci_dev *pdev = to_pci_dev(ap->host->dev);
-       unsigned int cfg_addr = get_scr_cfg_addr(ap, scr);
+       struct pci_dev *pdev = to_pci_dev(link->ap->host->dev);
+       unsigned int cfg_addr = get_scr_cfg_addr(link->ap, scr);
 
        pci_write_config_dword(pdev, cfg_addr, val);
 }
 
-static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int uli_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
 
-       *val = uli_scr_cfg_read(ap, sc_reg);
+       *val = uli_scr_cfg_read(link, sc_reg);
        return 0;
 }
 
-static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int uli_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 {
        if (sc_reg > SCR_CONTROL) //SCR_CONTROL=2, SCR_ERROR=1, SCR_STATUS=0
                return -EINVAL;
 
-       uli_scr_cfg_write(ap, sc_reg, val);
+       uli_scr_cfg_write(link, sc_reg, val);
        return 0;
 }
 
index 96deeb354e16f24918a6d76608d09b39adb0fd56..1cfa74535d91abed8d42a8c5699f9e2c30462c38 100644 (file)
@@ -68,8 +68,8 @@ enum {
 };
 
 static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
-static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
+static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
+static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
 static void svia_noop_freeze(struct ata_port *ap);
 static int vt6420_prereset(struct ata_link *link, unsigned long deadline);
 static int vt6421_pata_cable_detect(struct ata_port *ap);
@@ -152,19 +152,19 @@ MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(pci, svia_pci_tbl);
 MODULE_VERSION(DRV_VERSION);
 
-static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       *val = ioread32(ap->ioaddr.scr_addr + (4 * sc_reg));
+       *val = ioread32(link->ap->ioaddr.scr_addr + (4 * sc_reg));
        return 0;
 }
 
-static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       iowrite32(val, ap->ioaddr.scr_addr + (4 * sc_reg));
+       iowrite32(val, link->ap->ioaddr.scr_addr + (4 * sc_reg));
        return 0;
 }
 
@@ -210,20 +210,20 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
                goto skip_scr;
 
        /* Resume phy.  This is the old SATA resume sequence */
-       svia_scr_write(ap, SCR_CONTROL, 0x300);
-       svia_scr_read(ap, SCR_CONTROL, &scontrol); /* flush */
+       svia_scr_write(link, SCR_CONTROL, 0x300);
+       svia_scr_read(link, SCR_CONTROL, &scontrol); /* flush */
 
        /* wait for phy to become ready, if necessary */
        do {
                msleep(200);
-               svia_scr_read(ap, SCR_STATUS, &sstatus);
+               svia_scr_read(link, SCR_STATUS, &sstatus);
                if ((sstatus & 0xf) != 1)
                        break;
        } while (time_before(jiffies, timeout));
 
        /* open code sata_print_link_status() */
-       svia_scr_read(ap, SCR_STATUS, &sstatus);
-       svia_scr_read(ap, SCR_CONTROL, &scontrol);
+       svia_scr_read(link, SCR_STATUS, &sstatus);
+       svia_scr_read(link, SCR_CONTROL, &scontrol);
 
        online = (sstatus & 0xf) == 0x3;
 
@@ -232,7 +232,7 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
                        online ? "up" : "down", sstatus, scontrol);
 
        /* SStatus is read one more time */
-       svia_scr_read(ap, SCR_STATUS, &sstatus);
+       svia_scr_read(link, SCR_STATUS, &sstatus);
 
        if (!online) {
                /* tell EH to bail */
index f3d635c0a2e9255fc51034319225208f45c446cf..c57cdff9e6bdbf21af767f70fe0ab0edc7242322 100644 (file)
@@ -98,20 +98,22 @@ enum {
                              VSC_SATA_INT_PHY_CHANGE),
 };
 
-static int vsc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
+static int vsc_sata_scr_read(struct ata_link *link,
+                            unsigned int sc_reg, u32 *val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4));
+       *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
 
-static int vsc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+static int vsc_sata_scr_write(struct ata_link *link,
+                             unsigned int sc_reg, u32 val)
 {
        if (sc_reg > SCR_CONTROL)
                return -EINVAL;
-       writel(val, ap->ioaddr.scr_addr + (sc_reg * 4));
+       writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4));
        return 0;
 }
 
index 1e55a658e6cefe0af8014bee290dc81f8b5a119d..32f3a8ed8d3d20e568e5547a48b559537de5fac1 100644 (file)
@@ -256,7 +256,6 @@ static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
@@ -298,7 +297,6 @@ static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
index 6a010681ecf3d33f114bb78607e0d6f19d46b319..af472e05273296e664e8ddcb7fa443f4bc0e60e8 100644 (file)
@@ -102,14 +102,19 @@ static struct usb_device_id blacklist_table[] = {
        { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
 
        /* Broadcom BCM2046 */
+       { USB_DEVICE(0x0a5c, 0x2146), .driver_info = BTUSB_RESET },
        { USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET },
 
+       /* Apple MacBook Pro with Broadcom chip */
+       { USB_DEVICE(0x05ac, 0x820f), .driver_info = BTUSB_RESET },
+
        /* IBM/Lenovo ThinkPad with Broadcom chip */
        { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
        { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
 
        /* Targus ACB10US */
        { USB_DEVICE(0x0a5c, 0x2100), .driver_info = BTUSB_RESET },
+       { USB_DEVICE(0x0a5c, 0x2154), .driver_info = BTUSB_RESET },
 
        /* ANYCOM Bluetooth USB-200 and USB-250 */
        { USB_DEVICE(0x0a5c, 0x2111), .driver_info = BTUSB_RESET },
@@ -147,6 +152,9 @@ static struct usb_device_id blacklist_table[] = {
        { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
        { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
 
+       /* Belkin F8T016 device */
+       { USB_DEVICE(0x050d, 0x016a), .driver_info = BTUSB_RESET },
+
        /* Digianswer devices */
        { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER },
        { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE },
@@ -169,6 +177,7 @@ static struct usb_device_id blacklist_table[] = {
 struct btusb_data {
        struct hci_dev       *hdev;
        struct usb_device    *udev;
+       struct usb_interface *intf;
        struct usb_interface *isoc;
 
        spinlock_t lock;
@@ -267,7 +276,6 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
@@ -350,7 +358,6 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
@@ -471,7 +478,6 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
@@ -516,7 +522,7 @@ static int btusb_open(struct hci_dev *hdev)
 
        err = btusb_submit_intr_urb(hdev);
        if (err < 0) {
-               clear_bit(BTUSB_INTR_RUNNING, &hdev->flags);
+               clear_bit(BTUSB_INTR_RUNNING, &data->flags);
                clear_bit(HCI_RUNNING, &hdev->flags);
        }
 
@@ -532,8 +538,10 @@ static int btusb_close(struct hci_dev *hdev)
        if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
                return 0;
 
+       cancel_work_sync(&data->work);
+
        clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
-       usb_kill_anchored_urbs(&data->intr_anchor);
+       usb_kill_anchored_urbs(&data->isoc_anchor);
 
        clear_bit(BTUSB_BULK_RUNNING, &data->flags);
        usb_kill_anchored_urbs(&data->bulk_anchor);
@@ -821,6 +829,7 @@ static int btusb_probe(struct usb_interface *intf,
        }
 
        data->udev = interface_to_usbdev(intf);
+       data->intf = intf;
 
        spin_lock_init(&data->lock);
 
@@ -889,7 +898,7 @@ static int btusb_probe(struct usb_interface *intf,
 
        if (data->isoc) {
                err = usb_driver_claim_interface(&btusb_driver,
-                                                       data->isoc, NULL);
+                                                       data->isoc, data);
                if (err < 0) {
                        hci_free_dev(hdev);
                        kfree(data);
@@ -921,13 +930,22 @@ static void btusb_disconnect(struct usb_interface *intf)
 
        hdev = data->hdev;
 
-       if (data->isoc)
-               usb_driver_release_interface(&btusb_driver, data->isoc);
+       __hci_dev_hold(hdev);
 
-       usb_set_intfdata(intf, NULL);
+       usb_set_intfdata(data->intf, NULL);
+
+       if (data->isoc)
+               usb_set_intfdata(data->isoc, NULL);
 
        hci_unregister_dev(hdev);
 
+       if (intf == data->isoc)
+               usb_driver_release_interface(&btusb_driver, data->intf);
+       else if (data->isoc)
+               usb_driver_release_interface(&btusb_driver, data->isoc);
+
+       __hci_dev_put(hdev);
+
        hci_free_dev(hdev);
 }
 
index 4bada0e8b8128ad548771b170b71f91579fb2dca..46f507531177dc91f85af1398755d2ff9f9cd829 100644 (file)
@@ -116,7 +116,9 @@ struct agp_bridge_driver {
        struct agp_memory *(*alloc_by_type) (size_t, int);
        void (*free_by_type)(struct agp_memory *);
        void *(*agp_alloc_page)(struct agp_bridge_data *);
+       int (*agp_alloc_pages)(struct agp_bridge_data *, struct agp_memory *, size_t);
        void (*agp_destroy_page)(void *, int flags);
+       void (*agp_destroy_pages)(struct agp_memory *);
        int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
        void (*chipset_flush)(struct agp_bridge_data *);
 };
@@ -277,7 +279,10 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type);
 struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type);
 void agp_generic_free_by_type(struct agp_memory *curr);
 void *agp_generic_alloc_page(struct agp_bridge_data *bridge);
+int agp_generic_alloc_pages(struct agp_bridge_data *agp_bridge,
+                           struct agp_memory *memory, size_t page_count);
 void agp_generic_destroy_page(void *addr, int flags);
+void agp_generic_destroy_pages(struct agp_memory *memory);
 void agp_free_key(int key);
 int agp_num_entries(void);
 u32 agp_collect_device_status(struct agp_bridge_data *bridge, u32 mode, u32 command);
index 5da89f6c6c251ef97580d64c52244b4ef5f79125..5ea4da8e995420f4b63e315e77bf655e087935bc 100644 (file)
@@ -143,7 +143,9 @@ struct agp_bridge_driver alpha_core_agp_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
index e280531843be490e0613ec70da67c9f8054ff48f..603a986e96af6299bd6bc9b2e10bb54edc3aea2c 100644 (file)
@@ -386,7 +386,9 @@ static const struct agp_bridge_driver amd_irongate_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
index 7495c522d8e477ac3aa0431c95fead255e7879ac..2812ee2b165a407ff802d737695c4818f8ea917e 100644 (file)
@@ -224,7 +224,9 @@ static const struct agp_bridge_driver amd_8151_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
index 6ecbcafb34b1978dfe62b1eca7a2d0cf849285ed..ae2791b926b9fe705a80e7540c4482675ad25de0 100644 (file)
@@ -418,7 +418,9 @@ static const struct agp_bridge_driver ati_generic_bridge = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
index 8ca6f262ef853c99ae285ec2817e902b75885b1f..453543a1f29346c73e4b253d6d4bf2c41e69a942 100644 (file)
@@ -335,7 +335,9 @@ static const struct agp_bridge_driver efficeon_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
index 118dbde25dc71ac53ca2afa24f784d2a0dfbce17..10d6cbd7c05e59126f175eb1d8217cc95113d826 100644 (file)
@@ -201,14 +201,22 @@ void agp_free_memory(struct agp_memory *curr)
                return;
        }
        if (curr->page_count != 0) {
-               for (i = 0; i < curr->page_count; i++) {
-                       curr->memory[i] = (unsigned long)gart_to_virt(curr->memory[i]);
-                       curr->bridge->driver->agp_destroy_page((void *)curr->memory[i],
-                                                              AGP_PAGE_DESTROY_UNMAP);
-               }
-               for (i = 0; i < curr->page_count; i++) {
-                       curr->bridge->driver->agp_destroy_page((void *)curr->memory[i],
-                                                              AGP_PAGE_DESTROY_FREE);
+               if (curr->bridge->driver->agp_destroy_pages) {
+                       curr->bridge->driver->agp_destroy_pages(curr);
+               } else {
+
+                       for (i = 0; i < curr->page_count; i++) {
+                               curr->memory[i] = (unsigned long)gart_to_virt(
+                                       curr->memory[i]);
+                               curr->bridge->driver->agp_destroy_page(
+                                       (void *)curr->memory[i],
+                                       AGP_PAGE_DESTROY_UNMAP);
+                       }
+                       for (i = 0; i < curr->page_count; i++) {
+                               curr->bridge->driver->agp_destroy_page(
+                                       (void *)curr->memory[i],
+                                       AGP_PAGE_DESTROY_FREE);
+                       }
                }
        }
        agp_free_key(curr->key);
@@ -264,6 +272,15 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
        if (new == NULL)
                return NULL;
 
+       if (bridge->driver->agp_alloc_pages) {
+               if (bridge->driver->agp_alloc_pages(bridge, new, page_count)) {
+                       agp_free_memory(new);
+                       return NULL;
+               }
+               new->bridge = bridge;
+               return new;
+       }
+
        for (i = 0; i < page_count; i++) {
                void *addr = bridge->driver->agp_alloc_page(bridge);
 
@@ -1203,6 +1220,39 @@ EXPORT_SYMBOL(agp_generic_alloc_user);
  * against a maximum value.
  */
 
+int agp_generic_alloc_pages(struct agp_bridge_data *bridge, struct agp_memory *mem, size_t num_pages)
+{
+       struct page * page;
+       int i, ret = -ENOMEM;
+
+       for (i = 0; i < num_pages; i++) {
+               page = alloc_page(GFP_KERNEL | GFP_DMA32);
+               /* agp_free_memory() needs gart address */
+               if (page == NULL)
+                       goto out;
+
+#ifndef CONFIG_X86
+               map_page_into_agp(page);
+#endif
+               get_page(page);
+               atomic_inc(&agp_bridge->current_memory_agp);
+
+               /* set_memory_array_uc() needs virtual address */
+               mem->memory[i] = (unsigned long)page_address(page);
+               mem->page_count++;
+       }
+
+#ifdef CONFIG_X86
+       set_memory_array_uc(mem->memory, num_pages);
+#endif
+       ret = 0;
+out:
+       for (i = 0; i < mem->page_count; i++)
+               mem->memory[i] = virt_to_gart((void *)mem->memory[i]);
+       return ret;
+}
+EXPORT_SYMBOL(agp_generic_alloc_pages);
+
 void *agp_generic_alloc_page(struct agp_bridge_data *bridge)
 {
        struct page * page;
@@ -1219,6 +1269,37 @@ void *agp_generic_alloc_page(struct agp_bridge_data *bridge)
 }
 EXPORT_SYMBOL(agp_generic_alloc_page);
 
+void agp_generic_destroy_pages(struct agp_memory *mem)
+{
+       int i;
+       void *addr;
+       struct page *page;
+
+       if (!mem)
+               return;
+
+       for (i = 0; i < mem->page_count; i++)
+               mem->memory[i] = (unsigned long)gart_to_virt(mem->memory[i]);
+
+#ifdef CONFIG_X86
+       set_memory_array_wb(mem->memory, mem->page_count);
+#endif
+
+       for (i = 0; i < mem->page_count; i++) {
+               addr = (void *)mem->memory[i];
+               page = virt_to_page(addr);
+
+#ifndef CONFIG_X86
+               unmap_page_from_agp(page);
+#endif
+
+               put_page(page);
+               free_page((unsigned long)addr);
+               atomic_dec(&agp_bridge->current_memory_agp);
+               mem->memory[i] = 0;
+       }
+}
+EXPORT_SYMBOL(agp_generic_destroy_pages);
 
 void agp_generic_destroy_page(void *addr, int flags)
 {
index 80d7317f85c93e312d297460e1f8d9a55e592af5..183ac3fe44fbfe3c0f67f49008e2dc1de9241f96 100644 (file)
@@ -435,7 +435,9 @@ const struct agp_bridge_driver hp_zx1_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
        .cant_use_aperture      = true,
 };
index e587eebebc67c29d6a09085d873701ec566b4538..10da687d131ac19b7c264b8b23bbeeea869ab925 100644 (file)
@@ -575,7 +575,9 @@ const struct agp_bridge_driver intel_i460_driver = {
        .insert_memory          = i460_insert_memory_small_io_page,
        .remove_memory          = i460_remove_memory_small_io_page,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
 #endif
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
index 016fdf0623a4ce7b5f849efc8ab099a2c5026497..043e36628d6d7faf03c34e5f7a2f9956f5429694 100644 (file)
@@ -1711,7 +1711,9 @@ static const struct agp_bridge_driver intel_generic_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -1736,7 +1738,9 @@ static const struct agp_bridge_driver intel_810_driver = {
        .alloc_by_type          = intel_i810_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -1760,7 +1764,9 @@ static const struct agp_bridge_driver intel_815_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -1785,7 +1791,9 @@ static const struct agp_bridge_driver intel_830_driver = {
        .alloc_by_type          = intel_i830_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
        .chipset_flush          = intel_i830_chipset_flush,
 };
@@ -1810,7 +1818,9 @@ static const struct agp_bridge_driver intel_820_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -1834,7 +1844,9 @@ static const struct agp_bridge_driver intel_830mp_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -1858,7 +1870,9 @@ static const struct agp_bridge_driver intel_840_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -1882,7 +1896,9 @@ static const struct agp_bridge_driver intel_845_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
        .chipset_flush          = intel_i830_chipset_flush,
 };
@@ -1907,7 +1923,9 @@ static const struct agp_bridge_driver intel_850_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -1931,7 +1949,9 @@ static const struct agp_bridge_driver intel_860_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -1956,7 +1976,9 @@ static const struct agp_bridge_driver intel_915_driver = {
        .alloc_by_type          = intel_i830_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
        .chipset_flush          = intel_i915_chipset_flush,
 };
@@ -1982,7 +2004,9 @@ static const struct agp_bridge_driver intel_i965_driver = {
        .alloc_by_type          = intel_i830_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
        .chipset_flush          = intel_i915_chipset_flush,
 };
@@ -2007,7 +2031,9 @@ static const struct agp_bridge_driver intel_7505_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -2032,7 +2058,9 @@ static const struct agp_bridge_driver intel_g33_driver = {
        .alloc_by_type          = intel_i830_alloc_by_type,
        .free_by_type           = intel_i810_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
        .chipset_flush          = intel_i915_chipset_flush,
 };
index eaceb61ba2dc3508e0244a58eb553c770163a3f9..dc70d3771811a1d820bc020d73929ebfd491ad18 100644 (file)
@@ -312,7 +312,9 @@ static const struct agp_bridge_driver nvidia_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
index 8c42dcc5958c687312495185353644c78ae8a5e0..f2492ecf082410da192b140d9a0615624ca79f3b 100644 (file)
@@ -224,7 +224,9 @@ static const struct agp_bridge_driver parisc_agp_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
        .cant_use_aperture      = true,
 };
index 2587ef96a9603afdd965ce016be1806eab000a70..6c3837a0184dd8ca0f56ca0c12f90243a0914dd8 100644 (file)
@@ -140,7 +140,9 @@ static struct agp_bridge_driver sis_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
index 2fb27fe4c10c186d4003c314c4f53b456f87e799..6224df8b7f0a4302a898941a2ec3015dddae097d 100644 (file)
@@ -437,7 +437,9 @@ static const struct agp_bridge_driver sworks_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
index eef72709ec5331902291c26f37eb9301daba48af..0f004b65ec0384e383cf12eced1320e311560031 100644 (file)
@@ -509,7 +509,9 @@ const struct agp_bridge_driver uninorth_agp_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
        .cant_use_aperture      = true,
 };
@@ -534,7 +536,9 @@ const struct agp_bridge_driver u3_agp_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
        .cant_use_aperture      = true,
        .needs_scratch_page     = true,
index 7b36476dff411d9c1e4774441feb55897dd1a582..9f4d49e1b59a909249ac6297aacd0a3aebfd3669 100644 (file)
@@ -190,7 +190,9 @@ static const struct agp_bridge_driver via_agp3_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
@@ -214,7 +216,9 @@ static const struct agp_bridge_driver via_driver = {
        .alloc_by_type          = agp_generic_alloc_by_type,
        .free_by_type           = agp_generic_free_by_type,
        .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_alloc_pages        = agp_generic_alloc_pages,
        .agp_destroy_page       = agp_generic_destroy_page,
+       .agp_destroy_pages      = agp_generic_destroy_pages,
        .agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
index daeb8f76697123bf47015e0145e5a15ccfe86940..e4dce87095410f8f648137ecb992927a6630c483 100644 (file)
@@ -695,13 +695,23 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line)
 {
        struct tty_driver *p, *res = NULL;
        int tty_line = 0;
+       int len;
        char *str;
 
+       for (str = name; *str; str++)
+               if ((*str >= '0' && *str <= '9') || *str == ',')
+                       break;
+       if (!*str)
+               return NULL;
+
+       len = str - name;
+       tty_line = simple_strtoul(str, &str, 10);
+
        mutex_lock(&tty_mutex);
        /* Search through the tty devices to look for a match */
        list_for_each_entry(p, &tty_drivers, tty_drivers) {
-               str = name + strlen(p->name);
-               tty_line = simple_strtoul(str, &str, 10);
+               if (strncmp(name, p->name, len) != 0)
+                       continue;
                if (*str == ',')
                        str++;
                if (*str == '\0')
index 4eee533f3f4af7e8f5c9d811c7ac671d95d05083..71d2ac4e3f46cc0e33410a2d8f7889ac1ae8de09 100644 (file)
@@ -178,11 +178,13 @@ static int verify_pmtmr_rate(void)
 
 /* Number of monotonicity checks to perform during initialization */
 #define ACPI_PM_MONOTONICITY_CHECKS 10
+/* Number of reads we try to get two different values */
+#define ACPI_PM_READ_CHECKS 10000
 
 static int __init init_acpi_pm_clocksource(void)
 {
        cycle_t value1, value2;
-       unsigned int i, j, good = 0;
+       unsigned int i, j = 0;
 
        if (!pmtmr_ioport)
                return -ENODEV;
@@ -192,29 +194,26 @@ static int __init init_acpi_pm_clocksource(void)
 
        /* "verify" this timing source: */
        for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) {
+               udelay(100 * j);
                value1 = clocksource_acpi_pm.read();
-               for (i = 0; i < 10000; i++) {
+               for (i = 0; i < ACPI_PM_READ_CHECKS; i++) {
                        value2 = clocksource_acpi_pm.read();
                        if (value2 == value1)
                                continue;
                        if (value2 > value1)
-                               good++;
                                break;
                        if ((value2 < value1) && ((value2) < 0xFFF))
-                               good++;
                                break;
                        printk(KERN_INFO "PM-Timer had inconsistent results:"
                               " 0x%#llx, 0x%#llx - aborting.\n",
                               value1, value2);
                        return -EINVAL;
                }
-               udelay(300 * i);
-       }
-
-       if (good != ACPI_PM_MONOTONICITY_CHECKS) {
-               printk(KERN_INFO "PM-Timer failed consistency check "
-                      " (0x%#llx) - aborting.\n", value1);
-               return -ENODEV;
+               if (i == ACPI_PM_READ_CHECKS) {
+                       printk(KERN_INFO "PM-Timer failed consistency check "
+                              " (0x%#llx) - aborting.\n", value1);
+                       return -ENODEV;
+               }
        }
 
        if (verify_pmtmr_rate() != 0)
index ee827a7f7c6a48257e5af20219dcb256421d8994..b6ad3ac5916e0311d989fb3241b04f6327b62912 100644 (file)
@@ -1157,6 +1157,8 @@ static int aead_authenc_givencrypt(
        edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_MODE0_ENCRYPT;
 
        memcpy(req->giv, ctx->iv, crypto_aead_ivsize(authenc));
+       /* avoid consecutive packets going out with same IV */
+       *(__be64 *)req->giv ^= cpu_to_be64(req->seq);
 
        return ipsec_esp(edesc, areq, req->giv, req->seq,
                         ipsec_esp_encrypt_done);
@@ -1449,6 +1451,8 @@ static int talitos_probe(struct of_device *ofdev,
 
        priv->ofdev = ofdev;
 
+       INIT_LIST_HEAD(&priv->alg_list);
+
        tasklet_init(&priv->done_task, talitos_done, (unsigned long)dev);
        tasklet_init(&priv->error_task, talitos_error, (unsigned long)dev);
 
@@ -1575,8 +1579,6 @@ static int talitos_probe(struct of_device *ofdev,
        }
 
        /* register crypto algorithms the device supports */
-       INIT_LIST_HEAD(&priv->alg_list);
-
        for (i = 0; i < ARRAY_SIZE(driver_algs); i++) {
                if (hw_supports(dev, driver_algs[i].desc_hdr_template)) {
                        struct talitos_crypto_alg *t_alg;
index 94df91771243565aa2b660b2a0eed0dc5d2013a3..0778d99aea7c3e6c53e56cdb92b6f11320a6c9f5 100644 (file)
@@ -364,7 +364,7 @@ static void dw_dma_tasklet(unsigned long data)
        int i;
 
        status_block = dma_readl(dw, RAW.BLOCK);
-       status_xfer = dma_readl(dw, RAW.BLOCK);
+       status_xfer = dma_readl(dw, RAW.XFER);
        status_err = dma_readl(dw, RAW.ERROR);
 
        dev_vdbg(dw->dma.dev, "tasklet: status_block=%x status_err=%x\n",
index d568c65c137089a1f6402237404c80bb1d402dc1..d9e7a49d6cbf089da4f14f054695bf6be727200e 100644 (file)
@@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
                { "OTES1 Fan",          36, 2, 60, 1, 0 },
                { NULL, 0, 0, 0, 0, 0 } }
        },
-       { 0x0011, NULL /* Abit AT8 32X, need DMI string */, {
+       { 0x0011, "AT8 32X(ATI RD580-ULI M1575)", {
                { "CPU Core",            0, 0, 10, 1, 0 },
                { "DDR",                 1, 0, 20, 1, 0 },
                { "DDR VTT",             2, 0, 10, 1, 0 },
@@ -303,6 +303,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
                { "SYS Fan",            34, 2, 60, 1, 0 },
                { "AUX1 Fan",           35, 2, 60, 1, 0 },
                { "AUX2 Fan",           36, 2, 60, 1, 0 },
+               { "AUX3 Fan",           37, 2, 60, 1, 0 },
                { NULL, 0, 0, 0, 0, 0 } }
        },
        { 0x0012, NULL /* Abit AN8 32X, need DMI string */, {
index ce8d94fbfd7e24b584da17e743fd729d30971e18..bfda8c80ef2473923a1ff1e38db845252b0bb16b 100644 (file)
@@ -69,7 +69,7 @@ static inline int ad7414_write(struct i2c_client *client, u8 reg, u8 value)
        return i2c_smbus_write_byte_data(client, reg, value);
 }
 
-struct ad7414_data *ad7414_update_device(struct device *dev)
+static struct ad7414_data *ad7414_update_device(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
        struct ad7414_data *data = i2c_get_clientdata(client);
index d191118ba0cbc2964b288492abed58be4022c91c..d6b490d3e36f029660e079f6f42802329cd4bf4b 100644 (file)
@@ -31,7 +31,7 @@
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("System voltages control via Attansic ATXP1");
-MODULE_VERSION("0.6.2");
+MODULE_VERSION("0.6.3");
 MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>");
 
 #define ATXP1_VID      0x00
@@ -289,16 +289,16 @@ static int atxp1_detect(struct i2c_client *new_client, int kind,
        if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) &&
             (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) &&
             (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) &&
-            (i2c_smbus_read_byte_data(new_client, 0xff) == 0) )) {
+            (i2c_smbus_read_byte_data(new_client, 0xff) == 0)))
+               return -ENODEV;
 
-               /* No vendor ID, now checking if registers 0x10,0x11 (non-existent)
-                * showing the same as register 0x00 */
-               temp = i2c_smbus_read_byte_data(new_client, 0x00);
+       /* No vendor ID, now checking if registers 0x10,0x11 (non-existent)
+        * showing the same as register 0x00 */
+       temp = i2c_smbus_read_byte_data(new_client, 0x00);
 
-               if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) &&
-                        (i2c_smbus_read_byte_data(new_client, 0x11) == temp) ))
-                       return -ENODEV;
-       }
+       if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) &&
+             (i2c_smbus_read_byte_data(new_client, 0x11) == temp)))
+               return -ENODEV;
 
        /* Get VRM */
        temp = vid_which_vrm();
index 30cdb0956779646d311476078a9c30ebc6f643ca..d793cc0119908abd5494ed9f531a27f3dbbb478b 100644 (file)
@@ -46,6 +46,8 @@
 #include <linux/err.h>
 #include <linux/mutex.h>
 #include <linux/sysfs.h>
+#include <linux/string.h>
+#include <linux/dmi.h>
 #include <asm/io.h>
 
 #define DRVNAME "it87"
@@ -236,6 +238,8 @@ struct it87_sio_data {
        /* Values read from Super-I/O config space */
        u8 revision;
        u8 vid_value;
+       /* Values set based on DMI strings */
+       u8 skip_pwm;
 };
 
 /* For each registered chip, we need to keep some data in memory.
@@ -273,10 +277,10 @@ struct it87_data {
 static inline int has_16bit_fans(const struct it87_data *data)
 {
        /* IT8705F Datasheet 0.4.1, 3h == Version G.
-          IT8712F Datasheet 0.9.1, section 8.3.5 indicates 7h == Version I.
+          IT8712F Datasheet 0.9.1, section 8.3.5 indicates 8h == Version J.
           These are the first revisions with 16bit tachometer support. */
        return (data->type == it87 && data->revision >= 0x03)
-           || (data->type == it8712 && data->revision >= 0x07)
+           || (data->type == it8712 && data->revision >= 0x08)
            || data->type == it8716
            || data->type == it8718;
 }
@@ -964,6 +968,7 @@ static int __init it87_find(unsigned short *address,
 {
        int err = -ENODEV;
        u16 chip_type;
+       const char *board_vendor, *board_name;
 
        superio_enter();
        chip_type = force_id ? force_id : superio_inw(DEVID);
@@ -1022,6 +1027,24 @@ static int __init it87_find(unsigned short *address,
                        pr_info("it87: in7 is VCCH (+5V Stand-By)\n");
        }
 
+       /* Disable specific features based on DMI strings */
+       board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
+       board_name = dmi_get_system_info(DMI_BOARD_NAME);
+       if (board_vendor && board_name) {
+               if (strcmp(board_vendor, "nVIDIA") == 0
+                && strcmp(board_name, "FN68PT") == 0) {
+                       /* On the Shuttle SN68PT, FAN_CTL2 is apparently not
+                          connected to a fan, but to something else. One user
+                          has reported instant system power-off when changing
+                          the PWM2 duty cycle, so we disable it.
+                          I use the board name string as the trigger in case
+                          the same board is ever used in other systems. */
+                       pr_info("it87: Disabling pwm2 due to "
+                               "hardware constraints\n");
+                       sio_data->skip_pwm = (1 << 1);
+               }
+       }
+
 exit:
        superio_exit();
        return err;
@@ -1168,25 +1191,33 @@ static int __devinit it87_probe(struct platform_device *pdev)
        }
 
        if (enable_pwm_interface) {
-               if ((err = device_create_file(dev,
-                    &sensor_dev_attr_pwm1_enable.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm2_enable.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm3_enable.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm1.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm2.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm3.dev_attr))
-                || (err = device_create_file(dev,
-                    &dev_attr_pwm1_freq))
-                || (err = device_create_file(dev,
-                    &dev_attr_pwm2_freq))
-                || (err = device_create_file(dev,
-                    &dev_attr_pwm3_freq)))
-                       goto ERROR4;
+               if (!(sio_data->skip_pwm & (1 << 0))) {
+                       if ((err = device_create_file(dev,
+                            &sensor_dev_attr_pwm1_enable.dev_attr))
+                        || (err = device_create_file(dev,
+                            &sensor_dev_attr_pwm1.dev_attr))
+                        || (err = device_create_file(dev,
+                            &dev_attr_pwm1_freq)))
+                               goto ERROR4;
+               }
+               if (!(sio_data->skip_pwm & (1 << 1))) {
+                       if ((err = device_create_file(dev,
+                            &sensor_dev_attr_pwm2_enable.dev_attr))
+                        || (err = device_create_file(dev,
+                            &sensor_dev_attr_pwm2.dev_attr))
+                        || (err = device_create_file(dev,
+                            &dev_attr_pwm2_freq)))
+                               goto ERROR4;
+               }
+               if (!(sio_data->skip_pwm & (1 << 2))) {
+                       if ((err = device_create_file(dev,
+                            &sensor_dev_attr_pwm3_enable.dev_attr))
+                        || (err = device_create_file(dev,
+                            &sensor_dev_attr_pwm3.dev_attr))
+                        || (err = device_create_file(dev,
+                            &dev_attr_pwm3_freq)))
+                               goto ERROR4;
+               }
        }
 
        if (data->type == it8712 || data->type == it8716
@@ -1546,6 +1577,7 @@ static int __init sm_it87_init(void)
        unsigned short isa_address=0;
        struct it87_sio_data sio_data;
 
+       memset(&sio_data, 0, sizeof(struct it87_sio_data));
        err = it87_find(&isa_address, &sio_data);
        if (err)
                return err;
index 22f6d5c00d80e85829dc5d81133cc5cb2f9c6029..0e7b1c6724aa5e0059deede2ca40f3cf5fcd89e8 100644 (file)
@@ -180,7 +180,7 @@ static const struct i2c_algorithm i2c_powermac_algorithm = {
 };
 
 
-static int i2c_powermac_remove(struct platform_device *dev)
+static int __devexit i2c_powermac_remove(struct platform_device *dev)
 {
        struct i2c_adapter      *adapter = platform_get_drvdata(dev);
        struct pmac_i2c_bus     *bus = i2c_get_adapdata(adapter);
@@ -200,7 +200,7 @@ static int i2c_powermac_remove(struct platform_device *dev)
 }
 
 
-static int __devexit i2c_powermac_probe(struct platform_device *dev)
+static int __devinit i2c_powermac_probe(struct platform_device *dev)
 {
        struct pmac_i2c_bus *bus = dev->dev.platform_data;
        struct device_node *parent = NULL;
index af4491fa7e347c3059b50d6bf68d509cdb24ea5b..307d976c9b69b977c389e62abfbe43682b1d3e24 100644 (file)
@@ -583,8 +583,10 @@ static int __init i2c_dev_init(void)
                goto out;
 
        i2c_dev_class = class_create(THIS_MODULE, "i2c-dev");
-       if (IS_ERR(i2c_dev_class))
+       if (IS_ERR(i2c_dev_class)) {
+               res = PTR_ERR(i2c_dev_class);
                goto out_unreg_chrdev;
+       }
 
        res = i2c_add_driver(&i2cdev_driver);
        if (res)
index fc735ab08ff4f8f3f80c82e911242a2f54f84758..052879a6f8534bf55296e48918c030178f5f99b7 100644 (file)
@@ -292,6 +292,20 @@ config IDE_GENERIC
        tristate "generic/default IDE chipset support"
        depends on ALPHA || X86 || IA64 || M32R || MIPS
        help
+         This is the generic IDE driver.  This driver attaches to the
+         fixed legacy ports (e.g. on PCs 0x1f0/0x170, 0x1e8/0x168 and
+         so on).  Please note that if this driver is built into the
+         kernel or loaded before other ATA (IDE or libata) drivers
+         and the controller is located at legacy ports, this driver
+         may grab those ports and thus can prevent the controller
+         specific driver from attaching.
+
+         Also, currently, IDE generic doesn't allow IRQ sharing
+         meaning that the IRQs it grabs won't be available to other
+         controllers sharing those IRQs which usually makes drivers
+         for those controllers fail.  Generally, it's not a good idea
+         to load IDE generic driver on modern systems.
+
          If unsure, say N.
 
 config BLK_DEV_PLATFORM
@@ -766,10 +780,6 @@ config BLK_DEV_IDEDMA_PMAC
          to transfer data to and from memory.  Saying Y is safe and improves
          performance.
 
-config BLK_DEV_IDE_SWARM
-       tristate "IDE for Sibyte evaluation boards"
-       depends on SIBYTE_SB1xxx_SOC
-
 config BLK_DEV_IDE_AU1XXX
        bool "IDE for AMD Alchemy Au1200"
        depends on SOC_AU1200
index 49a8c589e346c15982e158e5116c9fd930aa9b46..f16bb4667238acb65d0a9f3af3ee1421858194a6 100644 (file)
@@ -1661,7 +1661,9 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
                cdi->mask &= ~CDC_PLAY_AUDIO;
 
        mechtype = buf[8 + 6] >> 5;
-       if (mechtype == mechtype_caddy || mechtype == mechtype_popup)
+       if (mechtype == mechtype_caddy ||
+           mechtype == mechtype_popup ||
+           (drive->atapi_flags & IDE_AFLAG_NO_AUTOCLOSE))
                cdi->mask |= CDC_CLOSE_TRAY;
 
        if (cdi->sanyo_slot > 0) {
@@ -1859,6 +1861,8 @@ static const struct cd_list_entry ide_cd_quirks_list[] = {
        { "MATSHITADVD-ROM SR-8176", NULL,   IDE_AFLAG_PLAY_AUDIO_OK         },
        { "MATSHITADVD-ROM SR-8174", NULL,   IDE_AFLAG_PLAY_AUDIO_OK         },
        { "Optiarc DVD RW AD-5200A", NULL,   IDE_AFLAG_PLAY_AUDIO_OK         },
+       { "Optiarc DVD RW AD-7200A", NULL,   IDE_AFLAG_PLAY_AUDIO_OK         },
+       { "Optiarc DVD RW AD-7543A", NULL,   IDE_AFLAG_NO_AUTOCLOSE          },
        { NULL, NULL, 0 }
 };
 
index adc6827558577b32e3d3b144aac17197e6cf03fe..3fa07c0aeaa433e2ba3bfdc769c669ae05f8d71d 100644 (file)
@@ -211,7 +211,7 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq)
                                xcount = bcount & 0xffff;
                                if (is_trm290)
                                        xcount = ((xcount >> 2) - 1) << 16;
-                               if (xcount == 0x0000) {
+                               else if (xcount == 0x0000) {
        /* 
         * Most chipsets correctly interpret a length of 0x0000 as 64KB,
         * but at least one (e.g. CS5530) misinterprets it as zero (!).
index 994e41099b42e5e95ed08cce0154bb89b6e727b0..a51a30e9eab3c1e1712fc3924fa934113acef10a 100644 (file)
@@ -1492,7 +1492,7 @@ static struct device_attribute *ide_port_attrs[] = {
 
 static int ide_sysfs_register_port(ide_hwif_t *hwif)
 {
-       int i, rc;
+       int i, uninitialized_var(rc);
 
        for (i = 0; ide_port_attrs[i]; i++) {
                rc = device_create_file(hwif->portdev, ide_port_attrs[i]);
index 1bce84b566304115c2834a1742f03284e2c25ce9..3833189144edd507de0c26339ca8687ed734dedc 100644 (file)
@@ -2338,7 +2338,7 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
 {
        idetape_tape_t *tape = drive->driver_data;
        struct ide_atapi_pc pc;
-       char fw_rev[6], vendor_id[10], product_id[18];
+       char fw_rev[4], vendor_id[8], product_id[16];
 
        idetape_create_inquiry_cmd(&pc);
        if (idetape_queue_pc_tail(drive, &pc)) {
@@ -2350,11 +2350,11 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
        memcpy(product_id, &pc.buf[16], 16);
        memcpy(fw_rev, &pc.buf[32], 4);
 
-       ide_fixstring(vendor_id, 10, 0);
-       ide_fixstring(product_id, 18, 0);
-       ide_fixstring(fw_rev, 6, 0);
+       ide_fixstring(vendor_id, 8, 0);
+       ide_fixstring(product_id, 16, 0);
+       ide_fixstring(fw_rev, 4, 0);
 
-       printk(KERN_INFO "ide-tape: %s <-> %s: %s %s rev %s\n",
+       printk(KERN_INFO "ide-tape: %s <-> %s: %.8s %.16s rev %.4s\n",
                        drive->name, tape->name, vendor_id, product_id, fw_rev);
 }
 
index 677c7b2bac92419879119205bf209c88289879ca..5873fa0b8769e40288dfc2f1bf67d0dec4802782 100644 (file)
@@ -1,4 +1,3 @@
-obj-$(CONFIG_BLK_DEV_IDE_SWARM)                += swarm.o
 obj-$(CONFIG_BLK_DEV_IDE_AU1XXX)       += au1xxx-ide.o
 
 EXTRA_CFLAGS    := -Idrivers/ide
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
deleted file mode 100644 (file)
index badf79f..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
- * Copyright (C) 2004 MontaVista Software Inc.
- *     Author: Manish Lachwani, mlachwani@mvista.com
- * Copyright (C) 2004  MIPS Technologies, Inc.  All rights reserved.
- *     Author: Maciej W. Rozycki <macro@mips.com>
- * Copyright (c) 2006, 2008  Maciej W. Rozycki
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-/*
- *  Derived loosely from ide-pmac.c, so:
- *  Copyright (C) 1998 Paul Mackerras.
- *  Copyright (C) 1995-1998 Mark Lord
- */
-
-/*
- * Boards with SiByte processors so far have supported IDE devices via
- * the Generic Bus, PCI bus, and built-in PCMCIA interface.  In all
- * cases, byte-swapping must be avoided for these devices (whereas
- * other PCI devices, for example, will require swapping).  Any
- * SiByte-targetted kernel including IDE support will include this
- * file.  Probing of a Generic Bus for an IDE device is controlled by
- * the definition of "SIBYTE_HAVE_IDE", which is provided by
- * <asm/sibyte/board.h> for Broadcom boards.
- */
-
-#include <linux/ide.h>
-#include <linux/ioport.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/platform_device.h>
-
-#include <asm/io.h>
-
-#include <asm/sibyte/board.h>
-#include <asm/sibyte/sb1250_genbus.h>
-#include <asm/sibyte/sb1250_regs.h>
-
-#define DRV_NAME "ide-swarm"
-
-static char swarm_ide_string[] = DRV_NAME;
-
-static struct resource swarm_ide_resource = {
-       .name   = "SWARM GenBus IDE",
-       .flags  = IORESOURCE_MEM,
-};
-
-static struct platform_device *swarm_ide_dev;
-
-static const struct ide_port_info swarm_port_info = {
-       .name                   = DRV_NAME,
-       .host_flags             = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
-};
-
-/*
- * swarm_ide_probe - if the board header indicates the existence of
- * Generic Bus IDE, allocate a HWIF for it.
- */
-static int __devinit swarm_ide_probe(struct device *dev)
-{
-       u8 __iomem *base;
-       struct ide_host *host;
-       phys_t offset, size;
-       int i, rc;
-       hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
-
-       if (!SIBYTE_HAVE_IDE)
-               return -ENODEV;
-
-       base = ioremap(A_IO_EXT_BASE, 0x800);
-       offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
-       size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
-       iounmap(base);
-
-       offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE;
-       size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE;
-       if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) {
-               printk(KERN_INFO DRV_NAME
-                      ": IDE interface at GenBus disabled\n");
-               return -EBUSY;
-       }
-
-       printk(KERN_INFO DRV_NAME ": IDE interface at GenBus slot %i\n",
-              IDE_CS);
-
-       swarm_ide_resource.start = offset;
-       swarm_ide_resource.end = offset + size - 1;
-       if (request_resource(&iomem_resource, &swarm_ide_resource)) {
-               printk(KERN_ERR DRV_NAME
-                      ": can't request I/O memory resource\n");
-               return -EBUSY;
-       }
-
-       base = ioremap(offset, size);
-
-       for (i = 0; i <= 7; i++)
-               hw.io_ports_array[i] =
-                               (unsigned long)(base + ((0x1f0 + i) << 5));
-       hw.io_ports.ctl_addr =
-                               (unsigned long)(base + (0x3f6 << 5));
-       hw.irq = K_INT_GB_IDE;
-       hw.chipset = ide_generic;
-
-       rc = ide_host_add(&swarm_port_info, hws, &host);
-       if (rc)
-               goto err;
-
-       dev_set_drvdata(dev, host);
-
-       return 0;
-err:
-       release_resource(&swarm_ide_resource);
-       iounmap(base);
-       return rc;
-}
-
-static struct device_driver swarm_ide_driver = {
-       .name   = swarm_ide_string,
-       .bus    = &platform_bus_type,
-       .probe  = swarm_ide_probe,
-};
-
-static void swarm_ide_platform_release(struct device *device)
-{
-       struct platform_device *pldev;
-
-       /* free device */
-       pldev = to_platform_device(device);
-       kfree(pldev);
-}
-
-static int __devinit swarm_ide_init_module(void)
-{
-       struct platform_device *pldev;
-       int err;
-
-       printk(KERN_INFO "SWARM IDE driver\n");
-
-       if (driver_register(&swarm_ide_driver)) {
-               printk(KERN_ERR "Driver registration failed\n");
-               err = -ENODEV;
-               goto out;
-       }
-
-        if (!(pldev = kzalloc(sizeof (*pldev), GFP_KERNEL))) {
-               err = -ENOMEM;
-               goto out_unregister_driver;
-       }
-
-       pldev->name             = swarm_ide_string;
-       pldev->id               = 0;
-       pldev->dev.release      = swarm_ide_platform_release;
-
-       if (platform_device_register(pldev)) {
-               err = -ENODEV;
-               goto out_free_pldev;
-       }
-
-        if (!pldev->dev.driver) {
-               /*
-                * The driver was not bound to this device, there was
-                 * no hardware at this address. Unregister it, as the
-                * release fuction will take care of freeing the
-                * allocated structure
-                */
-               platform_device_unregister (pldev);
-       }
-
-       swarm_ide_dev = pldev;
-
-       return 0;
-
-out_free_pldev:
-       kfree(pldev);
-
-out_unregister_driver:
-       driver_unregister(&swarm_ide_driver);
-out:
-       return err;
-}
-
-module_init(swarm_ide_init_module);
index f29dbb767e87c3c0f77b5f23c8c58de06e85c169..9559248f265b80090aeecd8c693059e9e43bdad0 100644 (file)
@@ -1342,6 +1342,12 @@ static __be32 convert_access(int acc)
 static void set_fmr_seg(struct mlx4_wqe_fmr_seg *fseg, struct ib_send_wr *wr)
 {
        struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(wr->wr.fast_reg.page_list);
+       int i;
+
+       for (i = 0; i < wr->wr.fast_reg.page_list_len; ++i)
+               wr->wr.fast_reg.page_list->page_list[i] =
+                       cpu_to_be64(wr->wr.fast_reg.page_list->page_list[i] |
+                                   MLX4_MTT_FLAG_PRESENT);
 
        fseg->flags             = convert_access(wr->wr.fast_reg.access_flags);
        fseg->mem_key           = cpu_to_be32(wr->wr.fast_reg.rkey);
index 9f0b964b2c9932af7567dcae6efc7d98c6c01728..499d3cf83e1f28e2ee263ed3e92e2fdb18d1f59b 100644 (file)
@@ -1956,13 +1956,6 @@ static int mini_cm_reject(struct nes_cm_core *cm_core,
                return ret;
        cleanup_retrans_entry(cm_node);
        cm_node->state = NES_CM_STATE_CLOSED;
-       ret = send_fin(cm_node, NULL);
-
-       if (cm_node->accept_pend) {
-               BUG_ON(!cm_node->listener);
-               atomic_dec(&cm_node->listener->pend_accepts_cnt);
-               BUG_ON(atomic_read(&cm_node->listener->pend_accepts_cnt) < 0);
-       }
 
        ret = send_reset(cm_node, NULL);
        return ret;
@@ -2383,6 +2376,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
                        atomic_inc(&cm_disconnects);
                        cm_event.event = IW_CM_EVENT_DISCONNECT;
                        if (last_ae == NES_AEQE_AEID_LLP_CONNECTION_RESET) {
+                               issued_disconnect_reset = 1;
                                cm_event.status = IW_CM_EVENT_STATUS_RESET;
                                nes_debug(NES_DBG_CM, "Generating a CM "
                                        "Disconnect Event (status reset) for "
@@ -2508,7 +2502,6 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
                nes_debug(NES_DBG_CM, "Call close API\n");
 
                g_cm_core->api->close(g_cm_core, nesqp->cm_node);
-               nesqp->cm_node = NULL;
        }
 
        return ret;
@@ -2837,6 +2830,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
        cm_node->apbvt_set = 1;
        nesqp->cm_node = cm_node;
        cm_node->nesqp = nesqp;
+       nes_add_ref(&nesqp->ibqp);
 
        return 0;
 }
@@ -3167,7 +3161,6 @@ static void cm_event_connect_error(struct nes_cm_event *event)
        if (ret)
                printk(KERN_ERR "%s[%u] OFA CM event_handler returned, "
                        "ret=%d\n", __func__, __LINE__, ret);
-       nes_rem_ref(&nesqp->ibqp);
        cm_id->rem_ref(cm_id);
 
        rem_ref_cm_node(event->cm_node->cm_core, event->cm_node);
index b0ffc9abe8c082fa1c32e112e8aa50d9e06bca83..05eb41b8ab631692fcd46686eedc0940443236c9 100644 (file)
@@ -293,6 +293,7 @@ struct ipoib_dev_priv {
 
        struct delayed_work pkey_poll_task;
        struct delayed_work mcast_task;
+       struct work_struct carrier_on_task;
        struct work_struct flush_light;
        struct work_struct flush_normal;
        struct work_struct flush_heavy;
@@ -464,6 +465,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port);
 void ipoib_dev_cleanup(struct net_device *dev);
 
 void ipoib_mcast_join_task(struct work_struct *work);
+void ipoib_mcast_carrier_on_task(struct work_struct *work);
 void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb);
 
 void ipoib_mcast_restart_task(struct work_struct *work);
index 7e9e218738fa0f4be74741266e690d7c4211e6e0..e9ca3cb57d5219960f9f67adf7eadb19dabc206e 100644 (file)
@@ -404,7 +404,7 @@ static void path_rec_completion(int status,
        struct net_device *dev = path->dev;
        struct ipoib_dev_priv *priv = netdev_priv(dev);
        struct ipoib_ah *ah = NULL;
-       struct ipoib_ah *old_ah;
+       struct ipoib_ah *old_ah = NULL;
        struct ipoib_neigh *neigh, *tn;
        struct sk_buff_head skqueue;
        struct sk_buff *skb;
@@ -428,12 +428,12 @@ static void path_rec_completion(int status,
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       old_ah   = path->ah;
-       path->ah = ah;
-
        if (ah) {
                path->pathrec = *pathrec;
 
+               old_ah   = path->ah;
+               path->ah = ah;
+
                ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n",
                          ah, be16_to_cpu(pathrec->dlid), pathrec->sl);
 
@@ -1075,6 +1075,7 @@ static void ipoib_setup(struct net_device *dev)
 
        INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll);
        INIT_DELAYED_WORK(&priv->mcast_task,   ipoib_mcast_join_task);
+       INIT_WORK(&priv->carrier_on_task, ipoib_mcast_carrier_on_task);
        INIT_WORK(&priv->flush_light,   ipoib_ib_dev_flush_light);
        INIT_WORK(&priv->flush_normal,   ipoib_ib_dev_flush_normal);
        INIT_WORK(&priv->flush_heavy,   ipoib_ib_dev_flush_heavy);
index ac33c8f3ea8580e5120dd98704cfbccb0ccd5c71..aae28620a6e5f01a3650ce59b5c8d35f65b4ca28 100644 (file)
@@ -366,6 +366,21 @@ static int ipoib_mcast_sendonly_join(struct ipoib_mcast *mcast)
        return ret;
 }
 
+void ipoib_mcast_carrier_on_task(struct work_struct *work)
+{
+       struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv,
+                                                  carrier_on_task);
+
+       /*
+        * Take rtnl_lock to avoid racing with ipoib_stop() and
+        * turning the carrier back on while a device is being
+        * removed.
+        */
+       rtnl_lock();
+       netif_carrier_on(priv->dev);
+       rtnl_unlock();
+}
+
 static int ipoib_mcast_join_complete(int status,
                                     struct ib_sa_multicast *multicast)
 {
@@ -392,16 +407,12 @@ static int ipoib_mcast_join_complete(int status,
                                           &priv->mcast_task, 0);
                mutex_unlock(&mcast_mutex);
 
-               if (mcast == priv->broadcast) {
-                       /*
-                        * Take RTNL lock here to avoid racing with
-                        * ipoib_stop() and turning the carrier back
-                        * on while a device is being removed.
-                        */
-                       rtnl_lock();
-                       netif_carrier_on(dev);
-                       rtnl_unlock();
-               }
+               /*
+                * Defer carrier on work to ipoib_workqueue to avoid a
+                * deadlock on rtnl_lock here.
+                */
+               if (mcast == priv->broadcast)
+                       queue_work(ipoib_workqueue, &priv->carrier_on_task);
 
                return 0;
        }
index 18f4d7f6ce6d0d3b983d34fffc7b6da437679cc7..2998a6ac9ae44f82aa4a61f88ccda12de56bf71e 100644 (file)
@@ -351,8 +351,9 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 #define BCM5974_WELLSPRING_MODE_REQUEST_VALUE          0x300
 #define BCM5974_WELLSPRING_MODE_REQUEST_INDEX          0
 #define BCM5974_WELLSPRING_MODE_VENDOR_VALUE           0x01
+#define BCM5974_WELLSPRING_MODE_NORMAL_VALUE           0x08
 
-static int bcm5974_wellspring_mode(struct bcm5974 *dev)
+static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
 {
        char *data = kmalloc(8, GFP_KERNEL);
        int retval = 0, size;
@@ -377,7 +378,9 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
        }
 
        /* apply the mode switch */
-       data[0] = BCM5974_WELLSPRING_MODE_VENDOR_VALUE;
+       data[0] = on ?
+               BCM5974_WELLSPRING_MODE_VENDOR_VALUE :
+               BCM5974_WELLSPRING_MODE_NORMAL_VALUE;
 
        /* write configuration */
        size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
@@ -392,7 +395,8 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
                goto out;
        }
 
-       dprintk(2, "bcm5974: switched to wellspring mode.\n");
+       dprintk(2, "bcm5974: switched to %s mode.\n",
+               on ? "wellspring" : "normal");
 
  out:
        kfree(data);
@@ -481,7 +485,7 @@ exit:
  */
 static int bcm5974_start_traffic(struct bcm5974 *dev)
 {
-       if (bcm5974_wellspring_mode(dev)) {
+       if (bcm5974_wellspring_mode(dev, true)) {
                dprintk(1, "bcm5974: mode switch failed\n");
                goto error;
        }
@@ -504,6 +508,7 @@ static void bcm5974_pause_traffic(struct bcm5974 *dev)
 {
        usb_kill_urb(dev->tp_urb);
        usb_kill_urb(dev->bt_urb);
+       bcm5974_wellspring_mode(dev, false);
 }
 
 /*
index bf44f9d68342bdcd41f4b63ed87737d60e8f70cf..c8b7e8a45c4d91292c09afeb239be90efe598c79 100644 (file)
@@ -119,8 +119,8 @@ static int __devinit jornada720_ts_probe(struct platform_device *pdev)
        input_dev->id.bustype = BUS_HOST;
        input_dev->dev.parent = &pdev->dev;
 
-       input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
-       input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
+       input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+       input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
        input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0);
        input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0);
 
index be0e12144b8b6d5cc03ca24c38caa3d98309e0ed..34935155c1c00077b6e94201cb4c5e6a534f1fad 100644 (file)
@@ -161,6 +161,16 @@ static int fsg_led_probe(struct platform_device *pdev)
 {
        int ret;
 
+       /* Map the LED chip select address space */
+       latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512);
+       if (!latch_address) {
+               ret = -ENOMEM;
+               goto failremap;
+       }
+
+       latch_value = 0xffff;
+       *latch_address = latch_value;
+
        ret = led_classdev_register(&pdev->dev, &fsg_wlan_led);
        if (ret < 0)
                goto failwlan;
@@ -185,20 +195,8 @@ static int fsg_led_probe(struct platform_device *pdev)
        if (ret < 0)
                goto failring;
 
-       /* Map the LED chip select address space */
-       latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512);
-       if (!latch_address) {
-               ret = -ENOMEM;
-               goto failremap;
-       }
-
-       latch_value = 0xffff;
-       *latch_address = latch_value;
-
        return ret;
 
- failremap:
-       led_classdev_unregister(&fsg_ring_led);
  failring:
        led_classdev_unregister(&fsg_sync_led);
  failsync:
@@ -210,14 +208,14 @@ static int fsg_led_probe(struct platform_device *pdev)
  failwan:
        led_classdev_unregister(&fsg_wlan_led);
  failwlan:
+       iounmap(latch_address);
+ failremap:
 
        return ret;
 }
 
 static int fsg_led_remove(struct platform_device *pdev)
 {
-       iounmap(latch_address);
-
        led_classdev_unregister(&fsg_wlan_led);
        led_classdev_unregister(&fsg_wan_led);
        led_classdev_unregister(&fsg_sata_led);
@@ -225,6 +223,8 @@ static int fsg_led_remove(struct platform_device *pdev)
        led_classdev_unregister(&fsg_sync_led);
        led_classdev_unregister(&fsg_ring_led);
 
+       iounmap(latch_address);
+
        return 0;
 }
 
index 146c06972863fae8d49629bfbb593c474a260ce0..f508729123b54795480eb1ec25092107fd4f4857 100644 (file)
@@ -248,11 +248,10 @@ static int __devinit pca955x_probe(struct i2c_client *client,
                                        const struct i2c_device_id *id)
 {
        struct pca955x_led *pca955x;
-       int i;
-       int err = -ENODEV;
        struct pca955x_chipdef *chip;
        struct i2c_adapter *adapter;
        struct led_platform_data *pdata;
+       int i, err;
 
        chip = &pca955x_chipdefs[id->driver_data];
        adapter = to_i2c_adapter(client->dev.parent);
@@ -282,43 +281,41 @@ static int __devinit pca955x_probe(struct i2c_client *client,
                }
        }
 
+       pca955x = kzalloc(sizeof(*pca955x) * chip->bits, GFP_KERNEL);
+       if (!pca955x)
+               return -ENOMEM;
+
+       i2c_set_clientdata(client, pca955x);
+
        for (i = 0; i < chip->bits; i++) {
-               pca955x = kzalloc(sizeof(struct pca955x_led), GFP_KERNEL);
-               if (!pca955x) {
-                       err = -ENOMEM;
-                       goto exit;
-               }
+               pca955x[i].chipdef = chip;
+               pca955x[i].client = client;
+               pca955x[i].led_num = i;
 
-               pca955x->chipdef = chip;
-               pca955x->client = client;
-               pca955x->led_num = i;
                /* Platform data can specify LED names and default triggers */
                if (pdata) {
                        if (pdata->leds[i].name)
-                               snprintf(pca955x->name, 32, "pca955x:%s",
-                                                       pdata->leds[i].name);
+                               snprintf(pca955x[i].name,
+                                        sizeof(pca955x[i].name), "pca955x:%s",
+                                        pdata->leds[i].name);
                        if (pdata->leds[i].default_trigger)
-                               pca955x->led_cdev.default_trigger =
+                               pca955x[i].led_cdev.default_trigger =
                                        pdata->leds[i].default_trigger;
                } else {
-                       snprintf(pca955x->name, 32, "pca955x:%d", i);
+                       snprintf(pca955x[i].name, sizeof(pca955x[i].name),
+                                "pca955x:%d", i);
                }
-               spin_lock_init(&pca955x->lock);
 
-               pca955x->led_cdev.name = pca955x->name;
-               pca955x->led_cdev.brightness_set =
-                               pca955x_led_set;
+               spin_lock_init(&pca955x[i].lock);
 
-               /*
-                * Client data is a pointer to the _first_ pca955x_led
-                * struct
-                */
-               if (i == 0)
-                       i2c_set_clientdata(client, pca955x);
+               pca955x[i].led_cdev.name = pca955x[i].name;
+               pca955x[i].led_cdev.brightness_set = pca955x_led_set;
 
-               INIT_WORK(&(pca955x->work), pca955x_led_work);
+               INIT_WORK(&pca955x[i].work, pca955x_led_work);
 
-               led_classdev_register(&client->dev, &(pca955x->led_cdev));
+               err = led_classdev_register(&client->dev, &pca955x[i].led_cdev);
+               if (err < 0)
+                       goto exit;
        }
 
        /* Turn off LEDs */
@@ -336,23 +333,32 @@ static int __devinit pca955x_probe(struct i2c_client *client,
        pca955x_write_psc(client, 1, 0);
 
        return 0;
+
 exit:
+       while (i--) {
+               led_classdev_unregister(&pca955x[i].led_cdev);
+               cancel_work_sync(&pca955x[i].work);
+       }
+
+       kfree(pca955x);
+       i2c_set_clientdata(client, NULL);
+
        return err;
 }
 
 static int __devexit pca955x_remove(struct i2c_client *client)
 {
        struct pca955x_led *pca955x = i2c_get_clientdata(client);
-       int leds = pca955x->chipdef->bits;
        int i;
 
-       for (i = 0; i < leds; i++) {
-               led_classdev_unregister(&(pca955x->led_cdev));
-               cancel_work_sync(&(pca955x->work));
-               kfree(pca955x);
-               pca955x = pca955x + 1;
+       for (i = 0; i < pca955x->chipdef->bits; i++) {
+               led_classdev_unregister(&pca955x[i].led_cdev);
+               cancel_work_sync(&pca955x[i].work);
        }
 
+       kfree(pca955x);
+       i2c_set_clientdata(client, NULL);
+
        return 0;
 }
 
index 71dd65aa31b696aa37a894b0d7bd9cbdc2034123..c2fcf28b4c7022b2ec66e0c9d661e8a87b5279c8 100644 (file)
@@ -63,6 +63,7 @@ struct multipath {
 
        const char *hw_handler_name;
        struct work_struct activate_path;
+       struct pgpath *pgpath_to_activate;
        unsigned nr_priority_groups;
        struct list_head priority_groups;
        unsigned pg_init_required;      /* pg_init needs calling? */
@@ -146,6 +147,7 @@ static struct priority_group *alloc_priority_group(void)
 
 static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti)
 {
+       unsigned long flags;
        struct pgpath *pgpath, *tmp;
        struct multipath *m = ti->private;
 
@@ -154,6 +156,10 @@ static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti)
                if (m->hw_handler_name)
                        scsi_dh_detach(bdev_get_queue(pgpath->path.dev->bdev));
                dm_put_device(ti, pgpath->path.dev);
+               spin_lock_irqsave(&m->lock, flags);
+               if (m->pgpath_to_activate == pgpath)
+                       m->pgpath_to_activate = NULL;
+               spin_unlock_irqrestore(&m->lock, flags);
                free_pgpath(pgpath);
        }
 }
@@ -421,6 +427,7 @@ static void process_queued_ios(struct work_struct *work)
                __choose_pgpath(m);
 
        pgpath = m->current_pgpath;
+       m->pgpath_to_activate = m->current_pgpath;
 
        if ((pgpath && !m->queue_io) ||
            (!pgpath && !m->queue_if_no_path))
@@ -1093,8 +1100,15 @@ static void activate_path(struct work_struct *work)
        int ret;
        struct multipath *m =
                container_of(work, struct multipath, activate_path);
-       struct dm_path *path = &m->current_pgpath->path;
+       struct dm_path *path;
+       unsigned long flags;
 
+       spin_lock_irqsave(&m->lock, flags);
+       path = &m->pgpath_to_activate->path;
+       m->pgpath_to_activate = NULL;
+       spin_unlock_irqrestore(&m->lock, flags);
+       if (!path)
+               return;
        ret = scsi_dh_activate(bdev_get_queue(path->dev->bdev));
        pg_init_done(path, ret);
 }
index bca448e118786a78a5e07b54f3cb3a7e3aca85d5..ace998ce59f6af2616da4a24eca66de8b59c69ba 100644 (file)
@@ -837,12 +837,14 @@ static int dm_merge_bvec(struct request_queue *q,
        struct dm_table *map = dm_get_table(md);
        struct dm_target *ti;
        sector_t max_sectors;
-       int max_size;
+       int max_size = 0;
 
        if (unlikely(!map))
-               return 0;
+               goto out;
 
        ti = dm_table_find_target(map, bvm->bi_sector);
+       if (!dm_target_is_valid(ti))
+               goto out_table;
 
        /*
         * Find maximum amount of I/O that won't need splitting
@@ -861,14 +863,16 @@ static int dm_merge_bvec(struct request_queue *q,
        if (max_size && ti->type->merge)
                max_size = ti->type->merge(ti, bvm, biovec, max_size);
 
+out_table:
+       dm_table_put(map);
+
+out:
        /*
         * Always allow an entire first page
         */
        if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT))
                max_size = biovec->bv_len;
 
-       dm_table_put(map);
-
        return max_size;
 }
 
index 4790c83d78d0cd52adbfb4d4c394eb9d7ec4c691..deeac4b44173d959b2fca6ca7f9abf57aa419f55 100644 (file)
@@ -5761,7 +5761,11 @@ void md_do_sync(mddev_t *mddev)
                                         * time 'round when curr_resync == 2
                                         */
                                        continue;
-                               prepare_to_wait(&resync_wait, &wq, TASK_UNINTERRUPTIBLE);
+                               /* We need to wait 'interruptible' so as not to
+                                * contribute to the load average, and not to
+                                * be caught by 'softlockup'
+                                */
+                               prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE);
                                if (!kthread_should_stop() &&
                                    mddev2->curr_resync >= mddev->curr_resync) {
                                        printk(KERN_INFO "md: delaying %s of %s"
@@ -5769,6 +5773,8 @@ void md_do_sync(mddev_t *mddev)
                                               " share one or more physical units)\n",
                                               desc, mdname(mddev), mdname(mddev2));
                                        mddev_put(mddev2);
+                                       if (signal_pending(current))
+                                               flush_signals(current);
                                        schedule();
                                        finish_wait(&resync_wait, &wq);
                                        goto try_again;
index 216025cf5d4bfdbe430851636818c69789987cab..2c5b6282b569203d8551cbcb23ff4e727318d756 100644 (file)
@@ -10,6 +10,7 @@
 #include "dvb_frontend.h"
 
 #define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw"
+#define XC3028L_DEFAULT_FIRMWARE "xc3028L-v36.fw"
 
 /*      Dmoduler               IF (kHz) */
 #define        XC3028_FE_DEFAULT       0               /* Don't load SCODE */
index 4eed783f4bce0daaa4e724e20bfbfe21f80cdef9..a127a4175c402a45c1940d7dec586762557544b5 100644 (file)
@@ -491,6 +491,7 @@ static struct s5h1420_config skystar2_rev2_7_s5h1420_config = {
        .demod_address = 0x53,
        .invert = 1,
        .repeated_start_workaround = 1,
+       .serial_mpeg = 1,
 };
 
 static struct itd1000_config skystar2_rev2_7_itd1000_config = {
index 069d847ba887c39e2f1f83eafdf7c06a07b838a7..0c733c66a44150d7abd6afdea0acbbd760fe385b 100644 (file)
@@ -364,15 +364,16 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
                                       enum dmx_success success)
 {
        struct dmxdev_filter *dmxdevfilter = filter->priv;
+       unsigned long flags;
        int ret;
 
        if (dmxdevfilter->buffer.error) {
                wake_up(&dmxdevfilter->buffer.queue);
                return 0;
        }
-       spin_lock(&dmxdevfilter->dev->lock);
+       spin_lock_irqsave(&dmxdevfilter->dev->lock, flags);
        if (dmxdevfilter->state != DMXDEV_STATE_GO) {
-               spin_unlock(&dmxdevfilter->dev->lock);
+               spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
                return 0;
        }
        del_timer(&dmxdevfilter->timer);
@@ -391,7 +392,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
        }
        if (dmxdevfilter->params.sec.flags & DMX_ONESHOT)
                dmxdevfilter->state = DMXDEV_STATE_DONE;
-       spin_unlock(&dmxdevfilter->dev->lock);
+       spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
        wake_up(&dmxdevfilter->buffer.queue);
        return 0;
 }
@@ -403,11 +404,12 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
 {
        struct dmxdev_filter *dmxdevfilter = feed->priv;
        struct dvb_ringbuffer *buffer;
+       unsigned long flags;
        int ret;
 
-       spin_lock(&dmxdevfilter->dev->lock);
+       spin_lock_irqsave(&dmxdevfilter->dev->lock, flags);
        if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) {
-               spin_unlock(&dmxdevfilter->dev->lock);
+               spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
                return 0;
        }
 
@@ -417,7 +419,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
        else
                buffer = &dmxdevfilter->dev->dvr_buffer;
        if (buffer->error) {
-               spin_unlock(&dmxdevfilter->dev->lock);
+               spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
                wake_up(&buffer->queue);
                return 0;
        }
@@ -428,7 +430,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
                dvb_ringbuffer_flush(buffer);
                buffer->error = ret;
        }
-       spin_unlock(&dmxdevfilter->dev->lock);
+       spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
        wake_up(&buffer->queue);
        return 0;
 }
index e2eca0b1fe7cfad6dc1215aa6d2bd1247497b93e..a2c1fd5d2f67b05b5b25da04cf6a8dc0d7e8da49 100644 (file)
@@ -399,7 +399,9 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
 void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
                              size_t count)
 {
-       spin_lock(&demux->lock);
+       unsigned long flags;
+
+       spin_lock_irqsave(&demux->lock, flags);
 
        while (count--) {
                if (buf[0] == 0x47)
@@ -407,16 +409,17 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
                buf += 188;
        }
 
-       spin_unlock(&demux->lock);
+       spin_unlock_irqrestore(&demux->lock, flags);
 }
 
 EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
 
 void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
 {
+       unsigned long flags;
        int p = 0, i, j;
 
-       spin_lock(&demux->lock);
+       spin_lock_irqsave(&demux->lock, flags);
 
        if (demux->tsbufp) {
                i = demux->tsbufp;
@@ -449,17 +452,18 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
        }
 
 bailout:
-       spin_unlock(&demux->lock);
+       spin_unlock_irqrestore(&demux->lock, flags);
 }
 
 EXPORT_SYMBOL(dvb_dmx_swfilter);
 
 void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
 {
+       unsigned long flags;
        int p = 0, i, j;
        u8 tmppack[188];
 
-       spin_lock(&demux->lock);
+       spin_lock_irqsave(&demux->lock, flags);
 
        if (demux->tsbufp) {
                i = demux->tsbufp;
@@ -500,7 +504,7 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
        }
 
 bailout:
-       spin_unlock(&demux->lock);
+       spin_unlock_irqrestore(&demux->lock, flags);
 }
 
 EXPORT_SYMBOL(dvb_dmx_swfilter_204);
index 747d3fa2e5e5c47721a187858bb79c629aea9387..2e9fd2893ede8e573fd8d56adb92e59055f75636 100644 (file)
@@ -59,7 +59,7 @@ struct s5h1420_state {
         * it does not support repeated-start, workaround: write addr-1
         * and then read
         */
-       u8 shadow[255];
+       u8 shadow[256];
 };
 
 static u32 s5h1420_getsymbolrate(struct s5h1420_state* state);
@@ -94,8 +94,11 @@ static u8 s5h1420_readreg(struct s5h1420_state *state, u8 reg)
                if (ret != 3)
                        return ret;
        } else {
-               ret = i2c_transfer(state->i2c, &msg[1], 2);
-               if (ret != 2)
+               ret = i2c_transfer(state->i2c, &msg[1], 1);
+               if (ret != 1)
+                       return ret;
+               ret = i2c_transfer(state->i2c, &msg[2], 1);
+               if (ret != 1)
                        return ret;
        }
 
@@ -823,7 +826,7 @@ static int s5h1420_init (struct dvb_frontend* fe)
        struct s5h1420_state* state = fe->demodulator_priv;
 
        /* disable power down and do reset */
-       state->CON_1_val = 0x10;
+       state->CON_1_val = state->config->serial_mpeg << 4;
        s5h1420_writereg(state, 0x02, state->CON_1_val);
        msleep(10);
        s5h1420_reset(state);
index 4c913f142bc4258a307fd38e63c1d488e97f72fb..ff308136d8658e0f67f6c2d424588cbfcf4b63f9 100644 (file)
@@ -32,10 +32,12 @@ struct s5h1420_config
        u8 demod_address;
 
        /* does the inversion require inversion? */
-       u8 invert : 1;
+       u8 invert:1;
 
-       u8 repeated_start_workaround : 1;
-       u8 cdclk_polarity : 1; /* 1 == falling edge, 0 == raising edge */
+       u8 repeated_start_workaround:1;
+       u8 cdclk_polarity:1; /* 1 == falling edge, 0 == raising edge */
+
+       u8 serial_mpeg:1;
 };
 
 #if defined(CONFIG_DVB_S5H1420) || (defined(CONFIG_DVB_S5H1420_MODULE) && defined(MODULE))
index cc5efb643f33eb9de793843888cea0ee1a747a28..9da260fe3fd12313c0e633567ca818770e4afac4 100644 (file)
@@ -40,6 +40,8 @@ struct usb_device_id smsusb_id_table[] = {
                .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B },
        { USB_DEVICE(0x2040, 0x5500),
                .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
+       { USB_DEVICE(0x2040, 0x5510),
+               .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
        { USB_DEVICE(0x2040, 0x5580),
                .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
        { USB_DEVICE(0x2040, 0x5590),
@@ -87,7 +89,7 @@ static struct sms_board sms_boards[] = {
                .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw",
        },
        [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = {
-               .name   = "Hauppauge WinTV-Nova-T-MiniStick",
+               .name   = "Hauppauge WinTV MiniStick",
                .type   = SMS_NOVA_B0,
                .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-01.fw",
        },
index 6ae4cc860efedebdfdfc66babb7c683908417bd8..933eaef41eadd4b3be9e404924d22fb316c1bd70 100644 (file)
@@ -3431,7 +3431,7 @@ static int radio_open(struct inode *inode, struct file *file)
        dprintk("bttv: open minor=%d\n",minor);
 
        for (i = 0; i < bttv_num; i++) {
-               if (bttvs[i].radio_dev->minor == minor) {
+               if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) {
                        btv = &bttvs[i];
                        break;
                }
index c149b7d712e5a703d5f277ebed607aafe6202202..5405c30dbb041748b47941c5e9b0fd19842915c4 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/fs.h>
+#include <linux/mm.h>
 #include <linux/pci.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
index a4574740350df30cf6bd3cb84592b8c84d39f779..a8a199047cbde4c448dbfb736beedbb78d3c4e08 100644 (file)
@@ -632,7 +632,7 @@ int cpia2_usb_transfer_cmd(struct camera_data *cam,
 static int submit_urbs(struct camera_data *cam)
 {
        struct urb *urb;
-       int fx, err, i;
+       int fx, err, i, j;
 
        for(i=0; i<NUM_SBUF; ++i) {
                if (cam->sbuf[i].data)
@@ -657,6 +657,9 @@ static int submit_urbs(struct camera_data *cam)
                }
                urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
                if (!urb) {
+                       ERR("%s: usb_alloc_urb error!\n", __func__);
+                       for (j = 0; j < i; j++)
+                               usb_free_urb(cam->sbuf[j].urb);
                        return -ENOMEM;
                }
 
index 8fe5f38c4d7cf694a6a2c9a7738bfffd79324430..3cb9734ec07bf7f6314f84590430ce3ee93b7432 100644 (file)
@@ -163,7 +163,7 @@ static const struct cx18_card cx18_card_h900 = {
        },
        .audio_inputs = {
                { CX18_CARD_INPUT_AUD_TUNER,
-                 CX18_AV_AUDIO8, 0 },
+                 CX18_AV_AUDIO5, 0 },
                { CX18_CARD_INPUT_LINE_IN1,
                  CX18_AV_AUDIO_SERIAL1, 0 },
        },
index 3c006103c1eb369c4817fd74522ef7ffebc91e61..ac3292d7646cb71cc3eb2f229e9b81f352c5c769 100644 (file)
@@ -117,10 +117,10 @@ static void em28xx_audio_isocirq(struct urb *urb)
 
                        if (oldptr + length >= runtime->buffer_size) {
                                unsigned int cnt =
-                                   runtime->buffer_size - oldptr - 1;
+                                   runtime->buffer_size - oldptr;
                                memcpy(runtime->dma_area + oldptr * stride, cp,
                                       cnt * stride);
-                               memcpy(runtime->dma_area, cp + cnt,
+                               memcpy(runtime->dma_area, cp + cnt * stride,
                                       length * stride - cnt * stride);
                        } else {
                                memcpy(runtime->dma_area + oldptr * stride, cp,
@@ -161,8 +161,14 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
 
                memset(dev->adev->transfer_buffer[i], 0x80, sb_size);
                urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
-               if (!urb)
+               if (!urb) {
+                       em28xx_errdev("usb_alloc_urb failed!\n");
+                       for (j = 0; j < i; j++) {
+                               usb_free_urb(dev->adev->urb[j]);
+                               kfree(dev->adev->transfer_buffer[j]);
+                       }
                        return -ENOMEM;
+               }
 
                urb->dev = dev->udev;
                urb->context = dev;
index 452da70e719f330740a1263f07e149d2b74e254b..de943cf6c169aa58eb5eb319cab4f0909a2fe27d 100644 (file)
@@ -93,28 +93,6 @@ struct em28xx_board em28xx_boards[] = {
                        .amux     = 0,
                } },
        },
-       [EM2800_BOARD_KWORLD_USB2800] = {
-               .name         = "Kworld USB2800",
-               .valid        = EM28XX_BOARD_NOT_VALIDATED,
-               .is_em2800    = 1,
-               .vchannels    = 3,
-               .tuner_type   = TUNER_PHILIPS_FCV1236D,
-               .tda9887_conf = TDA9887_PRESENT,
-               .decoder      = EM28XX_SAA7113,
-               .input          = { {
-                       .type     = EM28XX_VMUX_TELEVISION,
-                       .vmux     = SAA7115_COMPOSITE2,
-                       .amux     = 0,
-               }, {
-                       .type     = EM28XX_VMUX_COMPOSITE1,
-                       .vmux     = SAA7115_COMPOSITE0,
-                       .amux     = 1,
-               }, {
-                       .type     = EM28XX_VMUX_SVIDEO,
-                       .vmux     = SAA7115_SVIDEO3,
-                       .amux     = 1,
-               } },
-       },
        [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
                .name         = "Kworld PVR TV 2800 RF",
                .is_em2800    = 0,
@@ -599,7 +577,7 @@ struct em28xx_board em28xx_boards[] = {
                }, {
                        .type     = EM28XX_VMUX_COMPOSITE1,
                        .vmux     = TVP5150_COMPOSITE1,
-                       .amux     = 1,
+                       .amux     = 3,
                }, {
                        .type     = EM28XX_VMUX_SVIDEO,
                        .vmux     = TVP5150_SVIDEO,
@@ -952,22 +930,23 @@ struct em28xx_board em28xx_boards[] = {
        },
        [EM2880_BOARD_KWORLD_DVB_310U] = {
                .name         = "KWorld DVB-T 310U",
-               .valid        = EM28XX_BOARD_NOT_VALIDATED,
                .vchannels    = 3,
                .tuner_type   = TUNER_XC2028,
+               .has_dvb      = 1,
+               .mts_firmware = 1,
                .decoder      = EM28XX_TVP5150,
                .input          = { {
                        .type     = EM28XX_VMUX_TELEVISION,
                        .vmux     = TVP5150_COMPOSITE0,
-                       .amux     = 0,
+                       .amux     = EM28XX_AMUX_VIDEO,
                }, {
                        .type     = EM28XX_VMUX_COMPOSITE1,
                        .vmux     = TVP5150_COMPOSITE1,
-                       .amux     = 1,
-               }, {
+                       .amux     = EM28XX_AMUX_AC97_LINE_IN,
+               }, {    /* S-video has not been tested yet */
                        .type     = EM28XX_VMUX_SVIDEO,
                        .vmux     = TVP5150_SVIDEO,
-                       .amux     = 1,
+                       .amux     = EM28XX_AMUX_AC97_LINE_IN,
                } },
        },
        [EM2881_BOARD_DNT_DA2_HYBRID] = {
@@ -1282,6 +1261,7 @@ static struct em28xx_reg_seq em2882_terratec_hybrid_xs_digital[] = {
 static struct em28xx_hash_table em28xx_eeprom_hash [] = {
        /* P/N: SA 60002070465 Tuner: TVF7533-MF */
        {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
+       {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
 };
 
 /* 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)
                /* djh - Not sure which demod we need here */
                ctl->demod = XC3028_FE_DEFAULT;
                break;
+       case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
+               ctl->demod = XC3028_FE_DEFAULT;
+               ctl->fname = XC3028L_DEFAULT_FIRMWARE;
+               break;
        case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
        case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
-       case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
                /* FIXME: Better to specify the needed IF */
                ctl->demod = XC3028_FE_DEFAULT;
                break;
@@ -1764,6 +1747,20 @@ void em28xx_card_setup(struct em28xx *dev)
                break;
        case EM2820_BOARD_UNKNOWN:
        case EM2800_BOARD_UNKNOWN:
+               /*
+                * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
+                *
+                * This occurs because they share identical USB vendor and
+                * product IDs.
+                *
+                * What we do here is look up the EEPROM hash of the K-WORLD
+                * and if it is found then we decide that we do not have
+                * a DIGIVOX and reset the device to the K-WORLD instead.
+                *
+                * This solution is only valid if they do not share eeprom
+                * hash identities which has not been determined as yet.
+                */
+       case EM2880_BOARD_MSI_DIGIVOX_AD:
                if (!em28xx_hint_board(dev))
                        em28xx_set_model(dev);
                break;
index 4b992bc0083c91954f834afb7a60e95652544cab..d2b1a1a52689f57fe5d9b423887d0c169818f347 100644 (file)
@@ -452,6 +452,15 @@ static int dvb_init(struct em28xx *dev)
                        goto out_free;
                }
                break;
+       case EM2880_BOARD_KWORLD_DVB_310U:
+               dvb->frontend = dvb_attach(zl10353_attach,
+                                               &em28xx_zl10353_with_xc3028,
+                                               &dev->i2c_adap);
+               if (attach_xc3028(0x61, dev) < 0) {
+                       result = -EINVAL;
+                       goto out_free;
+               }
+               break;
        default:
                printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card"
                                " isn't supported yet\n",
index 7be69284da035b0475eb1f7bdb1b6c4cabf3ecaf..ac95c55887df4b38eb1cd8c4478538c53e042aef 100644 (file)
@@ -459,6 +459,7 @@ static int create_urbs(struct gspca_dev *gspca_dev,
                urb = usb_alloc_urb(npkt, GFP_KERNEL);
                if (!urb) {
                        err("usb_alloc_urb failed");
+                       destroy_urbs(gspca_dev);
                        return -ENOMEM;
                }
                urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev,
@@ -468,8 +469,8 @@ static int create_urbs(struct gspca_dev *gspca_dev,
 
                if (urb->transfer_buffer == NULL) {
                        usb_free_urb(urb);
-                       destroy_urbs(gspca_dev);
                        err("usb_buffer_urb failed");
+                       destroy_urbs(gspca_dev);
                        return -ENOMEM;
                }
                gspca_dev->urb[n] = urb;
index d4be51843286dccc0f5af80502e96ca89e42eb19..ba865b7f1ed81710e902fdf86eb2ae1c1cf06e8a 100644 (file)
@@ -1063,6 +1063,7 @@ static __devinitdata struct usb_device_id device_table[] = {
        {USB_DEVICE(0x093a, 0x2621), .driver_info = SENSOR_PAC7302},
        {USB_DEVICE(0x093a, 0x2624), .driver_info = SENSOR_PAC7302},
        {USB_DEVICE(0x093a, 0x2626), .driver_info = SENSOR_PAC7302},
+       {USB_DEVICE(0x093a, 0x262a), .driver_info = SENSOR_PAC7302},
        {}
 };
 MODULE_DEVICE_TABLE(usb, device_table);
index 5dd78c6766eaf0745a52ad0c4e19d651421af524..12b81ae526b7206c0e982e3a845e20c4d1386ca2 100644 (file)
@@ -232,7 +232,7 @@ static struct ctrl sd_ctrls[] = {
 static struct v4l2_pix_format vga_mode[] = {
        {160, 120, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
                .bytesperline = 160,
-               .sizeimage = 160 * 120 * 5 / 4,
+               .sizeimage = 160 * 120,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 2 | MODE_RAW},
        {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
@@ -264,7 +264,7 @@ static struct v4l2_pix_format sif_mode[] = {
                .priv = 1 | MODE_REDUCED_SIF},
        {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
                .bytesperline = 176,
-               .sizeimage = 176 * 144 * 5 / 4,
+               .sizeimage = 176 * 144,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 1 | MODE_RAW},
        {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
index d75b1d20b3180e8982db8ca196de42823d1b00c3..572b0f363b640ccb407b7d312716c75c4da85e95 100644 (file)
@@ -707,6 +707,7 @@ static void i2c_w8(struct gspca_dev *gspca_dev,
                        0x08, 0,                /* value, index */
                        gspca_dev->usb_buf, 8,
                        500);
+       msleep(2);
 }
 
 /* read 5 bytes in gspca_dev->usb_buf */
@@ -976,13 +977,13 @@ static int sd_init(struct gspca_dev *gspca_dev)
        case BRIDGE_SN9C105:
                if (regF1 != 0x11)
                        return -ENODEV;
-               reg_w(gspca_dev, 0x02, regGpio, 2);
+               reg_w(gspca_dev, 0x01, regGpio, 2);
                break;
        case BRIDGE_SN9C120:
                if (regF1 != 0x12)
                        return -ENODEV;
                regGpio[1] = 0x70;
-               reg_w(gspca_dev, 0x02, regGpio, 2);
+               reg_w(gspca_dev, 0x01, regGpio, 2);
                break;
        default:
 /*     case BRIDGE_SN9C110: */
@@ -1183,7 +1184,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
        static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
        static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd };    /* MI0360 */
        static const __u8 CE_ov76xx[] =
-                       { 0x32, 0xdd, 0x32, 0xdd };     /* OV7630/48 */
+                               { 0x32, 0xdd, 0x32, 0xdd };
 
        sn9c1xx = sn_tb[(int) sd->sensor];
        configure_gpio(gspca_dev, sn9c1xx);
@@ -1223,8 +1224,15 @@ static void sd_start(struct gspca_dev *gspca_dev)
        reg_w(gspca_dev, 0x20, gamma_def, sizeof gamma_def);
        for (i = 0; i < 8; i++)
                reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
+       switch (sd->sensor) {
+       case SENSOR_OV7660:
+               reg_w1(gspca_dev, 0x9a, 0x05);
+               break;
+       default:
                reg_w1(gspca_dev, 0x9a, 0x08);
                reg_w1(gspca_dev, 0x99, 0x59);
+               break;
+       }
 
        mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
        if (mode)
@@ -1275,8 +1283,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
 /*                     reg1 = 0x44; */
 /*                     reg1 = 0x46;    (done) */
                } else {
-                       reg17 = 0x22;   /* 640 MCKSIZE */
-                       reg1 = 0x06;
+                       reg17 = 0xa2;   /* 640 */
+                       reg1 = 0x44;
                }
                break;
        }
@@ -1285,6 +1293,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
        switch (sd->sensor) {
        case SENSOR_OV7630:
        case SENSOR_OV7648:
+       case SENSOR_OV7660:
                reg_w(gspca_dev, 0xce, CE_ov76xx, 4);
                break;
        default:
index cfbc9ebc5c5d8f6bb6518bc352a1c0a69afe530b..95fcfcb9e31b51c8d2ce871fdae89b0096df1862 100644 (file)
@@ -225,7 +225,7 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode)
        reg_w_val(gspca_dev->dev, 0x8802, (mode | 0x01));
        do {
                reg_r(gspca_dev, 0x8803, 1);
-               if (!gspca_dev->usb_buf)
+               if (!gspca_dev->usb_buf[0])
                        break;
        } while (--retry);
        if (retry == 0)
index 8d7c27e6ac77dd697cab8f9ff4e0b0b617499eaa..d61ef727e0c241e08fe65b4f972450c154828da3 100644 (file)
@@ -6576,8 +6576,8 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
                 cs2102_60HZ, cs2102_60HZScale},
 /* SENSOR_CS2102K 1 */
                {cs2102_NoFliker, cs2102_NoFlikerScale,
-                cs2102_50HZ, cs2102_50HZScale,
-                cs2102_60HZ, cs2102_60HZScale},
+                NULL, NULL, /* currently disabled */
+                NULL, NULL},
 /* SENSOR_GC0305 2 */
                {gc0305_NoFliker, gc0305_NoFliker,
                 gc0305_50HZ, gc0305_50HZ,
index 3d3c48db45d958c4813e8dc2c0ea850a356b796a..c6852402c5e986d3b93161b636db049789f5b6a4 100644 (file)
@@ -3591,7 +3591,7 @@ static int
 ov51x_init_isoc(struct usb_ov511 *ov)
 {
        struct urb *urb;
-       int fx, err, n, size;
+       int fx, err, n, i, size;
 
        PDEBUG(3, "*** Initializing capture ***");
 
@@ -3662,6 +3662,8 @@ ov51x_init_isoc(struct usb_ov511 *ov)
                urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
                if (!urb) {
                        err("init isoc: usb_alloc_urb ret. NULL");
+                       for (i = 0; i < n; i++)
+                               usb_free_urb(ov->sbuf[i].urb);
                        return -ENOMEM;
                }
                ov->sbuf[n].urb = urb;
@@ -5651,7 +5653,7 @@ static ssize_t show_exposure(struct device *cd,
        if (!ov->dev)
                return -ENODEV;
        sensor_get_exposure(ov, &exp);
-       return sprintf(buf, "%d\n", exp >> 8);
+       return sprintf(buf, "%d\n", exp);
 }
 static DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL);
 
index 88e175168438d52ab0ffa113d5b47d561d19d68b..cbe2a3417851a80bc6fa02459afdf521f256117d 100644 (file)
@@ -489,6 +489,8 @@ static const struct pvr2_device_desc pvr2_device_751xx = {
 struct usb_device_id pvr2_device_table[] = {
        { USB_DEVICE(0x2040, 0x2900),
          .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
+       { USB_DEVICE(0x2040, 0x2950), /* Logically identical to 2900 */
+         .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
        { USB_DEVICE(0x2040, 0x2400),
          .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
        { USB_DEVICE(0x1164, 0x0622),
index b1d09d8e2b8572c35c88be39100cf35dbc7e21ba..92b83feae3668d2bca19f32a956962c2107de7f7 100644 (file)
@@ -669,7 +669,7 @@ static void s2255_fillbuff(struct s2255_dev *dev, struct s2255_buffer *buf,
                (unsigned long)vbuf, pos);
        /* tell v4l buffer was filled */
 
-       buf->vb.field_count++;
+       buf->vb.field_count = dev->frame_count[chn] * 2;
        do_gettimeofday(&ts);
        buf->vb.ts = ts;
        buf->vb.state = VIDEOBUF_DONE;
@@ -1268,6 +1268,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
        dev->last_frame[chn] = -1;
        dev->bad_payload[chn] = 0;
        dev->cur_frame[chn] = 0;
+       dev->frame_count[chn] = 0;
        for (j = 0; j < SYS_FRAMES; j++) {
                dev->buffer[chn].frame[j].ulState = 0;
                dev->buffer[chn].frame[j].cur_size = 0;
index 6ef3e5297de8c085cbeaa70a2ff628bba1b524dc..feab12aa2c7b5e9c0efb030a7eb1551611dbc766 100644 (file)
@@ -592,7 +592,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
        if (ctrl == NULL)
                return -EINVAL;
 
-       data = kmalloc(8, GFP_KERNEL);
+       data = kmalloc(ctrl->info->size, GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 
index 168baabe46591b02b9276e11987aaee44679ac63..11edf79f57be328a0f6a196f7d849776c3235a39 100644 (file)
@@ -911,7 +911,6 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam)
 
        for (i = 0; i < W9968CF_URBS; i++) {
                urb = usb_alloc_urb(W9968CF_ISO_PACKETS, GFP_KERNEL);
-               cam->urb[i] = urb;
                if (!urb) {
                        for (j = 0; j < i; j++)
                                usb_free_urb(cam->urb[j]);
@@ -919,6 +918,7 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam)
                        return -ENOMEM;
                }
 
+               cam->urb[i] = urb;
                urb->dev = udev;
                urb->context = (void*)cam;
                urb->pipe = usb_rcvisocpipe(udev, 1);
index 95c79ad804872b0f0df78bea3ecb4283174a06bd..54ac3fe26ec2ad4afe2371ae069caa25f9aa1597 100644 (file)
@@ -274,10 +274,8 @@ static int wm8739_probe(struct i2c_client *client,
                        client->addr << 1, client->adapter->name);
 
        state = kmalloc(sizeof(struct wm8739_state), GFP_KERNEL);
-       if (state == NULL) {
-               kfree(client);
+       if (state == NULL)
                return -ENOMEM;
-       }
        state->vol_l = 0x17; /* 0dB */
        state->vol_r = 0x17; /* 0dB */
        state->muted = 0;
index d842a7cb99d274ad493fea6eed822a918acd58e5..3282be730298a1ee2be50c7a3fc4cbe55b342eae 100644 (file)
@@ -988,7 +988,7 @@ zoran_open_init_params (struct zoran *zr)
        zr->v4l_grab_seq = 0;
        zr->v4l_settings.width = 192;
        zr->v4l_settings.height = 144;
-       zr->v4l_settings.format = &zoran_formats[4];    /* YUY2 - YUV-4:2:2 packed */
+       zr->v4l_settings.format = &zoran_formats[7];    /* YUY2 - YUV-4:2:2 packed */
        zr->v4l_settings.bytesperline =
            zr->v4l_settings.width *
            ((zr->v4l_settings.format->depth + 7) / 8);
index ec6f59674b105c281d25a6a59e8b6696eeff7f7d..2dab9eea4def302f7f934dab82426f3f71850134 100644 (file)
@@ -134,7 +134,7 @@ const struct zoran_format zoran_formats[] = {
        }, {
                .name = "16-bit RGB BE",
                ZFMT(-1,
-                    V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB),
+                    V4L2_PIX_FMT_RGB565X, V4L2_COLORSPACE_SRGB),
                .depth = 16,
                .flags = ZORAN_FORMAT_CAPTURE |
                         ZORAN_FORMAT_OVERLAY,
@@ -2737,7 +2737,8 @@ zoran_do_ioctl (struct inode *inode,
                                    fh->v4l_settings.format->fourcc;
                                fmt->fmt.pix.colorspace =
                                    fh->v4l_settings.format->colorspace;
-                               fmt->fmt.pix.bytesperline = 0;
+                               fmt->fmt.pix.bytesperline =
+                                   fh->v4l_settings.bytesperline;
                                if (BUZ_MAX_HEIGHT <
                                    (fh->v4l_settings.height * 2))
                                        fmt->fmt.pix.field =
@@ -2833,13 +2834,6 @@ zoran_do_ioctl (struct inode *inode,
                                fmt->fmt.pix.pixelformat,
                                (char *) &printformat);
 
-                       if (fmt->fmt.pix.bytesperline > 0) {
-                               dprintk(5,
-                                       KERN_ERR "%s: bpl not supported\n",
-                                       ZR_DEVNAME(zr));
-                               return -EINVAL;
-                       }
-
                        /* we can be requested to do JPEG/raw playback/capture */
                        if (!
                            (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE ||
@@ -2923,6 +2917,7 @@ zoran_do_ioctl (struct inode *inode,
                                fh->jpg_buffers.buffer_size =
                                    zoran_v4l2_calc_bufsize(&fh->
                                                            jpg_settings);
+                               fmt->fmt.pix.bytesperline = 0;
                                fmt->fmt.pix.sizeimage =
                                    fh->jpg_buffers.buffer_size;
 
@@ -2979,6 +2974,8 @@ zoran_do_ioctl (struct inode *inode,
 
                                /* tell the user the
                                 * results/missing stuff */
+                               fmt->fmt.pix.bytesperline =
+                                       fh->v4l_settings.bytesperline;
                                fmt->fmt.pix.sizeimage =
                                        fh->v4l_settings.height *
                                        fh->v4l_settings.bytesperline;
index 10c44d3fe01a429172855d2b76ea54e9255b6779..68dc8d9eb24ee87e39a99d3543962b2453bd008f 100644 (file)
@@ -21,7 +21,7 @@ config MFD_SM501
 
 config MFD_SM501_GPIO
        bool "Export GPIO via GPIO layer"
-       depends on MFD_SM501 && HAVE_GPIO_LIB
+       depends on MFD_SM501 && GPIOLIB
         ---help---
         This option uses the gpio library layer to export the 64 GPIO
         lines on the SM501. The platform data is used to supply the
@@ -29,7 +29,7 @@ config MFD_SM501_GPIO
 
 config MFD_ASIC3
        bool "Support for Compaq ASIC3"
-       depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB && ARM
+       depends on GENERIC_HARDIRQS && GPIOLIB && ARM
         ---help---
          This driver supports the ASIC3 multifunction chip found on many
          PDAs (mainly iPAQ and HTC based ones)
index bc2a807f210df1804129f0de665c8b2cacde9614..ba5aa2008273bebe869b12403d5f57ce8be0a2bb 100644 (file)
@@ -312,7 +312,6 @@ static int __init asic3_irq_probe(struct platform_device *pdev)
        struct asic3 *asic = platform_get_drvdata(pdev);
        unsigned long clksel = 0;
        unsigned int irq, irq_base;
-       int map_size;
        int ret;
 
        ret = platform_get_irq(pdev, 0);
@@ -534,6 +533,7 @@ static int __init asic3_probe(struct platform_device *pdev)
        struct asic3 *asic;
        struct resource *mem;
        unsigned long clksel;
+       int map_size;
        int ret = 0;
 
        asic = kzalloc(sizeof(struct asic3), GFP_KERNEL);
index facdb9893c84c322dbb65f47e2a7bf8de3c69685..1ee8501e90f11eb7e350355712625120dd2a5aeb 100644 (file)
@@ -450,12 +450,14 @@ static int eeepc_get_fan_pwm(void)
        int value = 0;
 
        read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value);
+       value = value * 255 / 100;
        return (value);
 }
 
 static void eeepc_set_fan_pwm(int value)
 {
-       value = SENSORS_LIMIT(value, 0, 100);
+       value = SENSORS_LIMIT(value, 0, 255);
+       value = value * 100 / 255;
        ec_write(EEEPC_EC_SC02, value);
 }
 
@@ -520,15 +522,23 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf)
        static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0);
 
 EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL);
-EEEPC_CREATE_SENSOR_ATTR(fan1_pwm, S_IRUGO | S_IWUSR,
+EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR,
                         eeepc_get_fan_pwm, eeepc_set_fan_pwm);
 EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR,
                         eeepc_get_fan_ctrl, eeepc_set_fan_ctrl);
 
+static ssize_t
+show_name(struct device *dev, struct device_attribute *attr, char *buf)
+{
+       return sprintf(buf, "eeepc\n");
+}
+static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
+
 static struct attribute *hwmon_attributes[] = {
-       &sensor_dev_attr_fan1_pwm.dev_attr.attr,
+       &sensor_dev_attr_pwm1.dev_attr.attr,
        &sensor_dev_attr_fan1_input.dev_attr.attr,
        &sensor_dev_attr_pwm1_enable.dev_attr.attr,
+       &sensor_dev_attr_name.dev_attr.attr,
        NULL
 };
 
index 6986f392624426e0bfa6cb0f6085766f56cae90e..ebc8b9d77613132f290b7372196ab50bfe416144 100644 (file)
@@ -615,14 +615,19 @@ static struct mmc_driver mmc_driver = {
 
 static int __init mmc_blk_init(void)
 {
-       int res = -ENOMEM;
+       int res;
 
        res = register_blkdev(MMC_BLOCK_MAJOR, "mmc");
        if (res)
                goto out;
 
-       return mmc_register_driver(&mmc_driver);
+       res = mmc_register_driver(&mmc_driver);
+       if (res)
+               goto out2;
 
+       return 0;
+ out2:
+       unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
  out:
        return res;
 }
index f26b01d811ae9f51560dbb2c3db9418e1a8672b5..b92b172074ee5a6f2b698a0292951b900dbd3008 100644 (file)
@@ -1040,7 +1040,7 @@ static const struct mmc_test_case mmc_test_cases[] = {
 
 };
 
-static struct mutex mmc_test_lock;
+static DEFINE_MUTEX(mmc_test_lock);
 
 static void mmc_test_run(struct mmc_test_card *test, int testcase)
 {
@@ -1171,8 +1171,6 @@ static int mmc_test_probe(struct mmc_card *card)
        if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD))
                return -ENODEV;
 
-       mutex_init(&mmc_test_lock);
-
        ret = device_create_file(&card->dev, &dev_attr_test);
        if (ret)
                return ret;
index 0bd06f5bd62ffa414439dcd3a4c382124832c779..00008967ef7ae505568836510931eef134c59102 100644 (file)
@@ -195,7 +195,9 @@ static int atmci_regs_show(struct seq_file *s, void *v)
 
        /* Grab a more or less consistent snapshot */
        spin_lock_irq(&host->mmc->lock);
+       clk_enable(host->mck);
        memcpy_fromio(buf, host->regs, MCI_REGS_SIZE);
+       clk_disable(host->mck);
        spin_unlock_irq(&host->mmc->lock);
 
        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)
        atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]);
        atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]);
 
+       kfree(buf);
+
        return 0;
 }
 
@@ -237,7 +241,6 @@ static void atmci_init_debugfs(struct atmel_mci *host)
        struct mmc_host *mmc;
        struct dentry   *root;
        struct dentry   *node;
-       struct resource *res;
 
        mmc = host->mmc;
        root = mmc->debugfs_root;
@@ -251,9 +254,6 @@ static void atmci_init_debugfs(struct atmel_mci *host)
        if (!node)
                goto err;
 
-       res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
-       node->d_inode->i_size = res->end - res->start + 1;
-
        node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops);
        if (!node)
                goto err;
@@ -426,8 +426,6 @@ static u32 atmci_submit_data(struct mmc_host *mmc, struct mmc_data *data)
        host->sg = NULL;
        host->data = data;
 
-       mci_writel(host, BLKR, MCI_BCNT(data->blocks)
-                       | MCI_BLKLEN(data->blksz));
        dev_vdbg(&mmc->class_dev, "BLKR=0x%08x\n",
                        MCI_BCNT(data->blocks) | MCI_BLKLEN(data->blksz));
 
@@ -483,6 +481,10 @@ static void atmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
                if (data->blocks > 1 && data->blksz & 3)
                        goto fail;
                atmci_set_timeout(host, data);
+
+               /* Must set block count/size before sending command */
+               mci_writel(host, BLKR, MCI_BCNT(data->blocks)
+                               | MCI_BLKLEN(data->blksz));
        }
 
        iflags = MCI_CMDRDY;
@@ -1059,6 +1061,10 @@ static int __init atmci_probe(struct platform_device *pdev)
                        host->present = !gpio_get_value(host->detect_pin);
                }
        }
+
+       if (!gpio_is_valid(host->detect_pin))
+               mmc->caps |= MMC_CAP_NEEDS_POLL;
+
        if (gpio_is_valid(host->wp_pin)) {
                if (gpio_request(host->wp_pin, "mmc_wp")) {
                        dev_dbg(&mmc->class_dev, "no WP pin available\n");
index 9e647a06054f886f8df4b51ed4af26824b6af8a6..ba2b4240a86ad722c82a3e910d8cbb129305664b 100644 (file)
@@ -159,10 +159,10 @@ static inline void tmio_mmc_kunmap_atomic(struct tmio_mmc_host *host,
 #define STATUS_TO_TEXT(a) \
        do { \
                if (status & TMIO_STAT_##a) \
-                       printf(#a); \
+                       printk(#a); \
        } while (0)
 
-void debug_status(u32 status)
+void pr_debug_status(u32 status)
 {
        printk(KERN_DEBUG "status: %08x = ", status);
        STATUS_TO_TEXT(CARD_REMOVE);
index c3c579f98ed07d64e877c794502310036af0d3c3..dfacd31f7ed08856cdac5c9c0156f6cef4addd1f 100644 (file)
@@ -6597,7 +6597,7 @@ struct flash_spec {
 
 struct bnx2_irq {
        irq_handler_t   handler;
-       u16             vector;
+       unsigned int    vector;
        u8              requested;
        char            name[16];
 };
index 453115acaad231c0efb4b902db371760c5d5bf0c..5cf78d612c4579ed337e2ed726c19121f656aab7 100644 (file)
@@ -2738,9 +2738,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
                nic->flags |= wol_magic;
 
        /* ack any pending wake events, disable PME */
-       err = pci_enable_wake(pdev, 0, 0);
-       if (err)
-               DPRINTK(PROBE, ERR, "Error clearing wake event\n");
+       pci_pme_active(pdev, false);
 
        strcpy(netdev->name, "eth%d");
        if((err = register_netdev(netdev))) {
index 9d6edf3e73f92998d8fb4f19ddbbfe64cd2ca4ac..d04eef53571e209bd0f49dafce91d89f759ccaf7 100644 (file)
@@ -144,6 +144,8 @@ static s32 e1000_host_if_read_cookie(struct e1000_hw *hw, u8 *buffer);
 static u8 e1000_calculate_mng_checksum(char *buffer, u32 length);
 static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex);
 static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw);
+static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
+static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
 
 /* IGP cable length table */
 static const
@@ -168,6 +170,8 @@ u16 e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] =
       83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
       104, 109, 114, 118, 121, 124};
 
+static DEFINE_SPINLOCK(e1000_eeprom_lock);
+
 /******************************************************************************
  * Set the phy type member in the hw struct.
  *
@@ -4903,6 +4907,15 @@ static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw)
  * words - number of words to read
  *****************************************************************************/
 s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
+{
+    s32 ret;
+    spin_lock(&e1000_eeprom_lock);
+    ret = e1000_do_read_eeprom(hw, offset, words, data);
+    spin_unlock(&e1000_eeprom_lock);
+    return ret;
+}
+
+static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
 {
     struct e1000_eeprom_info *eeprom = &hw->eeprom;
     u32 i = 0;
@@ -5235,6 +5248,16 @@ s32 e1000_update_eeprom_checksum(struct e1000_hw *hw)
  * EEPROM will most likely contain an invalid checksum.
  *****************************************************************************/
 s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
+{
+    s32 ret;
+    spin_lock(&e1000_eeprom_lock);
+    ret = e1000_do_write_eeprom(hw, offset, words, data);
+    spin_unlock(&e1000_eeprom_lock);
+    return ret;
+}
+
+
+static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
 {
     struct e1000_eeprom_info *eeprom = &hw->eeprom;
     s32 status = 0;
index ac4e506b4f88a495cd9d6e7616cc662ed60abf96..5ea6b60fa3774a5ed6673949bd8e7ea0ee780170 100644 (file)
@@ -257,7 +257,6 @@ struct e1000_adapter {
        struct net_device *netdev;
        struct pci_dev *pdev;
        struct net_device_stats net_stats;
-       spinlock_t stats_lock;      /* prevent concurrent stats updates */
 
        /* structs defined in e1000_hw.h */
        struct e1000_hw hw;
@@ -284,6 +283,8 @@ struct e1000_adapter {
        unsigned long led_status;
 
        unsigned int flags;
+       struct work_struct downshift_task;
+       struct work_struct update_phy_task;
 };
 
 struct e1000_info {
@@ -305,6 +306,7 @@ struct e1000_info {
 #define FLAG_HAS_CTRLEXT_ON_LOAD          (1 << 5)
 #define FLAG_HAS_SWSM_ON_LOAD             (1 << 6)
 #define FLAG_HAS_JUMBO_FRAMES             (1 << 7)
+#define FLAG_READ_ONLY_NVM                (1 << 8)
 #define FLAG_IS_ICH                       (1 << 9)
 #define FLAG_HAS_SMART_POWER_DOWN         (1 << 11)
 #define FLAG_IS_QUAD_PORT_A               (1 << 12)
@@ -385,6 +387,7 @@ extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw);
 extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw);
 extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state);
 
+extern void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw);
 extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
                                                 bool state);
 extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
index e21c9e0f3738441a159ad0a4068e9bb8fe2b82e5..33a3ff17b5d07d80556dd394efed6d692f7faf05 100644 (file)
@@ -432,6 +432,10 @@ static void e1000_get_regs(struct net_device *netdev,
        regs_buff[11] = er32(TIDV);
 
        regs_buff[12] = adapter->hw.phy.type;  /* PHY type (IGP=1, M88=0) */
+
+       /* ethtool doesn't use anything past this point, so all this
+        * code is likely legacy junk for apps that may or may not
+        * exist */
        if (hw->phy.type == e1000_phy_m88) {
                e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
                regs_buff[13] = (u32)phy_data; /* cable length */
@@ -447,7 +451,7 @@ static void e1000_get_regs(struct net_device *netdev,
                regs_buff[22] = adapter->phy_stats.receive_errors;
                regs_buff[23] = regs_buff[13]; /* mdix mode */
        }
-       regs_buff[21] = adapter->phy_stats.idle_errors;  /* phy idle errors */
+       regs_buff[21] = 0; /* was idle_errors */
        e1e_rphy(hw, PHY_1000T_STATUS, &phy_data);
        regs_buff[24] = (u32)phy_data;  /* phy local receiver status */
        regs_buff[25] = regs_buff[24];  /* phy remote receiver status */
@@ -529,6 +533,9 @@ static int e1000_set_eeprom(struct net_device *netdev,
        if (eeprom->magic != (adapter->pdev->vendor | (adapter->pdev->device << 16)))
                return -EFAULT;
 
+       if (adapter->flags & FLAG_READ_ONLY_NVM)
+               return -EINVAL;
+
        max_len = hw->nvm.word_size * 2;
 
        first_word = eeprom->offset >> 1;
index 9e38452a738cc4cd6038cf8829c0ff37787df64e..bcd2bc477af29110636abec9920b3f4a76a244b7 100644 (file)
@@ -58,6 +58,7 @@
 #define ICH_FLASH_HSFCTL               0x0006
 #define ICH_FLASH_FADDR                        0x0008
 #define ICH_FLASH_FDATA0               0x0010
+#define ICH_FLASH_PR0                  0x0074
 
 #define ICH_FLASH_READ_COMMAND_TIMEOUT 500
 #define ICH_FLASH_WRITE_COMMAND_TIMEOUT        500
@@ -150,6 +151,19 @@ union ich8_hws_flash_regacc {
        u16 regval;
 };
 
+/* ICH Flash Protected Region */
+union ich8_flash_protected_range {
+       struct ich8_pr {
+               u32 base:13;     /* 0:12 Protected Range Base */
+               u32 reserved1:2; /* 13:14 Reserved */
+               u32 rpe:1;       /* 15 Read Protection Enable */
+               u32 limit:13;    /* 16:28 Protected Range Limit */
+               u32 reserved2:2; /* 29:30 Reserved */
+               u32 wpe:1;       /* 31 Write Protection Enable */
+       } range;
+       u32 regval;
+};
+
 static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw);
 static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw);
 static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw);
@@ -366,6 +380,9 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
        return 0;
 }
 
+static DEFINE_MUTEX(nvm_mutex);
+static pid_t nvm_owner = -1;
+
 /**
  *  e1000_acquire_swflag_ich8lan - Acquire software control flag
  *  @hw: pointer to the HW structure
@@ -379,6 +396,15 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
        u32 extcnf_ctrl;
        u32 timeout = PHY_CFG_TIMEOUT;
 
+       might_sleep();
+
+       if (!mutex_trylock(&nvm_mutex)) {
+               WARN(1, KERN_ERR "e1000e mutex contention. Owned by pid %d\n",
+                    nvm_owner);
+               mutex_lock(&nvm_mutex);
+       }
+       nvm_owner = current->pid;
+
        while (timeout) {
                extcnf_ctrl = er32(EXTCNF_CTRL);
                extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
@@ -393,6 +419,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
 
        if (!timeout) {
                hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
+               nvm_owner = -1;
+               mutex_unlock(&nvm_mutex);
                return -E1000_ERR_CONFIG;
        }
 
@@ -414,6 +442,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
        extcnf_ctrl = er32(EXTCNF_CTRL);
        extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
        ew32(EXTCNF_CTRL, extcnf_ctrl);
+
+       nvm_owner = -1;
+       mutex_unlock(&nvm_mutex);
 }
 
 /**
@@ -1284,6 +1315,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
         * programming failed.
         */
        if (ret_val) {
+               /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
                hw_dbg(hw, "Flash commit failed.\n");
                e1000_release_swflag_ich8lan(hw);
                return ret_val;
@@ -1373,6 +1405,49 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
        return e1000e_validate_nvm_checksum_generic(hw);
 }
 
+/**
+ *  e1000e_write_protect_nvm_ich8lan - Make the NVM read-only
+ *  @hw: pointer to the HW structure
+ *
+ *  To prevent malicious write/erase of the NVM, set it to be read-only
+ *  so that the hardware ignores all write/erase cycles of the NVM via
+ *  the flash control registers.  The shadow-ram copy of the NVM will
+ *  still be updated, however any updates to this copy will not stick
+ *  across driver reloads.
+ **/
+void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
+{
+       union ich8_flash_protected_range pr0;
+       union ich8_hws_flash_status hsfsts;
+       u32 gfpreg;
+       s32 ret_val;
+
+       ret_val = e1000_acquire_swflag_ich8lan(hw);
+       if (ret_val)
+               return;
+
+       gfpreg = er32flash(ICH_FLASH_GFPREG);
+
+       /* Write-protect GbE Sector of NVM */
+       pr0.regval = er32flash(ICH_FLASH_PR0);
+       pr0.range.base = gfpreg & FLASH_GFPREG_BASE_MASK;
+       pr0.range.limit = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK);
+       pr0.range.wpe = true;
+       ew32flash(ICH_FLASH_PR0, pr0.regval);
+
+       /*
+        * Lock down a subset of GbE Flash Control Registers, e.g.
+        * PR0 to prevent the write-protection from being lifted.
+        * Once FLOCKDN is set, the registers protected by it cannot
+        * be written until FLOCKDN is cleared by a hardware reset.
+        */
+       hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
+       hsfsts.hsf_status.flockdn = true;
+       ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval);
+
+       e1000_release_swflag_ich8lan(hw);
+}
+
 /**
  *  e1000_write_flash_data_ich8lan - Writes bytes to the NVM
  *  @hw: pointer to the HW structure
@@ -1720,6 +1795,9 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
        ew32(CTRL, (ctrl | E1000_CTRL_RST));
        msleep(20);
 
+       /* release the swflag because it is not reset by hardware reset */
+       e1000_release_swflag_ich8lan(hw);
+
        ret_val = e1000e_get_auto_rd_done(hw);
        if (ret_val) {
                /*
index d266510c8a94683ae4d21516cf6c18491dc3eb3a..b81c4237b5d30a11dc7f6e3dcefdbbc3ae202fb2 100644 (file)
@@ -47,7 +47,7 @@
 
 #include "e1000.h"
 
-#define DRV_VERSION "0.3.3.3-k2"
+#define DRV_VERSION "0.3.3.3-k6"
 char e1000e_driver_name[] = "e1000e";
 const char e1000e_driver_version[] = DRV_VERSION;
 
@@ -1115,6 +1115,14 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
        writel(0, adapter->hw.hw_addr + rx_ring->tail);
 }
 
+static void e1000e_downshift_workaround(struct work_struct *work)
+{
+       struct e1000_adapter *adapter = container_of(work,
+                                       struct e1000_adapter, downshift_task);
+
+       e1000e_gig_downshift_workaround_ich8lan(&adapter->hw);
+}
+
 /**
  * e1000_intr_msi - Interrupt Handler
  * @irq: interrupt number
@@ -1139,7 +1147,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
                 */
                if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
                    (!(er32(STATUS) & E1000_STATUS_LU)))
-                       e1000e_gig_downshift_workaround_ich8lan(hw);
+                       schedule_work(&adapter->downshift_task);
 
                /*
                 * 80003ES2LAN workaround-- For packet buffer work-around on
@@ -1205,7 +1213,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
                 */
                if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
                    (!(er32(STATUS) & E1000_STATUS_LU)))
-                       e1000e_gig_downshift_workaround_ich8lan(hw);
+                       schedule_work(&adapter->downshift_task);
 
                /*
                 * 80003ES2LAN workaround--
@@ -2592,8 +2600,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
        /* Explicitly disable IRQ since the NIC can be in any state. */
        e1000_irq_disable(adapter);
 
-       spin_lock_init(&adapter->stats_lock);
-
        set_bit(__E1000_DOWN, &adapter->state);
        return 0;
 
@@ -2912,6 +2918,21 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
        return 0;
 }
 
+/**
+ * e1000e_update_phy_task - work thread to update phy
+ * @work: pointer to our work struct
+ *
+ * this worker thread exists because we must acquire a
+ * semaphore to read the phy, which we could msleep while
+ * waiting for it, and we can't msleep in a timer.
+ **/
+static void e1000e_update_phy_task(struct work_struct *work)
+{
+       struct e1000_adapter *adapter = container_of(work,
+                                       struct e1000_adapter, update_phy_task);
+       e1000_get_phy_info(&adapter->hw);
+}
+
 /*
  * Need to wait a few seconds after link up to get diagnostic information from
  * the phy
@@ -2919,7 +2940,7 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
 static void e1000_update_phy_info(unsigned long data)
 {
        struct e1000_adapter *adapter = (struct e1000_adapter *) data;
-       e1000_get_phy_info(&adapter->hw);
+       schedule_work(&adapter->update_phy_task);
 }
 
 /**
@@ -2930,10 +2951,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
 {
        struct e1000_hw *hw = &adapter->hw;
        struct pci_dev *pdev = adapter->pdev;
-       unsigned long irq_flags;
-       u16 phy_tmp;
-
-#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
 
        /*
         * Prevent stats update while adapter is being reset, or if the pci
@@ -2944,14 +2961,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
        if (pci_channel_offline(pdev))
                return;
 
-       spin_lock_irqsave(&adapter->stats_lock, irq_flags);
-
-       /*
-        * these counters are modified from e1000_adjust_tbi_stats,
-        * called from the interrupt context, so they must only
-        * be written while holding adapter->stats_lock
-        */
-
        adapter->stats.crcerrs += er32(CRCERRS);
        adapter->stats.gprc += er32(GPRC);
        adapter->stats.gorc += er32(GORCL);
@@ -3022,21 +3031,10 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
 
        /* Tx Dropped needs to be maintained elsewhere */
 
-       /* Phy Stats */
-       if (hw->phy.media_type == e1000_media_type_copper) {
-               if ((adapter->link_speed == SPEED_1000) &&
-                  (!e1e_rphy(hw, PHY_1000T_STATUS, &phy_tmp))) {
-                       phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
-                       adapter->phy_stats.idle_errors += phy_tmp;
-               }
-       }
-
        /* Management Stats */
        adapter->stats.mgptc += er32(MGTPTC);
        adapter->stats.mgprc += er32(MGTPRC);
        adapter->stats.mgpdc += er32(MGTPDC);
-
-       spin_unlock_irqrestore(&adapter->stats_lock, irq_flags);
 }
 
 /**
@@ -3048,10 +3046,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
        struct e1000_hw *hw = &adapter->hw;
        struct e1000_phy_regs *phy = &adapter->phy_regs;
        int ret_val;
-       unsigned long irq_flags;
-
-
-       spin_lock_irqsave(&adapter->stats_lock, irq_flags);
 
        if ((er32(STATUS) & E1000_STATUS_LU) &&
            (adapter->hw.phy.media_type == e1000_media_type_copper)) {
@@ -3082,8 +3076,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
                phy->stat1000 = 0;
                phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF);
        }
-
-       spin_unlock_irqrestore(&adapter->stats_lock, irq_flags);
 }
 
 static void e1000_print_link_info(struct e1000_adapter *adapter)
@@ -4467,6 +4459,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
        adapter->bd_number = cards_found++;
 
+       e1000e_check_options(adapter);
+
        /* setup adapter struct */
        err = e1000_sw_init(adapter);
        if (err)
@@ -4482,6 +4476,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
        if (err)
                goto err_hw_init;
 
+       if ((adapter->flags & FLAG_IS_ICH) &&
+           (adapter->flags & FLAG_READ_ONLY_NVM))
+               e1000e_write_protect_nvm_ich8lan(&adapter->hw);
+
        hw->mac.ops.get_bus_info(&adapter->hw);
 
        adapter->hw.phy.autoneg_wait_to_complete = 0;
@@ -4572,8 +4570,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
        INIT_WORK(&adapter->reset_task, e1000_reset_task);
        INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
-
-       e1000e_check_options(adapter);
+       INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround);
+       INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task);
 
        /* Initialize link parameters. User can change them with ethtool */
        adapter->hw.mac.autoneg = 1;
index ed912e023a7266db32cf88dcb60e8bf406d5c421..d91dbf7ba4341665c403fe9491f81355098db80d 100644 (file)
@@ -133,6 +133,15 @@ E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
  */
 E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
 
+/*
+ * Write Protect NVM
+ *
+ * Valid Range: 0, 1
+ *
+ * Default Value: 1 (enabled)
+ */
+E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
+
 struct e1000_option {
        enum { enable_option, range_option, list_option } type;
        const char *name;
@@ -388,4 +397,25 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
                                                                       opt.def);
                }
        }
+       { /* Write-protect NVM */
+               const struct e1000_option opt = {
+                       .type = enable_option,
+                       .name = "Write-protect NVM",
+                       .err  = "defaulting to Enabled",
+                       .def  = OPTION_ENABLED
+               };
+
+               if (adapter->flags & FLAG_IS_ICH) {
+                       if (num_WriteProtectNVM > bd) {
+                               unsigned int write_protect_nvm = WriteProtectNVM[bd];
+                               e1000_validate_option(&write_protect_nvm, &opt,
+                                                     adapter);
+                               if (write_protect_nvm)
+                                       adapter->flags |= FLAG_READ_ONLY_NVM;
+                       } else {
+                               if (opt.def)
+                                       adapter->flags |= FLAG_READ_ONLY_NVM;
+                       }
+               }
+       }
 }
index 0b6ecef9a849d6ea2238fcf807e6601d73ab8aca..eeb55ed2152d4377ac69b5a892906439d4cfdca8 100644 (file)
@@ -5643,6 +5643,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
                dev->dev_addr[4] = (np->orig_mac[0] >>  8) & 0xff;
                dev->dev_addr[5] = (np->orig_mac[0] >>  0) & 0xff;
                writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll);
+               printk(KERN_DEBUG "nv_probe: set workaround bit for reversed mac addr\n");
        }
        memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
 
@@ -5890,14 +5891,12 @@ static void nv_restore_phy(struct net_device *dev)
        }
 }
 
-static void __devexit nv_remove(struct pci_dev *pci_dev)
+static void nv_restore_mac_addr(struct pci_dev *pci_dev)
 {
        struct net_device *dev = pci_get_drvdata(pci_dev);
        struct fe_priv *np = netdev_priv(dev);
        u8 __iomem *base = get_hwbase(dev);
 
-       unregister_netdev(dev);
-
        /* special op: write back the misordered MAC address - otherwise
         * the next nv_probe would see a wrong address.
         */
@@ -5905,6 +5904,15 @@ static void __devexit nv_remove(struct pci_dev *pci_dev)
        writel(np->orig_mac[1], base + NvRegMacAddrB);
        writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV,
               base + NvRegTransmitPoll);
+}
+
+static void __devexit nv_remove(struct pci_dev *pci_dev)
+{
+       struct net_device *dev = pci_get_drvdata(pci_dev);
+
+       unregister_netdev(dev);
+
+       nv_restore_mac_addr(pci_dev);
 
        /* restore any phy related changes */
        nv_restore_phy(dev);
@@ -5975,6 +5983,8 @@ static void nv_shutdown(struct pci_dev *pdev)
        if (netif_running(dev))
                nv_close(dev);
 
+       nv_restore_mac_addr(pdev);
+
        pci_disable_device(pdev);
        if (system_state == SYSTEM_POWER_OFF) {
                if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled))
index 8239939554bc4474735fb174c8f6f02da9957180..fbbd3e660c2731800bf6b7e136a62980bc51032f 100644 (file)
@@ -139,7 +139,7 @@ static int __init do_hpp_probe(struct net_device *dev)
 #ifndef MODULE
 struct net_device * __init hp_plus_probe(int unit)
 {
-       struct net_device *dev = alloc_ei_netdev();
+       struct net_device *dev = alloc_eip_netdev();
        int err;
 
        if (!dev)
@@ -284,7 +284,7 @@ hpp_open(struct net_device *dev)
        int option_reg;
        int retval;
 
-       if ((retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) {
+       if ((retval = request_irq(dev->irq, eip_interrupt, 0, dev->name, dev))) {
            return retval;
        }
 
@@ -302,7 +302,7 @@ hpp_open(struct net_device *dev)
        /* Select the operational page. */
        outw(Perf_Page, ioaddr + HP_PAGING);
 
-       ei_open(dev);
+       eip_open(dev);
        return 0;
 }
 
@@ -313,7 +313,7 @@ hpp_close(struct net_device *dev)
        int option_reg = inw(ioaddr + HPP_OPTION);
 
        free_irq(dev->irq, dev);
-       ei_close(dev);
+       eip_close(dev);
        outw((option_reg & ~EnableIRQ) | MemDisable | NICReset | ChipReset,
                 ioaddr + HPP_OPTION);
 
index 62071d9c4a557c61a38da5167cf2d017590b5ac7..d1dd5b48dbd1412bddf6321ebd3cceb89d18bacd 100644 (file)
@@ -67,11 +67,10 @@ struct mlx4_mpt_entry {
 #define MLX4_MPT_FLAG_PHYSICAL     (1 <<  9)
 #define MLX4_MPT_FLAG_REGION       (1 <<  8)
 
-#define MLX4_MPT_PD_FLAG_FAST_REG   (1 << 26)
+#define MLX4_MPT_PD_FLAG_FAST_REG   (1 << 27)
+#define MLX4_MPT_PD_FLAG_RAE       (1 << 28)
 #define MLX4_MPT_PD_FLAG_EN_INV            (3 << 24)
 
-#define MLX4_MTT_FLAG_PRESENT          1
-
 #define MLX4_MPT_STATUS_SW             0xF0
 #define MLX4_MPT_STATUS_HW             0x00
 
@@ -348,7 +347,10 @@ int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr)
        if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) {
                /* fast register MR in free state */
                mpt_entry->flags    |= cpu_to_be32(MLX4_MPT_FLAG_FREE);
-               mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG);
+               mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG |
+                                                  MLX4_MPT_PD_FLAG_RAE);
+               mpt_entry->mtt_sz    = cpu_to_be32((1 << mr->mtt.order) *
+                                                  MLX4_MTT_ENTRY_PER_SEG);
        } else {
                mpt_entry->flags    |= cpu_to_be32(MLX4_MPT_FLAG_SW_OWNS);
        }
index f6c45288d0e7cad941a43ba501064d7401531902..87e37bc391454ecdf51921ad16504df28e3f103c 100644 (file)
@@ -294,8 +294,6 @@ static int ath_stop(struct ath_softc *sc)
         * hardware is gone (invalid).
         */
 
-       if (!sc->sc_invalid)
-               ath9k_hw_set_interrupts(ah, 0);
        ath_draintxq(sc, false);
        if (!sc->sc_invalid) {
                ath_stoprecv(sc);
@@ -797,6 +795,12 @@ int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan)
        if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT)
                sc->sc_imask |= ATH9K_INT_CST;
 
+       /* Note: We disable MIB interrupts for now as we don't yet
+        * handle processing ANI, otherwise you will get an interrupt
+        * storm after about 7 hours of usage making the system unusable
+        * with huge latency. Once we do have ANI processing included
+        * we can re-enable this interrupt. */
+#if 0
        /*
         * Enable MIB interrupts when there are hardware phy counters.
         * 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)
        if (ath9k_hw_phycounters(ah) &&
            ((sc->sc_opmode == ATH9K_M_STA) || (sc->sc_opmode == ATH9K_M_IBSS)))
                sc->sc_imask |= ATH9K_INT_MIB;
+#endif
        /*
         * Some hardware processes the TIM IE and fires an
         * interrupt when the TIM bit is set.  For hardware
@@ -1336,6 +1341,8 @@ void ath_deinit(struct ath_softc *sc)
 
        DPRINTF(sc, ATH_DBG_CONFIG, "%s\n", __func__);
 
+       tasklet_kill(&sc->intr_tq);
+       tasklet_kill(&sc->bcon_tasklet);
        ath_stop(sc);
        if (!sc->sc_invalid)
                ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
index 4ee695b76b88ece8e9ac4de86576555a737f0168..2f84093331ee79253e58f33ff59006392c54d891 100644 (file)
@@ -974,7 +974,6 @@ struct ath_softc {
        u32 sc_keymax;          /* size of key cache */
        DECLARE_BITMAP(sc_keymap, ATH_KEYMAX);  /* key use bit map */
        u8 sc_splitmic;         /* split TKIP MIC keys */
-       int sc_keytype;
 
        /* RX */
        struct list_head sc_rxbuf;
index 99badf1404c31a0fbb9640137cf5d1c36f212d28..acebdf1d20a842048ceaa1dcb5fcfbf117ce6fcc 100644 (file)
@@ -206,8 +206,6 @@ static int ath_key_config(struct ath_softc *sc,
        if (!ret)
                return -EIO;
 
-       if (mac)
-               sc->sc_keytype = hk.kv_type;
        return 0;
 }
 
@@ -778,7 +776,6 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
        case DISABLE_KEY:
                ath_key_delete(sc, key);
                clear_bit(key->keyidx, sc->sc_keymap);
-               sc->sc_keytype = ATH9K_CIPHER_CLR;
                break;
        default:
                ret = -EINVAL;
@@ -1414,10 +1411,17 @@ static void ath_pci_remove(struct pci_dev *pdev)
 {
        struct ieee80211_hw *hw = pci_get_drvdata(pdev);
        struct ath_softc *sc = hw->priv;
+       enum ath9k_int status;
 
-       if (pdev->irq)
+       if (pdev->irq) {
+               ath9k_hw_set_interrupts(sc->sc_ah, 0);
+               /* clear the ISR */
+               ath9k_hw_getisr(sc->sc_ah, &status);
+               sc->sc_invalid = 1;
                free_irq(pdev->irq, sc);
+       }
        ath_detach(sc);
+
        pci_iounmap(pdev, sc->mem);
        pci_release_region(pdev, 0);
        pci_disable_device(pdev);
index 550129f717e2c58ebd3f62f5edc6df0735e3c073..8b332e11a656729f078b47099ba044f2f33aef38 100644 (file)
@@ -315,11 +315,11 @@ static int ath_tx_prepare(struct ath_softc *sc,
                txctl->keyix = tx_info->control.hw_key->hw_key_idx;
                txctl->frmlen += tx_info->control.icv_len;
 
-               if (sc->sc_keytype == ATH9K_CIPHER_WEP)
+               if (tx_info->control.hw_key->alg == ALG_WEP)
                        txctl->keytype = ATH9K_KEY_TYPE_WEP;
-               else if (sc->sc_keytype == ATH9K_CIPHER_TKIP)
+               else if (tx_info->control.hw_key->alg == ALG_TKIP)
                        txctl->keytype = ATH9K_KEY_TYPE_TKIP;
-               else if (sc->sc_keytype == ATH9K_CIPHER_AES_CCM)
+               else if (tx_info->control.hw_key->alg == ALG_CCMP)
                        txctl->keytype = ATH9K_KEY_TYPE_AES;
        }
 
index fec5645944a4da39a93b76a784d7da731163e047..34ae125d5384dadf769b0134aa0a878af471fc17 100644 (file)
@@ -43,23 +43,6 @@ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
        return 0;
 }
 
-/* Update the rfkill state */
-static void b43_rfkill_update_state(struct b43_wldev *dev)
-{
-       struct b43_rfkill *rfk = &(dev->wl->rfkill);
-
-       if (!dev->radio_hw_enable) {
-               rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
-               return;
-       }
-
-       if (!dev->phy.radio_on)
-               rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
-       else
-               rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
-
-}
-
 /* The poll callback for the hardware button. */
 static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
 {
@@ -77,7 +60,6 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
        if (unlikely(enabled != dev->radio_hw_enable)) {
                dev->radio_hw_enable = enabled;
                report_change = 1;
-               b43_rfkill_update_state(dev);
                b43info(wl, "Radio hardware status changed to %s\n",
                        enabled ? "ENABLED" : "DISABLED");
        }
index 476add97e9749bddde4ef20b6420e13beef21886..b32bf6a94f19d7543525ed562a89683bf893d168 100644 (file)
@@ -44,23 +44,6 @@ static bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev)
        return 0;
 }
 
-/* Update the rfkill state */
-static void b43legacy_rfkill_update_state(struct b43legacy_wldev *dev)
-{
-       struct b43legacy_rfkill *rfk = &(dev->wl->rfkill);
-
-       if (!dev->radio_hw_enable) {
-               rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
-               return;
-       }
-
-       if (!dev->phy.radio_on)
-               rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
-       else
-               rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
-
-}
-
 /* The poll callback for the hardware button. */
 static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
 {
@@ -78,7 +61,6 @@ static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
        if (unlikely(enabled != dev->radio_hw_enable)) {
                dev->radio_hw_enable = enabled;
                report_change = 1;
-               b43legacy_rfkill_update_state(dev);
                b43legacyinfo(wl, "Radio hardware status changed to %s\n",
                        enabled ? "ENABLED" : "DISABLED");
        }
index da8b7433e3a69b731c5d534bb86d1f9a46bb301f..a60ae86bd5c9bddf5a9e8663ffdac0004d6183c8 100644 (file)
@@ -58,6 +58,7 @@ static struct usb_device_id usb_ids[] = {
        { USB_DEVICE(0x0586, 0x3407), .driver_info = DEVICE_ZD1211 },
        { USB_DEVICE(0x129b, 0x1666), .driver_info = DEVICE_ZD1211 },
        { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 },
+       { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 },
        /* ZD1211B */
        { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B },
        { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B },
index 9c718583a237f4f6082e7dcc5e84e23e85ee651c..77baff022f71b85259e1e064a06531b03a9bb727 100644 (file)
@@ -16,6 +16,7 @@
 
 
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/pci.h>
 #include <linux/stat.h>
 #include <linux/topology.h>
@@ -484,6 +485,21 @@ pci_mmap_legacy_mem(struct kobject *kobj, struct bin_attribute *attr,
 #endif /* HAVE_PCI_LEGACY */
 
 #ifdef HAVE_PCI_MMAP
+
+static int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma)
+{
+       unsigned long nr, start, size;
+
+       nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+       start = vma->vm_pgoff;
+       size = pci_resource_len(pdev, resno) >> PAGE_SHIFT;
+       if (start < size && size - start >= nr)
+               return 1;
+       WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n",
+               current->comm, start, start+nr, pci_name(pdev), resno, size);
+       return 0;
+}
+
 /**
  * pci_mmap_resource - map a PCI resource into user memory space
  * @kobj: kobject for mapping
@@ -510,6 +526,9 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
        if (i >= PCI_ROM_RESOURCE)
                return -ENODEV;
 
+       if (!pci_mmap_fits(pdev, i, vma))
+               return -EINVAL;
+
        /* pci_mmap_page_range() expects the same kind of entry as coming
         * from /proc/bus/pci/ which is a "user visible" value. If this is
         * different from the resource itself, arch will do necessary fixup.
index 9a7c9e1408a41823aef2198f6e3a8e0e220d609a..851f5b83cdbc3f62f352627d0ee91848fc9923c0 100644 (file)
@@ -527,7 +527,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
                 */
                pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP,
                        &reg32);
-               if (!(reg32 & PCI_EXP_DEVCAP_RBER && !aspm_force)) {
+               if (!(reg32 & PCI_EXP_DEVCAP_RBER) && !aspm_force) {
                        printk("Pre-1.1 PCIe device detected, "
                                "disable ASPM for %s. It can be enabled forcedly"
                                " with 'pcie_aspm=force'\n", pci_name(pdev));
index 3b3b5f1787973556f7dacecd01b1ab3bbe68b68f..4edfc4731bd4296f3b33081d2f9f66946f1f231f 100644 (file)
@@ -162,7 +162,7 @@ EXPORT_SYMBOL(pci_find_slot);
  * time.
  */
 struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device,
-                               const struct pci_dev *from)
+                               struct pci_dev *from)
 {
        struct pci_dev *pdev;
 
@@ -263,7 +263,7 @@ static int match_pci_dev_by_id(struct device *dev, void *data)
  * this file.
  */
 static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id,
-                                        const struct pci_dev *from)
+                                        struct pci_dev *from)
 {
        struct device *dev;
        struct device *dev_start = NULL;
@@ -303,7 +303,7 @@ static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id,
  */
 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
                               unsigned int ss_vendor, unsigned int ss_device,
-                              const struct pci_dev *from)
+                              struct pci_dev *from)
 {
        struct pci_dev *pdev;
        struct pci_device_id *id;
index 4174d9656e357f8ec5f16520ad03c86544a5e969..34c83d3ca0fac69df37ece4e352a99697ae515cd 100644 (file)
@@ -427,6 +427,18 @@ static int pcmcia_device_probe(struct device * dev)
        p_drv = to_pcmcia_drv(dev->driver);
        s = p_dev->socket;
 
+       /* The PCMCIA code passes the match data in via dev->driver_data
+        * which is an ugly hack. Once the driver probe is called it may
+        * and often will overwrite the match data so we must save it first
+        *
+        * handle pseudo multifunction devices:
+        * there are at most two pseudo multifunction devices.
+        * if we're matching against the first, schedule a
+        * call which will then check whether there are two
+        * pseudo devices, and if not, add the second one.
+        */
+       did = p_dev->dev.driver_data;
+
        ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id,
               p_drv->drv.name);
 
@@ -455,21 +467,14 @@ static int pcmcia_device_probe(struct device * dev)
                goto put_module;
        }
 
-       /* handle pseudo multifunction devices:
-        * there are at most two pseudo multifunction devices.
-        * if we're matching against the first, schedule a
-        * call which will then check whether there are two
-        * pseudo devices, and if not, add the second one.
-        */
-       did = p_dev->dev.driver_data;
        if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
            (p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
                pcmcia_add_device_later(p_dev->socket, 0);
 
- put_module:
+put_module:
        if (ret)
                module_put(p_drv->owner);
- put_dev:
+put_dev:
        if (ret)
                put_device(dev);
        return (ret);
index 26f5abc9c3f7d604d926ec32e77570d4fd1a8363..e83f34f1b5bada1207cb4bf8e77badaac623e2e1 100644 (file)
@@ -2,12 +2,15 @@
 # Makefile for the Linux Plug-and-Play Support.
 #
 
-obj-y          := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o system.o
+obj-y          := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o
 
 obj-$(CONFIG_PNPACPI)          += pnpacpi/
 obj-$(CONFIG_PNPBIOS)          += pnpbios/
 obj-$(CONFIG_ISAPNP)           += isapnp/
 
+# pnp_system_init goes after pnpacpi/pnpbios init
+obj-y                          += system.o
+
 ifeq ($(CONFIG_PNP_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
index c1b9ea34977b395c400fcd522ecd41f06fadbd21..53561d72b4eef0795e41054476060093d1053dbe 100644 (file)
@@ -268,7 +268,7 @@ static int __init pnpacpi_init(void)
        return 0;
 }
 
-subsys_initcall(pnpacpi_init);
+fs_initcall(pnpacpi_init);
 
 static int __init pnpacpi_setup(char *str)
 {
index 19a4be1a9a31afd73567724ccdf3b56a03445bc7..662dfcddedc62fce03362f72cd79c421f6542a37 100644 (file)
@@ -571,7 +571,7 @@ static int __init pnpbios_init(void)
        return 0;
 }
 
-subsys_initcall(pnpbios_init);
+fs_initcall(pnpbios_init);
 
 static int __init pnpbios_thread_init(void)
 {
index f118252f3a9f2b921cef3fff96fd1ef890d65b3c..52e2743b04ecf77bb6a975d6c8609fa042025dea 100644 (file)
@@ -422,6 +422,12 @@ done:
        return err;
 }
 
+static int rtc_dev_fasync(int fd, struct file *file, int on)
+{
+       struct rtc_device *rtc = file->private_data;
+       return fasync_helper(fd, file, on, &rtc->async_queue);
+}
+
 static int rtc_dev_release(struct inode *inode, struct file *file)
 {
        struct rtc_device *rtc = file->private_data;
@@ -434,16 +440,13 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
        if (rtc->ops->release)
                rtc->ops->release(rtc->dev.parent);
 
+       if (file->f_flags & FASYNC)
+               rtc_dev_fasync(-1, file, 0);
+
        clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
        return 0;
 }
 
-static int rtc_dev_fasync(int fd, struct file *file, int on)
-{
-       struct rtc_device *rtc = file->private_data;
-       return fasync_helper(fd, file, on, &rtc->async_queue);
-}
-
 static const struct file_operations rtc_dev_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
index e0ce65fca4e797ed2da7370093a56f1a86d04c81..9a50f245774b0491e1c31532d059049cab945c7b 100644 (file)
@@ -113,7 +113,8 @@ ccwgroup_release (struct device *dev)
 
        for (i = 0; i < gdev->count; i++) {
                if (gdev->cdev[i]) {
-                       dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
+                       if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev)
+                               dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
                        put_device(&gdev->cdev[i]->dev);
                }
        }
@@ -296,6 +297,7 @@ error:
                        if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev)
                                dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
                        put_device(&gdev->cdev[i]->dev);
+                       gdev->cdev[i] = NULL;
                }
        mutex_unlock(&gdev->reg_mutex);
        put_device(&gdev->dev);
index 5954b905e3cab9723116646069356ad7928c31d8..326f4cc7f92c932578870443f1421488501c25c0 100644 (file)
@@ -174,6 +174,7 @@ cio_start_key (struct subchannel *sch,      /* subchannel structure */
        CIO_TRACE_EVENT(4, sch->dev.bus_id);
 
        orb = &to_io_private(sch)->orb;
+       memset(orb, 0, sizeof(union orb));
        /* sch is always under 2G. */
        orb->cmd.intparm = (u32)(addr_t)sch;
        orb->cmd.fmt = 1;
index 1679e2f91c945eb0164b3d8a813207c9cfd5efbd..a0b6b46e746647ae5451d5099c5a8ccde5e89175 100644 (file)
@@ -447,51 +447,36 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr,
 {
        char s[80];
 
-       sprintf(s, "%s sc:%x ", cdev->dev.bus_id, irq_ptr->schid.sch_no);
-
+       sprintf(s, "qdio: %s ", dev_name(&cdev->dev));
        switch (irq_ptr->qib.qfmt) {
        case QDIO_QETH_QFMT:
-               sprintf(s + strlen(s), "OSADE ");
+               sprintf(s + strlen(s), "OSA ");
                break;
        case QDIO_ZFCP_QFMT:
                sprintf(s + strlen(s), "ZFCP ");
                break;
        case QDIO_IQDIO_QFMT:
-               sprintf(s + strlen(s), "HiperSockets ");
+               sprintf(s + strlen(s), "HS ");
                break;
        }
-       sprintf(s + strlen(s), "using: ");
-
-       if (!is_thinint_irq(irq_ptr))
-               sprintf(s + strlen(s), "no");
-       sprintf(s + strlen(s), "AdapterInterrupts ");
-       if (!(irq_ptr->sch_token != 0))
-               sprintf(s + strlen(s), "no");
-       sprintf(s + strlen(s), "QEBSM ");
-       if (!(irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED))
-               sprintf(s + strlen(s), "no");
-       sprintf(s + strlen(s), "OutboundPCI ");
-       if (!css_general_characteristics.aif_tdd)
-               sprintf(s + strlen(s), "no");
-       sprintf(s + strlen(s), "TDD\n");
-       printk(KERN_INFO "qdio: %s", s);
-
-       memset(s, 0, sizeof(s));
-       sprintf(s, "%s SIGA required: ", cdev->dev.bus_id);
-       if (irq_ptr->siga_flag.input)
-               sprintf(s + strlen(s), "Read ");
-       if (irq_ptr->siga_flag.output)
-               sprintf(s + strlen(s), "Write ");
-       if (irq_ptr->siga_flag.sync)
-               sprintf(s + strlen(s), "Sync ");
-       if (!irq_ptr->siga_flag.no_sync_ti)
-               sprintf(s + strlen(s), "SyncAI ");
-       if (!irq_ptr->siga_flag.no_sync_out_ti)
-               sprintf(s + strlen(s), "SyncOutAI ");
-       if (!irq_ptr->siga_flag.no_sync_out_pci)
-               sprintf(s + strlen(s), "SyncOutPCI");
+       sprintf(s + strlen(s), "on SC %x using ", irq_ptr->schid.sch_no);
+       sprintf(s + strlen(s), "AI:%d ", is_thinint_irq(irq_ptr));
+       sprintf(s + strlen(s), "QEBSM:%d ", (irq_ptr->sch_token) ? 1 : 0);
+       sprintf(s + strlen(s), "PCI:%d ",
+               (irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED) ? 1 : 0);
+       sprintf(s + strlen(s), "TDD:%d ", css_general_characteristics.aif_tdd);
+       sprintf(s + strlen(s), "SIGA:");
+       sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.input) ? "R" : " ");
+       sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.output) ? "W" : " ");
+       sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.sync) ? "S" : " ");
+       sprintf(s + strlen(s), "%s",
+               (!irq_ptr->siga_flag.no_sync_ti) ? "A" : " ");
+       sprintf(s + strlen(s), "%s",
+               (!irq_ptr->siga_flag.no_sync_out_ti) ? "O" : " ");
+       sprintf(s + strlen(s), "%s",
+               (!irq_ptr->siga_flag.no_sync_out_pci) ? "P" : " ");
        sprintf(s + strlen(s), "\n");
-       printk(KERN_INFO "qdio: %s", s);
+       printk(KERN_INFO "%s", s);
 }
 
 int __init qdio_setup_init(void)
index 48ee8c7f5bdd270351bcdf0dae895e0ae572a3f2..e1872989710a326fad8b706b821418abb7f91040 100644 (file)
@@ -294,10 +294,10 @@ static void sas_ata_post_internal(struct ata_queued_cmd *qc)
        }
 }
 
-static int sas_ata_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
+static int sas_ata_scr_write(struct ata_link *link, unsigned int sc_reg_in,
                              u32 val)
 {
-       struct domain_device *dev = ap->private_data;
+       struct domain_device *dev = link->ap->private_data;
 
        SAS_DPRINTK("STUB %s\n", __func__);
        switch (sc_reg_in) {
@@ -319,10 +319,10 @@ static int sas_ata_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
        return 0;
 }
 
-static int sas_ata_scr_read(struct ata_port *ap, unsigned int sc_reg_in,
+static int sas_ata_scr_read(struct ata_link *link, unsigned int sc_reg_in,
                            u32 *val)
 {
-       struct domain_device *dev = ap->private_data;
+       struct domain_device *dev = link->ap->private_data;
 
        SAS_DPRINTK("STUB %s\n", __func__);
        switch (sc_reg_in) {
index 45a3b93eed57aac2617617a79a449df231f51f8f..bf41887cdd655a4dfd0ecc04a4a8a91aa67bc265 100644 (file)
@@ -1834,7 +1834,6 @@ clear_risc_ints:
                WRT_REG_WORD(&reg->isp.hccr, HCCR_CLR_HOST_INT);
        }
        spin_unlock_irq(&ha->hardware_lock);
-       ha->isp_ops->enable_intrs(ha);
 
 fail:
        return ret;
index 26afe44265c794177380eea2b25433d2277761f5..6d0f0e5f282791fc6b8bc40c77c89a2db55b92dc 100644 (file)
@@ -1740,6 +1740,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        if (ret)
                goto probe_failed;
 
+       ha->isp_ops->enable_intrs(ha);
+
        scsi_scan_host(host);
 
        qla2x00_alloc_sysfs_attr(ha);
index 4a1cf6377f6c89b7a654bf3c38e9e2ae8b1bcc4f..9053508967253b9d894efefbd81bdc1bf125e725 100644 (file)
@@ -914,6 +914,7 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
                                ds[i].d_count = sg_dma_len(s);
                        }
                        sg_count -= n;
+                       sg = s;
                }
        } else {
                cmd->dataseg[0].d_base = 0;
index ff5d56b3ee4d5c66a6ee4ab34609fc1800cd347b..62307bd794a924c1f04d6b6822aa61dd2ef875c3 100644 (file)
@@ -852,7 +852,7 @@ static void scsi_end_bidi_request(struct scsi_cmnd *cmd)
 void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 {
        int result = cmd->result;
-       int this_count = scsi_bufflen(cmd);
+       int this_count;
        struct request_queue *q = cmd->device->request_queue;
        struct request *req = cmd->request;
        int error = 0;
@@ -908,6 +908,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
         */
        if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL)
                return;
+       this_count = blk_rq_bytes(req);
 
        /* good_bytes = 0, or (inclusive) there were leftovers and
         * result = 0, so scsi_end_request couldn't retry.
index 3a6da80b081c14405ecfdd60660470928843e84c..61fb8b6d19af77be5a9b180532725c22df68d44d 100644 (file)
@@ -131,7 +131,8 @@ struct atmel_uart_char {
 struct atmel_uart_port {
        struct uart_port        uart;           /* uart */
        struct clk              *clk;           /* uart clock */
-       unsigned short          suspended;      /* is port suspended? */
+       int                     may_wakeup;     /* cached value of device_may_wakeup for times we need to disable it */
+       u32                     backup_imr;     /* IMR saved during suspend */
        int                     break_active;   /* break being received */
 
        short                   use_dma_rx;     /* enable PDC receiver */
@@ -984,8 +985,15 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
                 * This is called on uart_open() or a resume event.
                 */
                clk_enable(atmel_port->clk);
+
+               /* re-enable interrupts if we disabled some on suspend */
+               UART_PUT_IER(port, atmel_port->backup_imr);
                break;
        case 3:
+               /* Back up the interrupt mask and disable all interrupts */
+               atmel_port->backup_imr = UART_GET_IMR(port);
+               UART_PUT_IDR(port, -1);
+
                /*
                 * Disable the peripheral clock for this serial port.
                 * This is called on uart_close() or a suspend event.
@@ -1475,13 +1483,12 @@ static int atmel_serial_suspend(struct platform_device *pdev,
                        cpu_relax();
        }
 
-       if (device_may_wakeup(&pdev->dev)
-           && !atmel_serial_clk_will_stop())
-               enable_irq_wake(port->irq);
-       else {
-               uart_suspend_port(&atmel_uart, port);
-               atmel_port->suspended = 1;
-       }
+       /* we can not wake up if we're running on slow clock */
+       atmel_port->may_wakeup = device_may_wakeup(&pdev->dev);
+       if (atmel_serial_clk_will_stop())
+               device_set_wakeup_enable(&pdev->dev, 0);
+
+       uart_suspend_port(&atmel_uart, port);
 
        return 0;
 }
@@ -1491,11 +1498,8 @@ static int atmel_serial_resume(struct platform_device *pdev)
        struct uart_port *port = platform_get_drvdata(pdev);
        struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
 
-       if (atmel_port->suspended) {
-               uart_resume_port(&atmel_uart, port);
-               atmel_port->suspended = 0;
-       } else
-               disable_irq_wake(port->irq);
+       uart_resume_port(&atmel_uart, port);
+       device_set_wakeup_enable(&pdev->dev, atmel_port->may_wakeup);
 
        return 0;
 }
@@ -1513,6 +1517,8 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
        BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE));
 
        port = &atmel_ports[pdev->id];
+       port->backup_imr = 0;
+
        atmel_init_port(port, pdev);
 
        if (!atmel_use_dma_rx(&port->uart)) {
index c4eaacd6e5539ee53e65aa0909666f40f5a5568b..b872bfaf4bd2c0e4706c1551db8da94324622983 100644 (file)
@@ -427,7 +427,7 @@ static int orion_spi_transfer(struct spi_device *spi, struct spi_message *m)
                        goto msg_rejected;
                }
 
-               if (t->speed_hz < orion_spi->min_speed) {
+               if (t->speed_hz && t->speed_hz < orion_spi->min_speed) {
                        dev_err(&spi->dev,
                                "message rejected : "
                                "device min speed (%d Hz) exceeds "
index 0e53354c1cfe7edbde6e47ff8ca0efcc4306be7d..d47d3636227fe90e435fc03a8f59fd49860b1220 100644 (file)
@@ -49,7 +49,7 @@ MODULE_ALIAS("platform:pxa2xx-spi");
 
 #define DMA_INT_MASK           (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR)
 #define RESET_DMA_CHANNEL      (DCSR_NODESC | DMA_INT_MASK)
-#define IS_DMA_ALIGNED(x)      (((x) & 0x07) == 0)
+#define IS_DMA_ALIGNED(x)      ((((u32)(x)) & 0x07) == 0)
 #define MAX_DMA_LEN            8191
 
 /*
@@ -896,7 +896,7 @@ static void pump_transfers(unsigned long data)
                                || transfer->rx_dma || transfer->tx_dma) {
                        dev_err(&drv_data->pdev->dev,
                                "pump_transfers: mapped transfer length "
-                               "of %lu is greater than %d\n",
+                               "of %u is greater than %d\n",
                                transfer->len, MAX_DMA_LEN);
                        message->status = -EINVAL;
                        giveback(drv_data);
index 87ab2443e66d405ec72d45a2da2f120d59e48f0c..0ffabf5c0b60dd9892b5b9c45e2a1d8881129108 100644 (file)
@@ -471,6 +471,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
 #endif
                        break;
                case SSB_BUSTYPE_SSB:
+                       dev->dma_mask = &dev->coherent_dma_mask;
                        break;
                }
 
index 8abd4e59bf4abac0bb2edcee5385894f42310e98..8ab389dca2b91c49bfdb75e900a1c5a5dde3d334 100644 (file)
@@ -1876,7 +1876,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
                 * with IRQF_SHARED. As usb_hcd_irq() will always disable
                 * interrupts we can remove it here.
                 */
-               irqflags &= ~IRQF_DISABLED;
+               if (irqflags & IRQF_SHARED)
+                       irqflags &= ~IRQF_DISABLED;
 
                snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
                                hcd->driver->description, hcd->self.busnum);
index 6a5cb018383d538a2b504429183be99e112c6a5b..d99963873e37aada67583be1cc84fc219f00bbb2 100644 (file)
@@ -2683,35 +2683,17 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                                USB_PORT_STAT_C_ENABLE);
 #endif
 
-       /* Try to use the debounce delay for protection against
-        * port-enable changes caused, for example, by EMI.
-        */
-       if (portchange & (USB_PORT_STAT_C_CONNECTION |
-                               USB_PORT_STAT_C_ENABLE)) {
-               status = hub_port_debounce(hub, port1);
-               if (status < 0) {
-                       if (printk_ratelimit())
-                               dev_err (hub_dev, "connect-debounce failed, "
-                                               "port %d disabled\n", port1);
-                       portstatus &= ~USB_PORT_STAT_CONNECTION;
-               } else {
-                       portstatus = status;
-               }
-       }
-
        /* Try to resuscitate an existing device */
        udev = hdev->children[port1-1];
        if ((portstatus & USB_PORT_STAT_CONNECTION) && udev &&
                        udev->state != USB_STATE_NOTATTACHED) {
-
                usb_lock_device(udev);
                if (portstatus & USB_PORT_STAT_ENABLE) {
                        status = 0;             /* Nothing to do */
-               } else if (!udev->persist_enabled) {
-                       status = -ENODEV;       /* Mustn't resuscitate */
 
 #ifdef CONFIG_USB_SUSPEND
-               } else if (udev->state == USB_STATE_SUSPENDED) {
+               } else if (udev->state == USB_STATE_SUSPENDED &&
+                               udev->persist_enabled) {
                        /* For a suspended device, treat this as a
                         * remote wakeup event.
                         */
@@ -2726,7 +2708,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 #endif
 
                } else {
-                       status = usb_reset_device(udev);
+                       status = -ENODEV;       /* Don't resuscitate */
                }
                usb_unlock_device(udev);
 
@@ -2741,6 +2723,19 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                usb_disconnect(&hdev->children[port1-1]);
        clear_bit(port1, hub->change_bits);
 
+       if (portchange & (USB_PORT_STAT_C_CONNECTION |
+                               USB_PORT_STAT_C_ENABLE)) {
+               status = hub_port_debounce(hub, port1);
+               if (status < 0) {
+                       if (printk_ratelimit())
+                               dev_err(hub_dev, "connect-debounce failed, "
+                                               "port %d disabled\n", port1);
+                       portstatus &= ~USB_PORT_STAT_CONNECTION;
+               } else {
+                       portstatus = status;
+               }
+       }
+
        /* Return now if debouncing failed or nothing is connected */
        if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
 
@@ -2748,7 +2743,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
                                && !(portstatus & (1 << USB_PORT_FEAT_POWER)))
                        set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
+
                if (portstatus & USB_PORT_STAT_ENABLE)
                        goto done;
                return;
index 1cfccf102a2dc9fdc9948daf4aadaf5a32c793cf..45ad556169f106270675c706d8d7ae6836d4b2ea 100644 (file)
@@ -223,7 +223,7 @@ static int dr_controller_setup(struct fsl_udc *udc)
        fsl_writel(tmp, &dr_regs->endpointlistaddr);
 
        VDBG("vir[qh_base] is %p phy[qh_base] is 0x%8x reg is 0x%8x",
-               (int)udc->ep_qh, (int)tmp,
+               udc->ep_qh, (int)tmp,
                fsl_readl(&dr_regs->endpointlistaddr));
 
        /* Config PHY interface */
index 574c53831a05fd17afd6062633aaab4843609e5f..bb54cca4c54381736ead413cec0e3747e4af9b78 100644 (file)
@@ -787,7 +787,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
                        omap_set_dma_dest_params(ep->lch,
                                OMAP_DMA_PORT_TIPB,
                                OMAP_DMA_AMODE_CONSTANT,
-                               (unsigned long) io_v2p(UDC_DATA_DMA),
+                               UDC_DATA_DMA,
                                0, 0);
                }
        } else {
@@ -804,7 +804,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
                        omap_set_dma_src_params(ep->lch,
                                OMAP_DMA_PORT_TIPB,
                                OMAP_DMA_AMODE_CONSTANT,
-                               (unsigned long) io_v2p(UDC_DATA_DMA),
+                               UDC_DATA_DMA,
                                0, 0);
                        /* EMIFF or SDRC */
                        omap_set_dma_dest_burst_mode(ep->lch,
index d9d53f289caf48b83001b42321e1bbaf9ca00886..8409e0705d6365c34e6db7252cc39eb60575877a 100644 (file)
@@ -145,16 +145,6 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr,
        return -ETIMEDOUT;
 }
 
-static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
-                                      u32 mask, u32 done, int usec)
-{
-       int error = handshake(ehci, ptr, mask, done, usec);
-       if (error)
-               ehci_to_hcd(ehci)->state = HC_STATE_HALT;
-
-       return error;
-}
-
 /* force HC to halt state from unknown (EHCI spec section 2.3) */
 static int ehci_halt (struct ehci_hcd *ehci)
 {
@@ -173,6 +163,22 @@ static int ehci_halt (struct ehci_hcd *ehci)
                          STS_HALT, STS_HALT, 16 * 125);
 }
 
+static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
+                                      u32 mask, u32 done, int usec)
+{
+       int error;
+
+       error = handshake(ehci, ptr, mask, done, usec);
+       if (error) {
+               ehci_halt(ehci);
+               ehci_to_hcd(ehci)->state = HC_STATE_HALT;
+               ehci_err(ehci, "force halt; handhake %p %08x %08x -> %d\n",
+                       ptr, mask, done, error);
+       }
+
+       return error;
+}
+
 /* put TDI/ARC silicon into EHCI mode */
 static void tdi_reset (struct ehci_hcd *ehci)
 {
index b7853c8bac0fb58c3c7f74e18145362b6f2002cd..4a0c5a78b2ed74358055e800d5181b1a1e2cb1c7 100644 (file)
@@ -437,6 +437,9 @@ static int enable_periodic (struct ehci_hcd *ehci)
        u32     cmd;
        int     status;
 
+       if (ehci->periodic_sched++)
+               return 0;
+
        /* did clearing PSE did take effect yet?
         * takes effect only at frame boundaries...
         */
@@ -461,6 +464,9 @@ static int disable_periodic (struct ehci_hcd *ehci)
        u32     cmd;
        int     status;
 
+       if (--ehci->periodic_sched)
+               return 0;
+
        /* did setting PSE not take effect yet?
         * takes effect only at frame boundaries...
         */
@@ -544,13 +550,10 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
                : (qh->usecs * 8);
 
        /* maybe enable periodic schedule processing */
-       if (!ehci->periodic_sched++)
-               return enable_periodic (ehci);
-
-       return 0;
+       return enable_periodic(ehci);
 }
 
-static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
+static int qh_unlink_periodic(struct ehci_hcd *ehci, struct ehci_qh *qh)
 {
        unsigned        i;
        unsigned        period;
@@ -586,9 +589,7 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
        qh_put (qh);
 
        /* maybe turn off periodic schedule */
-       ehci->periodic_sched--;
-       if (!ehci->periodic_sched)
-               (void) disable_periodic (ehci);
+       return disable_periodic(ehci);
 }
 
 static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
@@ -1562,9 +1563,7 @@ itd_link_urb (
        urb->hcpriv = NULL;
 
        timer_action (ehci, TIMER_IO_WATCHDOG);
-       if (unlikely (!ehci->periodic_sched++))
-               return enable_periodic (ehci);
-       return 0;
+       return enable_periodic(ehci);
 }
 
 #define        ISO_ERRS (EHCI_ISOC_BUF_ERR | EHCI_ISOC_BABBLE | EHCI_ISOC_XACTERR)
@@ -1642,7 +1641,7 @@ itd_complete (
        ehci_urb_done(ehci, urb, 0);
        retval = true;
        urb = NULL;
-       ehci->periodic_sched--;
+       (void) disable_periodic(ehci);
        ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
 
        if (unlikely (list_empty (&stream->td_list))) {
@@ -1951,9 +1950,7 @@ sitd_link_urb (
        urb->hcpriv = NULL;
 
        timer_action (ehci, TIMER_IO_WATCHDOG);
-       if (!ehci->periodic_sched++)
-               return enable_periodic (ehci);
-       return 0;
+       return enable_periodic(ehci);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -2019,7 +2016,7 @@ sitd_complete (
        ehci_urb_done(ehci, urb, 0);
        retval = true;
        urb = NULL;
-       ehci->periodic_sched--;
+       (void) disable_periodic(ehci);
        ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
 
        if (list_empty (&stream->td_list)) {
@@ -2243,8 +2240,7 @@ restart:
                        if (unlikely (modified)) {
                                if (likely(ehci->periodic_sched > 0))
                                        goto restart;
-                               /* maybe we can short-circuit this scan! */
-                               disable_periodic(ehci);
+                               /* short-circuit this scan */
                                now_uframe = clock;
                                break;
                        }
index a0017486ad4ea27f6220764ede93cb3562e59247..58b2b8fc9439c7b93b956e930e74387f17057cf3 100644 (file)
@@ -9,6 +9,7 @@ comment "Enable Host or Gadget support to see Inventra options"
 # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller
 config USB_MUSB_HDRC
        depends on (USB || USB_GADGET) && HAVE_CLK
+       depends on !SUPERH
        select TWL4030_USB if MACH_OMAP_3430SDP
        tristate 'Inventra Highspeed Dual Role Controller (TI, ...)'
        help
index c5b8f0296fcf2f9f9a7ab40404d1f8324e325508..128e949db47c4a2c64f0156a2c7c227ef8f16fd1 100644 (file)
 #include <linux/io.h>
 
 #ifdef CONFIG_ARM
-#include <asm/arch/hardware.h>
-#include <asm/arch/memory.h>
+#include <mach/hardware.h>
+#include <mach/memory.h>
 #include <asm/mach-types.h>
 #endif
 
index 298b22e6ad0dd999afaa7872fafd3babdbdfe960..9d2dcb121c5e95cc7e6ba81a5cdfa59ae07637ae 100644 (file)
@@ -35,8 +35,8 @@
 #include <linux/io.h>
 
 #include <asm/mach-types.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/mux.h>
+#include <mach/hardware.h>
+#include <mach/mux.h>
 
 #include "musb_core.h"
 #include "omap2430.h"
index 786a62071f7236382be179f2cf3116d10f2e5135..dc7670718cd2ba4bfd8aa4f080b54a2de0fe3a86 100644 (file)
@@ -11,8 +11,8 @@
 #define __MUSB_OMAP243X_H__
 
 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
-#include <asm/arch/hardware.h>
-#include <asm/arch/usb.h>
+#include <mach/hardware.h>
+#include <mach/usb.h>
 
 /*
  * OMAP2430-specific definitions
index 442cba69cce5b9742aa883872122522d0e525925..1279553381e34a5d4486ded444294a533f53371c 100644 (file)
@@ -72,6 +72,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
        { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */
        { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */
+       { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */
        { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
        { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
        { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
@@ -83,6 +84,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
        { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
        { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */
+       { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
        { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
        { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
        { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */
@@ -93,6 +95,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
        { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
        { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
+       { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
        { } /* Terminating Entry */
 };
 
index 984f6eff4c475acb6cdfdb85407897aac9e87d01..3dc93b542b30634cd23bbbe012b16034c84f6449 100644 (file)
@@ -654,6 +654,9 @@ static struct usb_device_id id_table_combined [] = {
                .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
        { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
        { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
+       { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) },
        { },                                    /* Optional parameter entry */
        { }                                     /* Terminating entry */
 };
index 382265bba9690b84eaf51c57b16a0e460c3f29ee..8a5b6df3a97673664b27c2ebb162076f63261685 100644 (file)
 
 #define PAPOUCH_VID                    0x5050  /* Vendor ID */
 #define PAPOUCH_TMU_PID                        0x0400  /* TMU USB Thermometer */
+#define PAPOUCH_QUIDO4x4_PID           0x0900  /* Quido 4/4 Module */
 
 /*
  * ACG Identification Technologies GmbH products (http://www.acg.de/).
 /* Rig Expert Ukraine devices */
 #define FTDI_REU_TINY_PID              0xED22  /* RigExpert Tiny */
 
+/* Domintell products  http://www.domintell.com */
+#define FTDI_DOMINTELL_DGQG_PID        0xEF50  /* Master */
+#define FTDI_DOMINTELL_DUSB_PID        0xEF51  /* DUSB01 module */
+
 /* Commands */
 #define FTDI_SIO_RESET                 0 /* Reset the port */
 #define FTDI_SIO_MODEM_CTRL    1 /* Set the modem control register */
index 9f9cd36455f463423e4cbe22fd752e639415580b..73f8277f88f2d26d57dafa9604f4eae5cb0468a9 100644 (file)
@@ -218,6 +218,7 @@ static int  option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
 /* ZTE PRODUCTS */
 #define ZTE_VENDOR_ID                          0x19d2
 #define ZTE_PRODUCT_MF628                      0x0015
+#define ZTE_PRODUCT_CDMA_TECH                  0xfffe
 
 static struct usb_device_id option_ids[] = {
        { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -347,6 +348,7 @@ static struct usb_device_id option_ids[] = {
        { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */
        { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
        { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
+       { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
        { } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
index 706033753adb7836db59e343310022e2469436e5..ea1a103c99bea9f23d3a4eb7fb4f846ccbed987f 100644 (file)
@@ -14,7 +14,7 @@
   Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org>
 */
 
-#define DRIVER_VERSION "v.1.2.13a"
+#define DRIVER_VERSION "v.1.3.2"
 #define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>"
 #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems"
 
@@ -30,9 +30,6 @@
 
 #define SWIMS_USB_REQUEST_SetPower     0x00
 #define SWIMS_USB_REQUEST_SetNmea      0x07
-#define SWIMS_USB_REQUEST_SetMode      0x0B
-#define SWIMS_USB_REQUEST_GetSwocInfo  0x0A
-#define SWIMS_SET_MODE_Modem           0x0001
 
 /* per port private data */
 #define N_IN_URB       4
@@ -163,7 +160,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
        { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
        { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
-       { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */
+       { USB_DEVICE(0x03f0, 0x1b1d) }, /* HP ev2200 a.k.a MC5720 */
        { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
        { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */
        { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
@@ -175,6 +172,8 @@ static struct usb_device_id id_table [] = {
         /* Sierra Wireless Device */
        { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) },
        { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */
+       { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless Device */
+       { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless Device */
 
        { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
        { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
@@ -187,6 +186,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */
        { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */
        { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */
+       { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */
        { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */
        { USB_DEVICE(0x1199, 0x683C) }, /* Sierra Wireless MC8790 */
        { USB_DEVICE(0x1199, 0x683D) }, /* Sierra Wireless MC8790 */
@@ -204,6 +204,8 @@ static struct usb_device_id id_table [] = {
        /* Sierra Wireless Device */
        { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)},
        /* Sierra Wireless Device */
+       { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)},
+       /* Sierra Wireless Device */
        { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)},
 
        { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
index e39c779e416099ea0a94a28d622851abaf71f13a..9a3e495c769cc92f7abaa59d33d7138fe2e73f73 100644 (file)
@@ -1744,7 +1744,7 @@ static int ti_download_firmware(struct ti_device *tdev, int type)
        if (buffer) {
                memcpy(buffer, fw_p->data, fw_p->size);
                memset(buffer + fw_p->size, 0xff, buffer_size - fw_p->size);
-               ti_do_download(dev, pipe, buffer, fw_p->size);
+               status = ti_do_download(dev, pipe, buffer, fw_p->size);
                kfree(buffer);
        }
        release_firmware(fw_p);
index b157c48e8b78df594bd0386f5ff38a725cf18929..4f7f9e3ae0a43fe0fd630aaf4f436637383b0e4d 100644 (file)
@@ -733,7 +733,9 @@ int usb_serial_probe(struct usb_interface *interface,
            ((le16_to_cpu(dev->descriptor.idVendor) == ATEN_VENDOR_ID) &&
             (le16_to_cpu(dev->descriptor.idProduct) == ATEN_PRODUCT_ID)) ||
            ((le16_to_cpu(dev->descriptor.idVendor) == ALCOR_VENDOR_ID) &&
-            (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID))) {
+            (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID)) ||
+           ((le16_to_cpu(dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) &&
+            (le16_to_cpu(dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_EF81))) {
                if (interface != dev->actconfig->interface[0]) {
                        /* check out the endpoints of the other interface*/
                        iface_desc = dev->actconfig->interface[0]->cur_altsetting;
index c76034672c18c6c87220fc37e5913f45e95be782..3d9249632ae12e7051174817241ef37ea6f2cd4c 100644 (file)
@@ -146,18 +146,6 @@ config USB_STORAGE_KARMA
          on the resulting scsi device node returns the Karma to normal
          operation.
 
-config USB_STORAGE_SIERRA
-       bool "Sierra Wireless TRU-Install Feature Support"
-       depends on USB_STORAGE
-       help
-         Say Y here to include additional code to support Sierra Wireless
-         products with the TRU-Install feature (e.g., AC597E, AC881U).
-
-         This code switches the Sierra Wireless device from being in
-         Mass Storage mode to Modem mode. It also has the ability to
-         support host software upgrades should full Linux support be added
-         to TRU-Install.
-
 config USB_STORAGE_CYPRESS_ATACB
        bool "SAT emulation on Cypress USB/ATA Bridge with ATACB"
        depends on USB_STORAGE
index bc3415b475c9b5675d0aec6d33cf0f117d7862da..7f8beb5366aec91656787736c5c1b3f1fb0d0712 100644 (file)
@@ -21,11 +21,10 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT)      += jumpshot.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA)   += alauda.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA)    += karma.o
-usb-storage-obj-$(CONFIG_USB_STORAGE_SIERRA)   += sierra_ms.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o
 
 usb-storage-objs :=    scsiglue.o protocol.o transport.o usb.o \
-                       initializers.o $(usb-storage-obj-y)
+                       initializers.o sierra_ms.o $(usb-storage-obj-y)
 
 ifneq ($(CONFIG_USB_LIBUSUAL),)
        obj-$(CONFIG_USB)       += libusual.o
index ba412e68d474a70e13bf7b68543eeb5f32c3fad7..cd155475cb6edf9a3af0cf115ffd2aa751fb0972 100644 (file)
@@ -160,6 +160,13 @@ UNUSUAL_DEV(  0x0421, 0x0019, 0x0592, 0x0592,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_MAX_SECTORS_64 ),
 
+/* Reported by Filip Joelsson <filip@blueturtle.nu> */
+UNUSUAL_DEV(  0x0421, 0x005d, 0x0001, 0x0600,
+               "Nokia",
+               "Nokia 3110c",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_FIX_CAPACITY ),
+
 /* Reported by Mario Rettig <mariorettig@web.de> */
 UNUSUAL_DEV(  0x0421, 0x042e, 0x0100, 0x0100,
                "Nokia",
@@ -232,6 +239,20 @@ UNUSUAL_DEV(  0x0421, 0x04b9, 0x0551, 0x0551,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_FIX_CAPACITY ),
 
+/* Reported by Richard Nauber <RichardNauber@web.de> */
+UNUSUAL_DEV(  0x0421, 0x04fa, 0x0601, 0x0601,
+               "Nokia",
+               "6300",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_FIX_CAPACITY ),
+
+/* Patch for Nokia 5310 capacity */
+UNUSUAL_DEV(  0x0421, 0x006a, 0x0000, 0x0591,
+       "Nokia",
+       "5310",
+       US_SC_DEVICE, US_PR_DEVICE, NULL,
+       US_FL_FIX_CAPACITY ),
+
 /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
 UNUSUAL_DEV(  0x0424, 0x0fdc, 0x0210, 0x0210,
                "SMSC",
@@ -987,6 +1008,13 @@ UNUSUAL_DEV(  0x069b, 0x3004, 0x0001, 0x0001,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_FIX_CAPACITY ),
 
+/* Reported by Adrian Pilchowiec <adi1981@epf.pl> */
+UNUSUAL_DEV(  0x071b, 0x3203, 0x0000, 0x0000,
+               "RockChip",
+               "MP3",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_NO_WP_DETECT | US_FL_MAX_SECTORS_64),
+
 /* Reported by Massimiliano Ghilardi <massimiliano.ghilardi@gmail.com>
  * This USB MP3/AVI player device fails and disconnects if more than 128
  * sectors (64kB) are read/written in a single command, and may be present
@@ -1576,7 +1604,6 @@ UNUSUAL_DEV(  0x10d6, 0x2200, 0x0100, 0x0100,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                0),
 
-#ifdef CONFIG_USB_STORAGE_SIERRA
 /* Reported by Kevin Lloyd <linux@sierrawireless.com>
  * Entry is needed for the initializer function override,
  * which instructs the device to load as a modem
@@ -1587,7 +1614,6 @@ UNUSUAL_DEV(  0x1199, 0x0fff, 0x0000, 0x9999,
                "USB MMC Storage",
                US_SC_DEVICE, US_PR_DEVICE, sierra_ms_init,
                0),
-#endif
 
 /* Reported by Jaco Kroon <jaco@kroon.co.za>
  * The usb-storage module found on the Digitech GNX4 (and supposedly other
index 73679aa506debe4a7b26cd33fd24fcbafbb6f1bf..27016fd2cad19003852154d23afc3d3f75573c9e 100644 (file)
 #ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB
 #include "cypress_atacb.h"
 #endif
-#ifdef CONFIG_USB_STORAGE_SIERRA
 #include "sierra_ms.h"
-#endif
 
 /* Some informational data */
 MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
index c6299e8a041de55fb205142792aa5c1d287500c9..9cbff84b787d9e4cf17d8ebd7d2dc1822d628f5f 100644 (file)
@@ -2400,11 +2400,15 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
 
        if (!fbcon_is_inactive(vc, info)) {
                if (ops->blank_state != blank) {
+                       int ret = 1;
+
                        ops->blank_state = blank;
                        fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
                        ops->cursor_flash = (!blank);
 
-                       if (fb_blank(info, blank))
+                       if (info->fbops->fb_blank)
+                               ret = info->fbops->fb_blank(blank, info);
+                       if (ret)
                                fbcon_generic_blank(vc, info, blank);
                }
 
index a6e38e9ea73f59e3b65e7f979c9481f8004c1fc0..89a346880ec014897f051168013d4af7fc5cd091 100644 (file)
@@ -110,7 +110,7 @@ static inline int mono_col(const struct fb_info *info)
        __u32 max_len;
        max_len = max(info->var.green.length, info->var.red.length);
        max_len = max(info->var.blue.length, max_len);
-       return ~(0xfff << (max_len & 0xff));
+       return (~(0xfff << max_len)) & 0xff;
 }
 
 static inline int attr_col_ec(int shift, struct vc_data *vc,
index 614a5c7017b64a68022ab936281aad01c8db832b..6799a6de66fe87d1ec01499278bb9b92f5683385 100644 (file)
@@ -130,8 +130,8 @@ static ssize_t geodewdt_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int geodewdt_ioctl(struct inode *inode, struct file *file,
-                               unsigned int cmd, unsigned long arg)
+static long geodewdt_ioctl(struct file *file, unsigned int cmd,
+                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -198,7 +198,7 @@ static const struct file_operations geodewdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = geodewdt_write,
-       .ioctl          = geodewdt_ioctl,
+       .unlocked_ioctl = geodewdt_ioctl,
        .open           = geodewdt_open,
        .release        = geodewdt_release,
 };
index b82405cfb4cd38534bac8235c8720b7382af5a05..89fcefcc8510da969bfb13a99677e4f73faf7463 100644 (file)
@@ -85,7 +85,6 @@ static void __asr_toggle(void)
 
        outb(reg & ~asr_toggle_mask, asr_write_addr);
        reg = inb(asr_read_addr);
-       spin_unlock(&asr_lock);
 }
 
 static void asr_toggle(void)
index 0ed84162437beb913a66cdf621bde5e0d2bc9a38..6d9f3d4a9987342f5900ba43200b8c447035c6d5 100644 (file)
@@ -173,8 +173,8 @@ static const struct watchdog_info ident = {
        .identity = "PNX4008 Watchdog",
 };
 
-static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file,
-                                       unsigned int cmd, unsigned long arg)
+static long pnx4008_wdt_ioctl(struct file *file, unsigned int cmd,
+                               unsigned long arg)
 {
        int ret = -ENOTTY;
        int time;
index 6756bcb009ed9efecdd30f8d3b40bc3f76cc2892..c9c73b69c5e54d2b6bb079c8dd70c99d3ef38aa8 100644 (file)
@@ -182,8 +182,8 @@ static ssize_t rc32434_wdt_write(struct file *file, const char *data,
        return 0;
 }
 
-static int rc32434_wdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
+                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int new_timeout;
@@ -242,7 +242,7 @@ static struct file_operations rc32434_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = rc32434_wdt_write,
-       .ioctl          = rc32434_wdt_ioctl,
+       .unlocked_ioctl = rc32434_wdt_ioctl,
        .open           = rc32434_wdt_open,
        .release        = rc32434_wdt_release,
 };
index 9108efa73e7da4b1adc0a929b667abe274b9cb50..bf92802f2bbe93ab19b4531610fea7d3978a7abb 100644 (file)
@@ -144,8 +144,8 @@ static int rdc321x_wdt_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static int rdc321x_wdt_ioctl(struct inode *inode, struct file *file,
-                               unsigned int cmd, unsigned long arg)
+static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd,
+                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        unsigned int value;
@@ -204,7 +204,7 @@ static ssize_t rdc321x_wdt_write(struct file *file, const char __user *buf,
 static const struct file_operations rdc321x_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = rdc321x_wdt_ioctl,
+       .unlocked_ioctl = rdc321x_wdt_ioctl,
        .open           = rdc321x_wdt_open,
        .write          = rdc321x_wdt_write,
        .release        = rdc321x_wdt_release,
index db362c34958bdf42e43ad1567eba11049795abbe..191ea6302107f39624a1e185d6e6a72a685722af 100644 (file)
@@ -115,8 +115,8 @@ static int watchdog_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t watchdog_write(struct file *file, const char *data,
-                                               size_t len, loff_t *ppos)
+static ssize_t watchdog_write(struct file *file, const char __user *data,
+                             size_t len, loff_t *ppos)
 {
        /*
         *      Refresh the timer.
@@ -133,21 +133,22 @@ static const struct watchdog_info ident = {
 };
 
 static long watchdog_ioctl(struct file *file, unsigned int cmd,
-                                                       unsigned long arg)
+                          unsigned long arg)
 {
        unsigned int new_margin;
+       int __user *int_arg = (int __user *)arg;
        int ret = -ENOTTY;
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
                ret = 0;
-               if (copy_to_user((void *)arg, &ident, sizeof(ident)))
+               if (copy_to_user((void __user *)arg, &ident, sizeof(ident)))
                        ret = -EFAULT;
                break;
 
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
-               ret = put_user(0, (int *)arg);
+               ret = put_user(0, int_arg);
                break;
 
        case WDIOC_KEEPALIVE:
@@ -156,7 +157,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
                break;
 
        case WDIOC_SETTIMEOUT:
-               ret = get_user(new_margin, (int *)arg);
+               ret = get_user(new_margin, int_arg);
                if (ret)
                        break;
 
@@ -171,7 +172,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
                watchdog_ping();
                /* Fall */
        case WDIOC_GETTIMEOUT:
-               ret = put_user(soft_margin, (int *)arg);
+               ret = put_user(soft_margin, int_arg);
                break;
        }
        return ret;
index c95295c65045a3540959b0ddb9c227e1366472f3..e83aa5ebe861d2a8454985875d4f74a6736291a2 100644 (file)
@@ -626,8 +626,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
        return NULL;
 
 error:
-       if (fid)
-               p9_client_clunk(fid);
+       p9_client_clunk(fid);
 
        return ERR_PTR(result);
 }
index 80e93956aced2e98f2ebe8053d126d104e860ba9..e7a1a99b7464ef442a8af4ed20b0d45a4db25a65 100644 (file)
@@ -1395,6 +1395,10 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
                if (dentry->d_parent != parent)
                        goto next;
 
+               /* non-existing due to RCU? */
+               if (d_unhashed(dentry))
+                       goto next;
+
                /*
                 * It is safe to compare names since d_move() cannot
                 * change the qstr (protected by d_lock).
@@ -1410,10 +1414,8 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
                                goto next;
                }
 
-               if (!d_unhashed(dentry)) {
-                       atomic_inc(&dentry->d_count);
-                       found = dentry;
-               }
+               atomic_inc(&dentry->d_count);
+               found = dentry;
                spin_unlock(&dentry->d_lock);
                break;
 next:
index 32993beecbe91a10670cc4f5a9a72a5faf813c56..cecee501ce78805c32c9d007c658fce1e87b0a97 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -752,11 +752,11 @@ static int exec_mmap(struct mm_struct *mm)
        tsk->active_mm = mm;
        activate_mm(active_mm, mm);
        task_unlock(tsk);
-       mm_update_next_owner(old_mm);
        arch_pick_mmap_layout(mm);
        if (old_mm) {
                up_read(&old_mm->mmap_sem);
                BUG_ON(active_mm != old_mm);
+               mm_update_next_owner(old_mm);
                mmput(old_mm);
                return 0;
        }
index 60249429a2530d11e6d5037e148d9a3c4fd00799..d85c7d931cdfd4cb4cfa5bc839b08b4de22f9bb1 100644 (file)
@@ -323,7 +323,7 @@ out:
 }
 
 /*
- * remove_kevent - cleans up and ultimately frees the given kevent
+ * remove_kevent - cleans up the given kevent
  *
  * Caller must hold dev->ev_mutex.
  */
@@ -334,7 +334,13 @@ static void remove_kevent(struct inotify_device *dev,
 
        dev->event_count--;
        dev->queue_size -= sizeof(struct inotify_event) + kevent->event.len;
+}
 
+/*
+ * free_kevent - frees the given kevent.
+ */
+static void free_kevent(struct inotify_kernel_event *kevent)
+{
        kfree(kevent->name);
        kmem_cache_free(event_cachep, kevent);
 }
@@ -350,6 +356,7 @@ static void inotify_dev_event_dequeue(struct inotify_device *dev)
                struct inotify_kernel_event *kevent;
                kevent = inotify_dev_get_event(dev);
                remove_kevent(dev, kevent);
+               free_kevent(kevent);
        }
 }
 
@@ -433,17 +440,15 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
        dev = file->private_data;
 
        while (1) {
-               int events;
 
                prepare_to_wait(&dev->wq, &wait, TASK_INTERRUPTIBLE);
 
                mutex_lock(&dev->ev_mutex);
-               events = !list_empty(&dev->events);
-               mutex_unlock(&dev->ev_mutex);
-               if (events) {
+               if (!list_empty(&dev->events)) {
                        ret = 0;
                        break;
                }
+               mutex_unlock(&dev->ev_mutex);
 
                if (file->f_flags & O_NONBLOCK) {
                        ret = -EAGAIN;
@@ -462,7 +467,6 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
        if (ret)
                return ret;
 
-       mutex_lock(&dev->ev_mutex);
        while (1) {
                struct inotify_kernel_event *kevent;
 
@@ -481,6 +485,13 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
                        }
                        break;
                }
+               remove_kevent(dev, kevent);
+
+               /*
+                * Must perform the copy_to_user outside the mutex in order
+                * to avoid a lock order reversal with mmap_sem.
+                */
+               mutex_unlock(&dev->ev_mutex);
 
                if (copy_to_user(buf, &kevent->event, event_size)) {
                        ret = -EFAULT;
@@ -498,7 +509,9 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
                        count -= kevent->event.len;
                }
 
-               remove_kevent(dev, kevent);
+               free_kevent(kevent);
+
+               mutex_lock(&dev->ev_mutex);
        }
        mutex_unlock(&dev->ev_mutex);
 
index 52312ec93ff4ae5c0753cdb37af0991f1f733a4c..5145cb9125af8c62a574b0dde476a4f7e8f8f814 100644 (file)
@@ -58,7 +58,7 @@ const struct inode_operations ramfs_file_inode_operations = {
  * size 0 on the assumption that it's going to be used for an mmap of shared
  * memory
  */
-static int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
+int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
 {
        struct pagevec lru_pvec;
        unsigned long npages, xpages, loop, limit;
index 1bbc6f4bb09cb850cec29e64ea34bfabe083bb3b..a1e701c27156f78201532e8f701d1af2266744f0 100644 (file)
@@ -898,6 +898,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
        if (unlikely(!(out->f_mode & FMODE_WRITE)))
                return -EBADF;
 
+       if (unlikely(out->f_flags & O_APPEND))
+               return -EINVAL;
+
        ret = rw_verify_area(WRITE, out, ppos, len);
        if (unlikely(ret < 0))
                return ret;
index b9cb77473758563314980e00c5144a84c9ccfdaf..d7f7645779f2bab707af9c0a38e96288fe65bebf 100644 (file)
@@ -538,7 +538,7 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node)
                printk(KERN_DEBUG "\t%d orphan inode numbers:\n", n);
                for (i = 0; i < n; i++)
                        printk(KERN_DEBUG "\t  ino %llu\n",
-                              le64_to_cpu(orph->inos[i]));
+                              (unsigned long long)le64_to_cpu(orph->inos[i]));
                break;
        }
        default:
index 2b267c9a18065030ff8caff09fc6b2d5cc08b558..526c01ec80032be9205e6057c48f9188b136b6e8 100644 (file)
@@ -426,7 +426,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 
        while (1) {
                dbg_gen("feed '%s', ino %llu, new f_pos %#x",
-                       dent->name, le64_to_cpu(dent->inum),
+                       dent->name, (unsigned long long)le64_to_cpu(dent->inum),
                        key_hash_flash(c, &dent->key));
                ubifs_assert(dent->ch.sqnum > ubifs_inode(dir)->creat_sqnum);
 
index e045c8b55423e9adc7c312efbd8164f7e3584bc5..47814cde24076ba1fdd3775824d0bdeda61f79a3 100644 (file)
@@ -507,7 +507,6 @@ int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *free,
                rsvd_idx_lebs = 0;
        lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt -
               c->lst.taken_empty_lebs;
-       ubifs_assert(lebs + c->lst.idx_lebs >= c->min_idx_lebs);
        if (rsvd_idx_lebs < lebs)
                /*
                 * OK to allocate an empty LEB, but we still don't want to go
index 13f1019c859f254bed9ee9512007b50ee79274da..02aba36fe3d4994ac6dbdba97d0705371cd8bf21 100644 (file)
@@ -334,15 +334,15 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
 
                err = move_nodes(c, sleb);
                if (err)
-                       goto out;
+                       goto out_inc_seq;
 
                err = gc_sync_wbufs(c);
                if (err)
-                       goto out;
+                       goto out_inc_seq;
 
                err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0);
                if (err)
-                       goto out;
+                       goto out_inc_seq;
 
                /* Allow for races with TNC */
                c->gced_lnum = lnum;
@@ -369,6 +369,14 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
 out:
        ubifs_scan_destroy(sleb);
        return err;
+
+out_inc_seq:
+       /* We may have moved at least some nodes so allow for races with TNC */
+       c->gced_lnum = lnum;
+       smp_wmb();
+       c->gc_seq += 1;
+       smp_wmb();
+       goto out;
 }
 
 /**
index 7562464ac83fba3c19101afea8cf9495bf6cd692..3f4902060c7a10aba197a73c07491b7aca4cc84e 100644 (file)
@@ -1024,14 +1024,13 @@ static int mount_ubifs(struct ubifs_info *c)
                goto out_dereg;
        }
 
+       sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);
        if (!mounted_read_only) {
                err = alloc_wbufs(c);
                if (err)
                        goto out_cbuf;
 
                /* Create background thread */
-               sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num,
-                       c->vi.vol_id);
                c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name);
                if (!c->bgt)
                        c->bgt = ERR_PTR(-EINVAL);
index 7da209ab93788f8cafb30d6532b946897d9ae384..7634c5970887960a9555e82757bf11ffe704a5f3 100644 (file)
@@ -1476,7 +1476,7 @@ again:
        }
 
        err = fallible_read_node(c, key, &zbr, node);
-       if (maybe_leb_gced(c, zbr.lnum, gc_seq1)) {
+       if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) {
                /*
                 * The node may have been GC'ed out from under us so try again
                 * while keeping the TNC mutex locked.
index f42f80a3b1faca317f3e08b021c532f19e0512cc..a44d68eb50b5302b8482000e523661b14c0854d8 100644 (file)
@@ -1338,6 +1338,10 @@ __xfs_get_blocks(
        offset = (xfs_off_t)iblock << inode->i_blkbits;
        ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
        size = bh_result->b_size;
+
+       if (!create && direct && offset >= i_size_read(inode))
+               return 0;
+
        error = xfs_iomap(XFS_I(inode), offset, size,
                             create ? flags : BMAPI_READ, &iomap, &niomap);
        if (error)
index 73c65f19e549f34dbf569cea7937b5971c44685e..18d3c848783511da1848ed56800a47b533be5b3d 100644 (file)
@@ -1302,9 +1302,29 @@ xfs_fs_remount(
                        mp->m_flags &= ~XFS_MOUNT_BARRIER;
                        break;
                default:
+                       /*
+                        * Logically we would return an error here to prevent
+                        * users from believing they might have changed
+                        * mount options using remount which can't be changed.
+                        *
+                        * But unfortunately mount(8) adds all options from
+                        * mtab and fstab to the mount arguments in some cases
+                        * so we can't blindly reject options, but have to
+                        * check for each specified option if it actually
+                        * differs from the currently set option and only
+                        * reject it if that's the case.
+                        *
+                        * Until that is implemented we return success for
+                        * every remount request, and silently ignore all
+                        * options that we can't actually change.
+                        */
+#if 0
                        printk(KERN_INFO
        "XFS: mount option \"%s\" not supported for remount\n", p);
                        return -EINVAL;
+#else
+                       return 0;
+#endif
                }
        }
 
index 608c30c3f76b872b8e553d325364407eff489593..002fc2617c8ee9426bff6203eb5bc6039094bf0a 100644 (file)
@@ -732,6 +732,7 @@ xfs_buf_item_init(
        bip->bli_item.li_ops = &xfs_buf_item_ops;
        bip->bli_item.li_mountp = mp;
        bip->bli_buf = bp;
+       xfs_buf_hold(bp);
        bip->bli_format.blf_type = XFS_LI_BUF;
        bip->bli_format.blf_blkno = (__int64_t)XFS_BUF_ADDR(bp);
        bip->bli_format.blf_len = (ushort)BTOBB(XFS_BUF_COUNT(bp));
@@ -867,6 +868,21 @@ xfs_buf_item_dirty(
        return (bip->bli_flags & XFS_BLI_DIRTY);
 }
 
+STATIC void
+xfs_buf_item_free(
+       xfs_buf_log_item_t      *bip)
+{
+#ifdef XFS_TRANS_DEBUG
+       kmem_free(bip->bli_orig);
+       kmem_free(bip->bli_logged);
+#endif /* XFS_TRANS_DEBUG */
+
+#ifdef XFS_BLI_TRACE
+       ktrace_free(bip->bli_trace);
+#endif
+       kmem_zone_free(xfs_buf_item_zone, bip);
+}
+
 /*
  * This is called when the buf log item is no longer needed.  It should
  * free the buf log item associated with the given buffer and clear
@@ -887,18 +903,8 @@ xfs_buf_item_relse(
            (XFS_BUF_IODONE_FUNC(bp) != NULL)) {
                XFS_BUF_CLR_IODONE_FUNC(bp);
        }
-
-#ifdef XFS_TRANS_DEBUG
-       kmem_free(bip->bli_orig);
-       bip->bli_orig = NULL;
-       kmem_free(bip->bli_logged);
-       bip->bli_logged = NULL;
-#endif /* XFS_TRANS_DEBUG */
-
-#ifdef XFS_BLI_TRACE
-       ktrace_free(bip->bli_trace);
-#endif
-       kmem_zone_free(xfs_buf_item_zone, bip);
+       xfs_buf_rele(bp);
+       xfs_buf_item_free(bip);
 }
 
 
@@ -1120,6 +1126,7 @@ xfs_buf_iodone(
 
        ASSERT(bip->bli_buf == bp);
 
+       xfs_buf_rele(bp);
        mp = bip->bli_item.li_mountp;
 
        /*
@@ -1136,18 +1143,7 @@ xfs_buf_iodone(
         * xfs_trans_delete_ail() drops the AIL lock.
         */
        xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
-
-#ifdef XFS_TRANS_DEBUG
-       kmem_free(bip->bli_orig);
-       bip->bli_orig = NULL;
-       kmem_free(bip->bli_logged);
-       bip->bli_logged = NULL;
-#endif /* XFS_TRANS_DEBUG */
-
-#ifdef XFS_BLI_TRACE
-       ktrace_free(bip->bli_trace);
-#endif
-       kmem_zone_free(xfs_buf_item_zone, bip);
+       xfs_buf_item_free(bip);
 }
 
 #if defined(XFS_BLI_TRACE)
index 760f4c5b5160c4e648e17d491d8912c691726214..75b0cd4da0ea30140bbdd3068c02ba94c751bd13 100644 (file)
@@ -149,7 +149,14 @@ xfs_swap_extents(
 
        sbp = &sxp->sx_stat;
 
-       xfs_lock_two_inodes(ip, tip, lock_flags);
+       /*
+        * we have to do two separate lock calls here to keep lockdep
+        * happy. If we try to get all the locks in one call, lock will
+        * report false positives when we drop the ILOCK and regain them
+        * below.
+        */
+       xfs_lock_two_inodes(ip, tip, XFS_IOLOCK_EXCL);
+       xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
        locked = 1;
 
        /* Verify that both files have the same format */
index 00e80df9dd9d727191f15fefc79cd92055d4e9d6..dbd9cef852ece3d6d8b3b5b930626000c88bed06 100644 (file)
@@ -4118,7 +4118,7 @@ xfs_iext_indirect_to_direct(
        ASSERT(nextents <= XFS_LINEAR_EXTS);
        size = nextents * sizeof(xfs_bmbt_rec_t);
 
-       xfs_iext_irec_compact_full(ifp);
+       xfs_iext_irec_compact_pages(ifp);
        ASSERT(ifp->if_real_bytes == XFS_IEXT_BUFSZ);
 
        ep = ifp->if_u1.if_ext_irec->er_extbuf;
@@ -4449,8 +4449,7 @@ xfs_iext_irec_remove(
  * compaction policy is as follows:
  *
  *    Full Compaction: Extents fit into a single page (or inline buffer)
- *    Full Compaction: Extents occupy less than 10% of allocated space
- * Partial Compaction: Extents occupy > 10% and < 50% of allocated space
+ * Partial Compaction: Extents occupy less than 50% of allocated space
  *      No Compaction: Extents occupy at least 50% of allocated space
  */
 void
@@ -4471,8 +4470,6 @@ xfs_iext_irec_compact(
                xfs_iext_direct_to_inline(ifp, nextents);
        } else if (nextents <= XFS_LINEAR_EXTS) {
                xfs_iext_indirect_to_direct(ifp);
-       } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 3) {
-               xfs_iext_irec_compact_full(ifp);
        } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 1) {
                xfs_iext_irec_compact_pages(ifp);
        }
@@ -4496,7 +4493,7 @@ xfs_iext_irec_compact_pages(
                erp_next = erp + 1;
                if (erp_next->er_extcount <=
                    (XFS_LINEAR_EXTS - erp->er_extcount)) {
-                       memmove(&erp->er_extbuf[erp->er_extcount],
+                       memcpy(&erp->er_extbuf[erp->er_extcount],
                                erp_next->er_extbuf, erp_next->er_extcount *
                                sizeof(xfs_bmbt_rec_t));
                        erp->er_extcount += erp_next->er_extcount;
@@ -4515,91 +4512,6 @@ xfs_iext_irec_compact_pages(
        }
 }
 
-/*
- * Fully compact the extent records managed by the indirection array.
- */
-void
-xfs_iext_irec_compact_full(
-       xfs_ifork_t     *ifp)                   /* inode fork pointer */
-{
-       xfs_bmbt_rec_host_t *ep, *ep_next;      /* extent record pointers */
-       xfs_ext_irec_t  *erp, *erp_next;        /* extent irec pointers */
-       int             erp_idx = 0;            /* extent irec index */
-       int             ext_avail;              /* empty entries in ex list */
-       int             ext_diff;               /* number of exts to add */
-       int             nlists;                 /* number of irec's (ex lists) */
-
-       ASSERT(ifp->if_flags & XFS_IFEXTIREC);
-
-       nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
-       erp = ifp->if_u1.if_ext_irec;
-       ep = &erp->er_extbuf[erp->er_extcount];
-       erp_next = erp + 1;
-       ep_next = erp_next->er_extbuf;
-
-       while (erp_idx < nlists - 1) {
-               /*
-                * Check how many extent records are available in this irec.
-                * If there is none skip the whole exercise.
-                */
-               ext_avail = XFS_LINEAR_EXTS - erp->er_extcount;
-               if (ext_avail) {
-
-                       /*
-                        * Copy over as many as possible extent records into
-                        * the previous page.
-                        */
-                       ext_diff = MIN(ext_avail, erp_next->er_extcount);
-                       memcpy(ep, ep_next, ext_diff * sizeof(xfs_bmbt_rec_t));
-                       erp->er_extcount += ext_diff;
-                       erp_next->er_extcount -= ext_diff;
-
-                       /*
-                        * If the next irec is empty now we can simply
-                        * remove it.
-                        */
-                       if (erp_next->er_extcount == 0) {
-                               /*
-                                * Free page before removing extent record
-                                * so er_extoffs don't get modified in
-                                * xfs_iext_irec_remove.
-                                */
-                               kmem_free(erp_next->er_extbuf);
-                               erp_next->er_extbuf = NULL;
-                               xfs_iext_irec_remove(ifp, erp_idx + 1);
-                               erp = &ifp->if_u1.if_ext_irec[erp_idx];
-                               nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
-
-                       /*
-                        * If the next irec is not empty move up the content
-                        * that has not been copied to the previous page to
-                        * the beggining of this one.
-                        */
-                       } else {
-                               memmove(erp_next->er_extbuf, &ep_next[ext_diff],
-                                       erp_next->er_extcount *
-                                       sizeof(xfs_bmbt_rec_t));
-                               ep_next = erp_next->er_extbuf;
-                               memset(&ep_next[erp_next->er_extcount], 0,
-                                       (XFS_LINEAR_EXTS -
-                                               erp_next->er_extcount) *
-                                       sizeof(xfs_bmbt_rec_t));
-                       }
-               }
-
-               if (erp->er_extcount == XFS_LINEAR_EXTS) {
-                       erp_idx++;
-                       if (erp_idx < nlists)
-                               erp = &ifp->if_u1.if_ext_irec[erp_idx];
-                       else
-                               break;
-               }
-               ep = &erp->er_extbuf[erp->er_extcount];
-               erp_next = erp + 1;
-               ep_next = erp_next->er_extbuf;
-       }
-}
-
 /*
  * This is called to update the er_extoff field in the indirection
  * array when extents have been added or removed from one of the
index ccba14eb9dbe373699417a2984eb559854bf5dbb..503ea89e8b9a24ac1b3da0901191ad82673f50f5 100644 (file)
@@ -124,16 +124,27 @@ STATIC void       xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
 STATIC int     xlog_iclogs_empty(xlog_t *log);
 
 #if defined(XFS_LOG_TRACE)
+
+#define XLOG_TRACE_LOGGRANT_SIZE       2048
+#define XLOG_TRACE_ICLOG_SIZE          256
+
+void
+xlog_trace_loggrant_alloc(xlog_t *log)
+{
+       log->l_grant_trace = ktrace_alloc(XLOG_TRACE_LOGGRANT_SIZE, KM_NOFS);
+}
+
+void
+xlog_trace_loggrant_dealloc(xlog_t *log)
+{
+       ktrace_free(log->l_grant_trace);
+}
+
 void
 xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string)
 {
        unsigned long cnts;
 
-       if (!log->l_grant_trace) {
-               log->l_grant_trace = ktrace_alloc(2048, KM_NOSLEEP);
-               if (!log->l_grant_trace)
-                       return;
-       }
        /* ticket counts are 1 byte each */
        cnts = ((unsigned long)tic->t_ocnt) | ((unsigned long)tic->t_cnt) << 8;
 
@@ -156,11 +167,21 @@ xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string)
                     (void *)((unsigned long)tic->t_unit_res));
 }
 
+void
+xlog_trace_iclog_alloc(xlog_in_core_t *iclog)
+{
+       iclog->ic_trace = ktrace_alloc(XLOG_TRACE_ICLOG_SIZE, KM_NOFS);
+}
+
+void
+xlog_trace_iclog_dealloc(xlog_in_core_t *iclog)
+{
+       ktrace_free(iclog->ic_trace);
+}
+
 void
 xlog_trace_iclog(xlog_in_core_t *iclog, uint state)
 {
-       if (!iclog->ic_trace)
-               iclog->ic_trace = ktrace_alloc(256, KM_NOFS);
        ktrace_enter(iclog->ic_trace,
                     (void *)((unsigned long)state),
                     (void *)((unsigned long)current_pid()),
@@ -170,8 +191,15 @@ xlog_trace_iclog(xlog_in_core_t *iclog, uint state)
                     (void *)NULL, (void *)NULL);
 }
 #else
+
+#define        xlog_trace_loggrant_alloc(log)
+#define        xlog_trace_loggrant_dealloc(log)
 #define        xlog_trace_loggrant(log,tic,string)
+
+#define        xlog_trace_iclog_alloc(iclog)
+#define        xlog_trace_iclog_dealloc(iclog)
 #define        xlog_trace_iclog(iclog,state)
+
 #endif /* XFS_LOG_TRACE */
 
 
@@ -1009,7 +1037,7 @@ xlog_iodone(xfs_buf_t *bp)
         * layer, it means the underlyin device no longer supports
         * barrier I/O. Warn loudly and turn off barriers.
         */
-       if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ORDERED(bp)) {
+       if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ISORDERED(bp)) {
                l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER;
                xfs_fs_cmn_err(CE_WARN, l->l_mp,
                                "xlog_iodone: Barriers are no longer supported"
@@ -1231,6 +1259,7 @@ xlog_alloc_log(xfs_mount_t        *mp,
        spin_lock_init(&log->l_grant_lock);
        sv_init(&log->l_flush_wait, 0, "flush_wait");
 
+       xlog_trace_loggrant_alloc(log);
        /* log record size must be multiple of BBSIZE; see xlog_rec_header_t */
        ASSERT((XFS_BUF_SIZE(bp) & BBMASK) == 0);
 
@@ -1285,6 +1314,8 @@ xlog_alloc_log(xfs_mount_t        *mp,
                sv_init(&iclog->ic_force_wait, SV_DEFAULT, "iclog-force");
                sv_init(&iclog->ic_write_wait, SV_DEFAULT, "iclog-write");
 
+               xlog_trace_iclog_alloc(iclog);
+
                iclogp = &iclog->ic_next;
        }
        *iclogp = log->l_iclog;                 /* complete ring */
@@ -1565,11 +1596,7 @@ xlog_dealloc_log(xlog_t *log)
                sv_destroy(&iclog->ic_force_wait);
                sv_destroy(&iclog->ic_write_wait);
                xfs_buf_free(iclog->ic_bp);
-#ifdef XFS_LOG_TRACE
-               if (iclog->ic_trace != NULL) {
-                       ktrace_free(iclog->ic_trace);
-               }
-#endif
+               xlog_trace_iclog_dealloc(iclog);
                next_iclog = iclog->ic_next;
                kmem_free(iclog);
                iclog = next_iclog;
@@ -1578,14 +1605,7 @@ xlog_dealloc_log(xlog_t *log)
        spinlock_destroy(&log->l_grant_lock);
 
        xfs_buf_free(log->l_xbuf);
-#ifdef XFS_LOG_TRACE
-       if (log->l_trace != NULL) {
-               ktrace_free(log->l_trace);
-       }
-       if (log->l_grant_trace != NULL) {
-               ktrace_free(log->l_grant_trace);
-       }
-#endif
+       xlog_trace_loggrant_dealloc(log);
        log->l_mp->m_log = NULL;
        kmem_free(log);
 }      /* xlog_dealloc_log */
index c8a5b22ee3e3b02fa1cd13e639bf2fe9b3f525a7..e7d8f84443fab87ceee83561fb6b1f04685400ff 100644 (file)
@@ -448,7 +448,6 @@ typedef struct log {
        int                     l_grant_write_bytes;
 
 #ifdef XFS_LOG_TRACE
-       struct ktrace           *l_trace;
        struct ktrace           *l_grant_trace;
 #endif
 
index aa238c8fbd7ae605e9f316969bb3012ee4c32f3c..8b6812f66a15bf2895aba5fed5f04be0c22625d8 100644 (file)
@@ -1838,6 +1838,12 @@ again:
 #endif
 }
 
+/*
+ * xfs_lock_two_inodes() can only be used to lock one type of lock
+ * at a time - the iolock or the ilock, but not both at once. If
+ * we lock both at once, lockdep will report false positives saying
+ * we have violated locking orders.
+ */
 void
 xfs_lock_two_inodes(
        xfs_inode_t             *ip0,
@@ -1848,6 +1854,8 @@ xfs_lock_two_inodes(
        int                     attempts = 0;
        xfs_log_item_t          *lp;
 
+       if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL))
+               ASSERT((lock_mode & (XFS_ILOCK_SHARED|XFS_ILOCK_EXCL)) == 0);
        ASSERT(ip0->i_ino != ip1->i_ino);
 
        if (ip0->i_ino > ip1->i_ino) {
@@ -3152,6 +3160,13 @@ error1:  /* Just cancel transaction */
 /*
  * Zero file bytes between startoff and endoff inclusive.
  * The iolock is held exclusive and no blocks are buffered.
+ *
+ * This function is used by xfs_free_file_space() to zero
+ * partial blocks when the range to free is not block aligned.
+ * When unreserving space with boundaries that are not block
+ * aligned we round up the start and round down the end
+ * boundaries and then use this function to zero the parts of
+ * the blocks that got dropped during the rounding.
  */
 STATIC int
 xfs_zero_remaining_bytes(
@@ -3168,6 +3183,17 @@ xfs_zero_remaining_bytes(
        int                     nimap;
        int                     error = 0;
 
+       /*
+        * Avoid doing I/O beyond eof - it's not necessary
+        * since nothing can read beyond eof.  The space will
+        * be zeroed when the file is extended anyway.
+        */
+       if (startoff >= ip->i_size)
+               return 0;
+
+       if (endoff > ip->i_size)
+               endoff = ip->i_size;
+
        bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize,
                                XFS_IS_REALTIME_INODE(ip) ?
                                mp->m_rtdev_targp : mp->m_ddev_targp);
index a3f738cffdb61a0057ffb8a1cd9a012e30b72f24..edc6ba82e090961a841cd37b54cb6abc0311b4d7 100644 (file)
@@ -97,6 +97,16 @@ extern void warn_slowpath(const char *file, const int line,
        unlikely(__ret_warn_once);                              \
 })
 
+#define WARN_ONCE(condition, format...)        ({                      \
+       static int __warned;                                    \
+       int __ret_warn_once = !!(condition);                    \
+                                                               \
+       if (unlikely(__ret_warn_once))                          \
+               if (WARN(!__warned, format))                    \
+                       __warned = 1;                           \
+       unlikely(__ret_warn_once);                              \
+})
+
 #define WARN_ON_RATELIMIT(condition, state)                    \
                WARN_ON((condition) && __ratelimit(state))
 
diff --git a/include/asm-mips/cevt-r4k.h b/include/asm-mips/cevt-r4k.h
new file mode 100644 (file)
index 0000000..fa4328f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Kevin D. Kissell
+ */
+
+/*
+ * Definitions used for common event timer implementation
+ * for MIPS 4K-type processors and their MIPS MT variants.
+ * Avoids unsightly extern declarations in C files.
+ */
+#ifndef __ASM_CEVT_R4K_H
+#define __ASM_CEVT_R4K_H
+
+DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
+
+void mips_event_handler(struct clock_event_device *dev);
+int c0_compare_int_usable(void);
+void mips_set_clock_mode(enum clock_event_mode, struct clock_event_device *);
+irqreturn_t c0_compare_interrupt(int, void *);
+
+extern struct irqaction c0_compare_irqaction;
+extern int cp0_timer_irq_installed;
+
+/*
+ * Possibly handle a performance counter interrupt.
+ * Return true if the timer interrupt should not be checked
+ */
+
+static inline int handle_perf_irq(int r2)
+{
+       /*
+        * The performance counter overflow interrupt may be shared with the
+        * timer interrupt (cp0_perfcount_irq < 0). If it is and a
+        * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
+        * and we can't reliably determine if a counter interrupt has also
+        * happened (!r2) then don't check for a timer interrupt.
+        */
+       return (cp0_perfcount_irq < 0) &&
+               perf_irq() == IRQ_HANDLED &&
+               !r2;
+}
+
+#endif /* __ASM_CEVT_R4K_H */
index 881e8866501d5f2af6b09355227edc620c3ba5b4..701ec0ba8fa9cdd596369b9de3825b284bae1ec9 100644 (file)
@@ -38,8 +38,17 @@ __asm__(
        "       .set    pop                                             \n"
        "       .endm");
 
+extern void smtc_ipi_replay(void);
+
 static inline void raw_local_irq_enable(void)
 {
+#ifdef CONFIG_MIPS_MT_SMTC
+       /*
+        * SMTC kernel needs to do a software replay of queued
+        * IPIs, at the cost of call overhead on each local_irq_enable()
+        */
+       smtc_ipi_replay();
+#endif
        __asm__ __volatile__(
                "raw_local_irq_enable"
                : /* no outputs */
@@ -47,6 +56,7 @@ static inline void raw_local_irq_enable(void)
                : "memory");
 }
 
+
 /*
  * For cli() we have to insert nops to make sure that the new value
  * has actually arrived in the status register before the end of this
@@ -185,15 +195,14 @@ __asm__(
        "       .set    pop                                             \n"
        "       .endm                                                   \n");
 
-extern void smtc_ipi_replay(void);
 
 static inline void raw_local_irq_restore(unsigned long flags)
 {
        unsigned long __tmp1;
 
-#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
+#ifdef CONFIG_MIPS_MT_SMTC
        /*
-        * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred
+        * SMTC kernel needs to do a software replay of queued
         * IPIs, at the cost of branch and call overhead on each
         * local_irq_restore()
         */
@@ -208,6 +217,17 @@ static inline void raw_local_irq_restore(unsigned long flags)
                : "memory");
 }
 
+static inline void __raw_local_irq_restore(unsigned long flags)
+{
+       unsigned long __tmp1;
+
+       __asm__ __volatile__(
+               "raw_local_irq_restore\t%0"
+               : "=r" (__tmp1)
+               : "0" (flags)
+               : "memory");
+}
+
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
 #ifdef CONFIG_MIPS_MT_SMTC
index a46f8e258e6bdfbeb9921998f4d8c4022844b81a..979866000da43d6fe7f0c72a1862db93a3ff0c19 100644 (file)
@@ -1462,7 +1462,7 @@ set_c0_##name(unsigned int set)                                   \
 {                                                              \
        unsigned int res;                                       \
        unsigned int omt;                                       \
-       unsigned int flags;                                     \
+       unsigned long flags;                                    \
                                                                \
        local_irq_save(flags);                                  \
        omt = __dmt();                                          \
@@ -1480,7 +1480,7 @@ clear_c0_##name(unsigned int clear)                               \
 {                                                              \
        unsigned int res;                                       \
        unsigned int omt;                                       \
-       unsigned int flags;                                     \
+       unsigned long flags;                                    \
                                                                \
        local_irq_save(flags);                                  \
        omt = __dmt();                                          \
@@ -1498,7 +1498,7 @@ change_c0_##name(unsigned int change, unsigned int new)           \
 {                                                              \
        unsigned int res;                                       \
        unsigned int omt;                                       \
-       unsigned int flags;                                     \
+       unsigned long flags;                                    \
                                                                \
        local_irq_save(flags);                                  \
                                                                \
index 4396e9ffd418960ed8aa15e17bc32e60587efd57..55813d6150c7ecc47ab0aa63e78e53e278e7f40b 100644 (file)
@@ -57,7 +57,7 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
 #define PMD_ORDER      1
 #define PTE_ORDER      0
 
-#define PTRS_PER_PGD   ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
+#define PTRS_PER_PGD   (USER_PTRS_PER_PGD * 2)
 #define PTRS_PER_PTE   ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
 
 #define USER_PTRS_PER_PGD      (0x80000000UL/PGDIR_SIZE)
index 3639b28f80db84acbdea9672eb705fa8976aca7d..ea60bf08dcb0b9792e4433a7dd92117a3b1afd98 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <asm/mips_mt.h>
+#include <asm/smtc_ipi.h>
 
 /*
  * System-wide SMTC status information
@@ -38,14 +39,15 @@ struct mm_struct;
 struct task_struct;
 
 void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu);
-
+void self_ipi(struct smtc_ipi *);
 void smtc_flush_tlb_asid(unsigned long asid);
-extern int mipsmt_build_cpu_map(int startslot);
-extern void mipsmt_prepare_cpus(void);
+extern int smtc_build_cpu_map(int startslot);
+extern void smtc_prepare_cpus(int cpus);
 extern void smtc_smp_finish(void);
 extern void smtc_boot_secondary(int cpu, struct task_struct *t);
 extern void smtc_cpus_done(void);
 
+
 /*
  * Sharing the TLB between multiple VPEs means that the
  * "random" index selection function is not allowed to
index c3dd5d0d525fc66be6c92dc70c86b2ad5b547577..721496a0bb92979161c8ed3cc2946f7c069d256d 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef __ASM_SN_MAPPED_KERNEL_H
 #define __ASM_SN_MAPPED_KERNEL_H
 
+#include <linux/mmzone.h>
+
 /*
  * Note on how mapped kernels work: the text and data section is
  * compiled at cksseg segment (LOADADDR = 0xc001c000), and the
 #define MAPPED_ADDR_RO_TO_PHYS(x)      (x - REP_BASE)
 #define MAPPED_ADDR_RW_TO_PHYS(x)      (x - REP_BASE - 16777216)
 
-#define MAPPED_KERN_RO_PHYSBASE(n) \
-                       (PLAT_NODE_DATA(n)->kern_vars.kv_ro_baseaddr)
-#define MAPPED_KERN_RW_PHYSBASE(n) \
-                       (PLAT_NODE_DATA(n)->kern_vars.kv_rw_baseaddr)
+#define MAPPED_KERN_RO_PHYSBASE(n) (hub_data(n)->kern_vars.kv_ro_baseaddr)
+#define MAPPED_KERN_RW_PHYSBASE(n) (hub_data(n)->kern_vars.kv_rw_baseaddr)
 
 #define MAPPED_KERN_RO_TO_PHYS(x) \
                                ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \
index 051e1af0bb95d08cfcec7295bb30f7234f95a817..4c37c4e5f72e4e51b578148f2e8943554da1b41a 100644 (file)
 #ifdef CONFIG_MIPS_MT_SMTC
                .set    mips32r2
                /*
-                * This may not really be necessary if ints are already
-                * inhibited here.
+                * We need to make sure the read-modify-write
+                * of Status below isn't perturbed by an interrupt
+                * or cross-TC access, so we need to do at least a DMT,
+                * protected by an interrupt-inhibit. But setting IXMT
+                * also creates a few-cycle window where an IPI could
+                * be queued and not be detected before potentially
+                * returning to a WAIT or user-mode loop. It must be
+                * replayed.
+                *
+                * We're in the middle of a context switch, and
+                * we can't dispatch it directly without trashing
+                * some registers, so we'll try to detect this unlikely
+                * case and program a software interrupt in the VPE,
+                * as would be done for a cross-VPE IPI.  To accomodate
+                * the handling of that case, we're doing a DVPE instead
+                * of just a DMT here to protect against other threads.
+                * This is a lot of cruft to cover a tiny window.
+                * If you can find a better design, implement it!
+                *
                 */
                mfc0    v0, CP0_TCSTATUS
                ori     v0, TCSTATUS_IXMT
                mtc0    v0, CP0_TCSTATUS
                _ehb
-               DMT     5                               # dmt a1
+               DVPE    5                               # dvpe a1
                jal     mips_ihb
 #endif /* CONFIG_MIPS_MT_SMTC */
                mfc0    a0, CP0_STATUS
  */
                LONG_L  v1, PT_TCSTATUS(sp)
                _ehb
-               mfc0    v0, CP0_TCSTATUS
+               mfc0    a0, CP0_TCSTATUS
                andi    v1, TCSTATUS_IXMT
-               /* We know that TCStatua.IXMT should be set from above */
-               xori    v0, v0, TCSTATUS_IXMT
-               or      v0, v0, v1
-               mtc0    v0, CP0_TCSTATUS
-               _ehb
-               andi    a1, a1, VPECONTROL_TE
+               bnez    v1, 0f
+
+/*
+ * We'd like to detect any IPIs queued in the tiny window
+ * above and request an software interrupt to service them
+ * when we ERET.
+ *
+ * Computing the offset into the IPIQ array of the executing
+ * TC's IPI queue in-line would be tedious.  We use part of
+ * the TCContext register to hold 16 bits of offset that we
+ * can add in-line to find the queue head.
+ */
+               mfc0    v0, CP0_TCCONTEXT
+               la      a2, IPIQ
+               srl     v0, v0, 16
+               addu    a2, a2, v0
+               LONG_L  v0, 0(a2)
+               beqz    v0, 0f
+/*
+ * If we have a queue, provoke dispatch within the VPE by setting C_SW1
+ */
+               mfc0    v0, CP0_CAUSE
+               ori     v0, v0, C_SW1
+               mtc0    v0, CP0_CAUSE
+0:
+               /*
+                * This test should really never branch but
+                * let's be prudent here.  Having atomized
+                * the shared register modifications, we can
+                * now EVPE, and must do so before interrupts
+                * are potentially re-enabled.
+                */
+               andi    a1, a1, MVPCONTROL_EVP
                beqz    a1, 1f
-               emt
+               evpe
 1:
+               /* We know that TCStatua.IXMT should be set from above */
+               xori    a0, a0, TCSTATUS_IXMT
+               or      a0, a0, v1
+               mtc0    a0, CP0_TCSTATUS
+               _ehb
+
                .set    mips0
 #endif /* CONFIG_MIPS_MT_SMTC */
                LONG_L  v1, PT_EPC(sp)
index 714207a1c38795fa40168373ee3858e74bffa607..f5705761a37b14509c5603e79c69292fdb4adb66 100644 (file)
@@ -9,8 +9,8 @@
  * 2 of the Licence, or (at your option) any later version.
  */
 
-#ifndef _ASM_A_OUT_CORE_H
-#define _ASM_A_OUT_CORE_H
+#ifndef ASM_X86__A_OUT_CORE_H
+#define ASM_X86__A_OUT_CORE_H
 
 #ifdef __KERNEL__
 #ifdef CONFIG_X86_32
@@ -70,4 +70,4 @@ static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
 
 #endif /* CONFIG_X86_32 */
 #endif /* __KERNEL__ */
-#endif /* _ASM_A_OUT_CORE_H */
+#endif /* ASM_X86__A_OUT_CORE_H */
index 4684f97a5bbd1b1edce881a88e75393b580a2cd1..0948748bc69c1dd8f694c34878551868e01a3da7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_A_OUT_H
-#define _ASM_X86_A_OUT_H
+#ifndef ASM_X86__A_OUT_H
+#define ASM_X86__A_OUT_H
 
 struct exec
 {
@@ -17,4 +17,4 @@ struct exec
 #define N_DRSIZE(a)    ((a).a_drsize)
 #define N_SYMSIZE(a)   ((a).a_syms)
 
-#endif /* _ASM_X86_A_OUT_H */
+#endif /* ASM_X86__A_OUT_H */
index 635d764dc13e346e26dc6f27b8a45d5701a9c55b..392e17336be1dede3964b6e61ca4cdf568b258fd 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_ACPI_H
-#define _ASM_X86_ACPI_H
+#ifndef ASM_X86__ACPI_H
+#define ASM_X86__ACPI_H
 
 /*
  *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
@@ -140,6 +140,8 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
            boot_cpu_data.x86_model <= 0x05 &&
            boot_cpu_data.x86_mask < 0x0A)
                return 1;
+       else if (boot_cpu_has(X86_FEATURE_AMDC1E))
+               return 1;
        else
                return max_cstate;
 }
@@ -173,4 +175,4 @@ static inline void acpi_fake_nodes(const struct bootnode *fake_nodes,
 
 #define acpi_unlazy_tlb(x)     leave_mm(x)
 
-#endif /*__X86_ASM_ACPI_H*/
+#endif /* ASM_X86__ACPI_H */
index e4004a9f6a9a53fa03c7b5ce6db80809180dc703..3617fd4fcdf9faa1f110055cd33f607e98662c76 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_AGP_H
-#define _ASM_X86_AGP_H
+#ifndef ASM_X86__AGP_H
+#define ASM_X86__AGP_H
 
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
@@ -32,4 +32,4 @@
 #define free_gatt_pages(table, order)  \
        free_pages((unsigned long)(table), (order))
 
-#endif
+#endif /* ASM_X86__AGP_H */
index f6aa18eadf71717d9e86c53ac3719776fa035969..22d3c9862bf3b3a0967df0c9c2f2b7038d6e1ba3 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_ALTERNATIVE_H
-#define _ASM_X86_ALTERNATIVE_H
+#ifndef ASM_X86__ALTERNATIVE_H
+#define ASM_X86__ALTERNATIVE_H
 
 #include <linux/types.h>
 #include <linux/stddef.h>
@@ -180,4 +180,4 @@ extern void add_nops(void *insns, unsigned int len);
 extern void *text_poke(void *addr, const void *opcode, size_t len);
 extern void *text_poke_early(void *addr, const void *opcode, size_t len);
 
-#endif /* _ASM_X86_ALTERNATIVE_H */
+#endif /* ASM_X86__ALTERNATIVE_H */
index 2fd97cb250c7540f1606bef3cddbc2607fe176cd..041d0db7da272d42abe5d5659f38da6fe2b0e590 100644 (file)
@@ -17,8 +17,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#ifndef _ASM_X86_AMD_IOMMU_H
-#define _ASM_X86_AMD_IOMMU_H
+#ifndef ASM_X86__AMD_IOMMU_H
+#define ASM_X86__AMD_IOMMU_H
 
 #include <linux/irqreturn.h>
 
@@ -32,4 +32,4 @@ static inline int amd_iommu_init(void) { return -ENODEV; }
 static inline void amd_iommu_detect(void) { }
 #endif
 
-#endif
+#endif /* ASM_X86__AMD_IOMMU_H */
index 4ff892f3b0ad613b721118ed3c0c8f3d4d176d2d..b3085869a17b04aaa686e7360c2c424d0d875969 100644 (file)
@@ -17,8 +17,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#ifndef __AMD_IOMMU_TYPES_H__
-#define __AMD_IOMMU_TYPES_H__
+#ifndef ASM_X86__AMD_IOMMU_TYPES_H
+#define ASM_X86__AMD_IOMMU_TYPES_H
 
 #include <linux/types.h>
 #include <linux/list.h>
@@ -401,4 +401,4 @@ static inline u16 calc_devid(u8 bus, u8 devfn)
        return (((u16)bus) << 8) | devfn;
 }
 
-#endif
+#endif /* ASM_X86__AMD_IOMMU_TYPES_H */
index 133c998161ca4930dae0efe954802a45af2d62d4..65590c9aecd4cfc906f8e643dfc47cb56356ca90 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_APIC_H
-#define _ASM_X86_APIC_H
+#ifndef ASM_X86__APIC_H
+#define ASM_X86__APIC_H
 
 #include <linux/pm.h>
 #include <linux/delay.h>
@@ -54,6 +54,11 @@ extern int disable_apic;
 #endif
 
 extern int is_vsmp_box(void);
+extern void xapic_wait_icr_idle(void);
+extern u32 safe_xapic_wait_icr_idle(void);
+extern u64 xapic_icr_read(void);
+extern void xapic_icr_write(u32, u32);
+extern int setup_profiling_timer(unsigned int);
 
 static inline void native_apic_write(unsigned long reg, u32 v)
 {
@@ -76,9 +81,7 @@ extern int get_physical_broadcast(void);
 static inline void ack_APIC_irq(void)
 {
        /*
-        * ack_APIC_irq() actually gets compiled as a single instruction:
-        * - a single rmw on Pentium/82489DX
-        * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
+        * ack_APIC_irq() actually gets compiled as a single instruction
         * ... yummie.
         */
 
@@ -128,4 +131,4 @@ static inline void init_apic_mappings(void) { }
 
 #endif /* !CONFIG_X86_LOCAL_APIC */
 
-#endif /* __ASM_APIC_H */
+#endif /* ASM_X86__APIC_H */
index 6b9008c787319d1040c9520c137a454f24afc06a..c40687da20fc6c9259cd984f2c203480738d11a3 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_APICDEF_H
-#define _ASM_X86_APICDEF_H
+#ifndef ASM_X86__APICDEF_H
+#define ASM_X86__APICDEF_H
 
 /*
  * Constants for various Intel APICs. (local APIC, IOAPIC, etc.)
@@ -411,4 +411,4 @@ struct local_apic {
 #else
  #define BAD_APICID 0xFFFFu
 #endif
-#endif
+#endif /* ASM_X86__APICDEF_H */
index 8411750ceb633763ad2fda66d8f154f9b87cfd7f..72adc3a109cc5258beebbc0aab8b15423a67a10a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_ARCH_HOOKS_H
-#define _ASM_ARCH_HOOKS_H
+#ifndef ASM_X86__ARCH_HOOKS_H
+#define ASM_X86__ARCH_HOOKS_H
 
 #include <linux/interrupt.h>
 
@@ -25,4 +25,4 @@ extern void pre_time_init_hook(void);
 extern void time_init_hook(void);
 extern void mca_nmi_hook(void);
 
-#endif
+#endif /* ASM_X86__ARCH_HOOKS_H */
index 97220321f39de383b4624533a7ae1969756fb0b6..e1355f44d7c3395753317faaf2b2fb61f100bfea 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_ASM_H
-#define _ASM_X86_ASM_H
+#ifndef ASM_X86__ASM_H
+#define ASM_X86__ASM_H
 
 #ifdef __ASSEMBLY__
 # define __ASM_FORM(x) x
 
 #define _ASM_PTR       __ASM_SEL(.long, .quad)
 #define _ASM_ALIGN     __ASM_SEL(.balign 4, .balign 8)
-#define _ASM_MOV_UL    __ASM_SIZE(mov)
 
+#define _ASM_MOV       __ASM_SIZE(mov)
 #define _ASM_INC       __ASM_SIZE(inc)
 #define _ASM_DEC       __ASM_SIZE(dec)
 #define _ASM_ADD       __ASM_SIZE(add)
 #define _ASM_SUB       __ASM_SIZE(sub)
 #define _ASM_XADD      __ASM_SIZE(xadd)
+
 #define _ASM_AX                __ASM_REG(ax)
 #define _ASM_BX                __ASM_REG(bx)
 #define _ASM_CX                __ASM_REG(cx)
 #define _ASM_DX                __ASM_REG(dx)
+#define _ASM_SP                __ASM_REG(sp)
+#define _ASM_BP                __ASM_REG(bp)
+#define _ASM_SI                __ASM_REG(si)
+#define _ASM_DI                __ASM_REG(di)
 
 /* Exception table entry */
 # define _ASM_EXTABLE(from,to) \
@@ -39,4 +44,4 @@
        _ASM_PTR #from "," #to "\n" \
        " .previous\n"
 
-#endif /* _ASM_X86_ASM_H */
+#endif /* ASM_X86__ASM_H */
index 21a4825148c09e34c70db728f68951ff32e631f8..14d3f0beb889917c3d6af356bdd84d114a7cae06 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ARCH_I386_ATOMIC__
-#define __ARCH_I386_ATOMIC__
+#ifndef ASM_X86__ATOMIC_32_H
+#define ASM_X86__ATOMIC_32_H
 
 #include <linux/compiler.h>
 #include <asm/processor.h>
@@ -256,4 +256,4 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
 #define smp_mb__after_atomic_inc()     barrier()
 
 #include <asm-generic/atomic.h>
-#endif
+#endif /* ASM_X86__ATOMIC_32_H */
index 91c7d03e65bcc077f4bbffe98cf662ee47bf33dc..2cb218c4a356ce332b2e887b88e8d146e602fe84 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ARCH_X86_64_ATOMIC__
-#define __ARCH_X86_64_ATOMIC__
+#ifndef ASM_X86__ATOMIC_64_H
+#define ASM_X86__ATOMIC_64_H
 
 #include <asm/alternative.h>
 #include <asm/cmpxchg.h>
@@ -470,4 +470,4 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
 #define smp_mb__after_atomic_inc()     barrier()
 
 #include <asm-generic/atomic.h>
-#endif
+#endif /* ASM_X86__ATOMIC_64_H */
index 87f5e6d5a02075244fbd3ad2087ae9a8c9e4405a..12c7cac7420202c7a4a11997187b966bc4d392c4 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_AUXVEC_H
-#define _ASM_X86_AUXVEC_H
+#ifndef ASM_X86__AUXVEC_H
+#define ASM_X86__AUXVEC_H
 /*
  * Architecture-neutral AT_ values in 0-17, leave some room
  * for more of them, start the x86-specific ones at 32.
@@ -9,4 +9,4 @@
 #endif
 #define AT_SYSINFO_EHDR                33
 
-#endif
+#endif /* ASM_X86__AUXVEC_H */
index 0033e50c13b28cec6bfcd479ced48e01798e9e76..ec42ed8745913383cbb81be7c28556c4ddbacdd0 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _MACH_BIOS_EBDA_H
-#define _MACH_BIOS_EBDA_H
+#ifndef ASM_X86__BIOS_EBDA_H
+#define ASM_X86__BIOS_EBDA_H
 
 #include <asm/io.h>
 
@@ -16,4 +16,4 @@ static inline unsigned int get_bios_ebda(void)
 
 void reserve_ebda_region(void);
 
-#endif /* _MACH_BIOS_EBDA_H */
+#endif /* ASM_X86__BIOS_EBDA_H */
index 28ea8742b6e1f75e5c04b882ece9ecd1702f0ffe..451a74762bd4e95aa3fd1ba20c2c6230ced14c84 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_BITOPS_H
-#define _ASM_X86_BITOPS_H
+#ifndef ASM_X86__BITOPS_H
+#define ASM_X86__BITOPS_H
 
 /*
  * Copyright 1992, Linus Torvalds.
@@ -448,4 +448,4 @@ static inline int fls(int x)
 #include <asm-generic/bitops/minix.h>
 
 #endif /* __KERNEL__ */
-#endif /* _ASM_X86_BITOPS_H */
+#endif /* ASM_X86__BITOPS_H */
index 2faed7ecb092a7893c89c573b7ac9870e060d8a7..825de5dc867cb97240a90ba3abc1c2933f3fee07 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_BOOT_H
-#define _ASM_BOOT_H
+#ifndef ASM_X86__BOOT_H
+#define ASM_X86__BOOT_H
 
 /* Don't touch these, unless you really know what you're doing. */
 #define DEF_INITSEG    0x9000
@@ -25,4 +25,4 @@
 #define BOOT_STACK_SIZE        0x1000
 #endif
 
-#endif /* _ASM_BOOT_H */
+#endif /* ASM_X86__BOOT_H */
index ae22bdf0ab14a74c4b9d01f91fb07230047e1cee..ccf027e2d97da02eabaab3d54eea8bd4fe727d87 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_BOOTPARAM_H
-#define _ASM_BOOTPARAM_H
+#ifndef ASM_X86__BOOTPARAM_H
+#define ASM_X86__BOOTPARAM_H
 
 #include <linux/types.h>
 #include <linux/screen_info.h>
@@ -108,4 +108,4 @@ struct boot_params {
        __u8  _pad9[276];                               /* 0xeec */
 } __attribute__((packed));
 
-#endif /* _ASM_BOOTPARAM_H */
+#endif /* ASM_X86__BOOTPARAM_H */
index b69aa64b82a4af9e60573253abdb5a9c07ebc8e8..91ad43a54c47c6f9b9cb28bfc3cb7003a7b666a1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_BUG_H
-#define _ASM_X86_BUG_H
+#ifndef ASM_X86__BUG_H
+#define ASM_X86__BUG_H
 
 #ifdef CONFIG_BUG
 #define HAVE_ARCH_BUG
@@ -36,4 +36,4 @@ do {                                                          \
 #endif /* !CONFIG_BUG */
 
 #include <asm-generic/bug.h>
-#endif
+#endif /* ASM_X86__BUG_H */
index 021cbdd5f258a7739c2433d62f00a37a51070a4b..4761c461d23a62a4ba44e015c106bd5d5bdbd02c 100644 (file)
@@ -1,7 +1,7 @@
-#ifndef _ASM_X86_BUGS_H
-#define _ASM_X86_BUGS_H
+#ifndef ASM_X86__BUGS_H
+#define ASM_X86__BUGS_H
 
 extern void check_bugs(void);
 int ppro_with_ram_bug(void);
 
-#endif /* _ASM_X86_BUGS_H */
+#endif /* ASM_X86__BUGS_H */
index e02ae2d89acf13936aad26502e485aa6ddae0b65..722f27d68105f8e454ccaf01d1b7de4baa8dd0ce 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_BYTEORDER_H
-#define _ASM_X86_BYTEORDER_H
+#ifndef ASM_X86__BYTEORDER_H
+#define ASM_X86__BYTEORDER_H
 
 #include <asm/types.h>
 #include <linux/compiler.h>
@@ -78,4 +78,4 @@ static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
 
 #include <linux/byteorder/little_endian.h>
 
-#endif /* _ASM_X86_BYTEORDER_H */
+#endif /* ASM_X86__BYTEORDER_H */
index 1e0bac86f38f8ee4f950380e4e1845a49fec6b30..ea3f1cc06a974e8d3255bb07e74777f390976afa 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ARCH_X86_CACHE_H
-#define _ARCH_X86_CACHE_H
+#ifndef ASM_X86__CACHE_H
+#define ASM_X86__CACHE_H
 
 /* L1 cache line size */
 #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
@@ -17,4 +17,4 @@
 #endif
 #endif
 
-#endif
+#endif /* ASM_X86__CACHE_H */
index f4c0ab50d2c2bc4d8e5d5beea1c84c26409225d7..68840ef1b35a01c01fa7e23e45f3b5c0415d39e8 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_CACHEFLUSH_H
-#define _ASM_X86_CACHEFLUSH_H
+#ifndef ASM_X86__CACHEFLUSH_H
+#define ASM_X86__CACHEFLUSH_H
 
 /* Keep includes the same across arches.  */
 #include <linux/mm.h>
@@ -24,6 +24,8 @@
 #define copy_from_user_page(vma, page, vaddr, dst, src, len)   \
        memcpy((dst), (src), (len))
 
+#define PG_non_WB                              PG_arch_1
+PAGEFLAG(NonWB, non_WB)
 
 /*
  * 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);
 int set_memory_np(unsigned long addr, int numpages);
 int set_memory_4k(unsigned long addr, int numpages);
 
+int set_memory_array_uc(unsigned long *addr, int addrinarray);
+int set_memory_array_wb(unsigned long *addr, int addrinarray);
+
 /*
  * For legacy compatibility with the old APIs, a few functions
  * are provided that work on a "struct page".
@@ -96,8 +101,6 @@ int set_pages_rw(struct page *page, int numpages);
 
 void clflush_cache_range(void *addr, unsigned int size);
 
-void cpa_init(void);
-
 #ifdef CONFIG_DEBUG_RODATA
 void mark_rodata_ro(void);
 extern const int rodata_test_data;
@@ -112,4 +115,4 @@ static inline int rodata_test(void)
 }
 #endif
 
-#endif
+#endif /* ASM_X86__CACHEFLUSH_H */
index 67f60406e2d8136ac50b3b25afefef629508ec0d..933fd272f82663c6ed0c2224df4e668a0870681c 100644 (file)
@@ -21,8 +21,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#ifndef _ASM_X86_64_CALGARY_H
-#define _ASM_X86_64_CALGARY_H
+#ifndef ASM_X86__CALGARY_H
+#define ASM_X86__CALGARY_H
 
 #include <linux/spinlock.h>
 #include <linux/device.h>
@@ -69,4 +69,4 @@ static inline int calgary_iommu_init(void) { return 1; }
 static inline void detect_calgary(void) { return; }
 #endif
 
-#endif /* _ASM_X86_64_CALGARY_H */
+#endif /* ASM_X86__CALGARY_H */
index 52bbb0d8c4c15ce08c2d155fc23f031b98384547..d041e8cda227a6b191f70052599b00383af83ea7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_CHECKSUM_H
-#define _I386_CHECKSUM_H
+#ifndef ASM_X86__CHECKSUM_32_H
+#define ASM_X86__CHECKSUM_32_H
 
 #include <linux/in6.h>
 
@@ -186,4 +186,4 @@ static inline __wsum csum_and_copy_to_user(const void *src,
        return (__force __wsum)-1; /* invalid checksum */
 }
 
-#endif
+#endif /* ASM_X86__CHECKSUM_32_H */
index 8bd861cc5267094b38fb43f2452b4578d87fb405..110f403beb8953d60218bc5b8c940b9f92dc80bd 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _X86_64_CHECKSUM_H
-#define _X86_64_CHECKSUM_H
+#ifndef ASM_X86__CHECKSUM_64_H
+#define ASM_X86__CHECKSUM_64_H
 
 /*
  * Checksums for x86-64
@@ -188,4 +188,4 @@ static inline unsigned add32_with_carry(unsigned a, unsigned b)
        return a;
 }
 
-#endif
+#endif /* ASM_X86__CHECKSUM_64_H */
index bf5a69d1329ef827a636778829a42bae261910aa..0622e45cdf7cf2b26413e506ef98a0352d6fb400 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_CMPXCHG_H
-#define __ASM_CMPXCHG_H
+#ifndef ASM_X86__CMPXCHG_32_H
+#define ASM_X86__CMPXCHG_32_H
 
 #include <linux/bitops.h> /* for LOCK_PREFIX */
 
@@ -341,4 +341,4 @@ extern unsigned long long cmpxchg_486_u64(volatile void *, u64, u64);
 
 #endif
 
-#endif
+#endif /* ASM_X86__CMPXCHG_32_H */
index 17463ccf816618b59a144ec76f57e51589e8866c..63c1a5e61b994a781ef3ff8e9c1f858e9afac264 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_CMPXCHG_H
-#define __ASM_CMPXCHG_H
+#ifndef ASM_X86__CMPXCHG_64_H
+#define ASM_X86__CMPXCHG_64_H
 
 #include <asm/alternative.h> /* Provides LOCK_PREFIX */
 
@@ -182,4 +182,4 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
        cmpxchg_local((ptr), (o), (n));                                 \
 })
 
-#endif
+#endif /* ASM_X86__CMPXCHG_64_H */
index 1793ac317a30417523cc84fb5d4b2f583b1b4a01..6732b150949e8c8ef0b333673c5b92438c3a9a9e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_64_COMPAT_H
-#define _ASM_X86_64_COMPAT_H
+#ifndef ASM_X86__COMPAT_H
+#define ASM_X86__COMPAT_H
 
 /*
  * Architecture specific compatibility types
@@ -215,4 +215,4 @@ static inline int is_compat_task(void)
        return current_thread_info()->status & TS_COMPAT;
 }
 
-#endif /* _ASM_X86_64_COMPAT_H */
+#endif /* ASM_X86__COMPAT_H */
index 73f2ea84fd74b024fa4ebc8e91cabcdab4340108..83a115083f0d74ad3eb0f82eae64e19aea5a7cc1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_I386_CPU_H_
-#define _ASM_I386_CPU_H_
+#ifndef ASM_X86__CPU_H
+#define ASM_X86__CPU_H
 
 #include <linux/device.h>
 #include <linux/cpu.h>
@@ -17,4 +17,4 @@ extern void arch_unregister_cpu(int);
 #endif
 
 DECLARE_PER_CPU(int, cpu_state);
-#endif /* _ASM_I386_CPU_H_ */
+#endif /* ASM_X86__CPU_H */
index 9489283a4bcfbc6bbb4f9e8fd5c25dbb8ed547f8..250fa0cb144b9f3c4f34254f599c43a5e75acd9f 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Defines x86 CPU feature bits
  */
-#ifndef _ASM_X86_CPUFEATURE_H
-#define _ASM_X86_CPUFEATURE_H
+#ifndef ASM_X86__CPUFEATURE_H
+#define ASM_X86__CPUFEATURE_H
 
 #include <asm/required-features.h>
 
@@ -81,6 +81,7 @@
 #define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* Lfence synchronizes RDTSC */
 #define X86_FEATURE_11AP       (3*32+19) /* Bad local APIC aka 11AP */
 #define X86_FEATURE_NOPL       (3*32+20) /* The NOPL (0F 1F) instructions */
+#define X86_FEATURE_AMDC1E     (3*32+21) /* AMD C1E detected */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3       (4*32+ 0) /* Streaming SIMD Extensions-3 */
@@ -223,4 +224,4 @@ extern const char * const x86_power_flags[32];
 
 #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
 
-#endif /* _ASM_X86_CPUFEATURE_H */
+#endif /* ASM_X86__CPUFEATURE_H */
index 7515c19d498884d770e901740eb506d5f96c4807..a863ead856f3d37de49d023a156f98b1d4f540c5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _X86_CURRENT_H
-#define _X86_CURRENT_H
+#ifndef ASM_X86__CURRENT_H
+#define ASM_X86__CURRENT_H
 
 #ifdef CONFIG_X86_32
 #include <linux/compiler.h>
@@ -36,4 +36,4 @@ static __always_inline struct task_struct *get_current(void)
 
 #define current get_current()
 
-#endif /* X86_CURRENT_H */
+#endif /* ASM_X86__CURRENT_H */
index c6344d572b033a78d04d1219f9772f6fab8b7f06..ecb6907c3ea4ff97ef7aacb4b9c47809ef2701c4 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_DEBUGREG_H
-#define _ASM_X86_DEBUGREG_H
+#ifndef ASM_X86__DEBUGREG_H
+#define ASM_X86__DEBUGREG_H
 
 
 /* Indicate the register numbers for a number of the specific
@@ -67,4 +67,4 @@
 #define DR_LOCAL_SLOWDOWN (0x100)   /* Local slow the pipeline */
 #define DR_GLOBAL_SLOWDOWN (0x200)  /* Global slow the pipeline */
 
-#endif
+#endif /* ASM_X86__DEBUGREG_H */
index 409a649204aa7308c8936d6cc08d4479222d6885..8a0da95b4fc50e290187fd3bf3eb05b161fdf955 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_DELAY_H
-#define _ASM_X86_DELAY_H
+#ifndef ASM_X86__DELAY_H
+#define ASM_X86__DELAY_H
 
 /*
  * Copyright (C) 1993 Linus Torvalds
@@ -28,4 +28,4 @@ extern void __delay(unsigned long loops);
 
 void use_tsc_delay(void);
 
-#endif /* _ASM_X86_DELAY_H */
+#endif /* ASM_X86__DELAY_H */
index a44c4dc705902c6b1e76c92d71f1c68f759a0df4..b73fea54def29e1dfd0d2e95ec65f08c64b5cb49 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_DESC_H_
-#define _ASM_DESC_H_
+#ifndef ASM_X86__DESC_H
+#define ASM_X86__DESC_H
 
 #ifndef __ASSEMBLY__
 #include <asm/desc_defs.h>
@@ -397,4 +397,4 @@ static inline void set_system_gate_ist(int n, void *addr, unsigned ist)
 
 #endif /* __ASSEMBLY__ */
 
-#endif
+#endif /* ASM_X86__DESC_H */
index f7bacf357daca2be4fb7345d75deb69c6c6c0ee3..b881db664b46a27927d9febc4f16e39e24227d49 100644 (file)
@@ -1,6 +1,6 @@
 /* Written 2000 by Andi Kleen */
-#ifndef __ARCH_DESC_DEFS_H
-#define __ARCH_DESC_DEFS_H
+#ifndef ASM_X86__DESC_DEFS_H
+#define ASM_X86__DESC_DEFS_H
 
 /*
  * Segment descriptor structure definitions, usable from both x86_64 and i386
@@ -92,4 +92,4 @@ struct desc_ptr {
 
 #endif /* !__ASSEMBLY__ */
 
-#endif
+#endif /* ASM_X86__DESC_DEFS_H */
index 3c034f48fdb0a12f5a3fefe1499d014b68e6f4a2..1bece04c7d9d9b829d6d51abe191ce1b8abf0da9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_DEVICE_H
-#define _ASM_X86_DEVICE_H
+#ifndef ASM_X86__DEVICE_H
+#define ASM_X86__DEVICE_H
 
 struct dev_archdata {
 #ifdef CONFIG_ACPI
@@ -13,4 +13,4 @@ struct dma_mapping_ops *dma_ops;
 #endif
 };
 
-#endif /* _ASM_X86_DEVICE_H */
+#endif /* ASM_X86__DEVICE_H */
index 9a2d644c08efc0981dbc13b1700e81917fef7c63..f9530f23f1d6ac2e4577ec036748cbbbc4752a93 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_DIV64_H
-#define _ASM_X86_DIV64_H
+#ifndef ASM_X86__DIV64_H
+#define ASM_X86__DIV64_H
 
 #ifdef CONFIG_X86_32
 
@@ -57,4 +57,4 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
 # include <asm-generic/div64.h>
 #endif /* CONFIG_X86_32 */
 
-#endif /* _ASM_X86_DIV64_H */
+#endif /* ASM_X86__DIV64_H */
index 3b808e9bb72c3ac94ade3f0eb4f3b1a3533a91c7..219c33d6361cdfa640878431cd6e6523dc2a475a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_DMA_MAPPING_H_
-#define _ASM_DMA_MAPPING_H_
+#ifndef ASM_X86__DMA_MAPPING_H
+#define ASM_X86__DMA_MAPPING_H
 
 /*
  * IOMMU interface. See Documentation/DMA-mapping.txt and DMA-API.txt for
@@ -65,7 +65,7 @@ static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
                return dma_ops;
        else
                return dev->archdata.dma_ops;
-#endif
+#endif /* ASM_X86__DMA_MAPPING_H */
 }
 
 /* Make sure we keep the same behaviour */
index ca1098a7e58057eebe268c059a682990c6ebb7e6..c9f7a4eec5557c7ce8ee02b67af6daa6dd234062 100644 (file)
@@ -5,8 +5,8 @@
  * and John Boyd, Nov. 1992.
  */
 
-#ifndef _ASM_X86_DMA_H
-#define _ASM_X86_DMA_H
+#ifndef ASM_X86__DMA_H
+#define ASM_X86__DMA_H
 
 #include <linux/spinlock.h>    /* And spinlocks */
 #include <asm/io.h>            /* need byte IO */
@@ -315,4 +315,4 @@ extern int isa_dma_bridge_buggy;
 #define isa_dma_bridge_buggy   (0)
 #endif
 
-#endif /* _ASM_X86_DMA_H */
+#endif /* ASM_X86__DMA_H */
index 58a86571fe0f8451df8800bd87b218e2be028886..1cff6fe81fa5cb9d4f20954fca9e192cd99419a9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_DMI_H
-#define _ASM_X86_DMI_H
+#ifndef ASM_X86__DMI_H
+#define ASM_X86__DMI_H
 
 #include <asm/io.h>
 
@@ -23,4 +23,4 @@ static inline void *dmi_alloc(unsigned len)
 #define dmi_ioremap early_ioremap
 #define dmi_iounmap early_iounmap
 
-#endif
+#endif /* ASM_X86__DMI_H */
index 7881368142faaad53fe374c60aff964a69549770..c3c953a45b215ba24b3c4216f4ee9def2e1f7c08 100644 (file)
  * Debug Store (DS) support
  *
  * This provides a low-level interface to the hardware's Debug Store
- * feature that is used for last branch recording (LBR) and
+ * feature that is used for branch trace store (BTS) and
  * precise-event based sampling (PEBS).
  *
- * Different architectures use a different DS layout/pointer size.
- * The below functions therefore work on a void*.
+ * It manages:
+ * - per-thread and per-cpu allocation of BTS and PEBS
+ * - buffer memory allocation (optional)
+ * - buffer overflow handling
+ * - buffer access
  *
+ * It assumes:
+ * - get_task_struct on all parameter tasks
+ * - current is allowed to trace parameter tasks
  *
- * Since there is no user for PEBS, yet, only LBR (or branch
- * trace store, BTS) is supported.
  *
- *
- * Copyright (C) 2007 Intel Corporation.
- * Markus Metzger <markus.t.metzger@intel.com>, Dec 2007
+ * Copyright (C) 2007-2008 Intel Corporation.
+ * Markus Metzger <markus.t.metzger@intel.com>, 2007-2008
  */
 
-#ifndef _ASM_X86_DS_H
-#define _ASM_X86_DS_H
+#ifndef ASM_X86__DS_H
+#define ASM_X86__DS_H
+
+#ifdef CONFIG_X86_DS
 
 #include <linux/types.h>
 #include <linux/init.h>
 
-struct cpuinfo_x86;
 
+struct task_struct;
 
-/* a branch trace record entry
+/*
+ * Request BTS or PEBS
+ *
+ * Due to alignement constraints, the actual buffer may be slightly
+ * smaller than the requested or provided buffer.
  *
- * In order to unify the interface between various processor versions,
- * we use the below data structure for all processors.
+ * Returns 0 on success; -Eerrno otherwise
+ *
+ * task: the task to request recording for;
+ *       NULL for per-cpu recording on the current cpu
+ * base: the base pointer for the (non-pageable) buffer;
+ *       NULL if buffer allocation requested
+ * size: the size of the requested or provided buffer
+ * ovfl: pointer to a function to be called on buffer overflow;
+ *       NULL if cyclic buffer requested
  */
-enum bts_qualifier {
-       BTS_INVALID = 0,
-       BTS_BRANCH,
-       BTS_TASK_ARRIVES,
-       BTS_TASK_DEPARTS
-};
+typedef void (*ds_ovfl_callback_t)(struct task_struct *);
+extern int ds_request_bts(struct task_struct *task, void *base, size_t size,
+                         ds_ovfl_callback_t ovfl);
+extern int ds_request_pebs(struct task_struct *task, void *base, size_t size,
+                          ds_ovfl_callback_t ovfl);
 
-struct bts_struct {
-       u64 qualifier;
-       union {
-               /* BTS_BRANCH */
-               struct {
-                       u64 from_ip;
-                       u64 to_ip;
-               } lbr;
-               /* BTS_TASK_ARRIVES or
-                  BTS_TASK_DEPARTS */
-               u64 jiffies;
-       } variant;
+/*
+ * Release BTS or PEBS resources
+ *
+ * Frees buffers allocated on ds_request.
+ *
+ * Returns 0 on success; -Eerrno otherwise
+ *
+ * task: the task to release resources for;
+ *       NULL to release resources for the current cpu
+ */
+extern int ds_release_bts(struct task_struct *task);
+extern int ds_release_pebs(struct task_struct *task);
+
+/*
+ * Return the (array) index of the write pointer.
+ * (assuming an array of BTS/PEBS records)
+ *
+ * Returns -Eerrno on error
+ *
+ * task: the task to access;
+ *       NULL to access the current cpu
+ * pos (out): if not NULL, will hold the result
+ */
+extern int ds_get_bts_index(struct task_struct *task, size_t *pos);
+extern int ds_get_pebs_index(struct task_struct *task, size_t *pos);
+
+/*
+ * Return the (array) index one record beyond the end of the array.
+ * (assuming an array of BTS/PEBS records)
+ *
+ * Returns -Eerrno on error
+ *
+ * task: the task to access;
+ *       NULL to access the current cpu
+ * pos (out): if not NULL, will hold the result
+ */
+extern int ds_get_bts_end(struct task_struct *task, size_t *pos);
+extern int ds_get_pebs_end(struct task_struct *task, size_t *pos);
+
+/*
+ * Provide a pointer to the BTS/PEBS record at parameter index.
+ * (assuming an array of BTS/PEBS records)
+ *
+ * The pointer points directly into the buffer. The user is
+ * responsible for copying the record.
+ *
+ * Returns the size of a single record on success; -Eerrno on error
+ *
+ * task: the task to access;
+ *       NULL to access the current cpu
+ * index: the index of the requested record
+ * record (out): pointer to the requested record
+ */
+extern int ds_access_bts(struct task_struct *task,
+                        size_t index, const void **record);
+extern int ds_access_pebs(struct task_struct *task,
+                         size_t index, const void **record);
+
+/*
+ * Write one or more BTS/PEBS records at the write pointer index and
+ * advance the write pointer.
+ *
+ * If size is not a multiple of the record size, trailing bytes are
+ * zeroed out.
+ *
+ * May result in one or more overflow notifications.
+ *
+ * If called during overflow handling, that is, with index >=
+ * interrupt threshold, the write will wrap around.
+ *
+ * An overflow notification is given if and when the interrupt
+ * threshold is reached during or after the write.
+ *
+ * Returns the number of bytes written or -Eerrno.
+ *
+ * task: the task to access;
+ *       NULL to access the current cpu
+ * buffer: the buffer to write
+ * size: the size of the buffer
+ */
+extern int ds_write_bts(struct task_struct *task,
+                       const void *buffer, size_t size);
+extern int ds_write_pebs(struct task_struct *task,
+                        const void *buffer, size_t size);
+
+/*
+ * Same as ds_write_bts/pebs, but omit ownership checks.
+ *
+ * This is needed to have some other task than the owner of the
+ * BTS/PEBS buffer or the parameter task itself write into the
+ * respective buffer.
+ */
+extern int ds_unchecked_write_bts(struct task_struct *task,
+                                 const void *buffer, size_t size);
+extern int ds_unchecked_write_pebs(struct task_struct *task,
+                                  const void *buffer, size_t size);
+
+/*
+ * Reset the write pointer of the BTS/PEBS buffer.
+ *
+ * Returns 0 on success; -Eerrno on error
+ *
+ * task: the task to access;
+ *       NULL to access the current cpu
+ */
+extern int ds_reset_bts(struct task_struct *task);
+extern int ds_reset_pebs(struct task_struct *task);
+
+/*
+ * Clear the BTS/PEBS buffer and reset the write pointer.
+ * The entire buffer will be zeroed out.
+ *
+ * Returns 0 on success; -Eerrno on error
+ *
+ * task: the task to access;
+ *       NULL to access the current cpu
+ */
+extern int ds_clear_bts(struct task_struct *task);
+extern int ds_clear_pebs(struct task_struct *task);
+
+/*
+ * Provide the PEBS counter reset value.
+ *
+ * Returns 0 on success; -Eerrno on error
+ *
+ * task: the task to access;
+ *       NULL to access the current cpu
+ * value (out): the counter reset value
+ */
+extern int ds_get_pebs_reset(struct task_struct *task, u64 *value);
+
+/*
+ * Set the PEBS counter reset value.
+ *
+ * Returns 0 on success; -Eerrno on error
+ *
+ * task: the task to access;
+ *       NULL to access the current cpu
+ * value: the new counter reset value
+ */
+extern int ds_set_pebs_reset(struct task_struct *task, u64 value);
+
+/*
+ * Initialization
+ */
+struct cpuinfo_x86;
+extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *);
+
+
+
+/*
+ * The DS context - part of struct thread_struct.
+ */
+struct ds_context {
+       /* pointer to the DS configuration; goes into MSR_IA32_DS_AREA */
+       unsigned char *ds;
+       /* the owner of the BTS and PEBS configuration, respectively */
+       struct task_struct *owner[2];
+       /* buffer overflow notification function for BTS and PEBS */
+       ds_ovfl_callback_t callback[2];
+       /* the original buffer address */
+       void *buffer[2];
+       /* the number of allocated pages for on-request allocated buffers */
+       unsigned int pages[2];
+       /* use count */
+       unsigned long count;
+       /* a pointer to the context location inside the thread_struct
+        * or the per_cpu context array */
+       struct ds_context **this;
+       /* a pointer to the task owning this context, or NULL, if the
+        * context is owned by a cpu */
+       struct task_struct *task;
 };
 
-/* Overflow handling mechanisms */
-#define DS_O_SIGNAL    1 /* send overflow signal */
-#define DS_O_WRAP      2 /* wrap around */
-
-extern int ds_allocate(void **, size_t);
-extern int ds_free(void **);
-extern int ds_get_bts_size(void *);
-extern int ds_get_bts_end(void *);
-extern int ds_get_bts_index(void *);
-extern int ds_set_overflow(void *, int);
-extern int ds_get_overflow(void *);
-extern int ds_clear(void *);
-extern int ds_read_bts(void *, int, struct bts_struct *);
-extern int ds_write_bts(void *, const struct bts_struct *);
-extern unsigned long ds_debugctl_mask(void);
-extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *c);
-
-#endif /* _ASM_X86_DS_H */
+/* called by exit_thread() to free leftover contexts */
+extern void ds_free(struct ds_context *context);
+
+#else /* CONFIG_X86_DS */
+
+#define ds_init_intel(config) do {} while (0)
+
+#endif /* CONFIG_X86_DS */
+#endif /* ASM_X86__DS_H */
index 738bb9fb3e53c86ddb40119158b1b88307a5ab35..21d1bc32ad7c37ee7fa0213b2af692d73be0157a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _DWARF2_H
-#define _DWARF2_H
+#ifndef ASM_X86__DWARF2_H
+#define ASM_X86__DWARF2_H
 
 #ifndef __ASSEMBLY__
 #warning "asm/dwarf2.h should be only included in pure assembly files"
@@ -58,4 +58,4 @@
 
 #endif
 
-#endif
+#endif /* ASM_X86__DWARF2_H */
index 16a31e2c7c5747888b0c75178bb0683859dbbac1..f52daf176bcbba7c25a04677153bd0429a402050 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_E820_H
-#define __ASM_E820_H
+#ifndef ASM_X86__E820_H
+#define ASM_X86__E820_H
 #define E820MAP        0x2d0           /* our map */
 #define E820MAX        128             /* number of entries in E820MAP */
 
@@ -64,6 +64,7 @@ struct e820map {
 extern struct e820map e820;
 extern struct e820map e820_saved;
 
+extern unsigned long pci_mem_start;
 extern int e820_any_mapped(u64 start, u64 end, unsigned type);
 extern int e820_all_mapped(u64 start, u64 end, unsigned type);
 extern void e820_add_region(u64 start, u64 size, int type);
@@ -140,4 +141,4 @@ extern char *memory_setup(void);
 #define HIGH_MEMORY    (1024*1024)
 #endif /* __KERNEL__ */
 
-#endif  /* __ASM_E820_H */
+#endif /* ASM_X86__E820_H */
index a8088f63a30e4a58cfd50dde612e7da94843b3d0..9493c5b27bbdb4584bc60ff98b4fae0fd2dfc54f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_EDAC_H
-#define _ASM_X86_EDAC_H
+#ifndef ASM_X86__EDAC_H
+#define ASM_X86__EDAC_H
 
 /* ECC atomic, DMA, SMP and interrupt safe scrub function */
 
@@ -15,4 +15,4 @@ static inline void atomic_scrub(void *va, u32 size)
                asm volatile("lock; addl $0, %0"::"m" (*virt_addr));
 }
 
-#endif
+#endif /* ASM_X86__EDAC_H */
index d4f2b0abe9294eefce100885a7c342bea885d0c5..ed2de22e87050089bb8a8c02fb85bc0a204d2141 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_EFI_H
-#define _ASM_X86_EFI_H
+#ifndef ASM_X86__EFI_H
+#define ASM_X86__EFI_H
 
 #ifdef CONFIG_X86_32
 
@@ -94,4 +94,4 @@ extern void efi_reserve_early(void);
 extern void efi_call_phys_prelog(void);
 extern void efi_call_phys_epilog(void);
 
-#endif
+#endif /* ASM_X86__EFI_H */
index 7be4733c793e58c404fbab54d3c34e2e05ff8aa0..5c4745bec9061c0febdfb21ab4534c89c8f354f9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_ELF_H
-#define _ASM_X86_ELF_H
+#ifndef ASM_X86__ELF_H
+#define ASM_X86__ELF_H
 
 /*
  * ELF register definitions..
@@ -148,8 +148,9 @@ do {                                                \
 
 static inline void start_ia32_thread(struct pt_regs *regs, u32 ip, u32 sp)
 {
-       asm volatile("movl %0,%%fs" :: "r" (0));
-       asm volatile("movl %0,%%es; movl %0,%%ds" : : "r" (__USER32_DS));
+       loadsegment(fs, 0);
+       loadsegment(ds, __USER32_DS);
+       loadsegment(es, __USER32_DS);
        load_gs_index(0);
        regs->ip = ip;
        regs->sp = sp;
@@ -332,4 +333,4 @@ extern int syscall32_setup_pages(struct linux_binprm *, int exstack);
 extern unsigned long arch_randomize_brk(struct mm_struct *mm);
 #define arch_randomize_brk arch_randomize_brk
 
-#endif
+#endif /* ASM_X86__ELF_H */
index 8e6aef19f8f02ce8be4edf1cf346ac9b257aaa77..190d0d8b71e330e35d1b0da257ab38132f218db3 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_EMERGENCY_RESTART_H
-#define _ASM_EMERGENCY_RESTART_H
+#ifndef ASM_X86__EMERGENCY_RESTART_H
+#define ASM_X86__EMERGENCY_RESTART_H
 
 enum reboot_type {
        BOOT_TRIPLE = 't',
@@ -15,4 +15,4 @@ extern enum reboot_type reboot_type;
 
 extern void machine_emergency_restart(void);
 
-#endif /* _ASM_EMERGENCY_RESTART_H */
+#endif /* ASM_X86__EMERGENCY_RESTART_H */
index 53018464aea653a407dc32e6be3d95ac14230306..aca38dbd9a644981541ef3cedeaea57d373d8d2c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_FB_H
-#define _ASM_X86_FB_H
+#ifndef ASM_X86__FB_H
+#define ASM_X86__FB_H
 
 #include <linux/fb.h>
 #include <linux/fs.h>
@@ -18,4 +18,4 @@ extern int fb_is_primary_device(struct fb_info *info);
 static inline int fb_is_primary_device(struct fb_info *info) { return 0; }
 #endif
 
-#endif /* _ASM_X86_FB_H */
+#endif /* ASM_X86__FB_H */
index 44d4f82173496d2984b9c6612c4d4fe48341a146..78e33a1bc591ea67357cc8bee1efdeb4d75463e6 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_FIXMAP_H
-#define _ASM_FIXMAP_H
+#ifndef ASM_X86__FIXMAP_H
+#define ASM_X86__FIXMAP_H
 
 #ifdef CONFIG_X86_32
 # include "fixmap_32.h"
@@ -65,4 +65,4 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
        BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
        return __virt_to_fix(vaddr);
 }
-#endif
+#endif /* ASM_X86__FIXMAP_H */
index f1ac2b2167d7fdf0ba27c450d2c688f05c3b9e02..784e3e759866cc0025b4dd4e9af77aeedddcdd1d 100644 (file)
@@ -10,8 +10,8 @@
  * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
  */
 
-#ifndef _ASM_FIXMAP_32_H
-#define _ASM_FIXMAP_32_H
+#ifndef ASM_X86__FIXMAP_32_H
+#define ASM_X86__FIXMAP_32_H
 
 
 /* used by vmalloc.c, vsyscall.lds.S.
@@ -120,4 +120,4 @@ extern void reserve_top_address(unsigned long reserve);
 #define FIXADDR_BOOT_START     (FIXADDR_TOP - __FIXADDR_BOOT_SIZE)
 
 #endif /* !__ASSEMBLY__ */
-#endif
+#endif /* ASM_X86__FIXMAP_32_H */
index 00f3d74a0524d71e77bfb4730a8b6c13f38b052f..dafb24bc0424efd4b94ed18ae2ce5e1dcf4d0260 100644 (file)
@@ -8,8 +8,8 @@
  * Copyright (C) 1998 Ingo Molnar
  */
 
-#ifndef _ASM_FIXMAP_64_H
-#define _ASM_FIXMAP_64_H
+#ifndef ASM_X86__FIXMAP_64_H
+#define ASM_X86__FIXMAP_64_H
 
 #include <linux/kernel.h>
 #include <asm/acpi.h>
@@ -80,4 +80,4 @@ enum fixed_addresses {
 #define FIXADDR_USER_START     ((unsigned long)VSYSCALL32_VSYSCALL)
 #define FIXADDR_USER_END       (FIXADDR_USER_START + PAGE_SIZE)
 
-#endif
+#endif /* ASM_X86__FIXMAP_64_H */
index dbe82a5c5eacde33f9cdf3791dfe159228f151b6..7d83a3a83e3772ed54b5e0464c94aa8506421038 100644 (file)
@@ -7,8 +7,8 @@
  *
  * Copyright (C) 1995
  */
-#ifndef _ASM_X86_FLOPPY_H
-#define _ASM_X86_FLOPPY_H
+#ifndef ASM_X86__FLOPPY_H
+#define ASM_X86__FLOPPY_H
 
 #include <linux/vmalloc.h>
 
@@ -278,4 +278,4 @@ static int FDC2 = -1;
 
 #define EXTRA_FLOPPY_PARAMS
 
-#endif /* _ASM_X86_FLOPPY_H */
+#endif /* ASM_X86__FLOPPY_H */
index 5c68b32ee1c81c28a51392303f767f05cf9ae5f3..be0e004ad148123fc5f4b85e2c5a6c2ce8569aea 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_FTRACE
-#define _ASM_X86_FTRACE
+#ifndef ASM_X86__FTRACE_H
+#define ASM_X86__FTRACE_H
 
 #ifdef CONFIG_FTRACE
 #define MCOUNT_ADDR            ((long)(mcount))
@@ -11,4 +11,4 @@ extern void mcount(void);
 
 #endif /* CONFIG_FTRACE */
 
-#endif /* _ASM_X86_FTRACE */
+#endif /* ASM_X86__FTRACE_H */
index e7a76b37b333cc8b40295d7379f8cbb46b241a29..06b924ef6fa5b928dc6a6d83889ee6ce98cc157c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_FUTEX_H
-#define _ASM_X86_FUTEX_H
+#ifndef ASM_X86__FUTEX_H
+#define ASM_X86__FUTEX_H
 
 #ifdef __KERNEL__
 
@@ -25,7 +25,7 @@
        asm volatile("1:\tmovl  %2, %0\n"                       \
                     "\tmovl\t%0, %3\n"                         \
                     "\t" insn "\n"                             \
-                    "2:\tlock; cmpxchgl %3, %2\n"              \
+                    "2:\t" LOCK_PREFIX "cmpxchgl %3, %2\n"     \
                     "\tjnz\t1b\n"                              \
                     "3:\t.section .fixup,\"ax\"\n"             \
                     "4:\tmov\t%5, %1\n"                        \
@@ -64,7 +64,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
                __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
                break;
        case FUTEX_OP_ADD:
-               __futex_atomic_op1("lock; xaddl %0, %2", ret, oldval,
+               __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval,
                                   uaddr, oparg);
                break;
        case FUTEX_OP_OR:
@@ -122,7 +122,7 @@ static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval,
        if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
                return -EFAULT;
 
-       asm volatile("1:\tlock; cmpxchgl %3, %1\n"
+       asm volatile("1:\t" LOCK_PREFIX "cmpxchgl %3, %1\n"
                     "2:\t.section .fixup, \"ax\"\n"
                     "3:\tmov     %2, %0\n"
                     "\tjmp     2b\n"
@@ -137,4 +137,4 @@ static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval,
 }
 
 #endif
-#endif
+#endif /* ASM_X86__FUTEX_H */
index cdf4f78e081b39bdd426553aa3a03f898e873c57..605edb39ef9e9472203644b4b168acafdf7541fd 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X8664_GART_H
-#define _ASM_X8664_GART_H 1
+#ifndef ASM_X86__GART_H
+#define ASM_X86__GART_H
 
 #include <asm/e820.h>
 
@@ -54,15 +54,15 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
                return 0;
 
        if (aper_base + aper_size > 0x100000000ULL) {
-               printk(KERN_ERR "Aperture beyond 4GB. Ignoring.\n");
+               printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n");
                return 0;
        }
        if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
-               printk(KERN_ERR "Aperture pointing to e820 RAM. Ignoring.\n");
+               printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n");
                return 0;
        }
        if (aper_size < min_size) {
-               printk(KERN_ERR "Aperture too small (%d MB) than (%d MB)\n",
+               printk(KERN_INFO "Aperture too small (%d MB) than (%d MB)\n",
                                 aper_size>>20, min_size>>20);
                return 0;
        }
@@ -70,4 +70,4 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
        return 1;
 }
 
-#endif
+#endif /* ASM_X86__GART_H */
index 754d635f90ffc9514a1daae0ed560eed9d629cd9..34280f027664a57267d915bda709183b745ea9a5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_GENAPIC_H
-#define _ASM_GENAPIC_H 1
+#ifndef ASM_X86__GENAPIC_32_H
+#define ASM_X86__GENAPIC_32_H
 
 #include <asm/mpspec.h>
 
@@ -121,4 +121,4 @@ enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
 #define uv_system_init()               do {} while (0)
 
 
-#endif
+#endif /* ASM_X86__GENAPIC_32_H */
index a47d6312913596fbd0a8a77c54ed8b45937a5a90..25097a8cc5efd8cb3f59f5ad980c9de41955f567 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_GENAPIC_H
-#define _ASM_GENAPIC_H 1
+#ifndef ASM_X86__GENAPIC_64_H
+#define ASM_X86__GENAPIC_64_H
 
 /*
  * Copyright 2004 James Cleverdon, IBM.
@@ -47,4 +47,4 @@ extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip);
 
 extern void setup_apic_routing(void);
 
-#endif
+#endif /* ASM_X86__GENAPIC_64_H */
index 2c1cda0b8a860502aac60502b59fd4f9c9a9a895..3f3444be2638f7205d17dc432d723e5b58fcb3f1 100644 (file)
@@ -7,8 +7,8 @@
  * as published by the Free Software Foundation.
  */
 
-#ifndef _ASM_GEODE_H_
-#define _ASM_GEODE_H_
+#ifndef ASM_X86__GEODE_H
+#define ASM_X86__GEODE_H
 
 #include <asm/processor.h>
 #include <linux/io.h>
@@ -250,4 +250,4 @@ extern int __init mfgpt_timer_setup(void);
 static inline int mfgpt_timer_setup(void) { return 0; }
 #endif
 
-#endif
+#endif /* ASM_X86__GEODE_H */
index c4c91b37c104810433f074c396ca3bbc0e69c701..497fb980d96245c72689ee3bd0eb630cf0c729a7 100644 (file)
@@ -53,4 +53,4 @@ static inline int irq_to_gpio(unsigned int irq)
 
 #endif /* CONFIG_GPIOLIB */
 
-#endif /* _ASM_I386_GPIO_H */
+#endif /* ASM_X86__GPIO_H */
index 4f85f0f4b5631699e21f36016bb88ebe9b51a911..700fe230d9190dba5237d838581ec58485f793a7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_HARDIRQ_H
-#define __ASM_HARDIRQ_H
+#ifndef ASM_X86__HARDIRQ_32_H
+#define ASM_X86__HARDIRQ_32_H
 
 #include <linux/threads.h>
 #include <linux/irq.h>
@@ -25,4 +25,4 @@ DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
 void ack_bad_irq(unsigned int irq);
 #include <linux/irq_cpustat.h>
 
-#endif /* __ASM_HARDIRQ_H */
+#endif /* ASM_X86__HARDIRQ_32_H */
index 95d5e090ed89eb48d80a6c8b679db973c059d701..f8bd2919a8ce88bcb98d6b7f24f51ecfda429fcd 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_HARDIRQ_H
-#define __ASM_HARDIRQ_H
+#ifndef ASM_X86__HARDIRQ_64_H
+#define ASM_X86__HARDIRQ_64_H
 
 #include <linux/threads.h>
 #include <linux/irq.h>
@@ -20,4 +20,4 @@
 
 extern void ack_bad_irq(unsigned int irq);
 
-#endif /* __ASM_HARDIRQ_H */
+#endif /* ASM_X86__HARDIRQ_64_H */
index 4514b16cc7236b447444b30caf26c1a75196f498..bc3f6a280316d5c33f41f9f48f70606e3f096021 100644 (file)
@@ -15,8 +15,8 @@
  * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
  */
 
-#ifndef _ASM_HIGHMEM_H
-#define _ASM_HIGHMEM_H
+#ifndef ASM_X86__HIGHMEM_H
+#define ASM_X86__HIGHMEM_H
 
 #ifdef __KERNEL__
 
@@ -79,4 +79,4 @@ extern void add_highpages_with_active_regions(int nid, unsigned long start_pfn,
 
 #endif /* __KERNEL__ */
 
-#endif /* _ASM_HIGHMEM_H */
+#endif /* ASM_X86__HIGHMEM_H */
index 82f1ac641bd73214115fe7baff23e35153cfd5f0..cbbbb6d4dd32bb838462864da48b26b1becbcd2d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ASM_X86_HPET_H
-#define ASM_X86_HPET_H
+#ifndef ASM_X86__HPET_H
+#define ASM_X86__HPET_H
 
 #ifdef CONFIG_HPET_TIMER
 
@@ -90,4 +90,4 @@ static inline int is_hpet_enabled(void) { return 0; }
 #define hpet_readl(a) 0
 
 #endif
-#endif /* ASM_X86_HPET_H */
+#endif /* ASM_X86__HPET_H */
index 439a9acc132d10f77b469fc24b250f3acc2f51d9..0b7ec5dc08840df634deb5151e35279500a49577 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_HUGETLB_H
-#define _ASM_X86_HUGETLB_H
+#ifndef ASM_X86__HUGETLB_H
+#define ASM_X86__HUGETLB_H
 
 #include <asm/page.h>
 
@@ -90,4 +90,4 @@ static inline void arch_release_hugepage(struct page *page)
 {
 }
 
-#endif /* _ASM_X86_HUGETLB_H */
+#endif /* ASM_X86__HUGETLB_H */
index edd0b95f14d0df6dd9b4f4cfb01d02548d485c9b..65997b15d56a4b03d3f0c035051d088c01b1931d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_HW_IRQ_H
-#define _ASM_HW_IRQ_H
+#ifndef ASM_X86__HW_IRQ_H
+#define ASM_X86__HW_IRQ_H
 
 /*
  * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
@@ -93,6 +93,26 @@ extern asmlinkage void qic_reschedule_interrupt(void);
 extern asmlinkage void qic_enable_irq_interrupt(void);
 extern asmlinkage void qic_call_function_interrupt(void);
 
+/* SMP */
+extern void smp_apic_timer_interrupt(struct pt_regs *);
+#ifdef CONFIG_X86_32
+extern void smp_spurious_interrupt(struct pt_regs *);
+extern void smp_error_interrupt(struct pt_regs *);
+#else
+extern asmlinkage void smp_spurious_interrupt(void);
+extern asmlinkage void smp_error_interrupt(void);
+#endif
+#ifdef CONFIG_X86_SMP
+extern void smp_reschedule_interrupt(struct pt_regs *);
+extern void smp_call_function_interrupt(struct pt_regs *);
+extern void smp_call_function_single_interrupt(struct pt_regs *);
+#ifdef CONFIG_X86_32
+extern void smp_invalidate_interrupt(struct pt_regs *);
+#else
+extern asmlinkage void smp_invalidate_interrupt(struct pt_regs *);
+#endif
+#endif
+
 #ifdef CONFIG_X86_32
 extern void (*const interrupt[NR_IRQS])(void);
 #else
@@ -112,4 +132,4 @@ static inline void __setup_vector_irq(int cpu) {}
 
 #endif /* !ASSEMBLY_ */
 
-#endif
+#endif /* ASM_X86__HW_IRQ_H */
index d2bbd238b3e1718e261904d1a1fd14dbf6703175..cc011a3bc1c280a1b7fb44b8cce834100c675d37 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ASM_HYPERTRANSPORT_H
-#define ASM_HYPERTRANSPORT_H
+#ifndef ASM_X86__HYPERTRANSPORT_H
+#define ASM_X86__HYPERTRANSPORT_H
 
 /*
  * Constants for x86 Hypertransport Interrupts.
@@ -42,4 +42,4 @@
 #define HT_IRQ_HIGH_DEST_ID(v)                                         \
        ((((v) >> 8) << HT_IRQ_HIGH_DEST_ID_SHIFT) & HT_IRQ_HIGH_DEST_ID_MASK)
 
-#endif /* ASM_HYPERTRANSPORT_H */
+#endif /* ASM_X86__HYPERTRANSPORT_H */
index 56d00e31aec0064856fb0c04a80df039b037a30b..1ecdc3ed96e4ecf156c83cae583ad2779d96f8b9 100644 (file)
@@ -7,8 +7,8 @@
  * x86-64 work by Andi Kleen 2002
  */
 
-#ifndef _ASM_X86_I387_H
-#define _ASM_X86_I387_H
+#ifndef ASM_X86__I387_H
+#define ASM_X86__I387_H
 
 #include <linux/sched.h>
 #include <linux/kernel_stat.h>
@@ -25,6 +25,7 @@ extern void mxcsr_feature_mask_init(void);
 extern int init_fpu(struct task_struct *child);
 extern asmlinkage void math_state_restore(void);
 extern void init_thread_xstate(void);
+extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
 
 extern user_regset_active_fn fpregs_active, xfpregs_active;
 extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get;
@@ -336,4 +337,4 @@ static inline unsigned short get_fpu_mxcsr(struct task_struct *tsk)
        }
 }
 
-#endif /* _ASM_X86_I387_H */
+#endif /* ASM_X86__I387_H */
index b51c0487fc41d6aec43c7db474e80abd0330d50d..15a5b530044e85a56361f29c38ffd7eb75d1b38e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_I8253_H__
-#define __ASM_I8253_H__
+#ifndef ASM_X86__I8253_H
+#define ASM_X86__I8253_H
 
 /* i8253A PIT registers */
 #define PIT_MODE               0x43
@@ -15,4 +15,4 @@ extern void setup_pit_timer(void);
 #define inb_pit                inb_p
 #define outb_pit       outb_p
 
-#endif /* __ASM_I8253_H__ */
+#endif /* ASM_X86__I8253_H */
index 2f98df91f1f2bef9e7fc7bc47b3a42bbe14403d3..c586559a6957813187d9f4b8ecce0e14f35653a6 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_I8259_H__
-#define __ASM_I8259_H__
+#ifndef ASM_X86__I8259_H
+#define ASM_X86__I8259_H
 
 #include <linux/delay.h>
 
@@ -57,4 +57,4 @@ static inline void outb_pic(unsigned char value, unsigned int port)
 
 extern struct irq_chip i8259A_chip;
 
-#endif /* __ASM_I8259_H__ */
+#endif /* ASM_X86__I8259_H */
index 55d3abe5276f677c43b1840f3503c783b86217c8..f932f7ad51ddb1c11e6c121c2dd2021a60c8abf2 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_64_IA32_H
-#define _ASM_X86_64_IA32_H
+#ifndef ASM_X86__IA32_H
+#define ASM_X86__IA32_H
 
 
 #ifdef CONFIG_IA32_EMULATION
@@ -167,4 +167,4 @@ extern void ia32_pick_mmap_layout(struct mm_struct *mm);
 
 #endif /* !CONFIG_IA32_SUPPORT */
 
-#endif
+#endif /* ASM_X86__IA32_H */
index 61cea9e7c5c1b499dc67395b3d61ea18d54fee3f..dbd887d8a5a5846183fcd966feafbc73fedf3f2d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_64_IA32_UNISTD_H_
-#define _ASM_X86_64_IA32_UNISTD_H_
+#ifndef ASM_X86__IA32_UNISTD_H
+#define ASM_X86__IA32_UNISTD_H
 
 /*
  * This file contains the system call numbers of the ia32 port,
@@ -15,4 +15,4 @@
 #define __NR_ia32_sigreturn    119
 #define __NR_ia32_rt_sigreturn 173
 
-#endif /* _ASM_X86_64_IA32_UNISTD_H_ */
+#endif /* ASM_X86__IA32_UNISTD_H */
index d240e5b30a45d198acd26cf251c34930338d4e37..baa3f783d27dcb58c1de4fa66eb5f31deaecc872 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_64_IDLE_H
-#define _ASM_X86_64_IDLE_H 1
+#ifndef ASM_X86__IDLE_H
+#define ASM_X86__IDLE_H
 
 #define IDLE_START 1
 #define IDLE_END 2
@@ -10,4 +10,6 @@ void idle_notifier_register(struct notifier_block *n);
 void enter_idle(void);
 void exit_idle(void);
 
-#endif
+void c1e_remove_cpu(int cpu);
+
+#endif /* ASM_X86__IDLE_H */
index fa0fd068bc2e29aeaaad694db8c0e570c43c0df5..07c03c6c9a169cdb5eeeab1d840f1a61cef2052e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_INTEL_ARCH_PERFMON_H
-#define _ASM_X86_INTEL_ARCH_PERFMON_H
+#ifndef ASM_X86__INTEL_ARCH_PERFMON_H
+#define ASM_X86__INTEL_ARCH_PERFMON_H
 
 #define MSR_ARCH_PERFMON_PERFCTR0              0xc1
 #define MSR_ARCH_PERFMON_PERFCTR1              0xc2
@@ -28,4 +28,4 @@ union cpuid10_eax {
        unsigned int full;
 };
 
-#endif /* _ASM_X86_INTEL_ARCH_PERFMON_H */
+#endif /* ASM_X86__INTEL_ARCH_PERFMON_H */
index 0f954dc89cb3c537ebb444e402987616b0a9714b..72b7719523bfa9f26efc333ed0efb160ad37d997 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_IO_H
-#define _ASM_X86_IO_H
+#ifndef ASM_X86__IO_H
+#define ASM_X86__IO_H
 
 #define ARCH_HAS_IOREMAP_WC
 
@@ -73,6 +73,8 @@ build_mmio_write(__writeq, "q", unsigned long, "r", )
 #define writeq writeq
 #endif
 
+extern int iommu_bio_merge;
+
 #ifdef CONFIG_X86_32
 # include "io_32.h"
 #else
@@ -99,4 +101,4 @@ extern void early_iounmap(void *addr, unsigned long size);
 extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
 
 
-#endif /* _ASM_X86_IO_H */
+#endif /* ASM_X86__IO_H */
index e876d89ac15618f88ea4b624de64c6b1fc27e9cd..4f7d878bda1819a51541b67bda6dc7f4c53ac248 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_IO_H
-#define _ASM_IO_H
+#ifndef ASM_X86__IO_32_H
+#define ASM_X86__IO_32_H
 
 #include <linux/string.h>
 #include <linux/compiler.h>
@@ -281,4 +281,4 @@ BUILDIO(b, b, char)
 BUILDIO(w, w, short)
 BUILDIO(l, , int)
 
-#endif
+#endif /* ASM_X86__IO_32_H */
index 22995c5c5adc0d001bb40730fbeb15d47951ff01..64429e9431a8aef1089c25c8c00c18b64cd93663 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_IO_H
-#define _ASM_IO_H
+#ifndef ASM_X86__IO_64_H
+#define ASM_X86__IO_64_H
 
 
 /*
@@ -235,7 +235,6 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
 
 #define flush_write_buffers()
 
-extern int iommu_bio_merge;
 #define BIO_VMERGE_BOUNDARY iommu_bio_merge
 
 /*
@@ -245,4 +244,4 @@ extern int iommu_bio_merge;
 
 #endif /* __KERNEL__ */
 
-#endif
+#endif /* ASM_X86__IO_64_H */
index 14f82bbcb5fd6ee5d09f05be363651258ff4e9bb..be62847ab07eaa8b5d779ed5b9b0f6316f89c383 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_IO_APIC_H
-#define __ASM_IO_APIC_H
+#ifndef ASM_X86__IO_APIC_H
+#define ASM_X86__IO_APIC_H
 
 #include <linux/types.h>
 #include <asm/mpspec.h>
@@ -189,4 +189,4 @@ static const int timer_through_8259 = 0;
 static inline void ioapic_init_mappings(void) { }
 #endif
 
-#endif
+#endif /* ASM_X86__IO_APIC_H */
index c0c338bd40682e41e4699639794a301a87a3b3ae..33660351239968bd22205ed9e4b45e674bc67e96 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_IOCTLS_H
-#define _ASM_X86_IOCTLS_H
+#ifndef ASM_X86__IOCTLS_H
+#define ASM_X86__IOCTLS_H
 
 #include <asm/ioctl.h>
 
@@ -85,4 +85,4 @@
 
 #define TIOCSER_TEMT    0x01   /* Transmitter physically empty */
 
-#endif
+#endif /* ASM_X86__IOCTLS_H */
index 621a1af94c4c1bc0fc1840b1e4ac95c95364e7f6..546ad3110feaef59c2a607e98593d8e38f17b272 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X8664_IOMMU_H
-#define _ASM_X8664_IOMMU_H 1
+#ifndef ASM_X86__IOMMU_H
+#define ASM_X86__IOMMU_H
 
 extern void pci_iommu_shutdown(void);
 extern void no_iommu_init(void);
@@ -43,4 +43,4 @@ static inline void gart_iommu_hole_init(void)
 }
 #endif
 
-#endif
+#endif /* ASM_X86__IOMMU_H */
index ee678fd51594e5100d42e244433f3e8dc1c70690..910304fbdc8f289e7f92e37a4bd2089b540f585f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_IPCBUF_H
-#define _ASM_X86_IPCBUF_H
+#ifndef ASM_X86__IPCBUF_H
+#define ASM_X86__IPCBUF_H
 
 /*
  * The ipc64_perm structure for x86 architecture.
@@ -25,4 +25,4 @@ struct ipc64_perm {
        unsigned long           __unused2;
 };
 
-#endif /* _ASM_X86_IPCBUF_H */
+#endif /* ASM_X86__IPCBUF_H */
index bb1c09f7a76ced4cd028d631d79a13d0171e8c2c..c1b2267975181fb18da479d464fdea9096b80591 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_IPI_H
-#define __ASM_IPI_H
+#ifndef ASM_X86__IPI_H
+#define ASM_X86__IPI_H
 
 /*
  * Copyright 2004 James Cleverdon, IBM.
@@ -129,4 +129,4 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
        local_irq_restore(flags);
 }
 
-#endif /* __ASM_IPI_H */
+#endif /* ASM_X86__IPI_H */
index 1a292575731745bdc9c5734adb426220eac6649c..1e5f2909c1db8c7db9330412444cafb07c0d1149 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_IRQ_H
-#define _ASM_IRQ_H
+#ifndef ASM_X86__IRQ_H
+#define ASM_X86__IRQ_H
 /*
  *     (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
  *
@@ -47,4 +47,4 @@ extern void native_init_IRQ(void);
 /* Interrupt vector management */
 extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
 
-#endif /* _ASM_IRQ_H */
+#endif /* ASM_X86__IRQ_H */
index 3368b20c0b489fa04b46070d53aecaaeb8dc01e0..316a3b2588715cd0cec869c51eaa4f6774972c64 100644 (file)
@@ -4,8 +4,8 @@
  *
  * Jeremy Fitzhardinge <jeremy@goop.org>
  */
-#ifndef _ASM_I386_IRQ_REGS_H
-#define _ASM_I386_IRQ_REGS_H
+#ifndef ASM_X86__IRQ_REGS_32_H
+#define ASM_X86__IRQ_REGS_32_H
 
 #include <asm/percpu.h>
 
@@ -26,4 +26,4 @@ static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs)
        return old_regs;
 }
 
-#endif /* _ASM_I386_IRQ_REGS_H */
+#endif /* ASM_X86__IRQ_REGS_32_H */
index a48c7f2dbdc04b32f010fbc6267b7a479f37e578..c5d2d767a1f356366e7ee57716ffd057ff3deb4a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_IRQ_VECTORS_H
-#define _ASM_IRQ_VECTORS_H
+#ifndef ASM_X86__IRQ_VECTORS_H
+#define ASM_X86__IRQ_VECTORS_H
 
 #include <linux/threads.h>
 
 #define VIC_CPU_BOOT_ERRATA_CPI                (VIC_CPI_LEVEL0 + 8)
 
 
-#endif /* _ASM_IRQ_VECTORS_H */
+#endif /* ASM_X86__IRQ_VECTORS_H */
index 6ec6ceed95a718ec9d3c91f6004a459781dee74b..35a2fe9bc9212f799d3f3c2797af33d65b11eacd 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_IST_H
-#define _ASM_IST_H
+#ifndef ASM_X86__IST_H
+#define ASM_X86__IST_H
 
 /*
  * Include file for the interface to IST BIOS
@@ -31,4 +31,4 @@ struct ist_info {
 extern struct ist_info ist_info;
 
 #endif /* __KERNEL__ */
-#endif /* _ASM_IST_H */
+#endif /* ASM_X86__IST_H */
index 452e2b696ff48ef2cdf26175572dde1132a175cf..2bbaf4370a553b7aa6cff16b61c9f1f39e8b1009 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_K8_H
-#define _ASM_K8_H 1
+#ifndef ASM_X86__K8_H
+#define ASM_X86__K8_H
 
 #include <linux/pci.h>
 
@@ -12,4 +12,4 @@ extern int cache_k8_northbridges(void);
 extern void k8_flush_garts(void);
 extern int k8_scan_nodes(unsigned long start, unsigned long end);
 
-#endif
+#endif /* ASM_X86__K8_H */
index 96651bb59ba18c6f8506d985f9c98a757617a338..5ec3ad3e825c4dadfcbcff6b6f9c880f6ec02c7a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_KDEBUG_H
-#define _ASM_X86_KDEBUG_H
+#ifndef ASM_X86__KDEBUG_H
+#define ASM_X86__KDEBUG_H
 
 #include <linux/notifier.h>
 
@@ -35,4 +35,4 @@ extern void show_regs(struct pt_regs *regs);
 extern unsigned long oops_begin(void);
 extern void oops_end(unsigned long, struct pt_regs *, int signr);
 
-#endif
+#endif /* ASM_X86__KDEBUG_H */
index 4246ab7dc9887b58e898569a6173eeb15d3437a9..ea09600d6129543392b09936962a873e4e2ac622 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _KEXEC_H
-#define _KEXEC_H
+#ifndef ASM_X86__KEXEC_H
+#define ASM_X86__KEXEC_H
 
 #ifdef CONFIG_X86_32
 # define PA_CONTROL_PAGE       0
@@ -172,4 +172,4 @@ relocate_kernel(unsigned long indirection_page,
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* _KEXEC_H */
+#endif /* ASM_X86__KEXEC_H */
index 484c47554f3bc6e76db3eafdb5443c2cda0ba55b..d283863354de7279ce915bb0905680991b1ec250 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_KGDB_H_
-#define _ASM_KGDB_H_
+#ifndef ASM_X86__KGDB_H
+#define ASM_X86__KGDB_H
 
 /*
  * Copyright (C) 2001-2004 Amit S. Kale
@@ -39,12 +39,13 @@ enum regnames {
        GDB_FS,                 /* 14 */
        GDB_GS,                 /* 15 */
 };
+#define NUMREGBYTES            ((GDB_GS+1)*4)
 #else /* ! CONFIG_X86_32 */
-enum regnames {
+enum regnames64 {
        GDB_AX,                 /* 0 */
-       GDB_DX,                 /* 1 */
+       GDB_BX,                 /* 1 */
        GDB_CX,                 /* 2 */
-       GDB_BX,                 /* 3 */
+       GDB_DX,                 /* 3 */
        GDB_SI,                 /* 4 */
        GDB_DI,                 /* 5 */
        GDB_BP,                 /* 6 */
@@ -58,18 +59,15 @@ enum regnames {
        GDB_R14,                /* 14 */
        GDB_R15,                /* 15 */
        GDB_PC,                 /* 16 */
-       GDB_PS,                 /* 17 */
 };
-#endif /* CONFIG_X86_32 */
 
-/*
- * Number of bytes of registers:
- */
-#ifdef CONFIG_X86_32
-# define NUMREGBYTES           64
-#else
-# define NUMREGBYTES           ((GDB_PS+1)*8)
-#endif
+enum regnames32 {
+       GDB_PS = 34,
+       GDB_CS,
+       GDB_SS,
+};
+#define NUMREGBYTES            ((GDB_SS+1)*4)
+#endif /* CONFIG_X86_32 */
 
 static inline void arch_kgdb_breakpoint(void)
 {
@@ -78,4 +76,4 @@ static inline void arch_kgdb_breakpoint(void)
 #define BREAK_INSTR_SIZE       1
 #define CACHE_FLUSH_IS_SAFE    1
 
-#endif                         /* _ASM_KGDB_H_ */
+#endif /* ASM_X86__KGDB_H */
index 5f4174132a222a34d453b2fb915a0993a6e923be..89f44493e6432ad192fa65faeac1b46c93ce6eb6 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_KMAP_TYPES_H
-#define _ASM_X86_KMAP_TYPES_H
+#ifndef ASM_X86__KMAP_TYPES_H
+#define ASM_X86__KMAP_TYPES_H
 
 #if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM)
 # define D(n) __KM_FENCE_##n ,
@@ -26,4 +26,4 @@ D(13) KM_TYPE_NR
 
 #undef D
 
-#endif
+#endif /* ASM_X86__KMAP_TYPES_H */
index 54980b0b38925ade9c59799f906234e313b3237c..bd8407863c13127f1ed7ce1384fce4086e135022 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_KPROBES_H
-#define _ASM_KPROBES_H
+#ifndef ASM_X86__KPROBES_H
+#define ASM_X86__KPROBES_H
 /*
  *  Kernel Probes (KProbes)
  *
@@ -94,4 +94,4 @@ static inline void restore_interrupts(struct pt_regs *regs)
 extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
 extern int kprobe_exceptions_notify(struct notifier_block *self,
                                    unsigned long val, void *data);
-#endif                         /* _ASM_KPROBES_H */
+#endif /* ASM_X86__KPROBES_H */
index 6f1840812e595f05b7d5a064412e05d7e756b1cc..78e954db1e7f60066ea2cd232bf4d38a99821e57 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __LINUX_KVM_X86_H
-#define __LINUX_KVM_X86_H
+#ifndef ASM_X86__KVM_H
+#define ASM_X86__KVM_H
 
 /*
  * KVM x86 specific structures and definitions
@@ -230,4 +230,4 @@ struct kvm_pit_state {
 #define KVM_TRC_APIC_ACCESS      (KVM_TRC_HANDLER + 0x14)
 #define KVM_TRC_TDP_FAULT        (KVM_TRC_HANDLER + 0x15)
 
-#endif
+#endif /* ASM_X86__KVM_H */
index c2e34c27590066e4cf3359b78c1805d6c02805fc..69794547f514f5f249b65acf55ba8d5fd5c12685 100644 (file)
@@ -1,4 +1,4 @@
-#/*
+/*
  * Kernel-based Virtual Machine driver for Linux
  *
  * This header defines architecture specific interfaces, x86 version
@@ -8,8 +8,8 @@
  *
  */
 
-#ifndef ASM_KVM_HOST_H
-#define ASM_KVM_HOST_H
+#ifndef ASM_X86__KVM_HOST_H
+#define ASM_X86__KVM_HOST_H
 
 #include <linux/types.h>
 #include <linux/mm.h>
@@ -735,4 +735,4 @@ asmlinkage void kvm_handle_fault_on_reboot(void);
 int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
 int kvm_age_hva(struct kvm *kvm, unsigned long hva);
 
-#endif
+#endif /* ASM_X86__KVM_HOST_H */
index 76f392146daa46304adfb404874164a7a628010d..30054fded4fbbe325271e9ca2db0424eb3ebbdde 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __X86_KVM_PARA_H
-#define __X86_KVM_PARA_H
+#ifndef ASM_X86__KVM_PARA_H
+#define ASM_X86__KVM_PARA_H
 
 /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It
  * should be used to determine that a VM is running under KVM.
@@ -144,4 +144,4 @@ static inline unsigned int kvm_arch_para_features(void)
 
 #endif
 
-#endif
+#endif /* ASM_X86__KVM_PARA_H */
index 4e8c1e48d91daf5c8e73e9d3441a73e70539c000..e2d9b030c1ac9460297c34c08a1e796b13afa85c 100644 (file)
@@ -8,8 +8,8 @@
  * From: xen-unstable 10676:af9809f51f81a3c43f276f00c81a52ef558afda4
  */
 
-#ifndef __X86_EMULATE_H__
-#define __X86_EMULATE_H__
+#ifndef ASM_X86__KVM_X86_EMULATE_H
+#define ASM_X86__KVM_X86_EMULATE_H
 
 struct x86_emulate_ctxt;
 
@@ -181,4 +181,4 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt,
 int x86_emulate_insn(struct x86_emulate_ctxt *ctxt,
                     struct x86_emulate_ops *ops);
 
-#endif                         /* __X86_EMULATE_H__ */
+#endif /* ASM_X86__KVM_X86_EMULATE_H */
index 20c597242b53db0038fbf4efe7403b8425c7e16f..a5228504d867e68045b52f6a514b8f2130efacec 100644 (file)
@@ -3,8 +3,8 @@
  *
  * Definitions of structures used with the modify_ldt system call.
  */
-#ifndef _ASM_X86_LDT_H
-#define _ASM_X86_LDT_H
+#ifndef ASM_X86__LDT_H
+#define ASM_X86__LDT_H
 
 /* Maximum number of LDT entries supported. */
 #define LDT_ENTRIES    8192
@@ -37,4 +37,4 @@ struct user_desc {
 #define MODIFY_LDT_CONTENTS_CODE       2
 
 #endif /* !__ASSEMBLY__ */
-#endif
+#endif /* ASM_X86__LDT_H */
index be4a7247fa2b3ea44c07332bf76436d0cb6cc7df..7505e947ed2719a32a91c53a52598905a63818e4 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _X86_LGUEST_H
-#define _X86_LGUEST_H
+#ifndef ASM_X86__LGUEST_H
+#define ASM_X86__LGUEST_H
 
 #define GDT_ENTRY_LGUEST_CS    10
 #define GDT_ENTRY_LGUEST_DS    11
@@ -91,4 +91,4 @@ static inline void lguest_set_ts(void)
 
 #endif /* __ASSEMBLY__ */
 
-#endif
+#endif /* ASM_X86__LGUEST_H */
index a3241f28e34a51e469c77251200915567c8ade42..8f034ba4b53ebf1b3e6df32be9e5252ccf433f76 100644 (file)
@@ -1,6 +1,6 @@
 /* Architecture specific portion of the lguest hypercalls */
-#ifndef _X86_LGUEST_HCALL_H
-#define _X86_LGUEST_HCALL_H
+#ifndef ASM_X86__LGUEST_HCALL_H
+#define ASM_X86__LGUEST_HCALL_H
 
 #define LHCALL_FLUSH_ASYNC     0
 #define LHCALL_LGUEST_INIT     1
@@ -68,4 +68,4 @@ struct hcall_args {
 };
 
 #endif /* !__ASSEMBLY__ */
-#endif /* _I386_LGUEST_HCALL_H */
+#endif /* ASM_X86__LGUEST_HCALL_H */
index 64e444f8e85b2d9fccaf50cc78ceaa1da0654877..42d8b62ee8abe72e842c55a3c337d0e947802561 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_LINKAGE_H
-#define __ASM_LINKAGE_H
+#ifndef ASM_X86__LINKAGE_H
+#define ASM_X86__LINKAGE_H
 
 #undef notrace
 #define notrace __attribute__((no_instrument_function))
@@ -57,5 +57,5 @@
 #define __ALIGN_STR ".align 16,0x90"
 #endif
 
-#endif
+#endif /* ASM_X86__LINKAGE_H */
 
index 330a72496abd94f9eb85cce30f8ae590b1b57e18..ae91994fd6c91dc607251a31d5e2df0db6d8f6af 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ARCH_LOCAL_H
-#define _ARCH_LOCAL_H
+#ifndef ASM_X86__LOCAL_H
+#define ASM_X86__LOCAL_H
 
 #include <linux/percpu.h>
 
@@ -232,4 +232,4 @@ static inline long local_sub_return(long i, local_t *l)
 #define __cpu_local_add(i, l)  cpu_local_add((i), (l))
 #define __cpu_local_sub(i, l)  cpu_local_sub((i), (l))
 
-#endif /* _ARCH_LOCAL_H */
+#endif /* ASM_X86__LOCAL_H */
index c3b9dc6970c95726a3adaafe5502334b9d64c68c..05362d44a3ee58f6f43b9eba015b9d3809a0ec88 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APIC_H
-#define __ASM_MACH_APIC_H
+#ifndef ASM_X86__MACH_BIGSMP__MACH_APIC_H
+#define ASM_X86__MACH_BIGSMP__MACH_APIC_H
 
 #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu))
 #define esr_disable (1)
@@ -141,4 +141,4 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
        return cpuid_apic >> index_msb;
 }
 
-#endif /* __ASM_MACH_APIC_H */
+#endif /* ASM_X86__MACH_BIGSMP__MACH_APIC_H */
index a58ab5a75c8c57c5743a15f4f0fc1587f182a492..811935d9d49b6d17d625fecd1731ebc9fb947335 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APICDEF_H
-#define __ASM_MACH_APICDEF_H
+#ifndef ASM_X86__MACH_BIGSMP__MACH_APICDEF_H
+#define ASM_X86__MACH_BIGSMP__MACH_APICDEF_H
 
 #define                APIC_ID_MASK            (0xFF<<24)
 
@@ -10,4 +10,4 @@ static inline unsigned get_apic_id(unsigned long x)
 
 #define                GET_APIC_ID(x)  get_apic_id(x)
 
-#endif
+#endif /* ASM_X86__MACH_BIGSMP__MACH_APICDEF_H */
index 9404c535b7ecbbf6f496d0cd80f4eb266a529208..b1b0f966a0099105573742db4e5ee47e94bfedc7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_IPI_H
-#define __ASM_MACH_IPI_H
+#ifndef ASM_X86__MACH_BIGSMP__MACH_IPI_H
+#define ASM_X86__MACH_BIGSMP__MACH_IPI_H
 
 void send_IPI_mask_sequence(cpumask_t mask, int vector);
 
@@ -22,4 +22,4 @@ static inline void send_IPI_all(int vector)
        send_IPI_mask(cpu_online_map, vector);
 }
 
-#endif /* __ASM_MACH_IPI_H */
+#endif /* ASM_X86__MACH_BIGSMP__MACH_IPI_H */
index 989f34c37d321249f838efe86d4e9c2086b42233..2aa61b54fbd576f7c353eb4738904694e0844633 100644 (file)
@@ -3,8 +3,8 @@
  *  Split out from apm.c by Osamu Tomita <tomita@cinet.co.jp>
  */
 
-#ifndef _ASM_APM_H
-#define _ASM_APM_H
+#ifndef ASM_X86__MACH_DEFAULT__APM_H
+#define ASM_X86__MACH_DEFAULT__APM_H
 
 #ifdef APM_ZERO_SEGS
 #      define APM_DO_ZERO_SEGS \
@@ -70,4 +70,4 @@ static inline u8 apm_bios_call_simple_asm(u32 func, u32 ebx_in,
        return error;
 }
 
-#endif /* _ASM_APM_H */
+#endif /* ASM_X86__MACH_DEFAULT__APM_H */
index f3226b9a6b823459935a4de2c5b8e82165776e57..b615f40736be123e56a959aca3e7867a925162c7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APIC_H
-#define __ASM_MACH_APIC_H
+#ifndef ASM_X86__MACH_DEFAULT__MACH_APIC_H
+#define ASM_X86__MACH_DEFAULT__MACH_APIC_H
 
 #ifdef CONFIG_X86_LOCAL_APIC
 
@@ -138,4 +138,4 @@ static inline void enable_apic_mode(void)
 }
 
 #endif /* CONFIG_X86_LOCAL_APIC */
-#endif /* __ASM_MACH_APIC_H */
+#endif /* ASM_X86__MACH_DEFAULT__MACH_APIC_H */
index e4b29ba37de604894bae11681a9236bd64c041e7..936704f816d688601713d3e1998f8226bb1fb03b 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APICDEF_H
-#define __ASM_MACH_APICDEF_H
+#ifndef ASM_X86__MACH_DEFAULT__MACH_APICDEF_H
+#define ASM_X86__MACH_DEFAULT__MACH_APICDEF_H
 
 #include <asm/apic.h>
 
@@ -21,4 +21,4 @@ static inline unsigned get_apic_id(unsigned long x)
 #define                GET_APIC_ID(x)  get_apic_id(x)
 #endif
 
-#endif
+#endif /* ASM_X86__MACH_DEFAULT__MACH_APICDEF_H */
index be323364e68f6d7522194f7b2d2941df8edd6d19..674bc7e50c356250348c5341a6aba2a9167920a1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_IPI_H
-#define __ASM_MACH_IPI_H
+#ifndef ASM_X86__MACH_DEFAULT__MACH_IPI_H
+#define ASM_X86__MACH_DEFAULT__MACH_IPI_H
 
 /* Avoid include hell */
 #define NMI_VECTOR 0x02
@@ -61,4 +61,4 @@ static inline void send_IPI_all(int vector)
 }
 #endif
 
-#endif /* __ASM_MACH_IPI_H */
+#endif /* ASM_X86__MACH_DEFAULT__MACH_IPI_H */
index d14108505bb8905401f61ddab7f93fd34c3ce533..9c381f2815acb9752359d1538e662ff2966bc50f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_MPPARSE_H
-#define __ASM_MACH_MPPARSE_H
+#ifndef ASM_X86__MACH_DEFAULT__MACH_MPPARSE_H
+#define ASM_X86__MACH_DEFAULT__MACH_MPPARSE_H
 
 static inline int mps_oem_check(struct mp_config_table *mpc, char *oem, 
                char *productid)
@@ -14,4 +14,4 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 }
 
 
-#endif /* __ASM_MACH_MPPARSE_H */
+#endif /* ASM_X86__MACH_DEFAULT__MACH_MPPARSE_H */
index 51c9a977593289a2c72452a0b2a44504a7353189..d77646f011f1bb1dfce06bce8b63732898490804 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_MPSPEC_H
-#define __ASM_MACH_MPSPEC_H
+#ifndef ASM_X86__MACH_DEFAULT__MACH_MPSPEC_H
+#define ASM_X86__MACH_DEFAULT__MACH_MPSPEC_H
 
 #define MAX_IRQ_SOURCES 256
 
@@ -9,4 +9,4 @@
 #define MAX_MP_BUSSES 32
 #endif
 
-#endif /* __ASM_MACH_MPSPEC_H */
+#endif /* ASM_X86__MACH_DEFAULT__MACH_MPSPEC_H */
index 4b76e536cd986307b071c8c11d2bff4c30b4112f..990b15833834bf861ceef35d810d4adaa899a84d 100644 (file)
@@ -10,8 +10,8 @@
  * directly because of the awkward 8-bit access mechanism of the 82C54
  * device.
  */
-#ifndef _MACH_TIMER_H
-#define _MACH_TIMER_H
+#ifndef ASM_X86__MACH_DEFAULT__MACH_TIMER_H
+#define ASM_X86__MACH_DEFAULT__MACH_TIMER_H
 
 #define CALIBRATE_TIME_MSEC 30 /* 30 msecs */
 #define CALIBRATE_LATCH        \
@@ -45,4 +45,4 @@ static inline void mach_countup(unsigned long *count_p)
        *count_p = count;
 }
 
-#endif /* !_MACH_TIMER_H */
+#endif /* ASM_X86__MACH_DEFAULT__MACH_TIMER_H */
index 2fe7705c0484ed074a5d0b2f9e2bf7acc88cd7cf..de9ac3f5c4ce547c2a204cac41c4010da2839fe7 100644 (file)
@@ -2,8 +2,8 @@
  *  Machine specific NMI handling for generic.
  *  Split out from traps.c by Osamu Tomita <tomita@cinet.co.jp>
  */
-#ifndef _MACH_TRAPS_H
-#define _MACH_TRAPS_H
+#ifndef ASM_X86__MACH_DEFAULT__MACH_TRAPS_H
+#define ASM_X86__MACH_DEFAULT__MACH_TRAPS_H
 
 #include <asm/mc146818rtc.h>
 
@@ -36,4 +36,4 @@ static inline void reassert_nmi(void)
                unlock_cmos();
 }
 
-#endif /* !_MACH_TRAPS_H */
+#endif /* ASM_X86__MACH_DEFAULT__MACH_TRAPS_H */
index 3ebb17893aa524d49d4bcdec543148ee7e72a326..361b810f5160a2e5a02e8ea66c365a9dc0abd0f1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_WAKECPU_H
-#define __ASM_MACH_WAKECPU_H
+#ifndef ASM_X86__MACH_DEFAULT__MACH_WAKECPU_H
+#define ASM_X86__MACH_DEFAULT__MACH_WAKECPU_H
 
 /* 
  * This file copes with machines that wakeup secondary CPUs by the
@@ -39,4 +39,4 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
  #define inquire_remote_apic(apicid) {}
 #endif
 
-#endif /* __ASM_MACH_WAKECPU_H */
+#endif /* ASM_X86__MACH_DEFAULT__MACH_WAKECPU_H */
index 0a3fdf93067253e448ffa6a39ca8bcc0d1c0ed90..c1f6f682d61907ece9e20f19d25c59f019e436fc 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APIC_H
-#define __ASM_MACH_APIC_H
+#ifndef ASM_X86__MACH_ES7000__MACH_APIC_H
+#define ASM_X86__MACH_ES7000__MACH_APIC_H
 
 #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu)
 #define esr_disable (1)
@@ -191,4 +191,4 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
        return cpuid_apic >> index_msb;
 }
 
-#endif /* __ASM_MACH_APIC_H */
+#endif /* ASM_X86__MACH_ES7000__MACH_APIC_H */
index a58ab5a75c8c57c5743a15f4f0fc1587f182a492..a07e56744028b4f9ff327934448f0099ea7b85ef 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APICDEF_H
-#define __ASM_MACH_APICDEF_H
+#ifndef ASM_X86__MACH_ES7000__MACH_APICDEF_H
+#define ASM_X86__MACH_ES7000__MACH_APICDEF_H
 
 #define                APIC_ID_MASK            (0xFF<<24)
 
@@ -10,4 +10,4 @@ static inline unsigned get_apic_id(unsigned long x)
 
 #define                GET_APIC_ID(x)  get_apic_id(x)
 
-#endif
+#endif /* ASM_X86__MACH_ES7000__MACH_APICDEF_H */
index 5e61bd220b06c3b8b5f0a816c02d5ecc592e7145..3a21240e03dc6fba203762e764af4675749175ee 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_IPI_H
-#define __ASM_MACH_IPI_H
+#ifndef ASM_X86__MACH_ES7000__MACH_IPI_H
+#define ASM_X86__MACH_ES7000__MACH_IPI_H
 
 void send_IPI_mask_sequence(cpumask_t mask, int vector);
 
@@ -21,4 +21,4 @@ static inline void send_IPI_all(int vector)
        send_IPI_mask(cpu_online_map, vector);
 }
 
-#endif /* __ASM_MACH_IPI_H */
+#endif /* ASM_X86__MACH_ES7000__MACH_IPI_H */
index ef26d3523625451c38eeaded73228869cf737a2b..befde24705b7b91bc631f7ca06d1403095f0a642 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_MPPARSE_H
-#define __ASM_MACH_MPPARSE_H
+#ifndef ASM_X86__MACH_ES7000__MACH_MPPARSE_H
+#define ASM_X86__MACH_ES7000__MACH_MPPARSE_H
 
 #include <linux/acpi.h>
 
@@ -26,4 +26,4 @@ static inline int es7000_check_dsdt(void)
 }
 #endif
 
-#endif /* __ASM_MACH_MPPARSE_H */
+#endif /* ASM_X86__MACH_ES7000__MACH_MPPARSE_H */
index 84ff58314501cfa3c83cf4a7024ad19ec00f9fa9..97c776ce13f2c11396c75ac1410196d49a321007 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_WAKECPU_H
-#define __ASM_MACH_WAKECPU_H
+#ifndef ASM_X86__MACH_ES7000__MACH_WAKECPU_H
+#define ASM_X86__MACH_ES7000__MACH_WAKECPU_H
 
 /* 
  * This file copes with machines that wakeup secondary CPUs by the
@@ -56,4 +56,4 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
  #define inquire_remote_apic(apicid) {}
 #endif
 
-#endif /* __ASM_MACH_WAKECPU_H */
+#endif /* ASM_X86__MACH_ES7000__MACH_WAKECPU_H */
index 5305dcb96df270f511ce44bd953fc62e2c15e489..6ce0f7786ef8bebfe8ef51414de7553c908a6fd7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_GENERIC_GPIO_H
-#define __ASM_MACH_GENERIC_GPIO_H
+#ifndef ASM_X86__MACH_GENERIC__GPIO_H
+#define ASM_X86__MACH_GENERIC__GPIO_H
 
 int gpio_request(unsigned gpio, const char *label);
 void gpio_free(unsigned gpio);
@@ -12,4 +12,4 @@ int irq_to_gpio(unsigned irq);
 
 #include <asm-generic/gpio.h>           /* cansleep wrappers */
 
-#endif /* __ASM_MACH_GENERIC_GPIO_H */
+#endif /* ASM_X86__MACH_GENERIC__GPIO_H */
index 890ce3f5e09a7fbd89590fc7490627b0a807f986..f7870e1a220d535bbccd798dd994506c095aabe4 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_IRQ_VECTORS_LIMITS_H
-#define _ASM_IRQ_VECTORS_LIMITS_H
+#ifndef ASM_X86__MACH_GENERIC__IRQ_VECTORS_LIMITS_H
+#define ASM_X86__MACH_GENERIC__IRQ_VECTORS_LIMITS_H
 
 /*
  * For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs,
@@ -11,4 +11,4 @@
 #define NR_IRQS        224
 #define NR_IRQ_VECTORS 1024
 
-#endif /* _ASM_IRQ_VECTORS_LIMITS_H */
+#endif /* ASM_X86__MACH_GENERIC__IRQ_VECTORS_LIMITS_H */
index 6eff343e12338f892693fa667ea25105f2ff7da9..5d010c6881dddc51bb9ad2a59503c79ad2837b14 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APIC_H
-#define __ASM_MACH_APIC_H
+#ifndef ASM_X86__MACH_GENERIC__MACH_APIC_H
+#define ASM_X86__MACH_GENERIC__MACH_APIC_H
 
 #include <asm/genapic.h>
 
@@ -29,4 +29,4 @@
 
 extern void generic_bigsmp_probe(void);
 
-#endif /* __ASM_MACH_APIC_H */
+#endif /* ASM_X86__MACH_GENERIC__MACH_APIC_H */
index 28ed98972ca84a98fbdd2a38dceb8dbdb94e5ca9..1657f38b8f27e184bb930a24eb3b992eaf548bbb 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _GENAPIC_MACH_APICDEF_H
-#define _GENAPIC_MACH_APICDEF_H 1
+#ifndef ASM_X86__MACH_GENERIC__MACH_APICDEF_H
+#define ASM_X86__MACH_GENERIC__MACH_APICDEF_H
 
 #ifndef APIC_DEFINITION
 #include <asm/genapic.h>
@@ -8,4 +8,4 @@
 #define APIC_ID_MASK (genapic->apic_id_mask)
 #endif
 
-#endif
+#endif /* ASM_X86__MACH_GENERIC__MACH_APICDEF_H */
index 441b0fe3ed1d8142cb0ef503b5a58718f90b8137..f67433dbd65f9f85b549ee4e34efdf68385725f3 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _MACH_IPI_H
-#define _MACH_IPI_H 1
+#ifndef ASM_X86__MACH_GENERIC__MACH_IPI_H
+#define ASM_X86__MACH_GENERIC__MACH_IPI_H
 
 #include <asm/genapic.h>
 
@@ -7,4 +7,4 @@
 #define send_IPI_allbutself (genapic->send_IPI_allbutself)
 #define send_IPI_all (genapic->send_IPI_all)
 
-#endif
+#endif /* ASM_X86__MACH_GENERIC__MACH_IPI_H */
index 586cadbf3787ce9c98449921db1c14c942d418bc..3115564e557cfd6d6b25f6ea02bb585d17121e43 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _MACH_MPPARSE_H
-#define _MACH_MPPARSE_H 1
+#ifndef ASM_X86__MACH_GENERIC__MACH_MPPARSE_H
+#define ASM_X86__MACH_GENERIC__MACH_MPPARSE_H
 
 
 extern int mps_oem_check(struct mp_config_table *mpc, char *oem,
@@ -7,4 +7,4 @@ extern int mps_oem_check(struct mp_config_table *mpc, char *oem,
 
 extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id);
 
-#endif
+#endif /* ASM_X86__MACH_GENERIC__MACH_MPPARSE_H */
index c83c120be538504f5139228bc53182e3040f43ea..6061b153613e32ec75d0cf983091aa13dbea31d5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_MPSPEC_H
-#define __ASM_MACH_MPSPEC_H
+#ifndef ASM_X86__MACH_GENERIC__MACH_MPSPEC_H
+#define ASM_X86__MACH_GENERIC__MACH_MPSPEC_H
 
 #define MAX_IRQ_SOURCES 256
 
@@ -9,4 +9,4 @@
 
 extern void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem,
                                char *productid);
-#endif /* __ASM_MACH_MPSPEC_H */
+#endif /* ASM_X86__MACH_GENERIC__MACH_MPSPEC_H */
index d802465e026a4a5adb6834f90c0ea74caa672617..7a0d39edfcfa628151c94947340eab6ef648aaf9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APIC_H
-#define __ASM_MACH_APIC_H
+#ifndef ASM_X86__MACH_NUMAQ__MACH_APIC_H
+#define ASM_X86__MACH_NUMAQ__MACH_APIC_H
 
 #include <asm/io.h>
 #include <linux/mmzone.h>
@@ -135,4 +135,4 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
        return cpuid_apic >> index_msb;
 }
 
-#endif /* __ASM_MACH_APIC_H */
+#endif /* ASM_X86__MACH_NUMAQ__MACH_APIC_H */
index bf439d0690f54e0c74a7fdf70c9a1cbf900d691d..f870ec5f77822d2358fec94b65e6c8650219037b 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APICDEF_H
-#define __ASM_MACH_APICDEF_H
+#ifndef ASM_X86__MACH_NUMAQ__MACH_APICDEF_H
+#define ASM_X86__MACH_NUMAQ__MACH_APICDEF_H
 
 
 #define APIC_ID_MASK (0xF<<24)
@@ -11,4 +11,4 @@ static inline unsigned get_apic_id(unsigned long x)
 
 #define         GET_APIC_ID(x)  get_apic_id(x)
 
-#endif
+#endif /* ASM_X86__MACH_NUMAQ__MACH_APICDEF_H */
index c6044488e9e6085a971c7a59640a56adefe22d7b..1e835823f4bc6f88fa89292b72af44859f464ad1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_IPI_H
-#define __ASM_MACH_IPI_H
+#ifndef ASM_X86__MACH_NUMAQ__MACH_IPI_H
+#define ASM_X86__MACH_NUMAQ__MACH_IPI_H
 
 void send_IPI_mask_sequence(cpumask_t, int vector);
 
@@ -22,4 +22,4 @@ static inline void send_IPI_all(int vector)
        send_IPI_mask(cpu_online_map, vector);
 }
 
-#endif /* __ASM_MACH_IPI_H */
+#endif /* ASM_X86__MACH_NUMAQ__MACH_IPI_H */
index 626aef6b155f1498eee4ab3594eab6a4adeee00d..74ade184920b0be727db25d2e2802ca17ec17aeb 100644 (file)
@@ -1,7 +1,7 @@
-#ifndef __ASM_MACH_MPPARSE_H
-#define __ASM_MACH_MPPARSE_H
+#ifndef ASM_X86__MACH_NUMAQ__MACH_MPPARSE_H
+#define ASM_X86__MACH_NUMAQ__MACH_MPPARSE_H
 
 extern void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem,
                                char *productid);
 
-#endif /* __ASM_MACH_MPPARSE_H */
+#endif /* ASM_X86__MACH_NUMAQ__MACH_MPPARSE_H */
index 00530041a991569f35e0da1fdd298bd96b8e6786..0db8cea643c02ba346085f92d42c5bfbc56419c1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_WAKECPU_H
-#define __ASM_MACH_WAKECPU_H
+#ifndef ASM_X86__MACH_NUMAQ__MACH_WAKECPU_H
+#define ASM_X86__MACH_NUMAQ__MACH_WAKECPU_H
 
 /* This file copes with machines that wakeup secondary CPUs by NMIs */
 
@@ -40,4 +40,4 @@ static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
 
 #define inquire_remote_apic(apicid) {}
 
-#endif /* __ASM_MACH_WAKECPU_H */
+#endif /* ASM_X86__MACH_NUMAQ__MACH_WAKECPU_H */
index acce0b7d397bb2465ee89beb6e8a7d817bccbc7a..94b6cdf532e207f210fffa131dfd34e2fa82e414 100644 (file)
@@ -1,5 +1,7 @@
-#ifndef _RDC321X_GPIO_H
-#define _RDC321X_GPIO_H
+#ifndef ASM_X86__MACH_RDC321X__GPIO_H
+#define ASM_X86__MACH_RDC321X__GPIO_H
+
+#include <linux/kernel.h>
 
 extern int rdc_gpio_get_value(unsigned gpio);
 extern void rdc_gpio_set_value(unsigned gpio, int value);
@@ -18,6 +20,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+       might_sleep();
        rdc_gpio_free(gpio);
 }
 
@@ -54,4 +57,4 @@ static inline int irq_to_gpio(unsigned irq)
 /* For cansleep */
 #include <asm-generic/gpio.h>
 
-#endif /* _RDC321X_GPIO_H_ */
+#endif /* ASM_X86__MACH_RDC321X__GPIO_H */
index 890ce3f5e09a7fbd89590fc7490627b0a807f986..22f376ad68e184fa3d3c517914a27a0958f9b628 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_IRQ_VECTORS_LIMITS_H
-#define _ASM_IRQ_VECTORS_LIMITS_H
+#ifndef ASM_X86__MACH_SUMMIT__IRQ_VECTORS_LIMITS_H
+#define ASM_X86__MACH_SUMMIT__IRQ_VECTORS_LIMITS_H
 
 /*
  * For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs,
@@ -11,4 +11,4 @@
 #define NR_IRQS        224
 #define NR_IRQ_VECTORS 1024
 
-#endif /* _ASM_IRQ_VECTORS_LIMITS_H */
+#endif /* ASM_X86__MACH_SUMMIT__IRQ_VECTORS_LIMITS_H */
index c47e2ab5c5ca06515c87b7a320e42fccff3e8ed2..7a66758d701d858fc6373c505d2076a698dc41b6 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APIC_H
-#define __ASM_MACH_APIC_H
+#ifndef ASM_X86__MACH_SUMMIT__MACH_APIC_H
+#define ASM_X86__MACH_SUMMIT__MACH_APIC_H
 
 #include <asm/smp.h>
 
@@ -182,4 +182,4 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
        return hard_smp_processor_id() >> index_msb;
 }
 
-#endif /* __ASM_MACH_APIC_H */
+#endif /* ASM_X86__MACH_SUMMIT__MACH_APIC_H */
index a58ab5a75c8c57c5743a15f4f0fc1587f182a492..d4bc8590c4f64f1ee96f59fc4159931dad5bfe9f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_APICDEF_H
-#define __ASM_MACH_APICDEF_H
+#ifndef ASM_X86__MACH_SUMMIT__MACH_APICDEF_H
+#define ASM_X86__MACH_SUMMIT__MACH_APICDEF_H
 
 #define                APIC_ID_MASK            (0xFF<<24)
 
@@ -10,4 +10,4 @@ static inline unsigned get_apic_id(unsigned long x)
 
 #define                GET_APIC_ID(x)  get_apic_id(x)
 
-#endif
+#endif /* ASM_X86__MACH_SUMMIT__MACH_APICDEF_H */
index 9404c535b7ecbbf6f496d0cd80f4eb266a529208..a3b31c528d9082ae463396c3d5dcd6c203683256 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_IPI_H
-#define __ASM_MACH_IPI_H
+#ifndef ASM_X86__MACH_SUMMIT__MACH_IPI_H
+#define ASM_X86__MACH_SUMMIT__MACH_IPI_H
 
 void send_IPI_mask_sequence(cpumask_t mask, int vector);
 
@@ -22,4 +22,4 @@ static inline void send_IPI_all(int vector)
        send_IPI_mask(cpu_online_map, vector);
 }
 
-#endif /* __ASM_MACH_IPI_H */
+#endif /* ASM_X86__MACH_SUMMIT__MACH_IPI_H */
index fdf5917013399d9175253ddf587e440c2caea654..92396f28772b9ef302e909f4d45f6fc678949ac6 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MACH_MPPARSE_H
-#define __ASM_MACH_MPPARSE_H
+#ifndef ASM_X86__MACH_SUMMIT__MACH_MPPARSE_H
+#define ASM_X86__MACH_SUMMIT__MACH_MPPARSE_H
 
 #include <mach_apic.h>
 #include <asm/tsc.h>
@@ -107,4 +107,4 @@ static inline int is_WPEG(struct rio_detail *rio){
                rio->type == LookOutAWPEG || rio->type == LookOutBWPEG);
 }
 
-#endif /* __ASM_MACH_MPPARSE_H */
+#endif /* ASM_X86__MACH_SUMMIT__MACH_MPPARSE_H */
index 9bf4ae93ab10b3a549efaac717fcdce0f81a158d..5768d8e95c8c2b671ffb93383d13dd842a696208 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_MATH_EMU_H
-#define _I386_MATH_EMU_H
+#ifndef ASM_X86__MATH_EMU_H
+#define ASM_X86__MATH_EMU_H
 
 /* This structure matches the layout of the data saved to the stack
    following a device-not-present interrupt, part of it saved
@@ -28,4 +28,4 @@ struct info {
        long ___vm86_fs;
        long ___vm86_gs;
 };
-#endif
+#endif /* ASM_X86__MATH_EMU_H */
index daf1ccde77af32a855d21112693fd0b9e6d126e2..a995f33176cd026f60f21c18008811f9a5a996a4 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Machine dependent access functions for RTC registers.
  */
-#ifndef _ASM_MC146818RTC_H
-#define _ASM_MC146818RTC_H
+#ifndef ASM_X86__MC146818RTC_H
+#define ASM_X86__MC146818RTC_H
 
 #include <asm/io.h>
 #include <asm/system.h>
@@ -101,4 +101,4 @@ extern unsigned long mach_get_cmos_time(void);
 
 #define RTC_IRQ 8
 
-#endif /* _ASM_MC146818RTC_H */
+#endif /* ASM_X86__MC146818RTC_H */
index 09adf2eac4dce0517ea1b3b9c7c5173415fb6ff5..60d1ed287b1301c2907e910ab4c7c0e182df87bd 100644 (file)
@@ -1,8 +1,8 @@
 /* -*- mode: c; c-basic-offset: 8 -*- */
 
 /* Platform specific MCA defines */
-#ifndef _ASM_MCA_H
-#define _ASM_MCA_H
+#ifndef ASM_X86__MCA_H
+#define ASM_X86__MCA_H
 
 /* Maximal number of MCA slots - actually, some machines have less, but
  * they all have sufficient number of POS registers to cover 8.
@@ -40,4 +40,4 @@
  */
 #define MCA_NUMADAPTERS (MCA_MAX_SLOT_NR+3)
 
-#endif
+#endif /* ASM_X86__MCA_H */
index c3dca6edc6b1b82c3a252c4b005abc77106100d8..49f22be237d29c0e76e520d33b1fdb654f8a3d5d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef MCA_DMA_H
-#define MCA_DMA_H
+#ifndef ASM_X86__MCA_DMA_H
+#define ASM_X86__MCA_DMA_H
 
 #include <asm/io.h>
 #include <linux/ioport.h>
@@ -198,4 +198,4 @@ static inline void mca_set_dma_mode(unsigned int dmanr, unsigned int mode)
        outb(mode, MCA_DMA_REG_EXE);
 }
 
-#endif /* MCA_DMA_H */
+#endif /* ASM_X86__MCA_DMA_H */
index 531eaa587455a90c2274ef5f5491e8214dd51ccf..036133eaf7448e4625a713bab4b9ff3f53e98bb2 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_MCE_H
-#define _ASM_X86_MCE_H
+#ifndef ASM_X86__MCE_H
+#define ASM_X86__MCE_H
 
 #ifdef __x86_64__
 
@@ -127,4 +127,4 @@ extern void restart_mce(void);
 
 #endif /* __KERNEL__ */
 
-#endif
+#endif /* ASM_X86__MCE_H */
index 90bc4108a4fdf917fc243502bd7fcf833f482a55..4ef28e6de3837e38db2bd98a2af0116c67dd464b 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_MMAN_H
-#define _ASM_X86_MMAN_H
+#ifndef ASM_X86__MMAN_H
+#define ASM_X86__MMAN_H
 
 #include <asm-generic/mman.h>
 
@@ -17,4 +17,4 @@
 #define MCL_CURRENT    1               /* lock all current mappings */
 #define MCL_FUTURE     2               /* lock all future mappings */
 
-#endif /* _ASM_X86_MMAN_H */
+#endif /* ASM_X86__MMAN_H */
index e293ab81e85017b21dbd0f534ba41692748795ec..fb79b1cf5d07bdcd24360a776a10cdca2d213274 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_MMCONFIG_H
-#define _ASM_MMCONFIG_H
+#ifndef ASM_X86__MMCONFIG_H
+#define ASM_X86__MMCONFIG_H
 
 #ifdef CONFIG_PCI_MMCONFIG
 extern void __cpuinit fam10h_check_enable_mmcfg(void);
@@ -9,4 +9,4 @@ static inline void fam10h_check_enable_mmcfg(void) { }
 static inline void check_enable_amd_mmconf_dmi(void) { }
 #endif
 
-#endif
+#endif /* ASM_X86__MMCONFIG_H */
index 00e88679e11f780af5654ae54f2bfafc7e572369..9d5aff14334a9214401d064c0bc54952e72da9c7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_MMU_H
-#define _ASM_X86_MMU_H
+#ifndef ASM_X86__MMU_H
+#define ASM_X86__MMU_H
 
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
@@ -7,14 +7,9 @@
 /*
  * The x86 doesn't have a mmu context, but
  * we put the segment information here.
- *
- * cpu_vm_mask is used to optimize ldt flushing.
  */
 typedef struct {
        void *ldt;
-#ifdef CONFIG_X86_64
-       rwlock_t ldtlock;
-#endif
        int size;
        struct mutex lock;
        void *vdso;
@@ -28,4 +23,4 @@ static inline void leave_mm(int cpu)
 }
 #endif
 
-#endif /* _ASM_X86_MMU_H */
+#endif /* ASM_X86__MMU_H */
index fac57014e7c6a4a5dbb62a7ac9e884f400c57870..8ec940bfd07902b858a9c31c00292fa429132653 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_X86_MMU_CONTEXT_H
-#define __ASM_X86_MMU_CONTEXT_H
+#ifndef ASM_X86__MMU_CONTEXT_H
+#define ASM_X86__MMU_CONTEXT_H
 
 #include <asm/desc.h>
 #include <asm/atomic.h>
@@ -34,4 +34,4 @@ do {                                          \
 } while (0);
 
 
-#endif /* __ASM_X86_MMU_CONTEXT_H */
+#endif /* ASM_X86__MMU_CONTEXT_H */
index 824fc575c6d8370f03d747b6abedaadf21882903..cce6f6e4afd6dbc6c4c876fe505da7e828647384 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __I386_SCHED_H
-#define __I386_SCHED_H
+#ifndef ASM_X86__MMU_CONTEXT_32_H
+#define ASM_X86__MMU_CONTEXT_32_H
 
 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 {
@@ -53,4 +53,4 @@ static inline void switch_mm(struct mm_struct *prev,
 #define deactivate_mm(tsk, mm)                 \
        asm("movl %0,%%gs": :"r" (0));
 
-#endif
+#endif /* ASM_X86__MMU_CONTEXT_32_H */
index c7000634ccae6900170be103a4b0fd99f571c55b..26758673c828b15068ea138a9527699ec7ae03d5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __X86_64_MMU_CONTEXT_H
-#define __X86_64_MMU_CONTEXT_H
+#ifndef ASM_X86__MMU_CONTEXT_64_H
+#define ASM_X86__MMU_CONTEXT_64_H
 
 #include <asm/pda.h>
 
@@ -51,4 +51,4 @@ do {                                          \
        asm volatile("movl %0,%%fs"::"r"(0));   \
 } while (0)
 
-#endif
+#endif /* ASM_X86__MMU_CONTEXT_64_H */
index 940881218ff862ab13c349f107b2b5c6d050a5e5..2e7299bb3653639a00819fd72cea430c71d0b970 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_MMX_H
-#define _ASM_MMX_H
+#ifndef ASM_X86__MMX_H
+#define ASM_X86__MMX_H
 
 /*
  *     MMX 3Dnow! helper operations
@@ -11,4 +11,4 @@ extern void *_mmx_memcpy(void *to, const void *from, size_t size);
 extern void mmx_clear_page(void *page);
 extern void mmx_copy_page(void *to, void *from);
 
-#endif
+#endif /* ASM_X86__MMX_H */
index 5862e6460658d29fc8be6b2a9b2a26389522eb1f..121b65d61d868ca09a4a2c81d61a2c36154fbc52 100644 (file)
@@ -3,8 +3,8 @@
  *
  */
 
-#ifndef _ASM_MMZONE_H_
-#define _ASM_MMZONE_H_
+#ifndef ASM_X86__MMZONE_32_H
+#define ASM_X86__MMZONE_32_H
 
 #include <asm/smp.h>
 
@@ -131,4 +131,4 @@ static inline int pfn_valid(int pfn)
 })
 #endif /* CONFIG_NEED_MULTIPLE_NODES */
 
-#endif /* _ASM_MMZONE_H_ */
+#endif /* ASM_X86__MMZONE_32_H */
index 594bd0dc1d081db7865f80e5a33c4c8ab4f7a718..626b03a14875b20d54e2885fae78a602507f8577 100644 (file)
@@ -1,8 +1,8 @@
 /* K8 NUMA support */
 /* Copyright 2002,2003 by Andi Kleen, SuSE Labs */
 /* 2.5 Version loosely based on the NUMAQ Code by Pat Gaughen. */
-#ifndef _ASM_X86_64_MMZONE_H
-#define _ASM_X86_64_MMZONE_H 1
+#ifndef ASM_X86__MMZONE_64_H
+#define ASM_X86__MMZONE_64_H
 
 
 #ifdef CONFIG_NUMA
@@ -49,4 +49,4 @@ extern int early_pfn_to_nid(unsigned long pfn);
 #endif
 
 #endif
-#endif
+#endif /* ASM_X86__MMZONE_64_H */
index bfedb247871cfbc39ecb2823f428ac62f57eb9f4..48dc3e0c07d9a27b828ea614689a939e0baa581b 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_MODULE_H
-#define _ASM_MODULE_H
+#ifndef ASM_X86__MODULE_H
+#define ASM_X86__MODULE_H
 
 /* x86_32/64 are simple */
 struct mod_arch_specific {};
@@ -79,4 +79,4 @@ struct mod_arch_specific {};
 # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE
 #endif
 
-#endif /* _ASM_MODULE_H */
+#endif /* ASM_X86__MODULE_H */
index b6995e567fcc64edff23e389bfad9ddeb5647508..118da365e371cf3415410fd902fd9ec85f537361 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _AM_X86_MPSPEC_H
-#define _AM_X86_MPSPEC_H
+#ifndef ASM_X86__MPSPEC_H
+#define ASM_X86__MPSPEC_H
 
 #include <linux/init.h>
 
@@ -141,4 +141,4 @@ static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map)
 
 extern physid_mask_t phys_cpu_present_map;
 
-#endif
+#endif /* ASM_X86__MPSPEC_H */
index 38d1e73b49e41ebc1fdd8b07d697697b6b0fff0d..79166b04801231cf5d6526759113b071719a6226 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MPSPEC_DEF_H
-#define __ASM_MPSPEC_DEF_H
+#ifndef ASM_X86__MPSPEC_DEF_H
+#define ASM_X86__MPSPEC_DEF_H
 
 /*
  * Structure definitions for SMP machines following the
@@ -177,4 +177,4 @@ enum mp_bustype {
        MP_BUS_PCI,
        MP_BUS_MCA,
 };
-#endif
+#endif /* ASM_X86__MPSPEC_DEF_H */
index 7e4e9481f51cff18dda6f96cfcadb5c9d9535eb9..1b538c907a3de50b0fee5d87de36238560a9fce4 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_MSGBUF_H
-#define _ASM_X86_MSGBUF_H
+#ifndef ASM_X86__MSGBUF_H
+#define ASM_X86__MSGBUF_H
 
 /*
  * The msqid64_ds structure for i386 architecture.
@@ -36,4 +36,4 @@ struct msqid64_ds {
        unsigned long  __unused5;
 };
 
-#endif /* _ASM_X86_MSGBUF_H */
+#endif /* ASM_X86__MSGBUF_H */
index 296f29ce426d4e75a3c9451d1e16bb7d8aed3f71..3139666a94fa2fab7c9bfc0f4d94713260a36a9f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ASM_MSIDEF_H
-#define ASM_MSIDEF_H
+#ifndef ASM_X86__MSIDEF_H
+#define ASM_X86__MSIDEF_H
 
 /*
  * Constants for Intel APIC based MSI messages.
@@ -48,4 +48,4 @@
 #define  MSI_ADDR_DEST_ID(dest)                (((dest) << MSI_ADDR_DEST_ID_SHIFT) & \
                                         MSI_ADDR_DEST_ID_MASK)
 
-#endif /* ASM_MSIDEF_H */
+#endif /* ASM_X86__MSIDEF_H */
index 44bce773012e80b11190b7400852f35a55683c98..3052f058ab063fb9cc0bf038986f4f34712320fc 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_MSR_INDEX_H
-#define __ASM_MSR_INDEX_H
+#ifndef ASM_X86__MSR_INDEX_H
+#define ASM_X86__MSR_INDEX_H
 
 /* CPU model specific register (MSR) numbers */
 
 /* Geode defined MSRs */
 #define MSR_GEODE_BUSCONT_CONF0                0x00001900
 
-#endif /* __ASM_MSR_INDEX_H */
+#endif /* ASM_X86__MSR_INDEX_H */
index 2362cfda1fbcfe08ebdc173b87b6a7818892a5f7..530af1f6389e4b1f17ed1d6002cd0b617665f50b 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_X86_MSR_H_
-#define __ASM_X86_MSR_H_
+#ifndef ASM_X86__MSR_H
+#define ASM_X86__MSR_H
 
 #include <asm/msr-index.h>
 
@@ -63,6 +63,22 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
        return EAX_EDX_VAL(val, low, high);
 }
 
+static inline unsigned long long native_read_msr_amd_safe(unsigned int msr,
+                                                     int *err)
+{
+       DECLARE_ARGS(val, low, high);
+
+       asm volatile("2: rdmsr ; xor %0,%0\n"
+                    "1:\n\t"
+                    ".section .fixup,\"ax\"\n\t"
+                    "3:  mov %3,%0 ; jmp 1b\n\t"
+                    ".previous\n\t"
+                    _ASM_EXTABLE(2b, 3b)
+                    : "=r" (*err), EAX_EDX_RET(val, low, high)
+                    : "c" (msr), "D" (0x9c5a203a), "i" (-EFAULT));
+       return EAX_EDX_VAL(val, low, high);
+}
+
 static inline void native_write_msr(unsigned int msr,
                                    unsigned low, unsigned high)
 {
@@ -158,6 +174,13 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p)
        *p = native_read_msr_safe(msr, &err);
        return err;
 }
+static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
+{
+       int err;
+
+       *p = native_read_msr_amd_safe(msr, &err);
+       return err;
+}
 
 #define rdtscl(low)                                            \
        ((low) = (u32)native_read_tsc())
@@ -221,4 +244,4 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
 #endif /* __KERNEL__ */
 
 
-#endif
+#endif /* ASM_X86__MSR_H */
index a69a01a517292ffe4d902fd157e9adb201705a11..23a7f83da953e7dee776dd7abb001a0dd5ce1374 100644 (file)
@@ -20,8 +20,8 @@
     The postal address is:
       Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.
 */
-#ifndef _ASM_X86_MTRR_H
-#define _ASM_X86_MTRR_H
+#ifndef ASM_X86__MTRR_H
+#define ASM_X86__MTRR_H
 
 #include <linux/ioctl.h>
 #include <linux/errno.h>
@@ -170,4 +170,4 @@ struct mtrr_gentry32 {
 
 #endif /* __KERNEL__ */
 
-#endif  /*  _ASM_X86_MTRR_H  */
+#endif /* ASM_X86__MTRR_H */
index 73e928ef5f03b6c6160788fa9f5df2efd89c78d6..25c16d8ba3c753995394e204258583a27eebbdf4 100644 (file)
@@ -6,8 +6,8 @@
  *
  *  Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
  */
-#ifndef _ASM_MUTEX_H
-#define _ASM_MUTEX_H
+#ifndef ASM_X86__MUTEX_32_H
+#define ASM_X86__MUTEX_32_H
 
 #include <asm/alternative.h>
 
@@ -122,4 +122,4 @@ static inline int __mutex_fastpath_trylock(atomic_t *count,
 #endif
 }
 
-#endif
+#endif /* ASM_X86__MUTEX_32_H */
index f3fae9becb387c0b758ed1a639be0591bdeeb129..918ba21ab9d9c5ec2c842e0479961694f379e2cd 100644 (file)
@@ -6,8 +6,8 @@
  *
  *  Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
  */
-#ifndef _ASM_MUTEX_H
-#define _ASM_MUTEX_H
+#ifndef ASM_X86__MUTEX_64_H
+#define ASM_X86__MUTEX_64_H
 
 /**
  * __mutex_fastpath_lock - decrement and call function if negative
@@ -97,4 +97,4 @@ static inline int __mutex_fastpath_trylock(atomic_t *count,
                return 0;
 }
 
-#endif
+#endif /* ASM_X86__MUTEX_64_H */
index 21f8d0202a828ee8f6d1bf14b444e2b340f6cb3d..d5e715f024dcc79d2818d78c2f651ac8d1b32807 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_NMI_H_
-#define _ASM_X86_NMI_H_
+#ifndef ASM_X86__NMI_H
+#define ASM_X86__NMI_H
 
 #include <linux/pm.h>
 #include <asm/irq.h>
@@ -34,6 +34,7 @@ extern void stop_apic_nmi_watchdog(void *);
 extern void disable_timer_nmi_watchdog(void);
 extern void enable_timer_nmi_watchdog(void);
 extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
+extern void cpu_nmi_set_wd_enabled(void);
 
 extern atomic_t nmi_active;
 extern unsigned int nmi_watchdog;
@@ -81,4 +82,4 @@ void enable_lapic_nmi_watchdog(void);
 void stop_nmi(void);
 void restart_nmi(void);
 
-#endif
+#endif /* ASM_X86__NMI_H */
index ad0bedd10b89c8e1a66c6ea6668e1d12c6a7b35b..ae742721ae73e01cdfeb9ab4e1bc72310f5ec729 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_NOPS_H
-#define _ASM_NOPS_H 1
+#ifndef ASM_X86__NOPS_H
+#define ASM_X86__NOPS_H
 
 /* Define nops for use with alternative() */
 
 
 #define ASM_NOP_MAX 8
 
-#endif
+#endif /* ASM_X86__NOPS_H */
index 220d7b7707a02be8d82232d5395732a6f9a3efa2..44cb07855c5bcfd8ab4db962c3871316f5b9027c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_32_NUMA_H
-#define _ASM_X86_32_NUMA_H 1
+#ifndef ASM_X86__NUMA_32_H
+#define ASM_X86__NUMA_32_H
 
 extern int pxm_to_nid(int pxm);
 extern void numa_remove_cpu(int cpu);
@@ -8,4 +8,4 @@ extern void numa_remove_cpu(int cpu);
 extern void set_highmem_pages_init(void);
 #endif
 
-#endif /* _ASM_X86_32_NUMA_H */
+#endif /* ASM_X86__NUMA_32_H */
index 3830094434a9ef75eb686bb2a84ef5c10daaaef7..15c990395b021b65c766b1321ea8801e4311f9f4 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X8664_NUMA_H
-#define _ASM_X8664_NUMA_H 1
+#ifndef ASM_X86__NUMA_64_H
+#define ASM_X86__NUMA_64_H
 
 #include <linux/nodemask.h>
 #include <asm/apicdef.h>
@@ -40,4 +40,4 @@ static inline void numa_add_cpu(int cpu, int node)    { }
 static inline void numa_remove_cpu(int cpu)            { }
 #endif
 
-#endif
+#endif /* ASM_X86__NUMA_64_H */
index 34b92d581fa326839f7c2568b82d9033472d44dd..124bf7d4b70a86d483fc25409e0a6105a3acca52 100644 (file)
@@ -23,8 +23,8 @@
  * Send feedback to <gone@us.ibm.com>
  */
 
-#ifndef NUMAQ_H
-#define NUMAQ_H
+#ifndef ASM_X86__NUMAQ_H
+#define ASM_X86__NUMAQ_H
 
 #ifdef CONFIG_X86_NUMAQ
 
@@ -165,5 +165,5 @@ static inline int get_memcfg_numaq(void)
        return 0;
 }
 #endif /* CONFIG_X86_NUMAQ */
-#endif /* NUMAQ_H */
+#endif /* ASM_X86__NUMAQ_H */
 
index 97d47133486f962687683793e19673b80da7af4b..d7328b1a05c1791dc9475a573a1574c65717ccd6 100644 (file)
@@ -1,7 +1,7 @@
 /* OLPC machine specific definitions */
 
-#ifndef ASM_OLPC_H_
-#define ASM_OLPC_H_
+#ifndef ASM_X86__OLPC_H
+#define ASM_X86__OLPC_H
 
 #include <asm/geode.h>
 
@@ -129,4 +129,4 @@ extern int olpc_ec_mask_unset(uint8_t bits);
 #define OLPC_GPIO_LID          geode_gpio(26)
 #define OLPC_GPIO_ECSCI                geode_gpio(27)
 
-#endif
+#endif /* ASM_X86__OLPC_H */
index 49982110e4d94e4025896a6c05d7fddecca382ae..c91574776751396207f1aa2ce903e15a82239d47 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PAGE_H
-#define _ASM_X86_PAGE_H
+#ifndef ASM_X86__PAGE_H
+#define ASM_X86__PAGE_H
 
 #include <linux/const.h>
 
@@ -57,6 +57,7 @@ typedef struct { pgdval_t pgd; } pgd_t;
 typedef struct { pgprotval_t pgprot; } pgprot_t;
 
 extern int page_is_ram(unsigned long pagenr);
+extern int pagerange_is_ram(unsigned long start, unsigned long end);
 extern int devmem_is_allowed(unsigned long pagenr);
 extern void map_devmem(unsigned long pfn, unsigned long size,
                       pgprot_t vma_prot);
@@ -199,4 +200,4 @@ static inline pteval_t native_pte_flags(pte_t pte)
 #define __HAVE_ARCH_GATE_AREA 1
 
 #endif /* __KERNEL__ */
-#endif /* _ASM_X86_PAGE_H */
+#endif /* ASM_X86__PAGE_H */
index ab8528793f081bef8d7c945b7bddbaf1bff54073..72f7305682c652d7ef2198b35e732d58544e808b 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PAGE_32_H
-#define _ASM_X86_PAGE_32_H
+#ifndef ASM_X86__PAGE_32_H
+#define ASM_X86__PAGE_32_H
 
 /*
  * This handles the memory map.
@@ -89,13 +89,11 @@ extern int nx_enabled;
 extern unsigned int __VMALLOC_RESERVE;
 extern int sysctl_legacy_va_layout;
 
-#define VMALLOC_RESERVE                ((unsigned long)__VMALLOC_RESERVE)
-#define MAXMEM                 (-__PAGE_OFFSET - __VMALLOC_RESERVE)
-
 extern void find_low_pfn_range(void);
 extern unsigned long init_memory_mapping(unsigned long start,
                                         unsigned long end);
 extern void initmem_init(unsigned long, unsigned long);
+extern void free_initmem(void);
 extern void setup_bootmem_allocator(void);
 
 
@@ -126,4 +124,4 @@ static inline void copy_page(void *to, void *from)
 #endif /* CONFIG_X86_3DNOW */
 #endif /* !__ASSEMBLY__ */
 
-#endif /* _ASM_X86_PAGE_32_H */
+#endif /* ASM_X86__PAGE_32_H */
index c6916c83e6b1aee454e8a8d55ccd787652bee88e..5e64acfed0a4882b1bf392e0541b03df8d53734f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _X86_64_PAGE_H
-#define _X86_64_PAGE_H
+#ifndef ASM_X86__PAGE_64_H
+#define ASM_X86__PAGE_64_H
 
 #define PAGETABLE_LEVELS       4
 
@@ -91,6 +91,7 @@ extern unsigned long init_memory_mapping(unsigned long start,
                                         unsigned long end);
 
 extern void initmem_init(unsigned long start_pfn, unsigned long end_pfn);
+extern void free_initmem(void);
 
 extern void init_extra_mapping_uc(unsigned long phys, unsigned long size);
 extern void init_extra_mapping_wb(unsigned long phys, unsigned long size);
@@ -102,4 +103,4 @@ extern void init_extra_mapping_wb(unsigned long phys, unsigned long size);
 #endif
 
 
-#endif /* _X86_64_PAGE_H */
+#endif /* ASM_X86__PAGE_64_H */
index 6f0d0422f4ca0ffdcb07df874789dc565f3ac82f..0009cfb11a5f53bbba0c697a6695cb6bddfefa7d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PARAM_H
-#define _ASM_X86_PARAM_H
+#ifndef ASM_X86__PARAM_H
+#define ASM_X86__PARAM_H
 
 #ifdef __KERNEL__
 # define HZ            CONFIG_HZ       /* Internal kernel timer frequency */
@@ -19,4 +19,4 @@
 
 #define MAXHOSTNAMELEN 64      /* max length of hostname */
 
-#endif /* _ASM_X86_PARAM_H */
+#endif /* ASM_X86__PARAM_H */
index fbbde93f12d6d5ad0aaca4fb1e6db0860cb5a351..891971f57d35d08f7f7e3b5000936a0f3babc56c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_PARAVIRT_H
-#define __ASM_PARAVIRT_H
+#ifndef ASM_X86__PARAVIRT_H
+#define ASM_X86__PARAVIRT_H
 /* Various instructions on x86 need to be replaced for
  * para-virtualization: those hooks are defined here. */
 
@@ -137,6 +137,7 @@ struct pv_cpu_ops {
 
        /* MSR, PMC and TSR operations.
           err = 0/-EFAULT.  wrmsr returns 0/-EFAULT. */
+       u64 (*read_msr_amd)(unsigned int msr, int *err);
        u64 (*read_msr)(unsigned int msr, int *err);
        int (*write_msr)(unsigned int msr, unsigned low, unsigned high);
 
@@ -257,13 +258,13 @@ struct pv_mmu_ops {
         * Hooks for allocating/releasing pagetable pages when they're
         * attached to a pagetable
         */
-       void (*alloc_pte)(struct mm_struct *mm, u32 pfn);
-       void (*alloc_pmd)(struct mm_struct *mm, u32 pfn);
-       void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
-       void (*alloc_pud)(struct mm_struct *mm, u32 pfn);
-       void (*release_pte)(u32 pfn);
-       void (*release_pmd)(u32 pfn);
-       void (*release_pud)(u32 pfn);
+       void (*alloc_pte)(struct mm_struct *mm, unsigned long pfn);
+       void (*alloc_pmd)(struct mm_struct *mm, unsigned long pfn);
+       void (*alloc_pmd_clone)(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count);
+       void (*alloc_pud)(struct mm_struct *mm, unsigned long pfn);
+       void (*release_pte)(unsigned long pfn);
+       void (*release_pmd)(unsigned long pfn);
+       void (*release_pud)(unsigned long pfn);
 
        /* Pagetable manipulation functions */
        void (*set_pte)(pte_t *ptep, pte_t pteval);
@@ -726,6 +727,10 @@ static inline u64 paravirt_read_msr(unsigned msr, int *err)
 {
        return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err);
 }
+static inline u64 paravirt_read_msr_amd(unsigned msr, int *err)
+{
+       return PVOP_CALL2(u64, pv_cpu_ops.read_msr_amd, msr, err);
+}
 static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high)
 {
        return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high);
@@ -771,6 +776,13 @@ static inline int rdmsrl_safe(unsigned msr, unsigned long long *p)
        *p = paravirt_read_msr(msr, &err);
        return err;
 }
+static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
+{
+       int err;
+
+       *p = paravirt_read_msr_amd(msr, &err);
+       return err;
+}
 
 static inline u64 paravirt_read_tsc(void)
 {
@@ -993,35 +1005,35 @@ static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd)
        PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd);
 }
 
-static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn)
+static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn)
 {
        PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn);
 }
-static inline void paravirt_release_pte(unsigned pfn)
+static inline void paravirt_release_pte(unsigned long pfn)
 {
        PVOP_VCALL1(pv_mmu_ops.release_pte, pfn);
 }
 
-static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned pfn)
+static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn)
 {
        PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn);
 }
 
-static inline void paravirt_alloc_pmd_clone(unsigned pfn, unsigned clonepfn,
-                                           unsigned start, unsigned count)
+static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn,
+                                           unsigned long start, unsigned long count)
 {
        PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count);
 }
-static inline void paravirt_release_pmd(unsigned pfn)
+static inline void paravirt_release_pmd(unsigned long pfn)
 {
        PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn);
 }
 
-static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned pfn)
+static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn)
 {
        PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn);
 }
-static inline void paravirt_release_pud(unsigned pfn)
+static inline void paravirt_release_pud(unsigned long pfn)
 {
        PVOP_VCALL1(pv_mmu_ops.release_pud, pfn);
 }
@@ -1634,4 +1646,4 @@ static inline unsigned long __raw_local_irq_save(void)
 
 #endif /* __ASSEMBLY__ */
 #endif /* CONFIG_PARAVIRT */
-#endif /* __ASM_PARAVIRT_H */
+#endif /* ASM_X86__PARAVIRT_H */
index 3c4ffeb467e9886ad62b1a4c6bf60686fcb219a3..2e3dda4dc3d9b9f4bc243ca5a5b82b15be18263c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PARPORT_H
-#define _ASM_X86_PARPORT_H
+#ifndef ASM_X86__PARPORT_H
+#define ASM_X86__PARPORT_H
 
 static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
 static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
@@ -7,4 +7,4 @@ static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
        return parport_pc_find_isa_ports(autoirq, autodma);
 }
 
-#endif /* _ASM_X86_PARPORT_H */
+#endif /* ASM_X86__PARPORT_H */
index 7edc473072179c48defd9043a2ec5be0202dbbcf..482c3e3f9879b23f086274fbd7dc453c3701ed69 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_PAT_H
-#define _ASM_PAT_H
+#ifndef ASM_X86__PAT_H
+#define ASM_X86__PAT_H
 
 #include <linux/types.h>
 
@@ -19,4 +19,4 @@ extern int free_memtype(u64 start, u64 end);
 
 extern void pat_disable(char *reason);
 
-#endif
+#endif /* ASM_X86__PAT_H */
index 80c775d9fe205810257fb8dc0013b997b5d61969..da42be07b6907bbfcf6eecabeaa65a2546cb40a1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ASM_PCI_DIRECT_H
-#define ASM_PCI_DIRECT_H 1
+#ifndef ASM_X86__PCI_DIRECT_H
+#define ASM_X86__PCI_DIRECT_H
 
 #include <linux/types.h>
 
@@ -18,4 +18,4 @@ extern int early_pci_allowed(void);
 extern unsigned int pci_early_dump_regs;
 extern void early_dump_pci_device(u8 bus, u8 slot, u8 func);
 extern void early_dump_pci_devices(void);
-#endif
+#endif /* ASM_X86__PCI_DIRECT_H */
index 2db14cf17db8f9faeae76133445f144023d58ff6..60258319299183fa10ba7127f8af81a4e45f4f4e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __x86_PCI_H
-#define __x86_PCI_H
+#ifndef ASM_X86__PCI_H
+#define ASM_X86__PCI_H
 
 #include <linux/mm.h> /* for struct page */
 #include <linux/types.h>
@@ -111,4 +111,4 @@ static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus)
 }
 #endif
 
-#endif
+#endif /* ASM_X86__PCI_H */
index a50d468512857e2dd9cbdecf3b76fd986e15b1d4..3f2288207c0cd0e664cce2037d7c25e4a1bf1166 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __i386_PCI_H
-#define __i386_PCI_H
+#ifndef ASM_X86__PCI_32_H
+#define ASM_X86__PCI_32_H
 
 
 #ifdef __KERNEL__
@@ -31,4 +31,4 @@ struct pci_dev;
 #endif /* __KERNEL__ */
 
 
-#endif /* __i386_PCI_H */
+#endif /* ASM_X86__PCI_32_H */
index f330234ffa5c568888aeabf92c1e7a49d91335dc..f72e12d5770ef275aff119c8c136a70b75ed047a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __x8664_PCI_H
-#define __x8664_PCI_H
+#ifndef ASM_X86__PCI_64_H
+#define ASM_X86__PCI_64_H
 
 #ifdef __KERNEL__
 
@@ -63,4 +63,4 @@ extern void pci_iommu_alloc(void);
 
 #endif /* __KERNEL__ */
 
-#endif /* __x8664_PCI_H */
+#endif /* ASM_X86__PCI_64_H */
index b34e9a7cc80b3002dc9e331f224298d8754482f1..80860afffbdbbede4092bb18a6946e5b0a2831f9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef X86_64_PDA_H
-#define X86_64_PDA_H
+#ifndef ASM_X86__PDA_H
+#define ASM_X86__PDA_H
 
 #ifndef __ASSEMBLY__
 #include <linux/stddef.h>
@@ -134,4 +134,4 @@ do {                                                                        \
 
 #define PDA_STACKOFFSET (5*8)
 
-#endif
+#endif /* ASM_X86__PDA_H */
index f643a3a92da08b3789efde09f883850f0e85b0ac..e10a1d0678cfaa014ad702e1169e5d7417240f52 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PERCPU_H_
-#define _ASM_X86_PERCPU_H_
+#ifndef ASM_X86__PERCPU_H
+#define ASM_X86__PERCPU_H
 
 #ifdef CONFIG_X86_64
 #include <linux/compiler.h>
@@ -215,4 +215,4 @@ do {                                                        \
 
 #endif /* !CONFIG_SMP */
 
-#endif /* _ASM_X86_PERCPU_H_ */
+#endif /* ASM_X86__PERCPU_H */
index d63ea431cb3bbc974bec3fa3b22e5afff0194c17..3cd23adedae851d13da954b3cb8574390102931a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PGALLOC_H
-#define _ASM_X86_PGALLOC_H
+#ifndef ASM_X86__PGALLOC_H
+#define ASM_X86__PGALLOC_H
 
 #include <linux/threads.h>
 #include <linux/mm.h>          /* for struct page */
@@ -111,4 +111,4 @@ extern void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud);
 #endif /* PAGETABLE_LEVELS > 3 */
 #endif /* PAGETABLE_LEVELS > 2 */
 
-#endif /* _ASM_X86_PGALLOC_H */
+#endif /* ASM_X86__PGALLOC_H */
index 0f71c9f13da4a406e8f6e6e7d3225fe30e72c983..7ec48f4e53472a865eee5d9fb4c1b018bd3fcd8a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_PGTABLE_2LEVEL_DEFS_H
-#define _I386_PGTABLE_2LEVEL_DEFS_H
+#ifndef ASM_X86__PGTABLE_2LEVEL_DEFS_H
+#define ASM_X86__PGTABLE_2LEVEL_DEFS_H
 
 #define SHARED_KERNEL_PMD      0
 
@@ -17,4 +17,4 @@
 
 #define PTRS_PER_PTE   1024
 
-#endif /* _I386_PGTABLE_2LEVEL_DEFS_H */
+#endif /* ASM_X86__PGTABLE_2LEVEL_DEFS_H */
index 46bc52c0eae18ce519f1fe073edbed48ab846dc8..81762081dcd88251464b4af812fe39239a14377d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_PGTABLE_2LEVEL_H
-#define _I386_PGTABLE_2LEVEL_H
+#ifndef ASM_X86__PGTABLE_2LEVEL_H
+#define ASM_X86__PGTABLE_2LEVEL_H
 
 #define pte_ERROR(e) \
        printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low)
@@ -53,9 +53,7 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp)
 #define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)
 #endif
 
-#define pte_page(x)            pfn_to_page(pte_pfn(x))
 #define pte_none(x)            (!(x).pte_low)
-#define pte_pfn(x)             (pte_val(x) >> PAGE_SHIFT)
 
 /*
  * Bits 0, 6 and 7 are taken, split up the 29 bits of offset
@@ -78,4 +76,4 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp)
 #define __pte_to_swp_entry(pte)                ((swp_entry_t) { (pte).pte_low })
 #define __swp_entry_to_pte(x)          ((pte_t) { .pte = (x).val })
 
-#endif /* _I386_PGTABLE_2LEVEL_H */
+#endif /* ASM_X86__PGTABLE_2LEVEL_H */
index 448ac95163145c4ded12b5d3a8db3c911d617bd3..c05fe6ff37202ddd51c596b9c27e1b609f84fb3a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_PGTABLE_3LEVEL_DEFS_H
-#define _I386_PGTABLE_3LEVEL_DEFS_H
+#ifndef ASM_X86__PGTABLE_3LEVEL_DEFS_H
+#define ASM_X86__PGTABLE_3LEVEL_DEFS_H
 
 #ifdef CONFIG_PARAVIRT
 #define SHARED_KERNEL_PMD      (pv_info.shared_kernel_pmd)
@@ -25,4 +25,4 @@
  */
 #define PTRS_PER_PTE   512
 
-#endif /* _I386_PGTABLE_3LEVEL_DEFS_H */
+#endif /* ASM_X86__PGTABLE_3LEVEL_DEFS_H */
index 105057f34032f0a23610ea5822e32cf12d51b4f7..75f4276b5ddb9e2a7fba9b3403ce9765366b0eec 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_PGTABLE_3LEVEL_H
-#define _I386_PGTABLE_3LEVEL_H
+#ifndef ASM_X86__PGTABLE_3LEVEL_H
+#define ASM_X86__PGTABLE_3LEVEL_H
 
 /*
  * Intel Physical Address Extension (PAE) Mode - three-level page
@@ -151,18 +151,11 @@ static inline int pte_same(pte_t a, pte_t b)
        return a.pte_low == b.pte_low && a.pte_high == b.pte_high;
 }
 
-#define pte_page(x)    pfn_to_page(pte_pfn(x))
-
 static inline int pte_none(pte_t pte)
 {
        return !pte.pte_low && !pte.pte_high;
 }
 
-static inline unsigned long pte_pfn(pte_t pte)
-{
-       return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT;
-}
-
 /*
  * Bits 0, 6 and 7 are taken in the low part of the pte,
  * put the 32 bits of offset into the high part.
@@ -179,4 +172,4 @@ static inline unsigned long pte_pfn(pte_t pte)
 #define __pte_to_swp_entry(pte)                ((swp_entry_t){ (pte).pte_high })
 #define __swp_entry_to_pte(x)          ((pte_t){ { .pte_high = (x).val } })
 
-#endif /* _I386_PGTABLE_3LEVEL_H */
+#endif /* ASM_X86__PGTABLE_3LEVEL_H */
index 04caa2f544df4dc8c1d7798498b39d7896db1eb9..ed932453ef26a3538ce3fd2c7670dfc78c18d9b9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PGTABLE_H
-#define _ASM_X86_PGTABLE_H
+#ifndef ASM_X86__PGTABLE_H
+#define ASM_X86__PGTABLE_H
 
 #define FIRST_USER_ADDRESS     0
 
@@ -19,6 +19,7 @@
 #define _PAGE_BIT_UNUSED3      11
 #define _PAGE_BIT_PAT_LARGE    12      /* On 2MB or 1GB pages */
 #define _PAGE_BIT_SPECIAL      _PAGE_BIT_UNUSED1
+#define _PAGE_BIT_CPA_TEST     _PAGE_BIT_UNUSED1
 #define _PAGE_BIT_NX           63       /* No execute: only valid after cpuid check */
 
 #define _PAGE_PRESENT  (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
@@ -36,6 +37,7 @@
 #define _PAGE_PAT      (_AT(pteval_t, 1) << _PAGE_BIT_PAT)
 #define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE)
 #define _PAGE_SPECIAL  (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL)
+#define _PAGE_CPA_TEST (_AT(pteval_t, 1) << _PAGE_BIT_CPA_TEST)
 #define __HAVE_ARCH_PTE_SPECIAL
 
 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
 #define __S110 PAGE_SHARED_EXEC
 #define __S111 PAGE_SHARED_EXEC
 
+/*
+ * early identity mapping  pte attrib macros.
+ */
+#ifdef CONFIG_X86_64
+#define __PAGE_KERNEL_IDENT_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC
+#else
+#define PTE_IDENT_ATTR  0x003          /* PRESENT+RW */
+#define PDE_IDENT_ATTR  0x063          /* PRESENT+RW+DIRTY+ACCESSED */
+#define PGD_IDENT_ATTR  0x001          /* PRESENT (no other attributes) */
+#endif
+
 #ifndef __ASSEMBLY__
 
 /*
@@ -186,6 +199,13 @@ static inline int pte_special(pte_t pte)
        return pte_val(pte) & _PAGE_SPECIAL;
 }
 
+static inline unsigned long pte_pfn(pte_t pte)
+{
+       return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT;
+}
+
+#define pte_page(pte)  pfn_to_page(pte_pfn(pte))
+
 static inline int pmd_large(pmd_t pte)
 {
        return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
@@ -313,6 +333,8 @@ static inline void native_pagetable_setup_start(pgd_t *base) {}
 static inline void native_pagetable_setup_done(pgd_t *base) {}
 #endif
 
+extern int arch_report_meminfo(char *page);
+
 #ifdef CONFIG_PARAVIRT
 #include <asm/paravirt.h>
 #else  /* !CONFIG_PARAVIRT */
@@ -521,4 +543,4 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
 #include <asm-generic/pgtable.h>
 #endif /* __ASSEMBLY__ */
 
-#endif /* _ASM_X86_PGTABLE_H */
+#endif /* ASM_X86__PGTABLE_H */
index 5c3b26567a95e46144cb3e2ca68601e572111e87..8de702dc7d620bc625b5ff1fe8eee2d5e0f804a9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_PGTABLE_H
-#define _I386_PGTABLE_H
+#ifndef ASM_X86__PGTABLE_32_H
+#define ASM_X86__PGTABLE_32_H
 
 
 /*
@@ -31,6 +31,7 @@ static inline void pgtable_cache_init(void) { }
 static inline void check_pgt_cache(void) { }
 void paging_init(void);
 
+extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t);
 
 /*
  * The Linux x86 paging architecture is 'compile-time dual-mode', it
@@ -56,8 +57,7 @@ void paging_init(void);
  * area for the same reason. ;)
  */
 #define VMALLOC_OFFSET (8 * 1024 * 1024)
-#define VMALLOC_START  (((unsigned long)high_memory + 2 * VMALLOC_OFFSET - 1) \
-                        & ~(VMALLOC_OFFSET - 1))
+#define VMALLOC_START  ((unsigned long)high_memory + VMALLOC_OFFSET)
 #ifdef CONFIG_X86_PAE
 #define LAST_PKMAP 512
 #else
@@ -73,6 +73,8 @@ void paging_init(void);
 # define VMALLOC_END   (FIXADDR_START - 2 * PAGE_SIZE)
 #endif
 
+#define MAXMEM (VMALLOC_END - PAGE_OFFSET - __VMALLOC_RESERVE)
+
 /*
  * Define this if things work differently on an i386 and an i486:
  * it will (on an i486) warn about kernel memory accesses that are
@@ -186,4 +188,4 @@ do {                                                \
 #define io_remap_pfn_range(vma, vaddr, pfn, size, prot)        \
        remap_pfn_range(vma, vaddr, pfn, size, prot)
 
-#endif /* _I386_PGTABLE_H */
+#endif /* ASM_X86__PGTABLE_32_H */
index 549144d03d99e7972ec2d4806b1763c2c41c933f..fde9770e53d14193a7279c8e427dc50e3f7fc87c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _X86_64_PGTABLE_H
-#define _X86_64_PGTABLE_H
+#ifndef ASM_X86__PGTABLE_64_H
+#define ASM_X86__PGTABLE_64_H
 
 #include <linux/const.h>
 #ifndef __ASSEMBLY__
@@ -175,8 +175,6 @@ static inline int pmd_bad(pmd_t pmd)
 #define pte_present(x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE))
 
 #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT))   /* FIXME: is this right? */
-#define pte_page(x)    pfn_to_page(pte_pfn((x)))
-#define pte_pfn(x)     ((pte_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
 
 /*
  * Macro to mark a page protection value as "uncacheable".
@@ -284,4 +282,4 @@ extern void cleanup_highmap(void);
 #define __HAVE_ARCH_PTE_SAME
 #endif /* !__ASSEMBLY__ */
 
-#endif /* _X86_64_PGTABLE_H */
+#endif /* ASM_X86__PGTABLE_64_H */
index b031efda37ec047417dc22b6c7b61ffd7c095b19..70cf2bb059393532401e0eb4bc49528b869c5f84 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ARCH_I386_POSIX_TYPES_H
-#define __ARCH_I386_POSIX_TYPES_H
+#ifndef ASM_X86__POSIX_TYPES_32_H
+#define ASM_X86__POSIX_TYPES_32_H
 
 /*
  * This file is generally used by user-level software, so you need to
@@ -82,4 +82,4 @@ do {                                                          \
 
 #endif /* defined(__KERNEL__) */
 
-#endif
+#endif /* ASM_X86__POSIX_TYPES_32_H */
index d6624c95854af6b27db8fe2d371e3536f2862a9d..388b4e7f4a440425173adfd5f6da9bd25ead676c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_64_POSIX_TYPES_H
-#define _ASM_X86_64_POSIX_TYPES_H
+#ifndef ASM_X86__POSIX_TYPES_64_H
+#define ASM_X86__POSIX_TYPES_64_H
 
 /*
  * This file is generally used by user-level software, so you need to
@@ -116,4 +116,4 @@ static inline void __FD_ZERO(__kernel_fd_set *p)
 
 #endif /* defined(__KERNEL__) */
 
-#endif
+#endif /* ASM_X86__POSIX_TYPES_64_H */
index 52952adef1ca8fbd4d04b14eae63f2f6315479ac..e7ae34eb4103357ac3a8b73352df7fce8caed93d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef X86_64_PRCTL_H
-#define X86_64_PRCTL_H 1
+#ifndef ASM_X86__PRCTL_H
+#define ASM_X86__PRCTL_H
 
 #define ARCH_SET_GS 0x1001
 #define ARCH_SET_FS 0x1002
@@ -7,4 +7,4 @@
 #define ARCH_GET_GS 0x1004
 
 
-#endif
+#endif /* ASM_X86__PRCTL_H */
index eff2ecd7fff067caf89bc48cd81bebe111a43363..5dd79774f693c176d66e8e2d5ef7639d85569c25 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_I386_PROCESSOR_FLAGS_H
-#define __ASM_I386_PROCESSOR_FLAGS_H
+#ifndef ASM_X86__PROCESSOR_FLAGS_H
+#define ASM_X86__PROCESSOR_FLAGS_H
 /* Various flags defined: can be included from assembler. */
 
 /*
@@ -96,4 +96,4 @@
 #endif
 #endif
 
-#endif /* __ASM_I386_PROCESSOR_FLAGS_H */
+#endif /* ASM_X86__PROCESSOR_FLAGS_H */
index 4df3e2f6fb563f2039cbc90aa4016dce9cf9274c..5eaf9bf0a62398b84c257f627ae6a6f8273e8b7d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_X86_PROCESSOR_H
-#define __ASM_X86_PROCESSOR_H
+#ifndef ASM_X86__PROCESSOR_H
+#define ASM_X86__PROCESSOR_H
 
 #include <asm/processor-flags.h>
 
@@ -20,6 +20,7 @@ struct mm_struct;
 #include <asm/msr.h>
 #include <asm/desc_defs.h>
 #include <asm/nops.h>
+#include <asm/ds.h>
 
 #include <linux/personality.h>
 #include <linux/cpumask.h>
@@ -140,6 +141,8 @@ DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);
 #define current_cpu_data       boot_cpu_data
 #endif
 
+extern const struct seq_operations cpuinfo_op;
+
 static inline int hlt_works(int cpu)
 {
 #ifdef CONFIG_X86_32
@@ -153,6 +156,8 @@ static inline int hlt_works(int cpu)
 
 extern void cpu_detect(struct cpuinfo_x86 *c);
 
+extern struct pt_regs *idle_regs(struct pt_regs *);
+
 extern void early_cpu_init(void);
 extern void identify_boot_cpu(void);
 extern void identify_secondary_cpu(struct cpuinfo_x86 *);
@@ -411,9 +416,14 @@ struct thread_struct {
        unsigned                io_bitmap_max;
 /* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set.  */
        unsigned long   debugctlmsr;
-/* Debug Store - if not 0 points to a DS Save Area configuration;
- *               goes into MSR_IA32_DS_AREA */
-       unsigned long   ds_area_msr;
+#ifdef CONFIG_X86_DS
+/* Debug Store context; see include/asm-x86/ds.h; goes into MSR_IA32_DS_AREA */
+       struct ds_context       *ds_ctx;
+#endif /* CONFIG_X86_DS */
+#ifdef CONFIG_X86_PTRACE_BTS
+/* the signal to send on a bts buffer overflow */
+       unsigned int    bts_ovfl_signal;
+#endif /* CONFIG_X86_PTRACE_BTS */
 };
 
 static inline unsigned long native_get_debugreg(int regno)
@@ -943,4 +953,4 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
 extern int get_tsc_mode(unsigned long adr);
 extern int set_tsc_mode(unsigned int val);
 
-#endif
+#endif /* ASM_X86__PROCESSOR_H */
index 3dd458c385c0532b59ce3aac67386ad215665dc9..6e89e8b4de0ec1c9f20f30ee2736116666a01d0e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X8664_PROTO_H
-#define _ASM_X8664_PROTO_H 1
+#ifndef ASM_X86__PROTO_H
+#define ASM_X86__PROTO_H
 
 #include <asm/ldt.h>
 
@@ -29,4 +29,4 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
 #define round_up(x, y) (((x) + (y) - 1) & ~((y) - 1))
 #define round_down(x, y) ((x) & ~((y) - 1))
 
-#endif
+#endif /* ASM_X86__PROTO_H */
index 72e7b9db29bba0e2cb736d86281ab4f7c24cdd1d..4298b8882a782ab23ac101fcf48322eb78ea2cbb 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PTRACE_ABI_H
-#define _ASM_X86_PTRACE_ABI_H
+#ifndef ASM_X86__PTRACE_ABI_H
+#define ASM_X86__PTRACE_ABI_H
 
 #ifdef __i386__
 
@@ -80,8 +80,9 @@
 
 #define PTRACE_SINGLEBLOCK     33      /* resume execution until next branch */
 
-#ifndef __ASSEMBLY__
+#ifdef CONFIG_X86_PTRACE_BTS
 
+#ifndef __ASSEMBLY__
 #include <asm/types.h>
 
 /* configuration/status structure used in PTRACE_BTS_CONFIG and
@@ -97,20 +98,20 @@ struct ptrace_bts_config {
        /* actual size of bts_struct in bytes */
        __u32 bts_size;
 };
-#endif
+#endif /* __ASSEMBLY__ */
 
 #define PTRACE_BTS_O_TRACE     0x1 /* branch trace */
 #define PTRACE_BTS_O_SCHED     0x2 /* scheduling events w/ jiffies */
 #define PTRACE_BTS_O_SIGNAL     0x4 /* send SIG<signal> on buffer overflow
                                       instead of wrapping around */
-#define PTRACE_BTS_O_CUT_SIZE  0x8 /* cut requested size to max available
-                                      instead of failing */
+#define PTRACE_BTS_O_ALLOC     0x8 /* (re)allocate buffer */
 
 #define PTRACE_BTS_CONFIG      40
 /* Configure branch trace recording.
    ADDR points to a struct ptrace_bts_config.
    DATA gives the size of that buffer.
-   A new buffer is allocated, iff the size changes.
+   A new buffer is allocated, if requested in the flags.
+   An overflow signal may only be requested for new buffers.
    Returns the number of bytes read.
 */
 #define PTRACE_BTS_STATUS      41
@@ -119,7 +120,7 @@ struct ptrace_bts_config {
    Returns the number of bytes written.
 */
 #define PTRACE_BTS_SIZE                42
-/* Return the number of available BTS records.
+/* Return the number of available BTS records for draining.
    DATA and ADDR are ignored.
 */
 #define PTRACE_BTS_GET         43
@@ -139,5 +140,6 @@ struct ptrace_bts_config {
    BTS records are read from oldest to newest.
    Returns number of BTS records drained.
 */
+#endif /* CONFIG_X86_PTRACE_BTS */
 
-#endif
+#endif /* ASM_X86__PTRACE_ABI_H */
index 8a71db803da6666bf030223503e0dcebf2778efd..d64a6109716531261d43bb1f80dc37060c6067dc 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PTRACE_H
-#define _ASM_X86_PTRACE_H
+#ifndef ASM_X86__PTRACE_H
+#define ASM_X86__PTRACE_H
 
 #include <linux/compiler.h>    /* For __user */
 #include <asm/ptrace-abi.h>
@@ -127,14 +127,48 @@ struct pt_regs {
 #endif /* __KERNEL__ */
 #endif /* !__i386__ */
 
+
+#ifdef CONFIG_X86_PTRACE_BTS
+/* a branch trace record entry
+ *
+ * In order to unify the interface between various processor versions,
+ * we use the below data structure for all processors.
+ */
+enum bts_qualifier {
+       BTS_INVALID = 0,
+       BTS_BRANCH,
+       BTS_TASK_ARRIVES,
+       BTS_TASK_DEPARTS
+};
+
+struct bts_struct {
+       __u64 qualifier;
+       union {
+               /* BTS_BRANCH */
+               struct {
+                       __u64 from_ip;
+                       __u64 to_ip;
+               } lbr;
+               /* BTS_TASK_ARRIVES or
+                  BTS_TASK_DEPARTS */
+               __u64 jiffies;
+       } variant;
+};
+#endif /* CONFIG_X86_PTRACE_BTS */
+
 #ifdef __KERNEL__
 
-/* the DS BTS struct is used for ptrace as well */
-#include <asm/ds.h>
+#include <linux/init.h>
 
+struct cpuinfo_x86;
 struct task_struct;
 
+#ifdef CONFIG_X86_PTRACE_BTS
+extern void __cpuinit ptrace_bts_init_intel(struct cpuinfo_x86 *);
 extern void ptrace_bts_take_timestamp(struct task_struct *, enum bts_qualifier);
+#else
+#define ptrace_bts_init_intel(config) do {} while (0)
+#endif /* CONFIG_X86_PTRACE_BTS */
 
 extern unsigned long profile_pc(struct pt_regs *regs);
 
@@ -148,6 +182,9 @@ extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 #endif
 
+extern long syscall_trace_enter(struct pt_regs *);
+extern void syscall_trace_leave(struct pt_regs *);
+
 static inline unsigned long regs_return_value(struct pt_regs *regs)
 {
        return regs->ax;
@@ -213,6 +250,11 @@ static inline unsigned long frame_pointer(struct pt_regs *regs)
        return regs->bp;
 }
 
+static inline unsigned long user_stack_pointer(struct pt_regs *regs)
+{
+       return regs->sp;
+}
+
 /*
  * These are defined as per linux/ptrace.h, which see.
  */
@@ -239,4 +281,4 @@ extern int do_set_thread_area(struct task_struct *p, int idx,
 
 #endif /* !__ASSEMBLY__ */
 
-#endif
+#endif /* ASM_X86__PTRACE_H */
index 6857f840b2436500a0483c37bb494cf2e388d939..edb3b4ecfc81687e46ff5aa8f24fb1a696349932 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PVCLOCK_ABI_H_
-#define _ASM_X86_PVCLOCK_ABI_H_
+#ifndef ASM_X86__PVCLOCK_ABI_H
+#define ASM_X86__PVCLOCK_ABI_H
 #ifndef __ASSEMBLY__
 
 /*
@@ -39,4 +39,4 @@ struct pvclock_wall_clock {
 } __attribute__((__packed__));
 
 #endif /* __ASSEMBLY__ */
-#endif /* _ASM_X86_PVCLOCK_ABI_H_ */
+#endif /* ASM_X86__PVCLOCK_ABI_H */
index 85b1bba8e0a34a2ac4121e1fe04324f02efdb603..1a38f68348007a64dfabf488dd623bef2a463f42 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_PVCLOCK_H_
-#define _ASM_X86_PVCLOCK_H_
+#ifndef ASM_X86__PVCLOCK_H
+#define ASM_X86__PVCLOCK_H
 
 #include <linux/clocksource.h>
 #include <asm/pvclock-abi.h>
@@ -10,4 +10,4 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
                            struct pvclock_vcpu_time_info *vcpu,
                            struct timespec *ts);
 
-#endif /* _ASM_X86_PVCLOCK_H_ */
+#endif /* ASM_X86__PVCLOCK_H */
index 206f355786dc5651b11777305974b281bb7a4e9f..1c2f0ce9e31e44b2c7cd8ab8a30e708f95db44c6 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_REBOOT_H
-#define _ASM_REBOOT_H
+#ifndef ASM_X86__REBOOT_H
+#define ASM_X86__REBOOT_H
 
 struct pt_regs;
 
@@ -18,4 +18,4 @@ void native_machine_crash_shutdown(struct pt_regs *regs);
 void native_machine_shutdown(void);
 void machine_real_restart(const unsigned char *code, int length);
 
-#endif /* _ASM_REBOOT_H */
+#endif /* ASM_X86__REBOOT_H */
index 0cb7d87c2b6847019032523fded1e6b4792bfdd4..2c2987d975706e891bbb5e58021b3158eacaac4a 100644 (file)
@@ -1,6 +1,6 @@
-#ifndef _LINUX_REBOOT_FIXUPS_H
-#define _LINUX_REBOOT_FIXUPS_H
+#ifndef ASM_X86__REBOOT_FIXUPS_H
+#define ASM_X86__REBOOT_FIXUPS_H
 
 extern void mach_reboot_fixups(void);
 
-#endif /* _LINUX_REBOOT_FIXUPS_H */
+#endif /* ASM_X86__REBOOT_FIXUPS_H */
index 5c2ff4bc2980b0c21d4973f52c123ab1cca45e7f..a01c4e376331ab48f65df1cd979439022fbd7cde 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_REQUIRED_FEATURES_H
-#define _ASM_REQUIRED_FEATURES_H 1
+#ifndef ASM_X86__REQUIRED_FEATURES_H
+#define ASM_X86__REQUIRED_FEATURES_H
 
 /* Define minimum CPUID feature set for kernel These bits are checked
    really early to actually display a visible error message before the
@@ -79,4 +79,4 @@
 #define REQUIRED_MASK6 0
 #define REQUIRED_MASK7 0
 
-#endif
+#endif /* ASM_X86__REQUIRED_FEATURES_H */
index 8d9f0b41ee86ca40f7f9b19d02f43c76348e1069..e39376d7de50f8e33b3bf22fb2c3d32c82bd89f9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_RESUME_TRACE_H
-#define _ASM_X86_RESUME_TRACE_H
+#ifndef ASM_X86__RESUME_TRACE_H
+#define ASM_X86__RESUME_TRACE_H
 
 #include <asm/asm.h>
 
@@ -7,7 +7,7 @@
 do {                                                           \
        if (pm_trace_enabled) {                                 \
                const void *tracedata;                          \
-               asm volatile(_ASM_MOV_UL " $1f,%0\n"            \
+               asm volatile(_ASM_MOV " $1f,%0\n"               \
                             ".section .tracedata,\"a\"\n"      \
                             "1:\t.word %c1\n\t"                \
                             _ASM_PTR " %c2\n"                  \
@@ -18,4 +18,4 @@ do {                                                          \
        }                                                       \
 } while (0)
 
-#endif
+#endif /* ASM_X86__RESUME_TRACE_H */
index c9448bd8968f3696f800d240078e3b0510e101b7..5e1256bdee83b791499000cb873b0135437e826f 100644 (file)
@@ -5,8 +5,8 @@
  * Author: Laurent Vivier <Laurent.Vivier@bull.net>
  */
 
-#ifndef __ASM_RIO_H
-#define __ASM_RIO_H
+#ifndef ASM_X86__RIO_H
+#define ASM_X86__RIO_H
 
 #define RIO_TABLE_VERSION      3
 
@@ -60,4 +60,4 @@ enum {
        ALT_CALGARY     = 5,    /* Second Planar Calgary      */
 };
 
-#endif /* __ASM_RIO_H */
+#endif /* ASM_X86__RIO_H */
index 6a8c0d6451080658c6b2bee54fad409b11d47a9a..48a3109e1a7d83e1101c13864c444dcad3741fad 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef _ASM_X86_RWLOCK_H
-#define _ASM_X86_RWLOCK_H
+#ifndef ASM_X86__RWLOCK_H
+#define ASM_X86__RWLOCK_H
 
 #define RW_LOCK_BIAS            0x01000000
 
 /* Actual code is in asm/spinlock.h or in arch/x86/lib/rwlock.S */
 
-#endif /* _ASM_X86_RWLOCK_H */
+#endif /* ASM_X86__RWLOCK_H */
index 750f2a3542b3931044e77835dceac28457bbece8..3ff3015b71a8367f738cb8c1974c09665b569ed3 100644 (file)
@@ -29,8 +29,8 @@
  * front, then they'll all be woken up, but no other readers will be.
  */
 
-#ifndef _I386_RWSEM_H
-#define _I386_RWSEM_H
+#ifndef ASM_X86__RWSEM_H
+#define ASM_X86__RWSEM_H
 
 #ifndef _LINUX_RWSEM_H
 #error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead"
@@ -262,4 +262,4 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem)
 }
 
 #endif /* __KERNEL__ */
-#endif /* _I386_RWSEM_H */
+#endif /* ASM_X86__RWSEM_H */
index c0432061f81a0f0609e8b115e3c23e4ff6cdcbb4..ee48f880005d13e8244c56bf6a59cb68845fdd2e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SCATTERLIST_H
-#define _ASM_X86_SCATTERLIST_H
+#ifndef ASM_X86__SCATTERLIST_H
+#define ASM_X86__SCATTERLIST_H
 
 #include <asm/types.h>
 
@@ -30,4 +30,4 @@ struct scatterlist {
 # define sg_dma_len(sg)                ((sg)->dma_length)
 #endif
 
-#endif
+#endif /* ASM_X86__SCATTERLIST_H */
index 36e71c5f306f0d29d23e7856af34cf46bfc7238c..cf9ab2dbcef1f07c0e3f864579d8f75c721a6005 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_SECCOMP_H
-#define _ASM_SECCOMP_H
+#ifndef ASM_X86__SECCOMP_32_H
+#define ASM_X86__SECCOMP_32_H
 
 #include <linux/thread_info.h>
 
@@ -14,4 +14,4 @@
 #define __NR_seccomp_exit __NR_exit
 #define __NR_seccomp_sigreturn __NR_sigreturn
 
-#endif /* _ASM_SECCOMP_H */
+#endif /* ASM_X86__SECCOMP_32_H */
index 76cfe69aa63c655d969fd80994193697637326bc..03274cea751f78e460afdd6fa66bb4c1937cb3c1 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_SECCOMP_H
-#define _ASM_SECCOMP_H
+#ifndef ASM_X86__SECCOMP_64_H
+#define ASM_X86__SECCOMP_64_H
 
 #include <linux/thread_info.h>
 
@@ -22,4 +22,4 @@
 #define __NR_seccomp_exit_32 __NR_ia32_exit
 #define __NR_seccomp_sigreturn_32 __NR_ia32_sigreturn
 
-#endif /* _ASM_SECCOMP_H */
+#endif /* ASM_X86__SECCOMP_64_H */
index 646452ea9ea3ede3d7847f5be78c8ca5a0feee48..ea5f0a8686f7539e32e92f801574454c9b3a6846 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SEGMENT_H_
-#define _ASM_X86_SEGMENT_H_
+#ifndef ASM_X86__SEGMENT_H
+#define ASM_X86__SEGMENT_H
 
 /* Constructor for a conventional segment GDT (or LDT) entry */
 /* This is a macro so it can be used in initializers */
@@ -212,4 +212,4 @@ extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][10];
 #endif
 #endif
 
-#endif
+#endif /* ASM_X86__SEGMENT_H */
index ee50c801f7b7eda1d4ea2aeea1f99cfaf1b03ccd..81f06b7e5a3f2685a88a1b7103253c3a69e34c79 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SEMBUF_H
-#define _ASM_X86_SEMBUF_H
+#ifndef ASM_X86__SEMBUF_H
+#define ASM_X86__SEMBUF_H
 
 /*
  * The semid64_ds structure for x86 architecture.
@@ -21,4 +21,4 @@ struct semid64_ds {
        unsigned long   __unused4;
 };
 
-#endif /* _ASM_X86_SEMBUF_H */
+#endif /* ASM_X86__SEMBUF_H */
index 628c801535ea912c00a57654310a832acca2e67f..303660b671e5cf6d07d02201578225cc0dfcb3ee 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SERIAL_H
-#define _ASM_X86_SERIAL_H
+#ifndef ASM_X86__SERIAL_H
+#define ASM_X86__SERIAL_H
 
 /*
  * This assumes you have a 1.8432 MHz clock for your UART.
@@ -26,4 +26,4 @@
        { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },      /* ttyS2 */     \
        { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },     /* ttyS3 */
 
-#endif /* _ASM_X86_SERIAL_H */
+#endif /* ASM_X86__SERIAL_H */
index a07c6f1c01e15b9480f14fcca8dc13d875334fc9..9030cb73c4d7acfc9def74ba772753e2710b7102 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SETUP_H
-#define _ASM_X86_SETUP_H
+#ifndef ASM_X86__SETUP_H
+#define ASM_X86__SETUP_H
 
 #define COMMAND_LINE_SIZE 2048
 
@@ -41,6 +41,7 @@ struct x86_quirks {
 };
 
 extern struct x86_quirks *x86_quirks;
+extern unsigned long saved_video_mode;
 
 #ifndef CONFIG_PARAVIRT
 #define paravirt_post_allocator_init() do {} while (0)
@@ -100,4 +101,4 @@ void __init x86_64_start_reservations(char *real_mode_data);
 #endif /* __ASSEMBLY__ */
 #endif  /*  __KERNEL__  */
 
-#endif /* _ASM_X86_SETUP_H */
+#endif /* ASM_X86__SETUP_H */
index b51413b749711f133882d9e21c432d4c28a68463..f51aec2298e9998f919d87bc734da9d994d82860 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SHMBUF_H
-#define _ASM_X86_SHMBUF_H
+#ifndef ASM_X86__SHMBUF_H
+#define ASM_X86__SHMBUF_H
 
 /*
  * The shmid64_ds structure for x86 architecture.
@@ -48,4 +48,4 @@ struct shminfo64 {
        unsigned long   __unused4;
 };
 
-#endif /* _ASM_X86_SHMBUF_H */
+#endif /* ASM_X86__SHMBUF_H */
index 0880cf0917b9ac3c1332d00700b96ebd3e7d012c..a83a1fd96a0e5a155b432d9fda755a7604882482 100644 (file)
@@ -1,6 +1,6 @@
-#ifndef _ASM_X86_SHMPARAM_H
-#define _ASM_X86_SHMPARAM_H
+#ifndef ASM_X86__SHMPARAM_H
+#define ASM_X86__SHMPARAM_H
 
 #define SHMLBA PAGE_SIZE        /* attach addr a multiple of this */
 
-#endif /* _ASM_X86_SHMPARAM_H */
+#endif /* ASM_X86__SHMPARAM_H */
index 2f9c884d2c0f3950f8a8179a6bd440fee0b228eb..24879c85b2914ec91821f0a67650706d45f3b3c2 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SIGCONTEXT_H
-#define _ASM_X86_SIGCONTEXT_H
+#ifndef ASM_X86__SIGCONTEXT_H
+#define ASM_X86__SIGCONTEXT_H
 
 #include <linux/compiler.h>
 #include <asm/types.h>
@@ -202,4 +202,4 @@ struct sigcontext {
 
 #endif /* !__i386__ */
 
-#endif
+#endif /* ASM_X86__SIGCONTEXT_H */
index 57a9686fb4917a74d0ca9f6f6f18ffd3b5bdb665..4e2ec732dd0130ac278408db300a65c2b095dd94 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _SIGCONTEXT32_H
-#define _SIGCONTEXT32_H 1
+#ifndef ASM_X86__SIGCONTEXT32_H
+#define ASM_X86__SIGCONTEXT32_H
 
 /* signal context for 32bit programs. */
 
@@ -68,4 +68,4 @@ struct sigcontext_ia32 {
        unsigned int cr2;
 };
 
-#endif
+#endif /* ASM_X86__SIGCONTEXT32_H */
index a477bea0c2a12d6dd81e356470d467fb77c7ee4e..808bdfb2958c600628df8fbc52317169033e6492 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SIGINFO_H
-#define _ASM_X86_SIGINFO_H
+#ifndef ASM_X86__SIGINFO_H
+#define ASM_X86__SIGINFO_H
 
 #ifdef __x86_64__
 # define __ARCH_SI_PREAMBLE_SIZE       (4 * sizeof(int))
@@ -7,4 +7,4 @@
 
 #include <asm-generic/siginfo.h>
 
-#endif
+#endif /* ASM_X86__SIGINFO_H */
index 6dac49364e9528c6e76d9478bf00ab9ed6b6d3bc..65acc82d267a6f3b75a42f856ae9b0ec007cf70a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SIGNAL_H
-#define _ASM_X86_SIGNAL_H
+#ifndef ASM_X86__SIGNAL_H
+#define ASM_X86__SIGNAL_H
 
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
@@ -140,6 +140,9 @@ struct sigaction {
 struct k_sigaction {
        struct sigaction sa;
 };
+
+extern void do_notify_resume(struct pt_regs *, void *, __u32);
+
 # else /* __KERNEL__ */
 /* Here we must cater to libcs that poke about in kernel headers.  */
 
@@ -256,4 +259,4 @@ struct pt_regs;
 #endif /* __KERNEL__ */
 #endif /* __ASSEMBLY__ */
 
-#endif
+#endif /* ASM_X86__SIGNAL_H */
index 3c877f74f279454cd579cf71530ef3bd051b75ff..04f84f4e2c8b727d82835574c6c2d0117bbef25e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SMP_H_
-#define _ASM_X86_SMP_H_
+#ifndef ASM_X86__SMP_H
+#define ASM_X86__SMP_H
 #ifndef __ASSEMBLY__
 #include <linux/cpumask.h>
 #include <linux/init.h>
@@ -34,6 +34,9 @@ extern cpumask_t cpu_initialized;
 DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
 DECLARE_PER_CPU(cpumask_t, cpu_core_map);
 DECLARE_PER_CPU(u16, cpu_llc_id);
+#ifdef CONFIG_X86_32
+DECLARE_PER_CPU(int, cpu_number);
+#endif
 
 DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
 DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid);
@@ -142,7 +145,6 @@ extern unsigned disabled_cpus __cpuinitdata;
  * from the initial startup. We map APIC_BASE very early in page_setup(),
  * so this is correct in the x86 case.
  */
-DECLARE_PER_CPU(int, cpu_number);
 #define raw_smp_processor_id() (x86_read_percpu(cpu_number))
 extern int safe_smp_processor_id(void);
 
@@ -205,4 +207,4 @@ extern void cpu_uninit(void);
 #endif
 
 #endif /* __ASSEMBLY__ */
-#endif
+#endif /* ASM_X86__SMP_H */
index 80af9c4ccad7f05cd09db4d0d212ec2a0753ed04..db73274c83c3b3ea302dff7a233fab452745c838 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_SOCKET_H
-#define _ASM_SOCKET_H
+#ifndef ASM_X86__SOCKET_H
+#define ASM_X86__SOCKET_H
 
 #include <asm/sockios.h>
 
@@ -54,4 +54,4 @@
 
 #define SO_MARK                        36
 
-#endif /* _ASM_SOCKET_H */
+#endif /* ASM_X86__SOCKET_H */
index 49cc72b5d3c914fa5bb98f181e37768018cc6782..a006704fdc8427cf4b4cd134bf9695375dbc3af5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SOCKIOS_H
-#define _ASM_X86_SOCKIOS_H
+#ifndef ASM_X86__SOCKIOS_H
+#define ASM_X86__SOCKIOS_H
 
 /* Socket-level I/O control calls. */
 #define FIOSETOWN      0x8901
@@ -10,4 +10,4 @@
 #define SIOCGSTAMP     0x8906          /* Get stamp (timeval) */
 #define SIOCGSTAMPNS   0x8907          /* Get stamp (timespec) */
 
-#endif /* _ASM_X86_SOCKIOS_H */
+#endif /* ASM_X86__SOCKIOS_H */
index 9bd48b0a534ba7b76ffeb439e9276af540a35081..38f8e6bc3186bb52ce64245870d651f20c24d6fd 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SPARSEMEM_H
-#define _ASM_X86_SPARSEMEM_H
+#ifndef ASM_X86__SPARSEMEM_H
+#define ASM_X86__SPARSEMEM_H
 
 #ifdef CONFIG_SPARSEMEM
 /*
@@ -31,4 +31,4 @@
 #endif
 
 #endif /* CONFIG_SPARSEMEM */
-#endif
+#endif /* ASM_X86__SPARSEMEM_H */
index e39c790dbfd2be789d812a6cdd89efc3d39cb5ec..93adae338ac64625ab1c1ec63634edd8c3d8dcd3 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _X86_SPINLOCK_H_
-#define _X86_SPINLOCK_H_
+#ifndef ASM_X86__SPINLOCK_H
+#define ASM_X86__SPINLOCK_H
 
 #include <asm/atomic.h>
 #include <asm/rwlock.h>
@@ -97,7 +97,7 @@ static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
                     "jne 1f\n\t"
                     "movw %w0,%w1\n\t"
                     "incb %h1\n\t"
-                    "lock ; cmpxchgw %w1,%2\n\t"
+                    LOCK_PREFIX "cmpxchgw %w1,%2\n\t"
                     "1:"
                     "sete %b1\n\t"
                     "movzbl %b1,%0\n\t"
@@ -135,7 +135,7 @@ static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
        int inc = 0x00010000;
        int tmp;
 
-       asm volatile("lock ; xaddl %0, %1\n"
+       asm volatile(LOCK_PREFIX "xaddl %0, %1\n"
                     "movzwl %w0, %2\n\t"
                     "shrl $16, %0\n\t"
                     "1:\t"
@@ -162,7 +162,7 @@ static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
                     "cmpl %0,%1\n\t"
                     "jne 1f\n\t"
                     "addl $0x00010000, %1\n\t"
-                    "lock ; cmpxchgl %1,%2\n\t"
+                    LOCK_PREFIX "cmpxchgl %1,%2\n\t"
                     "1:"
                     "sete %b1\n\t"
                     "movzbl %b1,%0\n\t"
@@ -366,4 +366,4 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
 #define _raw_read_relax(lock)  cpu_relax()
 #define _raw_write_relax(lock) cpu_relax()
 
-#endif
+#endif /* ASM_X86__SPINLOCK_H */
index 06c071c9eee9f1d2e5288930b91e511a3d094d61..6aa9b562c5080ae0ac7295a0adefea9ff31c138b 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_SPINLOCK_TYPES_H
-#define __ASM_SPINLOCK_TYPES_H
+#ifndef ASM_X86__SPINLOCK_TYPES_H
+#define ASM_X86__SPINLOCK_TYPES_H
 
 #ifndef __LINUX_SPINLOCK_TYPES_H
 # error "please don't include this file directly"
@@ -17,4 +17,4 @@ typedef struct {
 
 #define __RAW_RW_LOCK_UNLOCKED         { RW_LOCK_BIAS }
 
-#endif
+#endif /* ASM_X86__SPINLOCK_TYPES_H */
index 774c919dc2323cb7ecb85b1350876146414286db..5363e4f7e1cddb7b52f0db52be72eb185f5a2a5a 100644 (file)
@@ -24,8 +24,8 @@
  * Send feedback to Pat Gaughen <gone@us.ibm.com>
  */
 
-#ifndef _ASM_SRAT_H_
-#define _ASM_SRAT_H_
+#ifndef ASM_X86__SRAT_H
+#define ASM_X86__SRAT_H
 
 #ifdef CONFIG_ACPI_NUMA
 extern int get_memcfg_from_srat(void);
@@ -36,4 +36,4 @@ static inline int get_memcfg_from_srat(void)
 }
 #endif
 
-#endif /* _ASM_SRAT_H_ */
+#endif /* ASM_X86__SRAT_H */
index 30f82526a8e285547ea890febb757890d3ad4cde..f43517e28532fd930a6cf017591ac7f1bee5febc 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_STACKTRACE_H
-#define _ASM_STACKTRACE_H 1
+#ifndef ASM_X86__STACKTRACE_H
+#define ASM_X86__STACKTRACE_H
 
 extern int kstack_depth_to_print;
 
@@ -18,4 +18,4 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
                unsigned long *stack, unsigned long bp,
                const struct stacktrace_ops *ops, void *data);
 
-#endif
+#endif /* ASM_X86__STACKTRACE_H */
index 5c22dcb5d17e2e49fcae06e6b86db425730dcbad..1e120f62890546f58311c213d8f46d8ec2f0d065 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_STAT_H
-#define _ASM_X86_STAT_H
+#ifndef ASM_X86__STAT_H
+#define ASM_X86__STAT_H
 
 #define STAT_HAVE_NSEC 1
 
@@ -111,4 +111,4 @@ struct __old_kernel_stat {
 #endif
 };
 
-#endif
+#endif /* ASM_X86__STAT_H */
index 7c651aa972527928788a63648b567bf8bd70aec7..3f005bc3aa5bb0e35c6421927f6ad999d8181a1f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_STATFS_H
-#define _ASM_X86_STATFS_H
+#ifndef ASM_X86__STATFS_H
+#define ASM_X86__STATFS_H
 
 #ifdef __i386__
 #include <asm-generic/statfs.h>
@@ -60,4 +60,4 @@ struct compat_statfs64 {
 } __attribute__((packed));
 
 #endif /* !__i386__ */
-#endif
+#endif /* ASM_X86__STATFS_H */
index 193578cd1fd98af422fb5146c110ca03625d26cb..487843ed245a54bd91dadaca58413b650b0976cb 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_STRING_H_
-#define _I386_STRING_H_
+#ifndef ASM_X86__STRING_32_H
+#define ASM_X86__STRING_32_H
 
 #ifdef __KERNEL__
 
@@ -323,4 +323,4 @@ extern void *memscan(void *addr, int c, size_t size);
 
 #endif /* __KERNEL__ */
 
-#endif
+#endif /* ASM_X86__STRING_32_H */
index 52b5ab383395fde07df5e4d71f8899c8982d26b2..a2add11d3b66a6424f528cd365aaf6818db9556a 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _X86_64_STRING_H_
-#define _X86_64_STRING_H_
+#ifndef ASM_X86__STRING_64_H
+#define ASM_X86__STRING_64_H
 
 #ifdef __KERNEL__
 
@@ -57,4 +57,4 @@ int strcmp(const char *cs, const char *ct);
 
 #endif /* __KERNEL__ */
 
-#endif
+#endif /* ASM_X86__STRING_64_H */
index 8675c6782a7da2754a4b391bab931b920db9a009..acb6d4d491f4d35b704b2dac6e52ce21cb409161 100644 (file)
@@ -3,8 +3,8 @@
  * Based on code
  * Copyright 2001 Patrick Mochel <mochel@osdl.org>
  */
-#ifndef __ASM_X86_32_SUSPEND_H
-#define __ASM_X86_32_SUSPEND_H
+#ifndef ASM_X86__SUSPEND_32_H
+#define ASM_X86__SUSPEND_32_H
 
 #include <asm/desc.h>
 #include <asm/i387.h>
@@ -48,4 +48,4 @@ static inline void acpi_save_register_state(unsigned long return_point)
 extern int acpi_save_state_mem(void);
 #endif
 
-#endif /* __ASM_X86_32_SUSPEND_H */
+#endif /* ASM_X86__SUSPEND_32_H */
index dc3262b4307291bffd206e4c015d9743ae8d0a33..cf821dd310e81c9bf8858452188f70152bfe17a3 100644 (file)
@@ -3,8 +3,8 @@
  * Based on code
  * Copyright 2001 Patrick Mochel <mochel@osdl.org>
  */
-#ifndef __ASM_X86_64_SUSPEND_H
-#define __ASM_X86_64_SUSPEND_H
+#ifndef ASM_X86__SUSPEND_64_H
+#define ASM_X86__SUSPEND_64_H
 
 #include <asm/desc.h>
 #include <asm/i387.h>
@@ -49,4 +49,4 @@ extern int acpi_save_state_mem(void);
 extern char core_restore_code;
 extern char restore_registers;
 
-#endif /* __ASM_X86_64_SUSPEND_H */
+#endif /* ASM_X86__SUSPEND_64_H */
index 2730b351afcf2422695ca176cf8a7edbee57b9cc..1e20adbcad4b0cff70243b4ed71c7182e2371c64 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_SWIOTLB_H
-#define _ASM_SWIOTLB_H 1
+#ifndef ASM_X86__SWIOTLB_H
+#define ASM_X86__SWIOTLB_H
 
 #include <asm/dma-mapping.h>
 
@@ -55,4 +55,4 @@ static inline void pci_swiotlb_init(void)
 
 static inline void dma_mark_clean(void *addr, size_t size) {}
 
-#endif /* _ASM_SWIOTLB_H */
+#endif /* ASM_X86__SWIOTLB_H */
index b47a1d0b8a834719866a713dadf65a28fd566a4c..b689bee71104da4ba5b9eff3fa597606cfdd9de3 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_SYNC_BITOPS_H
-#define _I386_SYNC_BITOPS_H
+#ifndef ASM_X86__SYNC_BITOPS_H
+#define ASM_X86__SYNC_BITOPS_H
 
 /*
  * Copyright 1992, Linus Torvalds.
@@ -127,4 +127,4 @@ static inline int sync_test_and_change_bit(int nr, volatile unsigned long *addr)
 
 #undef ADDR
 
-#endif /* _I386_SYNC_BITOPS_H */
+#endif /* ASM_X86__SYNC_BITOPS_H */
diff --git a/include/asm-x86/syscall.h b/include/asm-x86/syscall.h
new file mode 100644 (file)
index 0000000..04c47dc
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * Access to user system call parameters and results
+ *
+ * Copyright (C) 2008 Red Hat, Inc.  All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ *
+ * See asm-generic/syscall.h for descriptions of what we must do here.
+ */
+
+#ifndef _ASM_SYSCALL_H
+#define _ASM_SYSCALL_H 1
+
+#include <linux/sched.h>
+#include <linux/err.h>
+
+static inline long syscall_get_nr(struct task_struct *task,
+                                 struct pt_regs *regs)
+{
+       /*
+        * We always sign-extend a -1 value being set here,
+        * so this is always either -1L or a syscall number.
+        */
+       return regs->orig_ax;
+}
+
+static inline void syscall_rollback(struct task_struct *task,
+                                   struct pt_regs *regs)
+{
+       regs->ax = regs->orig_ax;
+}
+
+static inline long syscall_get_error(struct task_struct *task,
+                                    struct pt_regs *regs)
+{
+       unsigned long error = regs->ax;
+#ifdef CONFIG_IA32_EMULATION
+       /*
+        * TS_COMPAT is set for 32-bit syscall entries and then
+        * remains set until we return to user mode.
+        */
+       if (task_thread_info(task)->status & TS_COMPAT)
+               /*
+                * Sign-extend the value so (int)-EFOO becomes (long)-EFOO
+                * and will match correctly in comparisons.
+                */
+               error = (long) (int) error;
+#endif
+       return IS_ERR_VALUE(error) ? error : 0;
+}
+
+static inline long syscall_get_return_value(struct task_struct *task,
+                                           struct pt_regs *regs)
+{
+       return regs->ax;
+}
+
+static inline void syscall_set_return_value(struct task_struct *task,
+                                           struct pt_regs *regs,
+                                           int error, long val)
+{
+       regs->ax = (long) error ?: val;
+}
+
+#ifdef CONFIG_X86_32
+
+static inline void syscall_get_arguments(struct task_struct *task,
+                                        struct pt_regs *regs,
+                                        unsigned int i, unsigned int n,
+                                        unsigned long *args)
+{
+       BUG_ON(i + n > 6);
+       memcpy(args, &regs->bx + i, n * sizeof(args[0]));
+}
+
+static inline void syscall_set_arguments(struct task_struct *task,
+                                        struct pt_regs *regs,
+                                        unsigned int i, unsigned int n,
+                                        const unsigned long *args)
+{
+       BUG_ON(i + n > 6);
+       memcpy(&regs->bx + i, args, n * sizeof(args[0]));
+}
+
+#else   /* CONFIG_X86_64 */
+
+static inline void syscall_get_arguments(struct task_struct *task,
+                                        struct pt_regs *regs,
+                                        unsigned int i, unsigned int n,
+                                        unsigned long *args)
+{
+# ifdef CONFIG_IA32_EMULATION
+       if (task_thread_info(task)->status & TS_COMPAT)
+               switch (i + n) {
+               case 6:
+                       if (!n--) break;
+                       *args++ = regs->bp;
+               case 5:
+                       if (!n--) break;
+                       *args++ = regs->di;
+               case 4:
+                       if (!n--) break;
+                       *args++ = regs->si;
+               case 3:
+                       if (!n--) break;
+                       *args++ = regs->dx;
+               case 2:
+                       if (!n--) break;
+                       *args++ = regs->cx;
+               case 1:
+                       if (!n--) break;
+                       *args++ = regs->bx;
+               case 0:
+                       if (!n--) break;
+               default:
+                       BUG();
+                       break;
+               }
+       else
+# endif
+               switch (i + n) {
+               case 6:
+                       if (!n--) break;
+                       *args++ = regs->r9;
+               case 5:
+                       if (!n--) break;
+                       *args++ = regs->r8;
+               case 4:
+                       if (!n--) break;
+                       *args++ = regs->r10;
+               case 3:
+                       if (!n--) break;
+                       *args++ = regs->dx;
+               case 2:
+                       if (!n--) break;
+                       *args++ = regs->si;
+               case 1:
+                       if (!n--) break;
+                       *args++ = regs->di;
+               case 0:
+                       if (!n--) break;
+               default:
+                       BUG();
+                       break;
+               }
+}
+
+static inline void syscall_set_arguments(struct task_struct *task,
+                                        struct pt_regs *regs,
+                                        unsigned int i, unsigned int n,
+                                        const unsigned long *args)
+{
+# ifdef CONFIG_IA32_EMULATION
+       if (task_thread_info(task)->status & TS_COMPAT)
+               switch (i + n) {
+               case 6:
+                       if (!n--) break;
+                       regs->bp = *args++;
+               case 5:
+                       if (!n--) break;
+                       regs->di = *args++;
+               case 4:
+                       if (!n--) break;
+                       regs->si = *args++;
+               case 3:
+                       if (!n--) break;
+                       regs->dx = *args++;
+               case 2:
+                       if (!n--) break;
+                       regs->cx = *args++;
+               case 1:
+                       if (!n--) break;
+                       regs->bx = *args++;
+               case 0:
+                       if (!n--) break;
+               default:
+                       BUG();
+               }
+       else
+# endif
+               switch (i + n) {
+               case 6:
+                       if (!n--) break;
+                       regs->r9 = *args++;
+               case 5:
+                       if (!n--) break;
+                       regs->r8 = *args++;
+               case 4:
+                       if (!n--) break;
+                       regs->r10 = *args++;
+               case 3:
+                       if (!n--) break;
+                       regs->dx = *args++;
+               case 2:
+                       if (!n--) break;
+                       regs->si = *args++;
+               case 1:
+                       if (!n--) break;
+                       regs->di = *args++;
+               case 0:
+                       if (!n--) break;
+               default:
+                       BUG();
+               }
+}
+
+#endif /* CONFIG_X86_32 */
+
+#endif /* _ASM_SYSCALL_H */
diff --git a/include/asm-x86/syscalls.h b/include/asm-x86/syscalls.h
new file mode 100644 (file)
index 0000000..87803da
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * syscalls.h - Linux syscall interfaces (arch-specific)
+ *
+ * Copyright (c) 2008 Jaswinder Singh
+ *
+ * This file is released under the GPLv2.
+ * See the file COPYING for more details.
+ */
+
+#ifndef _ASM_X86_SYSCALLS_H
+#define _ASM_X86_SYSCALLS_H
+
+#include <linux/compiler.h>
+#include <linux/linkage.h>
+#include <linux/types.h>
+#include <linux/signal.h>
+
+/* Common in X86_32 and X86_64 */
+/* kernel/ioport.c */
+asmlinkage long sys_ioperm(unsigned long, unsigned long, int);
+
+/* X86_32 only */
+#ifdef CONFIG_X86_32
+/* kernel/process_32.c */
+asmlinkage int sys_fork(struct pt_regs);
+asmlinkage int sys_clone(struct pt_regs);
+asmlinkage int sys_vfork(struct pt_regs);
+asmlinkage int sys_execve(struct pt_regs);
+
+/* kernel/signal_32.c */
+asmlinkage int sys_sigsuspend(int, int, old_sigset_t);
+asmlinkage int sys_sigaction(int, const struct old_sigaction __user *,
+                            struct old_sigaction __user *);
+asmlinkage int sys_sigaltstack(unsigned long);
+asmlinkage unsigned long sys_sigreturn(unsigned long);
+asmlinkage int sys_rt_sigreturn(unsigned long);
+
+/* kernel/ioport.c */
+asmlinkage long sys_iopl(unsigned long);
+
+/* kernel/ldt.c */
+asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
+
+/* kernel/sys_i386_32.c */
+asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long,
+                         unsigned long, unsigned long, unsigned long);
+struct mmap_arg_struct;
+asmlinkage int old_mmap(struct mmap_arg_struct __user *);
+struct sel_arg_struct;
+asmlinkage int old_select(struct sel_arg_struct __user *);
+asmlinkage int sys_ipc(uint, int, int, int, void __user *, long);
+struct old_utsname;
+asmlinkage int sys_uname(struct old_utsname __user *);
+struct oldold_utsname;
+asmlinkage int sys_olduname(struct oldold_utsname __user *);
+
+/* kernel/tls.c */
+asmlinkage int sys_set_thread_area(struct user_desc __user *);
+asmlinkage int sys_get_thread_area(struct user_desc __user *);
+
+/* kernel/vm86_32.c */
+asmlinkage int sys_vm86old(struct pt_regs);
+asmlinkage int sys_vm86(struct pt_regs);
+
+#else /* CONFIG_X86_32 */
+
+/* X86_64 only */
+/* kernel/process_64.c */
+asmlinkage long sys_fork(struct pt_regs *);
+asmlinkage long sys_clone(unsigned long, unsigned long,
+                         void __user *, void __user *,
+                         struct pt_regs *);
+asmlinkage long sys_vfork(struct pt_regs *);
+asmlinkage long sys_execve(char __user *, char __user * __user *,
+                          char __user * __user *,
+                          struct pt_regs *);
+
+/* kernel/ioport.c */
+asmlinkage long sys_iopl(unsigned int, struct pt_regs *);
+
+/* kernel/signal_64.c */
+asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
+                               struct pt_regs *);
+asmlinkage long sys_rt_sigreturn(struct pt_regs *);
+
+/* kernel/sys_x86_64.c */
+asmlinkage long sys_mmap(unsigned long, unsigned long, unsigned long,
+                        unsigned long, unsigned long, unsigned long);
+struct new_utsname;
+asmlinkage long sys_uname(struct new_utsname __user *);
+
+#endif /* CONFIG_X86_32 */
+#endif /* _ASM_X86_SYSCALLS_H */
index 983ce37c491fd83504fd0a82ff3a7da15f608861..34505dd7b24de4ad67b968f93b3fc24156700206 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_SYSTEM_H_
-#define _ASM_X86_SYSTEM_H_
+#ifndef ASM_X86__SYSTEM_H
+#define ASM_X86__SYSTEM_H
 
 #include <asm/asm.h>
 #include <asm/segment.h>
@@ -419,4 +419,4 @@ static inline void rdtsc_barrier(void)
        alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
 }
 
-#endif
+#endif /* ASM_X86__SYSTEM_H */
index 97fa251ccb2b088d055e0332fb97d50e5aeb480d..5aedb8bffc5a0c50fc3e6ac4576efc4686a94b37 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_SYSTEM_H
-#define __ASM_SYSTEM_H
+#ifndef ASM_X86__SYSTEM_64_H
+#define ASM_X86__SYSTEM_64_H
 
 #include <asm/segment.h>
 #include <asm/cmpxchg.h>
@@ -19,4 +19,4 @@ static inline void write_cr8(unsigned long val)
 
 #include <linux/irqflags.h>
 
-#endif
+#endif /* ASM_X86__SYSTEM_64_H */
index b1a4ea00df783cb86ea52818fb148c4d86a31ae3..e7932d7fbbab9d10ccff23b170f54d20a9e15a32 100644 (file)
@@ -21,8 +21,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#ifndef _ASM_X86_64_TCE_H
-#define _ASM_X86_64_TCE_H
+#ifndef ASM_X86__TCE_H
+#define ASM_X86__TCE_H
 
 extern unsigned int specified_table_size;
 struct iommu_table;
@@ -45,4 +45,4 @@ extern void * __init alloc_tce_table(void);
 extern void __init free_tce_table(void *tbl);
 extern int __init build_tce_table(struct pci_dev *dev, void __iomem *bbar);
 
-#endif /* _ASM_X86_64_TCE_H */
+#endif /* ASM_X86__TCE_H */
index af1b70ea440fe2e4d6fded733d86a91bcb4d89af..3d00dc5e0c717967fb0b5a73663df7850c695a58 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_TERMBITS_H
-#define _ASM_X86_TERMBITS_H
+#ifndef ASM_X86__TERMBITS_H
+#define ASM_X86__TERMBITS_H
 
 #include <linux/posix_types.h>
 
@@ -195,4 +195,4 @@ struct ktermios {
 #define        TCSADRAIN       1
 #define        TCSAFLUSH       2
 
-#endif /* _ASM_X86_TERMBITS_H */
+#endif /* ASM_X86__TERMBITS_H */
index f72956331c49349623014bffc4c241f01c361eee..e235db248071f4cbc14a881049e215b2ab6bd038 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_TERMIOS_H
-#define _ASM_X86_TERMIOS_H
+#ifndef ASM_X86__TERMIOS_H
+#define ASM_X86__TERMIOS_H
 
 #include <asm/termbits.h>
 #include <asm/ioctls.h>
@@ -110,4 +110,4 @@ static inline int kernel_termios_to_user_termios_1(struct termios __user *u,
 
 #endif /* __KERNEL__ */
 
-#endif /* _ASM_X86_TERMIOS_H */
+#endif /* ASM_X86__TERMIOS_H */
index 399bf6026b16c8fd8f17a9fcf154653321495c7a..1c7f57b6b66e413ae52bda3d2c4162703870aed0 100644 (file)
@@ -1,9 +1,9 @@
-#ifndef __ASM_I386_THERM_THROT_H__
-#define __ASM_I386_THERM_THROT_H__ 1
+#ifndef ASM_X86__THERM_THROT_H
+#define ASM_X86__THERM_THROT_H
 
 #include <asm/atomic.h>
 
 extern atomic_t therm_throt_en;
 int therm_throt_process(int curr);
 
-#endif /* __ASM_I386_THERM_THROT_H__ */
+#endif /* ASM_X86__THERM_THROT_H */
index da0a675adf94a1a753792d1bca54c45d4fe3bed4..4db0066a3a3597fab71fc9079bb5b55180ab1070 100644 (file)
@@ -4,8 +4,8 @@
  * - Incorporating suggestions made by Linus Torvalds and Dave Miller
  */
 
-#ifndef _ASM_X86_THREAD_INFO_H
-#define _ASM_X86_THREAD_INFO_H
+#ifndef ASM_X86__THREAD_INFO_H
+#define ASM_X86__THREAD_INFO_H
 
 #include <linux/compiler.h>
 #include <asm/page.h>
@@ -71,6 +71,7 @@ struct thread_info {
  * Warning: layout of LSW is hardcoded in entry.S
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
+#define TIF_NOTIFY_RESUME      1       /* callback before returning to user */
 #define TIF_SIGPENDING         2       /* signal pending */
 #define TIF_NEED_RESCHED       3       /* rescheduling necessary */
 #define TIF_SINGLESTEP         4       /* reenable singlestep on user return*/
@@ -93,6 +94,7 @@ struct thread_info {
 #define TIF_BTS_TRACE_TS       27      /* record scheduling event timestamps */
 
 #define _TIF_SYSCALL_TRACE     (1 << TIF_SYSCALL_TRACE)
+#define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1 << TIF_SIGPENDING)
 #define _TIF_SINGLESTEP                (1 << TIF_SINGLESTEP)
 #define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
@@ -133,7 +135,7 @@ struct thread_info {
 
 /* Only used for 64 bit */
 #define _TIF_DO_NOTIFY_MASK                                            \
-       (_TIF_SIGPENDING|_TIF_MCE_NOTIFY)
+       (_TIF_SIGPENDING|_TIF_MCE_NOTIFY|_TIF_NOTIFY_RESUME)
 
 /* flags to check in __switch_to() */
 #define _TIF_WORK_CTXSW                                                        \
@@ -258,4 +260,4 @@ extern void free_thread_info(struct thread_info *ti);
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
 #define arch_task_cache_init arch_task_cache_init
 #endif
-#endif /* _ASM_X86_THREAD_INFO_H */
+#endif /* ASM_X86__THREAD_INFO_H */
index a17fa473e91d41b496972aef624d3ab6483f9f91..3e724eef7ac468f118bb8c7c95edac31577cc739 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASMX86_TIME_H
-#define _ASMX86_TIME_H
+#ifndef ASM_X86__TIME_H
+#define ASM_X86__TIME_H
 
 extern void hpet_time_init(void);
 
@@ -46,6 +46,8 @@ static inline int native_set_wallclock(unsigned long nowtime)
 
 #endif
 
+extern void time_init(void);
+
 #ifdef CONFIG_PARAVIRT
 #include <asm/paravirt.h>
 #else /* !CONFIG_PARAVIRT */
@@ -58,4 +60,4 @@ static inline int native_set_wallclock(unsigned long nowtime)
 
 extern unsigned long __init calibrate_cpu(void);
 
-#endif
+#endif /* ASM_X86__TIME_H */
index fb2a4ddddf3d083296d0248c759071f3cc450b3e..d0babce4b47a6ecbc9d3ca62bf084665c49a02b9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASMi386_TIMER_H
-#define _ASMi386_TIMER_H
+#ifndef ASM_X86__TIMER_H
+#define ASM_X86__TIMER_H
 #include <linux/init.h>
 #include <linux/pm.h>
 #include <linux/percpu.h>
@@ -9,9 +9,12 @@
 unsigned long long native_sched_clock(void);
 unsigned long native_calibrate_tsc(void);
 
+#ifdef CONFIG_X86_32
 extern int timer_ack;
-extern int no_timer_check;
 extern int recalibrate_cpu_khz(void);
+#endif /* CONFIG_X86_32 */
+
+extern int no_timer_check;
 
 #ifndef CONFIG_PARAVIRT
 #define calibrate_tsc() native_calibrate_tsc()
@@ -60,4 +63,4 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc)
        return ns;
 }
 
-#endif
+#endif /* ASM_X86__TIMER_H */
index 43e5a78500c57905fa8c24f5397f37a86a13fd7a..d1ce2416a5da14e61d151150622e4dbe7491c866 100644 (file)
@@ -1,6 +1,6 @@
 /* x86 architecture timex specifications */
-#ifndef _ASM_X86_TIMEX_H
-#define _ASM_X86_TIMEX_H
+#ifndef ASM_X86__TIMEX_H
+#define ASM_X86__TIMEX_H
 
 #include <asm/processor.h>
 #include <asm/tsc.h>
@@ -16,4 +16,4 @@
 
 #define ARCH_HAS_READ_CURRENT_TIMER
 
-#endif
+#endif /* ASM_X86__TIMEX_H */
index e4e9e2d07a93194b0ec45a5c4863464bfe1b333c..db36e9e89e873c7d65a2115c119ec7d828aa6133 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_TLB_H
-#define _ASM_X86_TLB_H
+#ifndef ASM_X86__TLB_H
+#define ASM_X86__TLB_H
 
 #define tlb_start_vma(tlb, vma) do { } while (0)
 #define tlb_end_vma(tlb, vma) do { } while (0)
@@ -8,4 +8,4 @@
 
 #include <asm-generic/tlb.h>
 
-#endif
+#endif /* ASM_X86__TLB_H */
index 35c76ceb9f4055eb548da359319a687467e73f66..ef68b76dc3c5c32f0ee2f24a1ecfec5725bba003 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_TLBFLUSH_H
-#define _ASM_X86_TLBFLUSH_H
+#ifndef ASM_X86__TLBFLUSH_H
+#define ASM_X86__TLBFLUSH_H
 
 #include <linux/mm.h>
 #include <linux/sched.h>
@@ -165,4 +165,4 @@ static inline void flush_tlb_kernel_range(unsigned long start,
        flush_tlb_all();
 }
 
-#endif /* _ASM_X86_TLBFLUSH_H */
+#endif /* ASM_X86__TLBFLUSH_H */
index 90ac7718469a5b416bfd90350b24ade716698925..7eca9bc022b2dd40568f6ff963dcd271a17de616 100644 (file)
@@ -22,8 +22,8 @@
  *
  * Send feedback to <colpatch@us.ibm.com>
  */
-#ifndef _ASM_X86_TOPOLOGY_H
-#define _ASM_X86_TOPOLOGY_H
+#ifndef ASM_X86__TOPOLOGY_H
+#define ASM_X86__TOPOLOGY_H
 
 #ifdef CONFIG_X86_32
 # ifdef CONFIG_X86_HT
@@ -255,4 +255,4 @@ static inline void set_mp_bus_to_node(int busnum, int node)
 }
 #endif
 
-#endif /* _ASM_X86_TOPOLOGY_H */
+#endif /* ASM_X86__TOPOLOGY_H */
index b156b08d0131a895b4b3d3a7034be45650220e16..0406bbd898a9601efbb5af853340712ed53e19a9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __TRAMPOLINE_HEADER
-#define __TRAMPOLINE_HEADER
+#ifndef ASM_X86__TRAMPOLINE_H
+#define ASM_X86__TRAMPOLINE_H
 
 #ifndef __ASSEMBLY__
 
@@ -18,4 +18,4 @@ extern unsigned long setup_trampoline(void);
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __TRAMPOLINE_HEADER */
+#endif /* ASM_X86__TRAMPOLINE_H */
index a4b65a71bd6609e46f3da39969b522fa4958f0da..2ccebc6fb0b0143c9605ab548662718dacb8b97d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_TRAPS_H
-#define _ASM_X86_TRAPS_H
+#ifndef ASM_X86__TRAPS_H
+#define ASM_X86__TRAPS_H
 
 /* Common in X86_32 and X86_64 */
 asmlinkage void divide_error(void);
@@ -51,6 +51,8 @@ void do_spurious_interrupt_bug(struct pt_regs *, long);
 unsigned long patch_espfix_desc(unsigned long, unsigned long);
 asmlinkage void math_emulate(long);
 
+void do_page_fault(struct pt_regs *regs, unsigned long error_code);
+
 #else /* CONFIG_X86_32 */
 
 asmlinkage void double_fault(void);
@@ -62,5 +64,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *);
 asmlinkage void do_simd_coprocessor_error(struct pt_regs *);
 asmlinkage void do_spurious_interrupt_bug(struct pt_regs *);
 
+asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code);
+
 #endif /* CONFIG_X86_32 */
-#endif /* _ASM_X86_TRAPS_H */
+#endif /* ASM_X86__TRAPS_H */
index cb6f6ee45b8f858921ad4cfbcaf1f3f0d6f886a2..ad0f5c41e78cde2ba21c653cc4a159faed9e27d7 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * x86 TSC related functions
  */
-#ifndef _ASM_X86_TSC_H
-#define _ASM_X86_TSC_H
+#ifndef ASM_X86__TSC_H
+#define ASM_X86__TSC_H
 
 #include <asm/processor.h>
 
@@ -59,4 +59,4 @@ extern void check_tsc_sync_target(void);
 
 extern int notsc_setup(char *);
 
-#endif
+#endif /* ASM_X86__TSC_H */
index 1ac80cd9acf8599a143ce5cf98913b91a668eda7..e78b52e17444ac245618369c52d34514805481f9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_TYPES_H
-#define _ASM_X86_TYPES_H
+#ifndef ASM_X86__TYPES_H
+#define ASM_X86__TYPES_H
 
 #include <asm-generic/int-ll64.h>
 
@@ -33,4 +33,4 @@ typedef u32 dma_addr_t;
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 
-#endif
+#endif /* ASM_X86__TYPES_H */
index 5f702d1d52184424941d3238ee82597c9f05ce37..48ebc0ad40ec17b66b700812c5c4792662227a8f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_UACCES_H_
-#define _ASM_UACCES_H_
+#ifndef ASM_X86__UACCESS_H
+#define ASM_X86__UACCESS_H
 /*
  * User space memory access functions
  */
@@ -450,5 +450,5 @@ extern struct movsl_mask {
 # include "uaccess_64.h"
 #endif
 
-#endif
+#endif /* ASM_X86__UACCESS_H */
 
index 6fdef39a0bcb849d86e3bb0e1ade448694d21cdb..6b5b57d9c6d1f9ee55cf15cebf75090696c63f45 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __i386_UACCESS_H
-#define __i386_UACCESS_H
+#ifndef ASM_X86__UACCESS_32_H
+#define ASM_X86__UACCESS_32_H
 
 /*
  * User space memory access functions
@@ -215,4 +215,4 @@ long strnlen_user(const char __user *str, long n);
 unsigned long __must_check clear_user(void __user *mem, unsigned long len);
 unsigned long __must_check __clear_user(void __user *mem, unsigned long len);
 
-#endif /* __i386_UACCESS_H */
+#endif /* ASM_X86__UACCESS_32_H */
index 515d4dce96b598bc6e9d07dba21332a44924948c..c96c1f5d07a2c88e4f5ca547ea0f7154ac68583c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __X86_64_UACCESS_H
-#define __X86_64_UACCESS_H
+#ifndef ASM_X86__UACCESS_64_H
+#define ASM_X86__UACCESS_64_H
 
 /*
  * User space memory access functions
@@ -7,6 +7,7 @@
 #include <linux/compiler.h>
 #include <linux/errno.h>
 #include <linux/prefetch.h>
+#include <linux/lockdep.h>
 #include <asm/page.h>
 
 /*
@@ -198,4 +199,4 @@ static inline int __copy_from_user_inatomic_nocache(void *dst,
 unsigned long
 copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest);
 
-#endif /* __X86_64_UACCESS_H */
+#endif /* ASM_X86__UACCESS_64_H */
index 50a79f7fcde9e42f85fe825553b3efbd60791371..9948dd328084ef66461d2dc92c996235fc78eb5e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_UCONTEXT_H
-#define _ASM_X86_UCONTEXT_H
+#ifndef ASM_X86__UCONTEXT_H
+#define ASM_X86__UCONTEXT_H
 
 struct ucontext {
        unsigned long     uc_flags;
@@ -9,4 +9,4 @@ struct ucontext {
        sigset_t          uc_sigmask;   /* mask last for extensibility */
 };
 
-#endif /* _ASM_X86_UCONTEXT_H */
+#endif /* ASM_X86__UCONTEXT_H */
index a7bd416b4763832f0a9851df49e92c938b8c5232..59dcdec37160a02127780c1b7f9a76743c2041e0 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_UNALIGNED_H
-#define _ASM_X86_UNALIGNED_H
+#ifndef ASM_X86__UNALIGNED_H
+#define ASM_X86__UNALIGNED_H
 
 /*
  * The x86 can do unaligned accesses itself.
@@ -11,4 +11,4 @@
 #define get_unaligned __get_unaligned_le
 #define put_unaligned __put_unaligned_le
 
-#endif /* _ASM_X86_UNALIGNED_H */
+#endif /* ASM_X86__UNALIGNED_H */
index d7394673b772442677ed3ec7063a4ea384ad7b62..017f4a87c9132bbce98f194b55d80c95ea3bfd65 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_I386_UNISTD_H_
-#define _ASM_I386_UNISTD_H_
+#ifndef ASM_X86__UNISTD_32_H
+#define ASM_X86__UNISTD_32_H
 
 /*
  * This file contains the system call numbers.
 #endif
 
 #endif /* __KERNEL__ */
-#endif /* _ASM_I386_UNISTD_H_ */
+#endif /* ASM_X86__UNISTD_32_H */
index 3a341d791792ad41999893f7034e529cce28e880..ace83f1f678730134569f1efb3656a1d869156d4 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_64_UNISTD_H_
-#define _ASM_X86_64_UNISTD_H_
+#ifndef ASM_X86__UNISTD_64_H
+#define ASM_X86__UNISTD_64_H
 
 #ifndef __SYSCALL
 #define __SYSCALL(a, b)
@@ -690,4 +690,4 @@ __SYSCALL(__NR_inotify_init1, sys_inotify_init1)
 #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
 #endif /* __KERNEL__ */
 
-#endif /* _ASM_X86_64_UNISTD_H_ */
+#endif /* ASM_X86__UNISTD_64_H */
index 8b064bd9c5535fa741c404b6e202445a8a9a003b..a2151567db44388a2465bc32924f7399942a821d 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_UNWIND_H
-#define _ASM_X86_UNWIND_H
+#ifndef ASM_X86__UNWIND_H
+#define ASM_X86__UNWIND_H
 
 #define UNW_PC(frame) ((void)(frame), 0UL)
 #define UNW_SP(frame) ((void)(frame), 0UL)
@@ -10,4 +10,4 @@ static inline int arch_unw_user_mode(const void *info)
        return 0;
 }
 
-#endif /* _ASM_X86_UNWIND_H */
+#endif /* ASM_X86__UNWIND_H */
index a3d91004787924876ea3dd0a137c5c710b7f0051..aa66c1857f06580e80160b5f8c4f1a1d0495b1df 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef USER32_H
-#define USER32_H 1
+#ifndef ASM_X86__USER32_H
+#define ASM_X86__USER32_H
 
 /* IA32 compatible user structures for ptrace.
  * These should be used for 32bit coredumps too. */
@@ -67,4 +67,4 @@ struct user32 {
 };
 
 
-#endif
+#endif /* ASM_X86__USER32_H */
index d6e51edc259d909dd78035b6de1775861a86ead1..e0fe2f55f1a6c736bcc2e568b9f355c50ede638c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _I386_USER_H
-#define _I386_USER_H
+#ifndef ASM_X86__USER_32_H
+#define ASM_X86__USER_32_H
 
 #include <asm/page.h>
 /* Core file format: The core file is written in such a way that gdb
@@ -128,4 +128,4 @@ struct user{
 #define HOST_TEXT_START_ADDR (u.start_code)
 #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
 
-#endif /* _I386_USER_H */
+#endif /* ASM_X86__USER_32_H */
index 6037b634c77fd374ae744b2816e2c4765ad7ec4a..38b5799863b455ecd911ceb23685a9ec5bcde74b 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _X86_64_USER_H
-#define _X86_64_USER_H
+#ifndef ASM_X86__USER_64_H
+#define ASM_X86__USER_64_H
 
 #include <asm/types.h>
 #include <asm/page.h>
@@ -134,4 +134,4 @@ struct user {
 #define HOST_TEXT_START_ADDR (u.start_code)
 #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
 
-#endif /* _X86_64_USER_H */
+#endif /* ASM_X86__USER_64_H */
index aa73362ff5dff48d17c4c36a6339dcb22fe0d3bf..7cd6d7ec1308fe523811d462865951a8667d7ab0 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_BIOS_H
-#define _ASM_X86_BIOS_H
+#ifndef ASM_X86__UV__BIOS_H
+#define ASM_X86__UV__BIOS_H
 
 /*
  * BIOS layer definitions.
@@ -65,4 +65,4 @@ x86_bios_freq_base(unsigned long which, unsigned long *ticks_per_second,
                   unsigned long *drift_info);
 extern const char *x86_bios_strerror(long status);
 
-#endif /* _ASM_X86_BIOS_H */
+#endif /* ASM_X86__UV__BIOS_H */
index 610b6b308e93a005ff98753ea3d8586b131202ab..77153fb18f5e085c5b518cdee6e27a587d01a938 100644 (file)
@@ -8,8 +8,8 @@
  * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
  */
 
-#ifndef __ASM_X86_UV_BAU__
-#define __ASM_X86_UV_BAU__
+#ifndef ASM_X86__UV__UV_BAU_H
+#define ASM_X86__UV__UV_BAU_H
 
 #include <linux/bitmap.h>
 #define BITSPERBYTE 8
@@ -329,4 +329,4 @@ extern int uv_flush_tlb_others(cpumask_t *, struct mm_struct *, unsigned long);
 extern void uv_bau_message_intr1(void);
 extern void uv_bau_timeout_intr1(void);
 
-#endif /* __ASM_X86_UV_BAU__ */
+#endif /* ASM_X86__UV__UV_BAU_H */
index a4ef26e5850bb445e5dfa5493b1778ee85feb771..bdb5b01afbf591d66f5b1ec87ee859886459f594 100644 (file)
@@ -8,8 +8,8 @@
  * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved.
  */
 
-#ifndef __ASM_X86_UV_HUB_H__
-#define __ASM_X86_UV_HUB_H__
+#ifndef ASM_X86__UV__UV_HUB_H
+#define ASM_X86__UV__UV_HUB_H
 
 #include <linux/numa.h>
 #include <linux/percpu.h>
@@ -350,5 +350,5 @@ static inline int uv_num_possible_blades(void)
        return uv_possible_blades;
 }
 
-#endif /* __ASM_X86_UV_HUB__ */
+#endif /* ASM_X86__UV__UV_HUB_H */
 
index 151fd7fcb809138d3454c50f023de8b1b49d5335..8b03d89d2459e8f3664bf1dbca34593b40457407 100644 (file)
@@ -8,8 +8,8 @@
  * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved.
  */
 
-#ifndef __ASM_X86_UV_MMRS__
-#define __ASM_X86_UV_MMRS__
+#ifndef ASM_X86__UV__UV_MMRS_H
+#define ASM_X86__UV__UV_MMRS_H
 
 #define UV_MMR_ENABLE          (1UL << 63)
 
@@ -1292,4 +1292,4 @@ union uvh_si_alias2_overlay_config_u {
 };
 
 
-#endif /* __ASM_X86_UV_MMRS__ */
+#endif /* ASM_X86__UV__UV_MMRS_H */
index 8e18fb80f5e641ac3683b8c84c68cb511c4ab30f..4ab320913ea3abcef82fc8313127501249a201bb 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_VDSO_H
-#define _ASM_X86_VDSO_H        1
+#ifndef ASM_X86__VDSO_H
+#define ASM_X86__VDSO_H
 
 #ifdef CONFIG_X86_64
 extern const char VDSO64_PRELINK[];
@@ -44,4 +44,4 @@ extern const char vdso32_int80_start, vdso32_int80_end;
 extern const char vdso32_syscall_start, vdso32_syscall_end;
 extern const char vdso32_sysenter_start, vdso32_sysenter_end;
 
-#endif /* asm-x86/vdso.h */
+#endif /* ASM_X86__VDSO_H */
index 0ccf804377e600b7014a7247f964b8b83a4dd058..b9e493d07d07a1478ec8d42538cf55fe54e3b970 100644 (file)
@@ -4,8 +4,8 @@
  *     (c) 1998 Martin Mares <mj@ucw.cz>
  */
 
-#ifndef _LINUX_ASM_VGA_H_
-#define _LINUX_ASM_VGA_H_
+#ifndef ASM_X86__VGA_H
+#define ASM_X86__VGA_H
 
 /*
  *     On the PC, we can just recalculate addresses and then
@@ -17,4 +17,4 @@
 #define vga_readb(x) (*(x))
 #define vga_writeb(x, y) (*(y) = (x))
 
-#endif
+#endif /* ASM_X86__VGA_H */
index 3301f092934291427d1505c056b636cdd2fe8148..38fd133640211790b4dfe3e0b31a7f171d52e88c 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_VGTOD_H
-#define _ASM_VGTOD_H 1
+#ifndef ASM_X86__VGTOD_H
+#define ASM_X86__VGTOD_H
 
 #include <asm/vsyscall.h>
 #include <linux/clocksource.h>
@@ -26,4 +26,4 @@ extern struct vsyscall_gtod_data __vsyscall_gtod_data
 __section_vsyscall_gtod_data;
 extern struct vsyscall_gtod_data vsyscall_gtod_data;
 
-#endif
+#endif /* ASM_X86__VGTOD_H */
index 995258831b7f8dbf5a97b37315a0676eda7f8426..9627a8fe84e9275a28728fd81158ff465ac1cba9 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __I386_SGI_COBALT_H
-#define __I386_SGI_COBALT_H
+#ifndef ASM_X86__VISWS__COBALT_H
+#define ASM_X86__VISWS__COBALT_H
 
 #include <asm/fixmap.h>
 
@@ -122,4 +122,4 @@ extern char visws_board_type;
 
 extern char visws_board_rev;
 
-#endif /* __I386_SGI_COBALT_H */
+#endif /* ASM_X86__VISWS__COBALT_H */
index dfcd4f07ab85b9e6a1c839de753bb242eb8076c4..b36d3b378c6353dd2c62811ae8d94afafa8e55fd 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __I386_SGI_LITHIUM_H
-#define __I386_SGI_LITHIUM_H
+#ifndef ASM_X86__VISWS__LITHIUM_H
+#define ASM_X86__VISWS__LITHIUM_H
 
 #include <asm/fixmap.h>
 
@@ -49,5 +49,5 @@ static inline unsigned short li_pcib_read16(unsigned long reg)
        return *((volatile unsigned short *)(LI_PCIB_VADDR+reg));
 }
 
-#endif
+#endif /* ASM_X86__VISWS__LITHIUM_H */
 
index 83ea4f46e41984b2ecad1800a248dd3301675aae..61c938045ec95175dc74f81a9b414defb731bc03 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __I386_SGI_PIIX_H
-#define __I386_SGI_PIIX_H
+#ifndef ASM_X86__VISWS__PIIX4_H
+#define ASM_X86__VISWS__PIIX4_H
 
 /*
  * PIIX4 as used on SGI Visual Workstations
  */
 #define        PIIX_GPI_STPCLK         0x4     // STPCLK signal routed back in
 
-#endif
+#endif /* ASM_X86__VISWS__PIIX4_H */
index 5ce351325e011c72721d1f58c0b6e2d6f16f77e7..998bd18eb737d5911b8e3ffa62725957aae9a2d5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _LINUX_VM86_H
-#define _LINUX_VM86_H
+#ifndef ASM_X86__VM86_H
+#define ASM_X86__VM86_H
 
 /*
  * I'm guessing at the VIF/VIP flag usage, but hope that this is how
@@ -205,4 +205,4 @@ static inline int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c)
 
 #endif /* __KERNEL__ */
 
-#endif
+#endif /* ASM_X86__VM86_H */
index c3118c3851565c9ae7a87e0d98e355fbf3efdc7a..b2d39e6a08b73a0aec01c226e2a78c2e9ed02652 100644 (file)
@@ -22,8 +22,8 @@
  *
  */
 
-#ifndef __VMI_TIME_H
-#define __VMI_TIME_H
+#ifndef ASM_X86__VMI_TIME_H
+#define ASM_X86__VMI_TIME_H
 
 /*
  * Raw VMI call indices for timer functions
@@ -95,4 +95,4 @@ extern void __devinit vmi_time_ap_init(void);
 
 #define CONFIG_VMI_ALARM_HZ    100
 
-#endif
+#endif /* ASM_X86__VMI_TIME_H */
index 6b66ff905af0408ee9ff586c4fe49dfc001c9af1..dcd4682413de06bb0c9e41126fbb4f6d8597b104 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_X86_64_VSYSCALL_H_
-#define _ASM_X86_64_VSYSCALL_H_
+#ifndef ASM_X86__VSYSCALL_H
+#define ASM_X86__VSYSCALL_H
 
 enum vsyscall_num {
        __NR_vgettimeofday,
@@ -41,4 +41,4 @@ extern void map_vsyscall(void);
 
 #endif /* __KERNEL__ */
 
-#endif /* _ASM_X86_64_VSYSCALL_H_ */
+#endif /* ASM_X86__VSYSCALL_H */
index 8ded7472002419e1067a663799dff272623190d0..8151f5b8b6cb577588b15f8cb0ef9eb1f42da451 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __XEN_EVENTS_H
-#define __XEN_EVENTS_H
+#ifndef ASM_X86__XEN__EVENTS_H
+#define ASM_X86__XEN__EVENTS_H
 
 enum ipi_vector {
        XEN_RESCHEDULE_VECTOR,
@@ -21,4 +21,4 @@ static inline void xen_do_IRQ(int irq, struct pt_regs *regs)
        do_IRQ(regs);
 }
 
-#endif /* __XEN_EVENTS_H */
+#endif /* ASM_X86__XEN__EVENTS_H */
index 2444d4593a3babf29547dae15fc03fdd876f088c..c4baab4d2b68d9f94b10839f6941658f3923519d 100644 (file)
@@ -1,7 +1,7 @@
-#ifndef __XEN_GRANT_TABLE_H
-#define __XEN_GRANT_TABLE_H
+#ifndef ASM_X86__XEN__GRANT_TABLE_H
+#define ASM_X86__XEN__GRANT_TABLE_H
 
 #define xen_alloc_vm_area(size)        alloc_vm_area(size)
 #define xen_free_vm_area(area) free_vm_area(area)
 
-#endif /* __XEN_GRANT_TABLE_H */
+#endif /* ASM_X86__XEN__GRANT_TABLE_H */
index 91cb7fd5c1234be0f549b44f8a93208c7fedd92d..44f4259bee3f0d72a9de91a90c6adfaf0bec6abf 100644 (file)
@@ -30,8 +30,8 @@
  * IN THE SOFTWARE.
  */
 
-#ifndef __HYPERCALL_H__
-#define __HYPERCALL_H__
+#ifndef ASM_X86__XEN__HYPERCALL_H
+#define ASM_X86__XEN__HYPERCALL_H
 
 #include <linux/errno.h>
 #include <linux/string.h>
@@ -524,4 +524,4 @@ MULTI_stack_switch(struct multicall_entry *mcl,
        mcl->args[1] = esp;
 }
 
-#endif /* __HYPERCALL_H__ */
+#endif /* ASM_X86__XEN__HYPERCALL_H */
index 04ee0610014ab69e14b602487a197e5536fa9813..0ef3a88b869df8c67ec6ec64021b664d5aec71a7 100644 (file)
@@ -30,8 +30,8 @@
  * IN THE SOFTWARE.
  */
 
-#ifndef __HYPERVISOR_H__
-#define __HYPERVISOR_H__
+#ifndef ASM_X86__XEN__HYPERVISOR_H
+#define ASM_X86__XEN__HYPERVISOR_H
 
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -69,4 +69,4 @@ u64 jiffies_to_st(unsigned long jiffies);
 
 #define is_running_on_xen()    (xen_start_info ? 1 : 0)
 
-#endif /* __HYPERVISOR_H__ */
+#endif /* ASM_X86__XEN__HYPERVISOR_H */
index 9d810f2538a2227083bbe8b6bc7a7b753c9add7b..d077bba96da9753d4db566f511575ea8fe0b23db 100644 (file)
@@ -6,8 +6,8 @@
  * Copyright (c) 2004, K A Fraser
  */
 
-#ifndef __ASM_X86_XEN_INTERFACE_H
-#define __ASM_X86_XEN_INTERFACE_H
+#ifndef ASM_X86__XEN__INTERFACE_H
+#define ASM_X86__XEN__INTERFACE_H
 
 #ifdef __XEN__
 #define __DEFINE_GUEST_HANDLE(name, type) \
@@ -172,4 +172,4 @@ DEFINE_GUEST_HANDLE_STRUCT(vcpu_guest_context);
 #define XEN_CPUID          XEN_EMULATE_PREFIX "cpuid"
 #endif
 
-#endif /* __ASM_X86_XEN_INTERFACE_H */
+#endif /* ASM_X86__XEN__INTERFACE_H */
index d8ac41d5db864cfb8ca560cde4efa23fcf823ea6..08167e19fc66cdefbdc3e50c3457750a8c324115 100644 (file)
@@ -6,8 +6,8 @@
  * Copyright (c) 2004, K A Fraser
  */
 
-#ifndef __ASM_X86_XEN_INTERFACE_32_H
-#define __ASM_X86_XEN_INTERFACE_32_H
+#ifndef ASM_X86__XEN__INTERFACE_32_H
+#define ASM_X86__XEN__INTERFACE_32_H
 
 
 /*
@@ -94,4 +94,4 @@ typedef struct xen_callback xen_callback_t;
 #define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
 #define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
 
-#endif /* __ASM_X86_XEN_INTERFACE_32_H */
+#endif /* ASM_X86__XEN__INTERFACE_32_H */
index 842266ce96e66d0c1ef2ca6aa9dacce59ce72b02..046c0f1e01d4095574ce63716f34f104bfc1d8fc 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __ASM_X86_XEN_INTERFACE_64_H
-#define __ASM_X86_XEN_INTERFACE_64_H
+#ifndef ASM_X86__XEN__INTERFACE_64_H
+#define ASM_X86__XEN__INTERFACE_64_H
 
 /*
  * 64-bit segment selectors
@@ -156,4 +156,4 @@ typedef unsigned long xen_callback_t;
 #endif /* !__ASSEMBLY__ */
 
 
-#endif /* __ASM_X86_XEN_INTERFACE_64_H */
+#endif /* ASM_X86__XEN__INTERFACE_64_H */
index 7b3835d3b77d9b910228fc0362b19747eb441e26..c50185dccec192bdef7e0d936863d5503cc304d5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __XEN_PAGE_H
-#define __XEN_PAGE_H
+#ifndef ASM_X86__XEN__PAGE_H
+#define ASM_X86__XEN__PAGE_H
 
 #include <linux/pfn.h>
 
@@ -162,4 +162,4 @@ xmaddr_t arbitrary_virt_to_machine(void *address);
 void make_lowmem_page_readonly(void *vaddr);
 void make_lowmem_page_readwrite(void *vaddr);
 
-#endif /* __XEN_PAGE_H */
+#endif /* ASM_X86__XEN__PAGE_H */
index 8a12d718c16931892d7842a9e6e3c3e6020b2443..a26ebd25bac1aff43e076c6a1ab4fbd34a08cad9 100644 (file)
@@ -667,6 +667,15 @@ static inline int ata_id_has_dword_io(const u16 *id)
        return 0;
 }
 
+static inline int ata_id_has_unload(const u16 *id)
+{
+       if (ata_id_major_version(id) >= 7 &&
+           (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 &&
+           id[ATA_ID_CFSSE] & (1 << 13))
+               return 1;
+       return 0;
+}
+
 static inline int ata_id_current_chs_valid(const u16 *id)
 {
        /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
similarity index 87%
rename from arch/arm/include/asm/cnt32_to_63.h
rename to include/linux/cnt32_to_63.h
index 480c873fa746ec8a5da3d371846b643e66ecba21..8c0f9505b48cbed9cab8b268ec67519df0f01ddc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  include/asm/cnt32_to_63.h -- extend a 32-bit counter to 63 bits
+ *  Extend a 32-bit counter to 63 bits
  *
  *  Author:    Nicolas Pitre
  *  Created:   December 3, 2006
  * as published by the Free Software Foundation.
  */
 
-#ifndef __INCLUDE_CNT32_TO_63_H__
-#define __INCLUDE_CNT32_TO_63_H__
+#ifndef __LINUX_CNT32_TO_63_H__
+#define __LINUX_CNT32_TO_63_H__
 
 #include <linux/compiler.h>
-#include <asm/types.h>
+#include <linux/types.h>
 #include <asm/byteorder.h>
 
-/*
- * Prototype: u64 cnt32_to_63(u32 cnt)
+/* this is used only to give gcc a clue about good code generation */
+union cnt32_to_63 {
+       struct {
+#if defined(__LITTLE_ENDIAN)
+               u32 lo, hi;
+#elif defined(__BIG_ENDIAN)
+               u32 hi, lo;
+#endif
+       };
+       u64 val;
+};
+
+
+/**
+ * cnt32_to_63 - Expand a 32-bit counter to a 63-bit counter
+ * @cnt_lo: The low part of the counter
+ *
  * Many hardware clock counters are only 32 bits wide and therefore have
  * a relatively short period making wrap-arounds rather frequent.  This
  * is a problem when implementing sched_clock() for example, where a 64-bit
  * clear-bit instruction. Otherwise caller must remember to clear the top
  * bit explicitly.
  */
-
-/* this is used only to give gcc a clue about good code generation */
-typedef union {
-       struct {
-#if defined(__LITTLE_ENDIAN)
-               u32 lo, hi;
-#elif defined(__BIG_ENDIAN)
-               u32 hi, lo;
-#endif
-       };
-       u64 val;
-} cnt32_to_63_t;
-
 #define cnt32_to_63(cnt_lo) \
 ({ \
-       static volatile u32 __m_cnt_hi = 0; \
-       cnt32_to_63_t __x; \
+       static volatile u32 __m_cnt_hi; \
+       union cnt32_to_63 __x; \
        __x.hi = __m_cnt_hi; \
        __x.lo = (cnt_lo); \
-       if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \
+       if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \
                __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \
        __x.val; \
 })
index 6d93dce61cbbc25c8b17d2f8f8c5c9d0e864ee9f..2f245fe63bda5611ad909c1452aa8a79c4f29eb4 100644 (file)
@@ -47,14 +47,22 @@ enum hrtimer_restart {
  *     HRTIMER_CB_IRQSAFE:             Callback may run in hardirq context
  *     HRTIMER_CB_IRQSAFE_NO_RESTART:  Callback may run in hardirq context and
  *                                     does not restart the timer
- *     HRTIMER_CB_IRQSAFE_NO_SOFTIRQ:  Callback must run in hardirq context
- *                                     Special mode for tick emultation
+ *     HRTIMER_CB_IRQSAFE_PERCPU:      Callback must run in hardirq context
+ *                                     Special mode for tick emulation and
+ *                                     scheduler timer. Such timers are per
+ *                                     cpu and not allowed to be migrated on
+ *                                     cpu unplug.
+ *     HRTIMER_CB_IRQSAFE_UNLOCKED:    Callback should run in hardirq context
+ *                                     with timer->base lock unlocked
+ *                                     used for timers which call wakeup to
+ *                                     avoid lock order problems with rq->lock
  */
 enum hrtimer_cb_mode {
        HRTIMER_CB_SOFTIRQ,
        HRTIMER_CB_IRQSAFE,
        HRTIMER_CB_IRQSAFE_NO_RESTART,
-       HRTIMER_CB_IRQSAFE_NO_SOFTIRQ,
+       HRTIMER_CB_IRQSAFE_PERCPU,
+       HRTIMER_CB_IRQSAFE_UNLOCKED,
 };
 
 /*
@@ -67,9 +75,10 @@ enum hrtimer_cb_mode {
  * 0x02                callback function running
  * 0x04                callback pending (high resolution mode)
  *
- * Special case:
+ * Special cases:
  * 0x03                callback function running and enqueued
  *             (was requeued on another CPU)
+ * 0x09                timer was migrated on CPU hotunplug
  * The "callback function running and enqueued" status is only possible on
  * SMP. It happens for example when a posix timer expired and the callback
  * queued a signal. Between dropping the lock which protects the posix timer
@@ -87,6 +96,7 @@ enum hrtimer_cb_mode {
 #define HRTIMER_STATE_ENQUEUED 0x01
 #define HRTIMER_STATE_CALLBACK 0x02
 #define HRTIMER_STATE_PENDING  0x04
+#define HRTIMER_STATE_MIGRATE  0x08
 
 /**
  * struct hrtimer - the basic hrtimer structure
index 1524829f73f2cd8c5aa4fc9cbc6bd47c7a1fa48f..6514db8fd2e413b0f7912982207b5dea5b0a3e8b 100644 (file)
@@ -366,7 +366,9 @@ enum {
        /* Currently on a filemark */
        IDE_AFLAG_FILEMARK              = (1 << 25),
        /* 0 = no tape is loaded, so we don't rewind after ejecting */
-       IDE_AFLAG_MEDIUM_PRESENT        = (1 << 26)
+       IDE_AFLAG_MEDIUM_PRESENT        = (1 << 26),
+
+       IDE_AFLAG_NO_AUTOCLOSE          = (1 << 27),
 };
 
 struct ide_drive_s {
index 225bfc5bd9ec1eb43b143d059f926918a30c2656..947cf84e555d66acc7c4869fdc6595bb1141dfcb 100644 (file)
@@ -146,6 +146,7 @@ enum {
        ATA_DFLAG_SPUNDOWN      = (1 << 14), /* XXX: for spindown_compat */
        ATA_DFLAG_SLEEPING      = (1 << 15), /* device is sleeping */
        ATA_DFLAG_DUBIOUS_XFER  = (1 << 16), /* data transfer not verified */
+       ATA_DFLAG_NO_UNLOAD     = (1 << 17), /* device doesn't support unload */
        ATA_DFLAG_INIT_MASK     = (1 << 24) - 1,
 
        ATA_DFLAG_DETACH        = (1 << 24),
@@ -244,6 +245,7 @@ enum {
        ATA_TMOUT_BOOT          = 30000,        /* heuristic */
        ATA_TMOUT_BOOT_QUICK    =  7000,        /* heuristic */
        ATA_TMOUT_INTERNAL_QUICK = 5000,
+       ATA_TMOUT_MAX_PARK      = 30000,
 
        /* FIXME: GoVault needs 2s but we can't afford that without
         * parallel probing.  800ms is enough for iVDR disk
@@ -319,8 +321,11 @@ enum {
        ATA_EH_RESET            = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
        ATA_EH_ENABLE_LINK      = (1 << 3),
        ATA_EH_LPM              = (1 << 4),  /* link power management action */
+       ATA_EH_PARK             = (1 << 5), /* unload heads and stop I/O */
 
-       ATA_EH_PERDEV_MASK      = ATA_EH_REVALIDATE,
+       ATA_EH_PERDEV_MASK      = ATA_EH_REVALIDATE | ATA_EH_PARK,
+       ATA_EH_ALL_ACTIONS      = ATA_EH_REVALIDATE | ATA_EH_RESET |
+                                 ATA_EH_ENABLE_LINK | ATA_EH_LPM,
 
        /* ata_eh_info->flags */
        ATA_EHI_HOTPLUGGED      = (1 << 0),  /* could have been hotplugged */
@@ -452,6 +457,7 @@ enum link_pm {
        MEDIUM_POWER,
 };
 extern struct device_attribute dev_attr_link_power_management_policy;
+extern struct device_attribute dev_attr_unload_heads;
 extern struct device_attribute dev_attr_em_message_type;
 extern struct device_attribute dev_attr_em_message;
 extern struct device_attribute dev_attr_sw_activity;
@@ -554,8 +560,8 @@ struct ata_ering {
 struct ata_device {
        struct ata_link         *link;
        unsigned int            devno;          /* 0 or 1 */
-       unsigned long           flags;          /* ATA_DFLAG_xxx */
        unsigned int            horkage;        /* List of broken features */
+       unsigned long           flags;          /* ATA_DFLAG_xxx */
        struct scsi_device      *sdev;          /* attached SCSI device */
 #ifdef CONFIG_ATA_ACPI
        acpi_handle             acpi_handle;
@@ -564,6 +570,7 @@ struct ata_device {
        /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
        u64                     n_sectors;      /* size of device, if ATA */
        unsigned int            class;          /* ATA_DEV_xxx */
+       unsigned long           unpark_deadline;
 
        u8                      pio_mode;
        u8                      dma_mode;
@@ -621,6 +628,7 @@ struct ata_eh_context {
                                               [ATA_EH_CMD_TIMEOUT_TABLE_SIZE];
        unsigned int            classes[ATA_MAX_DEVICES];
        unsigned int            did_probe_mask;
+       unsigned int            unloaded_mask;
        unsigned int            saved_ncq_enabled;
        u8                      saved_xfer_mode[ATA_MAX_DEVICES];
        /* timestamp for the last reset attempt or success */
@@ -688,7 +696,8 @@ struct ata_port {
        unsigned int            qc_active;
        int                     nr_active_links; /* #links with active qcs */
 
-       struct ata_link         link;   /* host default link */
+       struct ata_link         link;           /* host default link */
+       struct ata_link         *slave_link;    /* see ata_slave_link_init() */
 
        int                     nr_pmp_links;   /* nr of available PMP links */
        struct ata_link         *pmp_link;      /* array of PMP links */
@@ -709,6 +718,7 @@ struct ata_port {
        struct list_head        eh_done_q;
        wait_queue_head_t       eh_wait_q;
        int                     eh_tries;
+       struct completion       park_req_pending;
 
        pm_message_t            pm_mesg;
        int                     *pm_result;
@@ -772,8 +782,8 @@ struct ata_port_operations {
        /*
         * Optional features
         */
-       int  (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val);
-       int  (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val);
+       int  (*scr_read)(struct ata_link *link, unsigned int sc_reg, u32 *val);
+       int  (*scr_write)(struct ata_link *link, unsigned int sc_reg, u32 val);
        void (*pmp_attach)(struct ata_port *ap);
        void (*pmp_detach)(struct ata_port *ap);
        int  (*enable_pm)(struct ata_port *ap, enum link_pm policy);
@@ -895,6 +905,7 @@ extern void ata_port_disable(struct ata_port *);
 extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
 extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
                        const struct ata_port_info * const * ppi, int n_ports);
+extern int ata_slave_link_init(struct ata_port *ap);
 extern int ata_host_start(struct ata_host *host);
 extern int ata_host_register(struct ata_host *host,
                             struct scsi_host_template *sht);
@@ -920,8 +931,8 @@ extern int sata_scr_valid(struct ata_link *link);
 extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
 extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
 extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
-extern int ata_link_online(struct ata_link *link);
-extern int ata_link_offline(struct ata_link *link);
+extern bool ata_link_online(struct ata_link *link);
+extern bool ata_link_offline(struct ata_link *link);
 #ifdef CONFIG_PM
 extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
 extern void ata_host_resume(struct ata_host *host);
@@ -1098,6 +1109,7 @@ extern void ata_std_error_handler(struct ata_port *ap);
  */
 extern const struct ata_port_operations ata_base_port_ops;
 extern const struct ata_port_operations sata_port_ops;
+extern struct device_attribute *ata_common_sdev_attrs[];
 
 #define ATA_BASE_SHT(drv_name)                                 \
        .module                 = THIS_MODULE,                  \
@@ -1112,7 +1124,8 @@ extern const struct ata_port_operations sata_port_ops;
        .proc_name              = drv_name,                     \
        .slave_configure        = ata_scsi_slave_config,        \
        .slave_destroy          = ata_scsi_slave_destroy,       \
-       .bios_param             = ata_std_bios_param
+       .bios_param             = ata_std_bios_param,           \
+       .sdev_attrs             = ata_common_sdev_attrs
 
 #define ATA_NCQ_SHT(drv_name)                                  \
        ATA_BASE_SHT(drv_name),                                 \
@@ -1134,7 +1147,7 @@ static inline bool sata_pmp_attached(struct ata_port *ap)
 
 static inline int ata_is_host_link(const struct ata_link *link)
 {
-       return link == &link->ap->link;
+       return link == &link->ap->link || link == link->ap->slave_link;
 }
 #else /* CONFIG_SATA_PMP */
 static inline bool sata_pmp_supported(struct ata_port *ap)
@@ -1167,7 +1180,7 @@ static inline int sata_srst_pmp(struct ata_link *link)
        printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
 
 #define ata_link_printk(link, lv, fmt, args...) do { \
-       if (sata_pmp_attached((link)->ap)) \
+       if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link)    \
                printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id,   \
                       (link)->pmp , ##args); \
        else \
@@ -1265,34 +1278,17 @@ static inline int ata_link_active(struct ata_link *link)
        return ata_tag_valid(link->active_tag) || link->sactive;
 }
 
-static inline struct ata_link *ata_port_first_link(struct ata_port *ap)
-{
-       if (sata_pmp_attached(ap))
-               return ap->pmp_link;
-       return &ap->link;
-}
-
-static inline struct ata_link *ata_port_next_link(struct ata_link *link)
-{
-       struct ata_port *ap = link->ap;
-
-       if (ata_is_host_link(link)) {
-               if (!sata_pmp_attached(ap))
-                       return NULL;
-               return ap->pmp_link;
-       }
-
-       if (++link < ap->nr_pmp_links + ap->pmp_link)
-               return link;
-       return NULL;
-}
+extern struct ata_link *__ata_port_next_link(struct ata_port *ap,
+                                            struct ata_link *link,
+                                            bool dev_only);
 
-#define __ata_port_for_each_link(lk, ap) \
-       for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk))
+#define __ata_port_for_each_link(link, ap) \
+       for ((link) = __ata_port_next_link((ap), NULL, false); (link); \
+            (link) = __ata_port_next_link((ap), (link), false))
 
 #define ata_port_for_each_link(link, ap) \
-       for ((link) = ata_port_first_link(ap); (link); \
-            (link) = ata_port_next_link(link))
+       for ((link) = __ata_port_next_link((ap), NULL, true); (link); \
+            (link) = __ata_port_next_link((ap), (link), true))
 
 #define ata_link_for_each_dev(dev, link) \
        for ((dev) = (link)->device; \
index 655ea0d1ee1474d11a1dbd23c51bf5ef8f679fda..b2f944468313bb296bbdf83d7ff574615a588b1b 100644 (file)
@@ -141,6 +141,10 @@ enum {
        MLX4_STAT_RATE_OFFSET   = 5
 };
 
+enum {
+       MLX4_MTT_FLAG_PRESENT           = 1
+};
+
 static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
 {
        return (major << 32) | (minor << 16) | subminor;
index c0e14008a3c2bba4000ff5366bd54c3b24072301..98dc6243a706424ae099853320ef34edab5a8bc8 100644 (file)
@@ -534,7 +534,7 @@ extern void pci_sort_breadthfirst(void);
 #ifdef CONFIG_PCI_LEGACY
 struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
                                             unsigned int device,
-                                            const struct pci_dev *from);
+                                            struct pci_dev *from);
 struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
                                           unsigned int devfn);
 #endif /* CONFIG_PCI_LEGACY */
@@ -550,7 +550,7 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
                                struct pci_dev *from);
 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
                                unsigned int ss_vendor, unsigned int ss_device,
-                               const struct pci_dev *from);
+                               struct pci_dev *from);
 struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
 struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
 struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
@@ -816,7 +816,7 @@ _PCI_NOP_ALL(write,)
 
 static inline struct pci_dev *pci_find_device(unsigned int vendor,
                                              unsigned int device,
-                                             const struct pci_dev *from)
+                                             struct pci_dev *from)
 {
        return NULL;
 }
@@ -838,7 +838,7 @@ static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
                                             unsigned int device,
                                             unsigned int ss_vendor,
                                             unsigned int ss_device,
-                                            const struct pci_dev *from)
+                                            struct pci_dev *from)
 {
        return NULL;
 }
index 1ce54b63085dd09b1ee5826694294969fe2a1f78..be764e514e35946eeced5615440769912da9e0fa 100644 (file)
@@ -21,7 +21,14 @@ struct pnp_dev;
 /*
  * Resource Management
  */
+#ifdef CONFIG_PNP
 struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int);
+#else
+static inline struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned int type, unsigned int num)
+{
+       return NULL;
+}
+#endif
 
 static inline int pnp_resource_valid(struct resource *res)
 {
index b160fb18e8d6ce6f724827fe19fd31dfe748ddb8..37aaf2b3986386b3c73784e91c8b70327ecfbbd2 100644 (file)
@@ -6,6 +6,7 @@ extern int ramfs_get_sb(struct file_system_type *fs_type,
         int flags, const char *dev_name, void *data, struct vfsmount *mnt);
 
 #ifndef CONFIG_MMU
+extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);
 extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
                                                   unsigned long addr,
                                                   unsigned long len,
index caa43b2370cb04b6b12e7aa47d398e35dbfbedb3..82fefddc5987d0fba7925c76a14f2ac52dd82caf 100644 (file)
@@ -11,7 +11,9 @@
 
 #include <linux/types.h>
 #include <linux/magic.h>
+#ifdef __KERNEL__
 #include <linux/time.h>
+#endif
 
 enum smb_protocol { 
        SMB_PROTOCOL_NONE, 
index 5da9794b2d782d27f3f77fde3418521a6a19a3e8..b106fd8e0d5c4298d6495e1d48cefdd81d21910d 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __LINUX_STACKTRACE_H
 #define __LINUX_STACKTRACE_H
 
+struct task_struct;
+
 #ifdef CONFIG_STACKTRACE
 struct stack_trace {
        unsigned int nr_entries, max_entries;
index b3d3e27c62999d08360dcb51c15430d2d93c953d..c3626c0ba9d39a4358e028c328dfe534c5393b18 100644 (file)
@@ -596,4 +596,5 @@ int p9_idpool_check(int id, struct p9_idpool *p);
 int p9_error_init(void);
 int p9_errstr2errno(char *, int);
 int p9_trans_fd_init(void);
+void p9_trans_fd_exit(void);
 #endif /* NET_9P_H */
index 0db3a4038dc0d1e8feb9f89f763203169b335b36..3ca737120a90cff4f845d8ccc66fc9173e0fcd6f 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef NET_9P_TRANSPORT_H
 #define NET_9P_TRANSPORT_H
 
+#include <linux/module.h>
+
 /**
  * enum p9_trans_status - different states of underlying transports
  * @Connected: transport is connected and healthy
@@ -91,9 +93,12 @@ struct p9_trans_module {
        int maxsize;            /* max message size of transport */
        int def;                /* this transport should be default */
        struct p9_trans * (*create)(const char *, char *, int, unsigned char);
+       struct module *owner;
 };
 
 void v9fs_register_trans(struct p9_trans_module *m);
-struct p9_trans_module *v9fs_match_trans(const substring_t *name);
-struct p9_trans_module *v9fs_default_trans(void);
+void v9fs_unregister_trans(struct p9_trans_module *m);
+struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name);
+struct p9_trans_module *v9fs_get_default_trans(void);
+void v9fs_put_trans(struct p9_trans_module *m);
 #endif /* NET_9P_TRANSPORT_H */
index 24811732bdb2515977d7defbb5b9ce548dcea315..029a54a0239695894656d99c0342f0ed37b0ce61 100644 (file)
@@ -227,6 +227,9 @@ struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *,
                                   const struct sctp_chunk *,
                                   const __u8 *,
                                   const size_t );
+struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *,
+                                  const struct sctp_chunk *,
+                                  struct sctp_paramhdr *);
 struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *,
                                  const struct sctp_transport *,
                                  const void *payload,
index f6f7042331dc3ef9dbf156a807398936e0824b1a..3820323c4c8467c07831a8844532fb85976e9a9f 100644 (file)
@@ -708,7 +708,7 @@ int do_one_initcall(initcall_t fn)
        int result;
 
        if (initcall_debug) {
-               print_fn_descriptor_symbol("calling  %s\n", fn);
+               printk("calling  %pF\n", fn);
                t0 = ktime_get();
        }
 
@@ -718,8 +718,8 @@ int do_one_initcall(initcall_t fn)
                t1 = ktime_get();
                delta = ktime_sub(t1, t0);
 
-               print_fn_descriptor_symbol("initcall %s", fn);
-               printk(" returned %d after %Ld msecs\n", result,
+               printk("initcall %pF returned %d after %Ld msecs\n",
+                       fn, result,
                        (unsigned long long) delta.tv64 >> 20);
        }
 
@@ -737,8 +737,7 @@ int do_one_initcall(initcall_t fn)
                local_irq_enable();
        }
        if (msgbuf[0]) {
-               print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn);
-               printk(" returned with %s\n", msgbuf);
+               printk("initcall %pF returned with %s\n", fn, msgbuf);
        }
 
        return result;
index 13932abde15914e36a0d4f33e10b4a9a653f8c31..a0123d75ec9a7624f897bc2984ca4009b61abfbc 100644 (file)
@@ -2738,14 +2738,15 @@ void cgroup_fork_callbacks(struct task_struct *child)
  */
 void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
 {
-       struct cgroup *oldcgrp, *newcgrp;
+       struct cgroup *oldcgrp, *newcgrp = NULL;
 
        if (need_mm_owner_callback) {
                int i;
                for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
                        struct cgroup_subsys *ss = subsys[i];
                        oldcgrp = task_cgroup(old, ss->subsys_id);
-                       newcgrp = task_cgroup(new, ss->subsys_id);
+                       if (new)
+                               newcgrp = task_cgroup(new, ss->subsys_id);
                        if (oldcgrp == newcgrp)
                                continue;
                        if (ss->mm_owner_changed)
index 16395644a98ff8c060b2f5fd776fe7abadd61c6a..85a83c831856c193570e40a3b7d3e03ef8862d1c 100644 (file)
@@ -583,8 +583,6 @@ mm_need_new_owner(struct mm_struct *mm, struct task_struct *p)
         * If there are other users of the mm and the owner (us) is exiting
         * we need to find a new owner to take on the responsibility.
         */
-       if (!mm)
-               return 0;
        if (atomic_read(&mm->mm_users) <= 1)
                return 0;
        if (mm->owner != p)
@@ -627,6 +625,16 @@ retry:
        } while_each_thread(g, c);
 
        read_unlock(&tasklist_lock);
+       /*
+        * We found no owner yet mm_users > 1: this implies that we are
+        * most likely racing with swapoff (try_to_unuse()) or /proc or
+        * ptrace or page migration (get_task_mm()).  Mark owner as NULL,
+        * so that subsystems can understand the callback and take action.
+        */
+       down_write(&mm->mmap_sem);
+       cgroup_mm_owner_callbacks(mm->owner, NULL);
+       mm->owner = NULL;
+       up_write(&mm->mmap_sem);
        return;
 
 assign_new_owner:
index b8e4dce80a748dc06c94ed6cb43225903c7f99c1..cdec83e722fa1b80ee0af0f828d8e47532431a20 100644 (file)
@@ -672,13 +672,14 @@ static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
                         */
                        BUG_ON(timer->function(timer) != HRTIMER_NORESTART);
                        return 1;
-               case HRTIMER_CB_IRQSAFE_NO_SOFTIRQ:
+               case HRTIMER_CB_IRQSAFE_PERCPU:
+               case HRTIMER_CB_IRQSAFE_UNLOCKED:
                        /*
                         * This is solely for the sched tick emulation with
                         * dynamic tick support to ensure that we do not
                         * restart the tick right on the edge and end up with
                         * the tick timer in the softirq ! The calling site
-                        * takes care of this.
+                        * takes care of this. Also used for hrtimer sleeper !
                         */
                        debug_hrtimer_deactivate(timer);
                        return 1;
@@ -1245,7 +1246,8 @@ static void __run_hrtimer(struct hrtimer *timer)
        timer_stats_account_hrtimer(timer);
 
        fn = timer->function;
-       if (timer->cb_mode == HRTIMER_CB_IRQSAFE_NO_SOFTIRQ) {
+       if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU ||
+           timer->cb_mode == HRTIMER_CB_IRQSAFE_UNLOCKED) {
                /*
                 * Used for scheduler timers, avoid lock inversion with
                 * rq->lock and tasklist_lock.
@@ -1452,7 +1454,7 @@ void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task)
        sl->timer.function = hrtimer_wakeup;
        sl->task = task;
 #ifdef CONFIG_HIGH_RES_TIMERS
-       sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED;
 #endif
 }
 
@@ -1591,29 +1593,95 @@ static void __cpuinit init_hrtimers_cpu(int cpu)
 
 #ifdef CONFIG_HOTPLUG_CPU
 
-static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
-                               struct hrtimer_clock_base *new_base)
+static int migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
+                               struct hrtimer_clock_base *new_base, int dcpu)
 {
        struct hrtimer *timer;
        struct rb_node *node;
+       int raise = 0;
 
        while ((node = rb_first(&old_base->active))) {
                timer = rb_entry(node, struct hrtimer, node);
                BUG_ON(hrtimer_callback_running(timer));
                debug_hrtimer_deactivate(timer);
-               __remove_hrtimer(timer, old_base, HRTIMER_STATE_INACTIVE, 0);
+
+               /*
+                * Should not happen. Per CPU timers should be
+                * canceled _before_ the migration code is called
+                */
+               if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU) {
+                       __remove_hrtimer(timer, old_base,
+                                        HRTIMER_STATE_INACTIVE, 0);
+                       WARN(1, "hrtimer (%p %p)active but cpu %d dead\n",
+                            timer, timer->function, dcpu);
+                       continue;
+               }
+
+               /*
+                * Mark it as STATE_MIGRATE not INACTIVE otherwise the
+                * timer could be seen as !active and just vanish away
+                * under us on another CPU
+                */
+               __remove_hrtimer(timer, old_base, HRTIMER_STATE_MIGRATE, 0);
                timer->base = new_base;
                /*
                 * Enqueue the timer. Allow reprogramming of the event device
                 */
                enqueue_hrtimer(timer, new_base, 1);
+
+#ifdef CONFIG_HIGH_RES_TIMERS
+               /*
+                * Happens with high res enabled when the timer was
+                * already expired and the callback mode is
+                * HRTIMER_CB_IRQSAFE_UNLOCKED (hrtimer_sleeper). The
+                * enqueue code does not move them to the soft irq
+                * pending list for performance/latency reasons, but
+                * in the migration state, we need to do that
+                * otherwise we end up with a stale timer.
+                */
+               if (timer->state == HRTIMER_STATE_MIGRATE) {
+                       timer->state = HRTIMER_STATE_PENDING;
+                       list_add_tail(&timer->cb_entry,
+                                     &new_base->cpu_base->cb_pending);
+                       raise = 1;
+               }
+#endif
+               /* Clear the migration state bit */
+               timer->state &= ~HRTIMER_STATE_MIGRATE;
+       }
+       return raise;
+}
+
+#ifdef CONFIG_HIGH_RES_TIMERS
+static int migrate_hrtimer_pending(struct hrtimer_cpu_base *old_base,
+                                  struct hrtimer_cpu_base *new_base)
+{
+       struct hrtimer *timer;
+       int raise = 0;
+
+       while (!list_empty(&old_base->cb_pending)) {
+               timer = list_entry(old_base->cb_pending.next,
+                                  struct hrtimer, cb_entry);
+
+               __remove_hrtimer(timer, timer->base, HRTIMER_STATE_PENDING, 0);
+               timer->base = &new_base->clock_base[timer->base->index];
+               list_add_tail(&timer->cb_entry, &new_base->cb_pending);
+               raise = 1;
        }
+       return raise;
+}
+#else
+static int migrate_hrtimer_pending(struct hrtimer_cpu_base *old_base,
+                                  struct hrtimer_cpu_base *new_base)
+{
+       return 0;
 }
+#endif
 
 static void migrate_hrtimers(int cpu)
 {
        struct hrtimer_cpu_base *old_base, *new_base;
-       int i;
+       int i, raise = 0;
 
        BUG_ON(cpu_online(cpu));
        old_base = &per_cpu(hrtimer_bases, cpu);
@@ -1626,14 +1694,21 @@ static void migrate_hrtimers(int cpu)
        spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
 
        for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
-               migrate_hrtimer_list(&old_base->clock_base[i],
-                                    &new_base->clock_base[i]);
+               if (migrate_hrtimer_list(&old_base->clock_base[i],
+                                        &new_base->clock_base[i], cpu))
+                       raise = 1;
        }
 
+       if (migrate_hrtimer_pending(old_base, new_base))
+               raise = 1;
+
        spin_unlock(&old_base->lock);
        spin_unlock(&new_base->lock);
        local_irq_enable();
        put_cpu_var(hrtimer_bases);
+
+       if (raise)
+               hrtimer_raise_softirq();
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
index 59f3f0df35d4e04365480f5362aac097a236b63d..aef265325cd3596db981ed2515efec42f255804e 100644 (file)
@@ -753,8 +753,14 @@ static struct page *kimage_alloc_page(struct kimage *image,
                        *old = addr | (*old & ~PAGE_MASK);
 
                        /* The old page I have found cannot be a
-                        * destination page, so return it.
+                        * destination page, so return it if it's
+                        * gfp_flags honor the ones passed in.
                         */
+                       if (!(gfp_mask & __GFP_HIGHMEM) &&
+                           PageHighMem(old_page)) {
+                               kimage_free_pages(old_page);
+                               continue;
+                       }
                        addr = old_addr;
                        page = old_page;
                        break;
index eaa21fc9ad1d54250142a6c806115267865d3be6..e4dcfb2272a4184b19903927b1c438169788461a 100644 (file)
@@ -488,7 +488,7 @@ static int write_mem_msg(int binary)
                if (err)
                        return err;
                if (CACHE_FLUSH_IS_SAFE)
-                       flush_icache_range(addr, addr + length + 1);
+                       flush_icache_range(addr, addr + length);
                return 0;
        }
 
@@ -590,6 +590,7 @@ static void kgdb_wait(struct pt_regs *regs)
 
        /* Signal the primary CPU that we are done: */
        atomic_set(&cpu_in_kgdb[cpu], 0);
+       touch_softlockup_watchdog();
        clocksource_touch_watchdog();
        local_irq_restore(flags);
 }
@@ -1432,6 +1433,7 @@ acquirelock:
            atomic_read(&kgdb_cpu_doing_single_step) != cpu) {
 
                atomic_set(&kgdb_active, -1);
+               touch_softlockup_watchdog();
                clocksource_touch_watchdog();
                local_irq_restore(flags);
 
@@ -1462,7 +1464,7 @@ acquirelock:
         * Get the passive CPU lock which will hold all the non-primary
         * CPU in a spin state while the debugger is active
         */
-       if (!kgdb_single_step || !kgdb_contthread) {
+       if (!kgdb_single_step) {
                for (i = 0; i < NR_CPUS; i++)
                        atomic_set(&passive_cpu_wait[i], 1);
        }
@@ -1475,7 +1477,7 @@ acquirelock:
 
 #ifdef CONFIG_SMP
        /* Signal the other CPUs to enter kgdb_wait() */
-       if ((!kgdb_single_step || !kgdb_contthread) && kgdb_do_roundup)
+       if ((!kgdb_single_step) && kgdb_do_roundup)
                kgdb_roundup_cpus(flags);
 #endif
 
@@ -1494,7 +1496,7 @@ acquirelock:
        kgdb_post_primary_code(ks->linux_regs, ks->ex_vector, ks->err_code);
        kgdb_deactivate_sw_breakpoints();
        kgdb_single_step = 0;
-       kgdb_contthread = NULL;
+       kgdb_contthread = current;
        exception_level = 0;
 
        /* Talk to debugger with gdbserial protocol */
@@ -1508,7 +1510,7 @@ acquirelock:
        kgdb_info[ks->cpu].task = NULL;
        atomic_set(&cpu_in_kgdb[ks->cpu], 0);
 
-       if (!kgdb_single_step || !kgdb_contthread) {
+       if (!kgdb_single_step) {
                for (i = NR_CPUS-1; i >= 0; i--)
                        atomic_set(&passive_cpu_wait[i], 0);
                /*
@@ -1524,6 +1526,7 @@ acquirelock:
 kgdb_restore:
        /* Free kgdb_active */
        atomic_set(&kgdb_active, -1);
+       touch_softlockup_watchdog();
        clocksource_touch_watchdog();
        local_irq_restore(flags);
 
index e36d5798cbff427fca02fd8c9a8fb6f615dbd3fe..5131e5471169226ef8db42f20792c8ffdac6d12b 100644 (file)
@@ -441,7 +441,7 @@ static struct k_itimer * alloc_posix_timer(void)
                return tmr;
        if (unlikely(!(tmr->sigq = sigqueue_alloc()))) {
                kmem_cache_free(posix_timers_cache, tmr);
-               tmr = NULL;
+               return NULL;
        }
        memset(&tmr->sigq->info, 0, sizeof(siginfo_t));
        return tmr;
index cc1f81b50b82dddb19658dc4d10dd419087a59fc..ad1962dc0aa20cb865675e8e08e49f5b49bce1df 100644 (file)
@@ -201,7 +201,7 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime)
        hrtimer_init(&rt_b->rt_period_timer,
                        CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        rt_b->rt_period_timer.function = sched_rt_period_timer;
-       rt_b->rt_period_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       rt_b->rt_period_timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED;
 }
 
 static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
@@ -1087,7 +1087,7 @@ hotplug_hrtick(struct notifier_block *nfb, unsigned long action, void *hcpu)
        return NOTIFY_DONE;
 }
 
-static void init_hrtick(void)
+static __init void init_hrtick(void)
 {
        hotcpu_notifier(hotplug_hrtick, 0);
 }
@@ -1119,7 +1119,7 @@ static void init_rq_hrtick(struct rq *rq)
 
        hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        rq->hrtick_timer.function = hrtick;
-       rq->hrtick_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       rq->hrtick_timer.cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
 }
 #else
 static inline void hrtick_clear(struct rq *rq)
@@ -8909,6 +8909,9 @@ static int sched_rt_global_constraints(void)
        u64 rt_runtime, rt_period;
        int ret = 0;
 
+       if (sysctl_sched_rt_period <= 0)
+               return -EINVAL;
+
        rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period);
        rt_runtime = tg->rt_bandwidth.rt_runtime;
 
@@ -8925,6 +8928,9 @@ static int sched_rt_global_constraints(void)
        unsigned long flags;
        int i;
 
+       if (sysctl_sched_rt_period <= 0)
+               return -EINVAL;
+
        spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags);
        for_each_possible_cpu(i) {
                struct rt_rq *rt_rq = &cpu_rq(i)->rt;
index 552310798dadf13e3b2059d5f84e050f7e0926e2..1113157b20581b07cbcdf325d4d3428cdd7cd288 100644 (file)
@@ -350,6 +350,7 @@ static void __enable_runtime(struct rq *rq)
                spin_lock(&rt_rq->rt_runtime_lock);
                rt_rq->rt_runtime = rt_b->rt_runtime;
                rt_rq->rt_time = 0;
+               rt_rq->rt_throttled = 0;
                spin_unlock(&rt_rq->rt_runtime_lock);
                spin_unlock(&rt_b->rt_runtime_lock);
        }
index 1876b526c7783db17d4dd5050a899e640670ef59..f8d968063cea38e348f63590ce73d409385cc5e9 100644 (file)
@@ -71,6 +71,16 @@ void clockevents_set_mode(struct clock_event_device *dev,
        }
 }
 
+/**
+ * clockevents_shutdown - shutdown the device and clear next_event
+ * @dev:       device to shutdown
+ */
+void clockevents_shutdown(struct clock_event_device *dev)
+{
+       clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN);
+       dev->next_event.tv64 = KTIME_MAX;
+}
+
 /**
  * clockevents_program_event - Reprogram the clock event device.
  * @expires:   absolute expiry time (monotonic clock)
@@ -206,7 +216,7 @@ void clockevents_exchange_device(struct clock_event_device *old,
 
        if (new) {
                BUG_ON(new->mode != CLOCK_EVT_MODE_UNUSED);
-               clockevents_set_mode(new, CLOCK_EVT_MODE_SHUTDOWN);
+               clockevents_shutdown(new);
        }
        local_irq_restore(flags);
 }
index 2f5a38294bf9ffc8639a5e623760c5242e96629b..cb01cd8f919b2752cfb7d97b4dc9ea4e87834a97 100644 (file)
@@ -235,9 +235,9 @@ static void tick_do_broadcast_on_off(void *why)
        case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
                if (!cpu_isset(cpu, tick_broadcast_mask)) {
                        cpu_set(cpu, tick_broadcast_mask);
-                       if (td->mode == TICKDEV_MODE_PERIODIC)
-                               clockevents_set_mode(dev,
-                                                    CLOCK_EVT_MODE_SHUTDOWN);
+                       if (tick_broadcast_device.mode ==
+                           TICKDEV_MODE_PERIODIC)
+                               clockevents_shutdown(dev);
                }
                if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
                        tick_broadcast_force = 1;
@@ -246,7 +246,8 @@ static void tick_do_broadcast_on_off(void *why)
                if (!tick_broadcast_force &&
                    cpu_isset(cpu, tick_broadcast_mask)) {
                        cpu_clear(cpu, tick_broadcast_mask);
-                       if (td->mode == TICKDEV_MODE_PERIODIC)
+                       if (tick_broadcast_device.mode ==
+                           TICKDEV_MODE_PERIODIC)
                                tick_setup_periodic(dev, 0);
                }
                break;
@@ -254,7 +255,7 @@ static void tick_do_broadcast_on_off(void *why)
 
        if (cpus_empty(tick_broadcast_mask)) {
                if (!bc_stopped)
-                       clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN);
+                       clockevents_shutdown(bc);
        } else if (bc_stopped) {
                if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
                        tick_broadcast_start_periodic(bc);
@@ -306,7 +307,7 @@ void tick_shutdown_broadcast(unsigned int *cpup)
 
        if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) {
                if (bc && cpus_empty(tick_broadcast_mask))
-                       clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN);
+                       clockevents_shutdown(bc);
        }
 
        spin_unlock_irqrestore(&tick_broadcast_lock, flags);
@@ -321,7 +322,7 @@ void tick_suspend_broadcast(void)
 
        bc = tick_broadcast_device.evtdev;
        if (bc)
-               clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN);
+               clockevents_shutdown(bc);
 
        spin_unlock_irqrestore(&tick_broadcast_lock, flags);
 }
@@ -576,4 +577,12 @@ void tick_shutdown_broadcast_oneshot(unsigned int *cpup)
        spin_unlock_irqrestore(&tick_broadcast_lock, flags);
 }
 
+/*
+ * Check, whether the broadcast device is in one shot mode
+ */
+int tick_broadcast_oneshot_active(void)
+{
+       return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT;
+}
+
 #endif
index c4777193d56734d0276aa210ddbbad2e79c416c8..df12434b43ca09ec5ea9b0c48d679b842feddc9e 100644 (file)
@@ -33,7 +33,7 @@ DEFINE_PER_CPU(struct tick_device, tick_cpu_device);
  */
 ktime_t tick_next_period;
 ktime_t tick_period;
-int tick_do_timer_cpu __read_mostly = -1;
+int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT;
 DEFINE_SPINLOCK(tick_device_lock);
 
 /*
@@ -109,7 +109,8 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
        if (!tick_device_is_functional(dev))
                return;
 
-       if (dev->features & CLOCK_EVT_FEAT_PERIODIC) {
+       if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) &&
+           !tick_broadcast_oneshot_active()) {
                clockevents_set_mode(dev, CLOCK_EVT_MODE_PERIODIC);
        } else {
                unsigned long seq;
@@ -148,7 +149,7 @@ static void tick_setup_device(struct tick_device *td,
                 * If no cpu took the do_timer update, assign it to
                 * this cpu:
                 */
-               if (tick_do_timer_cpu == -1) {
+               if (tick_do_timer_cpu == TICK_DO_TIMER_BOOT) {
                        tick_do_timer_cpu = cpu;
                        tick_next_period = ktime_get();
                        tick_period = ktime_set(0, NSEC_PER_SEC / HZ);
@@ -249,7 +250,7 @@ static int tick_check_new_device(struct clock_event_device *newdev)
         * not give it back to the clockevents layer !
         */
        if (tick_is_broadcast_device(curdev)) {
-               clockevents_set_mode(curdev, CLOCK_EVT_MODE_SHUTDOWN);
+               clockevents_shutdown(curdev);
                curdev = NULL;
        }
        clockevents_exchange_device(curdev, newdev);
@@ -300,7 +301,8 @@ static void tick_shutdown(unsigned int *cpup)
        if (*cpup == tick_do_timer_cpu) {
                int cpu = first_cpu(cpu_online_map);
 
-               tick_do_timer_cpu = (cpu != NR_CPUS) ? cpu : -1;
+               tick_do_timer_cpu = (cpu != NR_CPUS) ? cpu :
+                       TICK_DO_TIMER_NONE;
        }
        spin_unlock_irqrestore(&tick_device_lock, flags);
 }
@@ -311,7 +313,7 @@ static void tick_suspend(void)
        unsigned long flags;
 
        spin_lock_irqsave(&tick_device_lock, flags);
-       clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN);
+       clockevents_shutdown(td->evtdev);
        spin_unlock_irqrestore(&tick_device_lock, flags);
 }
 
index 0ffc2918ea6fb8365523ad0a63266cd68628b65f..469248782c2355c0c2d31cf731dc8c692023268e 100644 (file)
@@ -1,6 +1,10 @@
 /*
  * tick internal variable and functions used by low/high res code
  */
+
+#define TICK_DO_TIMER_NONE     -1
+#define TICK_DO_TIMER_BOOT     -2
+
 DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
 extern spinlock_t tick_device_lock;
 extern ktime_t tick_next_period;
@@ -10,6 +14,8 @@ extern int tick_do_timer_cpu __read_mostly;
 extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
 extern void tick_handle_periodic(struct clock_event_device *dev);
 
+extern void clockevents_shutdown(struct clock_event_device *dev);
+
 /*
  * NO_HZ / high resolution timer shared code
  */
@@ -29,6 +35,7 @@ extern void tick_broadcast_oneshot_control(unsigned long reason);
 extern void tick_broadcast_switch_to_oneshot(void);
 extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
 extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
+extern int tick_broadcast_oneshot_active(void);
 # else /* BROADCAST */
 static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
 {
@@ -37,6 +44,7 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
 static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
 static inline void tick_broadcast_switch_to_oneshot(void) { }
 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
+static inline int tick_broadcast_oneshot_active(void) { return 0; }
 # endif /* !BROADCAST */
 
 #else /* !ONESHOT */
@@ -66,6 +74,7 @@ static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
 {
        return 0;
 }
+static inline int tick_broadcast_oneshot_active(void) { return 0; }
 #endif /* !TICK_ONESHOT */
 
 /*
index a87b0468568b026d90683bde0b2e9da0295c7caa..cb02324bdb88b1c477f055af028bd4eace476d4d 100644 (file)
@@ -75,6 +75,9 @@ static void tick_do_update_jiffies64(ktime_t now)
                                                           incr * ticks);
                }
                do_timer(++ticks);
+
+               /* Keep the tick_next_period variable up to date */
+               tick_next_period = ktime_add(last_jiffies_update, tick_period);
        }
        write_sequnlock(&xtime_lock);
 }
@@ -221,7 +224,7 @@ void tick_nohz_stop_sched_tick(int inidle)
         */
        if (unlikely(!cpu_online(cpu))) {
                if (cpu == tick_do_timer_cpu)
-                       tick_do_timer_cpu = -1;
+                       tick_do_timer_cpu = TICK_DO_TIMER_NONE;
        }
 
        if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
@@ -303,7 +306,7 @@ void tick_nohz_stop_sched_tick(int inidle)
                 * invoked.
                 */
                if (cpu == tick_do_timer_cpu)
-                       tick_do_timer_cpu = -1;
+                       tick_do_timer_cpu = TICK_DO_TIMER_NONE;
 
                ts->idle_sleeps++;
 
@@ -468,7 +471,7 @@ static void tick_nohz_handler(struct clock_event_device *dev)
         * this duty, then the jiffies update is still serialized by
         * xtime_lock.
         */
-       if (unlikely(tick_do_timer_cpu == -1))
+       if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE))
                tick_do_timer_cpu = cpu;
 
        /* Check, if the jiffies need an update */
@@ -570,7 +573,7 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
         * this duty, then the jiffies update is still serialized by
         * xtime_lock.
         */
-       if (unlikely(tick_do_timer_cpu == -1))
+       if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE))
                tick_do_timer_cpu = cpu;
 #endif
 
@@ -622,7 +625,7 @@ void tick_setup_sched_timer(void)
         */
        hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
        ts->sched_timer.function = tick_sched_timer;
-       ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
 
        /* Get the next period (per cpu) */
        ts->sched_timer.expires = tick_init_jiffy_update();
index bb948e52ce204bc1ec90b6bf6276a70203121de6..db58fb66a135bbbbc71b16f949bcbf47300fbb4c 100644 (file)
@@ -202,7 +202,7 @@ static void start_stack_timer(int cpu)
 
        hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        hrtimer->function = stack_trace_timer_fn;
-       hrtimer->cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       hrtimer->cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
 
        hrtimer_start(hrtimer, ns_to_ktime(sample_period), HRTIMER_MODE_REL);
 }
index e16e1523b688680572513b16ef0e49d5ac0314f0..b36b83b920ffe862f0d7060e29687c9bb998a0d8 100644 (file)
@@ -70,6 +70,7 @@ static DECLARE_WAIT_QUEUE_HEAD(pkmap_map_wait);
 static void flush_all_zero_pkmaps(void)
 {
        int i;
+       int need_flush = 0;
 
        flush_cache_kmaps();
 
@@ -101,8 +102,10 @@ static void flush_all_zero_pkmaps(void)
                          &pkmap_page_table[i]);
 
                set_page_address(page, NULL);
+               need_flush = 1;
        }
-       flush_tlb_kernel_range(PKMAP_ADDR(0), PKMAP_ADDR(LAST_PKMAP));
+       if (need_flush)
+               flush_tlb_kernel_range(PKMAP_ADDR(0), PKMAP_ADDR(LAST_PKMAP));
 }
 
 /**
index 0f1f7a7374bade23cf0052719a349a97322c5af4..36896f3eb7f5e5c2e4c3803cc8125fe461a71669 100644 (file)
@@ -250,6 +250,14 @@ static struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont)
 
 struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p)
 {
+       /*
+        * mm_update_next_owner() may clear mm->owner to NULL
+        * if it races with swapoff, page migration, etc.
+        * So this can be called with p == NULL.
+        */
+       if (unlikely(!p))
+               return NULL;
+
        return container_of(task_subsys_state(p, mem_cgroup_subsys_id),
                                struct mem_cgroup, css);
 }
@@ -549,6 +557,11 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
        if (likely(!memcg)) {
                rcu_read_lock();
                mem = mem_cgroup_from_task(rcu_dereference(mm->owner));
+               if (unlikely(!mem)) {
+                       rcu_read_unlock();
+                       kmem_cache_free(page_cgroup_cache, pc);
+                       return 0;
+               }
                /*
                 * For every charge from the cgroup, increment reference count
                 */
@@ -801,11 +814,16 @@ int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask)
 
        rcu_read_lock();
        mem = mem_cgroup_from_task(rcu_dereference(mm->owner));
+       if (unlikely(!mem)) {
+               rcu_read_unlock();
+               return 0;
+       }
        css_get(&mem->css);
        rcu_read_unlock();
 
        do {
                progress = try_to_free_mem_cgroup_pages(mem, gfp_mask);
+               progress += res_counter_check_under_limit(&mem->res);
        } while (!progress && --retry);
 
        css_put(&mem->css);
index e293c58bea58fc2195da7f34d95417262cedeffa..27b8681139fdb71e4d0da204ecc4a65fc3f7a1b5 100644 (file)
@@ -268,13 +268,14 @@ void prep_compound_page(struct page *page, unsigned long order)
 {
        int i;
        int nr_pages = 1 << order;
+       struct page *p = page + 1;
 
        set_compound_page_dtor(page, free_compound_page);
        set_compound_order(page, order);
        __SetPageHead(page);
-       for (i = 1; i < nr_pages; i++) {
-               struct page *p = page + i;
-
+       for (i = 1; i < nr_pages; i++, p++) {
+               if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
+                       p = pfn_to_page(page_to_pfn(page) + i);
                __SetPageTail(p);
                p->first_page = page;
        }
@@ -284,6 +285,7 @@ static void destroy_compound_page(struct page *page, unsigned long order)
 {
        int i;
        int nr_pages = 1 << order;
+       struct page *p = page + 1;
 
        if (unlikely(compound_order(page) != order))
                bad_page(page);
@@ -291,8 +293,9 @@ static void destroy_compound_page(struct page *page, unsigned long order)
        if (unlikely(!PageHead(page)))
                        bad_page(page);
        __ClearPageHead(page);
-       for (i = 1; i < nr_pages; i++) {
-               struct page *p = page + i;
+       for (i = 1; i < nr_pages; i++, p++) {
+               if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
+                       p = pfn_to_page(page_to_pfn(page) + i);
 
                if (unlikely(!PageTail(p) |
                                (p->first_page != page)))
index c69f84fe038d8b725b8639aae0fd88151206b515..b70a7fec1ff6c3a4aa2c210215185b31085c8f4d 100644 (file)
@@ -114,8 +114,10 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)
 
 int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
 {
-       unsigned long pfn;
+       unsigned long pfn, flags;
        struct page *page;
+       struct zone *zone;
+       int ret;
 
        pfn = start_pfn;
        /*
@@ -131,7 +133,9 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
        if (pfn < end_pfn)
                return -EBUSY;
        /* Check all pages are free or Marked as ISOLATED */
-       if (__test_page_isolated_in_pageblock(start_pfn, end_pfn))
-               return 0;
-       return -EBUSY;
+       zone = page_zone(pfn_to_page(pfn));
+       spin_lock_irqsave(&zone->lock, flags);
+       ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn);
+       spin_unlock_irqrestore(&zone->lock, flags);
+       return ret ? 0 : -EBUSY;
 }
index 4c82dd41f32eae2ff2274f3d2b1d78e8e45fbb43..cb675d1267914dc263100b9c4a9ea5eb20fefa48 100644 (file)
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -514,9 +514,11 @@ size_t ksize(const void *block)
                return 0;
 
        sp = (struct slob_page *)virt_to_page(block);
-       if (slob_page(sp))
-               return ((slob_t *)block - 1)->units + SLOB_UNIT;
-       else
+       if (slob_page(sp)) {
+               int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
+               unsigned int *m = (unsigned int *)(block - align);
+               return SLOB_UNITS(*m) * SLOB_UNIT;
+       } else
                return sp->page.private;
 }
 
index fb486d5540f8bb0a7110245f2368fe2ace28338d..0c83e6afe7b223757f1608268436c59648c3633d 100644 (file)
--- 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)
        INIT_LIST_HEAD(&n->partial);
 #ifdef CONFIG_SLUB_DEBUG
        atomic_long_set(&n->nr_slabs, 0);
+       atomic_long_set(&n->total_objects, 0);
        INIT_LIST_HEAD(&n->full);
 #endif
 }
index ae532f50194319ce83b813a88b6a25aa5a4e85e5..8d7a27a6335c4c6076b38fc2ab990a82081ada5d 100644 (file)
@@ -65,31 +65,31 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
        if (!dentry)
                goto put_memory;
 
+       error = -ENFILE;
+       file = get_empty_filp();
+       if (!file)
+               goto put_dentry;
+
        error = -ENOSPC;
        inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0);
        if (!inode)
-               goto put_dentry;
+               goto close_file;
 
        d_instantiate(dentry, inode);
-       error = -ENFILE;
-       file = alloc_file(shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
-                       &ramfs_file_operations);
-       if (!file)
-               goto put_dentry;
-
+       inode->i_size = size;
        inode->i_nlink = 0;     /* It is unlinked */
+       init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
+                       &ramfs_file_operations);
 
-       /* notify everyone as to the change of file size */
-       error = do_truncate(dentry, size, 0, file);
-       if (error < 0)
+#ifndef CONFIG_MMU
+       error = ramfs_nommu_expand_for_mapping(inode, size);
+       if (error)
                goto close_file;
-
+#endif
        return file;
 
 close_file:
        put_filp(file);
-       return ERR_PTR(error);
-
 put_dentry:
        dput(dentry);
 put_memory:
index 2ffe40cf2f01799634c478443284b80f62c9289c..10e320307ec015dad7e2a7db8b753f4a1886f645 100644 (file)
@@ -75,7 +75,6 @@ static int parse_opts(char *opts, struct p9_client *clnt)
        int option;
        int ret = 0;
 
-       clnt->trans_mod = v9fs_default_trans();
        clnt->dotu = 1;
        clnt->msize = 8192;
 
@@ -108,7 +107,7 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                        clnt->msize = option;
                        break;
                case Opt_trans:
-                       clnt->trans_mod = v9fs_match_trans(&args[0]);
+                       clnt->trans_mod = v9fs_get_trans_by_name(&args[0]);
                        break;
                case Opt_legacy:
                        clnt->dotu = 0;
@@ -117,6 +116,10 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                        continue;
                }
        }
+
+       if (!clnt->trans_mod)
+               clnt->trans_mod = v9fs_get_default_trans();
+
        kfree(options);
        return ret;
 }
@@ -150,6 +153,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
        if (!clnt)
                return ERR_PTR(-ENOMEM);
 
+       clnt->trans_mod = NULL;
        clnt->trans = NULL;
        spin_lock_init(&clnt->lock);
        INIT_LIST_HEAD(&clnt->fidlist);
@@ -235,6 +239,8 @@ void p9_client_destroy(struct p9_client *clnt)
                clnt->trans = NULL;
        }
 
+       v9fs_put_trans(clnt->trans_mod);
+
        list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist)
                p9_fid_destroy(fid);
 
index 44547201f5bcce723787cbeeee1c5a541a51ba3e..5ad3a3bd73b297725aed1c7998c0da80e9bdf2ae 100644 (file)
@@ -451,8 +451,10 @@ p9_put_data(struct cbuf *bufp, const char *data, int count,
                   unsigned char **pdata)
 {
        *pdata = buf_alloc(bufp, count);
+       if (*pdata == NULL)
+               return -ENOMEM;
        memmove(*pdata, data, count);
-       return count;
+       return 0;
 }
 
 static int
@@ -460,6 +462,8 @@ p9_put_user_data(struct cbuf *bufp, const char __user *data, int count,
                   unsigned char **pdata)
 {
        *pdata = buf_alloc(bufp, count);
+       if (*pdata == NULL)
+               return -ENOMEM;
        return copy_from_user(*pdata, data, count);
 }
 
index bdee1fb7cc62909a565717e7fd27a6c0903a1895..1084feb24cb0a3a9ef2409071c1ba3c4c06695aa 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/parser.h>
 #include <net/9p/transport.h>
 #include <linux/list.h>
+#include <linux/spinlock.h>
 
 #ifdef CONFIG_NET_9P_DEBUG
 unsigned int p9_debug_level = 0;       /* feature-rific global debug level  */
@@ -44,8 +45,8 @@ MODULE_PARM_DESC(debug, "9P debugging level");
  *
  */
 
+static DEFINE_SPINLOCK(v9fs_trans_lock);
 static LIST_HEAD(v9fs_trans_list);
-static struct p9_trans_module *v9fs_default_transport;
 
 /**
  * v9fs_register_trans - register a new transport with 9p
@@ -54,48 +55,87 @@ static struct p9_trans_module *v9fs_default_transport;
  */
 void v9fs_register_trans(struct p9_trans_module *m)
 {
+       spin_lock(&v9fs_trans_lock);
        list_add_tail(&m->list, &v9fs_trans_list);
-       if (m->def)
-               v9fs_default_transport = m;
+       spin_unlock(&v9fs_trans_lock);
 }
 EXPORT_SYMBOL(v9fs_register_trans);
 
 /**
- * v9fs_match_trans - match transport versus registered transports
+ * v9fs_unregister_trans - unregister a 9p transport
+ * @m: the transport to remove
+ *
+ */
+void v9fs_unregister_trans(struct p9_trans_module *m)
+{
+       spin_lock(&v9fs_trans_lock);
+       list_del_init(&m->list);
+       spin_unlock(&v9fs_trans_lock);
+}
+EXPORT_SYMBOL(v9fs_unregister_trans);
+
+/**
+ * v9fs_get_trans_by_name - get transport with the matching name
  * @name: string identifying transport
  *
  */
-struct p9_trans_module *v9fs_match_trans(const substring_t *name)
+struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name)
 {
-       struct list_head *p;
-       struct p9_trans_module *t = NULL;
-
-       list_for_each(p, &v9fs_trans_list) {
-               t = list_entry(p, struct p9_trans_module, list);
-               if (strncmp(t->name, name->from, name->to-name->from) == 0)
-                       return t;
-       }
-       return NULL;
+       struct p9_trans_module *t, *found = NULL;
+
+       spin_lock(&v9fs_trans_lock);
+
+       list_for_each_entry(t, &v9fs_trans_list, list)
+               if (strncmp(t->name, name->from, name->to-name->from) == 0 &&
+                   try_module_get(t->owner)) {
+                       found = t;
+                       break;
+               }
+
+       spin_unlock(&v9fs_trans_lock);
+       return found;
 }
-EXPORT_SYMBOL(v9fs_match_trans);
+EXPORT_SYMBOL(v9fs_get_trans_by_name);
 
 /**
- * v9fs_default_trans - returns pointer to default transport
+ * v9fs_get_default_trans - get the default transport
  *
  */
 
-struct p9_trans_module *v9fs_default_trans(void)
+struct p9_trans_module *v9fs_get_default_trans(void)
 {
-       if (v9fs_default_transport)
-               return v9fs_default_transport;
-       else if (!list_empty(&v9fs_trans_list))
-               return list_first_entry(&v9fs_trans_list,
-                                       struct p9_trans_module, list);
-       else
-               return NULL;
+       struct p9_trans_module *t, *found = NULL;
+
+       spin_lock(&v9fs_trans_lock);
+
+       list_for_each_entry(t, &v9fs_trans_list, list)
+               if (t->def && try_module_get(t->owner)) {
+                       found = t;
+                       break;
+               }
+
+       if (!found)
+               list_for_each_entry(t, &v9fs_trans_list, list)
+                       if (try_module_get(t->owner)) {
+                               found = t;
+                               break;
+                       }
+
+       spin_unlock(&v9fs_trans_lock);
+       return found;
 }
-EXPORT_SYMBOL(v9fs_default_trans);
+EXPORT_SYMBOL(v9fs_get_default_trans);
 
+/**
+ * v9fs_put_trans - put trans
+ * @m: transport to put
+ *
+ */
+void v9fs_put_trans(struct p9_trans_module *m)
+{
+       if (m)
+               module_put(m->owner);
+}
 
 /**
  * v9fs_init - Initialize module
@@ -120,6 +160,8 @@ static int __init init_p9(void)
 static void __exit exit_p9(void)
 {
        printk(KERN_INFO "Unloading 9P2000 support\n");
+
+       p9_trans_fd_exit();
 }
 
 module_init(init_p9)
index cdf137af7adc87d580280fbbce9b3c2d64b9dc82..d652baf5ff919c422664ed8890996d9f71beadc1 100644 (file)
@@ -151,7 +151,6 @@ struct p9_mux_poll_task {
  * @trans: reference to transport instance for this connection
  * @tagpool: id accounting for transactions
  * @err: error state
- * @equeue: event wait_q (?)
  * @req_list: accounting for requests which have been sent
  * @unsent_req_list: accounting for requests that haven't been sent
  * @rcall: current response &p9_fcall structure
@@ -178,7 +177,6 @@ struct p9_conn {
        struct p9_trans *trans;
        struct p9_idpool *tagpool;
        int err;
-       wait_queue_head_t equeue;
        struct list_head req_list;
        struct list_head unsent_req_list;
        struct p9_fcall *rcall;
@@ -240,22 +238,6 @@ static int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc,
 
 static void p9_conn_cancel(struct p9_conn *m, int err);
 
-static int p9_mux_global_init(void)
-{
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++)
-               p9_mux_poll_tasks[i].task = NULL;
-
-       p9_mux_wq = create_workqueue("v9fs");
-       if (!p9_mux_wq) {
-               printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
-               return -ENOMEM;
-       }
-
-       return 0;
-}
-
 static u16 p9_mux_get_tag(struct p9_conn *m)
 {
        int tag;
@@ -409,11 +391,11 @@ static void p9_mux_poll_stop(struct p9_conn *m)
 static struct p9_conn *p9_conn_create(struct p9_trans *trans)
 {
        int i, n;
-       struct p9_conn *m, *mtmp;
+       struct p9_conn *m;
 
        P9_DPRINTK(P9_DEBUG_MUX, "transport %p msize %d\n", trans,
                                                                trans->msize);
-       m = kmalloc(sizeof(struct p9_conn), GFP_KERNEL);
+       m = kzalloc(sizeof(struct p9_conn), GFP_KERNEL);
        if (!m)
                return ERR_PTR(-ENOMEM);
 
@@ -424,25 +406,14 @@ static struct p9_conn *p9_conn_create(struct p9_trans *trans)
        m->trans = trans;
        m->tagpool = p9_idpool_create();
        if (IS_ERR(m->tagpool)) {
-               mtmp = ERR_PTR(-ENOMEM);
                kfree(m);
-               return mtmp;
+               return ERR_PTR(-ENOMEM);
        }
 
-       m->err = 0;
-       init_waitqueue_head(&m->equeue);
        INIT_LIST_HEAD(&m->req_list);
        INIT_LIST_HEAD(&m->unsent_req_list);
-       m->rcall = NULL;
-       m->rpos = 0;
-       m->rbuf = NULL;
-       m->wpos = m->wsize = 0;
-       m->wbuf = NULL;
        INIT_WORK(&m->rq, p9_read_work);
        INIT_WORK(&m->wq, p9_write_work);
-       m->wsched = 0;
-       memset(&m->poll_waddr, 0, sizeof(m->poll_waddr));
-       m->poll_task = NULL;
        n = p9_mux_poll_start(m);
        if (n) {
                kfree(m);
@@ -463,10 +434,8 @@ static struct p9_conn *p9_conn_create(struct p9_trans *trans)
        for (i = 0; i < ARRAY_SIZE(m->poll_waddr); i++) {
                if (IS_ERR(m->poll_waddr[i])) {
                        p9_mux_poll_stop(m);
-                       mtmp = (void *)m->poll_waddr;   /* the error code */
                        kfree(m);
-                       m = mtmp;
-                       break;
+                       return (void *)m->poll_waddr;   /* the error code */
                }
        }
 
@@ -483,18 +452,13 @@ static void p9_conn_destroy(struct p9_conn *m)
 {
        P9_DPRINTK(P9_DEBUG_MUX, "mux %p prev %p next %p\n", m,
                m->mux_list.prev, m->mux_list.next);
-       p9_conn_cancel(m, -ECONNRESET);
-
-       if (!list_empty(&m->req_list)) {
-               /* wait until all processes waiting on this session exit */
-               P9_DPRINTK(P9_DEBUG_MUX,
-                       "mux %p waiting for empty request queue\n", m);
-               wait_event_timeout(m->equeue, (list_empty(&m->req_list)), 5000);
-               P9_DPRINTK(P9_DEBUG_MUX, "mux %p request queue empty: %d\n", m,
-                       list_empty(&m->req_list));
-       }
 
        p9_mux_poll_stop(m);
+       cancel_work_sync(&m->rq);
+       cancel_work_sync(&m->wq);
+
+       p9_conn_cancel(m, -ECONNRESET);
+
        m->trans = NULL;
        p9_idpool_destroy(m->tagpool);
        kfree(m);
@@ -840,8 +804,6 @@ static void p9_read_work(struct work_struct *work)
                                        (*req->cb) (req, req->cba);
                                else
                                        kfree(req->rcall);
-
-                               wake_up(&m->equeue);
                        }
                } else {
                        if (err >= 0 && rcall->id != P9_RFLUSH)
@@ -908,8 +870,10 @@ static struct p9_req *p9_send_request(struct p9_conn *m,
        else
                n = p9_mux_get_tag(m);
 
-       if (n < 0)
+       if (n < 0) {
+               kfree(req);
                return ERR_PTR(-ENOMEM);
+       }
 
        p9_set_tag(tc, n);
 
@@ -984,8 +948,6 @@ static void p9_mux_flush_cb(struct p9_req *freq, void *a)
                        (*req->cb) (req, req->cba);
                else
                        kfree(req->rcall);
-
-               wake_up(&m->equeue);
        }
 
        kfree(freq->tcall);
@@ -1191,8 +1153,6 @@ void p9_conn_cancel(struct p9_conn *m, int err)
                else
                        kfree(req->rcall);
        }
-
-       wake_up(&m->equeue);
 }
 
 /**
@@ -1370,7 +1330,6 @@ p9_fd_poll(struct p9_trans *trans, struct poll_table_struct *pt)
 {
        int ret, n;
        struct p9_trans_fd *ts = NULL;
-       mm_segment_t oldfs;
 
        if (trans && trans->status == Connected)
                ts = trans->priv;
@@ -1384,24 +1343,17 @@ p9_fd_poll(struct p9_trans *trans, struct poll_table_struct *pt)
        if (!ts->wr->f_op || !ts->wr->f_op->poll)
                return -EIO;
 
-       oldfs = get_fs();
-       set_fs(get_ds());
-
        ret = ts->rd->f_op->poll(ts->rd, pt);
        if (ret < 0)
-               goto end;
+               return ret;
 
        if (ts->rd != ts->wr) {
                n = ts->wr->f_op->poll(ts->wr, pt);
-               if (n < 0) {
-                       ret = n;
-                       goto end;
-               }
+               if (n < 0)
+                       return n;
                ret = (ret & ~POLLOUT) | (n & ~POLLIN);
        }
 
-end:
-       set_fs(oldfs);
        return ret;
 }
 
@@ -1629,6 +1581,7 @@ static struct p9_trans_module p9_tcp_trans = {
        .maxsize = MAX_SOCK_BUF,
        .def = 1,
        .create = p9_trans_create_tcp,
+       .owner = THIS_MODULE,
 };
 
 static struct p9_trans_module p9_unix_trans = {
@@ -1636,6 +1589,7 @@ static struct p9_trans_module p9_unix_trans = {
        .maxsize = MAX_SOCK_BUF,
        .def = 0,
        .create = p9_trans_create_unix,
+       .owner = THIS_MODULE,
 };
 
 static struct p9_trans_module p9_fd_trans = {
@@ -1643,14 +1597,20 @@ static struct p9_trans_module p9_fd_trans = {
        .maxsize = MAX_SOCK_BUF,
        .def = 0,
        .create = p9_trans_create_fd,
+       .owner = THIS_MODULE,
 };
 
 int p9_trans_fd_init(void)
 {
-       int ret = p9_mux_global_init();
-       if (ret) {
-               printk(KERN_WARNING "9p: starting mux failed\n");
-               return ret;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++)
+               p9_mux_poll_tasks[i].task = NULL;
+
+       p9_mux_wq = create_workqueue("v9fs");
+       if (!p9_mux_wq) {
+               printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
+               return -ENOMEM;
        }
 
        v9fs_register_trans(&p9_tcp_trans);
@@ -1659,4 +1619,12 @@ int p9_trans_fd_init(void)
 
        return 0;
 }
-EXPORT_SYMBOL(p9_trans_fd_init);
+
+void p9_trans_fd_exit(void)
+{
+       v9fs_unregister_trans(&p9_tcp_trans);
+       v9fs_unregister_trans(&p9_unix_trans);
+       v9fs_unregister_trans(&p9_fd_trans);
+
+       destroy_workqueue(p9_mux_wq);
+}
index 42adc052b149251a46e3ac8a1bf039c91f00417f..94912e077a55e0ecdfdd137c9a9848256edd66b3 100644 (file)
@@ -528,6 +528,7 @@ static struct p9_trans_module p9_virtio_trans = {
        .create = p9_virtio_create,
        .maxsize = PAGE_SIZE*16,
        .def = 0,
+       .owner = THIS_MODULE,
 };
 
 /* The standard init function */
@@ -545,6 +546,7 @@ static int __init p9_virtio_init(void)
 static void __exit p9_virtio_cleanup(void)
 {
        unregister_virtio_driver(&p9_virtio_drv);
+       v9fs_unregister_trans(&p9_virtio_trans);
 }
 
 module_init(p9_virtio_init);
index 01c83e2a4c196f813122158af5aa5bf5ea13cbd0..28c71574a781e6b0600f453275e50bf8911dcca9 100644 (file)
@@ -317,6 +317,9 @@ void ax25_destroy_socket(ax25_cb *ax25)
                                /* Queue the unaccepted socket for death */
                                sock_orphan(skb->sk);
 
+                               /* 9A4GL: hack to release unaccepted sockets */
+                               skb->sk->sk_state = TCP_LISTEN;
+
                                ax25_start_heartbeat(sax25);
                                sax25->state = AX25_STATE_0;
                        }
index cdc7e751ef36129fc9e25f107d8beb1e58034faf..96e4b9273250918b4a60fdcc9ccce00b79090827 100644 (file)
@@ -39,9 +39,11 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25)
 
        switch (ax25->state) {
        case AX25_STATE_0:
-               if (!sk ||
-                   sock_flag(sk, SOCK_DESTROY) ||
-                   sock_flag(sk, SOCK_DEAD)) {
+               /* Magic here: If we listen() and a new link dies before it
+                  is accepted() it isn't 'dead' so doesn't get removed. */
+               if (!sk || sock_flag(sk, SOCK_DESTROY) ||
+                   (sk->sk_state == TCP_LISTEN &&
+                    sock_flag(sk, SOCK_DEAD))) {
                        if (sk) {
                                sock_hold(sk);
                                ax25_destroy_socket(ax25);
index e719ed29310ff5695c347db907a6311aa79e36c5..0ae08d3f57e79730ac893dbb8a046a6678cd622a 100644 (file)
 #include <linux/if_arp.h>
 #include <linux/if_vlan.h>
 #include <linux/ip.h>
+#include <net/ip.h>
 #include <linux/ipv6.h>
 #include <linux/in.h>
 #include <linux/jhash.h>
@@ -1667,7 +1668,7 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
 {
        u32 addr1, addr2, ports;
        u32 hash, ihl;
-       u8 ip_proto;
+       u8 ip_proto = 0;
 
        if (unlikely(!simple_tx_hashrnd_initialized)) {
                get_random_bytes(&simple_tx_hashrnd, 4);
@@ -1676,7 +1677,8 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
 
        switch (skb->protocol) {
        case __constant_htons(ETH_P_IP):
-               ip_proto = ip_hdr(skb)->protocol;
+               if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)))
+                       ip_proto = ip_hdr(skb)->protocol;
                addr1 = ip_hdr(skb)->saddr;
                addr2 = ip_hdr(skb)->daddr;
                ihl = ip_hdr(skb)->ihl;
@@ -2916,6 +2918,12 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
        return 0;
 }
 
+static void dev_change_rx_flags(struct net_device *dev, int flags)
+{
+       if (dev->flags & IFF_UP && dev->change_rx_flags)
+               dev->change_rx_flags(dev, flags);
+}
+
 static int __dev_set_promiscuity(struct net_device *dev, int inc)
 {
        unsigned short old_flags = dev->flags;
@@ -2953,8 +2961,7 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
                                current->uid, current->gid,
                                audit_get_sessionid(current));
 
-               if (dev->change_rx_flags)
-                       dev->change_rx_flags(dev, IFF_PROMISC);
+               dev_change_rx_flags(dev, IFF_PROMISC);
        }
        return 0;
 }
@@ -3020,8 +3027,7 @@ int dev_set_allmulti(struct net_device *dev, int inc)
                }
        }
        if (dev->flags ^ old_flags) {
-               if (dev->change_rx_flags)
-                       dev->change_rx_flags(dev, IFF_ALLMULTI);
+               dev_change_rx_flags(dev, IFF_ALLMULTI);
                dev_set_rx_mode(dev);
        }
        return 0;
@@ -3345,8 +3351,8 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
         *      Load in the correct multicast list now the flags have changed.
         */
 
-       if (dev->change_rx_flags && (old_flags ^ flags) & IFF_MULTICAST)
-               dev->change_rx_flags(dev, IFF_MULTICAST);
+       if ((old_flags ^ flags) & IFF_MULTICAST)
+               dev_change_rx_flags(dev, IFF_MULTICAST);
 
        dev_set_rx_mode(dev);
 
@@ -3806,14 +3812,11 @@ static int dev_new_index(struct net *net)
 }
 
 /* Delayed registration/unregisteration */
-static DEFINE_SPINLOCK(net_todo_list_lock);
 static LIST_HEAD(net_todo_list);
 
 static void net_set_todo(struct net_device *dev)
 {
-       spin_lock(&net_todo_list_lock);
        list_add_tail(&dev->todo_list, &net_todo_list);
-       spin_unlock(&net_todo_list_lock);
 }
 
 static void rollback_registered(struct net_device *dev)
@@ -4140,33 +4143,24 @@ static void netdev_wait_allrefs(struct net_device *dev)
  *     free_netdev(y1);
  *     free_netdev(y2);
  *
- * We are invoked by rtnl_unlock() after it drops the semaphore.
+ * We are invoked by rtnl_unlock().
  * This allows us to deal with problems:
  * 1) We can delete sysfs objects which invoke hotplug
  *    without deadlocking with linkwatch via keventd.
  * 2) Since we run with the RTNL semaphore not held, we can sleep
  *    safely in order to wait for the netdev refcnt to drop to zero.
+ *
+ * We must not return until all unregister events added during
+ * the interval the lock was held have been completed.
  */
-static DEFINE_MUTEX(net_todo_run_mutex);
 void netdev_run_todo(void)
 {
        struct list_head list;
 
-       /* Need to guard against multiple cpu's getting out of order. */
-       mutex_lock(&net_todo_run_mutex);
-
-       /* Not safe to do outside the semaphore.  We must not return
-        * until all unregister events invoked by the local processor
-        * have been completed (either by this todo run, or one on
-        * another cpu).
-        */
-       if (list_empty(&net_todo_list))
-               goto out;
-
        /* Snapshot list, allow later requests */
-       spin_lock(&net_todo_list_lock);
        list_replace_init(&net_todo_list, &list);
-       spin_unlock(&net_todo_list_lock);
+
+       __rtnl_unlock();
 
        while (!list_empty(&list)) {
                struct net_device *dev
@@ -4198,9 +4192,6 @@ void netdev_run_todo(void)
                /* Free network device */
                kobject_put(&dev->dev.kobj);
        }
-
-out:
-       mutex_unlock(&net_todo_run_mutex);
 }
 
 static struct net_device_stats *internal_stats(struct net_device *dev)
index 71edb8b36341622df50ec48f32127b1be490b19f..d6381c2a46936751b8da284d8191bf0404593597 100644 (file)
@@ -73,7 +73,7 @@ void __rtnl_unlock(void)
 
 void rtnl_unlock(void)
 {
-       mutex_unlock(&rtnl_mutex);
+       /* This fellow will unlock it for us. */
        netdev_run_todo();
 }
 
index bfcbd148a89d5daec4bf09b169010e6690c6f6c8..c209e054a634ed5b07f9b6d8374006887a2c2085 100644 (file)
@@ -150,7 +150,11 @@ static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
                ca->snd_cwnd_cents -= 128;
                tp->snd_cwnd_cnt = 0;
        }
-
+       /* check when cwnd has not been incremented for a while */
+       if (increment == 0 && odd == 0 && tp->snd_cwnd_cnt >= tp->snd_cwnd) {
+               tp->snd_cwnd++;
+               tp->snd_cwnd_cnt = 0;
+       }
        /* clamp down slowstart cwnd to ssthresh value. */
        if (is_slowstart)
                tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
index 67ccce2a96bd0d7d506bc7bca08a7ac29c38fea6..7abc6b80d47d2fd6fd9ff539e23f50dc89147cec 100644 (file)
@@ -4879,7 +4879,8 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
                                        goto no_ack;
                        }
 
-                       __tcp_ack_snd_check(sk, 0);
+                       if (!copied_early || tp->rcv_nxt != tp->rcv_wup)
+                               __tcp_ack_snd_check(sk, 0);
 no_ack:
 #ifdef CONFIG_NET_DMA
                        if (copied_early)
index 1b4fee20fc932a54ad11f113c1f51786fb4b85f4..011478e46c406bd7dd75c2b2d06f578714d98606 100644 (file)
@@ -618,7 +618,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
                        ];
        } rep;
        struct ip_reply_arg arg;
-       struct net *net = dev_net(skb->dev);
+       struct net *net = dev_net(skb->dst->dev);
 
        memset(&rep.th, 0, sizeof(struct tcphdr));
        memset(&arg, 0, sizeof(arg));
index 8e42fbbd57616316df2692a39379398f9486ac22..57e26fa66185affd152d8613800ee5a9e6230991 100644 (file)
@@ -951,6 +951,27 @@ int udp_disconnect(struct sock *sk, int flags)
        return 0;
 }
 
+static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
+{
+       int is_udplite = IS_UDPLITE(sk);
+       int rc;
+
+       if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) {
+               /* Note that an ENOMEM error is charged twice */
+               if (rc == -ENOMEM)
+                       UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS,
+                                        is_udplite);
+               goto drop;
+       }
+
+       return 0;
+
+drop:
+       UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
+       kfree_skb(skb);
+       return -1;
+}
+
 /* returns:
  *  -1: error
  *   0: success
@@ -989,9 +1010,7 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
                    up->encap_rcv != NULL) {
                        int ret;
 
-                       bh_unlock_sock(sk);
                        ret = (*up->encap_rcv)(sk, skb);
-                       bh_lock_sock(sk);
                        if (ret <= 0) {
                                UDP_INC_STATS_BH(sock_net(sk),
                                                 UDP_MIB_INDATAGRAMS,
@@ -1044,17 +1063,16 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
                        goto drop;
        }
 
-       if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) {
-               /* Note that an ENOMEM error is charged twice */
-               if (rc == -ENOMEM) {
-                       UDP_INC_STATS_BH(sock_net(sk),
-                                       UDP_MIB_RCVBUFERRORS, is_udplite);
-                       atomic_inc(&sk->sk_drops);
-               }
-               goto drop;
-       }
+       rc = 0;
 
-       return 0;
+       bh_lock_sock(sk);
+       if (!sock_owned_by_user(sk))
+               rc = __udp_queue_rcv_skb(sk, skb);
+       else
+               sk_add_backlog(sk, skb);
+       bh_unlock_sock(sk);
+
+       return rc;
 
 drop:
        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,
                                skb1 = skb_clone(skb, GFP_ATOMIC);
 
                        if (skb1) {
-                               int ret = 0;
-
-                               bh_lock_sock(sk);
-                               if (!sock_owned_by_user(sk))
-                                       ret = udp_queue_rcv_skb(sk, skb1);
-                               else
-                                       sk_add_backlog(sk, skb1);
-                               bh_unlock_sock(sk);
-
+                               int ret = udp_queue_rcv_skb(sk, skb1);
                                if (ret > 0)
                                        /* we should probably re-process instead
                                         * of dropping packets here. */
@@ -1195,13 +1205,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
                        uh->dest, inet_iif(skb), udptable);
 
        if (sk != NULL) {
-               int ret = 0;
-               bh_lock_sock(sk);
-               if (!sock_owned_by_user(sk))
-                       ret = udp_queue_rcv_skb(sk, skb);
-               else
-                       sk_add_backlog(sk, skb);
-               bh_unlock_sock(sk);
+               int ret = udp_queue_rcv_skb(sk, skb);
                sock_put(sk);
 
                /* a return value > 0 means to resubmit the input, but
@@ -1494,7 +1498,7 @@ struct proto udp_prot = {
        .sendmsg           = udp_sendmsg,
        .recvmsg           = udp_recvmsg,
        .sendpage          = udp_sendpage,
-       .backlog_rcv       = udp_queue_rcv_skb,
+       .backlog_rcv       = __udp_queue_rcv_skb,
        .hash              = udp_lib_hash,
        .unhash            = udp_lib_unhash,
        .get_port          = udp_v4_get_port,
index 62e39ace05888f72fcda1e3b54b3bcc2d366f005..26654b26d7fafd3f2d20103484498b2098d30461 100644 (file)
@@ -97,8 +97,6 @@ hbh_mt6(const struct sk_buff *skb, const struct net_device *in,
        hdrlen -= 2;
        if (!(optinfo->flags & IP6T_OPTS_OPTS)) {
                return ret;
-       } else if (optinfo->flags & IP6T_OPTS_NSTRICT) {
-               pr_debug("Not strict - not implemented");
        } else {
                pr_debug("Strict ");
                pr_debug("#%d ", optinfo->optsnr);
@@ -177,6 +175,12 @@ hbh_mt6_check(const char *tablename, const void *entry,
                pr_debug("ip6t_opts: unknown flags %X\n", optsinfo->invflags);
                return false;
        }
+
+       if (optsinfo->flags & IP6T_OPTS_NSTRICT) {
+               pr_debug("ip6t_opts: Not strict - not implemented");
+               return false;
+       }
+
        return true;
 }
 
index 9af6115f0f500822c94ff6cb751ab24cd34de911..63442a1e741c630cb7936702f3e0690353e11a5b 100644 (file)
@@ -2688,6 +2688,8 @@ int __init ip6_route_init(void)
        if (ret)
                goto out_kmem_cache;
 
+       ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops_template.kmem_cachep;
+
        /* Registering of the loopback is done before this portion of code,
         * the loopback reference in rt6_info will not be taken, do it
         * manually for init_net */
index b585c850a89a3737b1b6a19aab62dd7dd1cee5cb..10e22fd482225c0b49c17646fa0e347a6250904f 100644 (file)
@@ -1050,7 +1050,7 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
        struct tcphdr *th = tcp_hdr(skb), *t1;
        struct sk_buff *buff;
        struct flowi fl;
-       struct net *net = dev_net(skb->dev);
+       struct net *net = dev_net(skb->dst->dev);
        struct sock *ctl_sk = net->ipv6.tcp_sk;
        unsigned int tot_len = sizeof(struct tcphdr);
        __be32 *topt;
index 705959b31e24dab7cd85db52b1b098391cfa2489..d7b54b5bfa69954778a7eed398d23e06fa18633c 100644 (file)
@@ -524,7 +524,6 @@ static int iucv_enable(void)
        get_online_cpus();
        for_each_online_cpu(cpu)
                smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1);
-       preempt_enable();
        if (cpus_empty(iucv_buffer_cpumask))
                /* No cpu could declare an iucv buffer. */
                goto out_path;
@@ -547,7 +546,9 @@ out:
  */
 static void iucv_disable(void)
 {
+       get_online_cpus();
        on_each_cpu(iucv_retrieve_cpu, NULL, 1);
+       put_online_cpus();
        kfree(iucv_path_table);
 }
 
index d628df97e02ed5b81002e725bdda6f200649fc08..b7f5a1c353ee4ec81b299d42b1f429a2d564ec22 100644 (file)
@@ -73,22 +73,18 @@ static int pfkey_can_dump(struct sock *sk)
        return 0;
 }
 
-static int pfkey_do_dump(struct pfkey_sock *pfk)
+static void pfkey_terminate_dump(struct pfkey_sock *pfk)
 {
-       int rc;
-
-       rc = pfk->dump.dump(pfk);
-       if (rc == -ENOBUFS)
-               return 0;
-
-       pfk->dump.done(pfk);
-       pfk->dump.dump = NULL;
-       pfk->dump.done = NULL;
-       return rc;
+       if (pfk->dump.dump) {
+               pfk->dump.done(pfk);
+               pfk->dump.dump = NULL;
+               pfk->dump.done = NULL;
+       }
 }
 
 static void pfkey_sock_destruct(struct sock *sk)
 {
+       pfkey_terminate_dump(pfkey_sk(sk));
        skb_queue_purge(&sk->sk_receive_queue);
 
        if (!sock_flag(sk, SOCK_DEAD)) {
@@ -310,6 +306,18 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,
        return err;
 }
 
+static int pfkey_do_dump(struct pfkey_sock *pfk)
+{
+       int rc;
+
+       rc = pfk->dump.dump(pfk);
+       if (rc == -ENOBUFS)
+               return 0;
+
+       pfkey_terminate_dump(pfk);
+       return rc;
+}
+
 static inline void pfkey_hdr_dup(struct sadb_msg *new, struct sadb_msg *orig)
 {
        *new = *orig;
index 532e4faa29f7cac835a854d4180f5d2e6861c794..9f1ea4a27b356e1f93f8a8fdc5dcb125cf488f0c 100644 (file)
@@ -525,6 +525,7 @@ static int nr_release(struct socket *sock)
        if (sk == NULL) return 0;
 
        sock_hold(sk);
+       sock_orphan(sk);
        lock_sock(sk);
        nr = nr_sk(sk);
 
@@ -548,7 +549,6 @@ static int nr_release(struct socket *sock)
                sk->sk_state    = TCP_CLOSE;
                sk->sk_shutdown |= SEND_SHUTDOWN;
                sk->sk_state_change(sk);
-               sock_orphan(sk);
                sock_set_flag(sk, SOCK_DESTROY);
                break;
 
index 9634091ee2f0f7f1c65059d6ae454281d2db0adf..ec0a0839ce512620231997be5f5c233b4bea423a 100644 (file)
@@ -215,10 +215,9 @@ static void dev_watchdog(unsigned long arg)
                            time_after(jiffies, (dev->trans_start +
                                                 dev->watchdog_timeo))) {
                                char drivername[64];
-                               printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
+                               WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
                                       dev->name, netdev_drivername(dev, drivername, 64));
                                dev->tx_timeout(dev);
-                               WARN_ON_ONCE(1);
                        }
                        if (!mod_timer(&dev->watchdog_timer,
                                       round_jiffies(jiffies +
index 8472b8b349c464ac8a900d6b23241ce59efc5397..abd51cef24131846299485b6f238ecbd4c939dbe 100644 (file)
@@ -599,11 +599,12 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
        /* Check to see if this is a duplicate. */
        peer = sctp_assoc_lookup_paddr(asoc, addr);
        if (peer) {
+               /* An UNKNOWN state is only set on transports added by
+                * user in sctp_connectx() call.  Such transports should be
+                * considered CONFIRMED per RFC 4960, Section 5.4.
+                */
                if (peer->state == SCTP_UNKNOWN) {
-                       if (peer_state == SCTP_ACTIVE)
-                               peer->state = SCTP_ACTIVE;
-                       if (peer_state == SCTP_UNCONFIRMED)
-                               peer->state = SCTP_UNCONFIRMED;
+                       peer->state = SCTP_ACTIVE;
                }
                return peer;
        }
index 0dc4a7dfb23443eacbe4accda160787443646906..225c7123c41f8b2dfa3a629b7bb8590133ab146e 100644 (file)
@@ -533,7 +533,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)
        if (!(dst->dev->features & NETIF_F_NO_CSUM)) {
                crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
                crc32 = sctp_end_cksum(crc32);
-       }
+       } else
+               nskb->ip_summed = CHECKSUM_UNNECESSARY;
 
        /* 3) Put the resultant value into the checksum field in the
         *    common header, and leave the rest of the bits unchanged.
index e8ca4e54981fb16d9e03790a8fcccd55002f660d..d68869f966c3b3b99fb70f8361cae85452f98632 100644 (file)
@@ -1012,6 +1012,29 @@ end:
        return retval;
 }
 
+struct sctp_chunk *sctp_make_violation_paramlen(
+       const struct sctp_association *asoc,
+       const struct sctp_chunk *chunk,
+       struct sctp_paramhdr *param)
+{
+       struct sctp_chunk *retval;
+       static const char error[] = "The following parameter had invalid length:";
+       size_t payload_len = sizeof(error) + sizeof(sctp_errhdr_t) +
+                               sizeof(sctp_paramhdr_t);
+
+       retval = sctp_make_abort(asoc, chunk, payload_len);
+       if (!retval)
+               goto nodata;
+
+       sctp_init_cause(retval, SCTP_ERROR_PROTO_VIOLATION,
+                       sizeof(error) + sizeof(sctp_paramhdr_t));
+       sctp_addto_chunk(retval, sizeof(error), error);
+       sctp_addto_param(retval, sizeof(sctp_paramhdr_t), param);
+
+nodata:
+       return retval;
+}
+
 /* Make a HEARTBEAT chunk.  */
 struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc,
                                  const struct sctp_transport *transport,
@@ -1782,11 +1805,6 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
                                        const struct sctp_chunk *chunk,
                                        struct sctp_chunk **errp)
 {
-       static const char error[] = "The following parameter had invalid length:";
-       size_t          payload_len = WORD_ROUND(sizeof(error)) +
-                                               sizeof(sctp_paramhdr_t);
-
-
        /* This is a fatal error.  Any accumulated non-fatal errors are
         * not reported.
         */
@@ -1794,14 +1812,7 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
                sctp_chunk_free(*errp);
 
        /* Create an error chunk and fill it in with our payload. */
-       *errp = sctp_make_op_error_space(asoc, chunk, payload_len);
-
-       if (*errp) {
-               sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION,
-                               sizeof(error) + sizeof(sctp_paramhdr_t));
-               sctp_addto_chunk(*errp, sizeof(error), error);
-               sctp_addto_param(*errp, sizeof(sctp_paramhdr_t), param);
-       }
+       *errp = sctp_make_violation_paramlen(asoc, chunk, param);
 
        return 0;
 }
@@ -1886,11 +1897,13 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
                            /* if the peer reports AUTH, assume that he
                             * supports AUTH.
                             */
-                           asoc->peer.auth_capable = 1;
+                           if (sctp_auth_enable)
+                                   asoc->peer.auth_capable = 1;
                            break;
                    case SCTP_CID_ASCONF:
                    case SCTP_CID_ASCONF_ACK:
-                           asoc->peer.asconf_capable = 1;
+                           if (sctp_addip_enable)
+                                   asoc->peer.asconf_capable = 1;
                            break;
                    default:
                            break;
@@ -2319,12 +2332,10 @@ clean_up:
        /* Release the transport structures. */
        list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
                transport = list_entry(pos, struct sctp_transport, transports);
-               list_del_init(pos);
-               sctp_transport_free(transport);
+               if (transport->state != SCTP_ACTIVE)
+                       sctp_assoc_rm_peer(asoc, transport);
        }
 
-       asoc->peer.transport_count = 0;
-
 nomem:
        return 0;
 }
@@ -2460,6 +2471,9 @@ do_addr_param:
                break;
 
        case SCTP_PARAM_SET_PRIMARY:
+               if (!sctp_addip_enable)
+                       goto fall_through;
+
                addr_param = param.v + sizeof(sctp_addip_param_t);
 
                af = sctp_get_af_specific(param_type2af(param.p->type));
index 8848d329aa2cea8bea3e3aec60405a4af51767cb..7c622af2ce55ad14f27bfbf87234cab9de7a829e 100644 (file)
@@ -119,7 +119,7 @@ static sctp_disposition_t sctp_sf_violation_paramlen(
                                     const struct sctp_endpoint *ep,
                                     const struct sctp_association *asoc,
                                     const sctp_subtype_t type,
-                                    void *arg,
+                                    void *arg, void *ext,
                                     sctp_cmd_seq_t *commands);
 
 static sctp_disposition_t sctp_sf_violation_ctsn(
@@ -3425,7 +3425,7 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep,
        addr_param = (union sctp_addr_param *)hdr->params;
        length = ntohs(addr_param->p.length);
        if (length < sizeof(sctp_paramhdr_t))
-               return sctp_sf_violation_paramlen(ep, asoc, type,
+               return sctp_sf_violation_paramlen(ep, asoc, type, arg,
                           (void *)addr_param, commands);
 
        /* Verify the ASCONF chunk before processing it. */
@@ -3433,8 +3433,8 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep,
                            (sctp_paramhdr_t *)((void *)addr_param + length),
                            (void *)chunk->chunk_end,
                            &err_param))
-               return sctp_sf_violation_paramlen(ep, asoc, type,
-                                                 (void *)&err_param, commands);
+               return sctp_sf_violation_paramlen(ep, asoc, type, arg,
+                                                 (void *)err_param, commands);
 
        /* ADDIP 5.2 E1) Compare the value of the serial number to the value
         * 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,
            (sctp_paramhdr_t *)addip_hdr->params,
            (void *)asconf_ack->chunk_end,
            &err_param))
-               return sctp_sf_violation_paramlen(ep, asoc, type,
-                          (void *)&err_param, commands);
+               return sctp_sf_violation_paramlen(ep, asoc, type, arg,
+                          (void *)err_param, commands);
 
        if (last_asconf) {
                addip_hdr = (sctp_addiphdr_t *)last_asconf->subh.addip_hdr;
@@ -4240,12 +4240,38 @@ static sctp_disposition_t sctp_sf_violation_paramlen(
                                     const struct sctp_endpoint *ep,
                                     const struct sctp_association *asoc,
                                     const sctp_subtype_t type,
-                                    void *arg,
-                                    sctp_cmd_seq_t *commands) {
-       static const char err_str[] = "The following parameter had invalid length:";
+                                    void *arg, void *ext,
+                                    sctp_cmd_seq_t *commands)
+{
+       struct sctp_chunk *chunk =  arg;
+       struct sctp_paramhdr *param = ext;
+       struct sctp_chunk *abort = NULL;
 
-       return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str,
-                                       sizeof(err_str));
+       if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc))
+               goto discard;
+
+       /* Make the abort chunk. */
+       abort = sctp_make_violation_paramlen(asoc, chunk, param);
+       if (!abort)
+               goto nomem;
+
+       sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
+       SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
+
+       sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                       SCTP_ERROR(ECONNABORTED));
+       sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
+                       SCTP_PERR(SCTP_ERROR_PROTO_VIOLATION));
+       SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
+
+discard:
+       sctp_sf_pdiscard(ep, asoc, SCTP_ST_CHUNK(0), arg, commands);
+
+       SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+
+       return SCTP_DISPOSITION_ABORT;
+nomem:
+       return SCTP_DISPOSITION_NOMEM;
 }
 
 /* Handle a protocol violation when the peer trying to advance the
index 8ef8ba81b9e2048c93363f4a2f98f73b7778cdce..3e8d4e35c08f3892e615959f60b0855e72f348a1 100644 (file)
@@ -1511,6 +1511,7 @@ out_fd:
        goto out_put;
 }
 
+#if 0
 #ifdef HAVE_SET_RESTORE_SIGMASK
 asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
                            int __user *upeer_addrlen,
@@ -1564,6 +1565,7 @@ asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
        return do_accept(fd, upeer_sockaddr, upeer_addrlen, flags);
 }
 #endif
+#endif
 
 asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
                           int __user *upeer_addrlen)
index ac25b4c0e982ee7d5089f7cf5c41d6d73c39ab51..dc50f1e71f76f86487ebded9991cb20bc4e46ef9 100644 (file)
@@ -27,10 +27,14 @@ static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb)
                - skb_headroom(skb);
        int ntail = dst->dev->needed_tailroom - skb_tailroom(skb);
 
-       if (nhead > 0 || ntail > 0)
-               return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC);
-
-       return 0;
+       if (nhead <= 0) {
+               if (ntail <= 0)
+                       return 0;
+               nhead = 0;
+       } else if (ntail < 0)
+               ntail = 0;
+
+       return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC);
 }
 
 static int xfrm_output_one(struct sk_buff *skb, int err)
index 36b5eedcdc7518d9dc734078c2287e16cca9f4d0..3e1057f885c6a2496e981e6180611aa6878cede0 100644 (file)
@@ -32,6 +32,7 @@ char *defconfig_file;
 
 static int indent = 1;
 static int valid_stdin = 1;
+static int sync_kconfig;
 static int conf_cnt;
 static char line[128];
 static struct menu *rootEntry;
@@ -65,7 +66,7 @@ static void strip(char *str)
 
 static void check_stdin(void)
 {
-       if (!valid_stdin && input_mode == ask_silent) {
+       if (!valid_stdin) {
                printf(_("aborted!\n\n"));
                printf(_("Console input/output is redirected. "));
                printf(_("Run 'make oldconfig' to update configuration.\n\n"));
@@ -427,43 +428,6 @@ static void check_conf(struct menu *menu)
                check_conf(child);
 }
 
-static void conf_do_update(void)
-{
-       /* Update until a loop caused no more changes */
-       do {
-               conf_cnt = 0;
-               check_conf(&rootmenu);
-       } while (conf_cnt);
-}
-
-static int conf_silent_update(void)
-{
-       const char *name;
-
-       if (conf_get_changed()) {
-               name = getenv("KCONFIG_NOSILENTUPDATE");
-               if (name && *name) {
-                       fprintf(stderr,
-                       _("\n*** Kernel configuration requires explicit update.\n\n"));
-                       return 1;
-               }
-               conf_do_update();
-       }
-       return 0;
-}
-
-static int conf_update(void)
-{
-       rootEntry = &rootmenu;
-       conf(&rootmenu);
-       if (input_mode == ask_all) {
-               input_mode = ask_silent;
-               valid_stdin = 1;
-       }
-       conf_do_update();
-       return 0;
-}
-
 int main(int ac, char **av)
 {
        int opt;
@@ -477,11 +441,11 @@ int main(int ac, char **av)
        while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
                switch (opt) {
                case 'o':
-                       input_mode = ask_new;
+                       input_mode = ask_silent;
                        break;
                case 's':
                        input_mode = ask_silent;
-                       valid_stdin = isatty(0) && isatty(1) && isatty(2);
+                       sync_kconfig = 1;
                        break;
                case 'd':
                        input_mode = set_default;
@@ -519,6 +483,19 @@ int main(int ac, char **av)
        name = av[optind];
        conf_parse(name);
        //zconfdump(stdout);
+       if (sync_kconfig) {
+               if (stat(".config", &tmpstat)) {
+                       fprintf(stderr, _("***\n"
+                               "*** You have not yet configured your kernel!\n"
+                               "*** (missing kernel .config file)\n"
+                               "***\n"
+                               "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
+                               "*** \"make menuconfig\" or \"make xconfig\").\n"
+                               "***\n"));
+                       exit(1);
+               }
+       }
+
        switch (input_mode) {
        case set_default:
                if (!defconfig_file)
@@ -531,16 +508,6 @@ int main(int ac, char **av)
                }
                break;
        case ask_silent:
-               if (stat(".config", &tmpstat)) {
-                       printf(_("***\n"
-                               "*** You have not yet configured your kernel!\n"
-                               "*** (missing kernel .config file)\n"
-                               "***\n"
-                               "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
-                               "*** \"make menuconfig\" or \"make xconfig\").\n"
-                               "***\n"));
-                       exit(1);
-               }
        case ask_all:
        case ask_new:
                conf_read(NULL);
@@ -569,6 +536,19 @@ int main(int ac, char **av)
        default:
                break;
        }
+
+       if (sync_kconfig) {
+               if (conf_get_changed()) {
+                       name = getenv("KCONFIG_NOSILENTUPDATE");
+                       if (name && *name) {
+                               fprintf(stderr,
+                                       _("\n*** Kernel configuration requires explicit update.\n\n"));
+                               return 1;
+                       }
+               }
+               valid_stdin = isatty(0) && isatty(1) && isatty(2);
+       }
+
        switch (input_mode) {
        case set_no:
                conf_set_all_new_symbols(def_no);
@@ -585,27 +565,38 @@ int main(int ac, char **av)
        case set_default:
                conf_set_all_new_symbols(def_default);
                break;
-       case ask_silent:
        case ask_new:
-               if (conf_silent_update())
-                       exit(1);
-               break;
        case ask_all:
-               if (conf_update())
-                       exit(1);
+               rootEntry = &rootmenu;
+               conf(&rootmenu);
+               input_mode = ask_silent;
+               /* fall through */
+       case ask_silent:
+               /* Update until a loop caused no more changes */
+               do {
+                       conf_cnt = 0;
+                       check_conf(&rootmenu);
+               } while (conf_cnt);
                break;
        }
 
-       if (conf_write(NULL)) {
-               fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
-               exit(1);
-       }
-       /* ask_silent is used during the build so we shall update autoconf.
-        * All other commands are only used to generate a config.
-        */
-       if (input_mode == ask_silent && conf_write_autoconf()) {
-               fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
-               return 1;
+       if (sync_kconfig) {
+               /* silentoldconfig is used during the build so we shall update autoconf.
+                * All other commands are only used to generate a config.
+                */
+               if (conf_get_changed() && conf_write(NULL)) {
+                       fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
+                       exit(1);
+               }
+               if (conf_write_autoconf()) {
+                       fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n"));
+                       return 1;
+               }
+       } else {
+               if (conf_write(NULL)) {
+                       fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
+                       exit(1);
+               }
        }
        return 0;
 }
index df6a188b993002ae7d2ca82cb12e8b853aefcb42..b91cf241a539ceaadbf603374d45b3c012a24e41 100644 (file)
@@ -222,8 +222,10 @@ load:
                                continue;
                        if (def == S_DEF_USER) {
                                sym = sym_find(line + 9);
-                               if (!sym)
+                               if (!sym) {
+                                       sym_add_change_count(1);
                                        break;
+                               }
                        } else {
                                sym = sym_lookup(line + 9, 0);
                                if (sym->type == S_UNKNOWN)
@@ -259,8 +261,10 @@ load:
                        }
                        if (def == S_DEF_USER) {
                                sym = sym_find(line + 7);
-                               if (!sym)
+                               if (!sym) {
+                                       sym_add_change_count(1);
                                        break;
+                               }
                        } else {
                                sym = sym_lookup(line + 7, 0);
                                if (sym->type == S_UNKNOWN)
index ff787e6ff8edcbef0edc7fbfaef7f3d088f930a0..44ee94d2ab761ba46b1f8f155009d78dbac2daad 100755 (executable)
@@ -781,6 +781,7 @@ sub output_struct_xml(%) {
     print " <refsect1>\n";
     print "  <title>Members</title>\n";
 
+    if ($#{$args{'parameterlist'}} >= 0) {
     print "  <variablelist>\n";
     foreach $parameter (@{$args{'parameterlist'}}) {
       ($parameter =~ /^#/) && next;
@@ -798,6 +799,9 @@ sub output_struct_xml(%) {
       print "    </varlistentry>\n";
     }
     print "  </variablelist>\n";
+    } else {
+       print " <para>\n  None\n </para>\n";
+    }
     print " </refsect1>\n";
 
     output_section_xml(@_);
index 418cd7dbbc939ae89ae88d04e71d14025885b4a8..8e0de6a5e18a0fad92f53cdf889c640022519774 100644 (file)
@@ -1986,11 +1986,13 @@ static void read_markers(const char *fname)
 
                mod = find_module(modname);
                if (!mod) {
-                       if (is_vmlinux(modname))
-                               have_vmlinux = 1;
                        mod = new_module(NOFAIL(strdup(modname)));
                        mod->skip = 1;
                }
+               if (is_vmlinux(modname)) {
+                       have_vmlinux = 1;
+                       mod->skip = 0;
+               }
 
                if (!mod->skip)
                        add_marker(mod, marker, fmt);
index d11a8154500f7f312e4fd83bd56430593c7b1393..8551952ef329bcf62c9fe1516f8a4d181988b543 100644 (file)
@@ -2737,6 +2737,7 @@ int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,
                if (ctx == NULL)
                        goto netlbl_secattr_to_sid_return;
 
+               context_init(&ctx_new);
                ctx_new.user = ctx->user;
                ctx_new.role = ctx->role;
                ctx_new.type = ctx->type;
@@ -2745,13 +2746,9 @@ int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,
                        if (ebitmap_netlbl_import(&ctx_new.range.level[0].cat,
                                                  secattr->attr.mls.cat) != 0)
                                goto netlbl_secattr_to_sid_return;
-                       ctx_new.range.level[1].cat.highbit =
-                               ctx_new.range.level[0].cat.highbit;
-                       ctx_new.range.level[1].cat.node =
-                               ctx_new.range.level[0].cat.node;
-               } else {
-                       ebitmap_init(&ctx_new.range.level[0].cat);
-                       ebitmap_init(&ctx_new.range.level[1].cat);
+                       memcpy(&ctx_new.range.level[1].cat,
+                              &ctx_new.range.level[0].cat,
+                              sizeof(ctx_new.range.level[0].cat));
                }
                if (mls_context_isvalid(&policydb, &ctx_new) != 1)
                        goto netlbl_secattr_to_sid_return_cleanup;
index 9dd9bc73fe1d6ab8b568fa1ce865650f52bae72f..ece25c718e95e8f78c5a71b01df6e01e80519908 100644 (file)
@@ -781,7 +781,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
                return -ENODEV;
 
        card = pcm->card;
-       down_read(&card->controls_rwsem);
+       read_lock(&card->ctl_files_rwlock);
        list_for_each_entry(kctl, &card->ctl_files, list) {
                if (kctl->pid == current->pid) {
                        prefer_subdevice = kctl->prefer_pcm_subdevice;
@@ -789,7 +789,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
                                break;
                }
        }
-       up_read(&card->controls_rwsem);
+       read_unlock(&card->ctl_files_rwlock);
 
        switch (stream) {
        case SNDRV_PCM_STREAM_PLAYBACK:
index c49b9d9e303c76d6495943b5b99fb02eff710e1f..c487025d345777d56ba228918bbc95eb9564cd05 100644 (file)
@@ -1546,16 +1546,10 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
        card = substream->pcm->card;
 
        if (runtime->status->state == SNDRV_PCM_STATE_OPEN ||
-           runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED)
+           runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED ||
+           runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
                return -EBADFD;
 
-       snd_power_lock(card);
-       if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
-               result = snd_power_wait(card, SNDRV_CTL_POWER_D0);
-               if (result < 0)
-                       goto _unlock;
-       }
-
        snd_pcm_stream_lock_irq(substream);
        /* resume pause */
        if (runtime->status->state == SNDRV_PCM_STATE_PAUSED)
@@ -1564,8 +1558,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
        snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
        /* runtime->control->appl_ptr = runtime->status->hw_ptr; */
        snd_pcm_stream_unlock_irq(substream);
- _unlock:
-       snd_power_unlock(card);
+
        return result;
 }
 
index f7ea7287c59cd7edfcf75bc5795efce07d512d79..b917a9f981c7a276b3fbff94deece3f4ab8aa2f4 100644 (file)
@@ -418,7 +418,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
        mutex_lock(&rmidi->open_mutex);
        while (1) {
                subdevice = -1;
-               down_read(&card->controls_rwsem);
+               read_lock(&card->ctl_files_rwlock);
                list_for_each_entry(kctl, &card->ctl_files, list) {
                        if (kctl->pid == current->pid) {
                                subdevice = kctl->prefer_rawmidi_subdevice;
@@ -426,7 +426,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
                                        break;
                        }
                }
-               up_read(&card->controls_rwsem);
+               read_unlock(&card->ctl_files_rwlock);
                err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device,
                                              subdevice, fflags, rawmidi_file);
                if (err >= 0)
index ad994fcab72508da6a7e483fd4b51526388643b6..f3da621f25c533a48b5a710970381410e6006e45 100644 (file)
@@ -1683,8 +1683,8 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
        /* Dell 3 stack systems with verb table in BIOS */
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0227, "Dell Vostro 1400  ", STAC_DELL_BIOS),
-       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022f, "Dell     ", STAC_DELL_BIOS),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022e, "Dell     ", STAC_DELL_BIOS),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0242, "Dell     ", STAC_DELL_BIOS),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0243, "Dell     ", STAC_DELL_BIOS),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x02ff, "Dell     ", STAC_DELL_BIOS),
index 566a6d0daf4a0161871305ac617ffa7b390975cc..106c48225bbadd2978a10b325fe80badcc7f086d 100644 (file)
@@ -621,6 +621,13 @@ static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] __initdata = {
        AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
 };
 
+static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] __initdata = {
+       AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
+       AWACS_VOLUME("Master Playback Volume", 5, 6, 1),
+       AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
+       AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
+};
+
 static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __initdata = {
        AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
        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 = {
 static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata =
 AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1);
 
-static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac __initdata =
+static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __initdata =
+AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 1);
+
+static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __initdata =
 AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0);
 
 
@@ -765,11 +775,12 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip)
 
 #define IS_PM7500 (machine_is_compatible("AAPL,7500"))
 #define IS_BEIGE (machine_is_compatible("AAPL,Gossamer"))
-#define IS_IMAC (machine_is_compatible("PowerMac2,1") \
-               || machine_is_compatible("PowerMac2,2") \
+#define IS_IMAC1 (machine_is_compatible("PowerMac2,1"))
+#define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \
                || machine_is_compatible("PowerMac4,1"))
+#define IS_G4AGP (machine_is_compatible("PowerMac3,1"))
 
-static int imac;
+static int imac1, imac2;
 
 #ifdef PMAC_SUPPORT_AUTOMUTE
 /*
@@ -815,13 +826,18 @@ static void snd_pmac_awacs_update_automute(struct snd_pmac *chip, int do_notify)
                {
                        int reg = chip->awacs_reg[1]
                                | (MASK_HDMUTE | MASK_SPKMUTE);
-                       if (imac) {
+                       if (imac1) {
+                               reg &= ~MASK_SPKMUTE;
+                               reg |= MASK_PAROUT1;
+                       } else if (imac2) {
                                reg &= ~MASK_SPKMUTE;
                                reg &= ~MASK_PAROUT1;
                        }
                        if (snd_pmac_awacs_detect_headphone(chip))
                                reg &= ~MASK_HDMUTE;
-                       else if (imac)
+                       else if (imac1)
+                               reg &= ~MASK_PAROUT1;
+                       else if (imac2)
                                reg |= MASK_PAROUT1;
                        else
                                reg &= ~MASK_SPKMUTE;
@@ -850,9 +866,13 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
 {
        int pm7500 = IS_PM7500;
        int beige = IS_BEIGE;
+       int g4agp = IS_G4AGP;
+       int imac;
        int err, vol;
 
-       imac = IS_IMAC;
+       imac1 = IS_IMAC1;
+       imac2 = IS_IMAC2;
+       imac = imac1 || imac2;
        /* looks like MASK_GAINLINE triggers something, so we set here
         * as start-up
         */
@@ -939,7 +959,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
                                snd_pmac_awacs_mixers);
        if (err < 0)
                return err;
-       if (beige)
+       if (beige || g4agp)
                ;
        else if (chip->model == PMAC_SCREAMER)
                err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2),
@@ -961,13 +981,17 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
                err = build_mixers(chip,
                                   ARRAY_SIZE(snd_pmac_screamer_mixers_imac),
                                   snd_pmac_screamer_mixers_imac);
+       else if (g4agp)
+               err = build_mixers(chip,
+                                  ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp),
+                                  snd_pmac_screamer_mixers_g4agp);
        else
                err = build_mixers(chip,
                                   ARRAY_SIZE(snd_pmac_awacs_mixers_pmac),
                                   snd_pmac_awacs_mixers_pmac);
        if (err < 0)
                return err;
-       chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac)
+       chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp)
                        ? &snd_pmac_awacs_master_sw_imac
                        : &snd_pmac_awacs_master_sw, chip);
        err = snd_ctl_add(chip->card, chip->master_sw_ctl);
@@ -1004,15 +1028,17 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
                                        snd_pmac_awacs_speaker_vol);
                if (err < 0)
                        return err;
-               chip->speaker_sw_ctl = snd_ctl_new1(imac
-                               ? &snd_pmac_awacs_speaker_sw_imac
+               chip->speaker_sw_ctl = snd_ctl_new1(imac1
+                               ? &snd_pmac_awacs_speaker_sw_imac1
+                               : imac2
+                               ? &snd_pmac_awacs_speaker_sw_imac2
                                : &snd_pmac_awacs_speaker_sw, chip);
                err = snd_ctl_add(chip->card, chip->speaker_sw_ctl);
                if (err < 0)
                        return err;
        }
 
-       if (beige)
+       if (beige || g4agp)
                err = build_mixers(chip,
                                ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige),
                                snd_pmac_screamer_mic_boost_beige);
index 435f1daf177c39e767cd4a7b6999f6d81d9847dc..c83584f989a9bea6223e611acce0ea37f8f2b51c 100644 (file)
@@ -434,7 +434,8 @@ static int at32_pcm_suspend(struct platform_device *pdev,
        params = prtd->params;
 
        /* Disable the PDC and save the PDC registers */
-       ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable);
+       ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
+                  params->mask->pdc_disable);
 
        prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr);
        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,
        ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save);
        ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save);
 
-       ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable);
+       ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR, params->mask->pdc_enable);
        return 0;
 }
 #else /* CONFIG_PM */
index 9deb8c74fdfd3f1c07f5b1eaf518d4b8f145b5d6..0bbd94501d7ea45f1aa8b491bf43d275ffb779c9 100644 (file)
@@ -490,34 +490,7 @@ static int cs4270_mute(struct snd_soc_dai *dai, int mute)
 
 #endif
 
-static int cs4270_i2c_probe(struct i2c_adapter *adap, int addr, int kind);
-
-/*
- * Notify the driver that a new I2C bus has been found.
- *
- * This function is called for each I2C bus in the system.  The function
- * then asks the I2C subsystem to probe that bus at the addresses on which
- * our device (the CS4270) could exist.  If a device is found at one of
- * those addresses, then our probe function (cs4270_i2c_probe) is called.
- */
-static int cs4270_i2c_attach(struct i2c_adapter *adapter)
-{
-       return i2c_probe(adapter, &addr_data, cs4270_i2c_probe);
-}
-
-static int cs4270_i2c_detach(struct i2c_client *client)
-{
-       struct snd_soc_codec *codec = i2c_get_clientdata(client);
-
-       i2c_detach_client(client);
-       codec->control_data = NULL;
-
-       kfree(codec->reg_cache);
-       codec->reg_cache = NULL;
-
-       kfree(client);
-       return 0;
-}
+static int cs4270_i2c_probe(struct i2c_client *, const struct i2c_device_id *);
 
 /* A list of non-DAPM controls that the CS4270 supports */
 static const struct snd_kcontrol_new cs4270_snd_controls[] = {
@@ -525,14 +498,19 @@ static const struct snd_kcontrol_new cs4270_snd_controls[] = {
                CS4270_VOLA, CS4270_VOLB, 0, 0xFF, 1)
 };
 
+static const struct i2c_device_id cs4270_id[] = {
+       {"cs4270", 0},
+       {}
+};
+MODULE_DEVICE_TABLE(i2c, cs4270_id);
+
 static struct i2c_driver cs4270_i2c_driver = {
        .driver = {
                .name = "CS4270 I2C",
                .owner = THIS_MODULE,
        },
-       .id =             I2C_DRIVERID_CS4270,
-       .attach_adapter = cs4270_i2c_attach,
-       .detach_client =  cs4270_i2c_detach,
+       .id_table = cs4270_id,
+       .probe = cs4270_i2c_probe,
 };
 
 /*
@@ -561,11 +539,11 @@ static struct snd_soc_device *cs4270_socdev;
  * Note: snd_soc_new_pcms() must be called before this function can be called,
  * because of snd_ctl_add().
  */
-static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
+static int cs4270_i2c_probe(struct i2c_client *i2c_client,
+       const struct i2c_device_id *id)
 {
        struct snd_soc_device *socdev = cs4270_socdev;
        struct snd_soc_codec *codec = socdev->codec;
-       struct i2c_client *i2c_client = NULL;
        int i;
        int ret = 0;
 
@@ -578,12 +556,6 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
 
        /* Note: codec_dai->codec is NULL here */
 
-       i2c_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (!i2c_client) {
-               printk(KERN_ERR "cs4270: could not allocate I2C client\n");
-               return -ENOMEM;
-       }
-
        codec->reg_cache = kzalloc(CS4270_NUMREGS, GFP_KERNEL);
        if (!codec->reg_cache) {
                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)
                goto error;
        }
 
-       i2c_set_clientdata(i2c_client, codec);
-       strcpy(i2c_client->name, "CS4270");
-
-       i2c_client->driver = &cs4270_i2c_driver;
-       i2c_client->adapter = adapter;
-       i2c_client->addr = addr;
-
        /* Verify that we have a CS4270 */
 
        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)
                goto error;
        }
 
-       printk(KERN_INFO "cs4270: found device at I2C address %X\n", addr);
+       printk(KERN_INFO "cs4270: found device at I2C address %X\n",
+               i2c_client->addr);
        printk(KERN_INFO "cs4270: hardware revision %X\n", ret & 0xF);
 
-       /* Tell the I2C layer a new client has arrived */
-
-       ret = i2c_attach_client(i2c_client);
-       if (ret) {
-               printk(KERN_ERR "cs4270: could not attach codec, "
-                       "I2C address %x, error code %i\n", addr, ret);
-               goto error;
-       }
-
        codec->control_data = i2c_client;
        codec->read = cs4270_read_reg_cache;
        codec->write = cs4270_i2c_write;
@@ -648,20 +605,17 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
                        goto error;
        }
 
+       i2c_set_clientdata(i2c_client, codec);
+
        return 0;
 
 error:
-       if (codec->control_data) {
-               i2c_detach_client(i2c_client);
-               codec->control_data = NULL;
-       }
+       codec->control_data = NULL;
 
        kfree(codec->reg_cache);
        codec->reg_cache = NULL;
        codec->reg_cache_size = 0;
 
-       kfree(i2c_client);
-
        return ret;
 }
 
@@ -727,7 +681,7 @@ static int cs4270_probe(struct platform_device *pdev)
        ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
        if (ret < 0) {
                printk(KERN_ERR "cs4270: failed to create PCMs\n");
-               return ret;
+               goto error_free_codec;
        }
 
 #ifdef USE_I2C
@@ -736,8 +690,7 @@ static int cs4270_probe(struct platform_device *pdev)
        ret = i2c_add_driver(&cs4270_i2c_driver);
        if (ret) {
                printk(KERN_ERR "cs4270: failed to attach driver");
-               snd_soc_free_pcms(socdev);
-               return ret;
+               goto error_free_pcms;
        }
 
        /* Did we find a CS4270 on the I2C bus? */
@@ -759,10 +712,23 @@ static int cs4270_probe(struct platform_device *pdev)
        ret = snd_soc_register_card(socdev);
        if (ret < 0) {
                printk(KERN_ERR "cs4270: failed to register card\n");
-               snd_soc_free_pcms(socdev);
-               return ret;
+               goto error_del_driver;
        }
 
+       return 0;
+
+error_del_driver:
+#ifdef USE_I2C
+       i2c_del_driver(&cs4270_i2c_driver);
+
+error_free_pcms:
+#endif
+       snd_soc_free_pcms(socdev);
+
+error_free_codec:
+       kfree(socdev->codec);
+       socdev->codec = NULL;
+
        return ret;
 }
 
@@ -773,8 +739,7 @@ static int cs4270_remove(struct platform_device *pdev)
        snd_soc_free_pcms(socdev);
 
 #ifdef USE_I2C
-       if (socdev->codec->control_data)
-               i2c_del_driver(&cs4270_i2c_driver);
+       i2c_del_driver(&cs4270_i2c_driver);
 #endif
 
        kfree(socdev->codec);
index 5761164fe16dea17481b538f4734d66fafdbebe9..e873414840c854231899d5bdd1b83316f08de4d8 100644 (file)
@@ -583,7 +583,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
 
        /* out 4 */
        {"Out4 Mux", "VREF", "VREF"},
-       {"Out4 Mux", "Capture ST", "Capture ST Mixer"},
+       {"Out4 Mux", "Capture ST", "Playback Mixer"},
        {"Out4 Mux", "LOUT2", "LOUT2"},
        {"Out 4", NULL, "Out4 Mux"},
        {"OUT4", NULL, "Out 4"},
@@ -607,7 +607,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
        /* Capture Right Mux */
        {"Capture Right Mux", "PGA", "Right Capture Volume"},
        {"Capture Right Mux", "Line or RXP-RXN", "Line Right Mux"},
-       {"Capture Right Mux", "Sidetone", "Capture ST Mixer"},
+       {"Capture Right Mux", "Sidetone", "Playback Mixer"},
 
        /* Mono Capture mixer-mux */
        {"Capture Right Mixer", "Stereo", "Capture Right Mux"},