]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Merge branch 'drm-fixes-4.10' of git://people.freedesktop.org/~agd5f/linux into drm...
authorDave Airlie <airlied@redhat.com>
Sun, 8 Jan 2017 23:47:19 +0000 (09:47 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 8 Jan 2017 23:47:19 +0000 (09:47 +1000)
Fixes for 4.10:
- Polaris 12 support
- Add new amd-gfx mailing list to MAINTAINERS file
- UVD clockgating fix
- SI dpm fixes

* 'drm-fixes-4.10' of git://people.freedesktop.org/~agd5f/linux:
  drm/amdgpu: drop verde dpm quirks
  drm/radeon: drop verde dpm quirks
  drm/radeon: update smc firmware selection for SI
  drm/amdgpu: update si kicker smc firmware
  drm/amd/powerplay: extend smu's response timeout time.
  drm/amdgpu: remove static integer for uvd pp state
  drm/amd/amdgpu: add Polaris12 PCI ID
  drm/amdgpu/powerplay: add Polaris12 support
  drm/amd/amdgpu: add Polaris12 support (v3)
  MAINTAINERS: Update mailing list for radeon and amdgpu

1916 files changed:
Documentation/DocBook/Makefile
Documentation/admin-guide/kernel-parameters.txt
Documentation/block/queue-sysfs.txt
Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt
Documentation/devicetree/bindings/power/supply/tps65217_charger.txt
Documentation/driver-api/infrastructure.rst
Documentation/features/io/sg-chain/arch-support.txt
Documentation/networking/mpls-sysctl.txt
Documentation/scsi/g_NCR5380.txt
Documentation/unaligned-memory-access.txt
Documentation/vfio-mediated-device.txt
Documentation/x86/topology.txt
MAINTAINERS
Makefile
arch/alpha/boot/misc.c
arch/alpha/kernel/irq.c
arch/alpha/kernel/osf_sys.c
arch/alpha/kernel/process.c
arch/alpha/kernel/ptrace.c
arch/alpha/kernel/setup.c
arch/alpha/kernel/signal.c
arch/alpha/kernel/srm_env.c
arch/alpha/kernel/srmcons.c
arch/alpha/kernel/time.c
arch/alpha/kernel/traps.c
arch/alpha/lib/csum_partial_copy.c
arch/alpha/math-emu/math.c
arch/alpha/mm/init.c
arch/arc/Kconfig
arch/arc/include/asm/arcregs.h
arch/arc/include/asm/cacheflush.h
arch/arc/include/asm/irqflags-arcv2.h
arch/arc/kernel/entry-arcv2.S
arch/arc/kernel/entry-compact.S
arch/arc/kernel/intc-arcv2.c
arch/arc/mm/cache.c
arch/arm/Kconfig
arch/arm/boot/dts/Makefile
arch/arm/boot/dts/am335x-bone-common.dtsi
arch/arm/boot/dts/am33xx.dtsi
arch/arm/boot/dts/am4372.dtsi
arch/arm/boot/dts/am571x-idk.dts
arch/arm/boot/dts/am572x-idk.dts
arch/arm/boot/dts/am57xx-idk-common.dtsi
arch/arm/boot/dts/dm814x.dtsi
arch/arm/boot/dts/dm816x.dtsi
arch/arm/boot/dts/dra7.dtsi
arch/arm/boot/dts/dra72-evm-tps65917.dtsi
arch/arm/boot/dts/imx31.dtsi
arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
arch/arm/boot/dts/imx6qdl.dtsi
arch/arm/boot/dts/imx6sl.dtsi
arch/arm/boot/dts/imx6sx.dtsi
arch/arm/boot/dts/omap2.dtsi
arch/arm/boot/dts/omap3-n900.dts
arch/arm/boot/dts/omap3.dtsi
arch/arm/boot/dts/omap4.dtsi
arch/arm/boot/dts/omap5.dtsi
arch/arm/boot/dts/qcom-apq8064.dtsi
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
arch/arm/common/bL_switcher_dummy_if.c
arch/arm/kernel/smp_twd.c
arch/arm/kernel/swp_emulate.c
arch/arm/kvm/arm.c
arch/arm/kvm/guest.c
arch/arm/mach-davinci/clock.c
arch/arm/mach-davinci/clock.h
arch/arm/mach-davinci/da850.c
arch/arm/mach-davinci/time.c
arch/arm/mach-davinci/usb-da8xx.c
arch/arm/mach-ep93xx/timer-ep93xx.c
arch/arm/mach-exynos/platsmp.c
arch/arm/mach-footbridge/dc21285-timer.c
arch/arm/mach-imx/mach-imx1.c
arch/arm/mach-imx/mmdc.c
arch/arm/mach-iop13xx/irq.c
arch/arm/mach-ixp4xx/common.c
arch/arm/mach-mmp/time.c
arch/arm/mach-mvebu/coherency.c
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/gpio.c [deleted file]
arch/arm/mach-omap2/omap_hwmod.c
arch/arm/mach-omap2/omap_hwmod_common_data.h
arch/arm/mach-omap2/prm_common.c
arch/arm/mach-omap2/timer.c
arch/arm/mach-rpc/dma.c
arch/arm/mach-s3c24xx/common.c
arch/arm/mm/cache-l2x0-pmu.c
arch/arm/mm/cache-l2x0.c
arch/arm/plat-iop/time.c
arch/arm/vfp/vfpmodule.c
arch/arm/xen/enlighten.c
arch/arm64/boot/dts/amlogic/meson-gx.dtsi
arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts
arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
arch/arm64/boot/dts/qcom/msm8996.dtsi
arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
arch/arm64/configs/defconfig
arch/arm64/include/asm/asm-uaccess.h [new file with mode: 0644]
arch/arm64/include/asm/current.h
arch/arm64/include/asm/uaccess.h
arch/arm64/include/asm/word-at-a-time.h
arch/arm64/kernel/armv8_deprecated.c
arch/arm64/kernel/debug-monitors.c
arch/arm64/kernel/entry.S
arch/arm64/kernel/hw_breakpoint.c
arch/arm64/kernel/probes/kprobes.c
arch/arm64/kernel/signal32.c
arch/arm64/kvm/guest.c
arch/arm64/lib/clear_user.S
arch/arm64/lib/copy_from_user.S
arch/arm64/lib/copy_in_user.S
arch/arm64/lib/copy_to_user.S
arch/arm64/mm/cache.S
arch/arm64/mm/dma-mapping.c
arch/arm64/mm/fault.c
arch/arm64/mm/init.c
arch/arm64/xen/hypercall.S
arch/avr32/kernel/avr32_ksyms.c
arch/avr32/kernel/ptrace.c
arch/avr32/kernel/signal.c
arch/avr32/kernel/time.c
arch/avr32/mm/cache.c
arch/blackfin/kernel/bfin_dma.c
arch/blackfin/kernel/kgdb_test.c
arch/blackfin/kernel/module.c
arch/blackfin/kernel/perf_event.c
arch/blackfin/kernel/time-ts.c
arch/c6x/kernel/time.c
arch/c6x/mm/init.c
arch/cris/arch-v10/drivers/eeprom.c
arch/cris/arch-v10/drivers/sync_serial.c
arch/cris/arch-v10/kernel/ptrace.c
arch/cris/arch-v10/kernel/signal.c
arch/cris/arch-v10/kernel/traps.c
arch/cris/arch-v10/lib/usercopy.c
arch/cris/arch-v10/mm/fault.c
arch/cris/arch-v32/drivers/cryptocop.c
arch/cris/arch-v32/kernel/ptrace.c
arch/cris/arch-v32/kernel/signal.c
arch/cris/arch-v32/kernel/traps.c
arch/cris/arch-v32/lib/usercopy.c
arch/cris/kernel/crisksyms.c
arch/cris/kernel/process.c
arch/cris/kernel/profile.c
arch/cris/kernel/ptrace.c
arch/cris/kernel/sys_cris.c
arch/cris/kernel/traps.c
arch/frv/include/asm/futex.h
arch/frv/kernel/irq.c
arch/frv/kernel/pm-mb93093.c
arch/frv/kernel/pm.c
arch/frv/kernel/process.c
arch/frv/kernel/ptrace.c
arch/frv/kernel/signal.c
arch/frv/kernel/sys_frv.c
arch/frv/kernel/sysctl.c
arch/frv/kernel/traps.c
arch/frv/kernel/uaccess.c
arch/frv/mm/dma-alloc.c
arch/frv/mm/extable.c
arch/h8300/boot/compressed/misc.c
arch/h8300/kernel/process.c
arch/h8300/kernel/signal.c
arch/hexagon/kernel/hexagon_ksyms.c
arch/hexagon/kernel/signal.c
arch/hexagon/kernel/time.c
arch/hexagon/mm/uaccess.c
arch/hexagon/mm/vm_fault.c
arch/ia64/kernel/brl_emu.c
arch/ia64/kernel/crash_dump.c
arch/ia64/kernel/cyclone.c
arch/ia64/kernel/fsyscall_gtod_data.h
arch/ia64/kernel/init_task.c
arch/ia64/kernel/irq.c
arch/ia64/kernel/kprobes.c
arch/ia64/kernel/perfmon.c
arch/ia64/kernel/process.c
arch/ia64/kernel/ptrace.c
arch/ia64/kernel/salinfo.c
arch/ia64/kernel/signal.c
arch/ia64/kernel/sys_ia64.c
arch/ia64/kernel/time.c
arch/ia64/kernel/traps.c
arch/ia64/kernel/unaligned.c
arch/ia64/kernel/unwind.c
arch/ia64/lib/csum_partial_copy.c
arch/ia64/mm/extable.c
arch/ia64/mm/init.c
arch/ia64/sn/kernel/sn2/sn_hwperf.c
arch/ia64/sn/kernel/sn2/sn_proc_fs.c
arch/ia64/sn/kernel/sn2/timer.c
arch/ia64/sn/kernel/tiocx.c
arch/m32r/kernel/align.c
arch/m32r/kernel/irq.c
arch/m32r/kernel/m32r_ksyms.c
arch/m32r/kernel/process.c
arch/m32r/kernel/ptrace.c
arch/m32r/kernel/signal.c
arch/m32r/kernel/sys_m32r.c
arch/m32r/kernel/traps.c
arch/m32r/lib/csum_partial_copy.c
arch/m32r/lib/usercopy.c
arch/m32r/mm/extable.c
arch/m32r/mm/fault-nommu.c
arch/m68k/68000/timers.c
arch/m68k/bvme6000/rtc.c
arch/m68k/coldfire/dma_timer.c
arch/m68k/coldfire/pit.c
arch/m68k/coldfire/sltimers.c
arch/m68k/coldfire/timers.c
arch/m68k/kernel/process.c
arch/m68k/kernel/ptrace.c
arch/m68k/kernel/signal.c
arch/m68k/kernel/sys_m68k.c
arch/m68k/kernel/traps.c
arch/m68k/lib/uaccess.c
arch/m68k/mac/misc.c
arch/m68k/mm/init.c
arch/m68k/mm/motorola.c
arch/m68k/mm/sun3mmu.c
arch/m68k/mvme16x/rtc.c
arch/m68k/sun3/mmu_emu.c
arch/metag/kernel/irq.c
arch/metag/kernel/perf/perf_event.c
arch/microblaze/kernel/timer.c
arch/mips/alchemy/common/power.c
arch/mips/alchemy/common/time.c
arch/mips/cavium-octeon/csrc-octeon.c
arch/mips/dec/kn01-berr.c
arch/mips/include/asm/checksum.h
arch/mips/include/asm/compat-signal.h
arch/mips/include/asm/r4kcache.h
arch/mips/include/asm/termios.h
arch/mips/jazz/jazzdma.c
arch/mips/jz4740/time.c
arch/mips/kernel/branch.c
arch/mips/kernel/cevt-txx9.c
arch/mips/kernel/cpu-probe.c
arch/mips/kernel/crash_dump.c
arch/mips/kernel/csrc-bcm1480.c
arch/mips/kernel/csrc-ioasic.c
arch/mips/kernel/csrc-r4k.c
arch/mips/kernel/csrc-sb1250.c
arch/mips/kernel/irq.c
arch/mips/kernel/kgdb.c
arch/mips/kernel/linux32.c
arch/mips/kernel/mips-mt-fpaff.c
arch/mips/kernel/mips-r2-to-r6-emul.c
arch/mips/kernel/mips_ksyms.c
arch/mips/kernel/pm-cps.c
arch/mips/kernel/process.c
arch/mips/kernel/ptrace.c
arch/mips/kernel/ptrace32.c
arch/mips/kernel/signal32.c
arch/mips/kernel/signal_n32.c
arch/mips/kernel/syscall.c
arch/mips/kernel/traps.c
arch/mips/kernel/unaligned.c
arch/mips/kvm/entry.c
arch/mips/kvm/mips.c
arch/mips/loongson32/common/time.c
arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c
arch/mips/loongson64/loongson-3/hpet.c
arch/mips/math-emu/cp1emu.c
arch/mips/math-emu/dsemul.c
arch/mips/mm/extable.c
arch/mips/mm/sc-debugfs.c
arch/mips/mti-malta/malta-time.c
arch/mips/netlogic/common/time.c
arch/mips/oprofile/op_model_loongson3.c
arch/mips/sgi-ip22/ip28-berr.c
arch/mips/sgi-ip27/ip27-berr.c
arch/mips/sgi-ip27/ip27-timer.c
arch/mips/sgi-ip32/ip32-berr.c
arch/mips/sibyte/common/sb_tbprof.c
arch/mn10300/kernel/csrc-mn10300.c
arch/mn10300/kernel/fpu.c
arch/mn10300/kernel/mn10300_ksyms.c
arch/mn10300/kernel/process.c
arch/mn10300/kernel/ptrace.c
arch/mn10300/kernel/setup.c
arch/mn10300/kernel/signal.c
arch/mn10300/kernel/sys_mn10300.c
arch/mn10300/lib/checksum.c
arch/mn10300/mm/cache-smp.c
arch/mn10300/mm/cache.c
arch/mn10300/mm/extable.c
arch/mn10300/mm/init.c
arch/mn10300/mm/misalignment.c
arch/mn10300/proc-mn2ws0050/proc-init.c
arch/nios2/kernel/time.c
arch/nios2/kernel/traps.c
arch/openrisc/kernel/or32_ksyms.c
arch/openrisc/kernel/process.c
arch/openrisc/kernel/signal.c
arch/openrisc/kernel/time.c
arch/openrisc/kernel/traps.c
arch/openrisc/kernel/vmlinux.lds.S
arch/openrisc/mm/fault.c
arch/parisc/include/asm/thread_info.h
arch/parisc/kernel/asm-offsets.c
arch/parisc/kernel/parisc_ksyms.c
arch/parisc/kernel/pci-dma.c
arch/parisc/kernel/perf.c
arch/parisc/kernel/ptrace.c
arch/parisc/kernel/signal.c
arch/parisc/kernel/signal32.c
arch/parisc/kernel/sys_parisc.c
arch/parisc/kernel/time.c
arch/parisc/kernel/unaligned.c
arch/parisc/kernel/unwind.c
arch/parisc/lib/checksum.c
arch/parisc/mm/fault.c
arch/powerpc/include/asm/asm-prototypes.h
arch/powerpc/kernel/align.c
arch/powerpc/kernel/crash_dump.c
arch/powerpc/kernel/hw_breakpoint.c
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/kprobes.c
arch/powerpc/kernel/misc_32.S
arch/powerpc/kernel/module.c
arch/powerpc/kernel/nvram_64.c
arch/powerpc/kernel/pci_32.c
arch/powerpc/kernel/proc_powerpc.c
arch/powerpc/kernel/ptrace.c
arch/powerpc/kernel/ptrace32.c
arch/powerpc/kernel/rtas-proc.c
arch/powerpc/kernel/rtas.c
arch/powerpc/kernel/rtas_flash.c
arch/powerpc/kernel/rtasd.c
arch/powerpc/kernel/setup_32.c
arch/powerpc/kernel/signal.c
arch/powerpc/kernel/signal_32.c
arch/powerpc/kernel/signal_64.c
arch/powerpc/kernel/sys_ppc32.c
arch/powerpc/kernel/syscalls.c
arch/powerpc/kernel/time.c
arch/powerpc/kernel/traps.c
arch/powerpc/kernel/vecemu.c
arch/powerpc/kvm/book3s.c
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_pr.c
arch/powerpc/kvm/book3s_pr_papr.c
arch/powerpc/kvm/book3s_rtas.c
arch/powerpc/kvm/book3s_xics.c
arch/powerpc/kvm/booke.c
arch/powerpc/kvm/mpic.c
arch/powerpc/kvm/powerpc.c
arch/powerpc/lib/checksum_wrappers.c
arch/powerpc/lib/code-patching.c
arch/powerpc/lib/sstep.c
arch/powerpc/lib/usercopy_64.c
arch/powerpc/math-emu/fabs.c
arch/powerpc/math-emu/fadd.c
arch/powerpc/math-emu/fadds.c
arch/powerpc/math-emu/fcmpo.c
arch/powerpc/math-emu/fcmpu.c
arch/powerpc/math-emu/fctiw.c
arch/powerpc/math-emu/fctiwz.c
arch/powerpc/math-emu/fdiv.c
arch/powerpc/math-emu/fdivs.c
arch/powerpc/math-emu/fmadd.c
arch/powerpc/math-emu/fmadds.c
arch/powerpc/math-emu/fmr.c
arch/powerpc/math-emu/fmsub.c
arch/powerpc/math-emu/fmsubs.c
arch/powerpc/math-emu/fmul.c
arch/powerpc/math-emu/fmuls.c
arch/powerpc/math-emu/fnabs.c
arch/powerpc/math-emu/fneg.c
arch/powerpc/math-emu/fnmadd.c
arch/powerpc/math-emu/fnmadds.c
arch/powerpc/math-emu/fnmsub.c
arch/powerpc/math-emu/fnmsubs.c
arch/powerpc/math-emu/fre.c
arch/powerpc/math-emu/fres.c
arch/powerpc/math-emu/frsp.c
arch/powerpc/math-emu/frsqrte.c
arch/powerpc/math-emu/frsqrtes.c
arch/powerpc/math-emu/fsel.c
arch/powerpc/math-emu/fsqrt.c
arch/powerpc/math-emu/fsqrts.c
arch/powerpc/math-emu/fsub.c
arch/powerpc/math-emu/fsubs.c
arch/powerpc/math-emu/lfd.c
arch/powerpc/math-emu/lfs.c
arch/powerpc/math-emu/math.c
arch/powerpc/math-emu/math_efp.c
arch/powerpc/math-emu/mcrfs.c
arch/powerpc/math-emu/mffs.c
arch/powerpc/math-emu/mtfsb0.c
arch/powerpc/math-emu/mtfsb1.c
arch/powerpc/math-emu/mtfsf.c
arch/powerpc/math-emu/mtfsfi.c
arch/powerpc/math-emu/stfd.c
arch/powerpc/math-emu/stfiwx.c
arch/powerpc/math-emu/stfs.c
arch/powerpc/mm/40x_mmu.c
arch/powerpc/mm/fsl_booke_mmu.c
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/init_64.c
arch/powerpc/mm/numa.c
arch/powerpc/mm/subpage-prot.c
arch/powerpc/oprofile/cell/spu_profiler.c
arch/powerpc/perf/core-book3s.c
arch/powerpc/platforms/cell/spufs/coredump.c
arch/powerpc/platforms/cell/spufs/file.c
arch/powerpc/platforms/cell/spufs/inode.c
arch/powerpc/platforms/cell/spufs/syscalls.c
arch/powerpc/platforms/chrp/nvram.c
arch/powerpc/platforms/powernv/opal-elog.c
arch/powerpc/platforms/powernv/opal-lpc.c
arch/powerpc/platforms/powernv/opal-prd.c
arch/powerpc/platforms/pseries/cmm.c
arch/powerpc/platforms/pseries/dlpar.c
arch/powerpc/platforms/pseries/dtl.c
arch/powerpc/platforms/pseries/lparcfg.c
arch/powerpc/platforms/pseries/nvram.c
arch/powerpc/platforms/pseries/reconfig.c
arch/powerpc/platforms/pseries/scanlog.c
arch/powerpc/sysdev/scom.c
arch/powerpc/sysdev/tsi108_pci.c
arch/s390/appldata/appldata_base.c
arch/s390/boot/compressed/misc.c
arch/s390/crypto/prng.c
arch/s390/include/asm/asm-prototypes.h [new file with mode: 0644]
arch/s390/include/asm/checksum.h
arch/s390/include/asm/idals.h
arch/s390/include/asm/mmu_context.h
arch/s390/kernel/compat_linux.c
arch/s390/kernel/compat_signal.c
arch/s390/kernel/debug.c
arch/s390/kernel/dis.c
arch/s390/kernel/kprobes.c
arch/s390/kernel/perf_cpum_cf.c
arch/s390/kernel/perf_cpum_sf.c
arch/s390/kernel/ptrace.c
arch/s390/kernel/signal.c
arch/s390/kernel/sys_s390.c
arch/s390/kernel/time.c
arch/s390/kernel/traps.c
arch/s390/kernel/vtime.c
arch/s390/kvm/interrupt.c
arch/s390/mm/init.c
arch/score/include/asm/checksum.h
arch/score/kernel/ptrace.c
arch/score/kernel/traps.c
arch/score/lib/checksum_copy.c
arch/sh/boards/mach-landisk/gio.c
arch/sh/boot/compressed/misc.c
arch/sh/include/asm/mmu_context.h
arch/sh/kernel/cpu/init.c
arch/sh/kernel/cpu/shmobile/cpuidle.c
arch/sh/kernel/cpu/shmobile/pm.c
arch/sh/kernel/crash_dump.c
arch/sh/kernel/io_trapped.c
arch/sh/kernel/irq.c
arch/sh/kernel/kprobes.c
arch/sh/kernel/process_32.c
arch/sh/kernel/process_64.c
arch/sh/kernel/ptrace_32.c
arch/sh/kernel/ptrace_64.c
arch/sh/kernel/setup.c
arch/sh/kernel/sh_ksyms_64.c
arch/sh/kernel/signal_32.c
arch/sh/kernel/signal_64.c
arch/sh/kernel/sys_sh.c
arch/sh/kernel/sys_sh32.c
arch/sh/kernel/traps_64.c
arch/sh/math-emu/math.c
arch/sh/mm/cache-debugfs.c
arch/sh/mm/cache-sh3.c
arch/sh/mm/cache-sh5.c
arch/sh/mm/cache-sh7705.c
arch/sh/mm/extable_32.c
arch/sh/mm/extable_64.c
arch/sh/mm/nommu.c
arch/sh/mm/pmb.c
arch/sh/mm/tlb-sh3.c
arch/sh/mm/tlbex_64.c
arch/sh/mm/tlbflush_64.c
arch/sh/oprofile/backtrace.c
arch/sparc/include/asm/checksum_32.h
arch/sparc/include/asm/checksum_64.h
arch/sparc/kernel/apc.c
arch/sparc/kernel/irq_64.c
arch/sparc/kernel/kprobes.c
arch/sparc/kernel/mdesc.c
arch/sparc/kernel/pci.c
arch/sparc/kernel/pcic.c
arch/sparc/kernel/pmc.c
arch/sparc/kernel/process_32.c
arch/sparc/kernel/process_64.c
arch/sparc/kernel/ptrace_32.c
arch/sparc/kernel/ptrace_64.c
arch/sparc/kernel/signal32.c
arch/sparc/kernel/signal_32.c
arch/sparc/kernel/signal_64.c
arch/sparc/kernel/smp_64.c
arch/sparc/kernel/sys_sparc32.c
arch/sparc/kernel/sys_sparc_32.c
arch/sparc/kernel/sys_sparc_64.c
arch/sparc/kernel/time_32.c
arch/sparc/kernel/time_64.c
arch/sparc/kernel/traps_64.c
arch/sparc/kernel/unaligned_32.c
arch/sparc/kernel/unaligned_64.c
arch/sparc/kernel/uprobes.c
arch/sparc/kernel/visemul.c
arch/sparc/kernel/windows.c
arch/sparc/math-emu/math_32.c
arch/sparc/math-emu/math_64.c
arch/sparc/mm/extable.c
arch/sparc/mm/init_64.c
arch/tile/kernel/process.c
arch/tile/kernel/single_step.c
arch/tile/kernel/unaligned.c
arch/um/drivers/harddog_kern.c
arch/um/drivers/hostaudio_kern.c
arch/um/drivers/mconsole_kern.c
arch/um/drivers/mmapper_kern.c
arch/um/drivers/random.c
arch/um/kernel/exec.c
arch/um/kernel/exitcode.c
arch/um/kernel/process.c
arch/um/kernel/ptrace.c
arch/um/kernel/syscall.c
arch/um/kernel/time.c
arch/unicore32/kernel/time.c
arch/x86/boot/cpu.c
arch/x86/entry/common.c
arch/x86/entry/vdso/vclock_gettime.c
arch/x86/entry/vdso/vma.c
arch/x86/events/amd/ibs.c
arch/x86/events/amd/power.c
arch/x86/events/amd/uncore.c
arch/x86/events/core.c
arch/x86/events/intel/core.c
arch/x86/events/intel/cqm.c
arch/x86/events/intel/cstate.c
arch/x86/events/intel/rapl.c
arch/x86/events/intel/uncore.c
arch/x86/events/intel/uncore_snbep.c
arch/x86/ia32/ia32_aout.c
arch/x86/ia32/ia32_signal.c
arch/x86/ia32/sys_ia32.c
arch/x86/include/asm/asm-prototypes.h
arch/x86/include/asm/bitops.h
arch/x86/include/asm/checksum_64.h
arch/x86/include/asm/kvm_host.h
arch/x86/include/asm/processor.h
arch/x86/include/asm/pvclock.h
arch/x86/include/asm/tsc.h
arch/x86/include/asm/unwind.h
arch/x86/include/asm/vgtod.h
arch/x86/include/asm/x86_init.h
arch/x86/include/asm/xen/page.h
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/alternative.c
arch/x86/kernel/apb_timer.c
arch/x86/kernel/apic/x2apic_cluster.c
arch/x86/kernel/apm_32.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/mcheck/mce-severity.c
arch/x86/kernel/cpu/mcheck/mce_amd.c
arch/x86/kernel/cpu/microcode/amd.c
arch/x86/kernel/cpu/microcode/core.c
arch/x86/kernel/cpu/microcode/intel.c
arch/x86/kernel/cpu/mshyperv.c
arch/x86/kernel/crash_dump_32.c
arch/x86/kernel/doublefault.c
arch/x86/kernel/hpet.c
arch/x86/kernel/kprobes/core.c
arch/x86/kernel/kprobes/opt.c
arch/x86/kernel/kvmclock.c
arch/x86/kernel/msr.c
arch/x86/kernel/paravirt_patch_32.c
arch/x86/kernel/paravirt_patch_64.c
arch/x86/kernel/pci-swiotlb.c
arch/x86/kernel/platform-quirks.c
arch/x86/kernel/process.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/pvclock.c
arch/x86/kernel/tboot.c
arch/x86/kernel/test_nx.c
arch/x86/kernel/tls.c
arch/x86/kernel/tsc.c
arch/x86/kernel/unwind_frame.c
arch/x86/kernel/vm86_32.c
arch/x86/kernel/x86_init.c
arch/x86/kvm/lapic.c
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c
arch/x86/lguest/boot.c
arch/x86/lib/usercopy_32.c
arch/x86/math-emu/errors.c
arch/x86/math-emu/fpu_entry.c
arch/x86/math-emu/get_address.c
arch/x86/math-emu/load_store.c
arch/x86/math-emu/reg_ld_str.c
arch/x86/mm/extable.c
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c
arch/x86/mm/pageattr.c
arch/x86/platform/ce4100/ce4100.c
arch/x86/platform/intel-mid/device_libs/Makefile
arch/x86/platform/intel-mid/intel-mid.c
arch/x86/platform/intel-quark/imr_selftest.c
arch/x86/platform/uv/uv_time.c
arch/x86/tools/relocs.c
arch/x86/um/ptrace_32.c
arch/x86/um/ptrace_64.c
arch/x86/um/signal.c
arch/x86/um/tls_32.c
arch/x86/xen/enlighten.c
arch/x86/xen/p2m.c
arch/x86/xen/pci-swiotlb-xen.c
arch/x86/xen/setup.c
arch/x86/xen/time.c
arch/x86/xen/xen-ops.h
arch/xtensa/include/asm/checksum.h
arch/xtensa/include/asm/segment.h
arch/xtensa/kernel/asm-offsets.c
arch/xtensa/kernel/irq.c
arch/xtensa/kernel/perf_event.c
arch/xtensa/kernel/process.c
arch/xtensa/kernel/ptrace.c
arch/xtensa/kernel/signal.c
arch/xtensa/kernel/stacktrace.c
arch/xtensa/kernel/syscall.c
arch/xtensa/kernel/time.c
arch/xtensa/kernel/traps.c
arch/xtensa/kernel/xtensa_ksyms.c
arch/xtensa/platforms/iss/console.c
arch/xtensa/platforms/iss/simdisk.c
block/blk-mq.c
block/blk-wbt.c
block/bsg.c
block/ioctl.c
block/partitions/ibm.c
block/scsi_ioctl.c
crypto/testmgr.c
drivers/acpi/acpi_video.c
drivers/acpi/acpi_watchdog.c
drivers/acpi/battery.c
drivers/acpi/glue.c
drivers/acpi/internal.h
drivers/acpi/osl.c
drivers/acpi/proc.c
drivers/acpi/processor_thermal.c
drivers/acpi/processor_throttling.c
drivers/acpi/scan.c
drivers/acpi/sysfs.c
drivers/acpi/thermal.c
drivers/atm/adummy.c
drivers/atm/atmtcp.c
drivers/atm/eni.c
drivers/atm/firestream.c
drivers/atm/fore200e.c
drivers/atm/he.c
drivers/atm/horizon.c
drivers/atm/idt77105.c
drivers/atm/idt77252.c
drivers/atm/iphase.c
drivers/atm/nicstar.c
drivers/atm/suni.c
drivers/atm/uPD98402.c
drivers/atm/zatm.c
drivers/base/memory.c
drivers/base/power/domain.c
drivers/base/power/main.c
drivers/base/power/wakeup.c
drivers/block/DAC960.c
drivers/block/amiflop.c
drivers/block/brd.c
drivers/block/cciss.c
drivers/block/cryptoloop.c
drivers/block/hd.c
drivers/block/loop.c
drivers/block/nbd.c
drivers/block/null_blk.c
drivers/block/paride/pcd.c
drivers/block/paride/pd.c
drivers/block/paride/pf.c
drivers/block/paride/pg.c
drivers/block/paride/pt.c
drivers/block/pktcdvd.c
drivers/block/swim3.c
drivers/block/sx8.c
drivers/block/umem.c
drivers/bus/arm-cci.c
drivers/bus/arm-ccn.c
drivers/cdrom/cdrom.c
drivers/char/agp/compat_ioctl.c
drivers/char/agp/frontend.c
drivers/char/applicom.c
drivers/char/bfin-otp.c
drivers/char/ds1620.c
drivers/char/dtlk.c
drivers/char/generic_nvram.c
drivers/char/hangcheck-timer.c
drivers/char/hpet.c
drivers/char/hw_random/core.c
drivers/char/ipmi/ipmi_watchdog.c
drivers/char/lp.c
drivers/char/mbcs.c
drivers/char/mmtimer.c
drivers/char/mwave/3780i.c
drivers/char/mwave/mwavedd.h
drivers/char/nsc_gpio.c
drivers/char/nwbutton.c
drivers/char/nwflash.c
drivers/char/pc8736x_gpio.c
drivers/char/pcmcia/cm4040_cs.c
drivers/char/pcmcia/synclink_cs.c
drivers/char/random.c
drivers/char/raw.c
drivers/char/scx200_gpio.c
drivers/char/sonypi.c
drivers/char/tlclk.c
drivers/char/toshiba.c
drivers/char/xilinx_hwicap/xilinx_hwicap.c
drivers/clk/clk-stm32f4.c
drivers/clk/renesas/clk-mstp.c
drivers/clocksource/acpi_pm.c
drivers/clocksource/arc_timer.c
drivers/clocksource/arm_arch_timer.c
drivers/clocksource/arm_global_timer.c
drivers/clocksource/cadence_ttc_timer.c
drivers/clocksource/clksrc-dbx500-prcmu.c
drivers/clocksource/dummy_timer.c
drivers/clocksource/dw_apb_timer.c
drivers/clocksource/em_sti.c
drivers/clocksource/exynos_mct.c
drivers/clocksource/h8300_timer16.c
drivers/clocksource/h8300_tpu.c
drivers/clocksource/i8253.c
drivers/clocksource/jcore-pit.c
drivers/clocksource/metag_generic.c
drivers/clocksource/mips-gic-timer.c
drivers/clocksource/mmio.c
drivers/clocksource/moxart_timer.c
drivers/clocksource/mxs_timer.c
drivers/clocksource/qcom-timer.c
drivers/clocksource/samsung_pwm_timer.c
drivers/clocksource/scx200_hrt.c
drivers/clocksource/sh_cmt.c
drivers/clocksource/sh_tmu.c
drivers/clocksource/tcb_clksrc.c
drivers/clocksource/time-armada-370-xp.c
drivers/clocksource/time-pistachio.c
drivers/clocksource/timer-atlas7.c
drivers/clocksource/timer-atmel-pit.c
drivers/clocksource/timer-atmel-st.c
drivers/clocksource/timer-nps.c
drivers/clocksource/timer-prima2.c
drivers/clocksource/timer-sun5i.c
drivers/clocksource/timer-ti-32k.c
drivers/clocksource/vt8500_timer.c
drivers/cpufreq/cpufreq-dt-platdev.c
drivers/cpufreq/ia64-acpi-cpufreq.c
drivers/cpufreq/intel_pstate.c
drivers/cpuidle/governors/ladder.c
drivers/crypto/marvell/cesa.h
drivers/crypto/marvell/hash.c
drivers/crypto/marvell/tdma.c
drivers/devfreq/devfreq.c
drivers/devfreq/exynos-bus.c
drivers/dio/dio.c
drivers/dma/dmatest.c
drivers/edac/edac_device.c
drivers/edac/edac_mc.c
drivers/edac/edac_pci.c
drivers/firmware/arm_scpi.c
drivers/firmware/psci_checker.c
drivers/gpu/drm/amd/amdgpu/dce_virtual.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/i915/gvt/cfg_space.c
drivers/gpu/drm/i915/gvt/gtt.c
drivers/gpu/drm/i915/gvt/gtt.h
drivers/gpu/drm/i915/gvt/gvt.h
drivers/gpu/drm/i915/gvt/kvmgt.c
drivers/gpu/drm/i915/gvt/opregion.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_request.h
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_overlay.c
drivers/gpu/drm/i915/intel_uncore.c
drivers/gpu/drm/meson/meson_plane.c
drivers/gpu/drm/meson/meson_venc.c
drivers/gpu/drm/meson/meson_venc_cvbs.c
drivers/gpu/drm/msm/adreno/adreno_gpu.c
drivers/gpu/drm/msm/msm_gem_submit.c
drivers/gpu/drm/msm/msm_ringbuffer.c
drivers/gpu/drm/nouveau/nouveau_fence.c
drivers/gpu/drm/tilcdc/tilcdc_crtc.c
drivers/hid/hid-asus.c
drivers/hid/hid-ids.h
drivers/hid/hid-sensor-hub.c
drivers/hid/hid-sony.c
drivers/hid/usbhid/hid-quirks.c
drivers/hv/hv.c
drivers/hwmon/lm90.c
drivers/hwtracing/coresight/coresight-etm3x.c
drivers/hwtracing/coresight/coresight-etm4x.c
drivers/i2c/i2c-core.c
drivers/ide/hpt366.c
drivers/ide/ide-disk.c
drivers/ide/ide-io.c
drivers/ide/ide-iops.c
drivers/ide/ide-probe.c
drivers/ide/ide-proc.c
drivers/iio/accel/st_accel_core.c
drivers/iio/adc/Kconfig
drivers/iio/common/st_sensors/st_sensors_buffer.c
drivers/iio/common/st_sensors/st_sensors_core.c
drivers/iio/counter/104-quad-8.c
drivers/iio/imu/bmi160/bmi160_core.c
drivers/iio/light/max44000.c
drivers/iio/trigger/iio-trig-hrtimer.c
drivers/infiniband/core/ucm.c
drivers/infiniband/core/user_mad.c
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/uverbs_main.c
drivers/infiniband/hw/cxgb4/qp.c
drivers/infiniband/hw/i40iw/i40iw_ctrl.c
drivers/infiniband/hw/i40iw/i40iw_puda.c
drivers/infiniband/hw/i40iw/i40iw_type.h
drivers/infiniband/hw/i40iw/i40iw_ucontext.h
drivers/infiniband/hw/i40iw/i40iw_uk.c
drivers/infiniband/hw/i40iw/i40iw_user.h
drivers/infiniband/hw/i40iw/i40iw_verbs.c
drivers/infiniband/hw/i40iw/i40iw_verbs.h
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/qedr/verbs.c
drivers/infiniband/sw/rxe/rxe_comp.c
drivers/infiniband/sw/rxe/rxe_net.c
drivers/infiniband/sw/rxe/rxe_qp.c
drivers/infiniband/sw/rxe/rxe_resp.c
drivers/infiniband/ulp/ipoib/ipoib_vlan.c
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/input/input-compat.c
drivers/input/joystick/walkera0701.c
drivers/input/misc/atlas_btns.c
drivers/input/mouse/amimouse.c
drivers/input/mouse/atarimouse.c
drivers/input/mouse/trackpoint.c
drivers/input/serio/hp_sdc.c
drivers/input/serio/i8042-x86ia64io.h
drivers/input/serio/q40kbd.c
drivers/input/serio/serport.c
drivers/input/tablet/aiptek.c
drivers/input/tablet/gtco.c
drivers/iommu/amd_iommu.c
drivers/iommu/dmar.c
drivers/iommu/intel-iommu.c
drivers/irqchip/irq-armada-370-xp.c
drivers/irqchip/irq-bcm2836.c
drivers/irqchip/irq-gic-v3.c
drivers/irqchip/irq-gic.c
drivers/irqchip/irq-hip04.c
drivers/irqchip/irq-mips-gic.c
drivers/irqchip/irq-st.c
drivers/isdn/capi/kcapi.c
drivers/isdn/hardware/avm/b1.c
drivers/isdn/hardware/avm/b1dma.c
drivers/isdn/hardware/avm/c4.c
drivers/isdn/hardware/eicon/capimain.c
drivers/isdn/hardware/eicon/divamnt.c
drivers/isdn/hardware/eicon/divasi.c
drivers/isdn/hardware/eicon/divasmain.c
drivers/isdn/hardware/eicon/divasproc.c
drivers/isdn/hysdn/hysdn_boot.c
drivers/leds/trigger/ledtrig-cpu.c
drivers/lguest/core.c
drivers/lguest/page_tables.c
drivers/lguest/x86/core.c
drivers/macintosh/ans-lcd.c
drivers/macintosh/smu.c
drivers/macintosh/via-pmu.c
drivers/macintosh/via-pmu68k.c
drivers/mailbox/mailbox.c
drivers/md/dm-ioctl.c
drivers/media/dvb-core/dmxdev.c
drivers/media/dvb-core/dvb_demux.c
drivers/media/dvb-core/dvb_net.c
drivers/media/dvb-core/dvb_ringbuffer.c
drivers/media/i2c/adv7170.c
drivers/media/i2c/adv7175.c
drivers/media/i2c/bt856.c
drivers/media/i2c/bt866.c
drivers/media/i2c/cs53l32a.c
drivers/media/i2c/m52790.c
drivers/media/i2c/saa6588.c
drivers/media/i2c/saa7110.c
drivers/media/i2c/saa7185.c
drivers/media/i2c/tlv320aic23b.c
drivers/media/i2c/vp27smpx.c
drivers/media/i2c/vpx3220.c
drivers/media/i2c/wm8739.c
drivers/media/i2c/wm8775.c
drivers/media/pci/cx88/cx88-input.c
drivers/media/pci/ivtv/ivtv-driver.h
drivers/media/pci/meye/meye.c
drivers/media/pci/pt3/pt3.c
drivers/media/pci/zoran/videocodec.c
drivers/media/pci/zoran/zoran_driver.c
drivers/media/platform/arv.c
drivers/media/rc/ir-rx51.c
drivers/media/usb/pvrusb2/pvrusb2-ioread.c
drivers/media/usb/pwc/pwc-ctrl.c
drivers/media/v4l2-core/v4l2-common.c
drivers/media/v4l2-core/v4l2-dev.c
drivers/message/fusion/mptctl.c
drivers/message/fusion/mptlan.h
drivers/misc/ibmasm/ibmasmfs.c
drivers/misc/mei/bus.c
drivers/misc/mei/client.c
drivers/mmc/core/block.c
drivers/mmc/host/android-goldfish.c
drivers/mtd/devices/pmc551.c
drivers/mtd/devices/slram.c
drivers/mtd/ftl.c
drivers/mtd/inftlcore.c
drivers/mtd/inftlmount.c
drivers/mtd/maps/sun_uflash.c
drivers/mtd/mtd_blkdevs.c
drivers/mtd/mtdchar.c
drivers/mtd/nftlcore.c
drivers/net/appletalk/ipddp.c
drivers/net/can/softing/softing_fw.c
drivers/net/can/softing/softing_main.c
drivers/net/eql.c
drivers/net/ethernet/3com/3c509.c
drivers/net/ethernet/3com/3c515.c
drivers/net/ethernet/3com/3c574_cs.c
drivers/net/ethernet/3com/3c59x.c
drivers/net/ethernet/3com/typhoon.c
drivers/net/ethernet/8390/axnet_cs.c
drivers/net/ethernet/8390/ne2k-pci.c
drivers/net/ethernet/8390/pcnet_cs.c
drivers/net/ethernet/adaptec/starfire.c
drivers/net/ethernet/alteon/acenic.c
drivers/net/ethernet/amd/amd8111e.c
drivers/net/ethernet/amd/nmclan_cs.c
drivers/net/ethernet/amd/xgbe/xgbe-ptp.c
drivers/net/ethernet/broadcom/b44.c
drivers/net/ethernet/broadcom/bcmsysport.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/cadence/macb_pci.c
drivers/net/ethernet/cavium/Kconfig
drivers/net/ethernet/chelsio/cxgb/cxgb2.c
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c
drivers/net/ethernet/dec/tulip/de2104x.c
drivers/net/ethernet/dec/tulip/de4x5.c
drivers/net/ethernet/dec/tulip/dmfe.c
drivers/net/ethernet/dec/tulip/tulip_core.c
drivers/net/ethernet/dec/tulip/uli526x.c
drivers/net/ethernet/dec/tulip/winbond-840.c
drivers/net/ethernet/dec/tulip/xircom_cb.c
drivers/net/ethernet/dlink/dl2k.h
drivers/net/ethernet/dlink/sundance.c
drivers/net/ethernet/ec_bhf.c
drivers/net/ethernet/emulex/benet/be.h
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/fealnx.c
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
drivers/net/ethernet/freescale/fec_ptp.c
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
drivers/net/ethernet/freescale/fs_enet/mac-fec.c
drivers/net/ethernet/freescale/fs_enet/mac-scc.c
drivers/net/ethernet/freescale/fs_enet/mii-fec.c
drivers/net/ethernet/freescale/gianfar.c
drivers/net/ethernet/freescale/gianfar.h
drivers/net/ethernet/freescale/gianfar_ethtool.c
drivers/net/ethernet/freescale/ucc_geth.c
drivers/net/ethernet/freescale/ucc_geth_ethtool.c
drivers/net/ethernet/fujitsu/fmvj18x_cs.c
drivers/net/ethernet/ibm/emac/core.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/e1000e/ptp.c
drivers/net/ethernet/intel/igb/igb_ptp.c
drivers/net/ethernet/intel/ixgb/ixgb_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
drivers/net/ethernet/korina.c
drivers/net/ethernet/marvell/mvpp2.c
drivers/net/ethernet/mellanox/mlx4/en_clock.c
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
drivers/net/ethernet/mellanox/mlx4/en_rx.c
drivers/net/ethernet/mellanox/mlx4/icm.c
drivers/net/ethernet/mellanox/mlx4/main.c
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
drivers/net/ethernet/mellanox/mlx5/core/en_clock.c
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
drivers/net/ethernet/mellanox/mlx5/core/main.c
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/natsemi/natsemi.c
drivers/net/ethernet/natsemi/ns83820.c
drivers/net/ethernet/packetengines/hamachi.c
drivers/net/ethernet/packetengines/yellowfin.c
drivers/net/ethernet/realtek/8139cp.c
drivers/net/ethernet/realtek/r8169.c
drivers/net/ethernet/renesas/sh_eth.c
drivers/net/ethernet/sfc/ef10.c
drivers/net/ethernet/sfc/ethtool.c
drivers/net/ethernet/sfc/net_driver.h
drivers/net/ethernet/sfc/siena.c
drivers/net/ethernet/sgi/ioc3-eth.c
drivers/net/ethernet/sis/sis900.c
drivers/net/ethernet/smsc/epic100.c
drivers/net/ethernet/smsc/smc91c92_cs.c
drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
drivers/net/ethernet/sun/cassini.c
drivers/net/ethernet/sun/sungem.c
drivers/net/ethernet/sun/sunhme.c
drivers/net/ethernet/ti/cpts.c
drivers/net/ethernet/tile/tilegx.c
drivers/net/ethernet/via/via-rhine.c
drivers/net/ethernet/xircom/xirc2ps_cs.c
drivers/net/fddi/skfp/hwmtm.c
drivers/net/fddi/skfp/pmf.c
drivers/net/fddi/skfp/skfddi.c
drivers/net/fddi/skfp/smt.c
drivers/net/hamradio/6pack.c
drivers/net/hamradio/baycom_epp.c
drivers/net/hamradio/baycom_par.c
drivers/net/hamradio/baycom_ser_fdx.c
drivers/net/hamradio/baycom_ser_hdx.c
drivers/net/hamradio/bpqether.c
drivers/net/hamradio/dmascc.c
drivers/net/hamradio/hdlcdrv.c
drivers/net/hamradio/mkiss.c
drivers/net/hamradio/scc.c
drivers/net/hamradio/yam.c
drivers/net/hippi/rrunner.c
drivers/net/ieee802154/at86rf230.c
drivers/net/ipvlan/ipvlan.h
drivers/net/ipvlan/ipvlan_core.c
drivers/net/ipvlan/ipvlan_main.c
drivers/net/irda/irtty-sir.c
drivers/net/irda/kingsun-sir.c
drivers/net/irda/ks959-sir.c
drivers/net/irda/ksdazzle-sir.c
drivers/net/irda/mcs7780.c
drivers/net/irda/vlsi_ir.c
drivers/net/loopback.c
drivers/net/phy/davicom.c
drivers/net/phy/icplus.c
drivers/net/phy/lxt.c
drivers/net/phy/qsemi.c
drivers/net/ppp/ppp_async.c
drivers/net/ppp/ppp_synctty.c
drivers/net/ppp/pppoe.c
drivers/net/ppp/pppox.c
drivers/net/sb1000.c
drivers/net/slip/slhc.c
drivers/net/slip/slip.c
drivers/net/tun.c
drivers/net/usb/asix_devices.c
drivers/net/usb/catc.c
drivers/net/usb/cdc_ncm.c
drivers/net/usb/kaweth.c
drivers/net/usb/pegasus.c
drivers/net/usb/rtl8150.c
drivers/net/virtio_net.c
drivers/net/vrf.c
drivers/net/wan/dlci.c
drivers/net/wan/dscc4.c
drivers/net/wan/farsync.c
drivers/net/wan/hd64570.c
drivers/net/wan/hd64572.c
drivers/net/wan/lapbether.c
drivers/net/wan/lmc/lmc_main.c
drivers/net/wan/lmc/lmc_media.c
drivers/net/wan/sbni.c
drivers/net/wan/sdla.c
drivers/net/wan/slic_ds26522.c
drivers/net/wireless/ath/ath10k/wmi.c
drivers/net/wireless/ath/ath9k/xmit.c
drivers/net/wireless/atmel/atmel.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
drivers/net/wireless/intel/ipw2x00/ipw2100.c
drivers/net/wireless/intel/ipw2x00/libipw_geo.c
drivers/net/wireless/intel/ipw2x00/libipw_module.c
drivers/net/wireless/intel/ipw2x00/libipw_rx.c
drivers/net/wireless/intel/ipw2x00/libipw_tx.c
drivers/net/wireless/intersil/hostap/hostap_hw.c
drivers/net/wireless/intersil/hostap/hostap_main.c
drivers/net/wireless/intersil/prism54/isl_38xx.c
drivers/net/wireless/intersil/prism54/isl_ioctl.c
drivers/net/wireless/ralink/rt2x00/rt2800usb.c
drivers/net/wireless/ray_cs.c
drivers/net/wireless/realtek/rtlwifi/core.c
drivers/net/wireless/wl3501_cs.c
drivers/ntb/hw/amd/ntb_hw_amd.c
drivers/ntb/hw/amd/ntb_hw_amd.h
drivers/ntb/hw/intel/ntb_hw_intel.c
drivers/ntb/hw/intel/ntb_hw_intel.h
drivers/ntb/ntb_transport.c
drivers/nubus/proc.c
drivers/nvme/host/core.c
drivers/nvme/host/fc.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/nvme/host/scsi.c
drivers/nvme/target/admin-cmd.c
drivers/nvme/target/fcloop.c
drivers/nvmem/core.c
drivers/nvmem/imx-ocotp.c
drivers/nvmem/qfprom.c
drivers/oprofile/event_buffer.c
drivers/oprofile/oprofilefs.c
drivers/parisc/ccio-dma.c
drivers/parisc/ccio-rm-dma.c
drivers/parisc/eisa_eeprom.c
drivers/parisc/eisa_enumerator.c
drivers/parisc/led.c
drivers/parisc/pdc_stable.c
drivers/parport/daisy.c
drivers/parport/ieee1284_ops.c
drivers/parport/parport_gsc.c
drivers/parport/probe.c
drivers/parport/procfs.c
drivers/pci/hotplug/acpiphp_ibm.c
drivers/pci/hotplug/cpqphp_core.c
drivers/pci/hotplug/cpqphp_nvram.c
drivers/pci/hotplug/pci_hotplug_core.c
drivers/pci/proc.c
drivers/pci/quirks.c
drivers/pci/syscall.c
drivers/perf/arm_pmu.c
drivers/pinctrl/meson/pinctrl-meson.c
drivers/pinctrl/pinctrl-amd.c
drivers/pinctrl/samsung/pinctrl-exynos.c
drivers/pinctrl/samsung/pinctrl-exynos.h
drivers/platform/x86/Kconfig
drivers/platform/x86/fujitsu-laptop.c
drivers/platform/x86/msi-wmi.c
drivers/platform/x86/sony-laptop.c
drivers/platform/x86/thinkpad_acpi.c
drivers/pnp/interface.c
drivers/pnp/pnpbios/proc.c
drivers/power/reset/ltc2952-poweroff.c
drivers/rtc/interface.c
drivers/s390/block/dasd_devmap.c
drivers/s390/block/dasd_eckd.c
drivers/s390/block/dasd_eer.c
drivers/s390/block/dasd_erp.c
drivers/s390/block/dasd_genhd.c
drivers/s390/block/dasd_ioctl.c
drivers/s390/block/dasd_proc.c
drivers/s390/block/xpram.c
drivers/s390/char/con3215.c
drivers/s390/char/keyboard.c
drivers/s390/char/monreader.c
drivers/s390/char/monwriter.c
drivers/s390/char/sclp_rw.c
drivers/s390/char/sclp_tty.c
drivers/s390/char/sclp_vt220.c
drivers/s390/char/tape_char.c
drivers/s390/char/tty3270.c
drivers/s390/char/vmcp.c
drivers/s390/char/vmlogrdr.c
drivers/s390/char/vmur.c
drivers/s390/char/zcore.c
drivers/s390/cio/blacklist.c
drivers/s390/crypto/ap_bus.c
drivers/s390/crypto/zcrypt_api.c
drivers/s390/crypto/zcrypt_cex2a.c
drivers/s390/crypto/zcrypt_pcixcc.c
drivers/s390/net/netiucv.c
drivers/s390/scsi/zfcp_dbf.c
drivers/s390/scsi/zfcp_dbf.h
drivers/s390/scsi/zfcp_erp.c
drivers/s390/scsi/zfcp_ext.h
drivers/s390/scsi/zfcp_fsf.h
drivers/s390/scsi/zfcp_reqlist.h
drivers/s390/scsi/zfcp_scsi.c
drivers/sbus/char/display7seg.c
drivers/sbus/char/envctrl.c
drivers/sbus/char/flash.c
drivers/sbus/char/jsflash.c
drivers/sbus/char/openprom.c
drivers/scsi/3w-9xxx.c
drivers/scsi/3w-9xxx.h
drivers/scsi/3w-sas.c
drivers/scsi/3w-sas.h
drivers/scsi/3w-xxxx.c
drivers/scsi/3w-xxxx.h
drivers/scsi/Kconfig
drivers/scsi/Makefile
drivers/scsi/NCR5380.c
drivers/scsi/NCR5380.h
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/commctrl.c
drivers/scsi/aacraid/linit.c
drivers/scsi/arcmsr/arcmsr_hba.c
drivers/scsi/bfa/bfad.c
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
drivers/scsi/bnx2i/bnx2i_init.c
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
drivers/scsi/cxgbi/libcxgbi.c
drivers/scsi/cxgbi/libcxgbi.h
drivers/scsi/dpt_i2o.c
drivers/scsi/g_NCR5380.c
drivers/scsi/g_NCR5380.h
drivers/scsi/gdth.c
drivers/scsi/hpsa.c
drivers/scsi/hptiop.c
drivers/scsi/ibmvscsi/ibmvscsi.c
drivers/scsi/ibmvscsi/ibmvscsi.h
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
drivers/scsi/ips.h
drivers/scsi/megaraid.c
drivers/scsi/megaraid/megaraid_mm.h
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/mpt3sas/mpt3sas_base.h
drivers/scsi/mpt3sas/mpt3sas_ctl.c
drivers/scsi/mpt3sas/mpt3sas_scsih.c
drivers/scsi/osst.c
drivers/scsi/qedi/Kconfig [new file with mode: 0644]
drivers/scsi/qedi/Makefile [new file with mode: 0644]
drivers/scsi/qedi/qedi.h [new file with mode: 0644]
drivers/scsi/qedi/qedi_dbg.c [new file with mode: 0644]
drivers/scsi/qedi/qedi_dbg.h [new file with mode: 0644]
drivers/scsi/qedi/qedi_debugfs.c [new file with mode: 0644]
drivers/scsi/qedi/qedi_fw.c [new file with mode: 0644]
drivers/scsi/qedi/qedi_gbl.h [new file with mode: 0644]
drivers/scsi/qedi/qedi_hsi.h [new file with mode: 0644]
drivers/scsi/qedi/qedi_iscsi.c [new file with mode: 0644]
drivers/scsi/qedi/qedi_iscsi.h [new file with mode: 0644]
drivers/scsi/qedi/qedi_main.c [new file with mode: 0644]
drivers/scsi/qedi/qedi_sysfs.c [new file with mode: 0644]
drivers/scsi/qedi/qedi_version.h [new file with mode: 0644]
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_inline.h
drivers/scsi/qla2xxx/qla_iocb.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/qla2xxx/qla_mid.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qla2xxx/qla_sup.c
drivers/scsi/scsi_debug.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/scsi_proc.c
drivers/scsi/scsi_sysfs.c
drivers/scsi/sd.c
drivers/scsi/sg.c
drivers/scsi/sr.c
drivers/scsi/sr_ioctl.c
drivers/scsi/st.c
drivers/scsi/ufs/ufs-qcom.c
drivers/scsi/ufs/ufs-qcom.h
drivers/scsi/ufs/ufs_quirks.h
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h
drivers/scsi/ufs/ufshci.h
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
drivers/staging/octeon/ethernet.c
drivers/tty/amiserial.c
drivers/tty/hvc/hvc_console.c
drivers/tty/hvc/hvcs.c
drivers/tty/hvc/hvsi.c
drivers/tty/moxa.c
drivers/tty/mxser.c
drivers/tty/n_hdlc.c
drivers/tty/n_r3964.c
drivers/tty/serial/icom.c
drivers/tty/serial/serial_core.c
drivers/tty/synclink.c
drivers/tty/synclink_gt.c
drivers/tty/synclinkmp.c
drivers/tty/tty_ioctl.c
drivers/tty/vt/consolemap.c
drivers/tty/vt/selection.c
drivers/tty/vt/vc_screen.c
drivers/tty/vt/vt_ioctl.c
drivers/usb/atm/usbatm.c
drivers/usb/chipidea/otg_fsm.c
drivers/usb/core/config.c
drivers/usb/core/hub.c
drivers/usb/dwc2/gadget.c
drivers/usb/dwc2/params.c
drivers/usb/dwc3/core.h
drivers/usb/dwc3/dwc3-omap.c
drivers/usb/dwc3/dwc3-pci.c
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c
drivers/usb/gadget/composite.c
drivers/usb/gadget/function/f_fs.c
drivers/usb/gadget/function/f_hid.c
drivers/usb/gadget/function/f_ncm.c
drivers/usb/gadget/legacy/inode.c
drivers/usb/gadget/udc/core.c
drivers/usb/gadget/udc/dummy_hcd.c
drivers/usb/host/ehci-timer.c
drivers/usb/host/fotg210-hcd.c
drivers/usb/host/ohci-at91.c
drivers/usb/host/uhci-hcd.c
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci-mtk.c
drivers/usb/host/xhci-pci.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.c
drivers/usb/host/xhci.h
drivers/usb/misc/ftdi-elan.c
drivers/usb/misc/idmouse.c
drivers/usb/misc/ldusb.c
drivers/usb/misc/legousbtower.c
drivers/usb/mon/mon_bin.c
drivers/usb/mon/mon_stat.c
drivers/usb/mon/mon_text.c
drivers/usb/musb/blackfin.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_core.h
drivers/usb/musb/musb_cppi41.c
drivers/usb/musb/musb_debugfs.c
drivers/usb/musb/musb_dsps.c
drivers/usb/musb/musb_host.c
drivers/usb/musb/musbhsdma.h
drivers/usb/serial/cyberjack.c
drivers/usb/serial/f81534.c
drivers/usb/serial/garmin_gps.c
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_ti.c
drivers/usb/serial/iuu_phoenix.c
drivers/usb/serial/keyspan_pda.c
drivers/usb/serial/kobil_sct.c
drivers/usb/serial/mos7720.c
drivers/usb/serial/mos7840.c
drivers/usb/serial/omninet.c
drivers/usb/serial/oti6858.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/quatech2.c
drivers/usb/serial/spcp8x5.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/storage/unusual_devs.h
drivers/vfio/mdev/mdev_core.c
drivers/vfio/mdev/mdev_private.h
drivers/vfio/mdev/mdev_sysfs.c
drivers/vfio/mdev/vfio_mdev.c
drivers/vfio/pci/vfio_pci.c
drivers/vfio/pci/vfio_pci_rdwr.c
drivers/vfio/vfio_iommu_type1.c
drivers/video/console/newport_con.c
drivers/video/fbdev/68328fb.c
drivers/video/fbdev/cobalt_lcdfb.c
drivers/video/fbdev/hitfb.c
drivers/video/fbdev/hpfb.c
drivers/video/fbdev/mx3fb.c
drivers/video/fbdev/q40fb.c
drivers/video/fbdev/sm501fb.c
drivers/video/fbdev/stifb.c
drivers/video/fbdev/w100fb.c
drivers/watchdog/Kconfig
drivers/watchdog/Makefile
drivers/watchdog/bcm2835_wdt.c
drivers/watchdog/bcm7038_wdt.c
drivers/watchdog/cpwd.c
drivers/watchdog/da9062_wdt.c
drivers/watchdog/davinci_wdt.c
drivers/watchdog/intel-mid_wdt.c
drivers/watchdog/it87_wdt.c
drivers/watchdog/jz4740_wdt.c
drivers/watchdog/loongson1_wdt.c [new file with mode: 0644]
drivers/watchdog/max77620_wdt.c
drivers/watchdog/mei_wdt.c
drivers/watchdog/meson_gxbb_wdt.c
drivers/watchdog/mpc8xxx_wdt.c
drivers/watchdog/octeon-wdt-main.c
drivers/watchdog/qcom-wdt.c
drivers/xen/arm-device.c
drivers/xen/events/events_fifo.c
drivers/xen/evtchn.c
drivers/xen/swiotlb-xen.c
drivers/xen/xenbus/xenbus_comms.h
drivers/xen/xenbus/xenbus_dev_frontend.c
drivers/zorro/proc.c
fs/9p/vfs_file.c
fs/afs/proc.c
fs/aio.c
fs/anon_inodes.c
fs/befs/befs.h
fs/befs/befs_fs_types.h
fs/befs/btree.c
fs/befs/btree.h
fs/befs/datastream.c
fs/befs/datastream.h
fs/befs/debug.c
fs/befs/inode.c
fs/befs/inode.h
fs/befs/io.c
fs/befs/io.h
fs/befs/linuxvfs.c
fs/befs/super.h
fs/bfs/inode.c
fs/binfmt_aout.c
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/block_dev.c
fs/buffer.c
fs/cifs/cifs_debug.c
fs/cifs/cifsencrypt.c
fs/cifs/cifsfs.c
fs/cifs/cifsglob.h
fs/cifs/cifsproto.h
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/dir.c
fs/cifs/file.c
fs/cifs/ioctl.c
fs/cifs/link.c
fs/cifs/smb2file.c
fs/cifs/smb2pdu.c
fs/cifs/smb2pdu.h
fs/cifs/smb2proto.h
fs/cifs/smbencrypt.c
fs/cifs/transport.c
fs/compat.c
fs/compat_ioctl.c
fs/configfs/file.c
fs/coredump.c
fs/crypto/keyinfo.c
fs/crypto/policy.c
fs/dax.c
fs/dcache.c
fs/dcookies.c
fs/dlm/dlm_internal.h
fs/dlm/lock.c
fs/efs/efs.h
fs/eventpoll.c
fs/exec.c
fs/ext2/inode.c
fs/ext2/ioctl.c
fs/ext2/super.c
fs/ext4/extents.c
fs/ext4/file.c
fs/ext4/ioctl.c
fs/ext4/super.c
fs/fcntl.c
fs/fhandle.c
fs/filesystems.c
fs/gfs2/file.c
fs/gfs2/glock.c
fs/gfs2/inode.c
fs/gfs2/sys.c
fs/gfs2/util.c
fs/gfs2/xattr.c
fs/hfs/hfs_fs.h
fs/hfsplus/ioctl.c
fs/hugetlbfs/inode.c
fs/jbd2/journal.c
fs/jfs/ioctl.c
fs/jfs/jfs_debug.c
fs/jfs/super.c
fs/libfs.c
fs/locks.c
fs/namei.c
fs/namespace.c
fs/ncpfs/dir.c
fs/ncpfs/file.c
fs/ncpfs/inode.c
fs/ncpfs/ioctl.c
fs/ncpfs/mmap.c
fs/ncpfs/ncplib_kernel.h
fs/ncpfs/sock.c
fs/ncpfs/symlink.c
fs/nfs/direct.c
fs/nfs/file.c
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/getroot.c
fs/nfs/inode.c
fs/nfs/super.c
fs/nfs/write.c
fs/nfsd/fault_inject.c
fs/nfsd/vfs.c
fs/notify/mark.c
fs/ntfs/file.c
fs/ocfs2/cluster/heartbeat.c
fs/ocfs2/cluster/masklog.c
fs/ocfs2/cluster/tcp.c
fs/ocfs2/dlmfs/dlmfs.c
fs/ocfs2/refcounttree.c
fs/ocfs2/stack_user.c
fs/open.c
fs/openpromfs/inode.c
fs/pipe.c
fs/pnode.c
fs/proc/base.c
fs/proc/generic.c
fs/proc/inode.c
fs/proc/kcore.c
fs/proc/kmsg.c
fs/proc/nommu.c
fs/proc/page.c
fs/proc/proc_net.c
fs/proc/proc_tty.c
fs/proc/root.c
fs/proc/task_mmu.c
fs/proc/vmcore.c
fs/ramfs/file-nommu.c
fs/ramfs/inode.c
fs/read_write.c
fs/readdir.c
fs/select.c
fs/seq_file.c
fs/stat.c
fs/timerfd.c
fs/ufs/inode.c
fs/ufs/super.c
fs/utimes.c
fs/xattr.c
fs/xfs/libxfs/xfs_ag_resv.c
fs/xfs/libxfs/xfs_refcount_btree.c
fs/xfs/libxfs/xfs_refcount_btree.h
fs/xfs/libxfs/xfs_rmap_btree.c
fs/xfs/libxfs/xfs_rmap_btree.h
fs/xfs/xfs_fsops.c
fs/xfs/xfs_icache.c
fs/xfs/xfs_ioctl32.c
fs/xfs/xfs_linux.h
fs/xfs/xfs_refcount_item.c
fs/xfs/xfs_reflink.c
fs/xfs/xfs_sysfs.c
include/asm-generic/asm-prototypes.h
include/asm-generic/termios-base.h
include/asm-generic/termios.h
include/drm/drmP.h
include/dt-bindings/mfd/tps65217.h [deleted file]
include/kvm/arm_arch_timer.h
include/linux/aio.h
include/linux/clocksource.h
include/linux/cpu.h
include/linux/cpuhotplug.h
include/linux/dax.h
include/linux/dw_apb_timer.h
include/linux/filter.h
include/linux/fsnotify_backend.h
include/linux/futex.h
include/linux/genhd.h
include/linux/hrtimer.h
include/linux/iio/common/st_sensors.h
include/linux/irqchip/mips-gic.h
include/linux/isdnif.h
include/linux/ktime.h
include/linux/mdev.h
include/linux/mlx4/device.h
include/linux/mlx5/device.h
include/linux/mlx5/driver.h
include/linux/mlx5/mlx5_ifc.h
include/linux/mm.h
include/linux/ntb.h
include/linux/page-flags.h
include/linux/pagemap.h
include/linux/poll.h
include/linux/radix-tree.h
include/linux/skbuff.h
include/linux/swiotlb.h
include/linux/tick.h
include/linux/timecounter.h
include/linux/timekeeper_internal.h
include/linux/timekeeping.h
include/linux/types.h
include/linux/wait.h
include/linux/writeback.h
include/net/checksum.h
include/net/netns/ipv4.h
include/net/red.h
include/net/sctp/sctp.h
include/net/sock.h
include/net/tcp.h
include/rdma/ib_addr.h
include/rdma/ib_verbs.h
include/trace/events/alarmtimer.h
include/trace/events/mmflags.h
include/trace/events/swiotlb.h
include/trace/events/timer.h
include/uapi/linux/usb/functionfs.h
init/init_task.c
init/main.c
kernel/audit_tree.c
kernel/capability.c
kernel/compat.c
kernel/configs.c
kernel/cpu.c
kernel/cpuset.c
kernel/events/uprobes.c
kernel/exit.c
kernel/extable.c
kernel/fork.c
kernel/futex.c
kernel/futex_compat.c
kernel/groups.c
kernel/kmod.c
kernel/kprobes.c
kernel/locking/lockdep_proc.c
kernel/module.c
kernel/power/snapshot.c
kernel/power/user.c
kernel/printk/printk.c
kernel/profile.c
kernel/sched/core.c
kernel/signal.c
kernel/sys.c
kernel/sys_ni.c
kernel/sysctl.c
kernel/time/alarmtimer.c
kernel/time/clockevents.c
kernel/time/clocksource.c
kernel/time/hrtimer.c
kernel/time/itimer.c
kernel/time/jiffies.c
kernel/time/ntp.c
kernel/time/posix-cpu-timers.c
kernel/time/posix-timers.c
kernel/time/tick-broadcast-hrtimer.c
kernel/time/tick-broadcast.c
kernel/time/tick-common.c
kernel/time/tick-oneshot.c
kernel/time/tick-sched.c
kernel/time/time.c
kernel/time/timecounter.c
kernel/time/timekeeping.c
kernel/time/timekeeping_internal.h
kernel/time/timer.c
kernel/time/timer_list.c
kernel/time/timer_stats.c
kernel/trace/ftrace.c
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_irqsoff.c
kernel/trace/trace_sched_wakeup.c
kernel/uid16.c
lib/Kconfig.debug
lib/Makefile
lib/cpu-notifier-error-inject.c [deleted file]
lib/extable.c
lib/iov_iter.c
lib/kstrtox.c
lib/radix-tree.c
lib/swiotlb.c
lib/timerqueue.c
mm/filemap.c
mm/internal.h
mm/memcontrol.c
mm/memory-failure.c
mm/memory.c
mm/mempolicy.c
mm/migrate.c
mm/mincore.c
mm/mmap.c
mm/mprotect.c
mm/nommu.c
mm/shmem.c
mm/swap.c
mm/truncate.c
mm/util.c
mm/vmalloc.c
mm/workingset.c
net/802/fc.c
net/802/hippi.c
net/8021q/vlan.c
net/atm/lec.c
net/ax25/af_ax25.c
net/ax25/ax25_addr.c
net/ax25/ax25_dev.c
net/ax25/ax25_ds_in.c
net/ax25/ax25_ds_subr.c
net/ax25/ax25_ds_timer.c
net/ax25/ax25_iface.c
net/ax25/ax25_in.c
net/ax25/ax25_ip.c
net/ax25/ax25_out.c
net/ax25/ax25_route.c
net/ax25/ax25_std_in.c
net/ax25/ax25_std_subr.c
net/ax25/ax25_std_timer.c
net/ax25/ax25_subr.c
net/ax25/ax25_timer.c
net/ax25/ax25_uid.c
net/bridge/br_device.c
net/bridge/br_ioctl.c
net/bridge/br_netfilter_hooks.c
net/bridge/br_netfilter_ipv6.c
net/bridge/netfilter/ebtables.c
net/can/bcm.c
net/can/gw.c
net/compat.c
net/core/datagram.c
net/core/dev.c
net/core/drop_monitor.c
net/core/filter.c
net/core/flow_dissector.c
net/core/gen_estimator.c
net/core/neighbour.c
net/core/rtnetlink.c
net/core/scm.c
net/core/skbuff.c
net/core/sock.c
net/core/utils.c
net/decnet/dn_dev.c
net/decnet/dn_fib.c
net/decnet/dn_table.c
net/decnet/sysctl_net_decnet.c
net/ipv4/af_inet.c
net/ipv4/devinet.c
net/ipv4/fib_frontend.c
net/ipv4/fib_semantics.c
net/ipv4/fib_trie.c
net/ipv4/icmp.c
net/ipv4/igmp.c
net/ipv4/ip_gre.c
net/ipv4/ip_options.c
net/ipv4/ip_output.c
net/ipv4/ip_sockglue.c
net/ipv4/ipconfig.c
net/ipv4/ipip.c
net/ipv4/ipmr.c
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv4/raw.c
net/ipv4/route.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_output.c
net/ipv4/udp.c
net/ipv6/af_inet6.c
net/ipv6/datagram.c
net/ipv6/exthdrs.c
net/ipv6/icmp.c
net/ipv6/ip6_flowlabel.c
net/ipv6/ip6_output.c
net/ipv6/ip6_tunnel.c
net/ipv6/ip6mr.c
net/ipv6/ipv6_sockglue.c
net/ipv6/mip6.c
net/ipv6/netfilter/ip6_tables.c
net/ipv6/raw.c
net/ipv6/route.c
net/ipv6/sit.c
net/ipv6/udp.c
net/ipx/af_ipx.c
net/irda/af_irda.c
net/irda/ircomm/ircomm_tty.c
net/irda/ircomm/ircomm_tty_ioctl.c
net/irda/irda_device.c
net/irda/irnet/irnet.h
net/l2tp/l2tp_ip.c
net/l2tp/l2tp_ip6.c
net/lapb/lapb_iface.c
net/lapb/lapb_in.c
net/lapb/lapb_out.c
net/lapb/lapb_subr.c
net/lapb/lapb_timer.c
net/mac80211/tx.c
net/mac802154/util.c
net/netfilter/ipvs/ip_vs_ctl.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nfnetlink.c
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c
net/netfilter/xt_time.c
net/netlink/af_netlink.c
net/openvswitch/datapath.c
net/openvswitch/flow.c
net/packet/af_packet.c
net/rose/af_rose.c
net/rose/rose_route.c
net/sched/act_tunnel_key.c
net/sched/cls_api.c
net/sched/cls_flower.c
net/sched/sch_cbq.c
net/sched/sch_netem.c
net/sctp/associola.c
net/sctp/ipv6.c
net/sctp/transport.c
net/socket.c
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/cache.c
net/sunrpc/svcsock.c
net/sunrpc/sysctl.c
net/tipc/socket.c
net/unix/af_unix.c
net/x25/af_x25.c
net/x25/x25_link.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
samples/Kconfig
samples/Makefile
samples/bpf/Makefile
samples/bpf/README.rst
samples/bpf/bpf_load.c
samples/bpf/bpf_load.h
samples/bpf/fds_example.c
samples/bpf/lathist_user.c
samples/bpf/libbpf.c [deleted file]
samples/bpf/libbpf.h
samples/bpf/lwt_len_hist_user.c
samples/bpf/offwaketime_user.c
samples/bpf/sampleip_user.c
samples/bpf/sock_example.c
samples/bpf/sock_example.h [new file with mode: 0644]
samples/bpf/sockex1_user.c
samples/bpf/sockex2_user.c
samples/bpf/sockex3_user.c
samples/bpf/spintest_user.c
samples/bpf/tc_l2_redirect_user.c
samples/bpf/test_cgrp2_array_pin.c
samples/bpf/test_cgrp2_attach.c
samples/bpf/test_cgrp2_attach2.c
samples/bpf/test_cgrp2_sock.c
samples/bpf/test_current_task_under_cgroup_user.c
samples/bpf/test_lru_dist.c
samples/bpf/test_probe_write_user_user.c
samples/bpf/trace_event_user.c
samples/bpf/trace_output_user.c
samples/bpf/tracex2_user.c
samples/bpf/tracex3_user.c
samples/bpf/tracex4_user.c
samples/bpf/tracex6_user.c
samples/bpf/xdp1_user.c
samples/bpf/xdp_tx_iptunnel_user.c
samples/vfio-mdev/Makefile
samples/vfio-mdev/mtty.c
scripts/gcc-plugins/gcc-common.h
scripts/gcc-plugins/latent_entropy_plugin.c
security/keys/keyctl.c
security/keys/process_keys.c
security/keys/request_key_auth.c
security/keys/user_defined.c
sound/core/hrtimer.c
sound/drivers/pcsp/pcsp_lib.c
sound/firewire/fireworks/fireworks_stream.c
sound/firewire/lib.c
sound/firewire/tascam/tascam-stream.c
sound/hda/hdac_stream.c
sound/oss/dmasound/dmasound_atari.c
sound/oss/dmasound/dmasound_core.c
sound/oss/dmasound/dmasound_paula.c
sound/oss/dmasound/dmasound_q40.c
sound/oss/msnd.c
sound/oss/os.h
sound/oss/swarm_cs4297a.c
sound/pci/hda/patch_realtek.c
sound/sh/sh_dac_audio.c
sound/usb/endpoint.c
sound/usb/endpoint.h
sound/usb/pcm.c
tools/include/uapi/linux/bpf.h
tools/lib/bpf/bpf.c
tools/lib/bpf/bpf.h
tools/lib/bpf/libbpf.c
tools/perf/Documentation/perf-sched.txt
tools/perf/Makefile.perf
tools/perf/bench/futex-lock-pi.c
tools/perf/builtin-c2c.c
tools/perf/builtin-mem.c
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/builtin-sched.c
tools/perf/builtin-stat.c
tools/perf/check-headers.sh [new file with mode: 0755]
tools/perf/perf.h
tools/perf/tests/builtin-test.c
tools/perf/tests/tests.h
tools/perf/tests/thread-map.c
tools/perf/trace/beauty/mmap.c
tools/perf/ui/browsers/annotate.c
tools/perf/util/annotate.c
tools/perf/util/annotate.h
tools/perf/util/evsel.c
tools/perf/util/evsel.h
tools/perf/util/symbol.c
tools/perf/util/thread_map.c
tools/perf/util/thread_map.h
tools/power/x86/turbostat/Makefile
tools/power/x86/turbostat/turbostat.8
tools/power/x86/turbostat/turbostat.c
usr/Makefile
virt/kvm/arm/arch_timer.c
virt/kvm/arm/vgic/vgic-init.c
virt/kvm/kvm_main.c

index c75e5d6b8fa8d48b787eed2a0f926bc36fe0a930..a6eb7dcd4dd5c010fe76ac285769d9e0c5157adc 100644 (file)
@@ -12,7 +12,7 @@ DOCBOOKS := z8530book.xml  \
            kernel-api.xml filesystems.xml lsm.xml kgdb.xml \
            gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
            genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
-           80211.xml sh.xml regulator.xml w1.xml \
+           sh.xml regulator.xml w1.xml \
            writing_musb_glue_layer.xml iio.xml
 
 ifeq ($(DOCBOOKS),)
index 21e2d88637050b7a33f141e558fff43d3f23d0c9..be7c0d9506b12072219f0396ceb9072eeea03df8 100644 (file)
                        use by PCI
                        Format: <irq>,<irq>...
 
+       acpi_mask_gpe=  [HW,ACPI]
+                       Due to the existence of _Lxx/_Exx, some GPEs triggered
+                       by unsupported hardware/firmware features can result in
+                        GPE floodings that cannot be automatically disabled by
+                        the GPE dispatcher.
+                       This facility can be used to prevent such uncontrolled
+                       GPE floodings.
+                       Format: <int>
+                       Support masking of GPEs numbered from 0x00 to 0x7f.
+
        acpi_no_auto_serialize  [HW,ACPI]
                        Disable auto-serialization of AML methods
                        AML control methods that contain the opcodes to create
                        it if 0 is given (See Documentation/cgroup-v1/memory.txt)
 
        swiotlb=        [ARM,IA-64,PPC,MIPS,X86]
-                       Format: { <int> | force }
+                       Format: { <int> | force | noforce }
                        <int> -- Number of I/O TLB slabs
                        force -- force using of bounce buffers even if they
                                 wouldn't be automatically used by the kernel
+                       noforce -- Never use bounce buffers (for debugging)
 
        switches=       [HW,M68k]
 
index 51642159aedbbc405d1bb90fa89402c2143f8310..c0a3bb5a6e4eb291d077f10633001c439563ccc2 100644 (file)
@@ -54,9 +54,9 @@ This is the hardware sector size of the device, in bytes.
 
 io_poll (RW)
 ------------
-When read, this file shows the total number of block IO polls and how
-many returned success.  Writing '0' to this file will disable polling
-for this device.  Writing any non-zero value will enable this feature.
+When read, this file shows whether polling is enabled (1) or disabled
+(0).  Writing '0' to this file will disable polling for this device.
+Writing any non-zero value will enable this feature.
 
 io_poll_delay (RW)
 ------------------
index 3e5b9793341f4e10679f792c8e19e9fbb55027e1..8682ab6d4a50f86d0d352f6b5b4e8a337c5511c4 100644 (file)
@@ -8,8 +8,9 @@ This driver provides a simple power button event via an Interrupt.
 Required properties:
 - compatible: should be "ti,tps65217-pwrbutton" or "ti,tps65218-pwrbutton"
 
-Required properties for TPS65218:
+Required properties:
 - interrupts: should be one of the following
+   - <2>: For controllers compatible with tps65217
    - <3 IRQ_TYPE_EDGE_BOTH>: For controllers compatible with tps65218
 
 Examples:
@@ -17,6 +18,7 @@ Examples:
 &tps {
        tps65217-pwrbutton {
                compatible = "ti,tps65217-pwrbutton";
+               interrupts = <2>;
        };
 };
 
index 98d131acee95dbff1631e63a5c01db39c2b3def1..a11072c5a8660d362958995a6fd27123c296b2fa 100644 (file)
@@ -2,11 +2,16 @@ TPS65217 Charger
 
 Required Properties:
 -compatible: "ti,tps65217-charger"
+-interrupts: TPS65217 interrupt numbers for the AC and USB charger input change.
+             Should be <0> for the USB charger and <1> for the AC adapter.
+-interrupt-names: Should be "USB" and "AC"
 
 This node is a subnode of the tps65217 PMIC.
 
 Example:
 
        tps65217-charger {
-               compatible = "ti,tps65090-charger";
+               compatible = "ti,tps65217-charger";
+               interrupts = <0>, <1>;
+               interrupt-names = "USB", "AC";
        };
index 0bb0b5fc951236f28c79d85a17f32e19710155da..6d9ff316b608db48b46de6413d9503e23b51536a 100644 (file)
@@ -55,21 +55,6 @@ Device Drivers DMA Management
 .. kernel-doc:: drivers/base/dma-mapping.c
    :export:
 
-Device Drivers Power Management
--------------------------------
-
-.. kernel-doc:: drivers/base/power/main.c
-   :export:
-
-Device Drivers ACPI Support
----------------------------
-
-.. kernel-doc:: drivers/acpi/scan.c
-   :export:
-
-.. kernel-doc:: drivers/acpi/scan.c
-   :internal:
-
 Device drivers PnP support
 --------------------------
 
index b9b675539b9df20ed3a754a01a4f5819d12bf7bb..6ca98f9911bbb31693ff342039d5c84772e37d91 100644 (file)
@@ -7,7 +7,7 @@
     |         arch |status|
     -----------------------
     |       alpha: | TODO |
-    |         arc: | TODO |
+    |         arc: |  ok  |
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |       avr32: | TODO |
index 9ed15f86c17c86ffa69fa3527e932b62f4b9ee20..15d8d16934fd13727bb35e9c5078484127bbfa30 100644 (file)
@@ -5,8 +5,8 @@ platform_labels - INTEGER
        possible to configure forwarding for label values equal to or
        greater than the number of platform labels.
 
-       A dense utliziation of the entries in the platform label table
-       is possible and expected aas the platform labels are locally
+       A dense utilization of the entries in the platform label table
+       is possible and expected as the platform labels are locally
        allocated.
 
        If the number of platform label table entries is set to 0 no
index e2c187947e588d6146c464852e07735966f95145..37b1967a00a9f48e1d6cc870747ce3ae0ead07d6 100644 (file)
@@ -6,17 +6,15 @@ NCR53c400 extensions (c) 1994,1995,1996 Kevin Lentin
 This file documents the NCR53c400 extensions by Kevin Lentin and some
 enhancements to the NCR5380 core.
 
-This driver supports both NCR5380 and NCR53c400 cards in port or memory
-mapped modes. Currently this driver can only support one of those mapping
-modes at a time but it does support both of these chips at the same time.
-The next release of this driver will support port & memory mapped cards at
-the same time. It should be able to handle multiple different cards in the
-same machine.
+This driver supports NCR5380 and NCR53c400 and compatible cards in port or
+memory mapped modes.
 
-The drivers/scsi/Makefile has an override in it for the most common
-NCR53c400 card, the Trantor T130B in its default configuration:
-       Port: 0x350
-       IRQ : 5
+Use of an interrupt is recommended, if supported by the board, as this will
+allow targets to disconnect and thereby improve SCSI bus utilization.
+
+If the irq parameter is 254 or is omitted entirely, the driver will probe
+for the correct IRQ line automatically. If the irq parameter is 0 or 255
+then no IRQ will be used.
 
 The NCR53c400 does not support DMA but it does have Pseudo-DMA which is
 supported by the driver.
@@ -47,22 +45,24 @@ These old-style parameters can support only one card:
   dtc_3181e=1  to set up for a Domex Technology Corp 3181E board
   hp_c2502=1   to set up for a Hewlett Packard C2502 board
 
-e.g.
-OLD: modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_5380=1
-NEW: modprobe g_NCR5380 irq=5 base=0x350 card=0
-  for a port mapped NCR5380 board or
-
-OLD: modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1
-NEW: modprobe g_NCR5380 irq=255 base=0xc8000 card=1
-  for a memory mapped NCR53C400 board with interrupts disabled or
+E.g. Trantor T130B in its default configuration:
+modprobe g_NCR5380 irq=5 base=0x350 card=1
+or alternatively, using the old syntax,
+modprobe g_NCR5380 ncr_irq=5 ncr_addr=0x350 ncr_53c400=1
 
-NEW: modprobe g_NCR5380 irq=0,7 base=0x240,0x300 card=3,4
-  for two cards: DTC3181 (in non-PnP mode) at 0x240 with no IRQ
-             and HP C2502 at 0x300 with IRQ 7
+E.g. a port mapped NCR5380 board, driver to probe for IRQ:
+modprobe g_NCR5380 base=0x350 card=0
+or alternatively,
+modprobe g_NCR5380 ncr_addr=0x350 ncr_5380=1
 
-(255 should be specified for no or DMA interrupt, 254 to autoprobe for an 
-     IRQ line if overridden on the command line.)
+E.g. a memory mapped NCR53C400 board with no IRQ:
+modprobe g_NCR5380 irq=255 base=0xc8000 card=1
+or alternatively,
+modprobe g_NCR5380 ncr_irq=255 ncr_addr=0xc8000 ncr_53c400=1
 
+E.g. two cards, DTC3181 (in non-PnP mode) at 0x240 with no IRQ
+and HP C2502 at 0x300 with IRQ 7:
+modprobe g_NCR5380 irq=0,7 base=0x240,0x300 card=3,4
 
 Kevin Lentin
 K.Lentin@cs.monash.edu.au
index a445da098bc6e5aa733cd55ca2ee8b4a5f04dc2c..3f76c0c379206a72519e864fb5486abf1a75ac0f 100644 (file)
@@ -151,7 +151,7 @@ bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
 #else
        const u16 *a = (const u16 *)addr1;
        const u16 *b = (const u16 *)addr2;
-       return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
+       return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) == 0;
 #endif
 }
 
index b38afec35edc2b1ea3f49cce804b0d67667b0c97..d226c7a5ba8bee46aeded6bfd181b840259fd4bb 100644 (file)
@@ -127,22 +127,22 @@ the VFIO when devices are unbound from the driver.
 Physical Device Driver Interface
 --------------------------------
 
-The physical device driver interface provides the parent_ops[3] structure to
-define the APIs to manage work in the mediated core driver that is related to
-the physical device.
+The physical device driver interface provides the mdev_parent_ops[3] structure
+to define the APIs to manage work in the mediated core driver that is related
+to the physical device.
 
-The structures in the parent_ops structure are as follows:
+The structures in the mdev_parent_ops structure are as follows:
 
 * dev_attr_groups: attributes of the parent device
 * mdev_attr_groups: attributes of the mediated device
 * supported_config: attributes to define supported configurations
 
-The functions in the parent_ops structure are as follows:
+The functions in the mdev_parent_ops structure are as follows:
 
 * create: allocate basic resources in a driver for a mediated device
 * remove: free resources in a driver when a mediated device is destroyed
 
-The callbacks in the parent_ops structure are as follows:
+The callbacks in the mdev_parent_ops structure are as follows:
 
 * open: open callback of mediated device
 * close: close callback of mediated device
@@ -151,14 +151,14 @@ The callbacks in the parent_ops structure are as follows:
 * write: write emulation callback
 * mmap: mmap emulation callback
 
-A driver should use the parent_ops structure in the function call to register
-itself with the mdev core driver:
+A driver should use the mdev_parent_ops structure in the function call to
+register itself with the mdev core driver:
 
 extern int  mdev_register_device(struct device *dev,
-                                 const struct parent_ops *ops);
+                                 const struct mdev_parent_ops *ops);
 
-However, the parent_ops structure is not required in the function call that a
-driver should use to unregister itself with the mdev core driver:
+However, the mdev_parent_ops structure is not required in the function call
+that a driver should use to unregister itself with the mdev core driver:
 
 extern void mdev_unregister_device(struct device *dev);
 
@@ -223,6 +223,9 @@ Directories and files under the sysfs for Each Physical Device
 
        sprintf(buf, "%s-%s", dev_driver_string(parent->dev), group->name);
 
+  (or using mdev_parent_dev(mdev) to arrive at the parent device outside
+   of the core mdev code)
+
 * device_api
 
   This attribute should show which device API is being created, for example,
@@ -394,5 +397,5 @@ References
 
 [1] See Documentation/vfio.txt for more information on VFIO.
 [2] struct mdev_driver in include/linux/mdev.h
-[3] struct parent_ops in include/linux/mdev.h
+[3] struct mdev_parent_ops in include/linux/mdev.h
 [4] struct vfio_iommu_driver_ops in include/linux/vfio.h
index 06afac252f5b5c0877746c2ac406b6aa84af8f8e..f3e9d7e9ed6cbcbe4e731881ffb5203925b758db 100644 (file)
@@ -63,6 +63,15 @@ The topology of a system is described in the units of:
     The maximum possible number of packages in the system. Helpful for per
     package facilities to preallocate per package information.
 
+  - cpu_llc_id:
+
+    A per-CPU variable containing:
+    - On Intel, the first APIC ID of the list of CPUs sharing the Last Level
+    Cache
+
+    - On AMD, the Node ID or Core Complex ID containing the Last Level
+    Cache. In general, it is a number identifying an LLC uniquely on the
+    system.
 
 * Cores:
 
index cb4611867a88787dd7d18e1dc96698177b4a692a..35c9cbfe4f2d503318bdde8df45d2269648d965c 100644 (file)
@@ -143,7 +143,7 @@ S:  Maintained
 F:     drivers/net/ethernet/3com/typhoon*
 
 3WARE SAS/SATA-RAID SCSI DRIVERS (3W-XXXX, 3W-9XXX, 3W-SAS)
-M:     Adam Radford <linuxraid@lsi.com>
+M:     Adam Radford <aradford@gmail.com>
 L:     linux-scsi@vger.kernel.org
 W:     http://www.lsi.com
 S:     Supported
@@ -3800,6 +3800,7 @@ F:        include/linux/devcoredump.h
 DEVICE FREQUENCY (DEVFREQ)
 M:     MyungJoo Ham <myungjoo.ham@samsung.com>
 M:     Kyungmin Park <kyungmin.park@samsung.com>
+R:     Chanwoo Choi <cw00.choi@samsung.com>
 L:     linux-pm@vger.kernel.org
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq.git
 S:     Maintained
@@ -5080,9 +5081,11 @@ F:       drivers/net/wan/dlci.c
 F:     drivers/net/wan/sdla.c
 
 FRAMEBUFFER LAYER
+M:     Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
 L:     linux-fbdev@vger.kernel.org
+T:     git git://github.com/bzolnier/linux.git
 Q:     http://patchwork.kernel.org/project/linux-fbdev/list/
-S:     Orphan
+S:     Maintained
 F:     Documentation/fb/
 F:     drivers/video/
 F:     include/video/
@@ -5504,6 +5507,7 @@ M:        Alex Elder <elder@kernel.org>
 M:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 S:     Maintained
 F:     drivers/staging/greybus/
+L:     greybus-dev@lists.linaro.org
 
 GREYBUS AUDIO PROTOCOLS DRIVERS
 M:     Vaibhav Agarwal <vaibhav.sr@gmail.com>
@@ -5735,7 +5739,7 @@ S:        Maintained
 F:     drivers/media/dvb-frontends/hd29l2*
 
 HEWLETT PACKARD ENTERPRISE ILO NMI WATCHDOG DRIVER
-M:     Brian Boylston <brian.boylston@hpe.com>
+M:     Jimmy Vance <jimmy.vance@hpe.com>
 S:     Supported
 F:     Documentation/watchdog/hpwdt.txt
 F:     drivers/watchdog/hpwdt.c
@@ -5961,6 +5965,7 @@ F:        drivers/media/platform/sti/hva
 Hyper-V CORE AND DRIVERS
 M:     "K. Y. Srinivasan" <kys@microsoft.com>
 M:     Haiyang Zhang <haiyangz@microsoft.com>
+M:     Stephen Hemminger <sthemmin@microsoft.com>
 L:     devel@linuxdriverproject.org
 S:     Maintained
 F:     arch/x86/include/asm/mshyperv.h
@@ -8828,7 +8833,7 @@ T:        git git://github.com/jonmason/ntb.git
 F:     drivers/ntb/hw/intel/
 
 NTB AMD DRIVER
-M:     Xiangliang Yu <Xiangliang.Yu@amd.com>
+M:     Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
 L:     linux-ntb@googlegroups.com
 S:     Supported
 F:     drivers/ntb/hw/amd/
@@ -8852,17 +8857,22 @@ F:      drivers/video/fbdev/nvidia/
 NVM EXPRESS DRIVER
 M:     Keith Busch <keith.busch@intel.com>
 M:     Jens Axboe <axboe@fb.com>
+M:     Christoph Hellwig <hch@lst.de>
+M:     Sagi Grimberg <sagi@grimberg.me>
 L:     linux-nvme@lists.infradead.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
-W:     https://kernel.googlesource.com/pub/scm/linux/kernel/git/axboe/linux-block/
+T:     git://git.infradead.org/nvme.git
+W:     http://git.infradead.org/nvme.git
 S:     Supported
 F:     drivers/nvme/host/
 F:     include/linux/nvme.h
+F:     include/uapi/linux/nvme_ioctl.h
 
 NVM EXPRESS TARGET DRIVER
 M:     Christoph Hellwig <hch@lst.de>
 M:     Sagi Grimberg <sagi@grimberg.me>
 L:     linux-nvme@lists.infradead.org
+T:     git://git.infradead.org/nvme.git
+W:     http://git.infradead.org/nvme.git
 S:     Supported
 F:     drivers/nvme/target/
 
@@ -9842,7 +9852,7 @@ M:        Mark Rutland <mark.rutland@arm.com>
 M:     Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
 L:     linux-arm-kernel@lists.infradead.org
 S:     Maintained
-F:     drivers/firmware/psci.c
+F:     drivers/firmware/psci*.c
 F:     include/linux/psci.h
 F:     include/uapi/linux/psci.h
 
@@ -10136,6 +10146,12 @@ F:     drivers/net/ethernet/qlogic/qed/
 F:     include/linux/qed/
 F:     drivers/net/ethernet/qlogic/qede/
 
+QLOGIC QL41xxx ISCSI DRIVER
+M:     QLogic-Storage-Upstream@cavium.com
+L:     linux-scsi@vger.kernel.org
+S:     Supported
+F:     drivers/scsi/qedi/
+
 QNX4 FILESYSTEM
 M:     Anders Larsen <al@alarsen.net>
 W:     http://www.alarsen.net/linux/qnx4fs/
@@ -13521,11 +13537,11 @@ F:    arch/x86/xen/*swiotlb*
 F:     drivers/xen/*swiotlb*
 
 XFS FILESYSTEM
-M:     Dave Chinner <david@fromorbit.com>
+M:     Darrick J. Wong <darrick.wong@oracle.com>
 M:     linux-xfs@vger.kernel.org
 L:     linux-xfs@vger.kernel.org
 W:     http://xfs.org/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git
+T:     git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
 S:     Supported
 F:     Documentation/filesystems/xfs.txt
 F:     fs/xfs/
index b1037774e8e83c86fc93afbd705acf8591c6b4ec..5f1a84735ff61a18fddd4bbad964f8ac89ecc8e4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 4
-PATCHLEVEL = 9
+PATCHLEVEL = 10
 SUBLEVEL = 0
-EXTRAVERSION =
+EXTRAVERSION = -rc3
 NAME = Roaring Lionus
 
 # *DOCUMENTATION*
index 3ff9a957a25cdc8b89e3eda0656e54a5a3af79ec..1b568ed74f95576dcb9e9e43fca312c8cc2c74ff 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define memzero(s,n)   memset ((s),0,(n))
 #define puts           srm_printk
index 2d6efcff3bf35cf1c11ebf180d2912d4033059b7..2f26ae74b61aeab153d2ab3acecca495e45974a0 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/bitops.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 volatile unsigned long irq_err_count;
 DEFINE_PER_CPU(unsigned long, irq_pmi_count);
index 56e427c7aa3c03d4e1e0547c71ea201dcaaa2006..54d8616644e2dfd510846b30b52e2b7e21c1c888 100644 (file)
@@ -39,7 +39,7 @@
 
 #include <asm/fpu.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sysinfo.h>
 #include <asm/thread_info.h>
 #include <asm/hwrpb.h>
index b483156698d5043358ecc9a681fc77f197282d25..bca963a4aa4880ce285fd16a2f08c80975b3055c 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/rcupdate.h>
 
 #include <asm/reg.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/hwrpb.h>
index 04abdec7f49605ecee1b460162440b6cfdb3f554..bc4d2cdcf21d764bcf4ae46ffbf17281fa6fef10 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/tracehook.h>
 #include <linux/audit.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/fpu.h>
 
index 4811e54069fcfbb733185d4004e24efa814b9165..491e6a604e82ac468ffc1e2212080fd381f894c8 100644 (file)
@@ -53,7 +53,7 @@ static struct notifier_block alpha_panic_block = {
         INT_MAX /* try to do it first */
 };
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/hwrpb.h>
 #include <asm/dma.h>
index 8dbfb15f17450501a80f6b3439e16aeab3546158..17308f9253066a2352eceaac54340e5e8364edbc 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/syscalls.h>
 #include <linux/tracehook.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sigcontext.h>
 #include <asm/ucontext.h>
 
index ffe996a54fadb3db9e0ed8b10dd0f0f1deb6bea5..705ae12acd15350fd547c54b99d8ab0c6f8a02cc 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <asm/console.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/machvec.h>
 
 #define BASE_DIR       "srm_environment"       /* Subdir in /proc/             */
index 72b59511e59aa350cc58d568cf896edba4f53602..e9c45b65a9058672e217cbfcef50ff595b1c8e2c 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/tty_flip.h>
 
 #include <asm/console.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 static DEFINE_SPINLOCK(srmcons_callback_lock);
index 5b6202a825ff8c48f56f387ac947c6503225f821..3bfe058d75d996796ff8992962a1fcb2632b6311 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/profile.h>
 #include <linux/irq_work.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/hwrpb.h>
 
@@ -133,7 +133,7 @@ init_rtc_clockevent(void)
  * The QEMU clock as a clocksource primitive.
  */
 
-static cycle_t
+static u64
 qemu_cs_read(struct clocksource *cs)
 {
        return qemu_get_vmtime();
@@ -260,7 +260,7 @@ common_init_rtc(void)
  * use this method when WTINT is in use.
  */
 
-static cycle_t read_rpcc(struct clocksource *cs)
+static u64 read_rpcc(struct clocksource *cs)
 {
        return rpcc();
 }
index 74aceead06e98a391a1f0fc49f5486ef2562844c..3328af7c2776416d5182d61bdf332554d17b6cdc 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/ratelimit.h>
 
 #include <asm/gentrap.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 #include <asm/sysinfo.h>
 #include <asm/hwrpb.h>
index b4ff3b683bcd57802c8c422708c3c712098c4cc7..5dfb7975895fd3a8b2078f737ef75ad470a9d893 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <linux/types.h>
 #include <linux/string.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 #define ldq_u(x,y) \
index 58c2669a1dd4fa431f32ecbe8416c24a540525ba..fa5ae0ad8983b67c65fe27956324438dc1582fdb 100644 (file)
@@ -3,7 +3,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "sfp-util.h"
 #include <math-emu/soft-fp.h>
index a1bea91df56ab996b92f33b0cfcd6738e4d2c072..0542e973c73dcf483bc662e989ac0f58b8c7531c 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/vmalloc.h>
 #include <linux/gfp.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/hwrpb.h>
index ab12723d39a01d8751807728a43c7b08cdc6a814..c75d29077e4a654276219883629444deec89c955 100644 (file)
@@ -9,6 +9,7 @@
 config ARC
        def_bool y
        select ARC_TIMERS
+       select ARCH_HAS_SG_CHAIN
        select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
        select BUILDTIME_EXTABLE_SORT
        select CLONE_BACKWARDS
index da41a54ea2d747011b6c20dcc0b1738e2a2e8062..f659942744de0c474962b118292100eeed7397ce 100644 (file)
@@ -244,7 +244,7 @@ struct cpuinfo_arc_mmu {
 };
 
 struct cpuinfo_arc_cache {
-       unsigned int sz_k:14, line_len:8, assoc:4, ver:4, alias:1, vipt:1;
+       unsigned int sz_k:14, line_len:8, assoc:4, alias:1, vipt:1, pad:4;
 };
 
 struct cpuinfo_arc_bpu {
index a093adbdb017580f6da74abb551ea02e14e04da5..fc662f49c55ac91916af7cbd830b1c978f827ffe 100644 (file)
@@ -85,6 +85,10 @@ void flush_anon_page(struct vm_area_struct *vma,
  */
 #define PG_dc_clean    PG_arch_1
 
+#define CACHE_COLORS_NUM       4
+#define CACHE_COLORS_MSK       (CACHE_COLORS_NUM - 1)
+#define CACHE_COLOR(addr)      (((unsigned long)(addr) >> (PAGE_SHIFT)) & CACHE_COLORS_MSK)
+
 /*
  * Simple wrapper over config option
  * Bootup code ensures that hardware matches kernel configuration
@@ -94,8 +98,6 @@ static inline int cache_is_vipt_aliasing(void)
        return IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING);
 }
 
-#define CACHE_COLOR(addr)      (((unsigned long)(addr) >> (PAGE_SHIFT)) & 1)
-
 /*
  * checks if two addresses (after page aligning) index into same cache set
  */
index e880dfa3fcd370c0f7ae8f9010a79df9ab8c3399..a64c447b0337804568c69cf2e15998deabdd9b40 100644 (file)
 #define AUX_IRQ_ACT_BIT_U      31
 
 /*
- * User space should be interruptable even by lowest prio interrupt
- * Safe even if actual interrupt priorities is fewer or even one
+ * Hardware supports 16 priorities (0 highest, 15 lowest)
+ * Linux by default runs at 1, priority 0 reserved for NMI style interrupts
  */
-#define ARCV2_IRQ_DEF_PRIO     15
+#define ARCV2_IRQ_DEF_PRIO     1
 
 /* seed value for status register */
 #define ISA_INIT_STATUS_BITS   (STATUS_IE_MASK | STATUS_AD_MASK | \
index 7a1c124ff021d53377d24ff5d1bb9cccbb2831de..0b6388a5f0b828323c03b53f0903a35bdc25b0cb 100644 (file)
@@ -67,12 +67,23 @@ ENTRY(handle_interrupt)
 
        INTERRUPT_PROLOGUE  irq
 
-       clri            ; To make status32.IE agree with CPU internal state
-
-#ifdef CONFIG_TRACE_IRQFLAGS
-       TRACE_ASM_IRQ_DISABLE
-#endif
-
+       # irq control APIs local_irq_save/restore/disable/enable fiddle with
+       # global interrupt enable bits in STATUS32 (.IE for 1 prio, .E[] for 2 prio)
+       # However a taken interrupt doesn't clear these bits. Thus irqs_disabled()
+       # query in hard ISR path would return false (since .IE is set) which would
+       # trips genirq interrupt handling asserts.
+       #
+       # So do a "soft" disable of interrutps here.
+       #
+       # Note this disable is only for consistent book-keeping as further interrupts
+       # will be disabled anyways even w/o this. Hardware tracks active interrupts
+       # seperately in AUX_IRQ_ACTIVE.active and will not take new interrupts
+       # unless this one returns (or higher prio becomes pending in 2-prio scheme)
+
+       IRQ_DISABLE
+
+       ; icause is banked: one per priority level
+       ; so a higher prio interrupt taken here won't clobber prev prio icause
        lr  r0, [ICAUSE]
        mov   blink, ret_from_exception
 
@@ -171,6 +182,7 @@ END(EV_TLBProtV)
 ; All 2 entry points to here already disable interrupts
 
 .Lrestore_regs:
+restore_regs:
 
        # Interrpts are actually disabled from this point on, but will get
        # reenabled after we return from interrupt/exception.
index 98812c1248dfaf85b28ed023287ae78f27286073..9211707634dcf57e1aa0ac13fa4a6bbc79b99eeb 100644 (file)
@@ -259,7 +259,7 @@ ENTRY(EV_TLBProtV)
 
        EXCEPTION_PROLOGUE
 
-       lr  r2, [ecr]
+       mov r2, r9      ; ECR set into r9 already
        lr  r0, [efa]   ; Faulting Data address (not part of pt_regs saved above)
 
        ; Exception auto-disables further Intr/exceptions.
index 62b59409a5d97eb8b95276a3f17b1e430b98899b..994dca7014db645b32cfb22753cb25bae4c46566 100644 (file)
@@ -14,8 +14,6 @@
 #include <linux/irqchip.h>
 #include <asm/irq.h>
 
-static int irq_prio;
-
 /*
  * Early Hardware specific Interrupt setup
  * -Called very early (start_kernel -> setup_arch -> setup_processor)
@@ -24,7 +22,7 @@ static int irq_prio;
  */
 void arc_init_IRQ(void)
 {
-       unsigned int tmp;
+       unsigned int tmp, irq_prio;
 
        struct irq_build {
 #ifdef CONFIG_CPU_BIG_ENDIAN
@@ -67,12 +65,12 @@ void arc_init_IRQ(void)
 
        irq_prio = irq_bcr.prio;        /* Encoded as N-1 for N levels */
        pr_info("archs-intc\t: %d priority levels (default %d)%s\n",
-               irq_prio + 1, irq_prio,
+               irq_prio + 1, ARCV2_IRQ_DEF_PRIO,
                irq_bcr.firq ? " FIRQ (not used)":"");
 
        /* setup status32, don't enable intr yet as kernel doesn't want */
        tmp = read_aux_reg(0xa);
-       tmp |= STATUS_AD_MASK | (irq_prio << 1);
+       tmp |= STATUS_AD_MASK | (ARCV2_IRQ_DEF_PRIO << 1);
        tmp &= ~STATUS_IE_MASK;
        asm volatile("kflag %0  \n"::"r"(tmp));
 }
@@ -93,7 +91,7 @@ void arcv2_irq_enable(struct irq_data *data)
 {
        /* set default priority */
        write_aux_reg(AUX_IRQ_SELECT, data->irq);
-       write_aux_reg(AUX_IRQ_PRIORITY, irq_prio);
+       write_aux_reg(AUX_IRQ_PRIORITY, ARCV2_IRQ_DEF_PRIO);
 
        /*
         * hw auto enables (linux unmask) all by default
index 50d71695cd4ecbeefd64f28e9f44265195b01d15..ec86ac0e33213b889cd6100e10e95fda8f3c31e4 100644 (file)
@@ -40,7 +40,7 @@ char *arc_cache_mumbojumbo(int c, char *buf, int len)
        struct cpuinfo_arc_cache *p;
 
 #define PR_CACHE(p, cfg, str)                                          \
-       if (!(p)->ver)                                                  \
+       if (!(p)->line_len)                                             \
                n += scnprintf(buf + n, len - n, str"\t\t: N/A\n");     \
        else                                                            \
                n += scnprintf(buf + n, len - n,                        \
@@ -54,7 +54,7 @@ char *arc_cache_mumbojumbo(int c, char *buf, int len)
        PR_CACHE(&cpuinfo_arc700[c].dcache, CONFIG_ARC_HAS_DCACHE, "D-Cache");
 
        p = &cpuinfo_arc700[c].slc;
-       if (p->ver)
+       if (p->line_len)
                n += scnprintf(buf + n, len - n,
                               "SLC\t\t: %uK, %uB Line%s\n",
                               p->sz_k, p->line_len, IS_USED_RUN(slc_enable));
@@ -104,7 +104,6 @@ static void read_decode_cache_bcr_arcv2(int cpu)
        READ_BCR(ARC_REG_SLC_BCR, sbcr);
        if (sbcr.ver) {
                READ_BCR(ARC_REG_SLC_CFG, slc_cfg);
-               p_slc->ver = sbcr.ver;
                p_slc->sz_k = 128 << slc_cfg.sz;
                l2_line_sz = p_slc->line_len = (slc_cfg.lsz == 0) ? 128 : 64;
        }
@@ -152,7 +151,6 @@ void read_decode_cache_bcr(void)
 
        p_ic->line_len = 8 << ibcr.line_len;
        p_ic->sz_k = 1 << (ibcr.sz - 1);
-       p_ic->ver = ibcr.ver;
        p_ic->vipt = 1;
        p_ic->alias = p_ic->sz_k/p_ic->assoc/TO_KB(PAGE_SIZE) > 1;
 
@@ -176,7 +174,6 @@ dc_chk:
 
        p_dc->line_len = 16 << dbcr.line_len;
        p_dc->sz_k = 1 << (dbcr.sz - 1);
-       p_dc->ver = dbcr.ver;
 
 slc_chk:
        if (is_isa_arcv2())
@@ -945,17 +942,13 @@ void arc_cache_init(void)
        if (IS_ENABLED(CONFIG_ARC_HAS_ICACHE)) {
                struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache;
 
-               if (!ic->ver)
+               if (!ic->line_len)
                        panic("cache support enabled but non-existent cache\n");
 
                if (ic->line_len != L1_CACHE_BYTES)
                        panic("ICache line [%d] != kernel Config [%d]",
                              ic->line_len, L1_CACHE_BYTES);
 
-               if (ic->ver != CONFIG_ARC_MMU_VER)
-                       panic("Cache ver [%d] doesn't match MMU ver [%d]\n",
-                             ic->ver, CONFIG_ARC_MMU_VER);
-
                /*
                 * In MMU v4 (HS38x) the aliasing icache config uses IVIL/PTAG
                 * pair to provide vaddr/paddr respectively, just as in MMU v3
@@ -969,7 +962,7 @@ void arc_cache_init(void)
        if (IS_ENABLED(CONFIG_ARC_HAS_DCACHE)) {
                struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache;
 
-               if (!dc->ver)
+               if (!dc->line_len)
                        panic("cache support enabled but non-existent cache\n");
 
                if (dc->line_len != L1_CACHE_BYTES)
@@ -979,11 +972,16 @@ void arc_cache_init(void)
                /* check for D-Cache aliasing on ARCompact: ARCv2 has PIPT */
                if (is_isa_arcompact()) {
                        int handled = IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING);
-
-                       if (dc->alias && !handled)
-                               panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n");
-                       else if (!dc->alias && handled)
+                       int num_colors = dc->sz_k/dc->assoc/TO_KB(PAGE_SIZE);
+
+                       if (dc->alias) {
+                               if (!handled)
+                                       panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n");
+                               if (CACHE_COLORS_NUM != num_colors)
+                                       panic("CACHE_COLORS_NUM not optimized for config\n");
+                       } else if (!dc->alias && handled) {
                                panic("Disable CONFIG_ARC_CACHE_VIPT_ALIASING\n");
+                       }
                }
        }
 
index 5fab553fd03ade24fdc1a69a83e5092b791b8a01..186c4c214e0a756b4468b597d5680093408c28c3 100644 (file)
@@ -1502,8 +1502,7 @@ source kernel/Kconfig.preempt
 
 config HZ_FIXED
        int
-       default 200 if ARCH_EBSA110 || ARCH_S3C24XX || \
-               ARCH_S5PV210 || ARCH_EXYNOS4
+       default 200 if ARCH_EBSA110
        default 128 if SOC_AT91RM9200
        default 0
 
index cccdbcb557b6d29b2e45a0c0b9fb792a469cf1fe..7327250f0bb66e716dacd07d35019c858f38cf68 100644 (file)
@@ -501,6 +501,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += \
        am3517-evm.dtb \
        am3517_mt_ventoux.dtb \
        logicpd-torpedo-37xx-devkit.dtb \
+       logicpd-som-lv-37xx-devkit.dtb \
        omap3430-sdp.dtb \
        omap3-beagle.dtb \
        omap3-beagle-xm.dtb \
index dc561d505bbe2ce10054c7bc19452b0b4b76fc4f..3e32dd18fd25f5720ca5449ce494c0a3282d4fc4 100644 (file)
@@ -6,8 +6,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <dt-bindings/mfd/tps65217.h>
-
 / {
        cpus {
                cpu@0 {
        ti,pmic-shutdown-controller;
 
        charger {
-               interrupts = <TPS65217_IRQ_AC>, <TPS65217_IRQ_USB>;
-               interrupts-names = "AC", "USB";
+               interrupts = <0>, <1>;
+               interrupt-names = "USB", "AC";
                status = "okay";
        };
 
        pwrbutton {
-               interrupts = <TPS65217_IRQ_PB>;
+               interrupts = <2>;
                status = "okay";
        };
 
index 64c8aa9057a3366b746078a51e662f76a35e8f4b..18d72a245e889ac28561b34417680702fb0e10e1 100644 (file)
@@ -16,6 +16,7 @@
        interrupt-parent = <&intc>;
        #address-cells = <1>;
        #size-cells = <1>;
+       chosen { };
 
        aliases {
                i2c0 = &i2c0;
index ac55f93fc91e997deef1815adeb9d9dee9e2c555..2df9e6050c2f382fea2d09f6a95e634210d3a88f 100644 (file)
@@ -16,6 +16,7 @@
        interrupt-parent = <&wakeupgen>;
        #address-cells = <1>;
        #size-cells = <1>;
+       chosen { };
 
        memory@0 {
                device_type = "memory";
index d6e43e5184c1829483a3b5b0fb1cc99268a0d611..ad68d1eb3bc3d2a4feec75053323f4ed90d394e4 100644 (file)
                        linux,default-trigger = "mmc0";
                };
        };
-
-       extcon_usb2: extcon_usb2 {
-            compatible = "linux,extcon-usb-gpio";
-            id-gpio = <&gpio5 7 GPIO_ACTIVE_HIGH>;
-       };
 };
 
 &mmc1 {
@@ -79,3 +74,8 @@
 &omap_dwc3_2 {
        extcon = <&extcon_usb2>;
 };
+
+&extcon_usb2 {
+       id-gpio = <&gpio5 7 GPIO_ACTIVE_HIGH>;
+       vbus-gpio = <&gpio7 22 GPIO_ACTIVE_HIGH>;
+};
index 27d9149cedba78c81c7025a2404d3f80b14524f6..8350b4b34b085231663c9235b570e487827a5000 100644 (file)
                reg = <0x0 0x80000000 0x0 0x80000000>;
        };
 
-       extcon_usb2: extcon_usb2 {
-               compatible = "linux,extcon-usb-gpio";
-               id-gpio = <&gpio3 16 GPIO_ACTIVE_HIGH>;
-       };
-
        status-leds {
                compatible = "gpio-leds";
                cpu0-led {
        extcon = <&extcon_usb2>;
 };
 
+&extcon_usb2 {
+       id-gpio = <&gpio3 16 GPIO_ACTIVE_HIGH>;
+       vbus-gpio = <&gpio3 26 GPIO_ACTIVE_HIGH>;
+};
+
 &mmc1 {
        status = "okay";
        vmmc-supply = <&v3_3d>;
@@ -87,3 +87,7 @@
 &sn65hvs882 {
        load-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
 };
+
+&pcie1 {
+       gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>;
+};
index 555ae21f2b9adcf2ad811b5541a3f865997bb098..814a720d5c3db5a9d1a5c94719fdf89207c435e2 100644 (file)
                        gpio-controller;
                        #gpio-cells = <2>;
                };
+
+               extcon_usb2: tps659038_usb {
+                       compatible = "ti,palmas-usb-vid";
+                       ti,enable-vbus-detection;
+                       ti,enable-id-detection;
+                       /* ID & VBUS GPIOs provided in board dts */
+               };
        };
 };
 
 };
 
 &usb2 {
-       dr_mode = "otg";
+       dr_mode = "peripheral";
 };
 
 &mmc2 {
index 1facc5f12cef700acf90e0b2f2e8594096a9bf9a..81b8cecb58206d8c98d9d986a1995e67e17fe7ed 100644 (file)
@@ -12,6 +12,7 @@
        interrupt-parent = <&intc>;
        #address-cells = <1>;
        #size-cells = <1>;
+       chosen { };
 
        aliases {
                i2c0 = &i2c1;
index 61dd2f6b02bcfe47d7d6a5ddd5734de0e5687e89..6db652ae9bd558021ac99a6a8bcb954a5c94b806 100644 (file)
@@ -12,6 +12,7 @@
        interrupt-parent = <&intc>;
        #address-cells = <1>;
        #size-cells = <1>;
+       chosen { };
 
        aliases {
                i2c0 = &i2c1;
index addb7530cfbe0dcece696c2e84fbb5ea8896ceb2..1faf24acd521d3cc4ed22d24c8fe0ff469e9a30a 100644 (file)
@@ -18,6 +18,7 @@
 
        compatible = "ti,dra7xx";
        interrupt-parent = <&crossbar_mpu>;
+       chosen { };
 
        aliases {
                i2c0 = &i2c1;
index ee6dac44edf1ada06b65a48d213ec9d8d966119b..e6df676886c0c35052921669039ae31fd446ccbf 100644 (file)
                ti,palmas-long-press-seconds = <6>;
        };
 };
+
+&usb2_phy1 {
+       phy-supply = <&ldo4_reg>;
+};
+
+&usb2_phy2 {
+       phy-supply = <&ldo4_reg>;
+};
+
+&dss {
+       vdda_video-supply = <&ldo5_reg>;
+};
+
+&mmc1 {
+       vmmc_aux-supply = <&ldo1_reg>;
+};
index 685916e3d8a1eaefb083d2a7a81583c18a360168..85cd8be22f7155edae2d56ac5a99984427aa6131 100644 (file)
                };
        };
 
-       avic: avic-interrupt-controller@60000000 {
+       avic: interrupt-controller@68000000 {
                compatible = "fsl,imx31-avic", "fsl,avic";
                interrupt-controller;
                #interrupt-cells = <1>;
-               reg = <0x60000000 0x100000>;
+               reg = <0x68000000 0x100000>;
        };
 
        soc {
index e476d01959ea3f337eb966559c241b3ef82f7fba..26d0604847282879f2286ac9c7242a84b8ac271b 100644 (file)
                                MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17071
                                MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17071
                                MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17071
-                               MX6QDL_PAD_NANDF_CS2__GPIO6_IO15        0x000b0
                        >;
                };
 
index 53e6e63cbb0235d634f108f12ad1fd75001817dd..89b834f3fa17f6b576e31fd61e8bfad205f73923 100644 (file)
                                interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6QDL_CLK_EIM_SLOW>;
                                fsl,weim-cs-gpr = <&gpr>;
+                               status = "disabled";
                        };
 
                        ocotp: ocotp@021bc000 {
index 4fd6de29f07db21ba1c4552b8d4e37c59858699f..19cbd879c448984717a83e1d819efdec822c4957 100644 (file)
                                reg = <0x021b8000 0x4000>;
                                interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
                                fsl,weim-cs-gpr = <&gpr>;
+                               status = "disabled";
                        };
 
                        ocotp: ocotp@021bc000 {
index 076a30f9bcae26d8e62b119ee92fd71d1944e922..10f33301619777a9d676eb49bae893540d920973 100644 (file)
                                interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SX_CLK_EIM_SLOW>;
                                fsl,weim-cs-gpr = <&gpr>;
+                               status = "disabled";
                        };
 
                        ocotp: ocotp@021bc000 {
index 4f793a025a721b03f3a5e1f074c4c531033cf62f..f1d6de8b3c193eee0d88b0465f33de4e122ba266 100644 (file)
@@ -17,6 +17,7 @@
        interrupt-parent = <&intc>;
        #address-cells = <1>;
        #size-cells = <1>;
+       chosen { };
 
        aliases {
                serial0 = &uart1;
index 87ca50b53002b9cf244b9dca24a0f2fbdca3dabc..4d448f145ed1c2941bda6d76e91d7573c0a37568 100644 (file)
        vmmc_aux-supply = <&vsim>;
        bus-width = <8>;
        non-removable;
+       no-sdio;
+       no-sd;
 };
 
 &mmc3 {
index ecf5eb584c75058598b9c90bc3f3568bf3a7ce7e..a3ff4933dbc173936bbec5a222aba6642e70564d 100644 (file)
@@ -17,6 +17,7 @@
        interrupt-parent = <&intc>;
        #address-cells = <1>;
        #size-cells = <1>;
+       chosen { };
 
        aliases {
                i2c0 = &i2c1;
index 8087456b5fbec60c9379e5937b299ce820a7cb03..578c53f08309090069454261e09bb0f1617e4a98 100644 (file)
@@ -15,6 +15,7 @@
        interrupt-parent = <&wakeupgen>;
        #address-cells = <1>;
        #size-cells = <1>;
+       chosen { };
 
        aliases {
                i2c0 = &i2c1;
index 968c67a49dbd158b3b3ca24ad2bd85b6f45687d6..7cd92babc41a688cf8bb474972d053ea7b8b33d6 100644 (file)
@@ -17,6 +17,7 @@
 
        compatible = "ti,omap5";
        interrupt-parent = <&wakeupgen>;
+       chosen { };
 
        aliases {
                i2c0 = &i2c1;
index 268bd470c865e6022d907ca495b6913acfd7c1ef..407a4610f4a7e055a488defe3fc52c05f1b3fa63 100644 (file)
@@ -4,6 +4,7 @@
 #include <dt-bindings/clock/qcom,gcc-msm8960.h>
 #include <dt-bindings/reset/qcom,gcc-msm8960.h>
 #include <dt-bindings/clock/qcom,mmcc-msm8960.h>
+#include <dt-bindings/clock/qcom,rpmcc.h>
 #include <dt-bindings/soc/qcom,gsbi.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
        firmware {
                scm {
                        compatible = "qcom,scm-apq8064";
+
+                       clocks = <&rpmcc RPM_DAYTONA_FABRIC_CLK>;
+                       clock-names = "core";
                };
        };
 
index 102838fcc5880ca0f4fbb90a23098191004d9386..15f4fd3f469561caa7fba30fed8c6a10c18c6668 100644 (file)
@@ -81,7 +81,7 @@
                #address-cells = <0>;
                interrupt-controller;
                reg = <0 0x2c001000 0 0x1000>,
-                     <0 0x2c002000 0 0x1000>,
+                     <0 0x2c002000 0 0x2000>,
                      <0 0x2c004000 0 0x2000>,
                      <0 0x2c006000 0 0x2000>;
                interrupts = <1 9 0xf04>;
index 45d08cc37b0134c71b11bb580fb574386b46c47b..bd107c5a02267f33a02e31e0e5fd116672684d73 100644 (file)
                #address-cells = <0>;
                interrupt-controller;
                reg = <0 0x2c001000 0 0x1000>,
-                     <0 0x2c002000 0 0x1000>,
+                     <0 0x2c002000 0 0x2000>,
                      <0 0x2c004000 0 0x2000>,
                      <0 0x2c006000 0 0x2000>;
                interrupts = <1 9 0xf04>;
index 7ea617e47fe41123193bc10a9cb331d9687e015a..958b4c42d32040105fd545ee2e62ceaadb0b682c 100644 (file)
                                        switch0phy1: switch1phy0@1 {
                                                reg = <1>;
                                                interrupt-parent = <&switch0>;
-                                               interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;                                   };
+                                               interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
+                                       };
                                        switch0phy2: switch1phy0@2 {
                                                reg = <2>;
                                                interrupt-parent = <&switch0>;
index 6053f64c3752c64034e80f5e811e645f5bb3794c..4c10c6452678b257219c551e8006d3f53eb620ee 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/bL_switcher.h>
 
 static ssize_t bL_switcher_write(struct file *file, const char __user *buf,
index 02d5e5e8d44cd0e55e216b4ab4469f5b386741f8..895ae5197159e36c34a61cbb6c404eced5698264 100644 (file)
@@ -339,7 +339,7 @@ static int __init twd_local_timer_common_register(struct device_node *np)
        }
 
        cpuhp_setup_state_nocalls(CPUHP_AP_ARM_TWD_STARTING,
-                                 "AP_ARM_TWD_STARTING",
+                                 "arm/timer/twd:starting",
                                  twd_timer_starting_cpu, twd_timer_dying_cpu);
 
        twd_get_clock(np);
index c3fe769d75584c7248015b855bca904589f3e29f..853221f81104c2bedcc7ee476b5299f8823bd306 100644 (file)
@@ -29,7 +29,7 @@
 #include <asm/opcodes.h>
 #include <asm/system_info.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * Error-checking SWP macros implemented using ldrex{b}/strex{b}
index 8f92efa8460e39808368f64f4be97234fa696cc6..11676787ad49042d5049ccd376d153d47ef7bd06 100644 (file)
@@ -33,7 +33,7 @@
 #define CREATE_TRACE_POINTS
 #include "trace.h"
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ptrace.h>
 #include <asm/mman.h>
 #include <asm/tlbflush.h>
index 9aca92074f85465590ef5f002fcd129a9f3a3674..fa6182a40941ff9fe4bafe42cf37d1b26f50aa8c 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <asm/cputype.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/kvm.h>
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_coproc.h>
index df42c93a93d69e88db6e8e621271a59e36025c5f..f5dce9b4e617df833cd210bac2fe65ac4a93b788 100644 (file)
@@ -31,10 +31,10 @@ static LIST_HEAD(clocks);
 static DEFINE_MUTEX(clocks_mutex);
 static DEFINE_SPINLOCK(clockfw_lock);
 
-static void __clk_enable(struct clk *clk)
+void davinci_clk_enable(struct clk *clk)
 {
        if (clk->parent)
-               __clk_enable(clk->parent);
+               davinci_clk_enable(clk->parent);
        if (clk->usecount++ == 0) {
                if (clk->flags & CLK_PSC)
                        davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
@@ -44,7 +44,7 @@ static void __clk_enable(struct clk *clk)
        }
 }
 
-static void __clk_disable(struct clk *clk)
+void davinci_clk_disable(struct clk *clk)
 {
        if (WARN_ON(clk->usecount == 0))
                return;
@@ -56,7 +56,7 @@ static void __clk_disable(struct clk *clk)
                        clk->clk_disable(clk);
        }
        if (clk->parent)
-               __clk_disable(clk->parent);
+               davinci_clk_disable(clk->parent);
 }
 
 int davinci_clk_reset(struct clk *clk, bool reset)
@@ -103,7 +103,7 @@ int clk_enable(struct clk *clk)
                return -EINVAL;
 
        spin_lock_irqsave(&clockfw_lock, flags);
-       __clk_enable(clk);
+       davinci_clk_enable(clk);
        spin_unlock_irqrestore(&clockfw_lock, flags);
 
        return 0;
@@ -118,7 +118,7 @@ void clk_disable(struct clk *clk)
                return;
 
        spin_lock_irqsave(&clockfw_lock, flags);
-       __clk_disable(clk);
+       davinci_clk_disable(clk);
        spin_unlock_irqrestore(&clockfw_lock, flags);
 }
 EXPORT_SYMBOL(clk_disable);
index e2a5437a1aee3c017f4f353410e0f0e314a96274..fa2b83752e030a494ae3f02a09db118e463488cd 100644 (file)
@@ -132,6 +132,8 @@ int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate);
 int davinci_set_refclk_rate(unsigned long rate);
 int davinci_simple_set_rate(struct clk *clk, unsigned long rate);
 int davinci_clk_reset(struct clk *clk, bool reset);
+void davinci_clk_enable(struct clk *clk);
+void davinci_clk_disable(struct clk *clk);
 
 extern struct platform_device davinci_wdt_device;
 extern void davinci_watchdog_reset(struct platform_device *);
index e770c97ea45c28bfc77232bb1873f976dcfc271c..1d873d15b545c26a97eefdf15d92d437ff2e1701 100644 (file)
@@ -319,6 +319,16 @@ static struct clk emac_clk = {
        .gpsc           = 1,
 };
 
+/*
+ * In order to avoid adding the emac_clk to the clock lookup table twice (and
+ * screwing up the linked list in the process) create a separate clock for
+ * mdio inheriting the rate from emac_clk.
+ */
+static struct clk mdio_clk = {
+       .name           = "mdio",
+       .parent         = &emac_clk,
+};
+
 static struct clk mcasp_clk = {
        .name           = "mcasp",
        .parent         = &async3_clk,
@@ -367,6 +377,16 @@ static struct clk aemif_clk = {
        .flags          = ALWAYS_ENABLED,
 };
 
+/*
+ * In order to avoid adding the aemif_clk to the clock lookup table twice (and
+ * screwing up the linked list in the process) create a separate clock for
+ * nand inheriting the rate from aemif_clk.
+ */
+static struct clk aemif_nand_clk = {
+       .name           = "nand",
+       .parent         = &aemif_clk,
+};
+
 static struct clk usb11_clk = {
        .name           = "usb11",
        .parent         = &pll0_sysclk4,
@@ -529,7 +549,7 @@ static struct clk_lookup da850_clks[] = {
        CLK(NULL,               "arm",          &arm_clk),
        CLK(NULL,               "rmii",         &rmii_clk),
        CLK("davinci_emac.1",   NULL,           &emac_clk),
-       CLK("davinci_mdio.0",   "fck",          &emac_clk),
+       CLK("davinci_mdio.0",   "fck",          &mdio_clk),
        CLK("davinci-mcasp.0",  NULL,           &mcasp_clk),
        CLK("davinci-mcbsp.0",  NULL,           &mcbsp0_clk),
        CLK("davinci-mcbsp.1",  NULL,           &mcbsp1_clk),
@@ -537,7 +557,15 @@ static struct clk_lookup da850_clks[] = {
        CLK("da830-mmc.0",      NULL,           &mmcsd0_clk),
        CLK("da830-mmc.1",      NULL,           &mmcsd1_clk),
        CLK("ti-aemif",         NULL,           &aemif_clk),
-       CLK(NULL,               "aemif",        &aemif_clk),
+       /*
+        * The only user of this clock is davinci_nand and it get's it through
+        * con_id. The nand node itself is created from within the aemif
+        * driver to guarantee that it's probed after the aemif timing
+        * parameters are configured. of_dev_auxdata is not accessible from
+        * the aemif driver and can't be passed to of_platform_populate(). For
+        * that reason we're leaving the dev_id here as NULL.
+        */
+       CLK(NULL,               "aemif",        &aemif_nand_clk),
        CLK("ohci-da8xx",       "usb11",        &usb11_clk),
        CLK("musb-da8xx",       "usb20",        &usb20_clk),
        CLK("spi_davinci.0",    NULL,           &spi0_clk),
index 6c18445a4639b169dc2dd24ad0b6d0475870486f..034f865fe78e8f19b42ae941965cd98ddc971270 100644 (file)
@@ -268,7 +268,7 @@ static void __init timer_init(void)
 /*
  * clocksource
  */
-static cycle_t read_cycles(struct clocksource *cs)
+static u64 read_cycles(struct clocksource *cs)
 {
        struct timer_s *t = &timers[TID_CLOCKSOURCE];
 
index c6feecf7ae242f36ce02ff1c2c43a8c4ad6807d1..9a6af0bd5dc340690bbe794b972b0aeb529faeff 100644 (file)
@@ -22,6 +22,8 @@
 #define DA8XX_USB0_BASE                0x01e00000
 #define DA8XX_USB1_BASE                0x01e25000
 
+static struct clk *usb20_clk;
+
 static struct platform_device da8xx_usb_phy = {
        .name           = "da8xx-usb-phy",
        .id             = -1,
@@ -158,26 +160,13 @@ int __init da8xx_register_usb_refclkin(int rate)
 
 static void usb20_phy_clk_enable(struct clk *clk)
 {
-       struct clk *usb20_clk;
-       int err;
        u32 val;
        u32 timeout = 500000; /* 500 msec */
 
        val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
 
-       usb20_clk = clk_get(&da8xx_usb20_dev.dev, "usb20");
-       if (IS_ERR(usb20_clk)) {
-               pr_err("could not get usb20 clk: %ld\n", PTR_ERR(usb20_clk));
-               return;
-       }
-
        /* The USB 2.O PLL requires that the USB 2.O PSC is enabled as well. */
-       err = clk_prepare_enable(usb20_clk);
-       if (err) {
-               pr_err("failed to enable usb20 clk: %d\n", err);
-               clk_put(usb20_clk);
-               return;
-       }
+       davinci_clk_enable(usb20_clk);
 
        /*
         * Turn on the USB 2.0 PHY, but just the PLL, and not OTG. The USB 1.1
@@ -197,8 +186,7 @@ static void usb20_phy_clk_enable(struct clk *clk)
 
        pr_err("Timeout waiting for USB 2.0 PHY clock good\n");
 done:
-       clk_disable_unprepare(usb20_clk);
-       clk_put(usb20_clk);
+       davinci_clk_disable(usb20_clk);
 }
 
 static void usb20_phy_clk_disable(struct clk *clk)
@@ -285,11 +273,19 @@ static struct clk_lookup usb20_phy_clk_lookup =
 int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin)
 {
        struct clk *parent;
-       int ret = 0;
+       int ret;
+
+       usb20_clk = clk_get(&da8xx_usb20_dev.dev, "usb20");
+       ret = PTR_ERR_OR_ZERO(usb20_clk);
+       if (ret)
+               return ret;
 
        parent = clk_get(NULL, use_usb_refclkin ? "usb_refclkin" : "pll0_aux");
-       if (IS_ERR(parent))
-               return PTR_ERR(parent);
+       ret = PTR_ERR_OR_ZERO(parent);
+       if (ret) {
+               clk_put(usb20_clk);
+               return ret;
+       }
 
        usb20_phy_clk.parent = parent;
        ret = clk_register(&usb20_phy_clk);
index e5f791145bd00dc4cb9424101564ef60c0c2f6bb..874cbc91b66944e09e64f66d0bb833e684586cba 100644 (file)
@@ -59,13 +59,13 @@ static u64 notrace ep93xx_read_sched_clock(void)
        return ret;
 }
 
-cycle_t ep93xx_clocksource_read(struct clocksource *c)
+u64 ep93xx_clocksource_read(struct clocksource *c)
 {
        u64 ret;
 
        ret = readl(EP93XX_TIMER4_VALUE_LOW);
        ret |= ((u64) (readl(EP93XX_TIMER4_VALUE_HIGH) & 0xff) << 32);
-       return (cycle_t) ret;
+       return (u64) ret;
 }
 
 static int ep93xx_clkevt_set_next_event(unsigned long next,
index 98ffe1e62ad5d6debe7c087743d728d5730c26d3..a5d68411a037994cfcf7f3c2b62c0afb5d91617f 100644 (file)
@@ -385,36 +385,6 @@ fail:
        return pen_release != -1 ? ret : 0;
 }
 
-/*
- * Initialise the CPU possible map early - this describes the CPUs
- * which may be present or become present in the system.
- */
-
-static void __init exynos_smp_init_cpus(void)
-{
-       void __iomem *scu_base = scu_base_addr();
-       unsigned int i, ncores;
-
-       if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
-               ncores = scu_base ? scu_get_core_count(scu_base) : 1;
-       else
-               /*
-                * CPU Nodes are passed thru DT and set_cpu_possible
-                * is set by "arm_dt_init_cpu_maps".
-                */
-               return;
-
-       /* sanity check */
-       if (ncores > nr_cpu_ids) {
-               pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-                       ncores, nr_cpu_ids);
-               ncores = nr_cpu_ids;
-       }
-
-       for (i = 0; i < ncores; i++)
-               set_cpu_possible(i, true);
-}
-
 static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
 {
        int i;
@@ -479,7 +449,6 @@ static void exynos_cpu_die(unsigned int cpu)
 #endif /* CONFIG_HOTPLUG_CPU */
 
 const struct smp_operations exynos_smp_ops __initconst = {
-       .smp_init_cpus          = exynos_smp_init_cpus,
        .smp_prepare_cpus       = exynos_smp_prepare_cpus,
        .smp_secondary_init     = exynos_secondary_init,
        .smp_boot_secondary     = exynos_boot_secondary,
index 810edc78c8172a7fc24f7121418cae34d67f73a5..75395a720e6338b49636bef9157ea330f133025c 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "common.h"
 
-static cycle_t cksrc_dc21285_read(struct clocksource *cs)
+static u64 cksrc_dc21285_read(struct clocksource *cs)
 {
        return cs->mask - *CSR_TIMER2_VALUE;
 }
index de5ab8d88549de87ea88fc92c2bf4eda7a022e38..3a8406e45b65dceedf0abdb02f59b4b30bf394a8 100644 (file)
@@ -37,7 +37,6 @@ static const char * const imx1_dt_board_compat[] __initconst = {
 };
 
 DT_MACHINE_START(IMX1_DT, "Freescale i.MX1 (Device Tree Support)")
-       .map_io         = debug_ll_io_init,
        .init_early     = imx1_init_early,
        .init_irq       = imx1_init_irq,
        .dt_compat      = imx1_dt_board_compat,
index ba96bf979625d4da755fa08939eefe626cb79bdd..699157759120f13ed4047b05609e53cb419fffe5 100644 (file)
@@ -60,6 +60,7 @@
 
 #define to_mmdc_pmu(p) container_of(p, struct mmdc_pmu, pmu)
 
+static enum cpuhp_state cpuhp_mmdc_state;
 static int ddr_type;
 
 struct fsl_mmdc_devtype_data {
@@ -451,8 +452,8 @@ static int imx_mmdc_remove(struct platform_device *pdev)
 {
        struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev);
 
+       cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
        perf_pmu_unregister(&pmu_mmdc->pmu);
-       cpuhp_remove_state_nocalls(CPUHP_ONLINE);
        kfree(pmu_mmdc);
        return 0;
 }
@@ -472,6 +473,18 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
                return -ENOMEM;
        }
 
+       /* The first instance registers the hotplug state */
+       if (!cpuhp_mmdc_state) {
+               ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
+                                             "perf/arm/mmdc:online", NULL,
+                                             mmdc_pmu_offline_cpu);
+               if (ret < 0) {
+                       pr_err("cpuhp_setup_state_multi failed\n");
+                       goto pmu_free;
+               }
+               cpuhp_mmdc_state = ret;
+       }
+
        mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev);
        if (mmdc_num == 0)
                name = "mmdc";
@@ -485,26 +498,23 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
                        HRTIMER_MODE_REL);
        pmu_mmdc->hrtimer.function = mmdc_pmu_timer_handler;
 
-       cpuhp_state_add_instance_nocalls(CPUHP_ONLINE,
-                                        &pmu_mmdc->node);
-       cpumask_set_cpu(smp_processor_id(), &pmu_mmdc->cpu);
-       ret = cpuhp_setup_state_multi(CPUHP_AP_NOTIFY_ONLINE,
-                                     "MMDC_ONLINE", NULL,
-                                     mmdc_pmu_offline_cpu);
-       if (ret) {
-               pr_err("cpuhp_setup_state_multi failure\n");
-               goto pmu_register_err;
-       }
+       cpumask_set_cpu(raw_smp_processor_id(), &pmu_mmdc->cpu);
+
+       /* Register the pmu instance for cpu hotplug */
+       cpuhp_state_add_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
 
        ret = perf_pmu_register(&(pmu_mmdc->pmu), name, -1);
-       platform_set_drvdata(pdev, pmu_mmdc);
        if (ret)
                goto pmu_register_err;
+
+       platform_set_drvdata(pdev, pmu_mmdc);
        return 0;
 
 pmu_register_err:
        pr_warn("MMDC Perf PMU failed (%d), disabled\n", ret);
+       cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
        hrtimer_cancel(&pmu_mmdc->hrtimer);
+pmu_free:
        kfree(pmu_mmdc);
        return ret;
 }
index c702cc4092dedb1ea181654b15603e24245ad3df..bd9b43c8004ef127d8d9eb57eee7455cdaf50148 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/interrupt.h>
 #include <linux/list.h>
 #include <linux/sysctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mach/irq.h>
 #include <asm/irq.h>
 #include <mach/hardware.h>
index 26874f608ca9e0ebc7107a11fece8975ec68eb55..846e033c56fa74a6a6873534255653b8593b3382 100644 (file)
@@ -34,7 +34,7 @@
 #include <mach/udc.h>
 #include <mach/hardware.h>
 #include <mach/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/page.h>
 #include <asm/irq.h>
@@ -493,7 +493,7 @@ static u64 notrace ixp4xx_read_sched_clock(void)
  * clocksource
  */
 
-static cycle_t ixp4xx_clocksource_read(struct clocksource *c)
+static u64 ixp4xx_clocksource_read(struct clocksource *c)
 {
        return *IXP4XX_OSTS;
 }
index 3c2c92aaa0aecc8eea9147478bcda5fcc513ea4e..96ad1db0b04bef7c59a191ffec822a5e84ae7686 100644 (file)
@@ -144,7 +144,7 @@ static struct clock_event_device ckevt = {
        .set_state_oneshot      = timer_set_shutdown,
 };
 
-static cycle_t clksrc_read(struct clocksource *cs)
+static u64 clksrc_read(struct clocksource *cs)
 {
        return timer_read();
 }
index ae2a018b93050fa8171d2164124d85796e801bb6..8f8748a0c84f44229fec0eb4f3fa225202c2666a 100644 (file)
@@ -148,7 +148,7 @@ static void __init armada_370_coherency_init(struct device_node *np)
        of_node_put(cpu_config_np);
 
        cpuhp_setup_state_nocalls(CPUHP_AP_ARM_MVEBU_COHERENCY,
-                                 "AP_ARM_MVEBU_COHERENCY",
+                                 "arm/mvebu/coherency:starting",
                                  armada_xp_clear_l2_starting, NULL);
 exit:
        set_cpu_coherent();
index 469894082fea00c9605ea4dc370d69b18f5b40d3..093458b62c8dadbcc3c7cc1c3b66d84e59af3d8d 100644 (file)
@@ -7,7 +7,7 @@ ccflags-y := -I$(srctree)/$(src)/include \
 
 # Common support
 obj-y := id.o io.o control.o devices.o fb.o timer.o pm.o \
-        common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
+        common.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
         omap_device.o omap-headsmp.o sram.o drm.o
 
 hwmod-common                           = omap_hwmod.o omap_hwmod_reset.o \
index 36d9943205ca4bb7bff163656f7760129c620e3c..dc9e34e670a26f280bdfe7947fa8709ee750465f 100644 (file)
@@ -304,7 +304,7 @@ DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
        .init_late      = am43xx_init_late,
        .init_irq       = omap_gic_of_init,
        .init_machine   = omap_generic_init,
-       .init_time      = omap4_local_timer_init,
+       .init_time      = omap3_gptimer_timer_init,
        .dt_compat      = am43_boards_compat,
        .restart        = omap44xx_restart,
 MACHINE_END
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
deleted file mode 100644 (file)
index 7a57714..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * OMAP2+ specific gpio initialization
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- * Author:
- *     Charulatha V <charu@ti.com>
- *
- * 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 version 2.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/gpio.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/of.h>
-#include <linux/platform_data/gpio-omap.h>
-
-#include "soc.h"
-#include "omap_hwmod.h"
-#include "omap_device.h"
-#include "omap-pm.h"
-
-#include "powerdomain.h"
-
-static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
-{
-       struct platform_device *pdev;
-       struct omap_gpio_platform_data *pdata;
-       struct omap_gpio_dev_attr *dev_attr;
-       char *name = "omap_gpio";
-       int id;
-       struct powerdomain *pwrdm;
-
-       /*
-        * extract the device id from name field available in the
-        * hwmod database and use the same for constructing ids for
-        * gpio devices.
-        * CAUTION: Make sure the name in the hwmod database does
-        * not change. If changed, make corresponding change here
-        * or make use of static variable mechanism to handle this.
-        */
-       sscanf(oh->name, "gpio%d", &id);
-
-       pdata = kzalloc(sizeof(struct omap_gpio_platform_data), GFP_KERNEL);
-       if (!pdata) {
-               pr_err("gpio%d: Memory allocation failed\n", id);
-               return -ENOMEM;
-       }
-
-       dev_attr = (struct omap_gpio_dev_attr *)oh->dev_attr;
-       pdata->bank_width = dev_attr->bank_width;
-       pdata->dbck_flag = dev_attr->dbck_flag;
-       pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
-       pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL);
-       if (!pdata->regs) {
-               pr_err("gpio%d: Memory allocation failed\n", id);
-               kfree(pdata);
-               return -ENOMEM;
-       }
-
-       switch (oh->class->rev) {
-       case 0:
-               if (id == 1)
-                       /* non-wakeup GPIO pins for OMAP2 Bank1 */
-                       pdata->non_wakeup_gpios = 0xe203ffc0;
-               else if (id == 2)
-                       /* non-wakeup GPIO pins for OMAP2 Bank2 */
-                       pdata->non_wakeup_gpios = 0x08700040;
-               /* fall through */
-
-       case 1:
-               pdata->regs->revision = OMAP24XX_GPIO_REVISION;
-               pdata->regs->direction = OMAP24XX_GPIO_OE;
-               pdata->regs->datain = OMAP24XX_GPIO_DATAIN;
-               pdata->regs->dataout = OMAP24XX_GPIO_DATAOUT;
-               pdata->regs->set_dataout = OMAP24XX_GPIO_SETDATAOUT;
-               pdata->regs->clr_dataout = OMAP24XX_GPIO_CLEARDATAOUT;
-               pdata->regs->irqstatus = OMAP24XX_GPIO_IRQSTATUS1;
-               pdata->regs->irqstatus2 = OMAP24XX_GPIO_IRQSTATUS2;
-               pdata->regs->irqenable = OMAP24XX_GPIO_IRQENABLE1;
-               pdata->regs->irqenable2 = OMAP24XX_GPIO_IRQENABLE2;
-               pdata->regs->set_irqenable = OMAP24XX_GPIO_SETIRQENABLE1;
-               pdata->regs->clr_irqenable = OMAP24XX_GPIO_CLEARIRQENABLE1;
-               pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL;
-               pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN;
-               pdata->regs->ctrl = OMAP24XX_GPIO_CTRL;
-               pdata->regs->wkup_en = OMAP24XX_GPIO_WAKE_EN;
-               pdata->regs->leveldetect0 = OMAP24XX_GPIO_LEVELDETECT0;
-               pdata->regs->leveldetect1 = OMAP24XX_GPIO_LEVELDETECT1;
-               pdata->regs->risingdetect = OMAP24XX_GPIO_RISINGDETECT;
-               pdata->regs->fallingdetect = OMAP24XX_GPIO_FALLINGDETECT;
-               break;
-       case 2:
-               pdata->regs->revision = OMAP4_GPIO_REVISION;
-               pdata->regs->direction = OMAP4_GPIO_OE;
-               pdata->regs->datain = OMAP4_GPIO_DATAIN;
-               pdata->regs->dataout = OMAP4_GPIO_DATAOUT;
-               pdata->regs->set_dataout = OMAP4_GPIO_SETDATAOUT;
-               pdata->regs->clr_dataout = OMAP4_GPIO_CLEARDATAOUT;
-               pdata->regs->irqstatus_raw0 = OMAP4_GPIO_IRQSTATUSRAW0;
-               pdata->regs->irqstatus_raw1 = OMAP4_GPIO_IRQSTATUSRAW1;
-               pdata->regs->irqstatus = OMAP4_GPIO_IRQSTATUS0;
-               pdata->regs->irqstatus2 = OMAP4_GPIO_IRQSTATUS1;
-               pdata->regs->irqenable = OMAP4_GPIO_IRQSTATUSSET0;
-               pdata->regs->irqenable2 = OMAP4_GPIO_IRQSTATUSSET1;
-               pdata->regs->set_irqenable = OMAP4_GPIO_IRQSTATUSSET0;
-               pdata->regs->clr_irqenable = OMAP4_GPIO_IRQSTATUSCLR0;
-               pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME;
-               pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE;
-               pdata->regs->ctrl = OMAP4_GPIO_CTRL;
-               pdata->regs->wkup_en = OMAP4_GPIO_IRQWAKEN0;
-               pdata->regs->leveldetect0 = OMAP4_GPIO_LEVELDETECT0;
-               pdata->regs->leveldetect1 = OMAP4_GPIO_LEVELDETECT1;
-               pdata->regs->risingdetect = OMAP4_GPIO_RISINGDETECT;
-               pdata->regs->fallingdetect = OMAP4_GPIO_FALLINGDETECT;
-               break;
-       default:
-               WARN(1, "Invalid gpio bank_type\n");
-               kfree(pdata->regs);
-               kfree(pdata);
-               return -EINVAL;
-       }
-
-       pwrdm = omap_hwmod_get_pwrdm(oh);
-       pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
-
-       pdev = omap_device_build(name, id - 1, oh, pdata, sizeof(*pdata));
-       kfree(pdata);
-
-       if (IS_ERR(pdev)) {
-               WARN(1, "Can't build omap_device for %s:%s.\n",
-                                       name, oh->name);
-               return PTR_ERR(pdev);
-       }
-
-       return 0;
-}
-
-/*
- * gpio_init needs to be done before
- * machine_init functions access gpio APIs.
- * Hence gpio_init is a omap_postcore_initcall.
- */
-static int __init omap2_gpio_init(void)
-{
-       /* If dtb is there, the devices will be created dynamically */
-       if (of_have_populated_dt())
-               return -ENODEV;
-
-       return omap_hwmod_for_each_by_class("gpio", omap2_gpio_dev_init, NULL);
-}
-omap_postcore_initcall(omap2_gpio_init);
index 759e1d45ba25c3977af1d7048bec577062a51b66..e8b988714a09f842c01b5ea8a22d09c31ba20f1d 100644 (file)
@@ -741,14 +741,14 @@ static int _init_main_clk(struct omap_hwmod *oh)
        int ret = 0;
        char name[MOD_CLK_MAX_NAME_LEN];
        struct clk *clk;
+       static const char modck[] = "_mod_ck";
 
-       /* +7 magic comes from '_mod_ck' suffix */
-       if (strlen(oh->name) + 7 > MOD_CLK_MAX_NAME_LEN)
+       if (strlen(oh->name) >= MOD_CLK_MAX_NAME_LEN - strlen(modck))
                pr_warn("%s: warning: cropping name for %s\n", __func__,
                        oh->name);
 
-       strncpy(name, oh->name, MOD_CLK_MAX_NAME_LEN - 7);
-       strcat(name, "_mod_ck");
+       strlcpy(name, oh->name, MOD_CLK_MAX_NAME_LEN - strlen(modck));
+       strlcat(name, modck, MOD_CLK_MAX_NAME_LEN);
 
        clk = clk_get(NULL, name);
        if (!IS_ERR(clk)) {
index cdfbb44ceb0c4f3059bc6568e2e765304f7e374a..f22e9cb39f4ac16af15020a0990e32dd975a9bd3 100644 (file)
@@ -121,10 +121,6 @@ extern struct omap_hwmod_irq_info omap2_uart3_mpu_irqs[];
 extern struct omap_hwmod_irq_info omap2_dispc_irqs[];
 extern struct omap_hwmod_irq_info omap2_i2c1_mpu_irqs[];
 extern struct omap_hwmod_irq_info omap2_i2c2_mpu_irqs[];
-extern struct omap_hwmod_irq_info omap2_gpio1_irqs[];
-extern struct omap_hwmod_irq_info omap2_gpio2_irqs[];
-extern struct omap_hwmod_irq_info omap2_gpio3_irqs[];
-extern struct omap_hwmod_irq_info omap2_gpio4_irqs[];
 extern struct omap_hwmod_irq_info omap2_dma_system_irqs[];
 extern struct omap_hwmod_irq_info omap2_mcspi1_mpu_irqs[];
 extern struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[];
index 5b2f5138d938ac626a1895b71a9a44cd0d757785..2b138b65129a5d609ff2ae02a55181c10154113b 100644 (file)
@@ -295,10 +295,8 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
                GFP_KERNEL);
 
        if (!prcm_irq_chips || !prcm_irq_setup->saved_mask ||
-           !prcm_irq_setup->priority_mask) {
-               pr_err("PRCM: kzalloc failed\n");
+           !prcm_irq_setup->priority_mask)
                goto err;
-       }
 
        memset(mask, 0, sizeof(mask));
 
index 5e2e2218a4023a28b25657f2174735d908fd2a68..07dd692c47372f8aa145d00cb5532b75774429c5 100644 (file)
@@ -369,9 +369,9 @@ static bool use_gptimer_clksrc __initdata;
 /*
  * clocksource
  */
-static cycle_t clocksource_read_cycles(struct clocksource *cs)
+static u64 clocksource_read_cycles(struct clocksource *cs)
 {
-       return (cycle_t)__omap_dm_timer_read_counter(&clksrc,
+       return (u64)__omap_dm_timer_read_counter(&clksrc,
                                                     OMAP_TIMER_NONPOSTED);
 }
 
@@ -510,18 +510,19 @@ void __init omap3_secure_sync32k_timer_init(void)
 }
 #endif /* CONFIG_ARCH_OMAP3 */
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX)
+#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) || \
+       defined(CONFIG_SOC_AM43XX)
 void __init omap3_gptimer_timer_init(void)
 {
        __omap_sync32k_timer_init(2, "timer_sys_ck", NULL,
                        1, "timer_sys_ck", "ti,timer-alwon", true);
-
-       clocksource_probe();
+       if (of_have_populated_dt())
+               clocksource_probe();
 }
 #endif
 
 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) ||         \
-       defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM43XX)
+       defined(CONFIG_SOC_DRA7XX)
 static void __init omap4_sync32k_timer_init(void)
 {
        __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon",
index 6d3517dc4772a05a444842475079d4d66dfcbb2a..fb48f3141fb4d7cd2403aaece876ae338a308bf2 100644 (file)
@@ -20,7 +20,7 @@
 #include <asm/fiq.h>
 #include <asm/irq.h>
 #include <mach/hardware.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/mach/dma.h>
 #include <asm/hardware/iomd.h>
index f6c3f151d0d48c2c62ca056a18fbbe16edc309d9..b59f4f4f256f2bd6785b086c40bbefb0bb68315c 100644 (file)
@@ -345,10 +345,40 @@ static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
        [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
 };
 
+static const struct dma_slave_map s3c2410_dma_slave_map[] = {
+       { "s3c2410-sdi", "rx-tx", (void *)DMACH_SDI },
+       { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0_RX },
+       { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0_TX },
+       { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1_RX },
+       { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1_TX },
+       /*
+        * The DMA request source[1] (DMACH_UARTx_SRC2) are
+        * not used in the UART driver.
+        */
+       { "s3c2410-uart.0", "rx", (void *)DMACH_UART0 },
+       { "s3c2410-uart.0", "tx", (void *)DMACH_UART0 },
+       { "s3c2410-uart.1", "rx", (void *)DMACH_UART1 },
+       { "s3c2410-uart.1", "tx", (void *)DMACH_UART1 },
+       { "s3c2410-uart.2", "rx", (void *)DMACH_UART2 },
+       { "s3c2410-uart.2", "tx", (void *)DMACH_UART2 },
+       { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
+       { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
+       { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
+       { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
+};
+
 static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
        .num_phy_channels = 4,
        .channels = s3c2410_dma_channels,
        .num_channels = DMACH_MAX,
+       .slave_map = s3c2410_dma_slave_map,
+       .slavecnt = ARRAY_SIZE(s3c2410_dma_slave_map),
 };
 
 struct platform_device s3c2410_device_dma = {
@@ -388,10 +418,36 @@ static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
        [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
 };
 
+static const struct dma_slave_map s3c2412_dma_slave_map[] = {
+       { "s3c2412-sdi", "rx-tx", (void *)DMACH_SDI },
+       { "s3c2412-spi.0", "rx", (void *)DMACH_SPI0_RX },
+       { "s3c2412-spi.0", "tx", (void *)DMACH_SPI0_TX },
+       { "s3c2412-spi.1", "rx", (void *)DMACH_SPI1_RX },
+       { "s3c2412-spi.1", "tx", (void *)DMACH_SPI1_TX },
+       { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
+       { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
+       { "s3c2412-iis", "rx", (void *)DMACH_I2S_IN },
+       { "s3c2412-iis", "tx", (void *)DMACH_I2S_OUT },
+       { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
+       { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
+       { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
+       { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
+       { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
+};
+
 static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
        .num_phy_channels = 4,
        .channels = s3c2412_dma_channels,
        .num_channels = DMACH_MAX,
+       .slave_map = s3c2412_dma_slave_map,
+       .slavecnt = ARRAY_SIZE(s3c2412_dma_slave_map),
 };
 
 struct platform_device s3c2412_device_dma = {
@@ -534,10 +590,30 @@ static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
        [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
 };
 
+static const struct dma_slave_map s3c2443_dma_slave_map[] = {
+       { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI },
+       { "s3c2443-spi.0", "rx", (void *)DMACH_SPI0_RX },
+       { "s3c2443-spi.0", "tx", (void *)DMACH_SPI0_TX },
+       { "s3c2443-spi.1", "rx", (void *)DMACH_SPI1_RX },
+       { "s3c2443-spi.1", "tx", (void *)DMACH_SPI1_TX },
+       { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
+       { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
+       { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
+       { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
+       { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 },
+       { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 },
+       { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
+       { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
+};
+
 static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
        .num_phy_channels = 6,
        .channels = s3c2443_dma_channels,
        .num_channels = DMACH_MAX,
+       .slave_map = s3c2443_dma_slave_map,
+       .slavecnt = ARRAY_SIZE(s3c2443_dma_slave_map),
 };
 
 struct platform_device s3c2443_device_dma = {
index 976d3057272e0e128bdb2af30d8c2f220d4a5aa7..0a1e2280141f796e1fa62ed25352aa77606b2b95 100644 (file)
@@ -563,7 +563,7 @@ static __init int l2x0_pmu_init(void)
 
        cpumask_set_cpu(0, &pmu_cpu);
        ret = cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_L2X0_ONLINE,
-                                       "AP_PERF_ARM_L2X0_ONLINE", NULL,
+                                       "perf/arm/l2x0:online", NULL,
                                        l2x0_pmu_offline_cpu);
        if (ret)
                goto out_pmu;
index d1870c777c6e2decbac8a2cd58c73c10c9e30ede..2290be390f87b15c48cd9cfc67a08386e1148999 100644 (file)
@@ -683,7 +683,7 @@ static void __init l2c310_enable(void __iomem *base, unsigned num_lock)
 
        if (aux & L310_AUX_CTRL_FULL_LINE_ZERO)
                cpuhp_setup_state(CPUHP_AP_ARM_L2X0_STARTING,
-                                 "AP_ARM_L2X0_STARTING", l2c310_starting_cpu,
+                                 "arm/l2x0:starting", l2c310_starting_cpu,
                                  l2c310_dying_cpu);
 }
 
index 101e8f2c7abecce5647034818c3926f55f94c489..2cff0010f677fe9a54fd12c4a3954fa61d0a2990 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/sched_clock.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 #include <mach/time.h>
@@ -38,7 +38,7 @@
 /*
  * IOP clocksource (free-running timer 1).
  */
-static cycle_t notrace iop_clocksource_read(struct clocksource *unused)
+static u64 notrace iop_clocksource_read(struct clocksource *unused)
 {
        return 0xffffffffu - read_tcr1();
 }
index 0351f5645fb11c7f086e4ad6ea6ab4e9bdd3cfae..569d5a650a4a2c6266ddf8fc6d38e0cd96b985f6 100644 (file)
@@ -799,7 +799,7 @@ static int __init vfp_init(void)
        }
 
        cpuhp_setup_state_nocalls(CPUHP_AP_ARM_VFP_STARTING,
-                                 "AP_ARM_VFP_STARTING", vfp_starting_cpu,
+                                 "arm/vfp:starting", vfp_starting_cpu,
                                  vfp_dying_cpu);
 
        vfp_vector = vfp_support_entry;
index 4986dc0c1dff05f564756d584cde2c06c4ee01ce..11d9f2898b16441b4ccac1dc111fe6c6c5a9ed7d 100644 (file)
@@ -412,7 +412,7 @@ static int __init xen_guest_init(void)
                pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);
 
        return cpuhp_setup_state(CPUHP_AP_ARM_XEN_STARTING,
-                                "AP_ARM_XEN_STARTING", xen_starting_cpu,
+                                "arm/xen:starting", xen_starting_cpu,
                                 xen_dying_cpu);
 }
 early_initcall(xen_guest_init);
index fc033c0d2a0f21b443ed0e28ad35d87598870e55..eada0b58ba1c7637d46fffaf7eadaf37380d41e8 100644 (file)
                                status = "disabled";
                        };
                };
+
+               vpu: vpu@d0100000 {
+                       compatible = "amlogic,meson-gx-vpu";
+                       reg = <0x0 0xd0100000 0x0 0x100000>,
+                             <0x0 0xc883c000 0x0 0x1000>,
+                             <0x0 0xc8838000 0x0 0x1000>;
+                       reg-names = "vpu", "hhi", "dmc";
+                       interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       /* CVBS VDAC output port */
+                       cvbs_vdac_port: port@0 {
+                               reg = <0>;
+                       };
+               };
        };
 };
index 969682092e0fe040fb1b6de918de99d095fd2c91..4cbd626a9e887b01285c6052fb3590d46bcae176 100644 (file)
                clocks = <&wifi32k>;
                clock-names = "ext_clock";
        };
+
+       cvbs-connector {
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
 };
 
 &uart_AO {
        clocks = <&clkc CLKID_FCLK_DIV4>;
        clock-names = "clkin0";
 };
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
index 203be28978d5ede48d7050356f14a2ad19423a7e..4a96e0f6f9265b858287c039714e652062134c9e 100644 (file)
                clocks = <&wifi32k>;
                clock-names = "ext_clock";
        };
+
+       cvbs-connector {
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
 };
 
 /* This UART is brought out to the DB9 connector */
        clocks = <&clkc CLKID_FCLK_DIV4>;
        clock-names = "clkin0";
 };
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
index 51edd5b5c4604518bf8e329c11d123c2aa706af6..596240c38a9cdd7720077a8f97a5c0111366e550 100644 (file)
                 <&clkc CLKID_FCLK_DIV2>;
        clock-names = "core", "clkin0", "clkin1";
 };
+
+&vpu {
+       compatible = "amlogic,meson-gxbb-vpu", "amlogic,meson-gx-vpu";
+};
index e99101ae966438414c055f54c635c8b0878a528e..cea4a3eded9b805983e0af414cfd6d901ad5a703 100644 (file)
                clocks = <&wifi32k>;
                clock-names = "ext_clock";
        };
+
+       cvbs-connector {
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
 };
 
 &uart_AO {
        clocks = <&clkc CLKID_FCLK_DIV4>;
        clock-names = "clkin0";
 };
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
index 9f89b99c4806776d1a009c9e02f02e3584e8c294..69216246275dfa05e852e513337eea1cb8d53e55 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "meson-gx.dtsi"
 #include <dt-bindings/clock/gxbb-clkc.h>
-#include <dt-bindings/gpio/meson-gxbb-gpio.h>
+#include <dt-bindings/gpio/meson-gxl-gpio.h>
 
 / {
        compatible = "amlogic,meson-gxl";
                 <&clkc CLKID_FCLK_DIV2>;
        clock-names = "core", "clkin0", "clkin1";
 };
+
+&vpu {
+       compatible = "amlogic,meson-gxl-vpu", "amlogic,meson-gx-vpu";
+};
index f859d75db8bd936845663084ffbfd7309148a9f4..5a337d339df1d58b984ab575ba88b07a03a067c2 100644 (file)
                compatible = "mmc-pwrseq-emmc";
                reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
        };
+
+       cvbs-connector {
+               compatible = "composite-video-connector";
+
+               port {
+                       cvbs_connector_in: endpoint {
+                               remote-endpoint = <&cvbs_vdac_out>;
+                       };
+               };
+       };
 };
 
 /* This UART is brought out to the DB9 connector */
                max-speed = <1000>;
        };
 };
+
+&cvbs_vdac_port {
+       cvbs_vdac_out: endpoint {
+               remote-endpoint = <&cvbs_connector_in>;
+       };
+};
index c1974bbbddead8d3b955e105ec018701fca3ffd7..eb2f0c3e5e538e4bebf211512bccd4a8eaab02b5 100644 (file)
                };
        };
 };
+
+&vpu {
+       compatible = "amlogic,meson-gxm-vpu", "amlogic,meson-gx-vpu";
+};
index a852e28a40e17761b5b393b21d9798eb9a80cd8b..a83ed2c6bbf79afd64c24577ca2530e7da6f0b87 100644 (file)
@@ -81,7 +81,7 @@
                #address-cells = <0>;
                interrupt-controller;
                reg = <0x0 0x2c001000 0 0x1000>,
-                     <0x0 0x2c002000 0 0x1000>,
+                     <0x0 0x2c002000 0 0x2000>,
                      <0x0 0x2c004000 0 0x2000>,
                      <0x0 0x2c006000 0 0x2000>;
                interrupts = <1 9 0xf04>;
index 9d1d7ad9b075a314d5777260622d66487c82cf45..29ed6b61c737a7827eb8caae01ef335fdbd222b1 100644 (file)
                        reg = <0x0 0x86000000 0x0 0x200000>;
                        no-map;
                };
+
+               memory@85800000 {
+                       reg = <0x0 0x85800000 0x0 0x800000>;
+                       no-map;
+               };
+
+               memory@86200000 {
+                       reg = <0x0 0x86200000 0x0 0x2600000>;
+                       no-map;
+               };
        };
 
        cpus {
index 6ffb0517421a92f40d43ffa37682bfd825efca25..dbea2c3d8f0c229f05573f94b9318837a8c11300 100644 (file)
                power-source = <3300>;
        };
 
-       sdhi0_pins_uhs: sd0 {
+       sdhi0_pins_uhs: sd0_uhs {
                groups = "sdhi0_data4", "sdhi0_ctrl";
                function = "sdhi0";
                power-source = <1800>;
index 869dded0f09f810f8b05005eed0e3d1d86287b93..33b744d547392d6464d34d5ca91d1296454ad784 100644 (file)
@@ -331,6 +331,7 @@ CONFIG_DRM_VC4=m
 CONFIG_DRM_PANEL_SIMPLE=m
 CONFIG_DRM_I2C_ADV7511=m
 CONFIG_DRM_HISI_KIRIN=m
+CONFIG_DRM_MESON=m
 CONFIG_FB=y
 CONFIG_FB_ARMCLCD=y
 CONFIG_BACKLIGHT_GENERIC=m
diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h
new file mode 100644 (file)
index 0000000..df411f3
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef __ASM_ASM_UACCESS_H
+#define __ASM_ASM_UACCESS_H
+
+#include <asm/alternative.h>
+#include <asm/kernel-pgtable.h>
+#include <asm/sysreg.h>
+#include <asm/assembler.h>
+
+/*
+ * User access enabling/disabling macros.
+ */
+#ifdef CONFIG_ARM64_SW_TTBR0_PAN
+       .macro  __uaccess_ttbr0_disable, tmp1
+       mrs     \tmp1, ttbr1_el1                // swapper_pg_dir
+       add     \tmp1, \tmp1, #SWAPPER_DIR_SIZE // reserved_ttbr0 at the end of swapper_pg_dir
+       msr     ttbr0_el1, \tmp1                // set reserved TTBR0_EL1
+       isb
+       .endm
+
+       .macro  __uaccess_ttbr0_enable, tmp1
+       get_thread_info \tmp1
+       ldr     \tmp1, [\tmp1, #TSK_TI_TTBR0]   // load saved TTBR0_EL1
+       msr     ttbr0_el1, \tmp1                // set the non-PAN TTBR0_EL1
+       isb
+       .endm
+
+       .macro  uaccess_ttbr0_disable, tmp1
+alternative_if_not ARM64_HAS_PAN
+       __uaccess_ttbr0_disable \tmp1
+alternative_else_nop_endif
+       .endm
+
+       .macro  uaccess_ttbr0_enable, tmp1, tmp2
+alternative_if_not ARM64_HAS_PAN
+       save_and_disable_irq \tmp2              // avoid preemption
+       __uaccess_ttbr0_enable \tmp1
+       restore_irq \tmp2
+alternative_else_nop_endif
+       .endm
+#else
+       .macro  uaccess_ttbr0_disable, tmp1
+       .endm
+
+       .macro  uaccess_ttbr0_enable, tmp1, tmp2
+       .endm
+#endif
+
+/*
+ * These macros are no-ops when UAO is present.
+ */
+       .macro  uaccess_disable_not_uao, tmp1
+       uaccess_ttbr0_disable \tmp1
+alternative_if ARM64_ALT_PAN_NOT_UAO
+       SET_PSTATE_PAN(1)
+alternative_else_nop_endif
+       .endm
+
+       .macro  uaccess_enable_not_uao, tmp1, tmp2
+       uaccess_ttbr0_enable \tmp1, \tmp2
+alternative_if ARM64_ALT_PAN_NOT_UAO
+       SET_PSTATE_PAN(0)
+alternative_else_nop_endif
+       .endm
+
+#endif
index f2bcbe2d98895ea35b95b8a1e518d808738284b4..86c404171305abd290a6a85d7a5edd69c55ecd02 100644 (file)
@@ -9,9 +9,17 @@
 
 struct task_struct;
 
+/*
+ * We don't use read_sysreg() as we want the compiler to cache the value where
+ * possible.
+ */
 static __always_inline struct task_struct *get_current(void)
 {
-       return (struct task_struct *)read_sysreg(sp_el0);
+       unsigned long sp_el0;
+
+       asm ("mrs %0, sp_el0" : "=r" (sp_el0));
+
+       return (struct task_struct *)sp_el0;
 }
 
 #define current get_current()
index d26750ca6e066b9f0f267025512b3e2bdef13744..46da3ea638bbdfc858161f3e00ac560562692359 100644 (file)
@@ -22,8 +22,6 @@
 #include <asm/kernel-pgtable.h>
 #include <asm/sysreg.h>
 
-#ifndef __ASSEMBLY__
-
 /*
  * User space memory access functions
  */
@@ -424,66 +422,4 @@ extern long strncpy_from_user(char *dest, const char __user *src, long count);
 extern __must_check long strlen_user(const char __user *str);
 extern __must_check long strnlen_user(const char __user *str, long n);
 
-#else  /* __ASSEMBLY__ */
-
-#include <asm/assembler.h>
-
-/*
- * User access enabling/disabling macros.
- */
-#ifdef CONFIG_ARM64_SW_TTBR0_PAN
-       .macro  __uaccess_ttbr0_disable, tmp1
-       mrs     \tmp1, ttbr1_el1                // swapper_pg_dir
-       add     \tmp1, \tmp1, #SWAPPER_DIR_SIZE // reserved_ttbr0 at the end of swapper_pg_dir
-       msr     ttbr0_el1, \tmp1                // set reserved TTBR0_EL1
-       isb
-       .endm
-
-       .macro  __uaccess_ttbr0_enable, tmp1
-       get_thread_info \tmp1
-       ldr     \tmp1, [\tmp1, #TSK_TI_TTBR0]   // load saved TTBR0_EL1
-       msr     ttbr0_el1, \tmp1                // set the non-PAN TTBR0_EL1
-       isb
-       .endm
-
-       .macro  uaccess_ttbr0_disable, tmp1
-alternative_if_not ARM64_HAS_PAN
-       __uaccess_ttbr0_disable \tmp1
-alternative_else_nop_endif
-       .endm
-
-       .macro  uaccess_ttbr0_enable, tmp1, tmp2
-alternative_if_not ARM64_HAS_PAN
-       save_and_disable_irq \tmp2              // avoid preemption
-       __uaccess_ttbr0_enable \tmp1
-       restore_irq \tmp2
-alternative_else_nop_endif
-       .endm
-#else
-       .macro  uaccess_ttbr0_disable, tmp1
-       .endm
-
-       .macro  uaccess_ttbr0_enable, tmp1, tmp2
-       .endm
-#endif
-
-/*
- * These macros are no-ops when UAO is present.
- */
-       .macro  uaccess_disable_not_uao, tmp1
-       uaccess_ttbr0_disable \tmp1
-alternative_if ARM64_ALT_PAN_NOT_UAO
-       SET_PSTATE_PAN(1)
-alternative_else_nop_endif
-       .endm
-
-       .macro  uaccess_enable_not_uao, tmp1, tmp2
-       uaccess_ttbr0_enable \tmp1, \tmp2
-alternative_if ARM64_ALT_PAN_NOT_UAO
-       SET_PSTATE_PAN(0)
-alternative_else_nop_endif
-       .endm
-
-#endif /* __ASSEMBLY__ */
-
 #endif /* __ASM_UACCESS_H */
index 2b79b8a89457bd70e20e24ba33c8029195e3284c..b0d708ff7f4e57523908fff7b5aeedcefd4fe243 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef __ASM_WORD_AT_A_TIME_H
 #define __ASM_WORD_AT_A_TIME_H
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifndef __AARCH64EB__
 
index 04de188a36c90b01ceb2bc87eb536798b994f794..ecf9298a12d48f11d5833dca0584d8ab028cf422 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/sysreg.h>
 #include <asm/system_misc.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cpufeature.h>
 
 #define CREATE_TRACE_POINTS
@@ -640,7 +640,7 @@ static int __init armv8_deprecated_init(void)
        }
 
        cpuhp_setup_state_nocalls(CPUHP_AP_ARM64_ISNDEP_STARTING,
-                                 "AP_ARM64_ISNDEP_STARTING",
+                                 "arm64/isndep:starting",
                                  run_all_insn_set_hw_mode, NULL);
        register_insn_emulation_sysctl(ctl_abi);
 
index 605df76f0a06c161b4adf64bb15e90d88328f82e..2bd426448fc190ce52a08208e9ff07fe7fa40a23 100644 (file)
@@ -140,7 +140,7 @@ static int clear_os_lock(unsigned int cpu)
 static int debug_monitors_init(void)
 {
        return cpuhp_setup_state(CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING,
-                                "CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING",
+                                "arm64/debug_monitors:starting",
                                 clear_os_lock, NULL);
 }
 postcore_initcall(debug_monitors_init);
index 4f0d76339414f9b9975a7d192a0e14a150e73152..923841ffe4a981669be9bea76d09540244550a1f 100644 (file)
@@ -31,7 +31,7 @@
 #include <asm/memory.h>
 #include <asm/ptrace.h>
 #include <asm/thread_info.h>
-#include <asm/uaccess.h>
+#include <asm/asm-uaccess.h>
 #include <asm/unistd.h>
 
 /*
index 1b3c747fedda51060d30fbd8a337870ca0291d6c..0296e79242402008837da11d97cfe682d711c18e 100644 (file)
@@ -1001,7 +1001,7 @@ static int __init arch_hw_breakpoint_init(void)
         * debugger will leave the world in a nice state for us.
         */
        ret = cpuhp_setup_state(CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING,
-                         "CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING",
+                         "perf/arm64/hw_breakpoint:starting",
                          hw_breakpoint_reset, NULL);
        if (ret)
                pr_err("failed to register CPU hotplug notifier: %d\n", ret);
index 1decd2b2c730cc58e35f8b52d01cda32ca772d47..f0593c92279bf6f8da6773111f1195b205ad09ae 100644 (file)
@@ -29,7 +29,7 @@
 #include <asm/debug-monitors.h>
 #include <asm/system_misc.h>
 #include <asm/insn.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq.h>
 #include <asm/sections.h>
 
index b7063de792f7845aab4e8eb40cb6f5b82f44ce21..c747a0fc5d7d174d59d0470127f35f6354fa5aaf 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/esr.h>
 #include <asm/fpsimd.h>
 #include <asm/signal32.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 
 struct compat_sigcontext {
index 3f9e15722473bc31dc9a1cf30ed52225dc2b5d7e..b37446a8ffdb89de0c7072ef576f7de9fa354fa6 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <asm/cputype.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/kvm.h>
 #include <asm/kvm_emulate.h>
 #include <asm/kvm_coproc.h>
index d7150e30438aef3bb3f29a8a41a73fbd4c5d4157..e88fb99c15616397e6c4bbc0dd9c26e504688d97 100644 (file)
@@ -17,7 +17,7 @@
  */
 #include <linux/linkage.h>
 
-#include <asm/uaccess.h>
+#include <asm/asm-uaccess.h>
 
        .text
 
index cfe13396085bef6e5dabbf6c0837735228ed1446..4b5d826895ff161347dec9dd48710d08bcc49699 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/linkage.h>
 
 #include <asm/cache.h>
-#include <asm/uaccess.h>
+#include <asm/asm-uaccess.h>
 
 /*
  * Copy from user space to a kernel buffer (alignment handled by the hardware)
index 718b1c4e2f85a7aa44be720815ba1c9dc9909c4a..47184c3a97da6faa4cce2e31b37f91d95d361ee6 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/linkage.h>
 
 #include <asm/cache.h>
-#include <asm/uaccess.h>
+#include <asm/asm-uaccess.h>
 
 /*
  * Copy from user space to user space (alignment handled by the hardware)
index e99e31c9acac81a26a762524471bec471735b541..351f0766f7a61c54a47427c6a6845521fda6066d 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/linkage.h>
 
 #include <asm/cache.h>
-#include <asm/uaccess.h>
+#include <asm/asm-uaccess.h>
 
 /*
  * Copy to user space from a kernel buffer (alignment handled by the hardware)
index da957693232203089181e3b3537552db26c8c3b4..83c27b6e6dca31007d3b9ae5bc1c48d66456e757 100644 (file)
@@ -23,7 +23,7 @@
 #include <asm/assembler.h>
 #include <asm/cpufeature.h>
 #include <asm/alternative.h>
-#include <asm/uaccess.h>
+#include <asm/asm-uaccess.h>
 
 /*
  *     flush_icache_range(start,end)
index 290a84f3351f706bd026e00364c2d433a4852aed..e04082700bb16c3598333de72b3c64659be63e5e 100644 (file)
@@ -524,7 +524,8 @@ EXPORT_SYMBOL(dummy_dma_ops);
 
 static int __init arm64_dma_init(void)
 {
-       if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
+       if (swiotlb_force == SWIOTLB_FORCE ||
+           max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
                swiotlb = 1;
 
        return atomic_pool_init();
index a78a5c401806c80ee63818c8d353f3ca44bf58d3..156169c6981ba09ef815308ae847d84ccc02e4f4 100644 (file)
@@ -88,21 +88,21 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
                        break;
 
                pud = pud_offset(pgd, addr);
-               printk(", *pud=%016llx", pud_val(*pud));
+               pr_cont(", *pud=%016llx", pud_val(*pud));
                if (pud_none(*pud) || pud_bad(*pud))
                        break;
 
                pmd = pmd_offset(pud, addr);
-               printk(", *pmd=%016llx", pmd_val(*pmd));
+               pr_cont(", *pmd=%016llx", pmd_val(*pmd));
                if (pmd_none(*pmd) || pmd_bad(*pmd))
                        break;
 
                pte = pte_offset_map(pmd, addr);
-               printk(", *pte=%016llx", pte_val(*pte));
+               pr_cont(", *pte=%016llx", pte_val(*pte));
                pte_unmap(pte);
        } while(0);
 
-       printk("\n");
+       pr_cont("\n");
 }
 
 #ifdef CONFIG_ARM64_HW_AFDBM
index 212c4d1e2f26df7f291270fb461abac912ce7161..716d1226ba6925babc28bc6c14dc175e739c7f57 100644 (file)
@@ -401,7 +401,8 @@ static void __init free_unused_memmap(void)
  */
 void __init mem_init(void)
 {
-       if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
+       if (swiotlb_force == SWIOTLB_FORCE ||
+           max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
                swiotlb_init(1);
 
        set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
index b41aff25426d6b360b24cf69300a51419a58eada..947830a459d2ca6ef83fb92a4d168b55ea5c659d 100644 (file)
@@ -49,7 +49,7 @@
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <asm/uaccess.h>
+#include <asm/asm-uaccess.h>
 #include <xen/interface/xen.h>
 
 
index 7c6cf14f09854aacd6f31cafedc39a88d451d18a..0d05fd095468396522986df51fdc4f17f42dcb62 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/module.h>
 
 #include <asm/checksum.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * GCC functions
index 4aedcab7cd4b9257343e8f0be68edea2b48cd77e..a89b893279bbbf90360b598e74b5949e4b00d5b4 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/notifier.h>
 
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ocd.h>
 #include <asm/mmu_context.h>
 #include <linux/kdebug.h>
index 8f1c63b9b9839bd8de2562c55b72013b2cfc99cf..b5fcc4914fe426164a856107fa05875caebd8182 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/unistd.h>
 #include <linux/tracehook.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ucontext.h>
 #include <asm/syscalls.h>
 
index a124c55733dbf7dc19e61aacbf74671ff149de83..4d9b69615979cfc33de7efe8b724fbe60a49cc54 100644 (file)
@@ -20,9 +20,9 @@
 
 static bool disable_cpu_idle_poll;
 
-static cycle_t read_cycle_count(struct clocksource *cs)
+static u64 read_cycle_count(struct clocksource *cs)
 {
-       return (cycle_t)sysreg_read(COUNT);
+       return (u64)sysreg_read(COUNT);
 }
 
 /*
index 85d635cd7b28f84045e5bf29e62e4aab53196f85..d9476825fc43873b6558ff942f1c356284fdf8cf 100644 (file)
@@ -12,7 +12,7 @@
 #include <asm/cacheflush.h>
 #include <asm/cachectl.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/syscalls.h>
 
 /*
index 4a32f2dd5ddc39120bb66c1c49e4bc49c630c940..9d3eb0cf8ccc3e9288949d2bc583943121639c57 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/blackfin.h>
 #include <asm/cacheflush.h>
 #include <asm/dma.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/early_printk.h>
 
 /*
index 18ab004aea1c95ef2a427d3eddb3d0664b5e98cb..b8b785dc4e3b38c920413d62e35f473d686e4a3f 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/proc_fs.h>
 
 #include <asm/current.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/blackfin.h>
 
index 4489efc528837f9bf6fd3e7bbb4ae94743906b09..0188c933b155be395539530e5051e135474bc754 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/kernel.h>
 #include <asm/dma.h>
 #include <asm/cacheflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Transfer the section to the L1 memory */
 int
index 6355e97d22b9b29fc7a875183c44812a90cd9ca5..6a9524ad04a5dcec696025a36aa17bea47950811 100644 (file)
@@ -475,7 +475,7 @@ static int __init bfin_pmu_init(void)
 
        ret = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
        if (!ret)
-               cpuhp_setup_state(CPUHP_PERF_BFIN, "PERF_BFIN",
+               cpuhp_setup_state(CPUHP_PERF_BFIN,"perf/bfin:starting",
                                  bfin_pmu_prepare_cpu, NULL);
        return ret;
 }
index fb9e95f1b719efaabcbc627eede3662f5db21d95..0e9fcf841d67c24fb77230e1a0d97d7a1c1b0272 100644 (file)
@@ -26,7 +26,7 @@
 
 #if defined(CONFIG_CYCLES_CLOCKSOURCE)
 
-static notrace cycle_t bfin_read_cycles(struct clocksource *cs)
+static notrace u64 bfin_read_cycles(struct clocksource *cs)
 {
 #ifdef CONFIG_CPU_FREQ
        return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod);
@@ -80,7 +80,7 @@ void __init setup_gptimer0(void)
        enable_gptimers(TIMER0bit);
 }
 
-static cycle_t bfin_read_gptimer0(struct clocksource *cs)
+static u64 bfin_read_gptimer0(struct clocksource *cs)
 {
        return bfin_read_TIMER0_COUNTER();
 }
index 04845aaf59858f81feebeeca6c45096b48c313d8..6a8e00a1f6d56b74f294586de606b707b642db00 100644 (file)
@@ -26,7 +26,7 @@
 static u32 sched_clock_multiplier;
 #define SCHED_CLOCK_SHIFT 16
 
-static cycle_t tsc_read(struct clocksource *cs)
+static u64 tsc_read(struct clocksource *cs)
 {
        return get_cycles();
 }
index 63f5560d6eb25df9fbf8b2a739748581c8482fc6..4cc72b0d1c1d9832457a3febe411d8a85dcff3a9 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/initrd.h>
 
 #include <asm/sections.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * ZERO_PAGE is a special page that is used for zero-initialized
index c903a9e53a47166d5715015b0b7f19b49459cb26..33558d270a53636c6ff1efceaa19500348b30279 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/wait.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "i2c.h"
 
 #define D(x)
index 0f3983241e606fa6e9f1d0ac4ee113ee58d5c75c..9ac75d68f1847f11352d76bdf9b2968fc6bc1f98 100644 (file)
@@ -27,7 +27,7 @@
 #include <asm/dma.h>
 #include <asm/io.h>
 #include <arch/svinto.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sync_serial.h>
 #include <arch/io_interface_mux.h>
 
index bfddfb99401f96845761627016c0cf4be037bec6..eca94c7d56e770b83af56cbc4e8238f35899d359 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/signal.h>
 #include <linux/security.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
index 7122d9773b13922184ee8077a3ffb503beef35d4..db30c98e4926ca71b3046f919f885d40485b31b9 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <asm/processor.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <arch/system.h>
 
 #define DEBUG_SIG 0
index 7001beda716c2c86077df3dc224d470244152965..96d004fe9740535bc8a09241e257903a45e7eb87 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <linux/ptrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <arch/sv_addr_ag.h>
 #include <arch/system.h>
 
index b964c667acedfd6fbc2583a2205a2898cb70eb1c..1ba7cc000dfc80266a7beb53ecb6c19386f989eb 100644 (file)
@@ -8,7 +8,7 @@
  * Pieces used from memcpy, originally by Kenny Ranerup long time ago.
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Asm:s have been tweaked (within the domain of correctness) to give
    satisfactory results for "gcc version 2.96 20000427 (experimental)".
index ed60588f846706675e2d2a85d174308ad021521b..75210cbe61ce36a82afce035eecb2c3eb5f552cb 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #include <linux/mm.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <arch/svinto.h>
 #include <asm/mmu_context.h>
index 0068fd411a8473707efb4a1718e33edee0fdbb50..ae6903d7fdbe08c25a7fa23439d228b345d1a874 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/spinlock.h>
 #include <linux/stddef.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/atomic.h>
 
index fe1f9cf7b391e54c9b973b07fe00d29ab6099ec5..c366bc05466a66d0f5c19213962928492c168f53 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/signal.h>
 #include <linux/security.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
index 150d1d76c29d2e2c038141177145f82cbfc3b03a..816bf2ca93ef576f247c4f5b83b9a34d6d8af85d 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <arch/hwregs/cpu_vect.h>
 
 extern unsigned long cris_signal_return_page;
index 8bbe09c931322cf4311383ab6f2fe169f746f8a1..d79666aefd71c7ddfee719b007a7bfd426fcbf3d 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <linux/ptrace.h>
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <hwregs/supp_reg.h>
 #include <hwregs/intr_vect_defs.h>
 #include <asm/irq.h>
index f0f335d8aa7928101fd0bf1d8f7d80c0e2f950f6..05e58dab800d58abb8c2407a21e1beeb37a66f77 100644 (file)
@@ -8,7 +8,7 @@
  * Pieces used from memcpy, originally by Kenny Ranerup long time ago.
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Asm:s have been tweaked (within the domain of correctness) to give
    satisfactory results for "gcc version 3.2.1 Axis release R53/1.53-v32".
index 31b4bd288cada7755c112eafeeab386ba6f49e95..3166d1cf2f84a0149b8698c3691a2ab56601a2c2 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/tty.h>
 
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/checksum.h>
 #include <asm/io.h>
 #include <asm/delay.h>
index b78498eb079b14e2930208d963c5e9dd87f57a1f..50a7dd451456cc808e80fddbba845f97fb09e6b9 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <linux/atomic.h>
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
index cd9f15b92f8f152cacb69c68abf59aea81833afe..ad56b37f8e11b204a856854d9e4e157706908475 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <asm/ptrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define SAMPLE_BUFFER_SIZE 8192
 
index fd3427e563c55b35cd440fd0619ce4a612fa5ad3..806b764059d5c6a4cd5c8b7cd51b01419d7ad74c 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/user.h>
 #include <linux/tracehook.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
index 7aa036ec78ff8a39e97d0be7ce12b24d1eb521ee..8febb032fdd783abdd365c539bcaef8c603bebc4 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/file.h>
 #include <linux/ipc.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/segment.h>
 
 asmlinkage long
index da4c72401e277f66ccfea6661a654a9f4a5d585e..b2a312a7afc6b8897283ccffd5df8e02c4da73bc 100644 (file)
@@ -20,7 +20,7 @@
 #endif
 
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <arch/system.h>
 
 extern void arch_enable_nmi(void);
index 4bea27f50a7ab4f72d8cbb28cecf181c89e9cf28..2e1da71e27a45a75f96ef0b91d1f35a71480b2c4 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <linux/futex.h>
 #include <asm/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 extern int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr);
 
index 2239346fa3db6e8ad72aba63344e3d8b08120c53..93513e4ccd2bd74ef6c86493a2b103d4519ba4e8 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/atomic.h>
 #include <asm/io.h>
 #include <asm/smp.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/delay.h>
 #include <asm/irq.h>
index eaa7b582ef52f17f017195c6946aa68fbafcef6c..8358e34a3fad790c908602827601c8a3760efdf4 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/sysctl.h>
 #include <linux/errno.h>
 #include <linux/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/mb86943a.h>
 
index ac767d94a8800962c37e5b3df4e3e025fba93680..051ccecbf7f1d1bba16758369f07b0da5ec6c7d7 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/sysctl.h>
 #include <linux/errno.h>
 #include <linux/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/mb86943a.h>
 
index 5d40aeb7712e9bf2fec6c996313ad946ca7771e5..b306241c4ef22ff7ba42eaac0538b76b4fc0c806 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/rcupdate.h>
 
 #include <asm/asm-offsets.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/setup.h>
 #include <asm/pgtable.h>
 #include <asm/tlb.h>
index 3987ff88dab0cd14d6273a05b86b6c8aef07d94a..49768401ce0fe2c15c4b72cbb8a37f4668168bd1 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/elf.h>
 #include <linux/tracehook.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
index 82d5e914dc1591c010130068bcd517777dd54bd5..bf6e07a7a1b1c6a1594bc5a4fe1cf7ab6c1e9e6c 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/personality.h>
 #include <linux/tracehook.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 
 #define DEBUG_SIG 0
index 9c4980825bbbd9202a5038bf32cd83a56b1cd05d..f80cc8b9bd45a71dc1a1e4a88e94377829dfc161 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/ipc.h>
 
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
                          unsigned long prot, unsigned long flags,
index f4dfae2c75ada63d5aadb55d317effd7708a999c..b54a64971cf1da50855ba46700f500222e632e87 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/sysctl.h>
 #include <linux/proc_fs.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static const char frv_cache_wback[] = "wback";
 static const char frv_cache_wthru[] = "wthru";
index a6d105d61b268d09dea36de65e367abde64994c8..31221fb4348e2200951da6aac9d61b22960f74c9 100644 (file)
@@ -23,7 +23,7 @@
 #include <asm/asm-offsets.h>
 #include <asm/setup.h>
 #include <asm/fpu.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/siginfo.h>
 #include <asm/unaligned.h>
index 374f88d6cc00d0c32fffd03f5c7b3a8b1af395ee..8b360b4222a5cc876f7aa6f3a11498c7f8f4b76f 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <linux/mm.h>
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*****************************************************************************/
 /*
index 7a73aaeae3ac987fe5a0d5c8d659d7fde472a9f7..e701aa9e6a146049090fa113270338e9e75e355f 100644 (file)
@@ -44,7 +44,7 @@
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/mmu.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/smp.h>
 
 static int map_page(unsigned long va, unsigned long pa, pgprot_t prot)
index 8863d6c1df6e40575841ba5c1bbb4c51997e332c..9a641c1b085a326315153be4c7925a064ee71714 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <linux/module.h>
 #include <linux/spinlock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 extern const void __memset_end, __memset_user_error_lr, __memset_user_error_handler;
 extern const void __memcpy_end, __memcpy_user_error_lr, __memcpy_user_error_handler;
index 9f64fe8f29ff2dc95d13b6e02746f3333b4d4074..a947dbb4fd91d815f478171ab005a2e8c1e433f2 100644 (file)
@@ -9,7 +9,7 @@
  * Adapted for h8300 by Yoshinori Sato 2006
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * gzip declarations
index dee41256922c867141e105c1d7232bc6427f25d8..891974a1170440212cb899c9e8746f542a17be54 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/slab.h>
 #include <linux/rcupdate.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/traps.h>
 #include <asm/setup.h>
 #include <asm/pgtable.h>
index 7138303cbbf25dfd7fb03c6fe177199e441617ab..d784f7117f9abeeae7b64dcfb0d4a9bb6a3cf880 100644 (file)
@@ -41,7 +41,7 @@
 #include <linux/tracehook.h>
 
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/traps.h>
 #include <asm/ucontext.h>
index c041d8ecb1e2fd9f4b7b45035627968980488bde..af9dec4c28eb2aca42c2931fb20e0cff88959c6f 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/dma-mapping.h>
 #include <asm/hexagon_vm.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Additional functions */
 EXPORT_SYMBOL(__clear_user_hexagon);
index b039a624c170a331b05e28a1d0f1bdb22f76d7ba..c6b22b9945a72f15e7184eaa47935cb571df6378 100644 (file)
@@ -24,7 +24,7 @@
 #include <asm/registers.h>
 #include <asm/thread_info.h>
 #include <asm/unistd.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ucontext.h>
 #include <asm/cacheflush.h>
 #include <asm/signal.h>
index a6a1d1f8309a40918e0e884715a09380d45c6d18..ff4e9bf995e91cec460232ebdb9a878f073957c9 100644 (file)
@@ -72,9 +72,9 @@ struct adsp_hw_timer_struct {
 /*  Look for "TCX0" for related constants.  */
 static __iomem struct adsp_hw_timer_struct *rtos_timer;
 
-static cycle_t timer_get_cycles(struct clocksource *cs)
+static u64 timer_get_cycles(struct clocksource *cs)
 {
-       return (cycle_t) __vmgettime();
+       return (u64) __vmgettime();
 }
 
 static struct clocksource hexagon_clocksource = {
index 34127261c2b7124d4fc43e36ddb7bb84dcf7900b..ec90afdb3ad084e999e6980077aff846564f7b7c 100644 (file)
@@ -23,7 +23,7 @@
  * we implement here as subroutines.
  */
 #include <linux/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 
 /*
index bd7c251e2bced3424c6ad74c5ec8e11c6e42dd9f..de863d6d802b899e79b436160dec66dfd949e918 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/mm.h>
 #include <linux/signal.h>
 #include <linux/module.h>
index 0b286ca164f9cf36fbecf9656b6830d193f710ee..8682df6263d6d35ad75e85bcdfe48175617f4b3c 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>
 
 extern char ia64_set_b1, ia64_set_b2, ia64_set_b3, ia64_set_b4, ia64_set_b5;
index c8c9298666fb65cefdf1b5991b7dafa3ad8238dc..9c12b794e7741ee380c52f30acca3145d59b2c31 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/crash_dump.h>
 
 #include <asm/page.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /**
  * copy_oldmem_page - copy one page from "oldmem"
index 5fa3848ba22497c34d68e4f0e3f4069f79c73d09..ee1a4afbf9da0167ffa80e9bd8a775c4cffd71c8 100644 (file)
@@ -21,9 +21,9 @@ void __init cyclone_setup(void)
 
 static void __iomem *cyclone_mc;
 
-static cycle_t read_cyclone(struct clocksource *cs)
+static u64 read_cyclone(struct clocksource *cs)
 {
-       return (cycle_t)readq((void __iomem *)cyclone_mc);
+       return (u64)readq((void __iomem *)cyclone_mc);
 }
 
 static struct clocksource clocksource_cyclone = {
index 146b15b5fec30f34d4c78df1a390870b34781aaa..dcc5149177315a4a4aabcb78a70298cbc9eb1f72 100644 (file)
@@ -9,15 +9,15 @@ struct fsyscall_gtod_data_t {
        seqcount_t      seq;
        struct timespec wall_time;
        struct timespec monotonic_time;
-       cycle_t         clk_mask;
+       u64             clk_mask;
        u32             clk_mult;
        u32             clk_shift;
        void            *clk_fsys_mmio;
-       cycle_t         clk_cycle_last;
+       u64             clk_cycle_last;
 } ____cacheline_aligned;
 
 struct itc_jitter_data_t {
        int             itc_jitter;
-       cycle_t         itc_lastcycle;
+       u64             itc_lastcycle;
 } ____cacheline_aligned;
 
index 0eaa89f3defd5d8b8f5abf0b7b1e0d1f35ac8d2d..fa8ee64adac2ff21bdb557a5c07d3bbdd2a9d9db 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/init_task.h>
 #include <linux/mqueue.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
index de4fc00dea98a8a6208cf7d50c805e7c5cd1bd0b..2ff1df7b14eaf7e619096aaf4de6fcafa3729bf0 100644 (file)
@@ -17,7 +17,7 @@
  */
 
 #include <asm/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/seq_file.h>
 #include <linux/interrupt.h>
index c7c51445c3be32d95ef3704e3b87e3e908b4f9a6..45ff27e9edbb1cd0e179c0b185f151e9d027942a 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/sections.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 extern void jprobe_inst_return(void);
 
index 2436ad5f92c17045987219e77d8c45b6145e5465..677a86826771a4451b6fb595b8013899cf1b29cf 100644 (file)
@@ -50,7 +50,7 @@
 #include <asm/perfmon.h>
 #include <asm/processor.h>
 #include <asm/signal.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/delay.h>
 
 #ifdef CONFIG_PERFMON
index aae6c4dc7ae7f5f51a328411af58c94e21c0cd88..52deab683ba137517c8dcbfaa0a863a1575b05b0 100644 (file)
@@ -41,7 +41,7 @@
 #include <asm/sal.h>
 #include <asm/switch_to.h>
 #include <asm/tlbflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unwind.h>
 #include <asm/user.h>
 
index 36f660da81242f6cb13be8ded36f4d80bad4759d..0b1153e610ea3ce11b87c9096949c0130a7b4d98 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/processor.h>
 #include <asm/ptrace_offsets.h>
 #include <asm/rse.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unwind.h>
 #ifdef CONFIG_PERFMON
 #include <asm/perfmon.h>
index aaf74f36cfa1cd9dd2334c7fc4a0d331ad00649f..d194d5c83d321ece1ca8139aeffd616c0b766ce8 100644 (file)
@@ -48,7 +48,7 @@
 #include <linux/semaphore.h>
 
 #include <asm/sal.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 MODULE_AUTHOR("Jesse Barnes <jbarnes@sgi.com>");
 MODULE_DESCRIPTION("/proc interface to IA-64 SAL features");
index b3a124da71e5ec7cd960dc5e18096379ed0f860d..5db52c6813c418e5c6820d32ca1283e215c5a1e0 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/wait.h>
 
 #include <asm/intrinsics.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/rse.h>
 #include <asm/sigcontext.h>
 
index 41e33f84c18511ffcf0164e7d18613369974a343..a09c12230bc507f1825f563336d5b8b614dbf084 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/hugetlb.h>
 
 #include <asm/shmparam.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 unsigned long
 arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len,
index 021f44ab4bfb84493bde9dec03183463bd899b7e..71775b95d6cc06cd9d8d8e9cadbf3fdb5333f967 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "fsyscall_gtod_data.h"
 
-static cycle_t itc_get_cycles(struct clocksource *cs);
+static u64 itc_get_cycles(struct clocksource *cs);
 
 struct fsyscall_gtod_data_t fsyscall_gtod_data;
 
@@ -323,7 +323,7 @@ void ia64_init_itm(void)
        }
 }
 
-static cycle_t itc_get_cycles(struct clocksource *cs)
+static u64 itc_get_cycles(struct clocksource *cs)
 {
        unsigned long lcycle, now, ret;
 
@@ -397,7 +397,7 @@ void update_vsyscall_tz(void)
 }
 
 void update_vsyscall_old(struct timespec *wall, struct timespec *wtm,
-                        struct clocksource *c, u32 mult, cycle_t cycle_last)
+                        struct clocksource *c, u32 mult, u64 cycle_last)
 {
        write_seqcount_begin(&fsyscall_gtod_data.seq);
 
index 77edd68c5161a60ce425d203f388029f15c38e1d..095bfaff82d0b14f04734c5b24c58819fb54237a 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/fpswa.h>
 #include <asm/intrinsics.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/setup.h>
 
 fpswa_interface_t *fpswa_interface;
index 7f0d31656b4d9d2069c904ae474ef46a29e6f966..9cd01c2200eee782a4c2ada82759cca02719a653 100644 (file)
@@ -22,7 +22,7 @@
 #include <asm/intrinsics.h>
 #include <asm/processor.h>
 #include <asm/rse.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 
 extern int die_if_kernel(char *str, struct pt_regs *regs, long err);
index 8f66195999e717a94f87b9f04c5116882be70fb5..9704e2cd9878cfaf3ec91badec8c51d10299aac2 100644 (file)
@@ -41,7 +41,7 @@
 #include <asm/ptrace_offsets.h>
 #include <asm/rse.h>
 #include <asm/sections.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "entry.h"
 #include "unwind_i.h"
index 118daf5a0632cc505f2f88574ab645c4b79e14a5..42f7678ef6ad13291206a51fb5b035dc8e7c30b5 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/types.h>
 #include <linux/string.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * XXX Fixme: those 2 inlines are meant for debugging and will go away
index 8f70bb2d0c37bc0df8bc264e5ac032e8c25e6c84..4edb816aba9a27131491feeb0dfadffc82d2204d 100644 (file)
@@ -5,7 +5,7 @@
  *     David Mosberger-Tang <davidm@hpl.hp.com>
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 void
 ia64_handle_exception (struct pt_regs *regs, const struct exception_table_entry *e)
index 1841ef69183d8742db20194334f248b88ffac4a4..bb4610faca84fec73b70c57f2e9276ad37fcc8bf 100644 (file)
@@ -31,7 +31,7 @@
 #include <asm/sal.h>
 #include <asm/sections.h>
 #include <asm/tlb.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/mca.h>
 
index b9992571c0368a123bffd493571478af6180fde8..4c3b84d8406a8b5b0cc1888681fe2f85a356dc99 100644 (file)
@@ -37,7 +37,7 @@
 
 #include <asm/processor.h>
 #include <asm/topology.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sal.h>
 #include <asm/sn/io.h>
 #include <asm/sn/sn_sal.h>
index 7aab87f480608959c5582b613b3a59fe431f4db2..29cf8f8c08e9bf73f5a2c791edbed4238c392226 100644 (file)
@@ -9,7 +9,7 @@
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sn/sn_sal.h>
 
 static int partition_id_show(struct seq_file *s, void *p)
index abab8f99e9139a7822b22f166ffe3c6e03700863..66edc36426edecfd69649c542572fae469e526fe 100644 (file)
@@ -22,9 +22,9 @@
 
 extern unsigned long sn_rtc_cycles_per_second;
 
-static cycle_t read_sn2(struct clocksource *cs)
+static u64 read_sn2(struct clocksource *cs)
 {
-       return (cycle_t)readq(RTC_COUNTER_ADDR);
+       return (u64)readq(RTC_COUNTER_ADDR);
 }
 
 static struct clocksource clocksource_sn2 = {
index e35f6485c1fd1964cfb4f379dd89497e52dc4de8..32d0380eb72e9d8f0e8907185db1bc70f409e3a6 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/capability.h>
 #include <linux/device.h>
 #include <linux/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sn/sn_sal.h>
 #include <asm/sn/addrs.h>
 #include <asm/sn/io.h>
index ab871ccd33f82f5318d0218669cce79e101c7adc..ec51e5b34860bcfd5ccca990e78ef9553b566450 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #include <asm/ptrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static int get_reg(struct pt_regs *regs, int nr)
 {
index c7272b8942835adb9f39a80d8026ea6cbfd42798..5537f73972976cdfb634144fbb9424e9bcbd5984 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/kernel_stat.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * do_IRQ handles all normal device IRQs (the special
index 23f26f4adfff5d0d32674710724dda81b3a9bcf8..d763f0bd210692e32696a4acc054380f438d91c2 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/string.h>
 
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/checksum.h>
 #include <asm/io.h>
 #include <asm/delay.h>
index a88b1f01e91f380c45bce48fd6fa697487727a9f..e0568bee60c072b3c23f0aedd1c7a754d09cadf7 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/rcupdate.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/elf.h>
 #include <asm/m32r.h>
index c145605a981ff4fbc441ffe4512a6167147f6bec..a68acb9fa515c1cfd9b17ab0b3eab23fa3737924 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <asm/cacheflush.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/mmu_context.h>
index 1c81e24fd0064a2c428ee88da199ac101f5d1169..1ed597041fba46b85961ec31a77481652843e082 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/tracehook.h>
 #include <asm/cacheflush.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define DEBUG_SIG 0
 
index c3fdd632fba70cf99f142e959fa63b65be1155a8..f34957032504e3dfa10a159caae7588dd1be9992 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/utsname.h>
 #include <linux/ipc.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cachectl.h>
 #include <asm/cacheflush.h>
 #include <asm/syscall.h>
index a7a424f852e48f12226d54af21e9073b9d43de3e..c3c5fdfae920d5535cf18cde389cde6dc6b1b541 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/page.h>
 #include <asm/processor.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/atomic.h>
 
index 5596f3df833f61eab47ff522dfe6d29aa6b7e1d9..b3cd59c12b8e6e8126b717bfaed012007b138fb1 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <net/checksum.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * Copy while checksumming, otherwise like csum_partial
index 82abd159dbef495253bb2989093f86809b085ca5..fd03f2731f2005591e224ef7b4bbc5d3073d05a7 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/prefetch.h>
 #include <linux/string.h>
 #include <linux/thread_info.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 unsigned long
 __generic_copy_to_user(void __user *to, const void *from, unsigned long n)
index 1743f23d49a320a8d1e0dec3b63942d8c8475e80..40ccf80d29cf5457b472b3af3af5fba4a9ddcf87 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int fixup_exception(struct pt_regs *regs)
 {
index 80f18cc6f5473be787a92f8dbea0305a00a359d5..e22d5ddae5cbf35c885561d3d4bda96973e3fa9b 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/vt_kern.h>              /* For unblank_screen() */
 
 #include <asm/m32r.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
 #include <asm/hardirq.h>
index 99a98698bc959035fb89c2d004a02800abcf81a4..252455bce1446b5c3734b054b27afaa85733c9ef 100644 (file)
@@ -76,7 +76,7 @@ static struct irqaction m68328_timer_irq = {
 
 /***************************************************************************/
 
-static cycle_t m68328_read_clk(struct clocksource *cs)
+static u64 m68328_read_clk(struct clocksource *cs)
 {
        unsigned long flags;
        u32 cycles;
index f7984f44ff0f807267d1f95e2e1a81350db28585..d53c9b301f84af754677190bcd021f50595bd3af 100644 (file)
@@ -20,7 +20,7 @@
 #include <asm/bvme6000hw.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/setup.h>
 
 /*
index 235ad57c470798c9538fab0fab7fef4936bd7a3c..8273eea5787455d34e93f281b9c368d490bde9e3 100644 (file)
@@ -34,7 +34,7 @@
 #define DMA_DTMR_CLK_DIV_16    (2 << 1)
 #define DMA_DTMR_ENABLE                (1 << 0)
 
-static cycle_t cf_dt_get_cycles(struct clocksource *cs)
+static u64 cf_dt_get_cycles(struct clocksource *cs)
 {
        return __raw_readl(DTCN0);
 }
index d86a9ffb3f13eadde3ee66380945b8932622dc93..175553d5b8ed8ff3d65a1501a662f75498853c51 100644 (file)
@@ -118,7 +118,7 @@ static struct irqaction pit_irq = {
 
 /***************************************************************************/
 
-static cycle_t pit_read_clk(struct clocksource *cs)
+static u64 pit_read_clk(struct clocksource *cs)
 {
        unsigned long flags;
        u32 cycles;
index 831a08cf6f40d7e6e6c28594035a75e0c6a8b1c7..3292c0d68b18b69ddbdce8a37d24dfa06d6d8c27 100644 (file)
@@ -97,7 +97,7 @@ static struct irqaction mcfslt_timer_irq = {
        .handler = mcfslt_tick,
 };
 
-static cycle_t mcfslt_read_clk(struct clocksource *cs)
+static u64 mcfslt_read_clk(struct clocksource *cs)
 {
        unsigned long flags;
        u32 cycles, scnt;
index cd496a20fcc7ced7b802e705badcae2417eb2256..2dc7a58204f654b69af1b6323927dd5cf2934071 100644 (file)
@@ -89,7 +89,7 @@ static struct irqaction mcftmr_timer_irq = {
 
 /***************************************************************************/
 
-static cycle_t mcftmr_read_clk(struct clocksource *cs)
+static u64 mcftmr_read_clk(struct clocksource *cs)
 {
        unsigned long flags;
        u32 cycles;
index 4ba1ae7345c324c9ce68c0f6d255054de0789f74..aaf28f8e342d27885f6dcbdca74d8f11b43d23af 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/mqueue.h>
 #include <linux/rcupdate.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/traps.h>
 #include <asm/machdep.h>
 #include <asm/setup.h>
index 1bc10e62b9affa45f8938f1f0150431971bffcde..9cd86d7343a63838cb2b4531dbeb20c811de5edf 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/signal.h>
 #include <linux/tracehook.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
index 58507edbdf1d5fa80526ea4bfa93a3d44418f310..8ead291a902a346765fe995eee1e39ad1171e542 100644 (file)
@@ -46,7 +46,7 @@
 #include <linux/tracehook.h>
 
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/traps.h>
 #include <asm/ucontext.h>
index 9aa01adb407fd3cfa25f6b1de395e01973392ff3..98a2daaae30cdb18526af2eda1d606040ac5ac37 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/ipc.h>
 
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cachectl.h>
 #include <asm/traps.h>
 #include <asm/page.h>
index 6c9ca24830e9829d7be7761bdd528a765e8b7d2f..558f3840273783ac5cc00296081b5a34c49f66cc 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <asm/setup.h>
 #include <asm/fpu.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/traps.h>
 #include <asm/pgalloc.h>
 #include <asm/machdep.h>
index 35d1442dee899af023a2e801401f8dc319272779..a76b73abaf6491d01feccd6ac750ac2d65456355 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 unsigned long __generic_copy_from_user(void *to, const void __user *from,
                                       unsigned long n)
index 0fb54a90eac273054ccb7dd618caf69c668e9fe4..c6d351f5bd79aacd8faa7a091fb3b24325547635 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/cuda.h>
 #include <linux/pmu.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/segment.h>
 #include <asm/setup.h>
index b09a3cb29b68fda44ba224fda84743bdfaaeded2..9c1e656b1f8f581727daf981a1d747beb88d1651 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/gfp.h>
 
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/traps.h>
index 8f37fdd80be9e9ccec99b1d4509f3c97a94f0899..7cb72dbc2eaa78bdfeb0eaed19d2fd91b6888b39 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/gfp.h>
 
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/machdep.h>
index 269f81158a33108e9568e83f096acd9c750b1814..b5b7d53f7283833b364ffa7f4ec86d0727fb4c4e 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/bootmem.h>
 
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/machdep.h>
index 1cdc732681885e9a5973b4fb25aeca2f922a1f5e..8f00847a0e4be37940d6c3292b21e915b7c1de1d 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/mvme16xhw.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/setup.h>
 
 /*
index 3f258e230ba5d0c95806848ef96c64ce1160d479..0f95134e9b858f2af09256214b34da0c277a40f5 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <asm/setup.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/sun3mmu.h>
index 3074b64793e6fc9b57e8ac772c8e26274c36d8b6..c9939604a38f03a5c4ceb2943348d965b16c1711 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <asm/core_reg.h>
 #include <asm/mach/arch.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_4KSTACKS
 union irq_ctx {
index 052cba23708c57bff289c74b386440268d7c2ba1..7e793eb0c1fe1b7053d709e04612a51f9b8456af 100644 (file)
@@ -868,7 +868,7 @@ static int __init init_hw_perf_events(void)
        metag_out32(0, PERF_COUNT(1));
 
        cpuhp_setup_state(CPUHP_AP_PERF_METAG_STARTING,
-                         "AP_PERF_METAG_STARTING", metag_pmu_starting_cpu,
+                         "perf/metag:starting", metag_pmu_starting_cpu,
                          NULL);
 
        ret = perf_pmu_register(&pmu, metag_pmu->name, PERF_TYPE_RAW);
index 9e954959f60504cd7cf04d1c8c58f897bf6cea76..1d6fad50fa76f60f89fc15f244f767d5846c3471 100644 (file)
@@ -190,17 +190,17 @@ static u64 xilinx_clock_read(void)
        return read_fn(timer_baseaddr + TCR1);
 }
 
-static cycle_t xilinx_read(struct clocksource *cs)
+static u64 xilinx_read(struct clocksource *cs)
 {
        /* reading actual value of timer 1 */
-       return (cycle_t)xilinx_clock_read();
+       return (u64)xilinx_clock_read();
 }
 
 static struct timecounter xilinx_tc = {
        .cc = NULL,
 };
 
-static cycle_t xilinx_cc_read(const struct cyclecounter *cc)
+static u64 xilinx_cc_read(const struct cyclecounter *cc)
 {
        return xilinx_read(NULL);
 }
index 921ed30b440cf2dca5a92807b67709798fa82b8f..303257b697c253b4b1afed4df2475f93e3230229 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/sysctl.h>
 #include <linux/jiffies.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mach-au1x00/au1000.h>
 
 /*
index f99d3ec17a459237a05dd76253ed7ef26d5bbca9..e1bec5a77c3941ee17cdcc114b8981a6c3c188cf 100644 (file)
@@ -44,7 +44,7 @@
 /* 32kHz clock enabled and detected */
 #define CNTR_OK (SYS_CNTRL_E0 | SYS_CNTRL_32S)
 
-static cycle_t au1x_counter1_read(struct clocksource *cs)
+static u64 au1x_counter1_read(struct clocksource *cs)
 {
        return alchemy_rdsys(AU1000_SYS_RTCREAD);
 }
index 23c2344a35525fa9a0badfb3bbca9a89d60293c5..39f153fe0022a349791fcc2c605b83b5a8fc027b 100644 (file)
@@ -98,7 +98,7 @@ void octeon_init_cvmcount(void)
        local_irq_restore(flags);
 }
 
-static cycle_t octeon_cvmcount_read(struct clocksource *cs)
+static u64 octeon_cvmcount_read(struct clocksource *cs)
 {
        return read_c0_cvmcount();
 }
index 44d8a87a8a689580e26989e0410a7b4d24ee02ed..e9d2db480aebb18bb756b0f35e48d5b22951839e 100644 (file)
@@ -23,7 +23,7 @@
 #include <asm/page.h>
 #include <asm/ptrace.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/dec/kn01.h>
 
index bce1ce53149a89a574c27fb53adb9de0dcc24389..7749daf2a46594cbf9c2dc9a6334fbcd514ca3a5 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <linux/in6.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * computes the checksum of a memory block at buff, length len,
index 64e0b9343b8c395537604f68a7be06aaea5d757a..4c61764671468c0bf38ae6f92513eddca86d7c43 100644 (file)
@@ -8,7 +8,7 @@
 #include <asm/signal.h>
 #include <asm/siginfo.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d,
        const sigset_t *s)
index 667ca3c467b71c3fab5c65137c01a612b7c6ad90..b42b513007a2c3da70480fd7dd86d990bb0bc874 100644 (file)
@@ -20,7 +20,7 @@
 #include <asm/cpu-features.h>
 #include <asm/cpu-type.h>
 #include <asm/mipsmtregs.h>
-#include <asm/uaccess.h> /* for segment_eq() */
+#include <linux/uaccess.h> /* for segment_eq() */
 
 extern void (*r4k_blast_dcache)(void);
 extern void (*r4k_blast_icache)(void);
index 6245b68a69a84973a5cd9059dde666ae8ff77eec..ce2d72e34274c0f2d2e217277aa6706ab5f4cb93 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef _ASM_TERMIOS_H
 #define _ASM_TERMIOS_H
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <uapi/asm/termios.h>
 
 /*
index db6f5afff4ff1a785a0b0ae8913ebe06b3061260..1900f39588ae07a6ad351c110157d52ff46821c0 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/mipsregs.h>
 #include <asm/jazz.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/dma.h>
 #include <asm/jazzdma.h>
 #include <asm/pgtable.h>
index 1f7ca2c9f26259c52382e091dbef166a41e046f6..bcf8f8c6273774f63e56efcbb6e423cb7b6bf5b2 100644 (file)
@@ -34,7 +34,7 @@
 
 static uint16_t jz4740_jiffies_per_tick;
 
-static cycle_t jz4740_clocksource_read(struct clocksource *cs)
+static u64 jz4740_clocksource_read(struct clocksource *cs)
 {
        return jz4740_timer_get_count(TIMER_CLOCKSOURCE);
 }
index 12c718181e5e3ee5e5cc51cca92bc16f408fbe0a..ae037a304ee459a6d0fff9c61e53ac6b4b4c8335 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/inst.h>
 #include <asm/mips-r2-to-r6-emul.h>
 #include <asm/ptrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * Calculate and return exception PC in case of branch delay slot
index 537eefdf838fec40cc0a947008c01ea0084ca0b3..aaca60d6ffc31f4320e740ac27b6b986065772b5 100644 (file)
@@ -27,7 +27,7 @@ struct txx9_clocksource {
        struct txx9_tmr_reg __iomem *tmrptr;
 };
 
-static cycle_t txx9_cs_read(struct clocksource *cs)
+static u64 txx9_cs_read(struct clocksource *cs)
 {
        struct txx9_clocksource *txx9_cs =
                container_of(cs, struct txx9_clocksource, cs);
index dd3175442c9e6791231f0f467e9c1bbf9f2f4384..07718bb5fc9d8612d98cc78d46a7ca10851f8245 100644 (file)
@@ -30,7 +30,7 @@
 #include <asm/elf.h>
 #include <asm/pgtable-bits.h>
 #include <asm/spram.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Hardware capabilities */
 unsigned int elf_hwcap __read_mostly;
index 6fe7790e5868e71812dc30f552590452248aca34..77ee99a2d0aaee816a86ec6da23b8d35ede7d7df 100644 (file)
@@ -1,7 +1,7 @@
 #include <linux/highmem.h>
 #include <linux/bootmem.h>
 #include <linux/crash_dump.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/slab.h>
 
 static void *kdump_buf_page;
index 7f65b53d1b242eda3a67c889c731956ddcdf5e1a..f011261e95061860c4590036f96670336eb3ea91 100644 (file)
@@ -25,9 +25,9 @@
 
 #include <asm/sibyte/sb1250.h>
 
-static cycle_t bcm1480_hpt_read(struct clocksource *cs)
+static u64 bcm1480_hpt_read(struct clocksource *cs)
 {
-       return (cycle_t) __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT));
+       return (u64) __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT));
 }
 
 struct clocksource bcm1480_clocksource = {
index 722f5589cd1dcdb1ec8440ca5fa93af219deb7ce..f6acd1e58c26103b5ad13c0e6368523b7c375265 100644 (file)
@@ -22,7 +22,7 @@
 #include <asm/dec/ioasic.h>
 #include <asm/dec/ioasic_addrs.h>
 
-static cycle_t dec_ioasic_hpt_read(struct clocksource *cs)
+static u64 dec_ioasic_hpt_read(struct clocksource *cs)
 {
        return ioasic_read(IO_REG_FCTR);
 }
index d76275da54cb89df684a9575dd33461fd22da3d8..eed099f35bf13af6e1e05122017c90dd5ae283d3 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <asm/time.h>
 
-static cycle_t c0_hpt_read(struct clocksource *cs)
+static u64 c0_hpt_read(struct clocksource *cs)
 {
        return read_c0_count();
 }
index d915652b4d56f88585fdb16428c2761a85e32c11..b07b7310d3f422cd91c1a20f96b8a72c9cfa44f5 100644 (file)
@@ -30,7 +30,7 @@
  * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
  * again.
  */
-static inline cycle_t sb1250_hpt_get_cycles(void)
+static inline u64 sb1250_hpt_get_cycles(void)
 {
        unsigned int count;
        void __iomem *addr;
@@ -41,7 +41,7 @@ static inline cycle_t sb1250_hpt_get_cycles(void)
        return SB1250_HPT_VALUE - count;
 }
 
-static cycle_t sb1250_hpt_read(struct clocksource *cs)
+static u64 sb1250_hpt_read(struct clocksource *cs)
 {
        return sb1250_hpt_get_cycles();
 }
index f25f7eab7307e92ec22a17228a7afba68cd5327c..f8f5836eb3c1b202a4bc40dc8fcb433cae46444f 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/ftrace.h>
 
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * 'what should we do if we get a hw irq event on an illegal vector'.
index de63d36af895aaa3aa5e1c0469f9a70a00064bf0..1f4bd222ba765788fe8e9c1f14e382c59b60df62 100644 (file)
@@ -32,7 +32,7 @@
 #include <asm/cacheflush.h>
 #include <asm/processor.h>
 #include <asm/sigcontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static struct hard_trap_info {
        unsigned char tt;       /* Trap type code for MIPS R3xxx and R4xxx */
index 50fb62544df71a62d4457d998de415193c0ad90e..0352f742d07714fda6d1a758f92886e7977b53de 100644 (file)
@@ -38,7 +38,7 @@
 
 #include <asm/compat-signal.h>
 #include <asm/sim.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/mman.h>
 
index 789d7bf4fef3203b3038a9ddaf20c5f70f1bc948..a12904ea9f655c2c64c7381556c6c0a57b76252d 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/sched.h>
 #include <linux/security.h>
 #include <linux/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * CPU mask used to set process affinity for MT VPEs/TCs with FPUs
index bd09853aecdfa1e567717cc35a9d19e786468391..ef2ca28a028b04b4913d56d1f3a98f75718fd0f4 100644 (file)
@@ -29,7 +29,7 @@
 #include <asm/local.h>
 #include <asm/mipsregs.h>
 #include <asm/ptrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_64BIT
 #define ADDIU  "daddiu "
index e2b6ab74643dba93b403dbba2dcfb4eced3e6d9e..93aeec705a6eca9fb26e0e9f10da09b97b4a90d7 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/export.h>
 #include <asm/checksum.h>
 #include <linux/mm.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ftrace.h>
 #include <asm/fpu.h>
 #include <asm/msa.h>
index 7cf653e214237f75b22200c94f0e47c696be14ae..5f928c34c1489c1b054b105a37296f72d863d6f7 100644 (file)
@@ -713,7 +713,7 @@ static int __init cps_pm_init(void)
                pr_warn("pm-cps: no CPC, clock & power gating unavailable\n");
        }
 
-       return cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "AP_PM_CPS_CPU_ONLINE",
+       return cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "mips/cps_pm:online",
                                 cps_pm_online_cpu, NULL);
 }
 arch_initcall(cps_pm_init);
index 9514e5f2209ff69eca82a21e6309ca54fc53c42a..5142b1dfe8a70d47c3f99384cd1969a5f95329f5 100644 (file)
@@ -38,7 +38,7 @@
 #include <asm/mipsregs.h>
 #include <asm/processor.h>
 #include <asm/reg.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/elf.h>
 #include <asm/isadep.h>
index a92994d60e91e4b768ac6570012ad64c1c86885d..c8ba2607213298ab0e4a846ca0fa26ee908b253e 100644 (file)
@@ -41,7 +41,7 @@
 #include <asm/pgtable.h>
 #include <asm/page.h>
 #include <asm/syscall.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/bootinfo.h>
 #include <asm/reg.h>
 
index 5fcbdcd7abd0bcecff728726812aca54519608c7..4f0998525626678d9f154bf76ecb9d08c9fe2cf5 100644 (file)
@@ -32,7 +32,7 @@
 #include <asm/pgtable.h>
 #include <asm/page.h>
 #include <asm/reg.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/bootinfo.h>
 
 /*
index 97b7c51b825179c59388e341a496fa751e1a3d1c..84165f2b31ff60c6c6842d3d96b38f445b621839 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <asm/compat.h>
 #include <asm/compat-signal.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 
 #include "signal-common.h"
index a7bc384305008ece50b78c9ff72364e54c7af2e5..b672cebb4a1a507144cfc85964e4b39ac5ee70fa 100644 (file)
@@ -33,7 +33,7 @@
 #include <asm/cacheflush.h>
 #include <asm/compat-signal.h>
 #include <asm/sim.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ucontext.h>
 #include <asm/fpu.h>
 #include <asm/cpu-features.h>
index 53a7ef9a8f320c5b14c5abb2d3e1518c0ad7f756..833f82210528ab9b86a9a79cfc00b433b4bee12a 100644 (file)
@@ -36,7 +36,7 @@
 #include <asm/sim.h>
 #include <asm/shmparam.h>
 #include <asm/sysmips.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/switch_to.h>
 
 /*
index 3905003dfe2b918faa7acd39f350710c9ed6edd0..6c7f9d7e92b3e0dace551122460ff0df8ae89698 100644 (file)
@@ -61,7 +61,7 @@
 #include <asm/siginfo.h>
 #include <asm/tlbdebug.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/watch.h>
 #include <asm/mmu_context.h>
 #include <asm/types.h>
index f1c308dbbc4a5258b17071f73de57471c6ce499e..7ed98354fe9daabd4237690e9e73a4d8decaa826 100644 (file)
@@ -89,7 +89,7 @@
 #include <asm/fpu.h>
 #include <asm/fpu_emulator.h>
 #include <asm/inst.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define STR(x) __STR(x)
 #define __STR(x)  #x
index 6a02b3a3fa6513a4f517c31c88aa435ddc766f3a..e92fb190e2d628e878b209a14e8c8be551510654 100644 (file)
@@ -521,6 +521,9 @@ void *kvm_mips_build_exit(void *addr)
        uasm_i_and(&p, V0, V0, AT);
        uasm_i_lui(&p, AT, ST0_CU0 >> 16);
        uasm_i_or(&p, V0, V0, AT);
+#ifdef CONFIG_64BIT
+       uasm_i_ori(&p, V0, V0, ST0_SX | ST0_UX);
+#endif
        uasm_i_mtc0(&p, V0, C0_STATUS);
        uasm_i_ehb(&p);
 
@@ -643,7 +646,7 @@ static void *kvm_mips_build_ret_to_guest(void *addr)
 
        /* Setup status register for running guest in UM */
        uasm_i_ori(&p, V1, V1, ST0_EXL | KSU_USER | ST0_IE);
-       UASM_i_LA(&p, AT, ~(ST0_CU0 | ST0_MX));
+       UASM_i_LA(&p, AT, ~(ST0_CU0 | ST0_MX | ST0_SX | ST0_UX));
        uasm_i_and(&p, V1, V1, AT);
        uasm_i_mtc0(&p, V1, C0_STATUS);
        uasm_i_ehb(&p);
index 06a60b19acfb53c2788ba6b9c79de983bb6fe43e..29ec9ab3fd5570737caa7f5c63768177a5caffa7 100644 (file)
@@ -360,8 +360,8 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
        dump_handler("kvm_exit", gebase + 0x2000, vcpu->arch.vcpu_run);
 
        /* Invalidate the icache for these ranges */
-       local_flush_icache_range((unsigned long)gebase,
-                               (unsigned long)gebase + ALIGN(size, PAGE_SIZE));
+       flush_icache_range((unsigned long)gebase,
+                          (unsigned long)gebase + ALIGN(size, PAGE_SIZE));
 
        /*
         * Allocate comm page for guest kernel, a TLB will be reserved for
index ff224f0020e504da5e45f6c0e0264eba526b1669..e6f972d35252cabc0c41b0e8a26bd994e5631351 100644 (file)
@@ -63,7 +63,7 @@ void __init ls1x_pwmtimer_init(void)
        ls1x_pwmtimer_restart();
 }
 
-static cycle_t ls1x_clocksource_read(struct clocksource *cs)
+static u64 ls1x_clocksource_read(struct clocksource *cs)
 {
        unsigned long flags;
        int count;
@@ -107,7 +107,7 @@ static cycle_t ls1x_clocksource_read(struct clocksource *cs)
 
        raw_spin_unlock_irqrestore(&ls1x_timer_lock, flags);
 
-       return (cycle_t) (jifs * ls1x_jiffies_per_tick) + count;
+       return (u64) (jifs * ls1x_jiffies_per_tick) + count;
 }
 
 static struct clocksource ls1x_clocksource = {
index da77d412514c03db21e6577466a9c8b8e8ac158b..9edfa55a0e7828d5f1b7ba10d91bb627650d7d00 100644 (file)
@@ -144,7 +144,7 @@ void __init setup_mfgpt0_timer(void)
  * to just read by itself. So use jiffies to emulate a free
  * running counter:
  */
-static cycle_t mfgpt_read(struct clocksource *cs)
+static u64 mfgpt_read(struct clocksource *cs)
 {
        unsigned long flags;
        int count;
@@ -188,7 +188,7 @@ static cycle_t mfgpt_read(struct clocksource *cs)
 
        raw_spin_unlock_irqrestore(&mfgpt_lock, flags);
 
-       return (cycle_t) (jifs * COMPARE) + count;
+       return (u64) (jifs * COMPARE) + count;
 }
 
 static struct clocksource clocksource_mfgpt = {
index 4788bea62a6ab1dfe411dac5122f834a68e3ec3e..24afe364637bc447909329f06f8d9aa9c2e351ff 100644 (file)
@@ -248,9 +248,9 @@ void __init setup_hpet_timer(void)
        pr_info("hpet clock event device register\n");
 }
 
-static cycle_t hpet_read_counter(struct clocksource *cs)
+static u64 hpet_read_counter(struct clocksource *cs)
 {
-       return (cycle_t)hpet_read(HPET_COUNTER);
+       return (u64)hpet_read(HPET_COUNTER);
 }
 
 static void hpet_suspend(struct clocksource *cs)
index f8b7bf836437708b414548625e1c4451cf747020..a298ac93edcc01c00c3b05abc52d5b57340dbf79 100644 (file)
@@ -42,7 +42,7 @@
 #include <asm/inst.h>
 #include <asm/ptrace.h>
 #include <asm/signal.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/cpu-info.h>
 #include <asm/processor.h>
index 4a094f7acb3dfe1d9b72f51bb28eb0c31afefd65..c4469ff4a996bc2ec143441b5fe2d1fc37f1370a 100644 (file)
@@ -6,7 +6,7 @@
 #include <asm/fpu_emulator.h>
 #include <asm/inst.h>
 #include <asm/mipsregs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /**
  * struct emuframe - The 'emulation' frame structure
index e474fa2efed49fbe30467fc38c268717905684ac..81bc8a34a83facfae6adda86293e51a60923a1b7 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/extable.h>
 #include <linux/spinlock.h>
 #include <asm/branch.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int fixup_exception(struct pt_regs *regs)
 {
index 01f1154cdb0cd75f2c1f942c46ef09c7f3127e39..7e945e310b446bb1ff95660eaf00e5e5f61ca283 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <asm/bcache.h>
 #include <asm/debug.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/debugfs.h>
 #include <linux/init.h>
 
index 7407da04f8d6bc1cf0da21b4800530087f7d0c88..1829a9031eec7aaa2fd68727db9c111c0517ca81 100644 (file)
@@ -75,7 +75,7 @@ static void __init estimate_frequencies(void)
        unsigned int count, start;
        unsigned char secs1, secs2, ctrl;
        int secs;
-       cycle_t giccount = 0, gicstart = 0;
+       u64 giccount = 0, gicstart = 0;
 
 #if defined(CONFIG_KVM_GUEST) && CONFIG_KVM_GUEST_TIMER_FREQ
        mips_hpt_frequency = CONFIG_KVM_GUEST_TIMER_FREQ * 1000000;
index 5873c83e65be05bc0f07417c5d3929a4b41e61e2..cbbf0d48216be732ed3cc50ad01c5ee6fd36d3b5 100644 (file)
@@ -59,14 +59,14 @@ unsigned int get_c0_compare_int(void)
        return IRQ_TIMER;
 }
 
-static cycle_t nlm_get_pic_timer(struct clocksource *cs)
+static u64 nlm_get_pic_timer(struct clocksource *cs)
 {
        uint64_t picbase = nlm_get_node(0)->picbase;
 
        return ~nlm_pic_read_timer(picbase, PIC_CLOCK_TIMER);
 }
 
-static cycle_t nlm_get_pic_timer32(struct clocksource *cs)
+static u64 nlm_get_pic_timer32(struct clocksource *cs)
 {
        uint64_t picbase = nlm_get_node(0)->picbase;
 
index 85f3ee4ab4566145039480d78113b3847c51da85..436b1fc99f2ca82a9f994cd465f1e3a742659fd1 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/oprofile.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <irq.h>
 #include <loongson.h>
 #include "op_impl.h"
@@ -186,7 +186,7 @@ static int __init loongson3_init(void)
 {
        on_each_cpu(reset_counters, NULL, 1);
        cpuhp_setup_state_nocalls(CPUHP_AP_MIPS_OP_LOONGSON3_STARTING,
-                                 "AP_MIPS_OP_LOONGSON3_STARTING",
+                                 "mips/oprofile/loongson3:starting",
                                  loongson3_starting_cpu, loongson3_dying_cpu);
        save_perf_irq = perf_irq;
        perf_irq = loongson3_perfcount_handler;
index 712cc0f6a58d51c916ced11b610ced6c934028fc..9960a8302eac59962e5ad2b01920b7bfd1b6171a 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/sgi/ioc.h>
 #include <asm/sgi/ip22.h>
 #include <asm/r4kcache.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/bootinfo.h>
 
 static unsigned int count_be_is_fixup;
index 692778da9e76505dd3297b15afd3e72a65dc2b6f..2e0edb385656986f3256e26f21f898c1761fd5a7 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/sn/sn0/hub.h>
 #include <asm/tlbdebug.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static void dump_hub_information(unsigned long errst0, unsigned long errst1)
 {
index 42d6cb9f956e35500d5a1b3268685447ebd5f7f2..695c51bdd7dcb1ed84f1ce6f801c8dff3bcf874a 100644 (file)
@@ -140,7 +140,7 @@ static void __init hub_rt_clock_event_global_init(void)
        setup_irq(irq, &hub_rt_irqaction);
 }
 
-static cycle_t hub_rt_read(struct clocksource *cs)
+static u64 hub_rt_read(struct clocksource *cs)
 {
        return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT);
 }
index afc1cadbba37af08bca373fab6d0bcba8d4b6892..ba8f46d80ab8a54d5f535f12a2faeb7812faf9e4 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/addrspace.h>
 #include <asm/ptrace.h>
 #include <asm/tlbdebug.h>
index 059e28c8fd973f8e9e40ab23973e9a3fb71563cb..99c720be72d261abed3ff920f28716cdebafab51 100644 (file)
@@ -54,7 +54,7 @@
 #define K_INT_PERF_CNT K_BCM1480_INT_PERF_CNT
 #endif
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define SBPROF_TB_MAJOR 240
 
index 45644cf18c41245904722c405d7faeff4861838a..6b74df3661f22aa1dbf13b77b7b68702da0fbe98 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/timex.h>
 #include "internal.h"
 
-static cycle_t mn10300_read(struct clocksource *cs)
+static u64 mn10300_read(struct clocksource *cs)
 {
        return read_timestamp_counter();
 }
index 064fa194de2b0dfa3cd3a4c003fcc7e454944d12..2578b7ae7dd55e6a303f4e91c3058ab66ed38c57 100644 (file)
@@ -8,7 +8,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the Licence, or (at your option) any later version.
  */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/fpu.h>
 #include <asm/elf.h>
 #include <asm/exceptions.h>
index f9eb9753a4043341c79d33bd5d328ab028dce308..ec6c4f8f93a63072302803736db9ac4946547d53 100644 (file)
@@ -9,7 +9,7 @@
  * 2 of the Licence, or (at your option) any later version.
  */
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 
 
index cbede4e88dee0b2c6f0f6b3806c9e246e2f07f89..e5def2217f72db10b8635d566315c4c362be8372 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/fs.h>
 #include <linux/slab.h>
 #include <linux/rcupdate.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/processor.h>
index 5bd58514e739729a7fb5722b39b1704df9f6dfeb..976020f469c1d3ee70b6de76d6fcafb10e0872a8 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/regset.h>
 #include <linux/elf.h>
 #include <linux/tracehook.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/cacheflush.h>
index 2ad7f32fa122d7131c09c81b2ac0146664df5694..1b3d80d8a171af223600fce84ebf05ac51f4e831 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/cpu.h>
 #include <asm/processor.h>
 #include <linux/console.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/setup.h>
 #include <asm/io.h>
 #include <asm/smp.h>
index cd8cb1d1176b0add337459631e62f9883298bb26..2f3cb573423564b52c9227663de5b479d924df9c 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/tracehook.h>
 #include <asm/cacheflush.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/fpu.h>
 #include "sigframe.h"
 
index 815f1355fad44eb5d2fa14681bb3618d9efd4228..f999981e55c0694782c044ddcb1d1a605bf93871 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/file.h>
 #include <linux/tty.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 asmlinkage long old_mmap(unsigned long addr, unsigned long len,
                         unsigned long prot, unsigned long flags,
index b6580f5d89eef78aa00a9ad0e68ab76002af6704..0f569151ef11bb010749906533a55f950ff21338 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/checksum.h>
 #include "internal.h"
 
index 2d23b9eeee62eef7d1164c54b17a2f3c463c6b9e..e80996064d3d5bf8e5023895ee1661db3c7a16a1 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/processor.h>
 #include <asm/cacheflush.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/smp.h>
 #include "cache-smp.h"
 
index 0a1f0aa92ebc78ff9881993e16d3015cb524cb96..0b925cce2b83252f62cfac484b876770897a1467 100644 (file)
@@ -17,7 +17,7 @@
 #include <asm/processor.h>
 #include <asm/cacheflush.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/smp.h>
 #include "cache-smp.h"
 
index 25e5485ab87d6f3146f2c93b8a2a9667152cc6c1..305de461cb8f83395f84a767a774883f9d20ed37 100644 (file)
@@ -10,7 +10,7 @@
  */
 #include <linux/module.h>
 #include <linux/spinlock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int fixup_exception(struct pt_regs *regs)
 {
index 97a1ec0beeecf2fd5dd538eda613b3bbcfa5346b..8ce677d5575ec191c4090d7b1d3f1d294968fad6 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/gfp.h>
 
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/dma.h>
index b9920b1edd5a7848180876783d39ae20f261011f..31d04da85743090e7ac9d6a4d1a6ffe63d12b73d 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/atomic.h>
 #include <asm/smp.h>
index 950cc8dbb284f91398b0779f2a74af1e463efea9..25b1b453c515db0f6ee1c5e90c4c3f688647e163 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <asm/cacheflush.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/atomic.h>
 #include <asm/smp.h>
index 746bf5caaffc7989884813b16bc3fd3fce85d0ef..6e2bdc9b8530e1745f01de61eab96d3fb660551c 100644 (file)
@@ -81,7 +81,7 @@ static inline unsigned long read_timersnapshot(struct nios2_timer *timer)
        return count;
 }
 
-static cycle_t nios2_timer_read(struct clocksource *cs)
+static u64 nios2_timer_read(struct clocksource *cs)
 {
        struct nios2_clocksource *nios2_cs = to_nios2_clksource(cs);
        unsigned long flags;
index 81f7da7b1d5590492940404bca781643fe305c1e..72ed30a93c851917422a4a0e908a5e69804338e7 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <asm/traps.h>
 #include <asm/sections.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static DEFINE_SPINLOCK(die_lock);
 
index 83ccf7c0c58d2d2c398acc53dfc740e43c657d7d..86e31cf1de1d1d3c43e671b9337c9917219fa6e9 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/semaphore.h>
 
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/checksum.h>
 #include <asm/io.h>
 #include <asm/hardirq.h>
index 277123bb4bf8db9e2cb45b121c24e33290464699..d7990df9025a6e1f77c1e98668a625700c323bea 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/mqueue.h>
 #include <linux/fs.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/processor.h>
index c82be69b43c64dc83ca24280d5261ff7b7e5bac6..265f10fb393071a7264d350a8e88d3d498354cd0 100644 (file)
@@ -30,7 +30,7 @@
 #include <asm/processor.h>
 #include <asm/syscall.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define DEBUG_SIG 0
 
index 50e970183dcd7e996431fcfa8d6645f494128d8a..687c11d048d7c2493c7d302e3c0cd053f99ef360 100644 (file)
@@ -117,9 +117,9 @@ static __init void openrisc_clockevent_init(void)
  * is 32 bits wide and runs at the CPU clock frequency.
  */
 
-static cycle_t openrisc_timer_read(struct clocksource *cs)
+static u64 openrisc_timer_read(struct clocksource *cs)
 {
-       return (cycle_t) mfspr(SPR_TTCR);
+       return (u64) mfspr(SPR_TTCR);
 }
 
 static struct clocksource openrisc_timer = {
index 3d3f6062f49ccee5ae47ec0505101fad7f5d147d..a4574cb4b0fb88cc783066cf48d4a35ecd4ead1e 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/timer.h>
 #include <linux/mm.h>
 #include <linux/kallsyms.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/segment.h>
 #include <asm/io.h>
index ef31fc24344e983c67b6f2b9c185a9275d456ed1..552544616b9d93ab6838a998ffb0b6ad9a7f1574 100644 (file)
@@ -44,6 +44,8 @@ SECTIONS
         /* Read-only sections, merged into text segment: */
         . = LOAD_BASE ;
 
+       _text = .;
+
        /* _s_kernel_ro must be page aligned */
        . = ALIGN(PAGE_SIZE);
        _s_kernel_ro = .;
index e94cd225e8161c2aa5e5e63019dd15e5b89be114..b1a7435e786afd590f53e2ec286c15886f0e0dbb 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/siginfo.h>
 #include <asm/signal.h>
 
index 7581330ea35be1e15498cf5cef9bbcbd3889aab9..88fe0aad4390b10830ce1bc1be62925d4b2d4bbc 100644 (file)
@@ -49,7 +49,6 @@ struct thread_info {
 #define TIF_POLLING_NRFLAG     3       /* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_32BIT               4       /* 32 bit binary */
 #define TIF_MEMDIE             5       /* is terminating due to OOM killer */
-#define TIF_RESTORE_SIGMASK    6       /* restore saved signal mask */
 #define TIF_SYSCALL_AUDIT      7       /* syscall auditing active */
 #define TIF_NOTIFY_RESUME      8       /* callback before returning to user */
 #define TIF_SINGLESTEP         9       /* single stepping? */
index 78d30d2ea2d8bb24116a7639a3d4bc5f90400058..1c4fe61a592b3748c2555ed53065feef5aed6a53 100644 (file)
@@ -38,7 +38,7 @@
 #include <asm/ptrace.h>
 #include <asm/processor.h>
 #include <asm/pdc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_64BIT
 #define FRAME_SIZE     128
index 3cad8aadc69e7a1159c829a7e5e5cea9f6a1297b..7484b3d11e0dbf83e58de4b64b08079b4a346bd7 100644 (file)
@@ -43,7 +43,7 @@ EXPORT_SYMBOL(__xchg64);
 EXPORT_SYMBOL(__cmpxchg_u64);
 #endif
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 EXPORT_SYMBOL(lclear_user);
 EXPORT_SYMBOL(lstrnlen_user);
 
index b6298a85e8aef40318ebb1a838799468374e37f5..697c53543a4d1c2112318c73aefd4edc518e41d0 100644 (file)
@@ -33,7 +33,7 @@
 #include <asm/io.h>
 #include <asm/page.h>  /* get_order */
 #include <asm/pgalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/tlbflush.h>      /* for purge_tlb_*() macros */
 
 static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
index 6eabce62463bbbcf29031143c46d7b75c841b6fa..e282a5131d77e10f62d274d4be426b076f655017 100644 (file)
@@ -48,7 +48,7 @@
 #include <linux/miscdevice.h>
 #include <linux/spinlock.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/perf.h>
 #include <asm/parisc-device.h>
 #include <asm/processor.h>
index e02d7b4d2b693dd94af83e2f6a215452d8d7e04d..f8b6959d2d972a9f558aaa7464eb066c358a8472 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/signal.h>
 #include <linux/audit.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/asm-offsets.h>
index 2264f68f3c2f9716030cb8fab53487f6db22e667..e58925ac64d10594ea1d63412da1b6ea8b1069af 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/elf.h>
 #include <asm/ucontext.h>
 #include <asm/rt_sigframe.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/cacheflush.h>
 #include <asm/asm-offsets.h>
index c342b2e17492ebf1884c69334dd01716c1cde086..70aaabb8b3cb33cd869c865bb653c434861f8b6b 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/types.h>
 #include <linux/errno.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "signal32.h"
 
index a81e177cac7be0c7d1d0f86f0a871d350fea5fdc..bf3294171230ad43d964a87818acd01f17c18eea 100644 (file)
@@ -23,7 +23,7 @@
  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/elf.h>
 #include <linux/file.h>
 #include <linux/fs.h>
index 4215f5596c8b6291516a9d39190e77df1b2bf488..1e22f981cd81fb0cf840407210d499cab0319e0e 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/platform_device.h>
 #include <linux/ftrace.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/page.h>
@@ -137,7 +137,7 @@ EXPORT_SYMBOL(profile_pc);
 
 /* clock source code */
 
-static cycle_t notrace read_cr16(struct clocksource *cs)
+static u64 notrace read_cr16(struct clocksource *cs)
 {
        return get_cycles();
 }
@@ -235,9 +235,26 @@ void __init time_init(void)
 
        cr16_hz = 100 * PAGE0->mem_10msec;  /* Hz */
 
-       /* register at clocksource framework */
-       clocksource_register_hz(&clocksource_cr16, cr16_hz);
-
        /* register as sched_clock source */
        sched_clock_register(read_cr16_sched_clock, BITS_PER_LONG, cr16_hz);
 }
+
+static int __init init_cr16_clocksource(void)
+{
+       /*
+        * The cr16 interval timers are not syncronized across CPUs, so mark
+        * them unstable and lower rating on SMP systems.
+        */
+       if (num_online_cpus() > 1) {
+               clocksource_cr16.flags = CLOCK_SOURCE_UNSTABLE;
+               clocksource_cr16.rating = 0;
+       }
+
+       /* register at clocksource framework */
+       clocksource_register_hz(&clocksource_cr16,
+               100 * PAGE0->mem_10msec);
+
+       return 0;
+}
+
+device_initcall(init_cr16_clocksource);
index 2b65c01777789f922d13a1e165d937e5e464e87a..0a21067ac0a3491d03f94d79986a23fb0b7bdd43 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/sched.h>
 #include <linux/signal.h>
 #include <linux/ratelimit.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/hardirq.h>
 #include <asm/traps.h>
 
index e278a87f43ccb467245533afb781c0117675fd07..1b73690477c5caf60c5b684389129e5f0bcb6c1c 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/kallsyms.h>
 #include <linux/sort.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/assembly.h>
 #include <asm/asm-offsets.h>
 #include <asm/ptrace.h>
index ae66d31f9ecf7d713d3c995a23330980d361c067..ba6384da6ade7458c149e1701a5b809532651dbd 100644 (file)
@@ -20,7 +20,7 @@
 #include <net/checksum.h>
 #include <asm/byteorder.h>
 #include <asm/string.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define addc(_t,_r)                     \
        __asm__ __volatile__ (          \
index 8ff9253930af776b5ca7d408f4bd134cdb88c9b0..1a0b4f63f0e90fbb4e4cb58ea6da95d326bcba3c 100644 (file)
@@ -234,7 +234,7 @@ show_signal_msg(struct pt_regs *regs, unsigned long code,
            tsk->comm, code, address);
        print_vma_addr(KERN_CONT " in ", regs->iaoq[0]);
 
-       pr_cont(" trap #%lu: %s%c", code, trap_name(code),
+       pr_cont("\ntrap #%lu: %s%c", code, trap_name(code),
                vma ? ',':'\n');
 
        if (vma)
index 81592562e0f862b7e467cd177afac6a0835cca1b..ba47c70712f92b619c6ba91859c39bb42ddc4bbf 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/threads.h>
 #include <asm/cacheflush.h>
 #include <asm/checksum.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/epapr_hcalls.h>
 
 #include <uapi/asm/ucontext.h>
index 033f3385fa49496d1d2de6837be081f33c3c357e..8d58c61908f781b66b12d239788bb529e1eece89 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cache.h>
 #include <asm/cputable.h>
 #include <asm/emulated_ops.h>
index cfa0f81a5bb049da21c8ff33e149541843df1184..d10ad258d41a3f8e3aba17ca6c49bdc9b1cc99cd 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/kdump.h>
 #include <asm/prom.h>
 #include <asm/firmware.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/rtas.h>
 
 #ifdef DEBUG
index 03d089b3ed726faeb69d3121e27191ed834899bf..4d3aa05e28be0439f97f97b1b4e6f84b8dce7f3b 100644 (file)
@@ -33,7 +33,7 @@
 #include <asm/hw_breakpoint.h>
 #include <asm/processor.h>
 #include <asm/sstep.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * Stores the breakpoints currently in use on each breakpoint address
index 3c05c311e35e6aba3e8ad6c1f083d7aef57ec3d8..a018f5cae899ae796840cea0492897970083fd79 100644 (file)
@@ -55,7 +55,7 @@
 #include <linux/of.h>
 #include <linux/of_irq.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/irq.h>
index ad108b842669566130cc2734e947f51203f55914..735ff3d3f77d9ad796b88dc2d47ad344bbbf24ab 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/code-patching.h>
 #include <asm/cacheflush.h>
 #include <asm/sstep.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
 DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
index 1863324c6a3c96db16028de56d35f0c2698f33e6..84db14e435f593ffbee5fbd45bc02cac52eccbac 100644 (file)
@@ -296,7 +296,7 @@ _GLOBAL(flush_instruction_cache)
        lis     r3, KERNELBASE@h
        iccci   0,r3
 #endif
-#elif CONFIG_FSL_BOOKE
+#elif defined(CONFIG_FSL_BOOKE)
 BEGIN_FTR_SECTION
        mfspr   r3,SPRN_L1CSR0
        ori     r3,r3,L1CSR0_CFI|L1CSR0_CLFC
index 30b89d5cbb0378989a50ba7fb182bbfb887421c3..3f7ba0f5bf29f97f4fda95140605f0869df36e63 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/vmalloc.h>
 #include <linux/bug.h>
 #include <asm/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/firmware.h>
 #include <linux/sort.h>
 #include <asm/setup.h>
index 34d2c595de23baff57351bbed16764c699d55800..d5e2b83099398d303282b4a32978140139d4c6ca 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/pagemap.h>
 #include <linux/pstore.h>
 #include <linux/zlib.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/nvram.h>
 #include <asm/rtas.h>
 #include <asm/prom.h>
index 678f87a63645718e0f63488f52ff5ae6fc72ae06..41c86c6b6e4d563cd7e93eb7f7d9b967c7a867d1 100644 (file)
@@ -24,7 +24,7 @@
 #include <asm/pci-bridge.h>
 #include <asm/ppc-pci.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/machdep.h>
 
 #undef DEBUG
index c30612aad68ebd5f239776a3b4c6cf66ea94bf1e..56548bf6231f8ef34e774411692b4857826a6940 100644 (file)
@@ -24,7 +24,7 @@
 #include <asm/machdep.h>
 #include <asm/vdso_datapage.h>
 #include <asm/rtas.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/prom.h>
 
 #ifdef CONFIG_PPC64
index b1ec62f2cc316a337c77fc3fe5a3bd6a23680d40..e4744ff38a1782de7aa60305fc3f72dc9c109cba 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/perf_event.h>
 #include <linux/context_tracking.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/switch_to.h>
index 1e887f3a61a675a0dd9a7ff5aa29c2b205c809ec..f37eb53de1a1f1aa152b70611445cd05cd18278b 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/signal.h>
 #include <linux/compat.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/switch_to.h>
index c82eed97bd227b5ecbb68a27c9059f16c24aa0c7..df56dfc4b6815bc4c1a44ed156ef0543793cd46b 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/bitops.h>
 #include <linux/rtc.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/prom.h>
index 6a3e5de544ce2f2b6a3311338daafd19b442f6b5..112cc3b2ee1a17226263d799af931571b2afd1b9 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/page.h>
 #include <asm/param.h>
 #include <asm/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/udbg.h>
 #include <asm/syscalls.h>
 #include <asm/smp.h>
index db2b482af6585184b425f4913440d675de6b89a4..f6f6a8a5103ab954773f252bd11e804604df82ad 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/proc_fs.h>
 #include <linux/reboot.h>
 #include <asm/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/rtas.h>
 
 #define MODULE_VERS "1.0"
index a26a020065764bb8680da0a77636e5ec7899d5db..2bf1f9b5b34b3100bb447f070e4003ad88dc648a 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/workqueue.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/rtas.h>
 #include <asm/prom.h>
index 5fe79182f0fac97ef292b3ab680f7bc4cdd419e1..7fcf1f7f01c1b4d9dfd084bbe84ec334707ac2ec 100644 (file)
@@ -29,7 +29,7 @@
 #include <asm/bootx.h>
 #include <asm/btext.h>
 #include <asm/machdep.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pmac_feature.h>
 #include <asm/sections.h>
 #include <asm/nvram.h>
index bbe77aed198d4899f12288f7675e880ae8e4a92e..3a36711724362fc4d5aa224e49076a84b38585d9 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/key.h>
 #include <linux/context_tracking.h>
 #include <asm/hw_breakpoint.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/debug.h>
 #include <asm/tm.h>
index 27aa913ac91d42828d819ddf984f5bf0550d370f..97bb1385e77152d95215d83278771a0fbe972982 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/binfmts.h>
 #endif
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/syscalls.h>
 #include <asm/sigcontext.h>
index 96698fdf93b4ae27ac4161ea03f067d122f5fb17..c83c115858c1909218c5897a23f15f0bbd7b10ed 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <asm/sigcontext.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/unistd.h>
 #include <asm/cacheflush.h>
index 8a285876aef8a8e667091b5560ec1aa8756f5bc7..15f216d022e220252982302029f42f84b68ab3ba 100644 (file)
@@ -44,7 +44,7 @@
 
 #include <asm/ptrace.h>
 #include <asm/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/time.h>
 #include <asm/mmu_context.h>
index 644cce3d8dce632a0cdab480694b039fba46bceb..de04c9fbb5cd757af231394ab0f9d8c29053913b 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/file.h>
 #include <linux/personality.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/syscalls.h>
 #include <asm/time.h>
 #include <asm/unistd.h>
index be9751f1cb2a7a64d7cf25dd016f56e9f5ffbc07..bc2e08d415fa3af8fea6d6f3e63b75e2900c78ff 100644 (file)
@@ -64,7 +64,7 @@
 #include <asm/nvram.h>
 #include <asm/cache.h>
 #include <asm/machdep.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/time.h>
 #include <asm/prom.h>
 #include <asm/irq.h>
@@ -80,7 +80,7 @@
 #include <linux/clockchips.h>
 #include <linux/timekeeper_internal.h>
 
-static cycle_t rtc_read(struct clocksource *);
+static u64 rtc_read(struct clocksource *);
 static struct clocksource clocksource_rtc = {
        .name         = "rtc",
        .rating       = 400,
@@ -89,7 +89,7 @@ static struct clocksource clocksource_rtc = {
        .read         = rtc_read,
 };
 
-static cycle_t timebase_read(struct clocksource *);
+static u64 timebase_read(struct clocksource *);
 static struct clocksource clocksource_timebase = {
        .name         = "timebase",
        .rating       = 400,
@@ -802,18 +802,18 @@ void read_persistent_clock(struct timespec *ts)
 }
 
 /* clocksource code */
-static cycle_t rtc_read(struct clocksource *cs)
+static u64 rtc_read(struct clocksource *cs)
 {
-       return (cycle_t)get_rtc();
+       return (u64)get_rtc();
 }
 
-static cycle_t timebase_read(struct clocksource *cs)
+static u64 timebase_read(struct clocksource *cs)
 {
-       return (cycle_t)get_tb();
+       return (u64)get_tb();
 }
 
 void update_vsyscall_old(struct timespec *wall_time, struct timespec *wtm,
-                        struct clocksource *clock, u32 mult, cycle_t cycle_last)
+                        struct clocksource *clock, u32 mult, u64 cycle_last)
 {
        u64 new_tb_to_xs, new_stamp_xsec;
        u32 frac_sec;
index 4239aaf748866a666680792437059c3ad356a0eb..e6cc56b61d017318c26c190c99dd817c158eaffd 100644 (file)
@@ -40,7 +40,7 @@
 
 #include <asm/emulated_ops.h>
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
 #include <asm/rtas.h>
index c4bfadb2606bcc6a5cb92b456ae0903e1ea5b86c..2d8f6d8ccafca2d0bf4905ae4370d669ead9eaa1 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/sched.h>
 #include <asm/ptrace.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Functions in vector.S */
 extern void vaddfp(vector128 *dst, vector128 *a, vector128 *b);
index b6952dd2315213c1cc31c7565632612e8b806c86..019f008775b96d863e7211f8510b944333ec2a7d 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/cputable.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/kvm_ppc.h>
 #include <asm/kvm_book3s.h>
index 8dcbe37a4dac8b8ee2bd0d1e62736939b56ac570..ec34e39471a78b3e60e2701f6a4e0bdf07b16de3 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/cputable.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/kvm_ppc.h>
 #include <asm/kvm_book3s.h>
@@ -1872,8 +1872,7 @@ static void kvmppc_set_timer(struct kvm_vcpu *vcpu)
        }
        dec_nsec = (vcpu->arch.dec_expires - now) * NSEC_PER_SEC
                   / tb_ticks_per_sec;
-       hrtimer_start(&vcpu->arch.dec_timer, ktime_set(0, dec_nsec),
-                     HRTIMER_MODE_REL);
+       hrtimer_start(&vcpu->arch.dec_timer, dec_nsec, HRTIMER_MODE_REL);
        vcpu->arch.timer_running = 1;
 }
 
index 826c541a12af12e4bb76a723103d3121769e1015..1482961ceb4d9a0361121fcebc4719176d231ef7 100644 (file)
@@ -28,7 +28,7 @@
 #include <asm/cputable.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/kvm_ppc.h>
 #include <asm/kvm_book3s.h>
index 02176fd52f84b85187f8a57a5e434bd56299a151..f102616febc7b10aeedd467dfb1cf084024dd81c 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <linux/anon_inodes.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/kvm_ppc.h>
 #include <asm/kvm_book3s.h>
 
index ef27fbd5d9c54694beac4d1b400dc7d512db38da..20528701835bf8c081d680ee52492ce7109187ab 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/kvm.h>
 #include <linux/err.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/kvm_book3s.h>
 #include <asm/kvm_ppc.h>
 #include <asm/hvcall.h>
index 3bdc639157c177eaaea320eece1209e4e2df92c0..20dff102a06fb01ea94171438ebd540447dc5c18 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/anon_inodes.h>
 #include <linux/spinlock.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/kvm_book3s.h>
 #include <asm/kvm_ppc.h>
 #include <asm/hvcall.h>
index df3f2706d3e57e5f3077e18ac07d7d0b8bb340c5..0514cbd4e533ac01834df77ba12090495ddb5f09 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/fs.h>
 
 #include <asm/cputable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/kvm_ppc.h>
 #include <asm/cacheflush.h>
 #include <asm/dbell.h>
index ed38f811411847d659e1810c9e5a94c583369df6..fe312c160d9752b5af12e3c68a81aec0c3cf820a 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/anon_inodes.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mpic.h>
 #include <asm/kvm_para.h>
 #include <asm/kvm_host.h>
index efd1183a6b16d576ea75474f57e4268cffd19937..cd892dec7cb641a39f4243979a0fe6c97e9e1bb0 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/irqbypass.h>
 #include <linux/kvm_irqfd.h>
 #include <asm/cputable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/kvm_ppc.h>
 #include <asm/tlbflush.h>
 #include <asm/cputhreads.h>
index 08e3a3356c402f02145ef3f3c55a9627fb2cda1c..a0cb63fb76a1ada4b6ab727533c62e0cc681e33c 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/compiler.h>
 #include <linux/types.h>
 #include <asm/checksum.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 __wsum csum_and_copy_from_user(const void __user *src, void *dst,
                               int len, __wsum sum, int *err_ptr)
index d5edbeb8eb8209e61a9d6524acfa565e3f30782f..c1746df0f88e953c7b404ba0f55f2179882d48b3 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/mm.h>
 #include <asm/page.h>
 #include <asm/code-patching.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 int patch_instruction(unsigned int *addr, unsigned int instr)
index 9c78a9c102c3a9fd9bc6f89fe0d326284e9c4ab1..06c7e9b884083f3c6423de1d5de61e2d6d93260e 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/prefetch.h>
 #include <asm/sstep.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cpu_has_feature.h>
 #include <asm/cputable.h>
 
index 5eea6f3c1e03be13c06fb25ea04f64e45ece5954..9bd3a3dad78db44d9a2c694c291438362b0f56af 100644 (file)
@@ -7,7 +7,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
 {
index 549baba5948fbc9d82961cbf044f5768d367745d..a5e7ad1384ee99f21419267680d851eccbf435d1 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int
 fabs(u32 *frD, u32 *frB)
index 0158a16e2b826b7597563dd56c7a12c63c5c4ee7..29de37e0e0da4390216c2274b528067a3391b4d0 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 5930f40a868743dfb0683350bc2f2e789aa6d9ea..7093c5b580022692b68bff295f9538be7aa85a4a 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 5bce011c2aece41137e83ca30611cbdc7f5db7f1..5d644467221cc9109e9937796dd3eb8a00d21dbd 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index d4fb1babc6ada6abdaa069934f9f9f48ff73f136..0f9bf4864832d4269c7d3431c24f2c973e2cc990 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index f694440ddc003a276ef5630f4ad3d5b259a18cc4..716d6da7f2044494d19de0de547997242b1f19c9 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 71e782fd4fe35b13a2d1e1b77d6f8b7f32855738..7212fa7cfd3685d0622dd85280bd46271cf4072a 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index a29239c05e3eecb13b47b193b9e54e4aa04696d2..e1e452069e49836f118b197283e3fc478ee37431 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 526bc261275f81178320637a82f467c30131cbe5..5511e2d1c3ad9712103a6d50511a0c239d8ddb44 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 8c3f20aa5a95359e354986f429720d3c2c0d9f73..2b6fae0bc8c2cdb1fc4cdddefdab171ff414bd08 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 794fb31e59d17c878b44c7927c7dd5431cc3ac9c..aff35f24a23665f546ac793773110ab0ff1e9e9a 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index bd55384b8196e38a816e440c92c52b28fe0394aa..f6347911f6a35951ff6834068f082487e70db762 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int
 fmr(u32 *frD, u32 *frB)
index 626f6fed84ac5c06541013dcd7df5c5c4a2f8104..1fb26cebe04e612901897cefd15a8e595b126364 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 3425bc899760483012920dcd3bcbf74fb03057a5..f73965453e0593c06600883993db0e8476e4ef11 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 2c1929779892b6e29f228467c0625a46cff830ee..ffd31b549290bb44c17d6e40fb40818b6bb055d6 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index f5ad5c9c77d001b3ed9bacbff92dcaea66a88e75..21aee431ca9de1ad2e80d9625b7c4f9e205fbd2b 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index a7d34f3d9499c0419c578d80d1cd03bb38e1591a..af877a53d264ef8e12c074a8b1f3b9d7621410aa 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int
 fnabs(u32 *frD, u32 *frB)
index 1e988cd9c6ccab8034cfb824e78800d4599d2a85..8417d174758cf101e97463aa36f7bb58d6359fa3 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int
 fneg(u32 *frD, u32 *frB)
index e817bc5453efc4597d8ebd79df40924fb2e44cda..6316ef0e087423b8bceaa39143583f2793980a28 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 4db4b7d9ba8d3d7157cd999ec4dcb042e799054f..9ffe037df2b955614a66689333edf71f5b174ccb 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index f65979fa770eac810e07762874c2c206f38cd602..f97a9cfb54ea1c56a3c7a50a1a01b213fa77d6c6 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 9021dacc03b8b2f1d5326cc03c75ff97eb19d3c8..7fa1217bd930fce3788a6b0bff8e745b502561b6 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 49ccf2cc6a5a88dc577a6977b90c24d88d5e1375..b621a790aa67dbb10eb7c293b3803aa3e70b1c2c 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int fre(void *frD, void *frB)
 {
index 10ecbd08b79e4f562aa53158e0d53fb1f47f66b5..211c30d0145f6674f75e8841e31e2130f7852fb8 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int
 fres(void *frD, void *frB)
index ddcc14664b1a23a7116b95d9883cb92b4b7604ae..3e3bc73e27aeddbd8ec521e71dd101020aeb46b7 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 1d0a3a0fd0e6d42f7117e3295ddd5de2e98d7c3f..7c2ce43750dc14e5efb803385a08e98d45ae3455 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int
 frsqrte(void *frD, void *frB)
index 7e838e380314f7e1048061ae318d65fdaf809d8e..269951a8c65078c1fc00ab553247df6b0b173126 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int frsqrtes(void *frD, void *frB)
 {
index 1b0c144980320a87d5982d052419301ba15a2777..32b62c6c7f489f5b9a53644116402499155ecc2c 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index a55fc7d49983fe331eecf5f931a4790af6d6de63..0e2a34b616dccfa38a66e6e18a4d95c8da70de69 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 31dccbfc39ff8073a66849e3ca2617b40b1bc34c..420cf19b5fd47b16c2102fe4e9fb3b3361a031e0 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 02c5dff458baa2afac1648a7ccdc997eef31f5e3..feedd705cf629c49f5a25f78493a657260098038 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 5d9b18c35e074aeb8997b0f9dc1a78059ea0a79a..74190514063ea4e8225ffa7e0f3ed40c85fa93f5 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 79ac76d596c31f30279bb678a600be120308d750..d998a50740a0a5418fe8c11c0d4c51e1a41a76e6 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/double.h>
index 434ed27be8dbaee074943bc80b6141c773d2ecf6..1ee10b83d7e344926177c9dd839e4801ace7035e 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index ab151f04050264fdc4c4a37af8b815b86c6e60de..76ee2e5dba65a24c658a2938a6189536edf37056 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/types.h>
 #include <linux/sched.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/reg.h>
 #include <asm/switch_to.h>
 
index 28337c9709ae60c326bbe9e67364b9fe3c19796e..581f404caa1d6aa325c14a866e0f1eecf89257bf 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/types.h>
 #include <linux/prctl.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/reg.h>
 
 #define FP_EX_BOOKE_E500_SPE
index e948d5708e2b722041c712810964bb95fa0f197e..8e8e72397ebc1be41deef8504138bdc44a817dff 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 5526cf96ede5e0e33b462f09f44b8c8177c636c9..e00fdc22a0bc294605ba5fc5f63bbad623cdd552 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index bc985585bca8afd65c6b964184a30e74b4376ede..5ed3e7d5063e0bfe32ad4f10b6a6ada84f9b93cc 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index fe6ed5ac85b331cf75e14c695996a6733ff03a14..602aa16eda81990b8cf1718dcb6ddcabbffc38ac 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 44b0fc8214f4773520452f4ede8f372fa82859b9..b0d5593ad357d61401c28809f243c474cac78038 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index fd2acc26813b7f1a240f80427075bc43a52b0c53..5df30541a7848cd7c6015aad5e92022def99c7d9 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 33a165c8df0fe1e16eff1f682b5194871abcadb6..6baeaec134a2719a51457151ec94a952cf861be3 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int
 stfd(void *frS, void *ea)
index f15a35f67e2c08d18c312562e07dd7da624c8d34..9da7c5d1a872f3c4f4559204dded0c1334d591d2 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int
 stfiwx(u32 *frS, void *ea)
index 6122147356d1b2fa008922ae86e0fb157ce557f7..62bd25264fb5548bd27b697b6f4ebc64b1900125 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sfp-machine.h>
 #include <math-emu/soft-fp.h>
index 31a5d42df8c9af2ea0af8d62420b4e073fff3f29..61ac468c87c66643df2db4c40e4da18d9098e61e 100644 (file)
@@ -43,7 +43,7 @@
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/mmu.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/smp.h>
 #include <asm/bootx.h>
 #include <asm/machdep.h>
index 139dec421e57a578b89eb7140cca17028a1276cc..080d49b26c3a7d3b06326482f4f7b2d4402de5ad 100644 (file)
@@ -48,7 +48,7 @@
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/mmu.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/smp.h>
 #include <asm/machdep.h>
 #include <asm/setup.h>
index 8410b4bb36edb8770123a0799cc413ccb7f1d393..80334937e14fdf8519236a9930e73707ef373d86 100644 (file)
@@ -42,7 +42,7 @@
 #include <asm/mmu_context.h>
 #include <asm/page.h>
 #include <asm/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/machdep.h>
 #include <asm/prom.h>
 #include <asm/tlbflush.h>
index a000c35853903b8017403594b60590fbc0befaf2..93abf8a9813d5c2d47a1aa150cafa4076111b0db 100644 (file)
@@ -51,7 +51,7 @@
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/mmu.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/smp.h>
 #include <asm/machdep.h>
 #include <asm/tlb.h>
index 0cb6bd8bfccfd7139b5148a60bd486a1fe8bfcdd..b1099cb2f393c8adbfa7f1ac42f3db478e177efc 100644 (file)
@@ -944,7 +944,7 @@ void __init initmem_init(void)
         * _nocalls() + manual invocation is used because cpuhp is not yet
         * initialized for the boot CPU.
         */
-       cpuhp_setup_state_nocalls(CPUHP_POWER_NUMA_PREPARE, "POWER_NUMA_PREPARE",
+       cpuhp_setup_state_nocalls(CPUHP_POWER_NUMA_PREPARE, "powerpc/numa:prepare",
                                  ppc_numa_cpu_prepare, ppc_numa_cpu_dead);
        for_each_present_cpu(cpu)
                numa_setup_cpu(cpu);
index d5543514c1dfe0d3f53c9ed19bda7e11896dd4b1..5c096c01e8bd876b184c1d018bec2fbc04f29a30 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/hugetlb.h>
 
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/tlbflush.h>
 
 /*
index b19265de91784158abcb17c3e6fed4282c30bae6..5182f2936af2c8c718ee06e65a837d174fa88d19 100644 (file)
@@ -180,7 +180,7 @@ static enum hrtimer_restart profile_spus(struct hrtimer *timer)
        smp_wmb();      /* insure spu event buffer updates are written */
                        /* don't want events intermingled... */
 
-       kt = ktime_set(0, profiling_interval);
+       kt = profiling_interval;
        if (!spu_prof_running)
                goto stop;
        hrtimer_forward(timer, timer->base->get_time(), kt);
@@ -204,7 +204,7 @@ int start_spu_profiling_cycles(unsigned int cycles_reset)
        ktime_t kt;
 
        pr_debug("timer resolution: %lu\n", TICK_NSEC);
-       kt = ktime_set(0, profiling_interval);
+       kt = profiling_interval;
        hrtimer_init(&timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        hrtimer_set_expires(&timer, kt);
        timer.function = profile_spus;
index 72c27b8d2cf3240f201eabeb723afcdb0ff9b0de..fd3e4034c04d2207a30cc82d6c65dffc6094c603 100644 (file)
@@ -2189,7 +2189,7 @@ int register_power_pmu(struct power_pmu *pmu)
 #endif /* CONFIG_PPC64 */
 
        perf_pmu_register(&power_pmu, "cpu", PERF_TYPE_RAW);
-       cpuhp_setup_state(CPUHP_PERF_POWER, "PERF_POWER",
+       cpuhp_setup_state(CPUHP_PERF_POWER, "perf/powerpc:prepare",
                          power_pmu_prepare_cpu, NULL);
        return 0;
 }
index 85c85eb3e245d7a7a9600a8fce95a592789f38bc..e5a891ae80ee5e6881bd10be148c04519d3dffd0 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/coredump.h>
 #include <linux/binfmts.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "spufs.h"
 
index 3a147122bc9890045ac57e6d649a11bebec7d0ba..a35e2c29d7eed3b0ee15f2e088e3c0d4aeb8b19a 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/time.h>
 #include <asm/spu.h>
 #include <asm/spu_info.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "spufs.h"
 #include "sputrace.h"
index 5364d4a542493880bc7b14d75c57b04cf2a5469d..d8af9bc0489f782d14532e954e96cccaaab1fc31 100644 (file)
@@ -38,7 +38,7 @@
 #include <asm/prom.h>
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "spufs.h"
 
index a87200a535fae99065a5aafb27775f736c31aa5c..0d290ea83dc106272f678eb045fd021abe0cc642 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/namei.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "spufs.h"
 
index 9ef8cc3378d0dae581ba8abd19a21bcf6f63a266..c3ede2c365c3b803b630988b8e3cc3be30267732 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/rtas.h>
index f2344cbd2f464cb93a3afbcbf21dc8263069b555..ecd6d9177d13f31e35f2ef4c67bdd8d9e47bffa3 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/vmalloc.h>
 #include <linux/fcntl.h>
 #include <linux/kobject.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/opal.h>
 
 struct elog_obj {
index e4169d68cb3289a98230a7547b0ef24e3fb5c260..4886eb8b63816d1609ca21b3b7a1f35b5b45419d 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/xics.h>
 #include <asm/opal.h>
 #include <asm/prom.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/debug.h>
 
 static int opal_lpc_chip_id = -1;
index e315e704cca7100cc22ee9f335701659684e744d..2d6ee1c5ad859f4253f4b3c42e2aca1a6f9056a5 100644 (file)
@@ -29,7 +29,7 @@
 #include <asm/opal-prd.h>
 #include <asm/opal.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 /**
index 97232882938785f2dcf2295796bb3a1e8cb4c7bc..4839db385bb05a07f735d1179d015f731e3c8173 100644 (file)
@@ -37,7 +37,7 @@
 #include <asm/hvcall.h>
 #include <asm/mmu.h>
 #include <asm/pgalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/memory.h>
 #include <asm/plpar_wrappers.h>
 
index 76caa4a45ccd8408a9701fd48cd589b0c07d297d..5cb2e4beffc513b910bb8a67c79e937b3d02ed4b 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <asm/prom.h>
 #include <asm/machdep.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/rtas.h>
 
 static struct workqueue_struct *pseries_hp_wq;
index 39049e4884fbd30e8cf261f867da8309a98e9532..6b04e3f0f982fd567e9c23bae41a2813395680d9 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/debugfs.h>
 #include <linux/spinlock.h>
 #include <asm/smp.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/firmware.h>
 #include <asm/lppaca.h>
 #include <asm/debug.h>
index e6397976060e8fdea92139e1df5dae5c73a8580a..779fc2a1c8f77d90bfcce73774cfefb12a5153b7 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/init.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/lppaca.h>
 #include <asm/hvcall.h>
 #include <asm/firmware.h>
index 79aef8c1c5b309c1ba16b40b27d4ddb85639ebef..69cedc1b3b8ac50400dddaceea5b4781293d40f6 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/ctype.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/nvram.h>
 #include <asm/rtas.h>
 #include <asm/prom.h>
index cc66c49f07aa1b8a6825382216efb38486665460..e5bf1e84047f4c3fb9746ae85b0c6593f47ab012 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <asm/prom.h>
 #include <asm/machdep.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu.h>
 
 #include "of_helpers.h"
index 7d28cabf1206080695792c1ce59f3ab1447237dd..c47585a78b69158e8fb880689bd38d44d1d29db5 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/rtas.h>
 #include <asm/prom.h>
 
index 6f5a8d177c427f038aa65d0a7af9ce5657459625..d0e9f178a324e0b21ff78841b053e66a2da5484a 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/debug.h>
 #include <asm/prom.h>
 #include <asm/scom.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 const struct scom_controller *scom_controller;
 EXPORT_SYMBOL_GPL(scom_controller);
index 53a16aa4d38401449a97c4ea9fc95b2ab6422d73..5692dd569b9b6dadf1c8d4c117a7b1a1698ab2c6 100644 (file)
@@ -30,7 +30,7 @@
 #include <asm/byteorder.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/machdep.h>
 #include <asm/pci-bridge.h>
 #include <asm/tsi108.h>
index f587c4811faf139a70df3d19ad858deb7df69665..5a8dfa22da7c3147fa657c7f32d7268d0cd66dc1 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/platform_device.h>
 #include <asm/appldata.h>
 #include <asm/vtimer.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/smp.h>
 
index 4da604ebf6fd8edd75eb01951913c79991d0eca5..8515dd5a5663c6df8ef076b3c6d7f6a81d34d78e 100644 (file)
@@ -6,7 +6,7 @@
  * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/sclp.h>
 #include <asm/ipl.h>
index 1113389d0a39fe661229b68d28cf99e7a2e18eab..daf9bb063aaa235a743be36ece8321aa4dc700b1 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/random.h>
 #include <linux/slab.h>
 #include <asm/debug.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/timex.h>
 #include <asm/cpacf.h>
 
diff --git a/arch/s390/include/asm/asm-prototypes.h b/arch/s390/include/asm/asm-prototypes.h
new file mode 100644 (file)
index 0000000..2c3413b
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef _ASM_S390_PROTOTYPES_H
+
+#include <linux/kvm_host.h>
+#include <linux/ftrace.h>
+#include <asm/fpu/api.h>
+#include <asm-generic/asm-prototypes.h>
+
+#endif /* _ASM_S390_PROTOTYPES_H */
index d7f100c53f07fd483a39cd6e00315e460455c19b..12bf4fef2a68435d26b9c13a66f7a1d42a64a27e 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef _S390_CHECKSUM_H
 #define _S390_CHECKSUM_H
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * computes the checksum of a memory block at buff, length len,
index a7b2d7504049a00d286c74aee5bd3ae39e5e9f55..280b60a0bcd456fb9c725bbc750afaa34ea811a5 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <asm/cio.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define IDA_SIZE_LOG 12 /* 11 for 2k , 12 for 4k */
 #define IDA_BLOCK_SIZE (1L<<IDA_SIZE_LOG)
index 515fea5a3fc4334b33111cdccfbb15a91f0c1c5b..67f7a991c929bb92731c6aafeef4a1255d69c959 100644 (file)
@@ -8,7 +8,7 @@
 #define __S390_MMU_CONTEXT_H
 
 #include <asm/pgalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/tlbflush.h>
 #include <asm/ctl_reg.h>
 
index 0f9cd90c11af6173d78d4ace43465cc70332b18f..96df4547377a56772a411c603baec350552d79f3 100644 (file)
@@ -51,7 +51,7 @@
 #include <linux/slab.h>
 
 #include <asm/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/scm.h>
 #include <net/sock.h>
index 6f2a6ab13cb53ced84db41aaa499eb0b75d054e1..362350cc485c42b5b5dd0f80921186d38c6fb589 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/personality.h>
 #include <linux/binfmts.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/lowcore.h>
 #include <asm/switch_to.h>
 #include "compat_linux.h"
index aa12de72fd47c9d9d8c13f1c4a1734eababe3891..79f8ae9335204dfcc25a1b8d9e07e8934b4c3bfb 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/ctype.h>
 #include <linux/string.h>
 #include <linux/sysctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/fs.h>
index c74c59236f4418c3f37933ff67b4812c101e8536..9f017cf417f6426e22000db95c5a33eb942535be 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/kprobes.h>
 #include <linux/kdebug.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/dis.h>
 #include <asm/io.h>
 #include <linux/atomic.h>
index fdb40424acfef247580ca1f288af4d3b3150f063..84e0557b16fed77c14afe62396dc6c7a95fffd90 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/ftrace.h>
 #include <asm/cacheflush.h>
 #include <asm/sections.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/dis.h>
 
 DEFINE_PER_CPU(struct kprobe *, current_kprobe);
index 037c2a253ae48fc977cdb520e21c86c745507624..1aba10e9090632ad7e644f2f066c4c405f1ce530 100644 (file)
@@ -711,7 +711,7 @@ static int __init cpumf_pmu_init(void)
                return rc;
        }
        return cpuhp_setup_state(CPUHP_AP_PERF_S390_CF_ONLINE,
-                                "AP_PERF_S390_CF_ONLINE",
+                                "perf/s390/cf:online",
                                 s390_pmu_online_cpu, s390_pmu_offline_cpu);
 }
 early_initcall(cpumf_pmu_init);
index 763dec18edcdd9ea763dfa18beeeddbc6ca37c9d..1c0b58545c04d6f5c44e0f07838fcc35901e0cf5 100644 (file)
@@ -1623,7 +1623,7 @@ static int __init init_cpum_sampling_pmu(void)
                goto out;
        }
 
-       cpuhp_setup_state(CPUHP_AP_PERF_S390_SF_ONLINE, "AP_PERF_S390_SF_ONLINE",
+       cpuhp_setup_state(CPUHP_AP_PERF_S390_SF_ONLINE, "perf/s390/sf:online",
                          s390_pmu_sf_online_cpu, s390_pmu_sf_offline_cpu);
 out:
        return err;
index b81ab8882e2ec9f1f8b2880cc511419b32ac6765..7447ba509c30eb0b409598d062ea408603f313af 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/switch_to.h>
 #include "entry.h"
index 9f241d1efeda6421ecead6dc0083f07d5cee8951..62a4c263e8878ed6254deef3c976abb566712e0d 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/syscalls.h>
 #include <linux/compat.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/lowcore.h>
 #include <asm/switch_to.h>
 #include "entry.h"
index f145490cce54043077fcc449daca05d3ce005655..b7af452978ca8d478ee070c84c9191d52a1ef511 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/personality.h>
 #include <linux/unistd.h>
 #include <linux/ipc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "entry.h"
 
 /*
index 867d0a057046bb7cb3006378df6e04a8ed5cb857..52949df8852996985fd974c5f04d72c58d0e287d 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/clockchips.h>
 #include <linux/gfp.h>
 #include <linux/kprobes.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/facility.h>
 #include <asm/delay.h>
 #include <asm/div64.h>
@@ -209,7 +209,7 @@ void read_boot_clock64(struct timespec64 *ts)
        tod_to_timeval(clock - TOD_UNIX_EPOCH, ts);
 }
 
-static cycle_t read_tod_clock(struct clocksource *cs)
+static u64 read_tod_clock(struct clocksource *cs)
 {
        unsigned long long now, adj;
 
index d0539f76fd24c78dccbb47ac0082e98855225f9e..283ad7840335c11b32688fca3309250b802e0e0b 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/fpu/api.h>
 #include "entry.h"
 
index 6b246aadf311706849341dac2d0eafee293340f1..1b5c5ee9fc1b60878844cd67cb6a6cb12800a563 100644 (file)
@@ -94,7 +94,7 @@ static void update_mt_scaling(void)
  * Update process times based on virtual cpu times stored by entry.S
  * to the lowcore fields user_timer, system_timer & steal_clock.
  */
-static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
+static int do_account_vtime(struct task_struct *tsk)
 {
        u64 timer, clock, user, system, steal;
        u64 user_scaled, system_scaled;
@@ -138,7 +138,7 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
        }
        account_user_time(tsk, user);
        tsk->utimescaled += user_scaled;
-       account_system_time(tsk, hardirq_offset, system);
+       account_system_time(tsk, 0, system);
        tsk->stimescaled += system_scaled;
 
        steal = S390_lowcore.steal_timer;
@@ -152,7 +152,7 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
 
 void vtime_task_switch(struct task_struct *prev)
 {
-       do_account_vtime(prev, 0);
+       do_account_vtime(prev);
        prev->thread.user_timer = S390_lowcore.user_timer;
        prev->thread.system_timer = S390_lowcore.system_timer;
        S390_lowcore.user_timer = current->thread.user_timer;
@@ -166,7 +166,7 @@ void vtime_task_switch(struct task_struct *prev)
  */
 void vtime_account_user(struct task_struct *tsk)
 {
-       if (do_account_vtime(tsk, HARDIRQ_OFFSET))
+       if (do_account_vtime(tsk))
                virt_timer_expire();
 }
 
index af13f1a135b649784db7b6d9ff2479a4306f7ef9..0f8f14199734e94bd96ae0158be5c4a9a3c0333d 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/vmalloc.h>
 #include <asm/asm-offsets.h>
 #include <asm/dis.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sclp.h>
 #include <asm/isc.h>
 #include <asm/gmap.h>
@@ -1019,7 +1019,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
                return 0;
 
        __set_cpu_idle(vcpu);
-       hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL);
+       hrtimer_start(&vcpu->arch.ckc_timer, sltime, HRTIMER_MODE_REL);
        VCPU_EVENT(vcpu, 4, "enabled wait: %llu ns", sltime);
 no_timer:
        srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
index b3e9d18f2ec62b603737ef5d0080cd86b8df94a8..b67454ad8408c94c799f3c953d6ba4ee0552e7b4 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/gfp.h>
 #include <linux/memblock.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/dma.h>
index 539d9fd45d211969a3fb5cd4ca697ae033722f10..0338927f4826f3624a7f5b608bde72765e09cfea 100644 (file)
@@ -2,7 +2,7 @@
 #define _ASM_SCORE_CHECKSUM_H
 
 #include <linux/in6.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * computes the checksum of a memory block at buff, length len,
index 4f7314d5f3347d40a6282976d538ccfb0e4d447d..8b75e54816c19f143f13b3510f37613043347719 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/ptrace.h>
 #include <linux/regset.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * retrieve the contents of SCORE userspace general registers
index 5cea1e750ceca0b7ad0b7baac431218e695dafb8..d948a6818961d05906a001a1de34e068061d1684 100644 (file)
@@ -29,7 +29,7 @@
 #include <asm/cacheflush.h>
 #include <asm/irq.h>
 #include <asm/irq_regs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 unsigned long exception_handlers[32];
 
index 9b770b30e8a50e6f70a0988e46c26b39e71d820a..39b99ef618043fad96c11d01e0126764659a58cf 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <net/checksum.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 unsigned int csum_partial_copy(const char *src, char *dst,
                                int len, unsigned int sum)
index 8132dff078fbd2d5e2ee63d7614acd83df729f24..32c317f5d9910bbfd368d96274daebb070113ade 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/cdev.h>
 #include <linux/fs.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <mach-landisk/mach/gio.h>
 #include <mach-landisk/mach/iodata_landisk.h>
 
index 208a9753ab38cd0a532c63b19c379cae8a8494e7..ae1dfdb0013b01337d9216d66e7337c10038b95d 100644 (file)
@@ -11,7 +11,7 @@
  * Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/addrspace.h>
 #include <asm/page.h>
 
index 9f417feaf6e80b86b0c1da4fc740b9d7fe76722a..35ffdd081d2655a7a86f5664314fac0ab962cca5 100644 (file)
@@ -10,7 +10,7 @@
 #ifdef __KERNEL__
 #include <cpu/mmu_context.h>
 #include <asm/tlbflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm-generic/mm_hooks.h>
 
index c8b3be1b54e6e810e4f116fe2264d7a79f267b14..c4f01c5c87362e2f0bf3dc2ce1ec0867ce56c9a9 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/log2.h>
 #include <asm/mmu_context.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/cacheflush.h>
 #include <asm/cache.h>
index 53b8eeb1db20dbf9e87a2a1f8548f1e0c04c0752..c32e66079f7c31f932995c47337adcf48da0deea 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/cpuidle.h>
 #include <linux/export.h>
 #include <asm/suspend.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static unsigned long cpuidle_mode[] = {
        SUSP_SH_SLEEP, /* regular sleep mode */
index ac37b7234f85a5344ebd476311abf45148e3c4c7..fba2be5d72e934cc773ae8c370e44ff027c18bd2 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/io.h>
 #include <linux/suspend.h>
 #include <asm/suspend.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/bl_bit.h>
 
index 569e7b171c01656e646001cc88acb7ec0cc91328..b33be505361edb8bb157ee1cef0c6eeb5ec94a45 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/errno.h>
 #include <linux/crash_dump.h>
 #include <linux/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /**
  * copy_oldmem_page - copy one page from "oldmem"
index f8ce36286cea3f156bfe4e5c59cd2015655fb474..4d4e7a2a774b0b283c38e79b03a7b861ae1faea8 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <asm/mmu_context.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/io_trapped.h>
 
index 6c0378c0b8b5cc179cbf06269e94a02a5d1283c2..bc3591125df7a51a43140e743160b6ee8a040dfb 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/ratelimit.h>
 #include <asm/processor.h>
 #include <asm/machvec.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/thread_info.h>
 #include <cpu/mmu_context.h>
 
index 83acbf3f6de806c7b9ca964dab610220d717a61d..1653ff64b1037ed131513a8509dc03d8861cdefb 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/kdebug.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
 DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
index ee12e94518740829165d7fbcb597fbad90664c5f..51741850a7154078c77e2c7fe52e4cccc07bc5e5 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/hw_breakpoint.h>
 #include <linux/prefetch.h>
 #include <linux/stackprotector.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/fpu.h>
 #include <asm/syscalls.h>
index 9d3e9916555ded6ea4f06c69a5b832d766d483e1..e0b271bffd6a53f86a3420cfdc856f599ade3234 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/module.h>
 #include <linux/io.h>
 #include <asm/syscalls.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
 #include <asm/fpu.h>
index c1a6b89bfe70d588b1aabf5d2814196c505018a8..1aabfd356b35ffeb1b5be56c41b8b6670d851180 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/elf.h>
 #include <linux/regset.h>
 #include <linux/hw_breakpoint.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/mmu_context.h>
index 5cea973a65b25674a34fefb411483d474a723351..c49d0d05a215172d9a001c74621a84f5efa3cbf9 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/elf.h>
 #include <linux/regset.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/mmu_context.h>
index e7b49d81053e930a64b1b17d6c448c9bd0e19674..3a44c753b642c466d4479c1c960821c023daa0bd 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/memblock.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/page.h>
 #include <asm/elf.h>
index 26a0774f5272af46839c1faaf924ae9a4e29af13..6ee3740e009ef287dbb04935fc2bffeba19c3301 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/screen_info.h>
 #include <asm/cacheflush.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/checksum.h>
 #include <asm/io.h>
 #include <asm/delay.h>
index f7c3d5c25caf9f5d88d549d7c07b720959bc5149..5128d3001ee588711837af8524a875eb952de034 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/io.h>
 #include <linux/tracehook.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
 #include <asm/syscalls.h>
index d8a3f0d2280983030ccd7b637ed5d940ed50219a..7b77f18124349c5fabc7be8ca335e0693dfd2995 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/stddef.h>
 #include <linux/tracehook.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
 #include <asm/fpu.h>
index 8c6a350df751a97779cfe7030054b416203f9d9a..6576e5ee1fc3632c1880af2c298b4311996261c4 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/fs.h>
 #include <linux/ipc.h>
 #include <asm/syscalls.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/cacheflush.h>
 #include <asm/cachectl.h>
index b66d1c62eb1901d67c110b0b7032e5657c95b718..d5287d76809c02c3d654047f00f816a8a43aff73 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/fs.h>
 #include <linux/ipc.h>
 #include <asm/cacheflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/syscalls.h>
 
index d208c27ccc67c0738c38f327175fcb18135ee7c2..00835edb6e20f88eef29f67be862e890acad1353 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/sysctl.h>
 #include <linux/module.h>
 #include <linux/perf_event.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/alignment.h>
 #include <asm/processor.h>
index 04aa55fa8c7591546827e5012c9f7b8309683011..5078cb809750f5f0db2e0602d9f8b35b00818906 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/signal.h>
 #include <linux/perf_event.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 
index 777e50f33c00f3f96fe4b34f7723132507b13935..4eb9d43578b4c3ead533bcae6030ec4ead92ce95 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cache.h>
 #include <asm/io.h>
 
index e37523f651950b1ad38a0102155521698e40188d..031634f273fa06ee493d646340b7d82a890eb25d 100644 (file)
@@ -17,7 +17,7 @@
 #include <asm/processor.h>
 #include <asm/cache.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
index d1bffbcd9d525e2164cf64f5fd32e88b46bf88ee..d94dadedf74f57d5ad8d34d28c8c4cc3201745d1 100644 (file)
@@ -17,7 +17,7 @@
 #include <asm/processor.h>
 #include <asm/cache.h>
 #include <asm/pgalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 
 extern void __weak sh4__flush_region_init(void);
index 7729cca727ebebb48dfd787d0dd9a601dc9d1be3..6cd2aa395817a34e5aacbdacd9c83605a9593f79 100644 (file)
@@ -20,7 +20,7 @@
 #include <asm/processor.h>
 #include <asm/cache.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
index c1cf4463d09db8f1237a03fb5d614a08ae603621..9cfcbb5848e45201bd42c44672f80cae51c68693 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int fixup_exception(struct pt_regs *regs)
 {
index f05499688d88e1051d247eb7357910fa0b03c54e..96edaff8c98329d4f6fbffbe506d79e602df8d2f 100644 (file)
@@ -12,7 +12,7 @@
  */
 #include <linux/rwsem.h>
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 extern unsigned long copy_user_memcpy, copy_user_memcpy_end;
 extern void __copy_user_fixup(void);
index 36312d254faf3bb7714375b9e60c6844c754ab8e..82f8197b93f685975856fdfd9df486840645af3a 100644 (file)
@@ -14,7 +14,7 @@
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/page.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * Nothing too terribly exciting here ..
index 7160c9fd6fe3ab3e4283d440032396bbf65c453c..7b2cc490ebb73c3e0afd6246c950f94572d76fcf 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/vmalloc.h>
 #include <asm/cacheflush.h>
 #include <asm/sizes.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
index 6554fb439f0e5c01c8ca8ea7bc6b0d06303b90a4..5c66665bff8b5572bffa6c4887ced2dadeb36f28 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/interrupt.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
index 8557548fc53eea25b4b84f0237615b1a96858f1c..8ff966dd0c7431b66cd691532de21fe4f8077bbd 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/kprobes.h>
 #include <asm/tlb.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/mmu_context.h>
 
index f33fdd2558e8ef74a56b2693e454e976f7c8cdbc..bd0715d5dca4c25023f4763e401a28c7791aa09d 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/interrupt.h>
 #include <asm/io.h>
 #include <asm/tlb.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/mmu_context.h>
 
index 9c88dcd56e865851665f3ada46690f00e6cc625e..c7695f99c8c3cb2e6fc2972607cca9f555d2e6d8 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/mm.h>
 #include <asm/unwinder.h>
 #include <asm/ptrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sections.h>
 #include <asm/stacktrace.h>
 
index eff748c871ec372009111d9fbf2f20701ce1e04f..e25af5fc99fd41e3619dc1c0e3742eec5318de10 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #include <linux/in6.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* computes the checksum of a memory block at buff, length len,
  * and adds in "sum" (32-bit)
index 0395d75322e9640cda2a2de4d77fe8c980b6ca7a..96a5ed58cea605e6b7c17bb0ea3f4251743f3218 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #include <linux/in6.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* computes the checksum of a memory block at buff, length len,
  * and adds in "sum" (32-bit)
index 742f6c4436bf2a9397ce9eb20b073f70d26b044e..9ebc37e7d64c21c2b24034904b3d0f9fcace9690 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <asm/io.h>
 #include <asm/oplib.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/auxio.h>
 #include <asm/apc.h>
 #include <asm/processor.h>
index 34a7930b76ef1056dfa6ad1633e4cd8b4493138c..3bebf395252cc63ee3b39996f8a0d0431e7faf37 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/timer.h>
 #include <asm/smp.h>
 #include <asm/starfire.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cache.h>
 #include <asm/cpudata.h>
 #include <asm/auxio.h>
index b0377db12d83242fcd0ad3790be8bbab180ab3ca..2d13a4fc038489c7cee8068bc19c6c4419219e0b 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/context_tracking.h>
 #include <asm/signal.h>
 #include <asm/cacheflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* We do not have hardware single-stepping on sparc64.
  * So we implement software single-stepping with breakpoint
index 8a6982dfd7334fe1ff41cd830bbe320f05e25b30..c0765bbf60eaa35d9ad4814b3aea6d71e274ddb8 100644 (file)
@@ -17,7 +17,7 @@
 #include <asm/hypervisor.h>
 #include <asm/mdesc.h>
 #include <asm/prom.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/oplib.h>
 #include <asm/smp.h>
 
index 9c1878f4fa9f31a69f0849252ef160550689fcd5..015e55a7495d40cc3fd93c535b0723cd6ce147b4 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/irq.h>
 #include <asm/prom.h>
index 24384e1dc33d30bd22a8bc819f7b87daf0d3612b..a38787b843220807d0f5527f864981fc75e8486f 100644 (file)
@@ -33,7 +33,7 @@
 #include <asm/pcic.h>
 #include <asm/timex.h>
 #include <asm/timer.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq_regs.h>
 
 #include "kernel.h"
index 97d123107ecb8bd7d5c8daa1e92e605853b97a5d..f12b23f7b51570de14445cf9e23680279831d3e4 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <asm/io.h>
 #include <asm/oplib.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/auxio.h>
 #include <asm/processor.h>
 
index b7780a5bef11a8cc9d21a2e18707fd18613c99d2..48ffc3e7d1dd9a803bd179ee834fb728832d4b6f 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <asm/auxio.h>
 #include <asm/oplib.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
index 47ff5588e5213748d34bd4d6876eeefb779aca12..d249ca10b20337de9a9f996752f51cb283e308e0 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/nmi.h>
 #include <linux/context_tracking.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
index a331fdc11a2cc04748251d7b69d491791d9e210e..eca3dc76793c05eafc88281ce1dc1b17fcfc5b89 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/tracehook.h>
 
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 
 #include "kernel.h"
index 96494b2ef41f52bc721195253632a91e107ae7bd..901063c1cf7eedcfed5a19d0f2135afd9e6d7958 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <asm/asi.h>
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/psrcompat.h>
 #include <asm/visasm.h>
 #include <asm/spitfire.h>
index 91cc2f4ae4d98ba67ae74e5e31cf58ee06d57db4..b4096bb665b2dd736fd1da18d0b756d081d4100c 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/bitops.h>
 #include <linux/tracehook.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ptrace.h>
 #include <asm/pgtable.h>
 #include <asm/psrcompat.h>
index 9c0c8fd0b2922cacd2ad6ad81f3238a707286d69..62c3e255ae7cdbfbab1262110d6d592c5918fd52 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/bitops.h>
 #include <linux/tracehook.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ptrace.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
index c782c9b716db9ab0b00fe55fca397137bf6875c9..965d50e833e76dadc50b79ba24189a5884c7d9bc 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/bitops.h>
 #include <linux/context_tracking.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ptrace.h>
 #include <asm/pgtable.h>
 #include <asm/fpumacro.h>
index 8182f7caf5b1faa0b5d3cdc3a767411da4ad9f2a..0ce347f8e4ccf30ae94bb52ec0d4dca4642fa5c6 100644 (file)
@@ -43,7 +43,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/oplib.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/starfire.h>
 #include <asm/tlb.h>
 #include <asm/sections.h>
index 022c30c72ebd4bd330de4ca72281bd35fd3c0a36..bca44f3e6b86ca5e3c5def34c3db9ad2670e0898 100644 (file)
@@ -44,7 +44,7 @@
 #include <linux/slab.h>
 
 #include <asm/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/fpumacro.h>
 #include <asm/mmu_context.h>
 #include <asm/compat_signal.h>
index 646988d4c1a35aca56c0a3f0c56abdf1ca183587..fb7b185ee9417175a4f7db07a601c308cd52ca21 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/smp.h>
 #include <linux/ipc.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 
 #include "systbls.h"
index fe8b8ee8e6602307bebf6813704146da7d9bc30e..884c70331345d860291180790e8cf4111023dbb2 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/export.h>
 #include <linux/context_tracking.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/utrap.h>
 #include <asm/unistd.h>
 
index 1affabc96b087bb699a339372f0b0f963c92ecbd..244062bdaa564b9ea3471da9b6a9fe86125fa00e 100644 (file)
@@ -148,7 +148,7 @@ static unsigned int sbus_cycles_offset(void)
        return offset;
 }
 
-static cycle_t timer_cs_read(struct clocksource *cs)
+static u64 timer_cs_read(struct clocksource *cs)
 {
        unsigned int seq, offset;
        u64 cycles;
index c69b21e51efc444b7bd9ec11c6ff0cafd5220c71..12a6d3555cb84332a5755ad18c13eb84b62c60b6 100644 (file)
@@ -45,7 +45,7 @@
 #include <asm/smp.h>
 #include <asm/sections.h>
 #include <asm/cpudata.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq_regs.h>
 
 #include "entry.h"
@@ -770,7 +770,7 @@ void udelay(unsigned long usecs)
 }
 EXPORT_SYMBOL(udelay);
 
-static cycle_t clocksource_tick_read(struct clocksource *cs)
+static u64 clocksource_tick_read(struct clocksource *cs)
 {
        return tick_ops->get_tick();
 }
index 496fa926e1e003ef85fc6ec7303b1db1ea1b8763..4bc10e44d1ca32a0acdf69b8492e128e7ef0e600 100644 (file)
@@ -29,7 +29,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/unistd.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/fpumacro.h>
 #include <asm/lsu.h>
 #include <asm/dcu.h>
index 32b61d1b637981b711669e2c864c0ffe186cfb13..d20d4e3fd129d633a0f171df8062cb578230c13f 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/mm.h>
 #include <asm/ptrace.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/smp.h>
 #include <linux/perf_event.h>
 
index 52c00d90d4b46556a981db8b727d5255ebfe850e..cda7fd367c4f6952eb7de1f6a368018d4eeb0f76 100644 (file)
@@ -16,7 +16,7 @@
 #include <asm/ptrace.h>
 #include <asm/pstate.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/smp.h>
 #include <linux/bitops.h>
 #include <linux/perf_event.h>
index b6831405060239f8c419aa849fd5b112dda55536..d852ae56ddc1a2581affcd2424d8844064966840 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/kdebug.h>
 
 #include <asm/cacheflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Compute the address of the breakpoint instruction and return it.
  *
index c096c624ac4d44ad6bd723b4bce88510dcdf70f5..c4ac58e483a4ebacad0b96b552176bc43d99a301 100644 (file)
@@ -10,7 +10,7 @@
 #include <asm/ptrace.h>
 #include <asm/pstate.h>
 #include <asm/fpumacro.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 
 /* OPF field of various VIS instructions.  */
index 87bab0a3857a528bf7e90bf72a1d83fad2513b99..435a467b0595f10f305a2fc150f1c8134be4e3aa 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/smp.h>
 
 #include <asm/cacheflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "kernel.h"
 
index 5ce8f2f64604a0399e792cada3d9c3026f6a36c0..4d7e0fff054f65d47726d0b22b8f3d0464e2f214 100644 (file)
@@ -68,7 +68,7 @@
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/perf_event.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "sfp-util_32.h"
 #include <math-emu/soft-fp.h>
index 034aadbff036fd617c8cae7afbcac20eee0ecaf8..9647051853d33fd6cfe47531c3156a31584eca85 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <asm/fpumacro.h>
 #include <asm/ptrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 
 #include "sfp-util_64.h"
index a61c349448e1e12b28621b3590553593f2d3b799..768a11e6bd4fa083a34c8b2ef2bd62aa2bbd1553 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 void sort_extable(struct exception_table_entry *start,
                  struct exception_table_entry *finish)
index 37aa537b3ad841522d9a13c2b4695edb7b092a28..5d2f91511c60ce6099bc4e2ce3d383004febaffc 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/oplib.h>
 #include <asm/iommu.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/tlbflush.h>
 #include <asm/dma.h>
index 9f37106ef93ab0850408c06884311380020ffd45..c84c54a1ac550136a54798ccd1065041c7158c38 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/syscalls.h>
 #include <asm/traps.h>
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #ifdef CONFIG_HARDWALL
 #include <asm/hardwall.h>
 #endif
index 862973074bf91823cea501ee710811cf1b973a31..de3eae813e52e97bd6ec2f660a4611df012c48a7 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/prctl.h>
 #include <asm/cacheflush.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 #include <arch/abi.h>
 #include <arch/spr_def.h>
index 4fe78c5b839492c1935b26fece721f32dc23d88a..f229e979584e038362f0e161cd1cd771d65142c1 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/prctl.h>
 #include <asm/cacheflush.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 #include <arch/abi.h>
 #include <arch/spr_def.h>
index 3282787bbcfbaa69fb735929438a7f189c63000e..6d381279b362bf8f04b4fc17e8944f16885579a8 100644 (file)
@@ -45,7 +45,7 @@
 #include <linux/mutex.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "mconsole.h"
 
 MODULE_LICENSE("GPL");
index 3a4b58730f5fbcf45e8a586b2005e3b4b9688eda..12bdb5996bf56cb54d3b0e9ea3b980ceb14d44d6 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/sound.h>
 #include <linux/soundcard.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <init.h>
 #include <os.h>
 
index 8a6b57108ac26120cc25a037499d15432e6a0851..8a4c72af3bc0abbca5f0af14513f5031320ddb94 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/fs.h>
 #include <linux/mount.h>
 #include <linux/file.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/switch_to.h>
 
 #include <init.h>
index 62145c27616759dc2cc09fa4196356feed00939b..3645fcb2a7874e0e4de8f485fc9f2a53b4ef8db1 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <mem_user.h>
 
 /* These are set in mmapper_init, which is called at boot time */
index dd16c902ff701398c14e055bf71aa6e6a612dfff..05523f14d7b2b3de379e4f837d6567c2234fa8f4 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/interrupt.h>
 #include <linux/miscdevice.h>
 #include <linux/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <irq_kern.h>
 #include <os.h>
 
index 0d7103c9eff3d21c29f15f2f54d5aeabcb0a8449..770ec07b6a6af06385674fad8586b8d5414ff230 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/slab.h>
 #include <asm/current.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <as-layout.h>
 #include <mem_user.h>
 #include <skas.h>
index 41ebbfebb3332f2bc7269a754ff96b377e17212b..546302e3b7fbf0db7fef2faf9e5b77695f312c3e 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * If read and write race, the read will still atomically read a valid
index 034b42c7ab40566c6aad9704090b27b626c4bc0b..078630d6448c07f1ccbbd225f8aaca8e3dbeba68 100644 (file)
@@ -24,7 +24,7 @@
 #include <asm/current.h>
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <as-layout.h>
 #include <kern_util.h>
 #include <os.h>
index 6a826cbb15c4d97097f39e690a250bc6f52eb9f2..bc2a516c190f8b5a1073ff273fcdb2d9558867fd 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/ptrace.h>
 #include <linux/sched.h>
 #include <linux/tracehook.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ptrace-abi.h>
 
 void user_enable_single_step(struct task_struct *child)
index c1d0ae069b5343f9876b723743e695aea0c26bd8..6258676bed85a4a472768cbdcc354793f86c50c8 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/syscalls.h>
 #include <asm/current.h>
 #include <asm/mman.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 
 long old_mmap(unsigned long addr, unsigned long len,
index 25c23666d5924836c1ab19a95cbdefa1c70e7ab1..ba87a27d6715872d77723eff3c480cf587589d61 100644 (file)
@@ -83,7 +83,7 @@ static irqreturn_t um_timer(int irq, void *dev)
        return IRQ_HANDLED;
 }
 
-static cycle_t timer_read(struct clocksource *cs)
+static u64 timer_read(struct clocksource *cs)
 {
        return os_nsecs() / TIMER_MULTIPLIER;
 }
index ac4c5449bb88dad90a1f194088f84d724aa4c622..fceaa673f8614f0ef0a375ff9007c813bc8710fe 100644 (file)
@@ -62,7 +62,7 @@ static struct clock_event_device ckevt_puv3_osmr0 = {
        .set_state_oneshot      = puv3_osmr0_shutdown,
 };
 
-static cycle_t puv3_read_oscr(struct clocksource *cs)
+static u64 puv3_read_oscr(struct clocksource *cs)
 {
        return readl(OST_OSCR);
 }
index 4224ede43b4edc3df93b5e669cc091d73b9186b5..26240dde081e82e696b9a828a191b01c7bdaf0a9 100644 (file)
@@ -87,12 +87,6 @@ int validate_cpu(void)
                return -1;
        }
 
-       if (CONFIG_X86_MINIMUM_CPU_FAMILY <= 4 && !IS_ENABLED(CONFIG_M486) &&
-           !has_eflag(X86_EFLAGS_ID)) {
-               printf("This kernel requires a CPU with the CPUID instruction.  Build with CONFIG_M486=y to run on this CPU.\n");
-               return -1;
-       }
-
        if (err_flags) {
                puts("This kernel requires the following features "
                     "not present on the CPU:\n");
index bdd9cc59d20f7b514cf9ecb1f53ca49a5deb4d5b..b83c61cfd1546d0b9ee0ad1b028e90455d1176a2 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/desc.h>
 #include <asm/traps.h>
 #include <asm/vdso.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cpufeature.h>
 
 #define CREATE_TRACE_POINTS
index 02223cb4bcfd8155f041aac6ccd11a448ec5ebbe..9d4d6e1383117b5091a172b1c373eb2dc7ed3c2e 100644 (file)
@@ -92,10 +92,10 @@ static notrace const struct pvclock_vsyscall_time_info *get_pvti0(void)
        return (const struct pvclock_vsyscall_time_info *)&pvclock_page;
 }
 
-static notrace cycle_t vread_pvclock(int *mode)
+static notrace u64 vread_pvclock(int *mode)
 {
        const struct pvclock_vcpu_time_info *pvti = &get_pvti0()->pvti;
-       cycle_t ret;
+       u64 ret;
        u64 last;
        u32 version;
 
@@ -142,9 +142,9 @@ static notrace cycle_t vread_pvclock(int *mode)
 }
 #endif
 
-notrace static cycle_t vread_tsc(void)
+notrace static u64 vread_tsc(void)
 {
-       cycle_t ret = (cycle_t)rdtsc_ordered();
+       u64 ret = (u64)rdtsc_ordered();
        u64 last = gtod->cycle_last;
 
        if (likely(ret >= last))
index 40121d14d34d140b5dcd8b14ed0143d9f6b70a02..10820f6cefbf020737d1729fb92a7217fe0827fe 100644 (file)
@@ -371,7 +371,7 @@ static int __init init_vdso(void)
 
        /* notifier priority > KVM */
        return cpuhp_setup_state(CPUHP_AP_X86_VDSO_VMA_ONLINE,
-                                "AP_X86_VDSO_VMA_ONLINE", vgetcpu_online, NULL);
+                                "x86/vdso/vma:online", vgetcpu_online, NULL);
 }
 subsys_initcall(init_vdso);
 #endif /* CONFIG_X86_64 */
index b26ee32f73e8af227901b2b7f6d0a5ad620f65a3..05612a2529c8bba1e9aa9131a4cabaebe96d5736 100644 (file)
@@ -1010,7 +1010,7 @@ static __init int amd_ibs_init(void)
         * all online cpus.
         */
        cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_IBS_STARTING,
-                         "AP_PERF_X86_AMD_IBS_STARTING",
+                         "perf/x86/amd/ibs:STARTING",
                          x86_pmu_amd_ibs_starting_cpu,
                          x86_pmu_amd_ibs_dying_cpu);
 
index 9842270ed2f20b27f587ef36fefb86a6ff17a951..a6eee5ac4f581d927e9862cfbde643971fc76cf8 100644 (file)
@@ -291,7 +291,7 @@ static int __init amd_power_pmu_init(void)
 
 
        cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_POWER_ONLINE,
-                         "AP_PERF_X86_AMD_POWER_ONLINE",
+                         "perf/x86/amd/power:online",
                          power_cpu_init, power_cpu_exit);
 
        ret = perf_pmu_register(&pmu_class, "power", -1);
index 65577f081d072c5f774f763adc19a0e7a87e5627..a0b1bdb3ad421ed93746718717d47eb84904e86f 100644 (file)
@@ -527,16 +527,16 @@ static int __init amd_uncore_init(void)
         * Install callbacks. Core will call them for each online cpu.
         */
        if (cpuhp_setup_state(CPUHP_PERF_X86_AMD_UNCORE_PREP,
-                             "PERF_X86_AMD_UNCORE_PREP",
+                             "perf/x86/amd/uncore:prepare",
                              amd_uncore_cpu_up_prepare, amd_uncore_cpu_dead))
                goto fail_l2;
 
        if (cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
-                             "AP_PERF_X86_AMD_UNCORE_STARTING",
+                             "perf/x86/amd/uncore:starting",
                              amd_uncore_cpu_starting, NULL))
                goto fail_prep;
        if (cpuhp_setup_state(CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE,
-                             "AP_PERF_X86_AMD_UNCORE_ONLINE",
+                             "perf/x86/amd/uncore:online",
                              amd_uncore_cpu_online,
                              amd_uncore_cpu_down_prepare))
                goto fail_start;
index f1c22584a46f50342d56a642ca83db1504983b0e..019c5887b698af2a5fbf322c7cc5d6d3f8ab7e57 100644 (file)
@@ -1820,18 +1820,18 @@ static int __init init_hw_perf_events(void)
         * Install callbacks. Core will call them for each online
         * cpu.
         */
-       err = cpuhp_setup_state(CPUHP_PERF_X86_PREPARE, "PERF_X86_PREPARE",
+       err = cpuhp_setup_state(CPUHP_PERF_X86_PREPARE, "perf/x86:prepare",
                                x86_pmu_prepare_cpu, x86_pmu_dead_cpu);
        if (err)
                return err;
 
        err = cpuhp_setup_state(CPUHP_AP_PERF_X86_STARTING,
-                               "AP_PERF_X86_STARTING", x86_pmu_starting_cpu,
+                               "perf/x86:starting", x86_pmu_starting_cpu,
                                x86_pmu_dying_cpu);
        if (err)
                goto out;
 
-       err = cpuhp_setup_state(CPUHP_AP_PERF_X86_ONLINE, "AP_PERF_X86_ONLINE",
+       err = cpuhp_setup_state(CPUHP_AP_PERF_X86_ONLINE, "perf/x86:online",
                                x86_pmu_online_cpu, NULL);
        if (err)
                goto out1;
index cb8522290e6a3f6dc3b5baacfc618d0ee8db65e3..86138267b68a77753737ffd4c4be2ece6a24cc84 100644 (file)
@@ -2110,6 +2110,27 @@ again:
                    GLOBAL_STATUS_LBRS_FROZEN);
        if (!status)
                goto done;
+       /*
+        * In case multiple PEBS events are sampled at the same time,
+        * it is possible to have GLOBAL_STATUS bit 62 set indicating
+        * PEBS buffer overflow and also seeing at most 3 PEBS counters
+        * having their bits set in the status register. This is a sign
+        * that there was at least one PEBS record pending at the time
+        * of the PMU interrupt. PEBS counters must only be processed
+        * via the drain_pebs() calls and not via the regular sample
+        * processing loop coming after that the function, otherwise
+        * phony regular samples may be generated in the sampling buffer
+        * not marked with the EXACT tag. Another possibility is to have
+        * one PEBS event and at least one non-PEBS event whic hoverflows
+        * while PEBS has armed. In this case, bit 62 of GLOBAL_STATUS will
+        * not be set, yet the overflow status bit for the PEBS counter will
+        * be on Skylake.
+        *
+        * To avoid this problem, we systematically ignore the PEBS-enabled
+        * counters from the GLOBAL_STATUS mask and we always process PEBS
+        * events via drain_pebs().
+        */
+       status &= ~cpuc->pebs_enabled;
 
        /*
         * PEBS overflow sets bit 62 in the global status register
@@ -2117,15 +2138,6 @@ again:
        if (__test_and_clear_bit(62, (unsigned long *)&status)) {
                handled++;
                x86_pmu.drain_pebs(regs);
-               /*
-                * There are cases where, even though, the PEBS ovfl bit is set
-                * in GLOBAL_OVF_STATUS, the PEBS events may also have their
-                * overflow bits set for their counters. We must clear them
-                * here because they have been processed as exact samples in
-                * the drain_pebs() routine. They must not be processed again
-                * in the for_each_bit_set() loop for regular samples below.
-                */
-               status &= ~cpuc->pebs_enabled;
                status &= x86_pmu.intel_ctrl | GLOBAL_STATUS_TRACE_TOPAPMI;
        }
 
index 0c45cc8e64ba77f6988cff5a0e5443dfe0449435..8c00dc09a5d2cf41e0e0af5f6eb76577f4f0df09 100644 (file)
@@ -1747,9 +1747,9 @@ static int __init intel_cqm_init(void)
         * is enabled to avoid notifier leak.
         */
        cpuhp_setup_state(CPUHP_AP_PERF_X86_CQM_STARTING,
-                         "AP_PERF_X86_CQM_STARTING",
+                         "perf/x86/cqm:starting",
                          intel_cqm_cpu_starting, NULL);
-       cpuhp_setup_state(CPUHP_AP_PERF_X86_CQM_ONLINE, "AP_PERF_X86_CQM_ONLINE",
+       cpuhp_setup_state(CPUHP_AP_PERF_X86_CQM_ONLINE, "perf/x86/cqm:online",
                          NULL, intel_cqm_cpu_exit);
 
 out:
index da51e5a3e2ff799d54257aa3db5151b4723c8292..fec8a461bdef6da49c0e7f46c655f235e7fc1275 100644 (file)
@@ -594,6 +594,9 @@ static int __init cstate_probe(const struct cstate_model *cm)
 
 static inline void cstate_cleanup(void)
 {
+       cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_CSTATE_ONLINE);
+       cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_CSTATE_STARTING);
+
        if (has_cstate_core)
                perf_pmu_unregister(&cstate_core_pmu);
 
@@ -606,16 +609,16 @@ static int __init cstate_init(void)
        int err;
 
        cpuhp_setup_state(CPUHP_AP_PERF_X86_CSTATE_STARTING,
-                         "AP_PERF_X86_CSTATE_STARTING", cstate_cpu_init,
-                         NULL);
+                         "perf/x86/cstate:starting", cstate_cpu_init, NULL);
        cpuhp_setup_state(CPUHP_AP_PERF_X86_CSTATE_ONLINE,
-                         "AP_PERF_X86_CSTATE_ONLINE", NULL, cstate_cpu_exit);
+                         "perf/x86/cstate:online", NULL, cstate_cpu_exit);
 
        if (has_cstate_core) {
                err = perf_pmu_register(&cstate_core_pmu, cstate_core_pmu.name, -1);
                if (err) {
                        has_cstate_core = false;
                        pr_info("Failed to register cstate core pmu\n");
+                       cstate_cleanup();
                        return err;
                }
        }
@@ -629,8 +632,7 @@ static int __init cstate_init(void)
                        return err;
                }
        }
-
-       return err;
+       return 0;
 }
 
 static int __init cstate_pmu_init(void)
@@ -655,8 +657,6 @@ module_init(cstate_pmu_init);
 
 static void __exit cstate_pmu_exit(void)
 {
-       cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_CSTATE_ONLINE);
-       cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_CSTATE_STARTING);
        cstate_cleanup();
 }
 module_exit(cstate_pmu_exit);
index 0a535cea8ff31adf6e06fc32ff763d423a73ab74..bd34124449b08a4be95f114b3295c22e4d57cd34 100644 (file)
@@ -803,13 +803,13 @@ static int __init rapl_pmu_init(void)
         * Install callbacks. Core will call them for each online cpu.
         */
 
-       ret = cpuhp_setup_state(CPUHP_PERF_X86_RAPL_PREP, "PERF_X86_RAPL_PREP",
+       ret = cpuhp_setup_state(CPUHP_PERF_X86_RAPL_PREP, "perf/x86/rapl:prepare",
                                rapl_cpu_prepare, NULL);
        if (ret)
                goto out;
 
        ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_RAPL_ONLINE,
-                               "AP_PERF_X86_RAPL_ONLINE",
+                               "perf/x86/rapl:online",
                                rapl_cpu_online, rapl_cpu_offline);
        if (ret)
                goto out1;
index dbaaf7dc8373cb0248a4637abe4a211f266fb2db..97c246f84dea1e79d0f4517376763dcb88a18aea 100644 (file)
@@ -1398,22 +1398,22 @@ static int __init intel_uncore_init(void)
         */
        if (!cret) {
               ret = cpuhp_setup_state(CPUHP_PERF_X86_UNCORE_PREP,
-                                       "PERF_X86_UNCORE_PREP",
-                                       uncore_cpu_prepare, NULL);
+                                      "perf/x86/intel/uncore:prepare",
+                                      uncore_cpu_prepare, NULL);
                if (ret)
                        goto err;
        } else {
                cpuhp_setup_state_nocalls(CPUHP_PERF_X86_UNCORE_PREP,
-                                         "PERF_X86_UNCORE_PREP",
+                                         "perf/x86/intel/uncore:prepare",
                                          uncore_cpu_prepare, NULL);
        }
        first_init = 1;
        cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_STARTING,
-                         "AP_PERF_X86_UNCORE_STARTING",
+                         "perf/x86/uncore:starting",
                          uncore_cpu_starting, uncore_cpu_dying);
        first_init = 0;
        cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE,
-                         "AP_PERF_X86_UNCORE_ONLINE",
+                         "perf/x86/uncore:online",
                          uncore_event_cpu_online, uncore_event_cpu_offline);
        return 0;
 
index 272427700d48deebdbcb582b1bd4af143e44a58c..e6832be714bc6e76965e1faa7cedcc3ad309c8fa 100644 (file)
@@ -669,7 +669,7 @@ static struct event_constraint snbep_uncore_cbox_constraints[] = {
        UNCORE_EVENT_CONSTRAINT(0x1c, 0xc),
        UNCORE_EVENT_CONSTRAINT(0x1d, 0xc),
        UNCORE_EVENT_CONSTRAINT(0x1e, 0xc),
-       EVENT_CONSTRAINT_OVERLAP(0x1f, 0xe, 0xff),
+       UNCORE_EVENT_CONSTRAINT(0x1f, 0xe),
        UNCORE_EVENT_CONSTRAINT(0x21, 0x3),
        UNCORE_EVENT_CONSTRAINT(0x23, 0x3),
        UNCORE_EVENT_CONSTRAINT(0x31, 0x3),
index cb26f18d43af3ad01f24514dd43f0748e8839b63..7c0a711989d2c06726806ae31d91805d26168429 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/jiffies.h>
 #include <linux/perf_event.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/cacheflush.h>
 #include <asm/user32.h>
index cb13c0564ea7b07eb08617f07cacab589e7b6dd1..95c0b4ae09b0102a47e7c4c8fb64d2665db1d765 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/compat.h>
 #include <linux/binfmts.h>
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/fpu/internal.h>
 #include <asm/fpu/signal.h>
 #include <asm/ptrace.h>
index 719cd702b0a476e13abb42bfa28b0a7911204382..47956c6a4fd8b397edac10436d0deb1b83778804 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/slab.h>
 #include <asm/mman.h>
 #include <asm/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 #include <asm/vgtod.h>
 #include <asm/sys_ia32.h>
index 44b8762fa0c784b44a44d22e390af48ce2dcb5d0..830b19dbfa3101b73db8dc24c5510ee7d8dbd5a5 100644 (file)
@@ -1,5 +1,5 @@
 #include <asm/ftrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/string.h>
 #include <asm/page.h>
 #include <asm/checksum.h>
index 68557f52b9619ddfed7681fc43c2d0530c625f0f..854022772c5be4d49d2697bd2b66b454f49c9e6f 100644 (file)
@@ -139,6 +139,19 @@ static __always_inline void __clear_bit(long nr, volatile unsigned long *addr)
        asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
 }
 
+static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr)
+{
+       bool negative;
+       asm volatile(LOCK_PREFIX "andb %2,%1\n\t"
+               CC_SET(s)
+               : CC_OUT(s) (negative), ADDR
+               : "ir" ((char) ~(1 << nr)) : "memory");
+       return negative;
+}
+
+// Let everybody know we have it
+#define clear_bit_unlock_is_negative_byte clear_bit_unlock_is_negative_byte
+
 /*
  * __clear_bit_unlock - Clears a bit in memory
  * @nr: Bit to clear
index c020ee75dce7757efae7232a3e2a0815619a42fc..08e7efb2c1402fe9e10578d33de881c535a71d95 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <linux/compiler.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 /**
index 2e25038dbd932cfec9381eccbc1f4c30fe0c7b2e..a7066dc1a7e9ca894784b3eeee328c214f1c6162 100644 (file)
@@ -768,7 +768,7 @@ struct kvm_arch {
        spinlock_t pvclock_gtod_sync_lock;
        bool use_master_clock;
        u64 master_kernel_ns;
-       cycle_t master_cycle_now;
+       u64 master_cycle_now;
        struct delayed_work kvmclock_update_work;
        struct delayed_work kvmclock_sync_work;
 
index 6aa741fbe1df0b16aad52d93baec5816ffdfef37..eaf100508c36203ad888c0b4484ba264e20bd0ad 100644 (file)
@@ -602,33 +602,69 @@ static __always_inline void cpu_relax(void)
        rep_nop();
 }
 
-/* Stop speculative execution and prefetching of modified code. */
+/*
+ * This function forces the icache and prefetched instruction stream to
+ * catch up with reality in two very specific cases:
+ *
+ *  a) Text was modified using one virtual address and is about to be executed
+ *     from the same physical page at a different virtual address.
+ *
+ *  b) Text was modified on a different CPU, may subsequently be
+ *     executed on this CPU, and you want to make sure the new version
+ *     gets executed.  This generally means you're calling this in a IPI.
+ *
+ * If you're calling this for a different reason, you're probably doing
+ * it wrong.
+ */
 static inline void sync_core(void)
 {
-       int tmp;
-
-#ifdef CONFIG_M486
        /*
-        * Do a CPUID if available, otherwise do a jump.  The jump
-        * can conveniently enough be the jump around CPUID.
+        * There are quite a few ways to do this.  IRET-to-self is nice
+        * because it works on every CPU, at any CPL (so it's compatible
+        * with paravirtualization), and it never exits to a hypervisor.
+        * The only down sides are that it's a bit slow (it seems to be
+        * a bit more than 2x slower than the fastest options) and that
+        * it unmasks NMIs.  The "push %cs" is needed because, in
+        * paravirtual environments, __KERNEL_CS may not be a valid CS
+        * value when we do IRET directly.
+        *
+        * In case NMI unmasking or performance ever becomes a problem,
+        * the next best option appears to be MOV-to-CR2 and an
+        * unconditional jump.  That sequence also works on all CPUs,
+        * but it will fault at CPL3 (i.e. Xen PV and lguest).
+        *
+        * CPUID is the conventional way, but it's nasty: it doesn't
+        * exist on some 486-like CPUs, and it usually exits to a
+        * hypervisor.
+        *
+        * Like all of Linux's memory ordering operations, this is a
+        * compiler barrier as well.
         */
-       asm volatile("cmpl %2,%1\n\t"
-                    "jl 1f\n\t"
-                    "cpuid\n"
-                    "1:"
-                    : "=a" (tmp)
-                    : "rm" (boot_cpu_data.cpuid_level), "ri" (0), "0" (1)
-                    : "ebx", "ecx", "edx", "memory");
+       register void *__sp asm(_ASM_SP);
+
+#ifdef CONFIG_X86_32
+       asm volatile (
+               "pushfl\n\t"
+               "pushl %%cs\n\t"
+               "pushl $1f\n\t"
+               "iret\n\t"
+               "1:"
+               : "+r" (__sp) : : "memory");
 #else
-       /*
-        * CPUID is a barrier to speculative execution.
-        * Prefetched instructions are automatically
-        * invalidated when modified.
-        */
-       asm volatile("cpuid"
-                    : "=a" (tmp)
-                    : "0" (1)
-                    : "ebx", "ecx", "edx", "memory");
+       unsigned int tmp;
+
+       asm volatile (
+               "mov %%ss, %0\n\t"
+               "pushq %q0\n\t"
+               "pushq %%rsp\n\t"
+               "addq $8, (%%rsp)\n\t"
+               "pushfq\n\t"
+               "mov %%cs, %0\n\t"
+               "pushq %q0\n\t"
+               "pushq $1f\n\t"
+               "iretq\n\t"
+               "1:"
+               : "=&r" (tmp), "+r" (__sp) : : "cc", "memory");
 #endif
 }
 
index 3ad741b84072b33f85c386c0abfda7eda649de39..448cfe1b48cf02b46c76b76cf2aa0be93b3df0bc 100644 (file)
@@ -14,7 +14,7 @@ static inline struct pvclock_vsyscall_time_info *pvclock_pvti_cpu0_va(void)
 #endif
 
 /* some helper functions for xen and kvm pv clock sources */
-cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src);
+u64 pvclock_clocksource_read(struct pvclock_vcpu_time_info *src);
 u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src);
 void pvclock_set_flags(u8 flags);
 unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src);
@@ -87,11 +87,10 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
 }
 
 static __always_inline
-cycle_t __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
-                             u64 tsc)
+u64 __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src, u64 tsc)
 {
        u64 delta = tsc - src->tsc_timestamp;
-       cycle_t offset = pvclock_scale_delta(delta, src->tsc_to_system_mul,
+       u64 offset = pvclock_scale_delta(delta, src->tsc_to_system_mul,
                                             src->tsc_shift);
        return src->system_time + offset;
 }
index abb1fdcc545a530f59880b3e7e754cf6034bf9a2..f5e6f1c417df8724ad1f851f20259b75ecfc875f 100644 (file)
@@ -29,7 +29,7 @@ static inline cycles_t get_cycles(void)
        return rdtsc();
 }
 
-extern struct system_counterval_t convert_art_to_tsc(cycle_t art);
+extern struct system_counterval_t convert_art_to_tsc(u64 art);
 
 extern void tsc_init(void);
 extern void mark_tsc_unstable(char *reason);
index c5a7f3a930dd5bf8ae18b0c89059aca7cf23aaac..6fa75b17aec33aea051e1de2aea9199b0f6c836f 100644 (file)
@@ -12,7 +12,7 @@ struct unwind_state {
        struct task_struct *task;
        int graph_idx;
 #ifdef CONFIG_FRAME_POINTER
-       unsigned long *bp;
+       unsigned long *bp, *orig_sp;
        struct pt_regs *regs;
 #else
        unsigned long *sp;
index 3a01996db58fbf7bfa41ca52c86f323d4bb6c937..022e5971456260e108981ce451ea23099558d6ce 100644 (file)
@@ -17,8 +17,8 @@ struct vsyscall_gtod_data {
        unsigned seq;
 
        int vclock_mode;
-       cycle_t cycle_last;
-       cycle_t mask;
+       u64     cycle_last;
+       u64     mask;
        u32     mult;
        u32     shift;
 
index 6ba79317844138672dfe7de27254425e20630b5b..7ba7e90a9ad69e69723dd7dd152c2bc2b0e9ba16 100644 (file)
@@ -59,7 +59,7 @@ struct x86_init_irqs {
 
 /**
  * struct x86_init_oem - oem platform specific customizing functions
- * @arch_setup:                        platform specific architecure setup
+ * @arch_setup:                        platform specific architecture setup
  * @banner:                    print a platform specific banner
  */
 struct x86_init_oem {
@@ -164,9 +164,26 @@ struct x86_legacy_devices {
        int pnpbios;
 };
 
+/**
+ * enum x86_legacy_i8042_state - i8042 keyboard controller state
+ * @X86_LEGACY_I8042_PLATFORM_ABSENT: the controller is always absent on
+ *     given platform/subarch.
+ * @X86_LEGACY_I8042_FIRMWARE_ABSENT: firmware reports that the controller
+ *     is absent.
+ * @X86_LEGACY_i8042_EXPECTED_PRESENT: the controller is likely to be
+ *     present, the i8042 driver should probe for controller existence.
+ */
+enum x86_legacy_i8042_state {
+       X86_LEGACY_I8042_PLATFORM_ABSENT,
+       X86_LEGACY_I8042_FIRMWARE_ABSENT,
+       X86_LEGACY_I8042_EXPECTED_PRESENT,
+};
+
 /**
  * struct x86_legacy_features - legacy x86 features
  *
+ * @i8042: indicated if we expect the device to have i8042 controller
+ *     present.
  * @rtc: this device has a CMOS real-time clock present
  * @reserve_bios_regions: boot code will search for the EBDA address and the
  *     start of the 640k - 1M BIOS region.  If false, the platform must
@@ -175,6 +192,7 @@ struct x86_legacy_devices {
  *     documentation for further details.
  */
 struct x86_legacy_features {
+       enum x86_legacy_i8042_state i8042;
        int rtc;
        int reserve_bios_regions;
        struct x86_legacy_devices devices;
@@ -188,15 +206,14 @@ struct x86_legacy_features {
  * @set_wallclock:             set time back to HW clock
  * @is_untracked_pat_range     exclude from PAT logic
  * @nmi_init                   enable NMI on cpus
- * @i8042_detect               pre-detect if i8042 controller exists
  * @save_sched_clock_state:    save state for sched_clock() on suspend
  * @restore_sched_clock_state: restore state for sched_clock() on resume
- * @apic_post_init:            adjust apic if neeeded
+ * @apic_post_init:            adjust apic if needed
  * @legacy:                    legacy features
  * @set_legacy_features:       override legacy features. Use of this callback
  *                             is highly discouraged. You should only need
  *                             this if your hardware platform requires further
- *                             custom fine tuning far beyong what may be
+ *                             custom fine tuning far beyond what may be
  *                             possible in x86_early_init_platform_quirks() by
  *                             only using the current x86_hardware_subarch
  *                             semantics.
@@ -210,7 +227,6 @@ struct x86_platform_ops {
        bool (*is_untracked_pat_range)(u64 start, u64 end);
        void (*nmi_init)(void);
        unsigned char (*get_nmi_reason)(void);
-       int (*i8042_detect)(void);
        void (*save_sched_clock_state)(void);
        void (*restore_sched_clock_state)(void);
        void (*apic_post_init)(void);
index f5fb840b43e820ae68d1a97f38ebe7ff42dd8641..33cbd3db97b93d4449d29dfd1a79e1875ebfb1dc 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/pfn.h>
 #include <linux/mm.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 
index 6f65b0eed384c6b276d26b44aeb0c535d6b9db3e..64422f850e95e2da7991ded073041f5df5b4dfae 100644 (file)
@@ -930,6 +930,13 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
                x86_platform.legacy.devices.pnpbios = 0;
        }
 
+       if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
+           !(acpi_gbl_FADT.boot_flags & ACPI_FADT_8042) &&
+           x86_platform.legacy.i8042 != X86_LEGACY_I8042_PLATFORM_ABSENT) {
+               pr_debug("ACPI: i8042 controller is absent\n");
+               x86_platform.legacy.i8042 = X86_LEGACY_I8042_FIRMWARE_ABSENT;
+       }
+
        if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) {
                pr_debug("ACPI: not registering RTC platform device\n");
                x86_platform.legacy.rtc = 0;
index 5cb272a7a5a32eccbbee61a23c50ab9b5a80a0fb..c5b8f760473c32f090c430693c5b2e8a61cc196f 100644 (file)
@@ -337,7 +337,11 @@ done:
                n_dspl, (unsigned long)orig_insn + n_dspl + repl_len);
 }
 
-static void __init_or_module optimize_nops(struct alt_instr *a, u8 *instr)
+/*
+ * "noinline" to cause control flow change and thus invalidate I$ and
+ * cause refetch after modification.
+ */
+static void __init_or_module noinline optimize_nops(struct alt_instr *a, u8 *instr)
 {
        unsigned long flags;
 
@@ -346,7 +350,6 @@ static void __init_or_module optimize_nops(struct alt_instr *a, u8 *instr)
 
        local_irq_save(flags);
        add_nops(instr + (a->instrlen - a->padlen), a->padlen);
-       sync_core();
        local_irq_restore(flags);
 
        DUMP_BYTES(instr, a->instrlen, "%p: [%d:%d) optimized NOPs: ",
@@ -359,9 +362,12 @@ static void __init_or_module optimize_nops(struct alt_instr *a, u8 *instr)
  * This implies that asymmetric systems where APs have less capabilities than
  * the boot processor are not handled. Tough. Make sure you disable such
  * features by hand.
+ *
+ * Marked "noinline" to cause control flow change and thus insn cache
+ * to refetch changed I$ lines.
  */
-void __init_or_module apply_alternatives(struct alt_instr *start,
-                                        struct alt_instr *end)
+void __init_or_module noinline apply_alternatives(struct alt_instr *start,
+                                                 struct alt_instr *end)
 {
        struct alt_instr *a;
        u8 *instr, *replacement;
@@ -667,7 +673,6 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode,
        unsigned long flags;
        local_irq_save(flags);
        memcpy(addr, opcode, len);
-       sync_core();
        local_irq_restore(flags);
        /* Could also do a CLFLUSH here to speed up CPU recovery; but
           that causes hangs on some VIA CPUs. */
index 456316f6c868dc1aff24585bdc9b0119e4804693..65721dc73bd83b982154c5d5e0f52e06b0ccad29 100644 (file)
@@ -234,7 +234,7 @@ static __init int apbt_late_init(void)
        if (intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT ||
                !apb_timer_block_enabled)
                return 0;
-       return cpuhp_setup_state(CPUHP_X86_APB_DEAD, "X86_APB_DEAD", NULL,
+       return cpuhp_setup_state(CPUHP_X86_APB_DEAD, "x86/apb:dead", NULL,
                                 apbt_cpu_dead);
 }
 fs_initcall(apbt_late_init);
@@ -247,7 +247,7 @@ void apbt_setup_secondary_clock(void) {}
 static int apbt_clocksource_register(void)
 {
        u64 start, now;
-       cycle_t t1;
+       u64 t1;
 
        /* Start the counter, use timer 2 as source, timer 0/1 for event */
        dw_apb_clocksource_start(clocksource_apbt);
@@ -355,7 +355,7 @@ unsigned long apbt_quick_calibrate(void)
 {
        int i, scale;
        u64 old, new;
-       cycle_t t1, t2;
+       u64 t1, t2;
        unsigned long khz = 0;
        u32 loop, shift;
 
index 200af5ae96626e1610c7c946bb0a33c5360f9bcb..5a35f208ed95909d339db672cb493445c24a1a81 100644 (file)
@@ -191,7 +191,7 @@ static int x2apic_cluster_probe(void)
        if (!x2apic_mode)
                return 0;
 
-       ret = cpuhp_setup_state(CPUHP_X2APIC_PREPARE, "X2APIC_PREPARE",
+       ret = cpuhp_setup_state(CPUHP_X2APIC_PREPARE, "x86/x2apic:prepare",
                                x2apic_prepare_cpu, x2apic_dead_cpu);
        if (ret < 0) {
                pr_err("Failed to register X2APIC_PREPARE\n");
index 643818a7688b1273643636e3b608d2868bb2a665..45d44c173cf9e125df6f6b4bf9ae50d6ad19f393 100644 (file)
 #include <linux/i8253.h>
 #include <linux/cpuidle.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/desc.h>
 #include <asm/olpc.h>
 #include <asm/paravirt.h>
index 1f6b50a449ab92820cdb9d90661d7c63eaba30c2..dc1697ca5191ce87cd9f27a78236ede3897243ab 100644 (file)
@@ -667,13 +667,14 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
                c->x86_capability[CPUID_1_EDX] = edx;
        }
 
+       /* Thermal and Power Management Leaf: level 0x00000006 (eax) */
+       if (c->cpuid_level >= 0x00000006)
+               c->x86_capability[CPUID_6_EAX] = cpuid_eax(0x00000006);
+
        /* Additional Intel-defined flags: level 0x00000007 */
        if (c->cpuid_level >= 0x00000007) {
                cpuid_count(0x00000007, 0, &eax, &ebx, &ecx, &edx);
-
                c->x86_capability[CPUID_7_0_EBX] = ebx;
-
-               c->x86_capability[CPUID_6_EAX] = cpuid_eax(0x00000006);
                c->x86_capability[CPUID_7_ECX] = ecx;
        }
 
index c7efbcfbeda6ce5f4e7dc71fab0ab5ffdbe7569b..87cc9ab7a13cdeb731cd1782a8ea8863aed432a1 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/debugfs.h>
 #include <asm/mce.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "mce-internal.h"
 
index ffacfdcacb85eafd145228d0e0d3e4765b2177ea..a5fd137417a27278f49f3cf0b60803997176a665 100644 (file)
@@ -1182,6 +1182,9 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank)
        const char *name = get_name(bank, NULL);
        int err = 0;
 
+       if (!dev)
+               return -ENODEV;
+
        if (is_shared_bank(bank)) {
                nb = node_to_amd_nb(amd_get_nb_id(cpu));
 
index 6f353bdb3a2570b69d0fd349a1745694d5dbf6fa..6a31e2691f3aa0ac68620459c371ca42912c4475 100644 (file)
@@ -116,10 +116,11 @@ static inline u16 find_equiv_id(struct equiv_cpu_entry *equiv_cpu_table,
 
 /*
  * This scans the ucode blob for the proper container as we can have multiple
- * containers glued together.
+ * containers glued together. Returns the equivalence ID from the equivalence
+ * table or 0 if none found.
  */
-static struct container
-find_proper_container(u8 *ucode, size_t size, u16 *ret_id)
+static u16
+find_proper_container(u8 *ucode, size_t size, struct container *ret_cont)
 {
        struct container ret = { NULL, 0 };
        u32 eax, ebx, ecx, edx;
@@ -138,7 +139,7 @@ find_proper_container(u8 *ucode, size_t size, u16 *ret_id)
        if (header[0] != UCODE_MAGIC ||
            header[1] != UCODE_EQUIV_CPU_TABLE_TYPE || /* type */
            header[2] == 0)                            /* size */
-               return ret;
+               return eq_id;
 
        eax = 0x00000001;
        ecx = 0;
@@ -163,8 +164,9 @@ find_proper_container(u8 *ucode, size_t size, u16 *ret_id)
                         * ucode update loop below
                         */
                        left = ret.size - offset;
-                       *ret_id = eq_id;
-                       return ret;
+
+                       *ret_cont = ret;
+                       return eq_id;
                }
 
                /*
@@ -189,7 +191,7 @@ find_proper_container(u8 *ucode, size_t size, u16 *ret_id)
                ucode     = data;
        }
 
-       return ret;
+       return eq_id;
 }
 
 static int __apply_microcode_amd(struct microcode_amd *mc_amd)
@@ -214,17 +216,18 @@ static int __apply_microcode_amd(struct microcode_amd *mc_amd)
  * and on 32-bit during save_microcode_in_initrd_amd() -- we can call
  * load_microcode_amd() to save equivalent cpu table and microcode patches in
  * kernel heap memory.
+ *
+ * Returns true if container found (sets @ret_cont), false otherwise.
  */
-static struct container
-apply_microcode_early_amd(void *ucode, size_t size, bool save_patch)
+static bool apply_microcode_early_amd(void *ucode, size_t size, bool save_patch,
+                                     struct container *ret_cont)
 {
-       struct container ret = { NULL, 0 };
        u8 (*patch)[PATCH_MAX_SIZE];
+       u32 rev, *header, *new_rev;
+       struct container ret;
        int offset, left;
-       u32 rev, *header;
-       u8  *data;
        u16 eq_id = 0;
-       u32 *new_rev;
+       u8  *data;
 
 #ifdef CONFIG_X86_32
        new_rev = (u32 *)__pa_nodebug(&ucode_new_rev);
@@ -235,11 +238,11 @@ apply_microcode_early_amd(void *ucode, size_t size, bool save_patch)
 #endif
 
        if (check_current_patch_level(&rev, true))
-               return (struct container){ NULL, 0 };
+               return false;
 
-       ret = find_proper_container(ucode, size, &eq_id);
+       eq_id = find_proper_container(ucode, size, &ret);
        if (!eq_id)
-               return (struct container){ NULL, 0 };
+               return false;
 
        this_equiv_id = eq_id;
        header = (u32 *)ret.data;
@@ -273,7 +276,11 @@ apply_microcode_early_amd(void *ucode, size_t size, bool save_patch)
                data   += offset;
                left   -= offset;
        }
-       return ret;
+
+       if (ret_cont)
+               *ret_cont = ret;
+
+       return true;
 }
 
 static bool get_builtin_microcode(struct cpio_data *cp, unsigned int family)
@@ -294,6 +301,7 @@ static bool get_builtin_microcode(struct cpio_data *cp, unsigned int family)
 void __init load_ucode_amd_bsp(unsigned int family)
 {
        struct ucode_cpu_info *uci;
+       u32 eax, ebx, ecx, edx;
        struct cpio_data cp;
        const char *path;
        bool use_pa;
@@ -315,9 +323,12 @@ void __init load_ucode_amd_bsp(unsigned int family)
                return;
 
        /* Get BSP's CPUID.EAX(1), needed in load_microcode_amd() */
-       uci->cpu_sig.sig = cpuid_eax(1);
+       eax = 1;
+       ecx = 0;
+       native_cpuid(&eax, &ebx, &ecx, &edx);
+       uci->cpu_sig.sig = eax;
 
-       apply_microcode_early_amd(cp.data, cp.size, true);
+       apply_microcode_early_amd(cp.data, cp.size, true, NULL);
 }
 
 #ifdef CONFIG_X86_32
@@ -349,7 +360,7 @@ void load_ucode_amd_ap(unsigned int family)
         * This would set amd_ucode_patch above so that the following APs can
         * use it directly instead of going down this path again.
         */
-       apply_microcode_early_amd(cp.data, cp.size, true);
+       apply_microcode_early_amd(cp.data, cp.size, true, NULL);
 }
 #else
 void load_ucode_amd_ap(unsigned int family)
@@ -387,8 +398,7 @@ reget:
                        }
                }
 
-               cont = apply_microcode_early_amd(cp.data, cp.size, false);
-               if (!(cont.data && cont.size)) {
+               if (!apply_microcode_early_amd(cp.data, cp.size, false, &cont)) {
                        cont.size = -1;
                        return;
                }
@@ -443,7 +453,7 @@ int __init save_microcode_in_initrd_amd(unsigned int fam)
                                return -EINVAL;
                        }
 
-                       cont = find_proper_container(cp.data, cp.size, &eq_id);
+                       eq_id = find_proper_container(cp.data, cp.size, &cont);
                        if (!eq_id) {
                                cont.size = -1;
                                return -EINVAL;
index 6996413c78c3e694817b60ce3f263f838acc9627..2af69d27da629a5c802498e692300f9980862a2a 100644 (file)
@@ -44,7 +44,7 @@
 #define DRIVER_VERSION "2.2"
 
 static struct microcode_ops    *microcode_ops;
-static bool dis_ucode_ldr;
+static bool dis_ucode_ldr = true;
 
 LIST_HEAD(microcode_cache);
 
@@ -76,6 +76,7 @@ struct cpu_info_ctx {
 static bool __init check_loader_disabled_bsp(void)
 {
        static const char *__dis_opt_str = "dis_ucode_ldr";
+       u32 a, b, c, d;
 
 #ifdef CONFIG_X86_32
        const char *cmdline = (const char *)__pa_nodebug(boot_command_line);
@@ -88,8 +89,23 @@ static bool __init check_loader_disabled_bsp(void)
        bool *res = &dis_ucode_ldr;
 #endif
 
-       if (cmdline_find_option_bool(cmdline, option))
-               *res = true;
+       if (!have_cpuid_p())
+               return *res;
+
+       a = 1;
+       c = 0;
+       native_cpuid(&a, &b, &c, &d);
+
+       /*
+        * CPUID(1).ECX[31]: reserved for hypervisor use. This is still not
+        * completely accurate as xen pv guests don't see that CPUID bit set but
+        * that's good enough as they don't land on the BSP path anyway.
+        */
+       if (c & BIT(31))
+               return *res;
+
+       if (cmdline_find_option_bool(cmdline, option) <= 0)
+               *res = false;
 
        return *res;
 }
@@ -121,9 +137,6 @@ void __init load_ucode_bsp(void)
        if (check_loader_disabled_bsp())
                return;
 
-       if (!have_cpuid_p())
-               return;
-
        vendor = x86_cpuid_vendor();
        family = x86_cpuid_family();
 
@@ -157,9 +170,6 @@ void load_ucode_ap(void)
        if (check_loader_disabled_ap())
                return;
 
-       if (!have_cpuid_p())
-               return;
-
        vendor = x86_cpuid_vendor();
        family = x86_cpuid_family();
 
@@ -233,14 +243,12 @@ struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa)
 # endif
 
        /*
-        * Did we relocate the ramdisk?
-        *
-        * So we possibly relocate the ramdisk *after* applying microcode on the
-        * BSP so we rely on use_pa (use physical addresses) - even if it is not
-        * absolutely correct - to determine whether we've done the ramdisk
-        * relocation already.
+        * Fixup the start address: after reserve_initrd() runs, initrd_start
+        * has the virtual address of the beginning of the initrd. It also
+        * possibly relocates the ramdisk. In either case, initrd_start contains
+        * the updated address so use that instead.
         */
-       if (!use_pa && relocated_ramdisk)
+       if (!use_pa && initrd_start)
                start = initrd_start;
 
        return find_cpio_data(path, (void *)start, size, NULL);
index 54d50c3694d853961d6079bcc1d54107cf809de7..b624b54912e11e4e58992b9e1ca2d7cab20ce9e4 100644 (file)
@@ -368,6 +368,26 @@ next:
        return patch;
 }
 
+static void cpuid_1(void)
+{
+       /*
+        * According to the Intel SDM, Volume 3, 9.11.7:
+        *
+        *   CPUID returns a value in a model specific register in
+        *   addition to its usual register return values. The
+        *   semantics of CPUID cause it to deposit an update ID value
+        *   in the 64-bit model-specific register at address 08BH
+        *   (IA32_BIOS_SIGN_ID). If no update is present in the
+        *   processor, the value in the MSR remains unmodified.
+        *
+        * Use native_cpuid -- this code runs very early and we don't
+        * want to mess with paravirt.
+        */
+       unsigned int eax = 1, ebx, ecx = 0, edx;
+
+       native_cpuid(&eax, &ebx, &ecx, &edx);
+}
+
 static int collect_cpu_info_early(struct ucode_cpu_info *uci)
 {
        unsigned int val[2];
@@ -393,7 +413,7 @@ static int collect_cpu_info_early(struct ucode_cpu_info *uci)
        native_wrmsrl(MSR_IA32_UCODE_REV, 0);
 
        /* As documented in the SDM: Do a CPUID 1 here */
-       sync_core();
+       cpuid_1();
 
        /* get the current revision from MSR 0x8B */
        native_rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
@@ -593,7 +613,7 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
        native_wrmsrl(MSR_IA32_UCODE_REV, 0);
 
        /* As documented in the SDM: Do a CPUID 1 here */
-       sync_core();
+       cpuid_1();
 
        /* get the current revision from MSR 0x8B */
        native_rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
@@ -805,7 +825,7 @@ static int apply_microcode_intel(int cpu)
        wrmsrl(MSR_IA32_UCODE_REV, 0);
 
        /* As documented in the SDM: Do a CPUID 1 here */
-       sync_core();
+       cpuid_1();
 
        /* get the current revision from MSR 0x8B */
        rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
index 6c044543545e637e867e4cd748934359e2719150..65e20c97e04b1e2591a356eda4e922ed92ec0310 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/apic.h>
 #include <asm/timer.h>
 #include <asm/reboot.h>
+#include <asm/nmi.h>
 
 struct ms_hyperv_info ms_hyperv;
 EXPORT_SYMBOL_GPL(ms_hyperv);
@@ -132,9 +133,9 @@ static uint32_t  __init ms_hyperv_platform(void)
        return 0;
 }
 
-static cycle_t read_hv_clock(struct clocksource *arg)
+static u64 read_hv_clock(struct clocksource *arg)
 {
-       cycle_t current_tick;
+       u64 current_tick;
        /*
         * Read the partition counter to get the current tick count. This count
         * is set to 0 when the partition is created and is incremented in
@@ -157,6 +158,26 @@ static unsigned char hv_get_nmi_reason(void)
        return 0;
 }
 
+#ifdef CONFIG_X86_LOCAL_APIC
+/*
+ * Prior to WS2016 Debug-VM sends NMIs to all CPUs which makes
+ * it dificult to process CHANNELMSG_UNLOAD in case of crash. Handle
+ * unknown NMI on the first CPU which gets it.
+ */
+static int hv_nmi_unknown(unsigned int val, struct pt_regs *regs)
+{
+       static atomic_t nmi_cpu = ATOMIC_INIT(-1);
+
+       if (!unknown_nmi_panic)
+               return NMI_DONE;
+
+       if (atomic_cmpxchg(&nmi_cpu, -1, raw_smp_processor_id()) != -1)
+               return NMI_HANDLED;
+
+       return NMI_DONE;
+}
+#endif
+
 static void __init ms_hyperv_init_platform(void)
 {
        /*
@@ -182,6 +203,9 @@ static void __init ms_hyperv_init_platform(void)
                pr_info("HyperV: LAPIC Timer Frequency: %#x\n",
                        lapic_timer_frequency);
        }
+
+       register_nmi_handler(NMI_UNKNOWN, hv_nmi_unknown, NMI_FLAG_FIRST,
+                            "hv_nmi_unknown");
 #endif
 
        if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
index 11891ca7b71688e05f27cfbb22bc0e0163e800b1..538fedea9b3f24fef0c828ee81036f1d2f73a800 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/highmem.h>
 #include <linux/crash_dump.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static void *kdump_buf_page;
 
index f6dfd9334b67e54aa0a9eda6cfac7f1094cf80d9..b2f7207ba86c4b177796dfcc26e70b2653453c66 100644 (file)
@@ -3,7 +3,7 @@
 #include <linux/init_task.h>
 #include <linux/fs.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/desc.h>
index 274fab99169d8235628b13fa955fc98b520ee27f..85e87b46c318026ed28d87056c516aec3e5fb9ed 100644 (file)
@@ -791,7 +791,7 @@ static union hpet_lock hpet __cacheline_aligned = {
        { .lock = __ARCH_SPIN_LOCK_UNLOCKED, },
 };
 
-static cycle_t read_hpet(struct clocksource *cs)
+static u64 read_hpet(struct clocksource *cs)
 {
        unsigned long flags;
        union hpet_lock old, new;
@@ -802,7 +802,7 @@ static cycle_t read_hpet(struct clocksource *cs)
         * Read HPET directly if in NMI.
         */
        if (in_nmi())
-               return (cycle_t)hpet_readl(HPET_COUNTER);
+               return (u64)hpet_readl(HPET_COUNTER);
 
        /*
         * Read the current state of the lock and HPET value atomically.
@@ -821,7 +821,7 @@ static cycle_t read_hpet(struct clocksource *cs)
                WRITE_ONCE(hpet.value, new.value);
                arch_spin_unlock(&hpet.lock);
                local_irq_restore(flags);
-               return (cycle_t)new.value;
+               return (u64)new.value;
        }
        local_irq_restore(flags);
 
@@ -843,15 +843,15 @@ contended:
                new.lockval = READ_ONCE(hpet.lockval);
        } while ((new.value == old.value) && arch_spin_is_locked(&new.lock));
 
-       return (cycle_t)new.value;
+       return (u64)new.value;
 }
 #else
 /*
  * For UP or 32-bit.
  */
-static cycle_t read_hpet(struct clocksource *cs)
+static u64 read_hpet(struct clocksource *cs)
 {
-       return (cycle_t)hpet_readl(HPET_COUNTER);
+       return (u64)hpet_readl(HPET_COUNTER);
 }
 #endif
 
@@ -867,7 +867,7 @@ static struct clocksource clocksource_hpet = {
 static int hpet_clocksource_register(void)
 {
        u64 start, now;
-       cycle_t t1;
+       u64 t1;
 
        /* Start the counter */
        hpet_restart_counter();
@@ -1051,11 +1051,11 @@ static __init int hpet_late_init(void)
                return 0;
 
        /* This notifier should be called after workqueue is ready */
-       ret = cpuhp_setup_state(CPUHP_AP_X86_HPET_ONLINE, "AP_X86_HPET_ONLINE",
+       ret = cpuhp_setup_state(CPUHP_AP_X86_HPET_ONLINE, "x86/hpet:online",
                                hpet_cpuhp_online, NULL);
        if (ret)
                return ret;
-       ret = cpuhp_setup_state(CPUHP_X86_HPET_DEAD, "X86_HPET_DEAD", NULL,
+       ret = cpuhp_setup_state(CPUHP_X86_HPET_DEAD, "x86/hpet:dead", NULL,
                                hpet_cpuhp_dead);
        if (ret)
                goto err_cpuhp;
index d9d8d16b69db89df63b5ff33a4e597fcf4e5eba6..eb3509338ae01ac69097d3decb922075ab63cb6a 100644 (file)
@@ -56,7 +56,7 @@
 #include <asm/cacheflush.h>
 #include <asm/desc.h>
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/alternative.h>
 #include <asm/insn.h>
 #include <asm/debugreg.h>
index 3bb4c5f021f6a6e74af13fd6b974e6dd600b64c1..3d1bee9d6a728fd50645d0179986cd1dda6629d0 100644 (file)
@@ -33,7 +33,7 @@
 #include <asm/cacheflush.h>
 #include <asm/desc.h>
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/alternative.h>
 #include <asm/insn.h>
 #include <asm/debugreg.h>
index 60b9949f1e65129464ad717bf1381c0a14206645..2a5cafdf8808eee394039c30f0700c234e4a615b 100644 (file)
@@ -32,7 +32,7 @@
 static int kvmclock __ro_after_init = 1;
 static int msr_kvm_system_time = MSR_KVM_SYSTEM_TIME;
 static int msr_kvm_wall_clock = MSR_KVM_WALL_CLOCK;
-static cycle_t kvm_sched_clock_offset;
+static u64 kvm_sched_clock_offset;
 
 static int parse_no_kvmclock(char *arg)
 {
@@ -79,10 +79,10 @@ static int kvm_set_wallclock(const struct timespec *now)
        return -1;
 }
 
-static cycle_t kvm_clock_read(void)
+static u64 kvm_clock_read(void)
 {
        struct pvclock_vcpu_time_info *src;
-       cycle_t ret;
+       u64 ret;
        int cpu;
 
        preempt_disable_notrace();
@@ -93,12 +93,12 @@ static cycle_t kvm_clock_read(void)
        return ret;
 }
 
-static cycle_t kvm_clock_get_cycles(struct clocksource *cs)
+static u64 kvm_clock_get_cycles(struct clocksource *cs)
 {
        return kvm_clock_read();
 }
 
-static cycle_t kvm_sched_clock_read(void)
+static u64 kvm_sched_clock_read(void)
 {
        return kvm_clock_read() - kvm_sched_clock_offset;
 }
index f5e3ff835cc8a318c12c3decc8532cc9df411b69..ef688804f80d33088fef15448996a97f69e2b193 100644 (file)
@@ -224,7 +224,6 @@ static int __init msr_init(void)
        return 0;
 
 out_class:
-       cpuhp_remove_state(cpuhp_msr_state);
        class_destroy(msr_class);
 out_chrdev:
        __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
index d33ef165b1f8b87cb4282801c0f2653732bcaf80..553acbbb4d32d72d0807f037a513fe05cfd7629b 100644 (file)
@@ -68,7 +68,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
 #endif
 
        default:
-patch_default:
+patch_default: __maybe_unused
                ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
                break;
 
index f4fcf26c9fcecefcd3b3c07db7cc85676e26aba6..11aaf1eaa0e4c9eb6373a3856fdc4af3ad143360 100644 (file)
@@ -80,7 +80,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
 #endif
 
        default:
-patch_default:
+patch_default: __maybe_unused
                ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
                break;
 
index b47edb8f52566e223f89800b5b0465349331985a..410efb2c7b80028ba63367e5ed6d5e27518b0f24 100644 (file)
@@ -68,12 +68,10 @@ static struct dma_map_ops swiotlb_dma_ops = {
  */
 int __init pci_swiotlb_detect_override(void)
 {
-       int use_swiotlb = swiotlb | swiotlb_force;
-
-       if (swiotlb_force)
+       if (swiotlb_force == SWIOTLB_FORCE)
                swiotlb = 1;
 
-       return use_swiotlb;
+       return swiotlb;
 }
 IOMMU_INIT_FINISH(pci_swiotlb_detect_override,
                  pci_xen_swiotlb_detect,
index 24a50301f1504a3560066e25ea9fa0ddc0d8fdaa..91271122f0dfb947e1b1b68cddeb505053fd9425 100644 (file)
@@ -6,6 +6,7 @@
 
 void __init x86_early_init_platform_quirks(void)
 {
+       x86_platform.legacy.i8042 = X86_LEGACY_I8042_EXPECTED_PRESENT;
        x86_platform.legacy.rtc = 1;
        x86_platform.legacy.reserve_bios_regions = 0;
        x86_platform.legacy.devices.pnpbios = 1;
@@ -16,10 +17,14 @@ void __init x86_early_init_platform_quirks(void)
                break;
        case X86_SUBARCH_XEN:
        case X86_SUBARCH_LGUEST:
+               x86_platform.legacy.devices.pnpbios = 0;
+               x86_platform.legacy.rtc = 0;
+               break;
        case X86_SUBARCH_INTEL_MID:
        case X86_SUBARCH_CE4100:
                x86_platform.legacy.devices.pnpbios = 0;
                x86_platform.legacy.rtc = 0;
+               x86_platform.legacy.i8042 = X86_LEGACY_I8042_PLATFORM_ABSENT;
                break;
        }
 
index 37363e46b1f0beda54e6591583256c11e56cedee..b615a1113f58241bb4dcf0b5cc544b743df24752 100644 (file)
@@ -23,7 +23,7 @@
 #include <asm/cpu.h>
 #include <asm/apic.h>
 #include <asm/syscalls.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mwait.h>
 #include <asm/fpu/internal.h>
 #include <asm/debugreg.h>
index 0e63c0267f99c3360906e8b27a2a1fa646a65dde..9cc7d5a330ef9de688e9df57adbfec633f882884 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/export.h>
 #include <linux/context_tracking.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/fpu/internal.h>
index 5b2cc889ce346586527ff260f018b5d7d436ca8f..9e93fe5803b470676997cec46a5f05f6e3c1177c 100644 (file)
@@ -71,10 +71,10 @@ u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src)
        return flags & valid_flags;
 }
 
-cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
+u64 pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
 {
        unsigned version;
-       cycle_t ret;
+       u64 ret;
        u64 last;
        u8 flags;
 
index 8402907825b02706f87283c45b5e27086a9cce0b..b868fa1b812b3a82713e0556c39900bced73f338 100644 (file)
@@ -408,7 +408,7 @@ static __init int tboot_late_init(void)
        tboot_create_trampoline();
 
        atomic_set(&ap_wfs_count, 0);
-       cpuhp_setup_state(CPUHP_AP_X86_TBOOT_DYING, "AP_X86_TBOOT_DYING", NULL,
+       cpuhp_setup_state(CPUHP_AP_X86_TBOOT_DYING, "x86/tboot:dying", NULL,
                          tboot_dying_cpu);
 #ifdef CONFIG_DEBUG_FS
        debugfs_create_file("tboot_log", S_IRUSR,
index 27538f183c3b15d9d59e225f2612b12660ee979b..a3b875c9e6afcca6642ae1308b2755c4f93ec605 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/sort.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/asm.h>
 
 extern int rodata_test_data;
index 9692a5e9fdab2002f31c6dd2dce2c113647608b6..6c8934406dc906c631200787f2b0d6ee8e746b60 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/regset.h>
 #include <linux/syscalls.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/desc.h>
 #include <asm/ldt.h>
 #include <asm/processor.h>
index 0aed75a1e31b0e7f88d3f3f105ea4207f5bcade2..be3a49ee035650f1f1eac68c07ad0e8898c40585 100644 (file)
@@ -1101,9 +1101,9 @@ static void tsc_resume(struct clocksource *cs)
  * checking the result of read_tsc() - cycle_last for being negative.
  * That works because CLOCKSOURCE_MASK(64) does not mask out any bit.
  */
-static cycle_t read_tsc(struct clocksource *cs)
+static u64 read_tsc(struct clocksource *cs)
 {
-       return (cycle_t)rdtsc_ordered();
+       return (u64)rdtsc_ordered();
 }
 
 /*
@@ -1192,7 +1192,7 @@ int unsynchronized_tsc(void)
 /*
  * Convert ART to TSC given numerator/denominator found in detect_art()
  */
-struct system_counterval_t convert_art_to_tsc(cycle_t art)
+struct system_counterval_t convert_art_to_tsc(u64 art)
 {
        u64 tmp, res, rem;
 
index ea7b7f9a3b9e29c891509429f55238e17dcdc66c..4443e499f2790923e6510bc57a88d5a9e0578051 100644 (file)
@@ -6,6 +6,37 @@
 
 #define FRAME_HEADER_SIZE (sizeof(long) * 2)
 
+static void unwind_dump(struct unwind_state *state, unsigned long *sp)
+{
+       static bool dumped_before = false;
+       bool prev_zero, zero = false;
+       unsigned long word;
+
+       if (dumped_before)
+               return;
+
+       dumped_before = true;
+
+       printk_deferred("unwind stack type:%d next_sp:%p mask:%lx graph_idx:%d\n",
+                       state->stack_info.type, state->stack_info.next_sp,
+                       state->stack_mask, state->graph_idx);
+
+       for (sp = state->orig_sp; sp < state->stack_info.end; sp++) {
+               word = READ_ONCE_NOCHECK(*sp);
+
+               prev_zero = zero;
+               zero = word == 0;
+
+               if (zero) {
+                       if (!prev_zero)
+                               printk_deferred("%p: %016x ...\n", sp, 0);
+                       continue;
+               }
+
+               printk_deferred("%p: %016lx (%pB)\n", sp, word, (void *)word);
+       }
+}
+
 unsigned long unwind_get_return_address(struct unwind_state *state)
 {
        unsigned long addr;
@@ -20,15 +51,7 @@ unsigned long unwind_get_return_address(struct unwind_state *state)
        addr = ftrace_graph_ret_addr(state->task, &state->graph_idx, *addr_p,
                                     addr_p);
 
-       if (!__kernel_text_address(addr)) {
-               printk_deferred_once(KERN_WARNING
-                       "WARNING: unrecognized kernel stack return address %p at %p in %s:%d\n",
-                       (void *)addr, addr_p, state->task->comm,
-                       state->task->pid);
-               return 0;
-       }
-
-       return addr;
+       return __kernel_text_address(addr) ? addr : 0;
 }
 EXPORT_SYMBOL_GPL(unwind_get_return_address);
 
@@ -46,7 +69,14 @@ static bool is_last_task_frame(struct unwind_state *state)
        unsigned long bp = (unsigned long)state->bp;
        unsigned long regs = (unsigned long)task_pt_regs(state->task);
 
-       return bp == regs - FRAME_HEADER_SIZE;
+       /*
+        * We have to check for the last task frame at two different locations
+        * because gcc can occasionally decide to realign the stack pointer and
+        * change the offset of the stack frame by a word in the prologue of a
+        * function called by head/entry code.
+        */
+       return bp == regs - FRAME_HEADER_SIZE ||
+              bp == regs - FRAME_HEADER_SIZE - sizeof(long);
 }
 
 /*
@@ -67,6 +97,7 @@ static bool update_stack_state(struct unwind_state *state, void *addr,
                               size_t len)
 {
        struct stack_info *info = &state->stack_info;
+       enum stack_type orig_type = info->type;
 
        /*
         * If addr isn't on the current stack, switch to the next one.
@@ -80,6 +111,9 @@ static bool update_stack_state(struct unwind_state *state, void *addr,
                                   &state->stack_mask))
                        return false;
 
+       if (!state->orig_sp || info->type != orig_type)
+               state->orig_sp = addr;
+
        return true;
 }
 
@@ -178,11 +212,13 @@ bad_address:
                        "WARNING: kernel stack regs at %p in %s:%d has bad 'bp' value %p\n",
                        state->regs, state->task->comm,
                        state->task->pid, next_frame);
+               unwind_dump(state, (unsigned long *)state->regs);
        } else {
                printk_deferred_once(KERN_WARNING
                        "WARNING: kernel stack frame pointer at %p in %s:%d has bad value %p\n",
                        state->bp, state->task->comm,
                        state->task->pid, next_frame);
+               unwind_dump(state, state->bp);
        }
 the_end:
        state->stack_info.type = STACK_TYPE_UNKNOWN;
index 01f30e56f99e57c2e215b2925ffcc205ea651ee3..ec5d7545e6dcbe2d1724e48b5e595b01071a3adc 100644 (file)
@@ -47,7 +47,7 @@
 #include <linux/slab.h>
 #include <linux/security.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/tlbflush.h>
 #include <asm/irq.h>
index 0bd9f1287f3962380f9f0f03470ce25f9ce8932b..11a93f005268b731de6fea9d8fa42775f46f1c2a 100644 (file)
@@ -89,7 +89,6 @@ struct x86_cpuinit_ops x86_cpuinit = {
 };
 
 static void default_nmi_init(void) { };
-static int default_i8042_detect(void) { return 1; };
 
 struct x86_platform_ops x86_platform __ro_after_init = {
        .calibrate_cpu                  = native_calibrate_cpu,
@@ -100,7 +99,6 @@ struct x86_platform_ops x86_platform __ro_after_init = {
        .is_untracked_pat_range         = is_ISA_range,
        .nmi_init                       = default_nmi_init,
        .get_nmi_reason                 = default_get_nmi_reason,
-       .i8042_detect                   = default_i8042_detect,
        .save_sched_clock_state         = tsc_save_sched_clock_state,
        .restore_sched_clock_state      = tsc_restore_sched_clock_state,
 };
index 34a66b2d47e656b5be5c91c6d9e6fe0c93616ada..5fe290c1b7d892729e7cfd637433b8171423f407 100644 (file)
@@ -1106,7 +1106,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
        now = ktime_get();
        remaining = ktime_sub(apic->lapic_timer.target_expiration, now);
        if (ktime_to_ns(remaining) < 0)
-               remaining = ktime_set(0, 0);
+               remaining = 0;
 
        ns = mod_64(ktime_to_ns(remaining), apic->lapic_timer.period);
        tmcct = div64_u64(ns,
@@ -2057,7 +2057,7 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu)
                        apic->lapic_timer.tscdeadline = 0;
                if (apic_lvtt_oneshot(apic)) {
                        apic->lapic_timer.tscdeadline = 0;
-                       apic->lapic_timer.target_expiration = ktime_set(0, 0);
+                       apic->lapic_timer.target_expiration = 0;
                }
                atomic_set(&apic->lapic_timer.pending, 0);
        }
index 24db5fb6f575af27d3b61a67b15ce9996158ed8b..a236decb81e4ffca42525d8a9cd3d5d8c98916a9 100644 (file)
@@ -132,12 +132,6 @@ module_param_named(preemption_timer, enable_preemption_timer, bool, S_IRUGO);
 
 #define VMX_MISC_EMULATED_PREEMPTION_TIMER_RATE 5
 
-#define VMX_VPID_EXTENT_SUPPORTED_MASK         \
-       (VMX_VPID_EXTENT_INDIVIDUAL_ADDR_BIT |  \
-       VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT |    \
-       VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT |    \
-       VMX_VPID_EXTENT_SINGLE_NON_GLOBAL_BIT)
-
 /*
  * Hyper-V requires all of these, so mark them as supported even though
  * they are just treated the same as all-context.
@@ -10473,12 +10467,12 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
            !nested_guest_cr4_valid(vcpu, vmcs12->guest_cr4)) {
                nested_vmx_entry_failure(vcpu, vmcs12,
                        EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT);
-               goto out;
+               return 1;
        }
        if (vmcs12->vmcs_link_pointer != -1ull) {
                nested_vmx_entry_failure(vcpu, vmcs12,
                        EXIT_REASON_INVALID_STATE, ENTRY_FAIL_VMCS_LINK_PTR);
-               goto out;
+               return 1;
        }
 
        /*
@@ -10498,7 +10492,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
                     ia32e != !!(vmcs12->guest_ia32_efer & EFER_LME))) {
                        nested_vmx_entry_failure(vcpu, vmcs12,
                                EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT);
-                       goto out;
+                       return 1;
                }
        }
 
@@ -10516,7 +10510,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
                    ia32e != !!(vmcs12->host_ia32_efer & EFER_LME)) {
                        nested_vmx_entry_failure(vcpu, vmcs12,
                                EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT);
-                       goto out;
+                       return 1;
                }
        }
 
index 445c51b6cf6dc702a0da9710ee5b6eb4b996ec34..2f22810a7e0c8e3106c77849a6a3ea78a2b00a0c 100644 (file)
@@ -1131,8 +1131,8 @@ struct pvclock_gtod_data {
 
        struct { /* extract of a clocksource struct */
                int vclock_mode;
-               cycle_t cycle_last;
-               cycle_t mask;
+               u64     cycle_last;
+               u64     mask;
                u32     mult;
                u32     shift;
        } clock;
@@ -1572,9 +1572,9 @@ static inline void adjust_tsc_offset_host(struct kvm_vcpu *vcpu, s64 adjustment)
 
 #ifdef CONFIG_X86_64
 
-static cycle_t read_tsc(void)
+static u64 read_tsc(void)
 {
-       cycle_t ret = (cycle_t)rdtsc_ordered();
+       u64 ret = (u64)rdtsc_ordered();
        u64 last = pvclock_gtod_data.clock.cycle_last;
 
        if (likely(ret >= last))
@@ -1592,7 +1592,7 @@ static cycle_t read_tsc(void)
        return last;
 }
 
-static inline u64 vgettsc(cycle_t *cycle_now)
+static inline u64 vgettsc(u64 *cycle_now)
 {
        long v;
        struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
@@ -1603,7 +1603,7 @@ static inline u64 vgettsc(cycle_t *cycle_now)
        return v * gtod->clock.mult;
 }
 
-static int do_monotonic_boot(s64 *t, cycle_t *cycle_now)
+static int do_monotonic_boot(s64 *t, u64 *cycle_now)
 {
        struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
        unsigned long seq;
@@ -1624,7 +1624,7 @@ static int do_monotonic_boot(s64 *t, cycle_t *cycle_now)
 }
 
 /* returns true if host is using tsc clocksource */
-static bool kvm_get_time_and_clockread(s64 *kernel_ns, cycle_t *cycle_now)
+static bool kvm_get_time_and_clockread(s64 *kernel_ns, u64 *cycle_now)
 {
        /* checked again under seqlock below */
        if (pvclock_gtod_data.clock.vclock_mode != VCLOCK_TSC)
@@ -3070,6 +3070,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
        memset(&events->reserved, 0, sizeof(events->reserved));
 }
 
+static void kvm_set_hflags(struct kvm_vcpu *vcpu, unsigned emul_flags);
+
 static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
                                              struct kvm_vcpu_events *events)
 {
@@ -3106,10 +3108,13 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
                vcpu->arch.apic->sipi_vector = events->sipi_vector;
 
        if (events->flags & KVM_VCPUEVENT_VALID_SMM) {
+               u32 hflags = vcpu->arch.hflags;
                if (events->smi.smm)
-                       vcpu->arch.hflags |= HF_SMM_MASK;
+                       hflags |= HF_SMM_MASK;
                else
-                       vcpu->arch.hflags &= ~HF_SMM_MASK;
+                       hflags &= ~HF_SMM_MASK;
+               kvm_set_hflags(vcpu, hflags);
+
                vcpu->arch.smi_pending = events->smi.pending;
                if (events->smi.smm_inside_nmi)
                        vcpu->arch.hflags |= HF_SMM_INSIDE_NMI_MASK;
@@ -5855,7 +5860,7 @@ static void kvm_timer_init(void)
        }
        pr_debug("kvm: max_tsc_khz = %ld\n", max_tsc_khz);
 
-       cpuhp_setup_state(CPUHP_AP_X86_KVM_CLK_ONLINE, "AP_X86_KVM_CLK_ONLINE",
+       cpuhp_setup_state(CPUHP_AP_X86_KVM_CLK_ONLINE, "x86/kvm/clk:online",
                          kvmclock_cpu_online, kvmclock_cpu_down_prep);
 }
 
index 4ca0d78adcf0832f7f722ef090dfa92d00824ab3..d3289d7e78fac8ac98a40e3b62b9dcd406402910 100644 (file)
@@ -916,7 +916,7 @@ static unsigned long lguest_tsc_khz(void)
  * If we can't use the TSC, the kernel falls back to our lower-priority
  * "lguest_clock", where we read the time value given to us by the Host.
  */
-static cycle_t lguest_clock_read(struct clocksource *cs)
+static u64 lguest_clock_read(struct clocksource *cs)
 {
        unsigned long sec, nsec;
 
index 0b281217c890195870c6492351e849a93e6704d0..1f65ff6540f076536b43fb29a0e430aa5efac571 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/export.h>
 #include <linux/backing-dev.h>
 #include <linux/interrupt.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmx.h>
 #include <asm/asm.h>
 
index 9e6545f269e548e7cff7f4ee51876c440a7b6706..2ccc424a57d996e786969a42f672bfee760b8f42 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <linux/signal.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "fpu_emu.h"
 #include "fpu_system.h"
index e945fedf1de2982c5e58aaf4b3e97a28b4e9457e..0203baefb5c0a35d9bf67f581cc0707849caaa7d 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/signal.h>
 #include <linux/regset.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/traps.h>
 #include <asm/user.h>
 #include <asm/fpu/internal.h>
index 8db26591d91a206d457974c5e2e96ba621e4923a..b8ef9f9d2ffc71ebe584af74be0cc9a51ab92b76 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <linux/stddef.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/vm86.h>
 
 #include "fpu_system.h"
index 95228ff042c09bad7bce04aadc0eb8425a24714b..1643054766eb59b5313180d5067e1530ca34d5be 100644 (file)
@@ -18,7 +18,7 @@
  |    other processes using the emulator while swapping is in progress.      |
  +---------------------------------------------------------------------------*/
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "fpu_system.h"
 #include "exception.h"
index d597fe7423c98441f7ed52f8bcb0df3bd45646a9..2c98965a60ba70f6701edd22a52b2eeb43dd6ca6 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "fpu_emu.h"
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "fpu_system.h"
 #include "exception.h"
index fcd06f7526de31a6cd429e6d800ea93fcac294f9..61a7e9ea9aa16d6d7b6a136abdfa8bc693f69163 100644 (file)
@@ -1,5 +1,5 @@
 #include <linux/extable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/traps.h>
 #include <asm/kdebug.h>
 
index cf8059016ec8900096698c66c411c31c95991e7c..928d657de8295d8f617f3e0b7ba69be81006be4b 100644 (file)
@@ -34,7 +34,7 @@
 #include <asm/asm.h>
 #include <asm/bios_ebda.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/dma.h>
 #include <asm/fixmap.h>
index 963895f9af7fb8d7feba7ccfba05a08bcec30f2d..af85b686a7b0a5ff8335715a0b6cc826e2acab3a 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <asm/processor.h>
 #include <asm/bios_ebda.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/dma.h>
index e3353c97d0862d2a20bdd060fc229af2de8324bb..5a287e523eab0b42d6e9b1e73574dc7ead77502b 100644 (file)
@@ -20,7 +20,7 @@
 #include <asm/tlbflush.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/proto.h>
 #include <asm/pat.h>
index 821cb41f00e6ee9528e5d46a8ae6afd8e82b5204..ce4b06733c0920c4032ad25f0ab4619ff8470feb 100644 (file)
 #include <asm/io_apic.h>
 #include <asm/emergency-restart.h>
 
-static int ce4100_i8042_detect(void)
-{
-       return 0;
-}
-
 /*
  * The CE4100 platform has an internal 8051 Microcontroller which is
  * responsible for signaling to the external Power Management Unit the
@@ -145,7 +140,6 @@ static void sdv_pci_init(void)
 void __init x86_ce4100_early_setup(void)
 {
        x86_init.oem.arch_setup = sdv_arch_setup;
-       x86_platform.i8042_detect = ce4100_i8042_detect;
        x86_init.resources.probe_roms = x86_init_noop;
        x86_init.mpparse.get_smp_config = x86_init_uint_noop;
        x86_init.mpparse.find_smp_config = x86_init_noop;
index dd6cfa4ad3ac35713da9c93951bd65bd70106a58..61b5ed2b7d400339053d933d82c3938c94bbc766 100644 (file)
@@ -19,7 +19,7 @@ obj-$(subst m,y,$(CONFIG_SPI_SPIDEV)) += platform_spidev.o
 # I2C Devices
 obj-$(subst m,y,$(CONFIG_SENSORS_EMC1403)) += platform_emc1403.o
 obj-$(subst m,y,$(CONFIG_SENSORS_LIS3LV02D)) += platform_lis331.o
-obj-$(subst m,y,$(CONFIG_INPUT_MPU3050)) += platform_mpu3050.o
+obj-$(subst m,y,$(CONFIG_MPU3050_I2C)) += platform_mpu3050.o
 obj-$(subst m,y,$(CONFIG_INPUT_BMA150)) += platform_bma023.o
 obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
 # I2C GPIO Expanders
index 7850128f0026f2a045fa135173fe95963a927f14..12a272582cdc9f03553954f9f09cec265ce506b4 100644 (file)
@@ -161,12 +161,6 @@ out:
        regulator_has_full_constraints();
 }
 
-/* MID systems don't have i8042 controller */
-static int intel_mid_i8042_detect(void)
-{
-       return 0;
-}
-
 /*
  * Moorestown does not have external NMI source nor port 0x61 to report
  * NMI status. The possible NMI sources are from pmu as a result of NMI
@@ -197,7 +191,6 @@ void __init x86_intel_mid_early_setup(void)
        x86_cpuinit.setup_percpu_clockev = apbt_setup_secondary_clock;
 
        x86_platform.calibrate_tsc = intel_mid_calibrate_tsc;
-       x86_platform.i8042_detect = intel_mid_i8042_detect;
        x86_init.timers.wallclock_init = intel_mid_rtc_init;
        x86_platform.get_nmi_reason = intel_mid_get_nmi_reason;
 
index f5bad40936ac5bc7a4b47a868fb07121963fe2be..b8f562049cad102cd315987f87b099bed97e4cce 100644 (file)
@@ -25,7 +25,8 @@
  * @fmt:       format string.
  * ...         variadic argument list.
  */
-static void __init imr_self_test_result(int res, const char *fmt, ...)
+static __printf(2, 3)
+void __init imr_self_test_result(int res, const char *fmt, ...)
 {
        va_list vlist;
 
index b333fc45f9ec8025e72b2ad29abfeffbc7285e4b..2ee7632d49162f18812f01ae78f5fbd081128845 100644 (file)
@@ -30,7 +30,7 @@
 
 #define RTC_NAME               "sgi_rtc"
 
-static cycle_t uv_read_rtc(struct clocksource *cs);
+static u64 uv_read_rtc(struct clocksource *cs);
 static int uv_rtc_next_event(unsigned long, struct clock_event_device *);
 static int uv_rtc_shutdown(struct clock_event_device *evt);
 
@@ -38,7 +38,7 @@ static struct clocksource clocksource_uv = {
        .name           = RTC_NAME,
        .rating         = 299,
        .read           = uv_read_rtc,
-       .mask           = (cycle_t)UVH_RTC_REAL_TIME_CLOCK_MASK,
+       .mask           = (u64)UVH_RTC_REAL_TIME_CLOCK_MASK,
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -296,7 +296,7 @@ static int uv_rtc_unset_timer(int cpu, int force)
  * cachelines of it's own page.  This allows faster simultaneous reads
  * from a given socket.
  */
-static cycle_t uv_read_rtc(struct clocksource *cs)
+static u64 uv_read_rtc(struct clocksource *cs)
 {
        unsigned long offset;
 
@@ -305,7 +305,7 @@ static cycle_t uv_read_rtc(struct clocksource *cs)
        else
                offset = (uv_blade_processor_id() * L1_CACHE_BYTES) % PAGE_SIZE;
 
-       return (cycle_t)uv_read_local_mmr(UVH_RTC | offset);
+       return (u64)uv_read_local_mmr(UVH_RTC | offset);
 }
 
 /*
index 0c2fae8d929df154ff0324994df5f5341f2d4c52..73eb7fd4aec48d02e367b87ec1326da6c4022bde 100644 (file)
@@ -992,11 +992,12 @@ static void emit_relocs(int as_text, int use_real_mode)
                die("Segment relocations found but --realmode not specified\n");
 
        /* Order the relocations for more efficient processing */
-       sort_relocs(&relocs16);
        sort_relocs(&relocs32);
 #if ELF_BITS == 64
        sort_relocs(&relocs32neg);
        sort_relocs(&relocs64);
+#else
+       sort_relocs(&relocs16);
 #endif
 
        /* Print the relocations */
index 60a5a5a85505dd25305aea03d0850613e51ee791..2497bac560663150f49355f163c6fdadf44861a4 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <linux/mm.h>
 #include <linux/sched.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ptrace-abi.h>
 #include <skas.h>
 
index e30202b1716efb4243372d02e61f5f8269203419..a5c9910d234f2f235500ecf8a2fa587eaec56f88 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/errno.h>
 #define __FRAME_OFFSETS
 #include <asm/ptrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ptrace-abi.h>
 
 /*
index 49e50369702275935475a475338b3119ed228fea..727ed442e0a52f0b60b57567abf5bbc59c8e6e5f 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/ptrace.h>
 #include <linux/kernel.h>
 #include <asm/unistd.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ucontext.h>
 #include <frame_kern.h>
 #include <skas.h>
index 48e38584d5c1de82b00710ef3546cbb0b4e2d5a2..5bd949da7a4a5deb659f19e849dcd6036a2843ac 100644 (file)
@@ -6,7 +6,7 @@
 #include <linux/percpu.h>
 #include <linux/sched.h>
 #include <linux/syscalls.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ptrace-abi.h>
 #include <os.h>
 #include <skas.h>
index ced7027b3fbc299a32daa666fa77c6afa2739599..51ef952327257cb2a787b6743805e4cb677ecafc 100644 (file)
@@ -1529,11 +1529,11 @@ static int xen_cpuhp_setup(void)
        int rc;
 
        rc = cpuhp_setup_state_nocalls(CPUHP_XEN_PREPARE,
-                                      "XEN_HVM_GUEST_PREPARE",
+                                      "x86/xen/hvm_guest:prepare",
                                       xen_cpu_up_prepare, xen_cpu_dead);
        if (rc >= 0) {
                rc = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
-                                              "XEN_HVM_GUEST_ONLINE",
+                                              "x86/xen/hvm_guest:online",
                                               xen_cpu_up_online, NULL);
                if (rc < 0)
                        cpuhp_remove_state_nocalls(CPUHP_XEN_PREPARE);
index 37129db76d33ee31787755a7978161b86ea46bf8..276da636dd3995d194953333d9662c5fdc4946f4 100644 (file)
@@ -71,7 +71,7 @@
 
 #include <asm/cache.h>
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/xen/page.h>
 #include <asm/xen/hypercall.h>
index a9fafb5c873897eec1685861180cf4ac5fd826e3..a0b36a9d5df149e6370fb3b6be0d5894bae72bd7 100644 (file)
@@ -48,7 +48,7 @@ int __init pci_xen_swiotlb_detect(void)
         * activate this IOMMU. If running as PV privileged, activate it
         * irregardless.
         */
-       if ((xen_initial_domain() || swiotlb || swiotlb_force))
+       if (xen_initial_domain() || swiotlb || swiotlb_force == SWIOTLB_FORCE)
                xen_swiotlb = 1;
 
        /* If we are running under Xen, we MUST disable the native SWIOTLB.
index 8c394e30e5fe2afcafa32b8e7fee658b5b1c27f3..f3f7b41116f7afcd3a37880d6e814b67cac0f005 100644 (file)
@@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void)
                size = PFN_PHYS(xen_start_info->nr_p2m_frames);
        }
 
-       if (!xen_is_e820_reserved(start, size)) {
-               memblock_reserve(start, size);
+       memblock_reserve(start, size);
+       if (!xen_is_e820_reserved(start, size))
                return;
-       }
 
 #ifdef CONFIG_X86_32
        /*
@@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void)
        BUG();
 #else
        xen_relocate_p2m();
+       memblock_free(start, size);
 #endif
 }
 
index 33d8f6a7829d75c6673a8287d8a9d4be68401d9e..1e69956d7852bbfc8816acfb3bdd3d701ed99d59 100644 (file)
@@ -39,10 +39,10 @@ static unsigned long xen_tsc_khz(void)
        return pvclock_tsc_khz(info);
 }
 
-cycle_t xen_clocksource_read(void)
+u64 xen_clocksource_read(void)
 {
         struct pvclock_vcpu_time_info *src;
-       cycle_t ret;
+       u64 ret;
 
        preempt_disable_notrace();
        src = &__this_cpu_read(xen_vcpu)->time;
@@ -51,7 +51,7 @@ cycle_t xen_clocksource_read(void)
        return ret;
 }
 
-static cycle_t xen_clocksource_get_cycles(struct clocksource *cs)
+static u64 xen_clocksource_get_cycles(struct clocksource *cs)
 {
        return xen_clocksource_read();
 }
index 3cbce3b085e73519973d766a75c86520723c219a..ac0a2b0f9e626088fd44670c1709e0bf2da2900f 100644 (file)
@@ -67,7 +67,7 @@ void xen_init_irq_ops(void);
 void xen_setup_timer(int cpu);
 void xen_setup_runstate_info(int cpu);
 void xen_teardown_timer(int cpu);
-cycle_t xen_clocksource_read(void);
+u64 xen_clocksource_read(void);
 void xen_setup_cpu_clockevents(void);
 void __init xen_init_time_ops(void);
 void __init xen_hvm_init_time_ops(void);
index ec35074fcb03ac1064af1e6c8f5112ae03187194..3ae74d7e074b5970c92b4e2e5158ea631809eccf 100644 (file)
@@ -12,7 +12,7 @@
 #define _XTENSA_CHECKSUM_H
 
 #include <linux/in6.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <variant/core.h>
 
 /*
index a2eb547a1a75e76d796bb4a54a3ce638db1f85bc..98964ad15ca2aab3084180f489a31a7fe19fc579 100644 (file)
@@ -11,6 +11,6 @@
 #ifndef _XTENSA_SEGMENT_H
 #define _XTENSA_SEGMENT_H
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #endif /* _XTENSA_SEGEMENT_H */
index 8e10e357ee329bcd6cdafcd2e34bddc3ddd3e02c..bcb5beb81177e78e3d4558545098fd55b2c94cf4 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <asm/ptrace.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int main(void)
 {
index 4ac3d23161cf782484da4f0c89b9394e1911a07f..a265edd6ac37b423e7227f095201fcd8e1685538 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/of.h>
 
 #include <asm/mxregs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/platform.h>
 
 DECLARE_PER_CPU(unsigned long, nmi_count);
index 0fecc8a2c0b58987f9a2af56bc40808cbef4dfa3..ff1d81385ed7a2658e3733ea864f0f4434ec0e65 100644 (file)
@@ -422,7 +422,7 @@ static int __init xtensa_pmu_init(void)
        int irq = irq_create_mapping(NULL, XCHAL_PROFILING_INTERRUPT);
 
        ret = cpuhp_setup_state(CPUHP_AP_PERF_XTENSA_STARTING,
-                               "AP_PERF_XTENSA_STARTING", xtensa_pmu_setup,
+                               "perf/xtensa:starting", xtensa_pmu_setup,
                                NULL);
        if (ret) {
                pr_err("xtensa_pmu: failed to register CPU-hotplug.\n");
index e0ded48561db5857f5d3480ffcb2e0cfcd266011..826d25104846f5d930f55679f998a596ea52a95d 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/rcupdate.h>
 
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/platform.h>
index a651f3a628eec0b4708d34d4f736192c344bd5b6..32519b71d914b4ba1a64418354bbb7627cd018db 100644 (file)
@@ -29,7 +29,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/ptrace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 void user_enable_single_step(struct task_struct *child)
index e87adaa07ff3f0d7cb5ac6816ba6593d9b09ed1d..c41294745731eece5bcb20f8e523c2ed8464971d 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/tracehook.h>
 
 #include <asm/ucontext.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/coprocessor.h>
 #include <asm/unistd.h>
index 7538d802b65abbc88f2e3769ff77e117282470c7..e7d30ee0fd482794a21f72c85ca2feb2ec4b5500 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <asm/stacktrace.h>
 #include <asm/traps.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #if IS_ENABLED(CONFIG_OPROFILE) || IS_ENABLED(CONFIG_PERF_EVENTS)
 
index 83cf49685373867080689b163bc5fcf3ed89f3c7..d3fd100dffc9a03e821ccede4aa2b26dfd95215b 100644 (file)
@@ -15,7 +15,7 @@
  * Kevin Chea
  *
  */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/syscall.h>
 #include <asm/unistd.h>
 #include <linux/linkage.h>
index be81e69b25bc98e46514c46e4a5a030afb87ecca..668c1056f9e49bf8ca23234d16dc44fec9bec9b2 100644 (file)
@@ -34,9 +34,9 @@
 unsigned long ccount_freq;             /* ccount Hz */
 EXPORT_SYMBOL(ccount_freq);
 
-static cycle_t ccount_read(struct clocksource *cs)
+static u64 ccount_read(struct clocksource *cs)
 {
-       return (cycle_t)get_ccount();
+       return (u64)get_ccount();
 }
 
 static u64 notrace ccount_sched_clock_read(void)
index ce37d5b899fead50d312f06ed3c3f3982309d294..282bf721a4d6851ba81a7698d983228f6fe69578 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/stacktrace.h>
 #include <asm/ptrace.h>
 #include <asm/timex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/traps.h>
index 4d2872fd9bb5ebf89bb15127841e5ae28e8d9b58..d159e9b9c01837ba5aa9e77d50c3c14e475ce367 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/irq.h>
 #include <linux/in6.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/checksum.h>
 #include <asm/dma.h>
index c68f1e6158aa67901696d075336fae3d04b0803d..0140a22551c84155e083abaeed8ee15f39ebc3d3 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/seq_file.h>
 #include <linux/serial.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq.h>
 
 #include <platform/simcall.h>
index ede04cca30dde3000930831db1ce161e25447a28..02e94bb3ad3e088e65eef692873cf86447eccf16 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/blkdev.h>
 #include <linux/bio.h>
 #include <linux/proc_fs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <platform/simcall.h>
 
 #define SIMDISK_MAJOR 240
index 4bf850e8d6b5abf5a1f5252ab3bfe6dd10de6111..a8e67a155d04f6d937e890473b1647fbe95d210f 100644 (file)
@@ -2569,7 +2569,7 @@ static bool blk_mq_poll_hybrid_sleep(struct request_queue *q,
         * This will be replaced with the stats tracking code, using
         * 'avg_completion_time / 2' as the pre-sleep target.
         */
-       kt = ktime_set(0, nsecs);
+       kt = nsecs;
 
        mode = HRTIMER_MODE_REL;
        hrtimer_init_on_stack(&hs.timer, CLOCK_MONOTONIC, mode);
index 6e82769f4042c2f57af7976b1b7b4342eea1306d..f0a9c07b4c7a5ef9e96985a89c5c000d62a78cd0 100644 (file)
@@ -544,6 +544,8 @@ static inline bool may_queue(struct rq_wb *rwb, struct rq_wait *rqw,
  * the timer to kick off queuing again.
  */
 static void __wbt_wait(struct rq_wb *rwb, unsigned long rw, spinlock_t *lock)
+       __releases(lock)
+       __acquires(lock)
 {
        struct rq_wait *rqw = get_rq_wait(rwb, current_is_kswapd());
        DEFINE_WAIT(wait);
@@ -558,13 +560,12 @@ static void __wbt_wait(struct rq_wb *rwb, unsigned long rw, spinlock_t *lock)
                if (may_queue(rwb, rqw, &wait, rw))
                        break;
 
-               if (lock)
+               if (lock) {
                        spin_unlock_irq(lock);
-
-               io_schedule();
-
-               if (lock)
+                       io_schedule();
                        spin_lock_irq(lock);
+               } else
+                       io_schedule();
        } while (1);
 
        finish_wait(&rqw->wait, &wait);
@@ -595,7 +596,7 @@ static inline bool wbt_should_throttle(struct rq_wb *rwb, struct bio *bio)
  * in an irq held spinlock, if it holds one when calling this function.
  * If we do sleep, we'll release and re-grab it.
  */
-unsigned int wbt_wait(struct rq_wb *rwb, struct bio *bio, spinlock_t *lock)
+enum wbt_flags wbt_wait(struct rq_wb *rwb, struct bio *bio, spinlock_t *lock)
 {
        unsigned int ret = 0;
 
index 8a05a404ae708503589bdf33643948c37d243e62..a57046de2f07f00eae78aaabe9b5e43c1ecc178f 100644 (file)
@@ -655,6 +655,9 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 
        dprintk("%s: write %Zd bytes\n", bd->name, count);
 
+       if (unlikely(segment_eq(get_fs(), KERNEL_DS)))
+               return -EINVAL;
+
        bsg_set_block(bd, file);
 
        bytes_written = 0;
index 656c8c6ed206f876bbdbd0f240dedf9997a88cf0..be7f4de3eb3cfe7edc7a95644b2d9ee350703b88 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/fs.h>
 #include <linux/blktrace_api.h>
 #include <linux/pr.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user *arg)
 {
index 47a61474e7951cf6e1cb3e5a16bf0cbe2b13fc1f..14b081af8d61bc7fa4cbffa086b3d150c99c0156 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/slab.h>
 #include <asm/dasd.h>
 #include <asm/ebcdic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/vtoc.h>
 
 #include "check.h"
index c6fee7437be44573ade684d064e161954485301a..c2b64923ab66d8d89b6e92be71fe898fc834baa2 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/slab.h>
 #include <linux/times.h>
 #include <linux/uio.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_ioctl.h>
index f616ad74cce756fb2d0a0657d153483ed05f56d7..44e888b0b041944b44e8aa5d75619e51d7fe52a2 100644 (file)
@@ -1461,16 +1461,25 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
        for (i = 0; i < ctcount; i++) {
                unsigned int dlen = COMP_BUF_SIZE;
                int ilen = ctemplate[i].inlen;
+               void *input_vec;
 
+               input_vec = kmalloc(ilen, GFP_KERNEL);
+               if (!input_vec) {
+                       ret = -ENOMEM;
+                       goto out;
+               }
+
+               memcpy(input_vec, ctemplate[i].input, ilen);
                memset(output, 0, dlen);
                init_completion(&result.completion);
-               sg_init_one(&src, ctemplate[i].input, ilen);
+               sg_init_one(&src, input_vec, ilen);
                sg_init_one(&dst, output, dlen);
 
                req = acomp_request_alloc(tfm);
                if (!req) {
                        pr_err("alg: acomp: request alloc failed for %s\n",
                               algo);
+                       kfree(input_vec);
                        ret = -ENOMEM;
                        goto out;
                }
@@ -1483,6 +1492,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
                if (ret) {
                        pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n",
                               i + 1, algo, -ret);
+                       kfree(input_vec);
                        acomp_request_free(req);
                        goto out;
                }
@@ -1491,6 +1501,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
                        pr_err("alg: acomp: Compression test %d failed for %s: output len = %d\n",
                               i + 1, algo, req->dlen);
                        ret = -EINVAL;
+                       kfree(input_vec);
                        acomp_request_free(req);
                        goto out;
                }
@@ -1500,26 +1511,37 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
                               i + 1, algo);
                        hexdump(output, req->dlen);
                        ret = -EINVAL;
+                       kfree(input_vec);
                        acomp_request_free(req);
                        goto out;
                }
 
+               kfree(input_vec);
                acomp_request_free(req);
        }
 
        for (i = 0; i < dtcount; i++) {
                unsigned int dlen = COMP_BUF_SIZE;
                int ilen = dtemplate[i].inlen;
+               void *input_vec;
+
+               input_vec = kmalloc(ilen, GFP_KERNEL);
+               if (!input_vec) {
+                       ret = -ENOMEM;
+                       goto out;
+               }
 
+               memcpy(input_vec, dtemplate[i].input, ilen);
                memset(output, 0, dlen);
                init_completion(&result.completion);
-               sg_init_one(&src, dtemplate[i].input, ilen);
+               sg_init_one(&src, input_vec, ilen);
                sg_init_one(&dst, output, dlen);
 
                req = acomp_request_alloc(tfm);
                if (!req) {
                        pr_err("alg: acomp: request alloc failed for %s\n",
                               algo);
+                       kfree(input_vec);
                        ret = -ENOMEM;
                        goto out;
                }
@@ -1532,6 +1554,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
                if (ret) {
                        pr_err("alg: acomp: decompression failed on test %d for %s: ret=%d\n",
                               i + 1, algo, -ret);
+                       kfree(input_vec);
                        acomp_request_free(req);
                        goto out;
                }
@@ -1540,6 +1563,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
                        pr_err("alg: acomp: Decompression test %d failed for %s: output len = %d\n",
                               i + 1, algo, req->dlen);
                        ret = -EINVAL;
+                       kfree(input_vec);
                        acomp_request_free(req);
                        goto out;
                }
@@ -1549,10 +1573,12 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
                               i + 1, algo);
                        hexdump(output, req->dlen);
                        ret = -EINVAL;
+                       kfree(input_vec);
                        acomp_request_free(req);
                        goto out;
                }
 
+               kfree(input_vec);
                acomp_request_free(req);
        }
 
index 201292e67ee8a130cf67bb4d10d81eac707716c4..d00bc0ef87a67a0517a2406cc6149d922d0feea6 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/suspend.h>
 #include <linux/acpi.h>
 #include <acpi/video.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define PREFIX "ACPI: "
 
index 13caebd679f5b07503941f1023cf468901aeec36..8c4e0a18460a78df600067da69537e6256d6bc1c 100644 (file)
@@ -114,7 +114,7 @@ void __init acpi_watchdog_init(void)
        pdev = platform_device_register_simple("wdat_wdt", PLATFORM_DEVID_NONE,
                                               resources, nresources);
        if (IS_ERR(pdev))
-               pr_err("Failed to create platform device\n");
+               pr_err("Device creation failed: %ld\n", PTR_ERR(pdev));
 
        kfree(resources);
 
index 05fe9ebfb9b5d8acd5625b3bb16e34f2c03b6a4b..4ef1e4624b2b4bcee2a59666e5929bd915fb40a2 100644 (file)
@@ -36,7 +36,7 @@
 #ifdef CONFIG_ACPI_PROCFS_POWER
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #endif
 
 #include <linux/acpi.h>
index f8d65647ea790dd161b07221b9be2bdead4447d0..fb19e1cdb6415ac8d1913e7017106911dcb7a7dd 100644 (file)
@@ -98,7 +98,15 @@ static int find_child_checks(struct acpi_device *adev, bool check_children)
        if (check_children && list_empty(&adev->children))
                return -ENODEV;
 
-       return sta_present ? FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE;
+       /*
+        * If the device has a _HID (or _CID) returning a valid ACPI/PNP
+        * device ID, it is better to make it look less attractive here, so that
+        * the other device with the same _ADR value (that may not have a valid
+        * device ID) can be matched going forward.  [This means a second spec
+        * violation in a row, so whatever we do here is best effort anyway.]
+        */
+       return sta_present && list_empty(&adev->pnp.ids) ?
+                       FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE;
 }
 
 struct acpi_device *acpi_find_child_device(struct acpi_device *parent,
@@ -250,7 +258,6 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
        return 0;
 
  err:
-       acpi_dma_deconfigure(dev);
        ACPI_COMPANION_SET(dev, NULL);
        put_device(dev);
        put_device(&acpi_dev->dev);
index 1b41a2739dac1dcab72aa352e9add209b2313711..0c452265c11110213ddde5c5c4440e52d2a523a5 100644 (file)
@@ -37,6 +37,7 @@ void acpi_amba_init(void);
 static inline void acpi_amba_init(void) {}
 #endif
 int acpi_sysfs_init(void);
+void acpi_gpe_apply_masked_gpes(void);
 void acpi_container_init(void);
 void acpi_memory_hotplug_init(void);
 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
index a404ff4d71511d0a9d56ce10a238682e9ffc6073..57fb5f468ac2025ecb80775d420bebc9a867b998 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/semaphore.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
 #include "internal.h"
index 2a358154b770dda2a603600cb1348fc2514aabae..a34669cc823b5b836a800bf6798599ce7f88907e 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/suspend.h>
 #include <linux/bcd.h>
 #include <linux/acpi.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "sleep.h"
 #include "internal.h"
index 1fed84a092c21cc161b06b9ddca140af12ec7427..59c3a5d1e60039170212aa4481b2d24bb28fd162 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/cpufreq.h>
 #include <linux/acpi.h>
 #include <acpi/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define PREFIX "ACPI: "
 
index d51ca1c05619567798281c2733fdf3dd28909d5d..a12f96cc93ff77724cabcb4cf2c98e1954b808d7 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/acpi.h>
 #include <acpi/processor.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define PREFIX "ACPI: "
 
index 45dec874ea55b820281457a3ae5de2fe1f12403c..192691880d55c9499e1d77e68058a56d8e5318f3 100644 (file)
@@ -2074,6 +2074,7 @@ int __init acpi_scan_init(void)
                }
        }
 
+       acpi_gpe_apply_masked_gpes();
        acpi_update_all_gpes();
        acpi_ec_ecdt_start();
 
index 703c26e7022cbf186d9a1ed3a60cd25c6fd1c049..cf05ae973381178cc066e1c235c38afb419e1f01 100644 (file)
@@ -708,6 +708,62 @@ end:
        return result ? result : size;
 }
 
+/*
+ * A Quirk Mechanism for GPE Flooding Prevention:
+ *
+ * Quirks may be needed to prevent GPE flooding on a specific GPE. The
+ * flooding typically cannot be detected and automatically prevented by
+ * ACPI_GPE_DISPATCH_NONE check because there is a _Lxx/_Exx prepared in
+ * the AML tables. This normally indicates a feature gap in Linux, thus
+ * instead of providing endless quirk tables, we provide a boot parameter
+ * for those who want this quirk. For example, if the users want to prevent
+ * the GPE flooding for GPE 00, they need to specify the following boot
+ * parameter:
+ *   acpi_mask_gpe=0x00
+ * The masking status can be modified by the following runtime controlling
+ * interface:
+ *   echo unmask > /sys/firmware/acpi/interrupts/gpe00
+ */
+
+/*
+ * Currently, the GPE flooding prevention only supports to mask the GPEs
+ * numbered from 00 to 7f.
+ */
+#define ACPI_MASKABLE_GPE_MAX  0x80
+
+static u64 __initdata acpi_masked_gpes;
+
+static int __init acpi_gpe_set_masked_gpes(char *val)
+{
+       u8 gpe;
+
+       if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX)
+               return -EINVAL;
+       acpi_masked_gpes |= ((u64)1<<gpe);
+
+       return 1;
+}
+__setup("acpi_mask_gpe=", acpi_gpe_set_masked_gpes);
+
+void __init acpi_gpe_apply_masked_gpes(void)
+{
+       acpi_handle handle;
+       acpi_status status;
+       u8 gpe;
+
+       for (gpe = 0;
+            gpe < min_t(u8, ACPI_MASKABLE_GPE_MAX, acpi_current_gpe_count);
+            gpe++) {
+               if (acpi_masked_gpes & ((u64)1<<gpe)) {
+                       status = acpi_get_gpe_device(gpe, &handle);
+                       if (ACPI_SUCCESS(status)) {
+                               pr_info("Masking GPE 0x%x.\n", gpe);
+                               (void)acpi_mask_gpe(handle, gpe, TRUE);
+                       }
+               }
+       }
+}
+
 void acpi_irq_stats_init(void)
 {
        acpi_status status;
index 35e8fbca10ad5eb847b82f028600ebfb738203a5..1d0417b87cb7ccd50c5b748cfa8e6edba70447d5 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/thermal.h>
 #include <linux/acpi.h>
 #include <linux/workqueue.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define PREFIX "ACPI: "
 
index f9b983ae68777544f5cc986f3e0e4e3b1f074179..1fd25e872ece44b9a591eb3225e15f2ec3b0178f 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/slab.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/atmdev.h>
 #include <linux/atm.h>
index 480fa6ffbc090a48ae32496ef788c8e63d92e6be..3ef6253e1cce24c91170b197f4ea72d1bf86f06f 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/bitops.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 
 
index 40c2d561417bdecd6bd386f3c92214a51a6faece..c53a9dd1353f4e473007d81100d5b60fb70524be 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/slab.h>
 #include <asm/io.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/string.h>
 #include <asm/byteorder.h>
 
index 85aaf2222587bfcc9086686d44ee4e042a46c233..80c2ddcfa92c514af55d200d57ce8e8cda280476 100644 (file)
@@ -52,7 +52,7 @@
 #include <asm/string.h>
 #include <asm/io.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/wait.h>
 
 #include "firestream.h"
index 81aaa505862c040605c30a70658d948ad3f52529..637c3e6b0f9ed3265da287c5a7a61c08180a74e6 100644 (file)
@@ -43,7 +43,7 @@
 #include <asm/irq.h>
 #include <asm/dma.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 
 #ifdef CONFIG_SBUS
index 31b513a23ae0cd1d39af043408deba0bbb8c9b83..3617659b918482f4ebeca9b9da10d5e393e963d8 100644 (file)
@@ -71,7 +71,7 @@
 #include <linux/slab.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/atmdev.h>
 #include <linux/atm.h>
index 5fc81e240c242a12fe972b7054c5d5162cdd4881..584aa881882b9b8961f3eaaae10bf21bdb4664be 100644 (file)
@@ -45,7 +45,7 @@
 
 #include <asm/io.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/string.h>
 #include <asm/byteorder.h>
 
index feb023d7eebd60615fe762a73e2dc703293a6306..082aa02abc5742fa68d3073b361d6afbf13ab5da 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <asm/param.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "idt77105.h"
 
index 074616b39f4d542db8001cd6d0b1d7829dc83875..471ddfd93ea87b2d4da09b398bb6982b735036b8 100644 (file)
@@ -45,7 +45,7 @@
 #include <linux/slab.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 #include <asm/byteorder.h>
 
index b2756765950e8b8f82b6529fc5db767e61f4cfb0..8640bafeb471eec5a3b8925cc0753d175b0ea6f6 100644 (file)
@@ -58,7 +58,7 @@
 #include <linux/slab.h>
 #include <asm/io.h>  
 #include <linux/atomic.h>
-#include <asm/uaccess.h>  
+#include <linux/uaccess.h>  
 #include <asm/string.h>  
 #include <asm/byteorder.h>  
 #include <linux/vmalloc.h>
index c7296b5837873f3953455540325d7edfd8390a1c..cb28579e8a946f6820fdff21433fd715870a6436 100644 (file)
@@ -50,7 +50,7 @@
 #include <linux/slab.h>
 #include <linux/idr.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 #include <linux/etherdevice.h>
 #include "nicstar.h"
index 02159345566c3d018d01d50f8309fc4bd680a1d1..b0363149b2fdac81b2c77ff06da850cc47a82c05 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/atm_suni.h>
 #include <linux/slab.h>
 #include <asm/param.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 
 #include "suni.h"
index 5120a96b3a894f4a62735c26caacbbf6c8a21ae3..4fa13a80787395369ce943fcd56f780468c353d6 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/sonet.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 
 #include "uPD98402.h"
index d3dc954841614e3b4b0e85e6f054d2b2f45b14a3..292dec18ffb87acf57842f3a0c2490b326488e12 100644 (file)
@@ -27,7 +27,7 @@
 #include <asm/string.h>
 #include <asm/io.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "uPD98401.h"
 #include "uPD98402.h"
index bb69e58c29f31fb51b4f787097de36590779579a..8ab8ea1253e62310a68d9e6bf039d8d866ee4019 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/slab.h>
 
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static DEFINE_MUTEX(mem_sysfs_mutex);
 
index 5711708532db12be9a7052a18d5b5ddc7e95d1a1..2997026b4dfb00c1daec88f1f18264656a61ffb0 100644 (file)
@@ -544,6 +544,7 @@ static int genpd_runtime_suspend(struct device *dev)
                return -EBUSY;
 
        /* Measure suspend latency. */
+       time_start = 0;
        if (runtime_pm)
                time_start = ktime_get();
 
@@ -625,6 +626,7 @@ static int genpd_runtime_resume(struct device *dev)
 
  out:
        /* Measure resume latency. */
+       time_start = 0;
        if (timed && runtime_pm)
                time_start = ktime_get();
 
index 48c6294e9c342850cbc602c247d4cb27f2a65970..249e0304597f5bb6e4e48a26725bc712b1a5120b 100644 (file)
@@ -194,7 +194,7 @@ void device_pm_move_last(struct device *dev)
 
 static ktime_t initcall_debug_start(struct device *dev)
 {
-       ktime_t calltime = ktime_set(0, 0);
+       ktime_t calltime = 0;
 
        if (pm_print_times_enabled) {
                pr_info("calling  %s+ @ %i, parent: %s\n",
index bf9ba26981a5590f97c6cf029bbf0ccb1fe31aa8..f546f8f107b06a456fc01738d1f8b2c6bcce1b53 100644 (file)
@@ -998,14 +998,14 @@ static int print_wakeup_source_stats(struct seq_file *m,
 
                active_time = ktime_sub(now, ws->last_time);
                total_time = ktime_add(total_time, active_time);
-               if (active_time.tv64 > max_time.tv64)
+               if (active_time > max_time)
                        max_time = active_time;
 
                if (ws->autosleep_enabled)
                        prevent_sleep_time = ktime_add(prevent_sleep_time,
                                ktime_sub(now, ws->start_prevent_time));
        } else {
-               active_time = ktime_set(0, 0);
+               active_time = 0;
        }
 
        seq_printf(m, "%-12s\t%lu\t\t%lu\t\t%lu\t\t%lu\t\t%lld\t\t%lld\t\t%lld\t\t%lld\t\t%lld\n",
index 0809cda93cc031360257c7f0802964e15f0f0d51..26a51be7722768d1215d2e72df11158dd64c0e05 100644 (file)
@@ -48,7 +48,7 @@
 #include <linux/random.h>
 #include <linux/scatterlist.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "DAC960.h"
 
 #define DAC960_GAM_MINOR       252
index 5fd50a2841682b5a2479cfd210e3ab1a38a9d8fd..a328f673adfe036fcc5a4ccfe5ac3e9824d8ca85 100644 (file)
@@ -70,7 +70,7 @@
 #include <linux/platform_device.h>
 
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/amigahw.h>
 #include <asm/amigaints.h>
 #include <asm/irq.h>
index ad793f35632c6f66815dff1944e57b02fc2d8301..3adc32a3153b2366d2d4deb652f22a1c61e06756 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/pfn_t.h>
 #endif
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define SECTOR_SHIFT           9
 #define PAGE_SECTORS_SHIFT     (PAGE_SHIFT - SECTOR_SHIFT)
index db9d6bb6352d97a0a2cc9099a16317227edca96f..e5c5b8eb14a9bc4aaea939b955cd89c91946e98c 100644 (file)
@@ -43,7 +43,7 @@
 #include <linux/mutex.h>
 #include <linux/bitmap.h>
 #include <linux/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/dma-mapping.h>
 #include <linux/blkdev.h>
index 3d31761c0ed05c6054f6a5de7251fb6d811b6caa..74e03aa537ad740faf9cf056d2b10e3f77590d31 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/string.h>
 #include <linux/blkdev.h>
 #include <linux/scatterlist.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "loop.h"
 
 MODULE_LICENSE("GPL");
index 3abb121825bc579609b218c7288b0fcd39b6040d..a9b48ed7a3cd258c1314b23aa77502c9a4fbbfc1 100644 (file)
@@ -45,7 +45,7 @@
 
 #define REALLY_SLOW_IO
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef __arm__
 #undef  HD_IRQ
index 4af81876679766d8e3609daf43302d8967b68d00..f347285c67ec1151d0d725842eed84ba2231f760 100644 (file)
@@ -78,7 +78,7 @@
 #include <linux/uio.h>
 #include "loop.h"
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static DEFINE_IDR(loop_index_idr);
 static DEFINE_MUTEX(loop_index_mutex);
index 99c84468f1543745eb68d9b245448e339f6cf503..38c576f76d36fca1f43bc37b6c733ba6bb222849 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/debugfs.h>
 #include <linux/blk-mq.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/types.h>
 
 #include <linux/nbd.h>
index 4943ee22716e04a3b1427161f28ca9bafdd68a95..c0e14e54909b41b8f8e2f916be0d1169464ff643 100644 (file)
@@ -257,7 +257,7 @@ static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)
 
 static void null_cmd_end_timer(struct nullb_cmd *cmd)
 {
-       ktime_t kt = ktime_set(0, completion_nsec);
+       ktime_t kt = completion_nsec;
 
        hrtimer_start(&cmd->timer, kt, HRTIMER_MODE_REL);
 }
index 93362362aa551ccbc0fa952263bebe1f2f8cddb0..5fd2d0e25567dca15c9edb91f9a1a4f27bec8f75 100644 (file)
@@ -139,7 +139,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
 #include <linux/spinlock.h>
 #include <linux/blkdev.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static DEFINE_MUTEX(pcd_mutex);
 static DEFINE_SPINLOCK(pcd_lock);
index 78a39f736c64f7edb6eb5d721e391d9e25f4a113..c3ed2fc72daae449f354867cb50e3eb111ec9c75 100644 (file)
@@ -155,7 +155,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV};
 #include <linux/blkpg.h>
 #include <linux/kernel.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/workqueue.h>
 
 static DEFINE_MUTEX(pd_mutex);
index 7a7d977a76c5089b54f715f861e63a11832f23c9..ed93e8badf5684d513ef78a8c03f74ccc4531ecd 100644 (file)
@@ -155,7 +155,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_LUN, D_DLY};
 #include <linux/blkdev.h>
 #include <linux/blkpg.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static DEFINE_MUTEX(pf_mutex);
 static DEFINE_SPINLOCK(pf_spin_lock);
index bfbd4c852dd9560d847766bf3db1cdd53c1ecb9e..5db955fe3a949018e353ebaa1b98a4a1f17b86ef 100644 (file)
@@ -166,7 +166,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
 #include <linux/mutex.h>
 #include <linux/jiffies.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 module_param(verbose, int, 0644);
 module_param(major, int, 0);
index 216a94fed5b420bd59627643730d3284308367e7..61fc6824299ac13c762e84dde6cae8baf8411e37 100644 (file)
@@ -150,7 +150,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
 #include <linux/sched.h>       /* current, TASK_*, schedule_timeout() */
 #include <linux/mutex.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 module_param(verbose, int, 0);
 module_param(major, int, 0);
index 95c98de929714c123217cf6fc1ba3c5ca998dafe..1b94c1ca5c5f1ee1bc00e0fe5103cf6ef0a4dafe 100644 (file)
@@ -68,7 +68,7 @@
 #include <linux/debugfs.h>
 #include <linux/device.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define DRIVER_NAME    "pktcdvd"
 
index c264f2d284a7be338caa7513a94e21c5bbc6d3de..aabd8e9d3035c880410dade33eef1096e2134d6b 100644 (file)
@@ -34,7 +34,7 @@
 #include <asm/io.h>
 #include <asm/dbdma.h>
 #include <asm/prom.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mediabay.h>
 #include <asm/machdep.h>
 #include <asm/pmac_feature.h>
index ba4bfe933276e34310a4208a10eb2e364dfefa7e..0e93ad7b851160540b25c068e5314f107dad2964 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/completion.h>
 #include <linux/scatterlist.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #if 0
 #define CARM_DEBUG
index 46f4c719fed96317c2bb1a217d6744f046c10986..c141cc3be22bddc12079e3195c93dea225aafb9b 100644 (file)
@@ -54,7 +54,7 @@
 
 #include "umem.h"
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 #define MM_MAXCARDS 4
index 231633328dfa9641ad2f6644321aab6690dc7939..c49da15d979013bb5b890e5cdd4db9296e1508fa 100644 (file)
@@ -1796,7 +1796,7 @@ static int __init cci_platform_init(void)
        int ret;
 
        ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_CCI_ONLINE,
-                                     "AP_PERF_ARM_CCI_ONLINE", NULL,
+                                     "perf/arm/cci:online", NULL,
                                      cci_pmu_offline_cpu);
        if (ret)
                return ret;
index d1074d9b38ba163e624ea1b996df38ad2164f285..4d6a2b7e4d3fc1fead60ccfc60d7f048030d3de1 100644 (file)
@@ -1562,7 +1562,7 @@ static int __init arm_ccn_init(void)
        int i, ret;
 
        ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_CCN_ONLINE,
-                                     "AP_PERF_ARM_CCN_ONLINE", NULL,
+                                     "perf/arm/ccn:online", NULL,
                                      arm_ccn_pmu_offline_cpu);
        if (ret)
                return ret;
@@ -1570,7 +1570,10 @@ static int __init arm_ccn_init(void)
        for (i = 0; i < ARRAY_SIZE(arm_ccn_pmu_events); i++)
                arm_ccn_pmu_events_attrs[i] = &arm_ccn_pmu_events[i].attr.attr;
 
-       return platform_driver_register(&arm_ccn_driver);
+       ret = platform_driver_register(&arm_ccn_driver);
+       if (ret)
+               cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_CCN_ONLINE);
+       return ret;
 }
 
 static void __exit arm_ccn_exit(void)
index 5d475b3a0b2e96660d6474b90cfc7daa7b5a0aff..59cca72647a623dad42465c08021bb9f818933b8 100644 (file)
 #include <linux/blkdev.h>
 #include <linux/times.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* used to tell the module to turn on full debugging messages */
 static bool debug;
index a48e05b31593b448d789b4f4e4e83ba484e7d340..2053f70ef66b2de7c93700daf081f41a26442eef 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/fs.h>
 #include <linux/agpgart.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "agp.h"
 #include "compat_ioctl.h"
 
index 0f64d149c98dcdea120a03ea6f191c36c01b3a29..f6955888e67657691e2654470bb5953d6ae15cac 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/mm.h>
 #include <linux/fs.h>
 #include <linux/sched.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include "agp.h"
 
index 14790304b84b23fc2f8dfe4b23eeb9f659755d92..e5c62dcf2c11cb10a920028b8cd13bbd0962c59b 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/fs.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "applicom.h"
 
index 35d46da754d79d14e598d785118303ef7f852849..0584025bb0c2239969e513996b96bf71856a58f0 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <asm/blackfin.h>
 #include <asm/bfrom.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
 #define stampit() stamp("here i am")
index 0fae5296e311cc819fc071356c77c07d8de74d93..eb53cbadb68f8ca348f0de5ad3769341e8b5590a 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/therm.h>
 
 #ifdef CONFIG_PROC_FS
index 65a8d96c0e938f6f8f7df38166f8cb3b065d956c..58471394beb92077617ae15b3dd80d4471c511fe 100644 (file)
@@ -59,7 +59,7 @@
 #include <linux/sched.h>
 #include <linux/mutex.h>
 #include <asm/io.h>            /* for inb_p, outb_p, inb, outb, etc. */
-#include <asm/uaccess.h>       /* for get_user, etc. */
+#include <linux/uaccess.h>     /* for get_user, etc. */
 #include <linux/wait.h>                /* for wait_queue */
 #include <linux/init.h>                /* for __init, module_{init,exit} */
 #include <linux/poll.h>                /* for POLLIN, etc. */
index 073db9558379366dcde41921c059bbf5287b4341..14e728fbb8a009bcb8988c63f52c812c122943b7 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/init.h>
 #include <linux/mutex.h>
 #include <linux/pagemap.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/nvram.h>
 #ifdef CONFIG_PPC_PMAC
 #include <asm/machdep.h>
index a7c5c59675f06944405e560cf54575fbe0f07e23..4f337375252e8953606042f6b915ef22ae2768a9 100644 (file)
@@ -46,7 +46,7 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/sysrq.h>
 #include <linux/timer.h>
 #include <linux/hrtimer.h>
index be54e5331a4517899e0e4ace0c48418cbb082a0e..20b32bb8c2aff5f57aa93e4eaa657e5275bf9313 100644 (file)
@@ -69,9 +69,9 @@ static u32 hpet_nhpet, hpet_max_freq = HPET_USER_FREQ;
 #ifdef CONFIG_IA64
 static void __iomem *hpet_mctr;
 
-static cycle_t read_hpet(struct clocksource *cs)
+static u64 read_hpet(struct clocksource *cs)
 {
-       return (cycle_t)read_counter((void __iomem *)hpet_mctr);
+       return (u64)read_counter((void __iomem *)hpet_mctr);
 }
 
 static struct clocksource clocksource_hpet = {
index f9766415ff10b7fe6566c08a39fde0ae07464792..6ce5ce8be2f2dda80a52790ee611106097fabdbe 100644 (file)
@@ -43,7 +43,7 @@
 #include <linux/slab.h>
 #include <linux/random.h>
 #include <linux/err.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 #define RNG_MODULE_NAME                "hw_random"
index 4facc7517a6a222350f2478568f81422980ff108..4035495f3a86c8bc83c0ab52ffae9a59f6a9c8bc 100644 (file)
@@ -43,7 +43,7 @@
 #include <linux/kdebug.h>
 #include <linux/rwsem.h>
 #include <linux/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/notifier.h>
 #include <linux/nmi.h>
 #include <linux/reboot.h>
index c4094c4e22c11dda9647d3d472a18203f98f9649..5b6742770656746e3f0f6c2c88c439253a5122fb 100644 (file)
 #include <linux/lp.h>
 
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* if you have more than 8 printers, remember to increase LP_NO */
 #define LP_NO 8
index 67d426470e5341df2c88afe1b509742b9923603a..8c9216a0f62ec64683015e69f805904854ac429c 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/slab.h>
 #include <linux/pagemap.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/sn/addrs.h>
 #include <asm/sn/intr.h>
index 3d6c0671e9965bcd020f81cece6680c3e5dfd726..f786b18ac5008d598cd4a0217a73bb69bc042c34 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/mutex.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sn/addrs.h>
 #include <asm/sn/intr.h>
 #include <asm/sn/shub_mmr.h>
index 972c40a19629c73271b10b1042f0b8f3601160d6..4a8937f8057012c8c3b4e1eb37f1fc655def1dbd 100644 (file)
@@ -54,7 +54,7 @@
 #include <linux/sched.h>       /* cond_resched() */
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq.h>
 #include "smapi.h"
 #include "mwavedd.h"
index 37e0a49260801eea400147905162b6bd7a835515..21cb09c7bed70ce85305665e103e5b5050e9e78b 100644 (file)
@@ -53,7 +53,7 @@
 #include "smapi.h"
 #include "mwavepub.h"
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/wait.h>
 
 extern int mwave_debug;
index b07b119ae57fd5883d68ecda686d3b2630fa5451..2a91bf048804408bb0f5e2b4ba3fb382fc9f934f 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/nsc_gpio.h>
 #include <linux/platform_device.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 #define NAME "nsc_gpio"
index 0e184426db98ed956c9d25bfb9566f608711980d..a5b1eb276c0bf97c9959d72171cf1738ac0503b6 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/errno.h>
 #include <linux/init.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
index dbe598de9b74ff4392384f8327715dc3136aa499..a284ae25e69a1bcee2b4eda407c51b616e9432cc 100644 (file)
@@ -31,7 +31,7 @@
 #include <asm/hardware/dec21285.h>
 #include <asm/io.h>
 #include <asm/mach-types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*****************************************************************************/
 #include <asm/nwflash.h>
index 3f79a9fb6b1b4a1e7489535c30cd6407f2defd44..5f4be88c0dfcd3521b0357e6dc05e5e5a42cd446 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/mutex.h>
 #include <linux/nsc_gpio.h>
 #include <linux/platform_device.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define DEVNAME "pc8736x_gpio"
 
index fc061f7c2bd1f7a850f96737c00cb06ac5dd56c1..d7123259143e9e3c849698068174a92589490d86 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/poll.h>
 #include <linux/mutex.h>
 #include <linux/wait.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 #include <pcmcia/cistpl.h>
index a7dd5f4f2c5a66a536e0cfd9e7a83a1a17255bfa..d136db1a10f01bffae939aebd9ff36939a1cd76e 100644 (file)
@@ -84,7 +84,7 @@
 #define PUT_USER(error,value,addr) error = put_user(value,addr)
 #define COPY_TO_USER(error,dest,src,size) error = copy_to_user(dest,src,size) ? -EFAULT : 0
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static MGSL_PARAMS default_params = {
        MGSL_MODE_HDLC,                 /* unsigned long mode */
index d6876d50622075f1b490bf7a19831b4e8784adb6..1ef26403bcc83f6a0c26f20d67b74e7fe6331635 100644 (file)
 #include <crypto/chacha20.h>
 
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq.h>
 #include <asm/irq_regs.h>
 #include <asm/io.h>
index e83b2adc014ad92c374a1e136a158612d3fd1883..293167c6e2548864d281c105248cb58466bf0650 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/compat.h>
 #include <linux/vmalloc.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 struct raw_device_data {
        struct block_device *binding;
index 0bc135b9b16fa680d0111aa932eb4cc39ce36ee8..903761bc41c968c8c8f6b692a36cf1c738aafdcb 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 #include <linux/types.h>
index 719c5b4eed3919c3679f6347999e58d12eae1ae9..4fa7fcd8af36aaecd214ee4287f84792e9ef5350 100644 (file)
@@ -52,7 +52,7 @@
 #include <linux/platform_device.h>
 #include <linux/gfp.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 #include <linux/sonypi.h>
index 100cd1de9939dc77c5c523b10e15e1bc80908449..572a51704e67cf118692346f6c7cf78a9a3bf83c 100644 (file)
@@ -44,7 +44,7 @@
 #include <linux/miscdevice.h>
 #include <linux/platform_device.h>
 #include <asm/io.h>            /* inb/outb */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 MODULE_AUTHOR("Sebastien Bouchard <sebastien.bouchard@ca.kontron.com>");
 MODULE_LICENSE("GPL");
index f5a45d887a37f0aa83ed033b912faaa9a75ae957..5488516da8ea50c272afb98d29321148e3fa52e6 100644 (file)
@@ -63,7 +63,7 @@
 #include <linux/miscdevice.h>
 #include <linux/ioport.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/init.h>
 #include <linux/stat.h>
 #include <linux/proc_fs.h>
index c07dfe5c4da30b6dc29bea327fb8f036f83bb6fa..3e6b23c3453c1fd66fd91ce6ffd76881eb7e7304 100644 (file)
@@ -88,7 +88,7 @@
 #include <linux/slab.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_OF
 /* For open firmware. */
index 5eb05dbf59b84d27d79106adeb7405d15de1433a..fc585f370549a336ea12cc5c323dbc77aec69825 100644 (file)
@@ -768,5 +768,5 @@ fail:
        kfree(clks);
        iounmap(base);
 }
-CLK_OF_DECLARE(stm32f42xx_rcc, "st,stm32f42xx-rcc", stm32f4_rcc_init);
-CLK_OF_DECLARE(stm32f46xx_rcc, "st,stm32f469-rcc", stm32f4_rcc_init);
+CLK_OF_DECLARE_DRIVER(stm32f42xx_rcc, "st,stm32f42xx-rcc", stm32f4_rcc_init);
+CLK_OF_DECLARE_DRIVER(stm32f46xx_rcc, "st,stm32f469-rcc", stm32f4_rcc_init);
index 9375777776d994071a476d2e198be933838db685..b533f99550e1b97dd55944a85cbf5d64153309f5 100644 (file)
  * @smstpcr: module stop control register
  * @mstpsr: module stop status register (optional)
  * @lock: protects writes to SMSTPCR
+ * @width_8bit: registers are 8-bit, not 32-bit
  */
 struct mstp_clock_group {
        struct clk_onecell_data data;
        void __iomem *smstpcr;
        void __iomem *mstpsr;
        spinlock_t lock;
+       bool width_8bit;
 };
 
 /**
@@ -59,6 +61,18 @@ struct mstp_clock {
 
 #define to_mstp_clock(_hw) container_of(_hw, struct mstp_clock, hw)
 
+static inline u32 cpg_mstp_read(struct mstp_clock_group *group,
+                               u32 __iomem *reg)
+{
+       return group->width_8bit ? readb(reg) : clk_readl(reg);
+}
+
+static inline void cpg_mstp_write(struct mstp_clock_group *group, u32 val,
+                                 u32 __iomem *reg)
+{
+       group->width_8bit ? writeb(val, reg) : clk_writel(val, reg);
+}
+
 static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
 {
        struct mstp_clock *clock = to_mstp_clock(hw);
@@ -70,12 +84,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
 
        spin_lock_irqsave(&group->lock, flags);
 
-       value = clk_readl(group->smstpcr);
+       value = cpg_mstp_read(group, group->smstpcr);
        if (enable)
                value &= ~bitmask;
        else
                value |= bitmask;
-       clk_writel(value, group->smstpcr);
+       cpg_mstp_write(group, value, group->smstpcr);
 
        spin_unlock_irqrestore(&group->lock, flags);
 
@@ -83,7 +97,7 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
                return 0;
 
        for (i = 1000; i > 0; --i) {
-               if (!(clk_readl(group->mstpsr) & bitmask))
+               if (!(cpg_mstp_read(group, group->mstpsr) & bitmask))
                        break;
                cpu_relax();
        }
@@ -114,9 +128,9 @@ static int cpg_mstp_clock_is_enabled(struct clk_hw *hw)
        u32 value;
 
        if (group->mstpsr)
-               value = clk_readl(group->mstpsr);
+               value = cpg_mstp_read(group, group->mstpsr);
        else
-               value = clk_readl(group->smstpcr);
+               value = cpg_mstp_read(group, group->smstpcr);
 
        return !(value & BIT(clock->bit_index));
 }
@@ -188,6 +202,9 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
                return;
        }
 
+       if (of_device_is_compatible(np, "renesas,r7s72100-mstp-clocks"))
+               group->width_8bit = true;
+
        for (i = 0; i < MSTP_MAX_CLOCKS; ++i)
                clks[i] = ERR_PTR(-ENOENT);
 
index 28037d0b8dcd133c4be8814bf609342c1520d0c4..1961e3539b5760fd78bd8c076ad790ffad729dc1 100644 (file)
@@ -58,16 +58,16 @@ u32 acpi_pm_read_verified(void)
        return v2;
 }
 
-static cycle_t acpi_pm_read(struct clocksource *cs)
+static u64 acpi_pm_read(struct clocksource *cs)
 {
-       return (cycle_t)read_pmtmr();
+       return (u64)read_pmtmr();
 }
 
 static struct clocksource clocksource_acpi_pm = {
        .name           = "acpi_pm",
        .rating         = 200,
        .read           = acpi_pm_read,
-       .mask           = (cycle_t)ACPI_PM_MASK,
+       .mask           = (u64)ACPI_PM_MASK,
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -81,9 +81,9 @@ static int __init acpi_pm_good_setup(char *__str)
 }
 __setup("acpi_pm_good", acpi_pm_good_setup);
 
-static cycle_t acpi_pm_read_slow(struct clocksource *cs)
+static u64 acpi_pm_read_slow(struct clocksource *cs)
 {
-       return (cycle_t)acpi_pm_read_verified();
+       return (u64)acpi_pm_read_verified();
 }
 
 static inline void acpi_pm_need_workaround(void)
@@ -145,7 +145,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE,
  */
 static int verify_pmtmr_rate(void)
 {
-       cycle_t value1, value2;
+       u64 value1, value2;
        unsigned long count, delta;
 
        mach_prepare_counter();
@@ -175,7 +175,7 @@ static int verify_pmtmr_rate(void)
 
 static int __init init_acpi_pm_clocksource(void)
 {
-       cycle_t value1, value2;
+       u64 value1, value2;
        unsigned int i, j = 0;
 
        if (!pmtmr_ioport)
index a49748d826c0315cf537a0beea7fb40073e410a8..7517f959cba762e484cdc1fb00a78cb95aee5fe0 100644 (file)
@@ -56,7 +56,7 @@ static int noinline arc_get_timer_clk(struct device_node *node)
 
 #ifdef CONFIG_ARC_TIMERS_64BIT
 
-static cycle_t arc_read_gfrc(struct clocksource *cs)
+static u64 arc_read_gfrc(struct clocksource *cs)
 {
        unsigned long flags;
        u32 l, h;
@@ -71,7 +71,7 @@ static cycle_t arc_read_gfrc(struct clocksource *cs)
 
        local_irq_restore(flags);
 
-       return (((cycle_t)h) << 32) | l;
+       return (((u64)h) << 32) | l;
 }
 
 static struct clocksource arc_counter_gfrc = {
@@ -105,7 +105,7 @@ CLOCKSOURCE_OF_DECLARE(arc_gfrc, "snps,archs-timer-gfrc", arc_cs_setup_gfrc);
 #define AUX_RTC_LOW    0x104
 #define AUX_RTC_HIGH   0x105
 
-static cycle_t arc_read_rtc(struct clocksource *cs)
+static u64 arc_read_rtc(struct clocksource *cs)
 {
        unsigned long status;
        u32 l, h;
@@ -122,7 +122,7 @@ static cycle_t arc_read_rtc(struct clocksource *cs)
                status = read_aux_reg(AUX_RTC_CTRL);
        } while (!(status & _BITUL(31)));
 
-       return (((cycle_t)h) << 32) | l;
+       return (((u64)h) << 32) | l;
 }
 
 static struct clocksource arc_counter_rtc = {
@@ -166,9 +166,9 @@ CLOCKSOURCE_OF_DECLARE(arc_rtc, "snps,archs-timer-rtc", arc_cs_setup_rtc);
  * 32bit TIMER1 to keep counting monotonically and wraparound
  */
 
-static cycle_t arc_read_timer1(struct clocksource *cs)
+static u64 arc_read_timer1(struct clocksource *cs)
 {
-       return (cycle_t) read_aux_reg(ARC_REG_TIMER1_CNT);
+       return (u64) read_aux_reg(ARC_REG_TIMER1_CNT);
 }
 
 static struct clocksource arc_counter_timer1 = {
@@ -309,7 +309,7 @@ static int __init arc_clockevent_setup(struct device_node *node)
        }
 
        ret = cpuhp_setup_state(CPUHP_AP_ARC_TIMER_STARTING,
-                               "AP_ARC_TIMER_STARTING",
+                               "clockevents/arc/timer:starting",
                                arc_timer_starting_cpu,
                                arc_timer_dying_cpu);
        if (ret) {
index 02fef6830e728d0adfad52920034c722273dfe61..4c8c3fb2e8b248b3335d1c4f582f7faab1121d37 100644 (file)
@@ -562,12 +562,12 @@ static u64 arch_counter_get_cntvct_mem(void)
  */
 u64 (*arch_timer_read_counter)(void) = arch_counter_get_cntvct;
 
-static cycle_t arch_counter_read(struct clocksource *cs)
+static u64 arch_counter_read(struct clocksource *cs)
 {
        return arch_timer_read_counter();
 }
 
-static cycle_t arch_counter_read_cc(const struct cyclecounter *cc)
+static u64 arch_counter_read_cc(const struct cyclecounter *cc)
 {
        return arch_timer_read_counter();
 }
@@ -738,7 +738,7 @@ static int __init arch_timer_register(void)
 
        /* Register and immediately configure the timer on the boot CPU */
        err = cpuhp_setup_state(CPUHP_AP_ARM_ARCH_TIMER_STARTING,
-                               "AP_ARM_ARCH_TIMER_STARTING",
+                               "clockevents/arm/arch_timer:starting",
                                arch_timer_starting_cpu, arch_timer_dying_cpu);
        if (err)
                goto out_unreg_cpupm;
index 8da03298f844f386b81c08f3bc12228fcab340ab..123ed20ac2ffd406a4e9225ae0a23909066a2f1b 100644 (file)
@@ -195,7 +195,7 @@ static int gt_dying_cpu(unsigned int cpu)
        return 0;
 }
 
-static cycle_t gt_clocksource_read(struct clocksource *cs)
+static u64 gt_clocksource_read(struct clocksource *cs)
 {
        return gt_counter_read();
 }
@@ -316,7 +316,7 @@ static int __init global_timer_of_register(struct device_node *np)
                goto out_irq;
        
        err = cpuhp_setup_state(CPUHP_AP_ARM_GLOBAL_TIMER_STARTING,
-                               "AP_ARM_GLOBAL_TIMER_STARTING",
+                               "clockevents/arm/global_timer:starting",
                                gt_starting_cpu, gt_dying_cpu);
        if (err)
                goto out_irq;
index fbfbdec13b081837e3866ee06f8a9c231cce990c..44e5e951583bc38fc8c4a6a9b89ea91f7587af34 100644 (file)
@@ -158,11 +158,11 @@ static irqreturn_t ttc_clock_event_interrupt(int irq, void *dev_id)
  *
  * returns: Current timer counter register value
  **/
-static cycle_t __ttc_clocksource_read(struct clocksource *cs)
+static u64 __ttc_clocksource_read(struct clocksource *cs)
 {
        struct ttc_timer *timer = &to_ttc_timer_clksrc(cs)->ttc;
 
-       return (cycle_t)readl_relaxed(timer->base_addr +
+       return (u64)readl_relaxed(timer->base_addr +
                                TTC_COUNT_VAL_OFFSET);
 }
 
index 77a365f573d7f19a385f06ceffb16011a9159d98..c69e2772658d9318892ce377cebff1eb4118c793 100644 (file)
@@ -30,7 +30,7 @@
 
 static void __iomem *clksrc_dbx500_timer_base;
 
-static cycle_t notrace clksrc_dbx500_prcmu_read(struct clocksource *cs)
+static u64 notrace clksrc_dbx500_prcmu_read(struct clocksource *cs)
 {
        void __iomem *base = clksrc_dbx500_timer_base;
        u32 count, count2;
index 89f1c2edbe02ee96eaf822e4bafe8139fa556062..01f3f5a59bc60306afee266ff536c85c50c45b1a 100644 (file)
@@ -34,7 +34,7 @@ static int dummy_timer_starting_cpu(unsigned int cpu)
 static int __init dummy_timer_register(void)
 {
        return cpuhp_setup_state(CPUHP_AP_DUMMY_TIMER_STARTING,
-                                "AP_DUMMY_TIMER_STARTING",
+                                "clockevents/dummy_timer:starting",
                                 dummy_timer_starting_cpu, NULL);
 }
 early_initcall(dummy_timer_register);
index 797505aa2ba41263f5f2080f9b777f383b744bfe..63e4f5519577bea8edbf6c023eef89d242ff0f34 100644 (file)
@@ -348,7 +348,7 @@ void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs)
        dw_apb_clocksource_read(dw_cs);
 }
 
-static cycle_t __apbt_read_clocksource(struct clocksource *cs)
+static u64 __apbt_read_clocksource(struct clocksource *cs)
 {
        u32 current_count;
        struct dw_apb_clocksource *dw_cs =
@@ -357,7 +357,7 @@ static cycle_t __apbt_read_clocksource(struct clocksource *cs)
        current_count = apbt_readl_relaxed(&dw_cs->timer,
                                        APBTMR_N_CURRENT_VALUE);
 
-       return (cycle_t)~current_count;
+       return (u64)~current_count;
 }
 
 static void apbt_restart_clocksource(struct clocksource *cs)
@@ -416,7 +416,7 @@ void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs)
  *
  * @dw_cs:     The clocksource to read.
  */
-cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs)
+u64 dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs)
 {
-       return (cycle_t)~apbt_readl(&dw_cs->timer, APBTMR_N_CURRENT_VALUE);
+       return (u64)~apbt_readl(&dw_cs->timer, APBTMR_N_CURRENT_VALUE);
 }
index 19bb1792d647dc8cca312248b5f2c7eef86099dd..aff87df07449d62d0fc0b401f4038463b18ab326 100644 (file)
@@ -110,9 +110,9 @@ static void em_sti_disable(struct em_sti_priv *p)
        clk_disable_unprepare(p->clk);
 }
 
-static cycle_t em_sti_count(struct em_sti_priv *p)
+static u64 em_sti_count(struct em_sti_priv *p)
 {
-       cycle_t ticks;
+       u64 ticks;
        unsigned long flags;
 
        /* the STI hardware buffers the 48-bit count, but to
@@ -121,14 +121,14 @@ static cycle_t em_sti_count(struct em_sti_priv *p)
         * Always read STI_COUNT_H before STI_COUNT_L.
         */
        raw_spin_lock_irqsave(&p->lock, flags);
-       ticks = (cycle_t)(em_sti_read(p, STI_COUNT_H) & 0xffff) << 32;
+       ticks = (u64)(em_sti_read(p, STI_COUNT_H) & 0xffff) << 32;
        ticks |= em_sti_read(p, STI_COUNT_L);
        raw_spin_unlock_irqrestore(&p->lock, flags);
 
        return ticks;
 }
 
-static cycle_t em_sti_set_next(struct em_sti_priv *p, cycle_t next)
+static u64 em_sti_set_next(struct em_sti_priv *p, u64 next)
 {
        unsigned long flags;
 
@@ -198,7 +198,7 @@ static struct em_sti_priv *cs_to_em_sti(struct clocksource *cs)
        return container_of(cs, struct em_sti_priv, cs);
 }
 
-static cycle_t em_sti_clocksource_read(struct clocksource *cs)
+static u64 em_sti_clocksource_read(struct clocksource *cs)
 {
        return em_sti_count(cs_to_em_sti(cs));
 }
@@ -271,7 +271,7 @@ static int em_sti_clock_event_next(unsigned long delta,
                                   struct clock_event_device *ced)
 {
        struct em_sti_priv *p = ced_to_em_sti(ced);
-       cycle_t next;
+       u64 next;
        int safe;
 
        next = em_sti_set_next(p, em_sti_count(p) + delta);
index 8f3488b808964b1884eaf18d602fe2ae9b4921c2..4da1dc2278bd7fc34caa9e00d29f71ec1ebd015f 100644 (file)
@@ -183,7 +183,7 @@ static u64 exynos4_read_count_64(void)
                hi2 = readl_relaxed(reg_base + EXYNOS4_MCT_G_CNT_U);
        } while (hi != hi2);
 
-       return ((cycle_t)hi << 32) | lo;
+       return ((u64)hi << 32) | lo;
 }
 
 /**
@@ -199,7 +199,7 @@ static u32 notrace exynos4_read_count_32(void)
        return readl_relaxed(reg_base + EXYNOS4_MCT_G_CNT_L);
 }
 
-static cycle_t exynos4_frc_read(struct clocksource *cs)
+static u64 exynos4_frc_read(struct clocksource *cs)
 {
        return exynos4_read_count_32();
 }
@@ -266,7 +266,7 @@ static void exynos4_mct_comp0_stop(void)
 static void exynos4_mct_comp0_start(bool periodic, unsigned long cycles)
 {
        unsigned int tcon;
-       cycle_t comp_cycle;
+       u64 comp_cycle;
 
        tcon = readl_relaxed(reg_base + EXYNOS4_MCT_G_TCON);
 
@@ -552,7 +552,7 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem *
 
        /* Install hotplug callbacks which configure the timer on this CPU */
        err = cpuhp_setup_state(CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING,
-                               "AP_EXYNOS4_MCT_TIMER_STARTING",
+                               "clockevents/exynos4/mct_timer:starting",
                                exynos4_mct_starting_cpu,
                                exynos4_mct_dying_cpu);
        if (err)
index 07d9d5be9054a6e46aeef0a933e0344b1dcf84dc..5b27fb9997c22083cf602811d86864cd7e7cdb0e 100644 (file)
@@ -72,7 +72,7 @@ static inline struct timer16_priv *cs_to_priv(struct clocksource *cs)
        return container_of(cs, struct timer16_priv, cs);
 }
 
-static cycle_t timer16_clocksource_read(struct clocksource *cs)
+static u64 timer16_clocksource_read(struct clocksource *cs)
 {
        struct timer16_priv *p = cs_to_priv(cs);
        unsigned long raw, value;
index 7bdf1991c847448525c3dc9d6fddf4e758361375..72e1cf2b30962ee09bd04b3c4fbaaa5654c3f39b 100644 (file)
@@ -64,7 +64,7 @@ static inline struct tpu_priv *cs_to_priv(struct clocksource *cs)
        return container_of(cs, struct tpu_priv, cs);
 }
 
-static cycle_t tpu_clocksource_read(struct clocksource *cs)
+static u64 tpu_clocksource_read(struct clocksource *cs)
 {
        struct tpu_priv *p = cs_to_priv(cs);
        unsigned long flags;
index 0efd36e483ab416bf01c34e8250afc78faca035a..64f6490740d78b19b58f31178554630542685fc4 100644 (file)
@@ -25,7 +25,7 @@ EXPORT_SYMBOL(i8253_lock);
  * to just read by itself. So use jiffies to emulate a free
  * running counter:
  */
-static cycle_t i8253_read(struct clocksource *cs)
+static u64 i8253_read(struct clocksource *cs)
 {
        static int old_count;
        static u32 old_jifs;
@@ -83,7 +83,7 @@ static cycle_t i8253_read(struct clocksource *cs)
 
        count = (PIT_LATCH - 1) - count;
 
-       return (cycle_t)(jifs * PIT_LATCH) + count;
+       return (u64)(jifs * PIT_LATCH) + count;
 }
 
 static struct clocksource i8253_cs = {
index 54e1665aa03c26c20b5e6236e1d3aac4be6871f3..7c61226f435918ca3a66d64a4c9f195ae8129994 100644 (file)
@@ -57,7 +57,7 @@ static notrace u64 jcore_sched_clock_read(void)
        return seclo * NSEC_PER_SEC + nsec;
 }
 
-static cycle_t jcore_clocksource_read(struct clocksource *cs)
+static u64 jcore_clocksource_read(struct clocksource *cs)
 {
        return jcore_sched_clock_read();
 }
@@ -240,7 +240,7 @@ static int __init jcore_pit_init(struct device_node *node)
        }
 
        cpuhp_setup_state(CPUHP_AP_JCORE_TIMER_STARTING,
-                         "AP_JCORE_TIMER_STARTING",
+                         "clockevents/jcore:starting",
                          jcore_pit_local_init, NULL);
 
        return 0;
index a80ab3e446b7111476a007f975930572f7afe537..6fcf96540631d2d9a53a1f64978e99d4cc2f26ab 100644 (file)
@@ -56,7 +56,7 @@ static int metag_timer_set_next_event(unsigned long delta,
        return 0;
 }
 
-static cycle_t metag_clocksource_read(struct clocksource *cs)
+static u64 metag_clocksource_read(struct clocksource *cs)
 {
        return __core_reg_get(TXTIMER);
 }
@@ -154,6 +154,6 @@ int __init metag_generic_timer_init(void)
 
        /* Hook cpu boot to configure the CPU's timers */
        return cpuhp_setup_state(CPUHP_AP_METAG_TIMER_STARTING,
-                                "AP_METAG_TIMER_STARTING",
+                                "clockevents/metag:starting",
                                 arch_timer_starting_cpu, NULL);
 }
index 7a960cd0110494a0c5b885fd6e89b81f3fec9c9c..d9ef7a61e093964485e2f078c733a299b33cc409 100644 (file)
@@ -120,12 +120,12 @@ static int gic_clockevent_init(void)
        }
 
        cpuhp_setup_state(CPUHP_AP_MIPS_GIC_TIMER_STARTING,
-                         "AP_MIPS_GIC_TIMER_STARTING", gic_starting_cpu,
-                         gic_dying_cpu);
+                         "clockevents/mips/gic/timer:starting",
+                         gic_starting_cpu, gic_dying_cpu);
        return 0;
 }
 
-static cycle_t gic_hpt_read(struct clocksource *cs)
+static u64 gic_hpt_read(struct clocksource *cs)
 {
        return gic_read_count();
 }
index c4f7d7a9b68987e861bb52ea807f919ca785a1c9..4c4df981d8ccc9fbe6a05f1de56dea642089f24a 100644 (file)
@@ -20,24 +20,24 @@ static inline struct clocksource_mmio *to_mmio_clksrc(struct clocksource *c)
        return container_of(c, struct clocksource_mmio, clksrc);
 }
 
-cycle_t clocksource_mmio_readl_up(struct clocksource *c)
+u64 clocksource_mmio_readl_up(struct clocksource *c)
 {
-       return (cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg);
+       return (u64)readl_relaxed(to_mmio_clksrc(c)->reg);
 }
 
-cycle_t clocksource_mmio_readl_down(struct clocksource *c)
+u64 clocksource_mmio_readl_down(struct clocksource *c)
 {
-       return ~(cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
+       return ~(u64)readl_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
 }
 
-cycle_t clocksource_mmio_readw_up(struct clocksource *c)
+u64 clocksource_mmio_readw_up(struct clocksource *c)
 {
-       return (cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg);
+       return (u64)readw_relaxed(to_mmio_clksrc(c)->reg);
 }
 
-cycle_t clocksource_mmio_readw_down(struct clocksource *c)
+u64 clocksource_mmio_readw_down(struct clocksource *c)
 {
-       return ~(cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
+       return ~(u64)readw_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
 }
 
 /**
@@ -51,7 +51,7 @@ cycle_t clocksource_mmio_readw_down(struct clocksource *c)
  */
 int __init clocksource_mmio_init(void __iomem *base, const char *name,
        unsigned long hz, int rating, unsigned bits,
-       cycle_t (*read)(struct clocksource *))
+       u64 (*read)(struct clocksource *))
 {
        struct clocksource_mmio *cs;
 
index 2a8f4705c734df7c2cc99f8a532a55cc0cbbe231..7f3430654fbd97972c8d4d74bc70644adcb6ce17 100644 (file)
@@ -161,19 +161,22 @@ static int __init moxart_timer_init(struct device_node *node)
        timer->base = of_iomap(node, 0);
        if (!timer->base) {
                pr_err("%s: of_iomap failed\n", node->full_name);
-               return -ENXIO;
+               ret = -ENXIO;
+               goto out_free;
        }
 
        irq = irq_of_parse_and_map(node, 0);
        if (irq <= 0) {
                pr_err("%s: irq_of_parse_and_map failed\n", node->full_name);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto out_unmap;
        }
 
        clk = of_clk_get(node, 0);
        if (IS_ERR(clk))  {
                pr_err("%s: of_clk_get failed\n", node->full_name);
-               return PTR_ERR(clk);
+               ret = PTR_ERR(clk);
+               goto out_unmap;
        }
 
        pclk = clk_get_rate(clk);
@@ -186,7 +189,8 @@ static int __init moxart_timer_init(struct device_node *node)
                timer->t1_disable_val = ASPEED_TIMER1_DISABLE;
        } else {
                pr_err("%s: unknown platform\n", node->full_name);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto out_unmap;
        }
 
        timer->count_per_tick = DIV_ROUND_CLOSEST(pclk, HZ);
@@ -208,14 +212,14 @@ static int __init moxart_timer_init(struct device_node *node)
                                    clocksource_mmio_readl_down);
        if (ret) {
                pr_err("%s: clocksource_mmio_init failed\n", node->full_name);
-               return ret;
+               goto out_unmap;
        }
 
        ret = request_irq(irq, moxart_timer_interrupt, IRQF_TIMER,
                          node->name, &timer->clkevt);
        if (ret) {
                pr_err("%s: setup_irq failed\n", node->full_name);
-               return ret;
+               goto out_unmap;
        }
 
        /* Clear match registers */
@@ -241,6 +245,12 @@ static int __init moxart_timer_init(struct device_node *node)
        clockevents_config_and_register(&timer->clkevt, pclk, 0x4, 0xfffffffe);
 
        return 0;
+
+out_unmap:
+       iounmap(timer->base);
+out_free:
+       kfree(timer);
+       return ret;
 }
 CLOCKSOURCE_OF_DECLARE(moxart, "moxa,moxart-timer", moxart_timer_init);
 CLOCKSOURCE_OF_DECLARE(aspeed, "aspeed,ast2400-timer", moxart_timer_init);
index 0ba0a913b41d113e7459b6dc21e07e00bb0d0648..99b77aff08395e887e824cf28cd373ce3a1e1560 100644 (file)
@@ -97,7 +97,7 @@ static void timrot_irq_acknowledge(void)
                     HW_TIMROT_TIMCTRLn(0) + STMP_OFFSET_REG_CLR);
 }
 
-static cycle_t timrotv1_get_cycles(struct clocksource *cs)
+static u64 timrotv1_get_cycles(struct clocksource *cs)
 {
        return ~((__raw_readl(mxs_timrot_base + HW_TIMROT_TIMCOUNTn(1))
                        & 0xffff0000) >> 16);
index 3283cfa2aa526dd9292fde87529d4b794458e97b..ee358cdf4a07b37e1952728fc22e21e2834d4864 100644 (file)
@@ -89,7 +89,7 @@ static struct clock_event_device __percpu *msm_evt;
 
 static void __iomem *source_base;
 
-static notrace cycle_t msm_read_timer_count(struct clocksource *cs)
+static notrace u64 msm_read_timer_count(struct clocksource *cs)
 {
        return readl_relaxed(source_base + TIMER_COUNT_VAL);
 }
@@ -182,7 +182,7 @@ static int __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq,
        } else {
                /* Install and invoke hotplug callbacks */
                res = cpuhp_setup_state(CPUHP_AP_QCOM_TIMER_STARTING,
-                                       "AP_QCOM_TIMER_STARTING",
+                                       "clockevents/qcom/timer:starting",
                                        msm_local_timer_starting_cpu,
                                        msm_local_timer_dying_cpu);
                if (res) {
index 54565bd0093bfc02673d6f27841315c589b8ad70..0093ece661fe613a1bb325b7df56ce48f246793e 100644 (file)
@@ -307,7 +307,7 @@ static void samsung_clocksource_resume(struct clocksource *cs)
        samsung_time_start(pwm.source_id, true);
 }
 
-static cycle_t notrace samsung_clocksource_read(struct clocksource *c)
+static u64 notrace samsung_clocksource_read(struct clocksource *c)
 {
        return ~readl_relaxed(pwm.source_reg);
 }
index 64f9e829443405e86bfdf154db3bceb53791d766..a46660bf65888d36d16ad6635b790ddd46789250 100644 (file)
@@ -43,10 +43,10 @@ MODULE_PARM_DESC(ppm, "+-adjust to actual XO freq (ppm)");
 /* The base timer frequency, * 27 if selected */
 #define HRT_FREQ   1000000
 
-static cycle_t read_hrt(struct clocksource *cs)
+static u64 read_hrt(struct clocksource *cs)
 {
        /* Read the timer value */
-       return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET);
+       return (u64) inl(scx200_cb_base + SCx200_TIMER_OFFSET);
 }
 
 static struct clocksource cs_hrt = {
index 103c49362c68f66f830587a6504e33ad428a1c14..28757edf6aca8ae8943bb01a02e4008b44efd6f1 100644 (file)
@@ -612,7 +612,7 @@ static struct sh_cmt_channel *cs_to_sh_cmt(struct clocksource *cs)
        return container_of(cs, struct sh_cmt_channel, cs);
 }
 
-static cycle_t sh_cmt_clocksource_read(struct clocksource *cs)
+static u64 sh_cmt_clocksource_read(struct clocksource *cs)
 {
        struct sh_cmt_channel *ch = cs_to_sh_cmt(cs);
        unsigned long flags, raw;
index 469e776ec17a5a2cf4528cc41c58d5542b9a0d53..1fbf2aadcfd41875751c57b73024ca541a430852 100644 (file)
@@ -255,7 +255,7 @@ static struct sh_tmu_channel *cs_to_sh_tmu(struct clocksource *cs)
        return container_of(cs, struct sh_tmu_channel, cs);
 }
 
-static cycle_t sh_tmu_clocksource_read(struct clocksource *cs)
+static u64 sh_tmu_clocksource_read(struct clocksource *cs)
 {
        struct sh_tmu_channel *ch = cs_to_sh_tmu(cs);
 
index 4da2af9694a23b267cebdfa52da624e9f43b61fe..d4ca9962a7595a0206710a0dd4a95656f426ae8e 100644 (file)
@@ -41,7 +41,7 @@
 
 static void __iomem *tcaddr;
 
-static cycle_t tc_get_cycles(struct clocksource *cs)
+static u64 tc_get_cycles(struct clocksource *cs)
 {
        unsigned long   flags;
        u32             lower, upper;
@@ -56,7 +56,7 @@ static cycle_t tc_get_cycles(struct clocksource *cs)
        return (upper << 16) | lower;
 }
 
-static cycle_t tc_get_cycles32(struct clocksource *cs)
+static u64 tc_get_cycles32(struct clocksource *cs)
 {
        return __raw_readl(tcaddr + ATMEL_TC_REG(0, CV));
 }
index 3c39e6f459714e5b725cfdd10663fb04dd62063b..4440aefc59cdefd9c5b859952a59724d3c37cbf6 100644 (file)
@@ -320,7 +320,7 @@ static int __init armada_370_xp_timer_common_init(struct device_node *np)
        }
 
        res = cpuhp_setup_state(CPUHP_AP_ARMADA_TIMER_STARTING,
-                               "AP_ARMADA_TIMER_STARTING",
+                               "clockevents/armada:starting",
                                armada_370_xp_timer_starting_cpu,
                                armada_370_xp_timer_dying_cpu);
        if (res) {
index a8e6c7df853d2c64914c04af5785f61a51d56880..3710e4d9dcba065117e9b435e0f7428dea0d1f23 100644 (file)
@@ -67,7 +67,7 @@ static inline void gpt_writel(void __iomem *base, u32 value, u32 offset,
        writel(value, base + 0x20 * gpt_id + offset);
 }
 
-static cycle_t notrace
+static u64 notrace
 pistachio_clocksource_read_cycles(struct clocksource *cs)
 {
        struct pistachio_clocksource *pcs = to_pistachio_clocksource(cs);
@@ -84,7 +84,7 @@ pistachio_clocksource_read_cycles(struct clocksource *cs)
        counter = gpt_readl(pcs->base, TIMER_CURRENT_VALUE, 0);
        raw_spin_unlock_irqrestore(&pcs->lock, flags);
 
-       return (cycle_t)~counter;
+       return (u64)~counter;
 }
 
 static u64 notrace pistachio_read_sched_clock(void)
index 4334e0330ada48729cd63a7033eacc45fc84c8f1..3d8a181f02528346c5d99053cdd87ad6b6569e34 100644 (file)
@@ -85,7 +85,7 @@ static irqreturn_t sirfsoc_timer_interrupt(int irq, void *dev_id)
 }
 
 /* read 64-bit timer counter */
-static cycle_t sirfsoc_timer_read(struct clocksource *cs)
+static u64 sirfsoc_timer_read(struct clocksource *cs)
 {
        u64 cycles;
 
@@ -221,7 +221,7 @@ static int __init sirfsoc_clockevent_init(void)
 
        /* Install and invoke hotplug callbacks */
        return cpuhp_setup_state(CPUHP_AP_MARCO_TIMER_STARTING,
-                                "AP_MARCO_TIMER_STARTING",
+                                "clockevents/marco:starting",
                                 sirfsoc_local_timer_starting_cpu,
                                 sirfsoc_local_timer_dying_cpu);
 }
index 6555821bbdaec2c9f833bdd59dadf0498483dcab..c0b5df3167a0357cfd8f2df315a97426159acbfc 100644 (file)
@@ -73,7 +73,7 @@ static inline void pit_write(void __iomem *base, unsigned int reg_offset, unsign
  * Clocksource:  just a monotonic counter of MCK/16 cycles.
  * We don't care whether or not PIT irqs are enabled.
  */
-static cycle_t read_pit_clk(struct clocksource *cs)
+static u64 read_pit_clk(struct clocksource *cs)
 {
        struct pit_data *data = clksrc_to_pit_data(cs);
        unsigned long flags;
index e90ab5b63a9068ec3901b85cab9b230db67a837c..be4ac76041364fec5d7a5597dd52a286a2cccef3 100644 (file)
@@ -92,7 +92,7 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
        return IRQ_NONE;
 }
 
-static cycle_t read_clk32k(struct clocksource *cs)
+static u64 read_clk32k(struct clocksource *cs)
 {
        return read_CRTR();
 }
index 8da5e93b681041f6e1a26585f614b7c6b3b71a5c..da1f7986e477eb18a2a7cd8bef365cc72d07808c 100644 (file)
@@ -77,11 +77,11 @@ static int __init nps_get_timer_clk(struct device_node *node,
        return 0;
 }
 
-static cycle_t nps_clksrc_read(struct clocksource *clksrc)
+static u64 nps_clksrc_read(struct clocksource *clksrc)
 {
        int cluster = raw_smp_processor_id() >> NPS_CLUSTER_OFFSET;
 
-       return (cycle_t)ioread32be(nps_msu_reg_low_addr[cluster]);
+       return (u64)ioread32be(nps_msu_reg_low_addr[cluster]);
 }
 
 static int __init nps_setup_clocksource(struct device_node *node)
index c32148ec7a384dc58921c40515786491033ff5e8..bfa981ac1eaf5908c14614d40e714634e867c4b8 100644 (file)
@@ -72,7 +72,7 @@ static irqreturn_t sirfsoc_timer_interrupt(int irq, void *dev_id)
 }
 
 /* read 64-bit timer counter */
-static cycle_t notrace sirfsoc_timer_read(struct clocksource *cs)
+static u64 notrace sirfsoc_timer_read(struct clocksource *cs)
 {
        u64 cycles;
 
index 4f87f3e76d8328ec6ca462882f873a51b2f72995..a3e662b15964ef9be3669884f45b739a828edf47 100644 (file)
@@ -152,7 +152,7 @@ static irqreturn_t sun5i_timer_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static cycle_t sun5i_clksrc_read(struct clocksource *clksrc)
+static u64 sun5i_clksrc_read(struct clocksource *clksrc)
 {
        struct sun5i_timer_clksrc *cs = to_sun5i_timer_clksrc(clksrc);
 
index cf5b14e442e43beac3a799a679cd863ca1a314fe..624067712ef0383b8805b39d164f33c42014a044 100644 (file)
@@ -65,11 +65,11 @@ static inline struct ti_32k *to_ti_32k(struct clocksource *cs)
        return container_of(cs, struct ti_32k, cs);
 }
 
-static cycle_t notrace ti_32k_read_cycles(struct clocksource *cs)
+static u64 notrace ti_32k_read_cycles(struct clocksource *cs)
 {
        struct ti_32k *ti = to_ti_32k(cs);
 
-       return (cycle_t)readl_relaxed(ti->counter);
+       return (u64)readl_relaxed(ti->counter);
 }
 
 static struct ti_32k ti_32k_timer = {
index b15069483fbde1b655fa0932b10a6d6be4fa3d44..d02b51075ad1d2bf1c0cf87bb0bf4eb3da960af4 100644 (file)
@@ -53,7 +53,7 @@
 
 static void __iomem *regbase;
 
-static cycle_t vt8500_timer_read(struct clocksource *cs)
+static u64 vt8500_timer_read(struct clocksource *cs)
 {
        int loops = msecs_to_loops(10);
        writel(3, regbase + TIMER_CTRL_VAL);
@@ -75,7 +75,7 @@ static int vt8500_timer_set_next_event(unsigned long cycles,
                                    struct clock_event_device *evt)
 {
        int loops = msecs_to_loops(10);
-       cycle_t alarm = clocksource.read(&clocksource) + cycles;
+       u64 alarm = clocksource.read(&clocksource) + cycles;
        while ((readl(regbase + TIMER_AS_VAL) & TIMER_MATCH_W_ACTIVE)
                                                && --loops)
                cpu_relax();
index bc97b6a4b1cf67a4897a412ff785e1350b4ee0ce..7fcaf26e8f819b7665f6e9bf83c07a1b705b1d65 100644 (file)
@@ -26,6 +26,8 @@ static const struct of_device_id machines[] __initconst = {
        { .compatible = "allwinner,sun8i-a83t", },
        { .compatible = "allwinner,sun8i-h3", },
 
+       { .compatible = "apm,xgene-shadowcat", },
+
        { .compatible = "arm,integrator-ap", },
        { .compatible = "arm,integrator-cp", },
 
index 759612da4fdcee8fa61a938d6d0c6ddfa5c0dfb1..e28a31a40829b8451a69c61597fdbfa615af9173 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pal.h>
 
 #include <linux/acpi.h>
index 6acbd4af632e2bdab99f984cd0b311e5f7a32e29..f91c25718d164c9d9339acf671d67937995fe076 100644 (file)
@@ -857,13 +857,13 @@ static struct freq_attr *hwp_cpufreq_attrs[] = {
        NULL,
 };
 
-static void intel_pstate_hwp_set(const struct cpumask *cpumask)
+static void intel_pstate_hwp_set(struct cpufreq_policy *policy)
 {
        int min, hw_min, max, hw_max, cpu, range, adj_range;
        struct perf_limits *perf_limits = limits;
        u64 value, cap;
 
-       for_each_cpu(cpu, cpumask) {
+       for_each_cpu(cpu, policy->cpus) {
                int max_perf_pct, min_perf_pct;
                struct cpudata *cpu_data = all_cpu_data[cpu];
                s16 epp;
@@ -949,7 +949,7 @@ skip_epp:
 static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy)
 {
        if (hwp_active)
-               intel_pstate_hwp_set(policy->cpus);
+               intel_pstate_hwp_set(policy);
 
        return 0;
 }
@@ -968,19 +968,28 @@ static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy)
 
 static int intel_pstate_resume(struct cpufreq_policy *policy)
 {
+       int ret;
+
        if (!hwp_active)
                return 0;
 
+       mutex_lock(&intel_pstate_limits_lock);
+
        all_cpu_data[policy->cpu]->epp_policy = 0;
 
-       return intel_pstate_hwp_set_policy(policy);
+       ret = intel_pstate_hwp_set_policy(policy);
+
+       mutex_unlock(&intel_pstate_limits_lock);
+
+       return ret;
 }
 
-static void intel_pstate_hwp_set_online_cpus(void)
+static void intel_pstate_update_policies(void)
 {
-       get_online_cpus();
-       intel_pstate_hwp_set(cpu_online_mask);
-       put_online_cpus();
+       int cpu;
+
+       for_each_possible_cpu(cpu)
+               cpufreq_update_policy(cpu);
 }
 
 /************************** debugfs begin ************************/
@@ -1018,10 +1027,6 @@ static void __init intel_pstate_debug_expose_params(void)
        struct dentry *debugfs_parent;
        int i = 0;
 
-       if (hwp_active ||
-           pstate_funcs.get_target_pstate == get_target_pstate_use_cpu_load)
-               return;
-
        debugfs_parent = debugfs_create_dir("pstate_snb", NULL);
        if (IS_ERR_OR_NULL(debugfs_parent))
                return;
@@ -1105,11 +1110,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b,
 
        limits->no_turbo = clamp_t(int, input, 0, 1);
 
-       if (hwp_active)
-               intel_pstate_hwp_set_online_cpus();
-
        mutex_unlock(&intel_pstate_limits_lock);
 
+       intel_pstate_update_policies();
+
        return count;
 }
 
@@ -1134,11 +1138,10 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
                                   limits->max_perf_pct);
        limits->max_perf = div_ext_fp(limits->max_perf_pct, 100);
 
-       if (hwp_active)
-               intel_pstate_hwp_set_online_cpus();
-
        mutex_unlock(&intel_pstate_limits_lock);
 
+       intel_pstate_update_policies();
+
        return count;
 }
 
@@ -1163,11 +1166,10 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
                                   limits->min_perf_pct);
        limits->min_perf = div_ext_fp(limits->min_perf_pct, 100);
 
-       if (hwp_active)
-               intel_pstate_hwp_set_online_cpus();
-
        mutex_unlock(&intel_pstate_limits_lock);
 
+       intel_pstate_update_policies();
+
        return count;
 }
 
@@ -2153,8 +2155,12 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy)
        if (per_cpu_limits)
                perf_limits = cpu->perf_limits;
 
+       mutex_lock(&intel_pstate_limits_lock);
+
        intel_pstate_update_perf_limits(policy, perf_limits);
 
+       mutex_unlock(&intel_pstate_limits_lock);
+
        return 0;
 }
 
@@ -2487,7 +2493,10 @@ hwp_cpu_matched:
        if (rc)
                goto out;
 
-       intel_pstate_debug_expose_params();
+       if (intel_pstate_driver == &intel_pstate && !hwp_active &&
+           pstate_funcs.get_target_pstate != get_target_pstate_use_cpu_load)
+               intel_pstate_debug_expose_params();
+
        intel_pstate_sysfs_expose_params();
 
        if (hwp_active)
index fe8f08948fcb1d0343024df86268b86893616252..ac321f09e717b7c1141ef7b66b3952e0521fe800 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/tick.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define PROMOTION_COUNT 4
 #define DEMOTION_COUNT 1
index a768da7138a1cd4a0a79771ad99b2f5436f481c3..b7872f62f67475fdc6889420c38de4f8418ffafd 100644 (file)
@@ -273,7 +273,8 @@ struct mv_cesa_op_ctx {
 #define CESA_TDMA_SRC_IN_SRAM                  BIT(30)
 #define CESA_TDMA_END_OF_REQ                   BIT(29)
 #define CESA_TDMA_BREAK_CHAIN                  BIT(28)
-#define CESA_TDMA_TYPE_MSK                     GENMASK(27, 0)
+#define CESA_TDMA_SET_STATE                    BIT(27)
+#define CESA_TDMA_TYPE_MSK                     GENMASK(26, 0)
 #define CESA_TDMA_DUMMY                                0
 #define CESA_TDMA_DATA                         1
 #define CESA_TDMA_OP                           2
index 317cf029c0cf1beab3f2b5f0ab41cf187626e24b..77c0fb936f4794363f478b7bc0b8d23dd10d880f 100644 (file)
@@ -280,13 +280,32 @@ static void mv_cesa_ahash_std_prepare(struct ahash_request *req)
        sreq->offset = 0;
 }
 
+static void mv_cesa_ahash_dma_step(struct ahash_request *req)
+{
+       struct mv_cesa_ahash_req *creq = ahash_request_ctx(req);
+       struct mv_cesa_req *base = &creq->base;
+
+       /* We must explicitly set the digest state. */
+       if (base->chain.first->flags & CESA_TDMA_SET_STATE) {
+               struct mv_cesa_engine *engine = base->engine;
+               int i;
+
+               /* Set the hash state in the IVDIG regs. */
+               for (i = 0; i < ARRAY_SIZE(creq->state); i++)
+                       writel_relaxed(creq->state[i], engine->regs +
+                                      CESA_IVDIG(i));
+       }
+
+       mv_cesa_dma_step(base);
+}
+
 static void mv_cesa_ahash_step(struct crypto_async_request *req)
 {
        struct ahash_request *ahashreq = ahash_request_cast(req);
        struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq);
 
        if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ)
-               mv_cesa_dma_step(&creq->base);
+               mv_cesa_ahash_dma_step(ahashreq);
        else
                mv_cesa_ahash_std_step(ahashreq);
 }
@@ -584,12 +603,16 @@ static int mv_cesa_ahash_dma_req_init(struct ahash_request *req)
        struct mv_cesa_ahash_dma_iter iter;
        struct mv_cesa_op_ctx *op = NULL;
        unsigned int frag_len;
+       bool set_state = false;
        int ret;
        u32 type;
 
        basereq->chain.first = NULL;
        basereq->chain.last = NULL;
 
+       if (!mv_cesa_mac_op_is_first_frag(&creq->op_tmpl))
+               set_state = true;
+
        if (creq->src_nents) {
                ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents,
                                 DMA_TO_DEVICE);
@@ -683,6 +706,15 @@ static int mv_cesa_ahash_dma_req_init(struct ahash_request *req)
        if (type != CESA_TDMA_RESULT)
                basereq->chain.last->flags |= CESA_TDMA_BREAK_CHAIN;
 
+       if (set_state) {
+               /*
+                * Put the CESA_TDMA_SET_STATE flag on the first tdma desc to
+                * let the step logic know that the IVDIG registers should be
+                * explicitly set before launching a TDMA chain.
+                */
+               basereq->chain.first->flags |= CESA_TDMA_SET_STATE;
+       }
+
        return 0;
 
 err_free_tdma:
index 4416b88eca708aff6aadbff76ec04d95f6b40dbb..c76375ff376d39e5dc2e74463a310231b58f4c86 100644 (file)
@@ -109,7 +109,14 @@ void mv_cesa_tdma_chain(struct mv_cesa_engine *engine,
                last->next = dreq->chain.first;
                engine->chain.last = dreq->chain.last;
 
-               if (!(last->flags & CESA_TDMA_BREAK_CHAIN))
+               /*
+                * Break the DMA chain if the CESA_TDMA_BREAK_CHAIN is set on
+                * the last element of the current chain, or if the request
+                * being queued needs the IV regs to be set before lauching
+                * the request.
+                */
+               if (!(last->flags & CESA_TDMA_BREAK_CHAIN) &&
+                   !(dreq->chain.first->flags & CESA_TDMA_SET_STATE))
                        last->next_dma = dreq->chain.first->cur_dma;
        }
 }
index a324801d6a664cd707d70d673611cade4d43bd9d..47206a21bb901f424c4e331c9db6eaedef69d93d 100644 (file)
@@ -593,11 +593,16 @@ struct devfreq *devfreq_add_device(struct device *dev,
        list_add(&devfreq->node, &devfreq_list);
 
        governor = find_devfreq_governor(devfreq->governor_name);
-       if (!IS_ERR(governor))
-               devfreq->governor = governor;
-       if (devfreq->governor)
-               err = devfreq->governor->event_handler(devfreq,
-                                       DEVFREQ_GOV_START, NULL);
+       if (IS_ERR(governor)) {
+               dev_err(dev, "%s: Unable to find governor for the device\n",
+                       __func__);
+               err = PTR_ERR(governor);
+               goto err_init;
+       }
+
+       devfreq->governor = governor;
+       err = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_START,
+                                               NULL);
        if (err) {
                dev_err(dev, "%s: Unable to start governor for the device\n",
                        __func__);
index a8ed7792ece2f199adaedd588b86375c49da6f17..9af86f46fbec0fc0779e4cf211c16227b804510d 100644 (file)
@@ -497,7 +497,7 @@ passive:
        if (IS_ERR(bus->devfreq)) {
                dev_err(dev,
                        "failed to add devfreq dev with passive governor\n");
-               ret = -EPROBE_DEFER;
+               ret = PTR_ERR(bus->devfreq);
                goto err;
        }
 
index 55dd88d82d6d541bfe463b12927406ec0a57cb41..8301845291098ded839cffcc75868071070f125a 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/init.h>
 #include <linux/dio.h>
 #include <linux/slab.h>                         /* kmalloc() */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>                             /* readb() */
 
 struct dio_bus dio_bus = {
index 451f899f74e4cb0129336b333fd09b7090da965c..c9297605058c1aa68aa0fa6d90f9a0fc1a6cdc0d 100644 (file)
@@ -429,8 +429,8 @@ static int dmatest_func(void *data)
        int                     dst_cnt;
        int                     i;
        ktime_t                 ktime, start, diff;
-       ktime_t                 filltime = ktime_set(0, 0);
-       ktime_t                 comparetime = ktime_set(0, 0);
+       ktime_t                 filltime = 0;
+       ktime_t                 comparetime = 0;
        s64                     runtime = 0;
        unsigned long long      total_len = 0;
        u8                      align = 0;
index de4d5d08af9e409faca4515f7c49a9a8700e8b97..65cf2b9355c47126a5f589efc3abc207edb4b773 100644 (file)
@@ -13,7 +13,7 @@
  */
 
 #include <asm/page.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/ctype.h>
 #include <linux/highmem.h>
 #include <linux/init.h>
index 5f2c717f805388e376b5cce38653c6957279d3d7..750891ea07de1573aba2d05a31bf8775b7d5ddf7 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/ctype.h>
 #include <linux/edac.h>
 #include <linux/bitops.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include "edac_mc.h"
 #include "edac_module.h"
index 4e9d5632041adb10f2ba1ebb1feac0ea4abc24d8..48c844a72a278bc13e72e0af0674b53f3fe06e04 100644 (file)
@@ -10,7 +10,7 @@
  *
  */
 #include <asm/page.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/ctype.h>
 #include <linux/highmem.h>
 #include <linux/init.h>
index 70e13230d8db835ec201590762ea0ac5331f7ca2..9ad0b1934be9a31173ede1ed6c1c3705cc0c1e05 100644 (file)
@@ -721,11 +721,17 @@ static int scpi_sensor_get_value(u16 sensor, u64 *val)
 
        ret = scpi_send_message(CMD_SENSOR_VALUE, &id, sizeof(id),
                                &buf, sizeof(buf));
-       if (!ret)
+       if (ret)
+               return ret;
+
+       if (scpi_info->is_legacy)
+               /* only 32-bits supported, hi_val can be junk */
+               *val = le32_to_cpu(buf.lo_val);
+       else
                *val = (u64)le32_to_cpu(buf.hi_val) << 32 |
                        le32_to_cpu(buf.lo_val);
 
-       return ret;
+       return 0;
 }
 
 static int scpi_device_get_power_state(u16 dev_id)
index 44bdb78f837b4d89f2aaef6e7d0764b8c2783d87..29d58feaf67535d0efc470339de02124ed92cd44 100644 (file)
@@ -270,8 +270,7 @@ static int suspend_test_thread(void *arg)
        struct cpuidle_device *dev;
        struct cpuidle_driver *drv;
        /* No need for an actual callback, we just want to wake up the CPU. */
-       struct timer_list wakeup_timer =
-               TIMER_INITIALIZER(dummy_callback, 0, 0);
+       struct timer_list wakeup_timer;
 
        /* Wait for the main thread to give the start signal. */
        wait_for_completion(&suspend_threads_started);
@@ -287,6 +286,7 @@ static int suspend_test_thread(void *arg)
        pr_info("CPU %d entering suspend cycles, states 1 through %d\n",
                cpu, drv->state_count - 1);
 
+       setup_timer_on_stack(&wakeup_timer, dummy_callback, 0);
        for (i = 0; i < NUM_SUSPEND_CYCLE; ++i) {
                int index;
                /*
index e4a5a5ac0ff3042075e3bf8600a93016f008f662..762f8e82ceb7465f56aa8cfcd7124ce0fc28acda 100644 (file)
@@ -752,7 +752,7 @@ static enum hrtimer_restart dce_virtual_vblank_timer_handle(struct hrtimer *vbla
 
        drm_handle_vblank(ddev, amdgpu_crtc->crtc_id);
        dce_virtual_pageflip(adev, amdgpu_crtc->crtc_id);
-       hrtimer_start(vblank_timer, ktime_set(0, DCE_VIRTUAL_VBLANK_PERIOD),
+       hrtimer_start(vblank_timer, DCE_VIRTUAL_VBLANK_PERIOD,
                      HRTIMER_MODE_REL);
 
        return HRTIMER_NORESTART;
@@ -772,11 +772,11 @@ static void dce_virtual_set_crtc_vblank_interrupt_state(struct amdgpu_device *ad
                hrtimer_init(&adev->mode_info.crtcs[crtc]->vblank_timer,
                             CLOCK_MONOTONIC, HRTIMER_MODE_REL);
                hrtimer_set_expires(&adev->mode_info.crtcs[crtc]->vblank_timer,
-                                   ktime_set(0, DCE_VIRTUAL_VBLANK_PERIOD));
+                                   DCE_VIRTUAL_VBLANK_PERIOD);
                adev->mode_info.crtcs[crtc]->vblank_timer.function =
                        dce_virtual_vblank_timer_handle;
                hrtimer_start(&adev->mode_info.crtcs[crtc]->vblank_timer,
-                             ktime_set(0, DCE_VIRTUAL_VBLANK_PERIOD), HRTIMER_MODE_REL);
+                             DCE_VIRTUAL_VBLANK_PERIOD, HRTIMER_MODE_REL);
        } else if (!state && adev->mode_info.crtcs[crtc]->vsync_timer_enabled) {
                DRM_DEBUG("Disable software vsync timer\n");
                hrtimer_cancel(&adev->mode_info.crtcs[crtc]->vblank_timer);
index 583f47f27b36de20a7ec1e273ce02559aa3fdae0..34f757bcabae8d88382f18392467e67f4e0f6100 100644 (file)
@@ -1259,8 +1259,10 @@ int drm_atomic_helper_commit(struct drm_device *dev,
 
        if (!nonblock) {
                ret = drm_atomic_helper_wait_for_fences(dev, state, true);
-               if (ret)
+               if (ret) {
+                       drm_atomic_helper_cleanup_planes(dev, state);
                        return ret;
+               }
        }
 
        /*
index db516382a4d4b2ae375f41cde6cf3f8bfe5b5bb9..711c31c8d8b46c3c51e4f93a741daecf4b28ce31 100644 (file)
@@ -123,6 +123,7 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu,
        u8 changed = old ^ new;
        int ret;
 
+       memcpy(vgpu_cfg_space(vgpu) + offset, p_data, bytes);
        if (!(changed & PCI_COMMAND_MEMORY))
                return 0;
 
@@ -142,7 +143,6 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu,
                        return ret;
        }
 
-       memcpy(vgpu_cfg_space(vgpu) + offset, p_data, bytes);
        return 0;
 }
 
@@ -240,7 +240,7 @@ int intel_vgpu_emulate_cfg_write(struct intel_vgpu *vgpu, unsigned int offset,
        if (WARN_ON(bytes > 4))
                return -EINVAL;
 
-       if (WARN_ON(offset + bytes >= INTEL_GVT_MAX_CFG_SPACE_SZ))
+       if (WARN_ON(offset + bytes > INTEL_GVT_MAX_CFG_SPACE_SZ))
                return -EINVAL;
 
        /* First check if it's PCI_COMMAND */
index 7eaaf1c9ed2bf47e935bf0592a4c00658838086d..6c5fdf5b2ce2a9d407839a3a28a7e067a5630d8d 100644 (file)
@@ -1998,6 +1998,8 @@ int intel_vgpu_init_gtt(struct intel_vgpu *vgpu)
        INIT_LIST_HEAD(&gtt->oos_page_list_head);
        INIT_LIST_HEAD(&gtt->post_shadow_list_head);
 
+       intel_vgpu_reset_ggtt(vgpu);
+
        ggtt_mm = intel_vgpu_create_mm(vgpu, INTEL_GVT_MM_GGTT,
                        NULL, 1, 0);
        if (IS_ERR(ggtt_mm)) {
@@ -2206,6 +2208,7 @@ int intel_vgpu_g2v_destroy_ppgtt_mm(struct intel_vgpu *vgpu,
 int intel_gvt_init_gtt(struct intel_gvt *gvt)
 {
        int ret;
+       void *page_addr;
 
        gvt_dbg_core("init gtt\n");
 
@@ -2218,6 +2221,23 @@ int intel_gvt_init_gtt(struct intel_gvt *gvt)
                return -ENODEV;
        }
 
+       gvt->gtt.scratch_ggtt_page =
+               alloc_page(GFP_KERNEL | GFP_ATOMIC | __GFP_ZERO);
+       if (!gvt->gtt.scratch_ggtt_page) {
+               gvt_err("fail to allocate scratch ggtt page\n");
+               return -ENOMEM;
+       }
+
+       page_addr = page_address(gvt->gtt.scratch_ggtt_page);
+
+       gvt->gtt.scratch_ggtt_mfn =
+               intel_gvt_hypervisor_virt_to_mfn(page_addr);
+       if (gvt->gtt.scratch_ggtt_mfn == INTEL_GVT_INVALID_ADDR) {
+               gvt_err("fail to translate scratch ggtt page\n");
+               __free_page(gvt->gtt.scratch_ggtt_page);
+               return -EFAULT;
+       }
+
        if (enable_out_of_sync) {
                ret = setup_spt_oos(gvt);
                if (ret) {
@@ -2239,6 +2259,41 @@ int intel_gvt_init_gtt(struct intel_gvt *gvt)
  */
 void intel_gvt_clean_gtt(struct intel_gvt *gvt)
 {
+       __free_page(gvt->gtt.scratch_ggtt_page);
+
        if (enable_out_of_sync)
                clean_spt_oos(gvt);
 }
+
+/**
+ * intel_vgpu_reset_ggtt - reset the GGTT entry
+ * @vgpu: a vGPU
+ *
+ * This function is called at the vGPU create stage
+ * to reset all the GGTT entries.
+ *
+ */
+void intel_vgpu_reset_ggtt(struct intel_vgpu *vgpu)
+{
+       struct intel_gvt *gvt = vgpu->gvt;
+       struct intel_gvt_gtt_pte_ops *ops = vgpu->gvt->gtt.pte_ops;
+       u32 index;
+       u32 offset;
+       u32 num_entries;
+       struct intel_gvt_gtt_entry e;
+
+       memset(&e, 0, sizeof(struct intel_gvt_gtt_entry));
+       e.type = GTT_TYPE_GGTT_PTE;
+       ops->set_pfn(&e, gvt->gtt.scratch_ggtt_mfn);
+       e.val64 |= _PAGE_PRESENT;
+
+       index = vgpu_aperture_gmadr_base(vgpu) >> PAGE_SHIFT;
+       num_entries = vgpu_aperture_sz(vgpu) >> PAGE_SHIFT;
+       for (offset = 0; offset < num_entries; offset++)
+               ops->set_entry(NULL, &e, index + offset, false, 0, vgpu);
+
+       index = vgpu_hidden_gmadr_base(vgpu) >> PAGE_SHIFT;
+       num_entries = vgpu_hidden_sz(vgpu) >> PAGE_SHIFT;
+       for (offset = 0; offset < num_entries; offset++)
+               ops->set_entry(NULL, &e, index + offset, false, 0, vgpu);
+}
index d250013bc37b053f45b3b747668d791fa477de26..b315ab3593ec37f2e73faf564a6d6c9fee9e7c81 100644 (file)
@@ -81,6 +81,9 @@ struct intel_gvt_gtt {
        struct list_head oos_page_use_list_head;
        struct list_head oos_page_free_list_head;
        struct list_head mm_lru_list_head;
+
+       struct page *scratch_ggtt_page;
+       unsigned long scratch_ggtt_mfn;
 };
 
 enum {
@@ -202,6 +205,7 @@ struct intel_vgpu_gtt {
 
 extern int intel_vgpu_init_gtt(struct intel_vgpu *vgpu);
 extern void intel_vgpu_clean_gtt(struct intel_vgpu *vgpu);
+void intel_vgpu_reset_ggtt(struct intel_vgpu *vgpu);
 
 extern int intel_gvt_init_gtt(struct intel_gvt *gvt);
 extern void intel_gvt_clean_gtt(struct intel_gvt *gvt);
index ad0e9364ee703a65ce2a33834321bb4a9fce34f1..0af17016f33f24f40d338715e5c78bfac8058e92 100644 (file)
@@ -175,6 +175,7 @@ struct intel_vgpu {
                struct notifier_block group_notifier;
                struct kvm *kvm;
                struct work_struct release_work;
+               atomic_t released;
        } vdev;
 #endif
 };
index 4dd6722a733933224c269825d6f12f53525bf9c7..faaae07ae487277973533bbf907b6eefc2632a48 100644 (file)
@@ -114,12 +114,15 @@ out:
 static kvm_pfn_t gvt_cache_find(struct intel_vgpu *vgpu, gfn_t gfn)
 {
        struct gvt_dma *entry;
+       kvm_pfn_t pfn;
 
        mutex_lock(&vgpu->vdev.cache_lock);
+
        entry = __gvt_cache_find(vgpu, gfn);
-       mutex_unlock(&vgpu->vdev.cache_lock);
+       pfn = (entry == NULL) ? 0 : entry->pfn;
 
-       return entry == NULL ? 0 : entry->pfn;
+       mutex_unlock(&vgpu->vdev.cache_lock);
+       return pfn;
 }
 
 static void gvt_cache_add(struct intel_vgpu *vgpu, gfn_t gfn, kvm_pfn_t pfn)
@@ -166,7 +169,7 @@ static void __gvt_cache_remove_entry(struct intel_vgpu *vgpu,
 
 static void gvt_cache_remove(struct intel_vgpu *vgpu, gfn_t gfn)
 {
-       struct device *dev = &vgpu->vdev.mdev->dev;
+       struct device *dev = mdev_dev(vgpu->vdev.mdev);
        struct gvt_dma *this;
        unsigned long g1;
        int rc;
@@ -195,7 +198,7 @@ static void gvt_cache_destroy(struct intel_vgpu *vgpu)
 {
        struct gvt_dma *dma;
        struct rb_node *node = NULL;
-       struct device *dev = &vgpu->vdev.mdev->dev;
+       struct device *dev = mdev_dev(vgpu->vdev.mdev);
        unsigned long gfn;
 
        mutex_lock(&vgpu->vdev.cache_lock);
@@ -396,7 +399,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev)
        struct device *pdev;
        void *gvt;
 
-       pdev = mdev->parent->dev;
+       pdev = mdev_parent_dev(mdev);
        gvt = kdev_to_i915(pdev)->gvt;
 
        type = intel_gvt_find_vgpu_type(gvt, kobject_name(kobj));
@@ -418,7 +421,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev)
        mdev_set_drvdata(mdev, vgpu);
 
        gvt_dbg_core("intel_vgpu_create succeeded for mdev: %s\n",
-                    dev_name(&mdev->dev));
+                    dev_name(mdev_dev(mdev)));
        return 0;
 }
 
@@ -482,7 +485,7 @@ static int intel_vgpu_open(struct mdev_device *mdev)
        vgpu->vdev.group_notifier.notifier_call = intel_vgpu_group_notifier;
 
        events = VFIO_IOMMU_NOTIFY_DMA_UNMAP;
-       ret = vfio_register_notifier(&mdev->dev, VFIO_IOMMU_NOTIFY, &events,
+       ret = vfio_register_notifier(mdev_dev(mdev), VFIO_IOMMU_NOTIFY, &events,
                                &vgpu->vdev.iommu_notifier);
        if (ret != 0) {
                gvt_err("vfio_register_notifier for iommu failed: %d\n", ret);
@@ -490,17 +493,26 @@ static int intel_vgpu_open(struct mdev_device *mdev)
        }
 
        events = VFIO_GROUP_NOTIFY_SET_KVM;
-       ret = vfio_register_notifier(&mdev->dev, VFIO_GROUP_NOTIFY, &events,
+       ret = vfio_register_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY, &events,
                                &vgpu->vdev.group_notifier);
        if (ret != 0) {
                gvt_err("vfio_register_notifier for group failed: %d\n", ret);
                goto undo_iommu;
        }
 
-       return kvmgt_guest_init(mdev);
+       ret = kvmgt_guest_init(mdev);
+       if (ret)
+               goto undo_group;
+
+       atomic_set(&vgpu->vdev.released, 0);
+       return ret;
+
+undo_group:
+       vfio_unregister_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY,
+                                       &vgpu->vdev.group_notifier);
 
 undo_iommu:
-       vfio_unregister_notifier(&mdev->dev, VFIO_IOMMU_NOTIFY,
+       vfio_unregister_notifier(mdev_dev(mdev), VFIO_IOMMU_NOTIFY,
                                        &vgpu->vdev.iommu_notifier);
 out:
        return ret;
@@ -509,17 +521,26 @@ out:
 static void __intel_vgpu_release(struct intel_vgpu *vgpu)
 {
        struct kvmgt_guest_info *info;
+       int ret;
 
        if (!handle_valid(vgpu->handle))
                return;
 
-       vfio_unregister_notifier(&vgpu->vdev.mdev->dev, VFIO_IOMMU_NOTIFY,
+       if (atomic_cmpxchg(&vgpu->vdev.released, 0, 1))
+               return;
+
+       ret = vfio_unregister_notifier(mdev_dev(vgpu->vdev.mdev), VFIO_IOMMU_NOTIFY,
                                        &vgpu->vdev.iommu_notifier);
-       vfio_unregister_notifier(&vgpu->vdev.mdev->dev, VFIO_GROUP_NOTIFY,
+       WARN(ret, "vfio_unregister_notifier for iommu failed: %d\n", ret);
+
+       ret = vfio_unregister_notifier(mdev_dev(vgpu->vdev.mdev), VFIO_GROUP_NOTIFY,
                                        &vgpu->vdev.group_notifier);
+       WARN(ret, "vfio_unregister_notifier for group failed: %d\n", ret);
 
        info = (struct kvmgt_guest_info *)vgpu->handle;
        kvmgt_guest_exit(info);
+
+       vgpu->vdev.kvm = NULL;
        vgpu->handle = 0;
 }
 
@@ -534,6 +555,7 @@ static void intel_vgpu_release_work(struct work_struct *work)
 {
        struct intel_vgpu *vgpu = container_of(work, struct intel_vgpu,
                                        vdev.release_work);
+
        __intel_vgpu_release(vgpu);
 }
 
@@ -1089,7 +1111,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
        return 0;
 }
 
-static const struct parent_ops intel_vgpu_ops = {
+static const struct mdev_parent_ops intel_vgpu_ops = {
        .supported_type_groups  = intel_vgpu_type_groups,
        .create                 = intel_vgpu_create,
        .remove                 = intel_vgpu_remove,
@@ -1134,6 +1156,10 @@ static int kvmgt_write_protect_add(unsigned long handle, u64 gfn)
 
        idx = srcu_read_lock(&kvm->srcu);
        slot = gfn_to_memslot(kvm, gfn);
+       if (!slot) {
+               srcu_read_unlock(&kvm->srcu, idx);
+               return -EINVAL;
+       }
 
        spin_lock(&kvm->mmu_lock);
 
@@ -1164,6 +1190,10 @@ static int kvmgt_write_protect_remove(unsigned long handle, u64 gfn)
 
        idx = srcu_read_lock(&kvm->srcu);
        slot = gfn_to_memslot(kvm, gfn);
+       if (!slot) {
+               srcu_read_unlock(&kvm->srcu, idx);
+               return -EINVAL;
+       }
 
        spin_lock(&kvm->mmu_lock);
 
@@ -1311,18 +1341,14 @@ static int kvmgt_guest_init(struct mdev_device *mdev)
 
 static bool kvmgt_guest_exit(struct kvmgt_guest_info *info)
 {
-       struct intel_vgpu *vgpu;
-
        if (!info) {
                gvt_err("kvmgt_guest_info invalid\n");
                return false;
        }
 
-       vgpu = info->vgpu;
-
        kvm_page_track_unregister_notifier(info->kvm, &info->track_node);
        kvmgt_protect_table_destroy(info);
-       gvt_cache_destroy(vgpu);
+       gvt_cache_destroy(info->vgpu);
        vfree(info);
 
        return true;
@@ -1372,7 +1398,7 @@ static unsigned long kvmgt_gfn_to_pfn(unsigned long handle, unsigned long gfn)
                return pfn;
 
        pfn = INTEL_GVT_INVALID_ADDR;
-       dev = &info->vgpu->vdev.mdev->dev;
+       dev = mdev_dev(info->vgpu->vdev.mdev);
        rc = vfio_pin_pages(dev, &gfn, 1, IOMMU_READ | IOMMU_WRITE, &pfn);
        if (rc != 1) {
                gvt_err("vfio_pin_pages failed for gfn 0x%lx: %d\n", gfn, rc);
index d2a0fbc896c3cb2ca0734a9371b603fb8669a643..81cd921770c6db7748ad8e880180c3fb6f4c448a 100644 (file)
@@ -65,7 +65,7 @@ static int map_vgpu_opregion(struct intel_vgpu *vgpu, bool map)
        int i, ret;
 
        for (i = 0; i < INTEL_GVT_OPREGION_PAGES; i++) {
-               mfn = intel_gvt_hypervisor_virt_to_mfn(vgpu_opregion(vgpu)
+               mfn = intel_gvt_hypervisor_virt_to_mfn(vgpu_opregion(vgpu)->va
                        + i * PAGE_SIZE);
                if (mfn == INTEL_GVT_INVALID_ADDR) {
                        gvt_err("fail to get MFN from VA\n");
index 4a31b7a891ecaf3e2732c9f2d6ce62fa633419f6..3dd7fc662859a90803b142a8adf7f542f29c5948 100644 (file)
@@ -244,14 +244,16 @@ err_phys:
 
 static void
 __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
-                               struct sg_table *pages)
+                               struct sg_table *pages,
+                               bool needs_clflush)
 {
        GEM_BUG_ON(obj->mm.madv == __I915_MADV_PURGED);
 
        if (obj->mm.madv == I915_MADV_DONTNEED)
                obj->mm.dirty = false;
 
-       if ((obj->base.read_domains & I915_GEM_DOMAIN_CPU) == 0 &&
+       if (needs_clflush &&
+           (obj->base.read_domains & I915_GEM_DOMAIN_CPU) == 0 &&
            !cpu_cache_is_coherent(obj->base.dev, obj->cache_level))
                drm_clflush_sg(pages);
 
@@ -263,7 +265,7 @@ static void
 i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
                               struct sg_table *pages)
 {
-       __i915_gem_object_release_shmem(obj, pages);
+       __i915_gem_object_release_shmem(obj, pages, false);
 
        if (obj->mm.dirty) {
                struct address_space *mapping = obj->base.filp->f_mapping;
@@ -2231,7 +2233,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj,
        struct sgt_iter sgt_iter;
        struct page *page;
 
-       __i915_gem_object_release_shmem(obj, pages);
+       __i915_gem_object_release_shmem(obj, pages, true);
 
        i915_gem_gtt_finish_pages(obj, pages);
 
@@ -2304,15 +2306,6 @@ unlock:
        mutex_unlock(&obj->mm.lock);
 }
 
-static unsigned int swiotlb_max_size(void)
-{
-#if IS_ENABLED(CONFIG_SWIOTLB)
-       return rounddown(swiotlb_nr_tbl() << IO_TLB_SHIFT, PAGE_SIZE);
-#else
-       return 0;
-#endif
-}
-
 static void i915_sg_trim(struct sg_table *orig_st)
 {
        struct sg_table new_st;
@@ -2322,7 +2315,7 @@ static void i915_sg_trim(struct sg_table *orig_st)
        if (orig_st->nents == orig_st->orig_nents)
                return;
 
-       if (sg_alloc_table(&new_st, orig_st->nents, GFP_KERNEL))
+       if (sg_alloc_table(&new_st, orig_st->nents, GFP_KERNEL | __GFP_NOWARN))
                return;
 
        new_sg = new_st.sgl;
@@ -2360,7 +2353,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
        GEM_BUG_ON(obj->base.read_domains & I915_GEM_GPU_DOMAINS);
        GEM_BUG_ON(obj->base.write_domain & I915_GEM_GPU_DOMAINS);
 
-       max_segment = swiotlb_max_size();
+       max_segment = swiotlb_max_segment();
        if (!max_segment)
                max_segment = rounddown(UINT_MAX, PAGE_SIZE);
 
@@ -2728,6 +2721,7 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine)
        struct drm_i915_gem_request *request;
        struct i915_gem_context *incomplete_ctx;
        struct intel_timeline *timeline;
+       unsigned long flags;
        bool ring_hung;
 
        if (engine->irq_seqno_barrier)
@@ -2763,13 +2757,20 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine)
        if (i915_gem_context_is_default(incomplete_ctx))
                return;
 
+       timeline = i915_gem_context_lookup_timeline(incomplete_ctx, engine);
+
+       spin_lock_irqsave(&engine->timeline->lock, flags);
+       spin_lock(&timeline->lock);
+
        list_for_each_entry_continue(request, &engine->timeline->requests, link)
                if (request->ctx == incomplete_ctx)
                        reset_request(request);
 
-       timeline = i915_gem_context_lookup_timeline(incomplete_ctx, engine);
        list_for_each_entry(request, &timeline->requests, link)
                reset_request(request);
+
+       spin_unlock(&timeline->lock);
+       spin_unlock_irqrestore(&engine->timeline->lock, flags);
 }
 
 void i915_gem_reset(struct drm_i915_private *dev_priv)
index e2b077df2da023107c92a818d3c74042dcf73bac..d229f47d1028bb615675f846ecbd46a43ae17197 100644 (file)
@@ -413,6 +413,25 @@ i915_gem_active_set(struct i915_gem_active *active,
        rcu_assign_pointer(active->request, request);
 }
 
+/**
+ * i915_gem_active_set_retire_fn - updates the retirement callback
+ * @active - the active tracker
+ * @fn - the routine called when the request is retired
+ * @mutex - struct_mutex used to guard retirements
+ *
+ * i915_gem_active_set_retire_fn() updates the function pointer that
+ * is called when the final request associated with the @active tracker
+ * is retired.
+ */
+static inline void
+i915_gem_active_set_retire_fn(struct i915_gem_active *active,
+                             i915_gem_retire_fn fn,
+                             struct mutex *mutex)
+{
+       lockdep_assert_held(mutex);
+       active->retire = fn ?: i915_gem_retire_noop;
+}
+
 static inline struct drm_i915_gem_request *
 __i915_gem_active_peek(const struct i915_gem_active *active)
 {
index 6daad86137606d700b6101ee0ffde7a7ee35a1cd..3dc8724df4004842c78bc985606da52a06e449c0 100644 (file)
@@ -16791,7 +16791,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 
        for_each_intel_crtc(dev, crtc) {
                struct intel_crtc_state *crtc_state = crtc->config;
-               int pixclk = 0;
 
                __drm_atomic_helper_crtc_destroy_state(&crtc_state->base);
                memset(crtc_state, 0, sizeof(*crtc_state));
@@ -16803,23 +16802,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
                crtc->base.enabled = crtc_state->base.enable;
                crtc->active = crtc_state->base.active;
 
-               if (crtc_state->base.active) {
+               if (crtc_state->base.active)
                        dev_priv->active_crtcs |= 1 << crtc->pipe;
 
-                       if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
-                               pixclk = ilk_pipe_pixel_rate(crtc_state);
-                       else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-                               pixclk = crtc_state->base.adjusted_mode.crtc_clock;
-                       else
-                               WARN_ON(dev_priv->display.modeset_calc_cdclk);
-
-                       /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
-                       if (IS_BROADWELL(dev_priv) && crtc_state->ips_enabled)
-                               pixclk = DIV_ROUND_UP(pixclk * 100, 95);
-               }
-
-               dev_priv->min_pixclk[crtc->pipe] = pixclk;
-
                readout_plane_state(crtc);
 
                DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n",
@@ -16892,6 +16877,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
        }
 
        for_each_intel_crtc(dev, crtc) {
+               int pixclk = 0;
+
                crtc->base.hwmode = crtc->config->base.adjusted_mode;
 
                memset(&crtc->base.mode, 0, sizeof(crtc->base.mode));
@@ -16919,10 +16906,23 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
                         */
                        crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED;
 
+                       if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
+                               pixclk = ilk_pipe_pixel_rate(crtc->config);
+                       else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
+                               pixclk = crtc->config->base.adjusted_mode.crtc_clock;
+                       else
+                               WARN_ON(dev_priv->display.modeset_calc_cdclk);
+
+                       /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
+                       if (IS_BROADWELL(dev_priv) && crtc->config->ips_enabled)
+                               pixclk = DIV_ROUND_UP(pixclk * 100, 95);
+
                        drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode);
                        update_scanline_offset(crtc);
                }
 
+               dev_priv->min_pixclk[crtc->pipe] = pixclk;
+
                intel_pipe_config_sanity_check(dev_priv, crtc->config);
        }
 }
index d9bc19be855e76b9bab0f1cee082bc170bccff26..0b8e8eb85c19dfe7e2bc4404914c2f578043e4e3 100644 (file)
@@ -355,7 +355,8 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev,
                                    struct intel_dp *intel_dp);
 static void
 intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
-                                             struct intel_dp *intel_dp);
+                                             struct intel_dp *intel_dp,
+                                             bool force_disable_vdd);
 static void
 intel_dp_pps_init(struct drm_device *dev, struct intel_dp *intel_dp);
 
@@ -516,7 +517,7 @@ vlv_power_sequencer_pipe(struct intel_dp *intel_dp)
 
        /* init power sequencer on this pipe and port */
        intel_dp_init_panel_power_sequencer(dev, intel_dp);
-       intel_dp_init_panel_power_sequencer_registers(dev, intel_dp);
+       intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, true);
 
        /*
         * Even vdd force doesn't work until we've made
@@ -553,7 +554,7 @@ bxt_power_sequencer_idx(struct intel_dp *intel_dp)
         * Only the HW needs to be reprogrammed, the SW state is fixed and
         * has been setup during connector init.
         */
-       intel_dp_init_panel_power_sequencer_registers(dev, intel_dp);
+       intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, false);
 
        return 0;
 }
@@ -636,7 +637,7 @@ vlv_initial_power_sequencer_setup(struct intel_dp *intel_dp)
                      port_name(port), pipe_name(intel_dp->pps_pipe));
 
        intel_dp_init_panel_power_sequencer(dev, intel_dp);
-       intel_dp_init_panel_power_sequencer_registers(dev, intel_dp);
+       intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, false);
 }
 
 void intel_power_sequencer_reset(struct drm_i915_private *dev_priv)
@@ -2912,7 +2913,7 @@ static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp)
 
        /* init power sequencer on this pipe and port */
        intel_dp_init_panel_power_sequencer(dev, intel_dp);
-       intel_dp_init_panel_power_sequencer_registers(dev, intel_dp);
+       intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, true);
 }
 
 static void vlv_pre_enable_dp(struct intel_encoder *encoder,
@@ -5055,7 +5056,8 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev,
 
 static void
 intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
-                                             struct intel_dp *intel_dp)
+                                             struct intel_dp *intel_dp,
+                                             bool force_disable_vdd)
 {
        struct drm_i915_private *dev_priv = to_i915(dev);
        u32 pp_on, pp_off, pp_div, port_sel = 0;
@@ -5068,6 +5070,31 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
 
        intel_pps_get_registers(dev_priv, intel_dp, &regs);
 
+       /*
+        * On some VLV machines the BIOS can leave the VDD
+        * enabled even on power seqeuencers which aren't
+        * hooked up to any port. This would mess up the
+        * power domain tracking the first time we pick
+        * one of these power sequencers for use since
+        * edp_panel_vdd_on() would notice that the VDD was
+        * already on and therefore wouldn't grab the power
+        * domain reference. Disable VDD first to avoid this.
+        * This also avoids spuriously turning the VDD on as
+        * soon as the new power seqeuencer gets initialized.
+        */
+       if (force_disable_vdd) {
+               u32 pp = ironlake_get_pp_control(intel_dp);
+
+               WARN(pp & PANEL_POWER_ON, "Panel power already on\n");
+
+               if (pp & EDP_FORCE_VDD)
+                       DRM_DEBUG_KMS("VDD already on, disabling first\n");
+
+               pp &= ~EDP_FORCE_VDD;
+
+               I915_WRITE(regs.pp_ctrl, pp);
+       }
+
        pp_on = (seq->t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) |
                (seq->t8 << PANEL_LIGHT_ON_DELAY_SHIFT);
        pp_off = (seq->t9 << PANEL_LIGHT_OFF_DELAY_SHIFT) |
@@ -5122,7 +5149,7 @@ static void intel_dp_pps_init(struct drm_device *dev,
                vlv_initial_power_sequencer_setup(intel_dp);
        } else {
                intel_dp_init_panel_power_sequencer(dev, intel_dp);
-               intel_dp_init_panel_power_sequencer_registers(dev, intel_dp);
+               intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, false);
        }
 }
 
index fd0e4dac7cc16f35ff658466bc107a7296407354..e589e17876dc134b60bbb5958ad1fe856f2f118e 100644 (file)
@@ -216,7 +216,8 @@ static void intel_overlay_submit_request(struct intel_overlay *overlay,
 {
        GEM_BUG_ON(i915_gem_active_peek(&overlay->last_flip,
                                        &overlay->i915->drm.struct_mutex));
-       overlay->last_flip.retire = retire;
+       i915_gem_active_set_retire_fn(&overlay->last_flip, retire,
+                                     &overlay->i915->drm.struct_mutex);
        i915_gem_active_set(&overlay->last_flip, req);
        i915_add_request(req);
 }
@@ -839,8 +840,8 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
        if (ret)
                goto out_unpin;
 
-       i915_gem_track_fb(overlay->vma->obj, new_bo,
-                         INTEL_FRONTBUFFER_OVERLAY(pipe));
+       i915_gem_track_fb(overlay->vma ? overlay->vma->obj : NULL,
+                         vma->obj, INTEL_FRONTBUFFER_OVERLAY(pipe));
 
        overlay->old_vma = overlay->vma;
        overlay->vma = vma;
@@ -1430,6 +1431,8 @@ void intel_setup_overlay(struct drm_i915_private *dev_priv)
        overlay->contrast = 75;
        overlay->saturation = 146;
 
+       init_request_active(&overlay->last_flip, NULL);
+
        regs = intel_overlay_map_regs(overlay);
        if (!regs)
                goto out_unpin_bo;
index d7be0d94ba4d1786443230d19b01b6df1fcc3cde..0bffd3f0c15d796627d5d89a5775e5da7a0bf572 100644 (file)
@@ -62,7 +62,7 @@ fw_domain_arm_timer(struct intel_uncore_forcewake_domain *d)
 {
        d->wake_count++;
        hrtimer_start_range_ns(&d->timer,
-                              ktime_set(0, NSEC_PER_MSEC),
+                              NSEC_PER_MSEC,
                               NSEC_PER_MSEC,
                               HRTIMER_MODE_REL);
 }
index 4942ca090b46fdfa1cf4b6193f3d66095804e02e..7890e30eb584570d5d87d857131db4065a8b3849 100644 (file)
@@ -51,6 +51,9 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
        struct drm_crtc_state *crtc_state;
        struct drm_rect clip = { 0, };
 
+       if (!state->crtc)
+               return 0;
+
        crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
        if (IS_ERR(crtc_state))
                return PTR_ERR(crtc_state);
index d836b2274531f83fcd49ea86d649ca49fb405489..f7c87017222048eff2bd17be8eb4f6c83f52b4a7 100644 (file)
  * - TV Panel encoding via ENCT
  */
 
+/* HHI Registers */
+#define HHI_VDAC_CNTL0         0x2F4 /* 0xbd offset in data sheet */
+#define HHI_VDAC_CNTL1         0x2F8 /* 0xbe offset in data sheet */
+#define HHI_HDMI_PHY_CNTL0     0x3a0 /* 0xe8 offset in data sheet */
+
 struct meson_cvbs_enci_mode meson_cvbs_enci_pal = {
        .mode_tag = MESON_VENC_MODE_CVBS_PAL,
        .hso_begin = 3,
@@ -242,6 +247,20 @@ void meson_venc_disable_vsync(struct meson_drm *priv)
 
 void meson_venc_init(struct meson_drm *priv)
 {
+       /* Disable CVBS VDAC */
+       regmap_write(priv->hhi, HHI_VDAC_CNTL0, 0);
+       regmap_write(priv->hhi, HHI_VDAC_CNTL1, 8);
+
+       /* Power Down Dacs */
+       writel_relaxed(0xff, priv->io_base + _REG(VENC_VDAC_SETTING));
+
+       /* Disable HDMI PHY */
+       regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0);
+
+       /* Disable HDMI */
+       writel_bits_relaxed(0x3, 0,
+                           priv->io_base + _REG(VPU_HDMI_SETTING));
+
        /* Disable all encoders */
        writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_EN));
        writel_relaxed(0, priv->io_base + _REG(ENCP_VIDEO_EN));
index c809c085fd78abd61f15f3c9d2a19f14ff173d00..a2bcc70a03efaaac6ee32058f747e57161222b23 100644 (file)
@@ -167,7 +167,7 @@ static void meson_venc_cvbs_encoder_disable(struct drm_encoder *encoder)
 
        /* Disable CVBS VDAC */
        regmap_write(priv->hhi, HHI_VDAC_CNTL0, 0);
-       regmap_write(priv->hhi, HHI_VDAC_CNTL1, 0);
+       regmap_write(priv->hhi, HHI_VDAC_CNTL1, 8);
 }
 
 static void meson_venc_cvbs_encoder_enable(struct drm_encoder *encoder)
index a18126150e1136ea380dcdddc89aabe293d7fcbb..14ff87686a36ffb2580353bde1f0126964c2f8dc 100644 (file)
@@ -213,7 +213,14 @@ void adreno_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
 void adreno_flush(struct msm_gpu *gpu)
 {
        struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
-       uint32_t wptr = get_wptr(gpu->rb);
+       uint32_t wptr;
+
+       /*
+        * Mask wptr value that we calculate to fit in the HW range. This is
+        * to account for the possibility that the last command fit exactly into
+        * the ringbuffer and rb->next hasn't wrapped to zero yet
+        */
+       wptr = get_wptr(gpu->rb) & ((gpu->rb->size / 4) - 1);
 
        /* ensure writes to ringbuffer have hit system memory: */
        mb();
index 166e84e4f0d48f80eacb992c3ccc8964af89b28d..489676568a10d15ac959093e6a09ee3f133abe45 100644 (file)
@@ -106,7 +106,8 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,
                        pagefault_disable();
                }
 
-               if (submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) {
+               if ((submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) ||
+                       !(submit_bo.flags & MSM_SUBMIT_BO_FLAGS)) {
                        DRM_ERROR("invalid flags: %x\n", submit_bo.flags);
                        ret = -EINVAL;
                        goto out_unlock;
@@ -290,7 +291,7 @@ static int submit_reloc(struct msm_gem_submit *submit, struct msm_gem_object *ob
 {
        uint32_t i, last_offset = 0;
        uint32_t *ptr;
-       int ret;
+       int ret = 0;
 
        if (offset % 4) {
                DRM_ERROR("non-aligned cmdstream buffer: %u\n", offset);
@@ -318,12 +319,13 @@ static int submit_reloc(struct msm_gem_submit *submit, struct msm_gem_object *ob
 
                ret = copy_from_user(&submit_reloc, userptr, sizeof(submit_reloc));
                if (ret)
-                       return -EFAULT;
+                       goto out;
 
                if (submit_reloc.submit_offset % 4) {
                        DRM_ERROR("non-aligned reloc offset: %u\n",
                                        submit_reloc.submit_offset);
-                       return -EINVAL;
+                       ret = -EINVAL;
+                       goto out;
                }
 
                /* offset in dwords: */
@@ -332,12 +334,13 @@ static int submit_reloc(struct msm_gem_submit *submit, struct msm_gem_object *ob
                if ((off >= (obj->base.size / 4)) ||
                                (off < last_offset)) {
                        DRM_ERROR("invalid offset %u at reloc %u\n", off, i);
-                       return -EINVAL;
+                       ret = -EINVAL;
+                       goto out;
                }
 
                ret = submit_bo(submit, submit_reloc.reloc_idx, NULL, &iova, &valid);
                if (ret)
-                       return ret;
+                       goto out;
 
                if (valid)
                        continue;
@@ -354,9 +357,10 @@ static int submit_reloc(struct msm_gem_submit *submit, struct msm_gem_object *ob
                last_offset = off;
        }
 
+out:
        msm_gem_put_vaddr_locked(&obj->base);
 
-       return 0;
+       return ret;
 }
 
 static void submit_cleanup(struct msm_gem_submit *submit)
index f326cf6a32e64473461e0b7859101f1a404c0318..67b34e069abf383d4c533ab7d348fd5d576ad525 100644 (file)
@@ -23,7 +23,8 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int size)
        struct msm_ringbuffer *ring;
        int ret;
 
-       size = ALIGN(size, 4);   /* size should be dword aligned */
+       if (WARN_ON(!is_power_of_2(size)))
+               return ERR_PTR(-EINVAL);
 
        ring = kzalloc(sizeof(*ring), GFP_KERNEL);
        if (!ring) {
index f2f348f0160c845d628cfdb0fa85e76cf4f4f490..a6126c93f215b0118e2c152cd0ad18d87c6f62ea 100644 (file)
@@ -330,7 +330,7 @@ nouveau_fence_wait_legacy(struct dma_fence *f, bool intr, long wait)
                __set_current_state(intr ? TASK_INTERRUPTIBLE :
                                           TASK_UNINTERRUPTIBLE);
 
-               kt = ktime_set(0, sleep_time);
+               kt = sleep_time;
                schedule_hrtimeout(&kt, HRTIMER_MODE_REL);
                sleep_time *= 2;
                if (sleep_time > NSEC_PER_MSEC)
index 9942b0577d6e556a2fce45b1d66c3ac410bf5c37..6dfdb145f3bbb694c2750e30807640999404e91e 100644 (file)
@@ -539,7 +539,7 @@ static void tilcdc_crtc_off(struct drm_crtc *crtc, bool shutdown)
        }
 
        drm_flip_work_commit(&tilcdc_crtc->unref_work, priv->wq);
-       tilcdc_crtc->last_vblank = ktime_set(0, 0);
+       tilcdc_crtc->last_vblank = 0;
 
        tilcdc_crtc->enabled = false;
        mutex_unlock(&tilcdc_crtc->enable_lock);
@@ -856,7 +856,7 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
        struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
        struct drm_device *dev = crtc->dev;
        struct tilcdc_drm_private *priv = dev->dev_private;
-       uint32_t stat;
+       uint32_t stat, reg;
 
        stat = tilcdc_read_irqstatus(dev);
        tilcdc_clear_irqstatus(dev, stat);
@@ -921,17 +921,26 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
                dev_err_ratelimited(dev->dev, "%s(0x%08x): Sync lost",
                                    __func__, stat);
                tilcdc_crtc->frame_intact = false;
-               if (tilcdc_crtc->sync_lost_count++ >
-                   SYNC_LOST_COUNT_LIMIT) {
-                       dev_err(dev->dev, "%s(0x%08x): Sync lost flood detected, recovering", __func__, stat);
-                       queue_work(system_wq, &tilcdc_crtc->recover_work);
-                       if (priv->rev == 1)
+               if (priv->rev == 1) {
+                       reg = tilcdc_read(dev, LCDC_RASTER_CTRL_REG);
+                       if (reg & LCDC_RASTER_ENABLE) {
                                tilcdc_clear(dev, LCDC_RASTER_CTRL_REG,
-                                            LCDC_V1_SYNC_LOST_INT_ENA);
-                       else
+                                            LCDC_RASTER_ENABLE);
+                               tilcdc_set(dev, LCDC_RASTER_CTRL_REG,
+                                          LCDC_RASTER_ENABLE);
+                       }
+               } else {
+                       if (tilcdc_crtc->sync_lost_count++ >
+                           SYNC_LOST_COUNT_LIMIT) {
+                               dev_err(dev->dev,
+                                       "%s(0x%08x): Sync lost flood detected, recovering",
+                                       __func__, stat);
+                               queue_work(system_wq,
+                                          &tilcdc_crtc->recover_work);
                                tilcdc_write(dev, LCDC_INT_ENABLE_CLR_REG,
                                             LCDC_SYNC_LOST);
-                       tilcdc_crtc->sync_lost_count = 0;
+                               tilcdc_crtc->sync_lost_count = 0;
+                       }
                }
        }
 
index d40ed9fdf68d990ce2b138579bc6404a6fae7d99..70b12f89a193dc369273cea5565bf804a78cc50a 100644 (file)
@@ -64,7 +64,8 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
 #define QUIRK_SKIP_INPUT_MAPPING       BIT(2)
 #define QUIRK_IS_MULTITOUCH            BIT(3)
 
-#define NOTEBOOK_QUIRKS                        QUIRK_FIX_NOTEBOOK_REPORT
+#define KEYBOARD_QUIRKS                        (QUIRK_FIX_NOTEBOOK_REPORT | \
+                                                QUIRK_NO_INIT_REPORTS)
 #define TOUCHPAD_QUIRKS                        (QUIRK_NO_INIT_REPORTS | \
                                                 QUIRK_SKIP_INPUT_MAPPING | \
                                                 QUIRK_IS_MULTITOUCH)
@@ -170,11 +171,11 @@ static int asus_raw_event(struct hid_device *hdev,
 
 static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi)
 {
+       struct input_dev *input = hi->input;
        struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
 
        if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
                int ret;
-               struct input_dev *input = hi->input;
 
                input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0);
                input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0);
@@ -191,10 +192,10 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi)
                        hid_err(hdev, "Asus input mt init slots failed: %d\n", ret);
                        return ret;
                }
-
-               drvdata->input = input;
        }
 
+       drvdata->input = input;
+
        return 0;
 }
 
@@ -286,7 +287,11 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
                goto err_stop_hw;
        }
 
-       drvdata->input->name = "Asus TouchPad";
+       if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
+               drvdata->input->name = "Asus TouchPad";
+       } else {
+               drvdata->input->name = "Asus Keyboard";
+       }
 
        if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
                ret = asus_start_multitouch(hdev);
@@ -315,7 +320,7 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 
 static const struct hid_device_id asus_devices[] = {
        { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
-                USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), NOTEBOOK_QUIRKS},
+                USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS},
        { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
                         USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS },
        { }
index ec277b96eaa1b33461aa7702f38864598b910e59..54bd22dc14110c308744f28f01a7ab4cff79ff95 100644 (file)
 #define USB_VENDOR_ID_DRAGONRISE               0x0079
 #define USB_DEVICE_ID_DRAGONRISE_WIIU          0x1800
 #define USB_DEVICE_ID_DRAGONRISE_PS3           0x1801
+#define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR    0x1803
 #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE      0x1843
 
 #define USB_VENDOR_ID_DWAV             0x0eef
 #define USB_VENDOR_ID_FLATFROG         0x25b5
 #define USB_DEVICE_ID_MULTITOUCH_3200  0x0002
 
+#define USB_VENDOR_ID_FUTABA            0x0547
+#define USB_DEVICE_ID_LED_DISPLAY       0x7000
+
 #define USB_VENDOR_ID_ESSENTIAL_REALITY        0x0d7f
 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
 
index 5c925228847c8e88653ec5fb00edfc053fa81784..4ef73374a8f9881136cabeda32a67c6a21d53a85 100644 (file)
@@ -212,7 +212,6 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
        __s32 value;
        int ret = 0;
 
-       memset(buffer, 0, buffer_size);
        mutex_lock(&data->mutex);
        report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
        if (!report || (field_index >= report->maxfield)) {
@@ -256,6 +255,8 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
        int buffer_index = 0;
        int i;
 
+       memset(buffer, 0, buffer_size);
+
        mutex_lock(&data->mutex);
        report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
        if (!report || (field_index >= report->maxfield) ||
index 7687c0875395d6b351928a156be6f5268cf50cfe..f405b07d03816506215bd19fe3c878393370484a 100644 (file)
@@ -1099,8 +1099,11 @@ struct sony_sc {
        u8 led_delay_on[MAX_LEDS];
        u8 led_delay_off[MAX_LEDS];
        u8 led_count;
+       bool ds4_dongle_connected;
 };
 
+static void sony_set_leds(struct sony_sc *sc);
+
 static inline void sony_schedule_work(struct sony_sc *sc)
 {
        if (!sc->defer_initialization)
@@ -1430,6 +1433,31 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
                                return -EILSEQ;
                        }
                }
+
+               /*
+                * In the case of a DS4 USB dongle, bit[2] of byte 31 indicates
+                * if a DS4 is actually connected (indicated by '0').
+                * For non-dongle, this bit is always 0 (connected).
+                */
+               if (sc->hdev->vendor == USB_VENDOR_ID_SONY &&
+                   sc->hdev->product == USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE) {
+                       bool connected = (rd[31] & 0x04) ? false : true;
+
+                       if (!sc->ds4_dongle_connected && connected) {
+                               hid_info(sc->hdev, "DualShock 4 USB dongle: controller connected\n");
+                               sony_set_leds(sc);
+                               sc->ds4_dongle_connected = true;
+                       } else if (sc->ds4_dongle_connected && !connected) {
+                               hid_info(sc->hdev, "DualShock 4 USB dongle: controller disconnected\n");
+                               sc->ds4_dongle_connected = false;
+                               /* Return 0, so hidraw can get the report. */
+                               return 0;
+                       } else if (!sc->ds4_dongle_connected) {
+                               /* Return 0, so hidraw can get the report. */
+                               return 0;
+                       }
+               }
+
                dualshock4_parse_report(sc, rd, size);
        }
 
@@ -2390,6 +2418,12 @@ static int sony_check_add(struct sony_sc *sc)
                }
 
                memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));
+
+               snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
+                       "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+                       sc->mac_address[5], sc->mac_address[4],
+                       sc->mac_address[3], sc->mac_address[2],
+                       sc->mac_address[1], sc->mac_address[0]);
        } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) ||
                        (sc->quirks & NAVIGATION_CONTROLLER_USB)) {
                buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL);
@@ -2548,7 +2582,7 @@ static int sony_input_configured(struct hid_device *hdev,
                        hid_err(sc->hdev,
                        "Unable to initialize multi-touch slots: %d\n",
                        ret);
-                       return ret;
+                       goto err_stop;
                }
 
                sony_init_output_report(sc, dualshock4_send_output_report);
index b3e01c82af0512dce7a68e6bde908d7e3afeaba8..e9d6cc7cdfc5c8019422d45914dc0363448bcb12 100644 (file)
@@ -83,11 +83,13 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3, HID_QUIRK_MULTI_INPUT },
+       { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },
        { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_FUTABA, USB_DEVICE_ID_LED_DISPLAY, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A, HID_QUIRK_ALWAYS_POLL },
        { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL },
        { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
index 446802ae8f1bc6b72f41b468ee9e32c145378fb3..b44b32f21e61db00a2db56db81c4e4a1a04053db 100644 (file)
@@ -135,9 +135,9 @@ u64 hv_do_hypercall(u64 control, void *input, void *output)
 EXPORT_SYMBOL_GPL(hv_do_hypercall);
 
 #ifdef CONFIG_X86_64
-static cycle_t read_hv_clock_tsc(struct clocksource *arg)
+static u64 read_hv_clock_tsc(struct clocksource *arg)
 {
-       cycle_t current_tick;
+       u64 current_tick;
        struct ms_hyperv_tsc_page *tsc_pg = hv_context.tsc_page;
 
        if (tsc_pg->tsc_sequence != 0) {
@@ -146,7 +146,7 @@ static cycle_t read_hv_clock_tsc(struct clocksource *arg)
                 */
 
                while (1) {
-                       cycle_t tmp;
+                       u64 tmp;
                        u32 sequence = tsc_pg->tsc_sequence;
                        u64 cur_tsc;
                        u64 scale = tsc_pg->tsc_scale;
@@ -350,7 +350,7 @@ int hv_post_message(union hv_connection_id connection_id,
 static int hv_ce_set_next_event(unsigned long delta,
                                struct clock_event_device *evt)
 {
-       cycle_t current_tick;
+       u64 current_tick;
 
        WARN_ON(!clockevent_state_oneshot(evt));
 
index 322ed9272811817324396960e63facf9df80d96c..841f2428e84a3936de0a60ee42700efd70933ed2 100644 (file)
@@ -1036,7 +1036,7 @@ static const u8 lm90_temp_emerg_index[3] = {
 };
 
 static const u8 lm90_min_alarm_bits[3] = { 5, 3, 11 };
-static const u8 lm90_max_alarm_bits[3] = { 0, 4, 12 };
+static const u8 lm90_max_alarm_bits[3] = { 6, 4, 12 };
 static const u8 lm90_crit_alarm_bits[3] = { 0, 1, 9 };
 static const u8 lm90_emergency_alarm_bits[3] = { 15, 13, 14 };
 static const u8 lm90_fault_bits[3] = { 0, 2, 10 };
index 3fe368b23d158d56563285052df9aecb869d3ef2..a51b6b64ecdf01ff61938608e89e9d24bcfab13a 100644 (file)
@@ -804,10 +804,10 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)
 
        if (!etm_count++) {
                cpuhp_setup_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING,
-                                         "AP_ARM_CORESIGHT_STARTING",
+                                         "arm/coresight:starting",
                                          etm_starting_cpu, etm_dying_cpu);
                ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
-                                               "AP_ARM_CORESIGHT_ONLINE",
+                                               "arm/coresight:online",
                                                etm_online_cpu, NULL);
                if (ret < 0)
                        goto err_arch_supported;
index 4db8d6a4d0cbbe0545e5724b7de75fbae0438c68..031480f2c34d0f68166e924b180167a7c943d4d9 100644 (file)
@@ -986,11 +986,11 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
                dev_err(dev, "ETM arch init failed\n");
 
        if (!etm4_count++) {
-               cpuhp_setup_state_nocalls(CPUHP_AP_ARM_CORESIGHT4_STARTING,
-                                         "AP_ARM_CORESIGHT4_STARTING",
+               cpuhp_setup_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING,
+                                         "arm/coresight4:starting",
                                          etm4_starting_cpu, etm4_dying_cpu);
                ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
-                                               "AP_ARM_CORESIGHT4_ONLINE",
+                                               "arm/coresight4:online",
                                                etm4_online_cpu, NULL);
                if (ret < 0)
                        goto err_arch_supported;
@@ -1037,7 +1037,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
 
 err_arch_supported:
        if (--etm4_count == 0) {
-               cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT4_STARTING);
+               cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING);
                if (hp_online)
                        cpuhp_remove_state_nocalls(hp_online);
        }
index 3de95a29024cde47e975918fafd3dd1a718b97a5..cf9e396d7702c6c769e2106a6938f90c6ddbb7a9 100644 (file)
@@ -30,7 +30,7 @@
 #define pr_fmt(fmt) "i2c-core: " fmt
 
 #include <dt-bindings/i2c/i2c.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/acpi.h>
 #include <linux/clk/clk-conf.h>
 #include <linux/completion.h>
index 0ceae5cbd89a327d198a5bac595f2e40882eefab..4b5dc0162e67418ab2cb20b67b12f96554a3acec 100644 (file)
 #include <linux/ide.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 #define DRV_NAME "hpt366"
index 83679da0c3f09d016b642dcb29dde359d8e06f81..5ceace542b775931524d60a569881e4cd79a51bc 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/div64.h>
 
index 6360bbd37efe52aa93a318fb4e3ea75d5ee61905..201e43fcbc940019a499260b7275ef4dbe18ef84 100644 (file)
@@ -51,7 +51,7 @@
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 int ide_end_rq(ide_drive_t *drive, struct request *rq, int error,
index 376f2dc410c5b80df744d71e5efb921c6390d7bb..210a0887dd2957d834dcdf924a11ffe242418382 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 void SELECT_MASK(ide_drive_t *drive, int mask)
index 0b63facd1d87d0def87864ee946ef92e179e3d1e..330e319419e6aabfc6fe82c2750238d3fb845f0d 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 /**
index 97c070077774b74201df5bda2f4053cc57debc28..863db44c79169632e4f66bfe5ae13acf79764151 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <linux/module.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/errno.h>
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
index f6b6d42385e1148b2ad7f279feb9a43396e66894..784670e2736b4fbbc540382afc1aefe66ccc1e5c 100644 (file)
@@ -353,12 +353,12 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
                                [0] = {
                                        .num = ST_ACCEL_FS_AVL_2G,
                                        .value = 0x00,
-                                       .gain = IIO_G_TO_M_S_2(1024),
+                                       .gain = IIO_G_TO_M_S_2(1000),
                                },
                                [1] = {
                                        .num = ST_ACCEL_FS_AVL_6G,
                                        .value = 0x01,
-                                       .gain = IIO_G_TO_M_S_2(340),
+                                       .gain = IIO_G_TO_M_S_2(3000),
                                },
                        },
                },
@@ -366,6 +366,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
                        .addr = 0x21,
                        .mask = 0x40,
                },
+               /*
+                * Data Alignment Setting - needs to be set to get
+                * left-justified data like all other sensors.
+                */
+               .das = {
+                       .addr = 0x21,
+                       .mask = 0x01,
+               },
                .drdy_irq = {
                        .addr = 0x21,
                        .mask_int1 = 0x04,
index 38bc319904c4c2998c040e8a05bdcbd3f55e9088..9c8b558ba19ecb035b8f4fe789acee1663184c60 100644 (file)
@@ -561,7 +561,7 @@ config TI_ADS8688
 
 config TI_AM335X_ADC
        tristate "TI's AM335X ADC driver"
-       depends on MFD_TI_AM335X_TSCADC
+       depends on MFD_TI_AM335X_TSCADC && HAS_DMA
        select IIO_BUFFER
        select IIO_KFIFO_BUF
        help
index fe7775bb37402ea73915189d2c4f121b0a74464d..df4045203a0717c40613b2297c9f85a855333f68 100644 (file)
@@ -30,7 +30,9 @@ static int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf)
 
        for_each_set_bit(i, indio_dev->active_scan_mask, num_data_channels) {
                const struct iio_chan_spec *channel = &indio_dev->channels[i];
-               unsigned int bytes_to_read = channel->scan_type.realbits >> 3;
+               unsigned int bytes_to_read =
+                       DIV_ROUND_UP(channel->scan_type.realbits +
+                                    channel->scan_type.shift, 8);
                unsigned int storage_bytes =
                        channel->scan_type.storagebits >> 3;
 
index 975a1f19f74760e5e1c17c786e36d9a86ae5a2a6..79c8c7cd70d5c6d74fc2e32cad372f8644233c6b 100644 (file)
@@ -401,6 +401,15 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
                        return err;
        }
 
+       /* set DAS */
+       if (sdata->sensor_settings->das.addr) {
+               err = st_sensors_write_data_with_mask(indio_dev,
+                                       sdata->sensor_settings->das.addr,
+                                       sdata->sensor_settings->das.mask, 1);
+               if (err < 0)
+                       return err;
+       }
+
        if (sdata->int_pin_open_drain) {
                dev_info(&indio_dev->dev,
                         "set interrupt line to open drain mode\n");
@@ -483,8 +492,10 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
        int err;
        u8 *outdata;
        struct st_sensor_data *sdata = iio_priv(indio_dev);
-       unsigned int byte_for_channel = ch->scan_type.realbits >> 3;
+       unsigned int byte_for_channel;
 
+       byte_for_channel = DIV_ROUND_UP(ch->scan_type.realbits +
+                                       ch->scan_type.shift, 8);
        outdata = kmalloc(byte_for_channel, GFP_KERNEL);
        if (!outdata)
                return -ENOMEM;
index 2d2ee353dde7fc7bc976ced92cd969ccd9fade53..a5913e97945eb6b5f26a418a71852fe086e6cd42 100644 (file)
@@ -153,7 +153,7 @@ static int quad8_write_raw(struct iio_dev *indio_dev,
                ior_cfg = val | priv->preset_enable[chan->channel] << 1;
 
                /* Load I/O control configuration */
-               outb(0x40 | ior_cfg, base_offset);
+               outb(0x40 | ior_cfg, base_offset + 1);
 
                return 0;
        case IIO_CHAN_INFO_SCALE:
@@ -233,7 +233,7 @@ static ssize_t quad8_read_set_to_preset_on_index(struct iio_dev *indio_dev,
        const struct quad8_iio *const priv = iio_priv(indio_dev);
 
        return snprintf(buf, PAGE_SIZE, "%u\n",
-               priv->preset_enable[chan->channel]);
+               !priv->preset_enable[chan->channel]);
 }
 
 static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev,
@@ -241,7 +241,7 @@ static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev,
        size_t len)
 {
        struct quad8_iio *const priv = iio_priv(indio_dev);
-       const int base_offset = priv->base + 2 * chan->channel;
+       const int base_offset = priv->base + 2 * chan->channel + 1;
        bool preset_enable;
        int ret;
        unsigned int ior_cfg;
@@ -250,6 +250,9 @@ static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev,
        if (ret)
                return ret;
 
+       /* Preset enable is active low in Input/Output Control register */
+       preset_enable = !preset_enable;
+
        priv->preset_enable[chan->channel] = preset_enable;
 
        ior_cfg = priv->ab_enable[chan->channel] |
@@ -362,7 +365,7 @@ static int quad8_set_synchronous_mode(struct iio_dev *indio_dev,
        priv->synchronous_mode[chan->channel] = synchronous_mode;
 
        /* Load Index Control configuration to Index Control Register */
-       outb(0x40 | idr_cfg, base_offset);
+       outb(0x60 | idr_cfg, base_offset);
 
        return 0;
 }
@@ -444,7 +447,7 @@ static int quad8_set_index_polarity(struct iio_dev *indio_dev,
        priv->index_polarity[chan->channel] = index_polarity;
 
        /* Load Index Control configuration to Index Control Register */
-       outb(0x40 | idr_cfg, base_offset);
+       outb(0x60 | idr_cfg, base_offset);
 
        return 0;
 }
index 5355507f8fa1493c8fc5346e4f51da37f8f4790c..c9e319bff58b314f626797f9dbf36339eb76be04 100644 (file)
 
 #define BMI160_REG_DUMMY               0x7F
 
-#define BMI160_ACCEL_PMU_MIN_USLEEP    3200
-#define BMI160_ACCEL_PMU_MAX_USLEEP    3800
-#define BMI160_GYRO_PMU_MIN_USLEEP     55000
-#define BMI160_GYRO_PMU_MAX_USLEEP     80000
+#define BMI160_ACCEL_PMU_MIN_USLEEP    3800
+#define BMI160_GYRO_PMU_MIN_USLEEP     80000
 #define BMI160_SOFTRESET_USLEEP                1000
 
 #define BMI160_CHANNEL(_type, _axis, _index) {                 \
@@ -151,20 +149,9 @@ static struct bmi160_regs bmi160_regs[] = {
        },
 };
 
-struct bmi160_pmu_time {
-       unsigned long min;
-       unsigned long max;
-};
-
-static struct bmi160_pmu_time bmi160_pmu_time[] = {
-       [BMI160_ACCEL] = {
-               .min = BMI160_ACCEL_PMU_MIN_USLEEP,
-               .max = BMI160_ACCEL_PMU_MAX_USLEEP
-       },
-       [BMI160_GYRO] = {
-               .min = BMI160_GYRO_PMU_MIN_USLEEP,
-               .max = BMI160_GYRO_PMU_MIN_USLEEP,
-       },
+static unsigned long bmi160_pmu_time[] = {
+       [BMI160_ACCEL] = BMI160_ACCEL_PMU_MIN_USLEEP,
+       [BMI160_GYRO] = BMI160_GYRO_PMU_MIN_USLEEP,
 };
 
 struct bmi160_scale {
@@ -289,7 +276,7 @@ int bmi160_set_mode(struct bmi160_data *data, enum bmi160_sensor_type t,
        if (ret < 0)
                return ret;
 
-       usleep_range(bmi160_pmu_time[t].min, bmi160_pmu_time[t].max);
+       usleep_range(bmi160_pmu_time[t], bmi160_pmu_time[t] + 1000);
 
        return 0;
 }
index a144ca3461fc91e2ad853302dcfc2241a9b3e923..81bd8e8da4a69af929760bfe1c12716fe16de972 100644 (file)
@@ -113,7 +113,7 @@ static const char max44000_int_time_avail_str[] =
        "0.100 "
        "0.025 "
        "0.00625 "
-       "0.001625";
+       "0.0015625";
 
 /* Available scales (internal to ulux) with pretty manual alignment: */
 static const int max44000_scale_avail_ulux_array[] = {
index 5e6d451febebda26f97599f5c6c607561ef3e983..a1cad6cc2e0ff1bc70ca99d8d315eccdd5acb7d3 100644 (file)
@@ -63,7 +63,7 @@ ssize_t iio_hrtimer_store_sampling_frequency(struct device *dev,
                return -EINVAL;
 
        info->sampling_frequency = val;
-       info->period = ktime_set(0, NSEC_PER_SEC / val);
+       info->period = NSEC_PER_SEC / val;
 
        return len;
 }
@@ -141,8 +141,7 @@ static struct iio_sw_trigger *iio_trig_hrtimer_probe(const char *name)
        trig_info->timer.function = iio_hrtimer_trig_handler;
 
        trig_info->sampling_frequency = HRTIMER_DEFAULT_SAMPLING_FREQUENCY;
-       trig_info->period = ktime_set(0, NSEC_PER_SEC /
-                                     trig_info->sampling_frequency);
+       trig_info->period = NSEC_PER_SEC / trig_info->sampling_frequency;
 
        ret = iio_trigger_register(trig_info->swt.trigger);
        if (ret)
index 579f9a7f62838caafaca7c2d234e5fac6ebc8f1a..e0a995b85a2d982c1e2c42deb1fd481563b3ce7e 100644 (file)
@@ -46,7 +46,7 @@
 #include <linux/mutex.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <rdma/ib.h>
 #include <rdma/ib_cm.h>
index 415a3185cde7f45dfc583180ef1a4ef81fec8699..249b403b43a440ba885b374988094e3fbe9e5498 100644 (file)
@@ -50,7 +50,7 @@
 #include <linux/semaphore.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <rdma/ib_mad.h>
 #include <rdma/ib_user_mad.h>
index 09b649159e6cf3ed0067f50c9f6b820a6c93838f..70078220348383eec62b9b6252a5607f9255e9fa 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/slab.h>
 #include <linux/sched.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "uverbs.h"
 #include "core_priv.h"
index 813593550c4bd65a582ce32c36dc320b7fee0cbc..b3f95d453fba73073c42bcbdebe96cce98eabd72 100644 (file)
@@ -46,7 +46,7 @@
 #include <linux/anon_inodes.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <rdma/ib.h>
 
index b7ac97b27c88c2fe11ad11f564ce786085d3217c..cda5542e13a206347447a49f18f9e8cb930e7c8c 100644 (file)
@@ -321,7 +321,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
                FW_RI_RES_WR_DCAEN_V(0) |
                FW_RI_RES_WR_DCACPU_V(0) |
                FW_RI_RES_WR_FBMIN_V(2) |
-               FW_RI_RES_WR_FBMAX_V(2) |
+               (t4_sq_onchip(&wq->sq) ? FW_RI_RES_WR_FBMAX_V(2) :
+                                        FW_RI_RES_WR_FBMAX_V(3)) |
                FW_RI_RES_WR_CIDXFTHRESHO_V(0) |
                FW_RI_RES_WR_CIDXFTHRESH_V(0) |
                FW_RI_RES_WR_EQSIZE_V(eqsize));
@@ -345,7 +346,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
                FW_RI_RES_WR_DCAEN_V(0) |
                FW_RI_RES_WR_DCACPU_V(0) |
                FW_RI_RES_WR_FBMIN_V(2) |
-               FW_RI_RES_WR_FBMAX_V(2) |
+               FW_RI_RES_WR_FBMAX_V(3) |
                FW_RI_RES_WR_CIDXFTHRESHO_V(0) |
                FW_RI_RES_WR_CIDXFTHRESH_V(0) |
                FW_RI_RES_WR_EQSIZE_V(eqsize));
index 392f78384a604ad9175f5376845a0f8e854f5405..98923a8cf86d83361d0a93afd1783b57fc4e5995 100644 (file)
@@ -358,13 +358,16 @@ void i40iw_qp_add_qos(struct i40iw_sc_qp *qp)
  * @dev: sc device struct
  * @pd: sc pd ptr
  * @pd_id: pd_id for allocated pd
+ * @abi_ver: ABI version from user context, -1 if not valid
  */
 static void i40iw_sc_pd_init(struct i40iw_sc_dev *dev,
                             struct i40iw_sc_pd *pd,
-                            u16 pd_id)
+                            u16 pd_id,
+                            int abi_ver)
 {
        pd->size = sizeof(*pd);
        pd->pd_id = pd_id;
+       pd->abi_ver = abi_ver;
        pd->dev = dev;
 }
 
@@ -2252,6 +2255,7 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
                                              offset);
 
        info->qp_uk_init_info.wqe_alloc_reg = wqe_alloc_reg;
+       info->qp_uk_init_info.abi_ver = qp->pd->abi_ver;
        ret_code = i40iw_qp_uk_init(&qp->qp_uk, &info->qp_uk_init_info);
        if (ret_code)
                return ret_code;
@@ -2270,10 +2274,21 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
                                                    false);
        i40iw_debug(qp->dev, I40IW_DEBUG_WQE, "%s: hw_sq_size[%04d] sq_ring.size[%04d]\n",
                    __func__, qp->hw_sq_size, qp->qp_uk.sq_ring.size);
-       ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
-                                              &wqe_size);
-       if (ret_code)
-               return ret_code;
+
+       switch (qp->pd->abi_ver) {
+       case 4:
+               ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
+                                                      &wqe_size);
+               if (ret_code)
+                       return ret_code;
+               break;
+       case 5: /* fallthrough until next ABI version */
+       default:
+               if (qp->qp_uk.max_rq_frag_cnt > I40IW_MAX_WQ_FRAGMENT_COUNT)
+                       return I40IW_ERR_INVALID_FRAG_COUNT;
+               wqe_size = I40IW_MAX_WQE_SIZE_RQ;
+               break;
+       }
        qp->hw_rq_size = i40iw_get_encoded_wqe_size(qp->qp_uk.rq_size *
                                (wqe_size / I40IW_QP_WQE_MIN_SIZE), false);
        i40iw_debug(qp->dev, I40IW_DEBUG_WQE,
index 449ba8c81ce786d1442a0808d72041b0edfb710d..db41ab40da9cea375b087d02fccbfe07adf0356a 100644 (file)
@@ -930,7 +930,7 @@ enum i40iw_status_code i40iw_puda_create_rsrc(struct i40iw_sc_vsi *vsi,
        INIT_LIST_HEAD(&rsrc->txpend);
 
        rsrc->tx_wqe_avail_cnt = info->sq_size - 1;
-       dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id);
+       dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id, -1);
        rsrc->qp_id = info->qp_id;
        rsrc->cq_id = info->cq_id;
        rsrc->sq_size = info->sq_size;
index f3f8e9cc3c058fe0a1b9fddbe06b64bca26daf9f..7b76259752b0062e5cf16f7bc097f5cd4b66098e 100644 (file)
@@ -280,6 +280,7 @@ struct i40iw_sc_pd {
        u32 size;
        struct i40iw_sc_dev *dev;
        u16 pd_id;
+       int abi_ver;
 };
 
 struct i40iw_cqp_quanta {
@@ -852,6 +853,7 @@ struct i40iw_qp_init_info {
        u64 host_ctx_pa;
        u64 q2_pa;
        u64 shadow_area_pa;
+       int abi_ver;
        u8 sq_tph_val;
        u8 rq_tph_val;
        u8 type;
@@ -1051,7 +1053,7 @@ struct i40iw_aeq_ops {
 };
 
 struct i40iw_pd_ops {
-       void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16);
+       void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16, int);
 };
 
 struct i40iw_priv_qp_ops {
index 12acd688def4707fa018a9673fe5ea8b6408f9cb..57d3f1d11ff1f5bcbd0108a4ffb48727f5778b56 100644 (file)
@@ -39,8 +39,8 @@
 
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+
 struct i40iw_alloc_ucontext_req {
        __u32 reserved32;
        __u8 userspace_ver;
index 4376cd628774248dbc18e7bf1ea731dcede4945c..2800f796271c4a89fccfbea526ff00395269f63c 100644 (file)
@@ -966,10 +966,6 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
        if (ret_code)
                return ret_code;
 
-       ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
-       if (ret_code)
-               return ret_code;
-
        qp->sq_base = info->sq;
        qp->rq_base = info->rq;
        qp->shadow_area = info->shadow_area;
@@ -998,8 +994,19 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
        if (!qp->use_srq) {
                qp->rq_size = info->rq_size;
                qp->max_rq_frag_cnt = info->max_rq_frag_cnt;
-               qp->rq_wqe_size = rqshift;
                I40IW_RING_INIT(qp->rq_ring, qp->rq_size);
+               switch (info->abi_ver) {
+               case 4:
+                       ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
+                       if (ret_code)
+                               return ret_code;
+                       break;
+               case 5: /* fallthrough until next ABI version */
+               default:
+                       rqshift = I40IW_MAX_RQ_WQE_SHIFT;
+                       break;
+               }
+               qp->rq_wqe_size = rqshift;
                qp->rq_wqe_size_multiplier = 4 << rqshift;
        }
        qp->ops = iw_qp_uk_ops;
index 80d9f464f65ea31813a2850298b443f9904dbac6..84be6f13b9c5264f27237a0eb6a2810f9d61b0ab 100644 (file)
@@ -76,6 +76,7 @@ enum i40iw_device_capabilities_const {
        I40IW_MAX_ORD_SIZE =                    127,
        I40IW_MAX_WQ_ENTRIES =                  2048,
        I40IW_Q2_BUFFER_SIZE =                  (248 + 100),
+       I40IW_MAX_WQE_SIZE_RQ =                 128,
        I40IW_QP_CTX_SIZE =                     248,
        I40IW_MAX_PDS =                         32768
 };
@@ -97,6 +98,7 @@ enum i40iw_device_capabilities_const {
 #define i40iw_address_list u64 *
 
 #define        I40IW_MAX_MR_SIZE       0x10000000000L
+#define        I40IW_MAX_RQ_WQE_SHIFT  2
 
 struct i40iw_qp_uk;
 struct i40iw_cq_uk;
@@ -405,7 +407,7 @@ struct i40iw_qp_uk_init_info {
        u32 max_sq_frag_cnt;
        u32 max_rq_frag_cnt;
        u32 max_inline_data;
-
+       int abi_ver;
 };
 
 struct i40iw_cq_uk_init_info {
index 7368a50bbdaa09abdfae87783f239d1bac5497e7..29e97df9e1a7f87c784ebf33f4ebccfae217f433 100644 (file)
@@ -145,9 +145,8 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
        if (ib_copy_from_udata(&req, udata, sizeof(req)))
                return ERR_PTR(-EINVAL);
 
-       if (req.userspace_ver != I40IW_ABI_USERSPACE_VER) {
-               i40iw_pr_err("Invalid userspace driver version detected. Detected version %d, should be %d\n",
-                            req.userspace_ver, I40IW_ABI_USERSPACE_VER);
+       if (req.userspace_ver < 4 || req.userspace_ver > I40IW_ABI_VER) {
+               i40iw_pr_err("Unsupported provider library version %u.\n", req.userspace_ver);
                return ERR_PTR(-EINVAL);
        }
 
@@ -155,13 +154,14 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
        uresp.max_qps = iwdev->max_qp;
        uresp.max_pds = iwdev->max_pd;
        uresp.wq_size = iwdev->max_qp_wr * 2;
-       uresp.kernel_ver = I40IW_ABI_KERNEL_VER;
+       uresp.kernel_ver = req.userspace_ver;
 
        ucontext = kzalloc(sizeof(*ucontext), GFP_KERNEL);
        if (!ucontext)
                return ERR_PTR(-ENOMEM);
 
        ucontext->iwdev = iwdev;
+       ucontext->abi_ver = req.userspace_ver;
 
        if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
                kfree(ucontext);
@@ -333,6 +333,7 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
        struct i40iw_sc_dev *dev = &iwdev->sc_dev;
        struct i40iw_alloc_pd_resp uresp;
        struct i40iw_sc_pd *sc_pd;
+       struct i40iw_ucontext *ucontext;
        u32 pd_id = 0;
        int err;
 
@@ -353,15 +354,18 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
        }
 
        sc_pd = &iwpd->sc_pd;
-       dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id);
 
        if (context) {
+               ucontext = to_ucontext(context);
+               dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, ucontext->abi_ver);
                memset(&uresp, 0, sizeof(uresp));
                uresp.pd_id = pd_id;
                if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
                        err = -EFAULT;
                        goto error;
                }
+       } else {
+               dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, -1);
        }
 
        i40iw_add_pdusecount(iwpd);
@@ -518,7 +522,7 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
        struct i40iw_dma_mem *mem = &iwqp->kqp.dma_mem;
        u32 sqdepth, rqdepth;
        u32 sq_size, rq_size;
-       u8 sqshift, rqshift;
+       u8 sqshift;
        u32 size;
        enum i40iw_status_code status;
        struct i40iw_qp_uk_init_info *ukinfo = &info->qp_uk_init_info;
@@ -527,14 +531,11 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
        rq_size = i40iw_qp_roundup(ukinfo->rq_size + 1);
 
        status = i40iw_get_wqe_shift(sq_size, ukinfo->max_sq_frag_cnt, ukinfo->max_inline_data, &sqshift);
-       if (!status)
-               status = i40iw_get_wqe_shift(rq_size, ukinfo->max_rq_frag_cnt, 0, &rqshift);
-
        if (status)
                return -ENOMEM;
 
        sqdepth = sq_size << sqshift;
-       rqdepth = rq_size << rqshift;
+       rqdepth = rq_size << I40IW_MAX_RQ_WQE_SHIFT;
 
        size = sqdepth * sizeof(struct i40iw_sq_uk_wr_trk_info) + (rqdepth << 3);
        iwqp->kqp.wrid_mem = kzalloc(size, GFP_KERNEL);
index 6549c939500f47068567e9bb275dfc8ebc829a70..07c3fec77de6a1fcbb3a52a95e4937b6e23ea8aa 100644 (file)
@@ -42,6 +42,7 @@ struct i40iw_ucontext {
        spinlock_t cq_reg_mem_list_lock; /* memory list for cq's */
        struct list_head qp_reg_mem_list;
        spinlock_t qp_reg_mem_list_lock; /* memory list for qp's */
+       int abi_ver;
 };
 
 struct i40iw_pd {
index c8413fc120e632bd9a6677c17507f3c454855d16..7031a8dd4d1404d439dafcb90af38b610774cc05 100644 (file)
@@ -1682,9 +1682,19 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
                size += ret;
        }
 
+       if (mlx4_is_master(mdev->dev) && flow_type == MLX4_FS_REGULAR &&
+           flow_attr->num_of_specs == 1) {
+               struct _rule_hw *rule_header = (struct _rule_hw *)(ctrl + 1);
+               enum ib_flow_spec_type header_spec =
+                       ((union ib_flow_spec *)(flow_attr + 1))->type;
+
+               if (header_spec == IB_FLOW_SPEC_ETH)
+                       mlx4_handle_eth_header_mcast_prio(ctrl, rule_header);
+       }
+
        ret = mlx4_cmd_imm(mdev->dev, mailbox->dma, reg_id, size >> 2, 0,
                           MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A,
-                          MLX4_CMD_WRAPPED);
+                          MLX4_CMD_NATIVE);
        if (ret == -ENOMEM)
                pr_err("mcg table is full. Fail to register network rule.\n");
        else if (ret == -ENXIO)
@@ -1701,7 +1711,7 @@ static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id)
        int err;
        err = mlx4_cmd(dev, reg_id, 0, 0,
                       MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A,
-                      MLX4_CMD_WRAPPED);
+                      MLX4_CMD_NATIVE);
        if (err)
                pr_err("Fail to detach network rule. registration id = 0x%llx\n",
                       reg_id);
index 302fb05e6e6fb1d17d5700363b02e70f42eba192..57c8de2080773b161272774a69eaebf02cc411ed 100644 (file)
@@ -890,6 +890,8 @@ struct ib_cq *qedr_create_cq(struct ib_device *ibdev,
 
                pbl_ptr = cq->q.pbl_tbl->pa;
                page_cnt = cq->q.pbl_info.num_pbes;
+
+               cq->ibcq.cqe = chain_entries;
        } else {
                cq->cq_type = QEDR_CQ_TYPE_KERNEL;
 
@@ -905,6 +907,7 @@ struct ib_cq *qedr_create_cq(struct ib_device *ibdev,
 
                page_cnt = qed_chain_get_page_cnt(&cq->pbl);
                pbl_ptr = qed_chain_get_pbl_phys(&cq->pbl);
+               cq->ibcq.cqe = cq->pbl.capacity;
        }
 
        qedr_init_cq_params(cq, ctx, dev, vector, chain_entries, page_cnt,
@@ -982,8 +985,13 @@ int qedr_destroy_cq(struct ib_cq *ibcq)
 
        /* GSIs CQs are handled by driver, so they don't exist in the FW */
        if (cq->cq_type != QEDR_CQ_TYPE_GSI) {
+               int rc;
+
                iparams.icid = cq->icid;
-               dev->ops->rdma_destroy_cq(dev->rdma_ctx, &iparams, &oparams);
+               rc = dev->ops->rdma_destroy_cq(dev->rdma_ctx, &iparams,
+                                              &oparams);
+               if (rc)
+                       return rc;
                dev->ops->common->chain_free(dev->cdev, &cq->pbl);
        }
 
@@ -1966,7 +1974,7 @@ int qedr_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 
        if (attr_mask & IB_QP_STATE) {
                if ((qp->qp_type != IB_QPT_GSI) && (!udata))
-                       qedr_update_qp_state(dev, qp, qp_params.new_state);
+                       rc = qedr_update_qp_state(dev, qp, qp_params.new_state);
                qp->state = qp_params.new_state;
        }
 
@@ -2070,8 +2078,10 @@ int qedr_destroy_qp(struct ib_qp *ibqp)
        DP_DEBUG(dev, QEDR_MSG_QP, "destroy qp: destroying %p, qp type=%d\n",
                 qp, qp->qp_type);
 
-       if (qp->state != (QED_ROCE_QP_STATE_RESET | QED_ROCE_QP_STATE_ERR |
-                         QED_ROCE_QP_STATE_INIT)) {
+       if ((qp->state != QED_ROCE_QP_STATE_RESET) &&
+           (qp->state != QED_ROCE_QP_STATE_ERR) &&
+           (qp->state != QED_ROCE_QP_STATE_INIT)) {
+
                attr.qp_state = IB_QPS_ERR;
                attr_mask |= IB_QP_STATE;
 
@@ -2626,7 +2636,9 @@ static u32 qedr_prepare_sq_rdma_data(struct qedr_dev *dev,
        rwqe2->r_key = cpu_to_le32(rdma_wr(wr)->rkey);
        DMA_REGPAIR_LE(rwqe2->remote_va, rdma_wr(wr)->remote_addr);
 
-       if (wr->send_flags & IB_SEND_INLINE) {
+       if (wr->send_flags & IB_SEND_INLINE &&
+           (wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM ||
+            wr->opcode == IB_WR_RDMA_WRITE)) {
                u8 flags = 0;
 
                SET_FIELD2(flags, RDMA_SQ_RDMA_WQE_1ST_INLINE_FLG, 1);
@@ -2977,8 +2989,9 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
 
        spin_lock_irqsave(&qp->q_lock, flags);
 
-       if ((qp->state == QED_ROCE_QP_STATE_RESET) ||
-           (qp->state == QED_ROCE_QP_STATE_ERR)) {
+       if ((qp->state != QED_ROCE_QP_STATE_RTS) &&
+           (qp->state != QED_ROCE_QP_STATE_ERR) &&
+           (qp->state != QED_ROCE_QP_STATE_SQD)) {
                spin_unlock_irqrestore(&qp->q_lock, flags);
                *bad_wr = wr;
                DP_DEBUG(dev, QEDR_MSG_CQ,
@@ -3031,8 +3044,7 @@ int qedr_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
 
        spin_lock_irqsave(&qp->q_lock, flags);
 
-       if ((qp->state == QED_ROCE_QP_STATE_RESET) ||
-           (qp->state == QED_ROCE_QP_STATE_ERR)) {
+       if (qp->state == QED_ROCE_QP_STATE_RESET) {
                spin_unlock_irqrestore(&qp->q_lock, flags);
                *bad_wr = wr;
                return -EINVAL;
@@ -3174,6 +3186,7 @@ static int process_req(struct qedr_dev *dev, struct qedr_qp *qp,
 
                /* fill WC */
                wc->status = status;
+               wc->vendor_err = 0;
                wc->wc_flags = 0;
                wc->src_qp = qp->id;
                wc->qp = &qp->ibqp;
@@ -3225,7 +3238,7 @@ static int qedr_poll_cq_req(struct qedr_dev *dev,
                       "Error: POLL CQ with RDMA_CQE_REQ_STS_WORK_REQUEST_FLUSHED_ERR. CQ icid=0x%x, QP icid=0x%x\n",
                       cq->icid, qp->icid);
                cnt = process_req(dev, qp, cq, num_entries, wc, req->sq_cons,
-                                 IB_WC_WR_FLUSH_ERR, 0);
+                                 IB_WC_WR_FLUSH_ERR, 1);
                break;
        default:
                /* process all WQE before the cosumer */
@@ -3363,6 +3376,7 @@ static void __process_resp_one(struct qedr_dev *dev, struct qedr_qp *qp,
 
        /* fill WC */
        wc->status = wc_status;
+       wc->vendor_err = 0;
        wc->src_qp = qp->id;
        wc->qp = &qp->ibqp;
        wc->wr_id = wr_id;
@@ -3391,6 +3405,7 @@ static int process_resp_flush(struct qedr_qp *qp, struct qedr_cq *cq,
        while (num_entries && qp->rq.wqe_cons != hw_cons) {
                /* fill WC */
                wc->status = IB_WC_WR_FLUSH_ERR;
+               wc->vendor_err = 0;
                wc->wc_flags = 0;
                wc->src_qp = qp->id;
                wc->byte_len = 0;
index cd27cbde765249b98331fd1da8f023d134dddd38..d369f24425f94008878b0d9514de16952cbae4af 100644 (file)
@@ -224,7 +224,7 @@ static inline enum comp_state check_psn(struct rxe_qp *qp,
                else
                        return COMPST_DONE;
        } else if ((diff > 0) && (wqe->mask & WR_ATOMIC_OR_READ_MASK)) {
-               return COMPST_ERROR_RETRY;
+               return COMPST_DONE;
        } else {
                return COMPST_CHECK_ACK;
        }
index 16967cdb45dffb6c9841748ac0b13f379d02adb9..342e78163613dfdc719b171e1396d01fd44432eb 100644 (file)
@@ -455,8 +455,7 @@ static int send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
                return -EAGAIN;
        }
 
-       if (pkt->qp)
-               atomic_inc(&pkt->qp->skb_out);
+       atomic_inc(&pkt->qp->skb_out);
        kfree_skb(skb);
 
        return 0;
index c3e60e4bde6e2a3ba5e0953b531a42f65927b717..486d576e55bc016dda1f8ddad6b8f00941f66727 100644 (file)
@@ -855,4 +855,5 @@ void rxe_qp_cleanup(void *arg)
        free_rd_atomic_resources(qp);
 
        kernel_sock_shutdown(qp->sk, SHUT_RDWR);
+       sock_release(qp->sk);
 }
index 7a36ec9dbc0c98cc9907f378e593814fbe26ffcc..3435efff879960cece0c7e122b5960a057f2d4a1 100644 (file)
@@ -1070,12 +1070,13 @@ static enum resp_states duplicate_request(struct rxe_qp *qp,
                                          struct rxe_pkt_info *pkt)
 {
        enum resp_states rc;
+       u32 prev_psn = (qp->resp.psn - 1) & BTH_PSN_MASK;
 
        if (pkt->mask & RXE_SEND_MASK ||
            pkt->mask & RXE_WRITE_MASK) {
                /* SEND. Ack again and cleanup. C9-105. */
                if (bth_ack(pkt))
-                       send_ack(qp, pkt, AETH_ACK_UNLIMITED, qp->resp.psn - 1);
+                       send_ack(qp, pkt, AETH_ACK_UNLIMITED, prev_psn);
                rc = RESPST_CLEANUP;
                goto out;
        } else if (pkt->mask & RXE_READ_MASK) {
index a2f9f29c6ab589e746170ac6463dd6c7781cd20e..fd811115af49ca23c4a5ebbcb3536c589fa056a0 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/init.h>
 #include <linux/seq_file.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "ipoib.h"
 
index 64b3d11dcf1ed588a95d149f2bbd9ff884562893..9104e6b8cac9f7b66322d7ebc573ab6a32fa525a 100644 (file)
@@ -62,7 +62,7 @@
 
 #include <net/sock.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_device.h>
index d84d20b9cec0279a14af084fd9c72700fd9137ca..2186f71c9fe5aaebf511b75f2be7e5f857aa8c63 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <linux/export.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "input-compat.h"
 
 #ifdef CONFIG_COMPAT
index 70a893a17467608a103a81546eb7cce4cdf44010..36a5b93156ed88b048159f4bc02ddc9d4242b9ef 100644 (file)
@@ -165,7 +165,7 @@ static void walkera0701_irq_handler(void *handler_data)
                                RESERVE + BIN1_PULSE - BIN0_PULSE)      /* frame sync .. */
                w->counter = 0;
 
-       hrtimer_start(&w->timer, ktime_set(0, BIN_SAMPLE), HRTIMER_MODE_REL);
+       hrtimer_start(&w->timer, BIN_SAMPLE, HRTIMER_MODE_REL);
 }
 
 static enum hrtimer_restart timer_handler(struct hrtimer
index 638165c78e75bde47b62e090598c1f854db157c2..6423aaccc76346a4a4c9e1c4d73a05a6facc8060 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/input.h>
 #include <linux/types.h>
 #include <linux/acpi.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define ACPI_ATLAS_NAME                "Atlas ACPI"
 #define ACPI_ATLAS_CLASS       "Atlas"
index a7fd8f22ba566ed4d36937987d4b3a5a1f5504d4..a33437c480e368dc2b579c84ea3b075501c76265 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <asm/irq.h>
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/amigahw.h>
 #include <asm/amigaints.h>
 
index d1c43236b12596cc0b7c732485cd7f7271484030..96f2f51604bdb84c3fddc0f7131e3fcad540f3c4 100644 (file)
@@ -47,7 +47,7 @@
 
 #include <asm/irq.h>
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/atarihw.h>
 #include <asm/atarikb.h>
 #include <asm/atariints.h>
index 354d47ecd66a01c8b0ab732eb038bbad19857d19..7331084973e12f75753159833fdf0d1e06126ae8 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/input.h>
 #include <linux/libps2.h>
 #include <linux/proc_fs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "psmouse.h"
 #include "trackpoint.h"
 
index 852858e5d8d08099f28223221edee453257c9c43..559c99ca65920fb76ad345a65fac806c0cb84623 100644 (file)
@@ -79,7 +79,7 @@
 # define sdc_readb(p)          gsc_readb(p)
 # define sdc_writeb(v,p)       gsc_writeb((v),(p))
 #elif defined(__mc68000__)
-# include <asm/uaccess.h>
+#include <linux/uaccess.h>
 # define sdc_readb(p)          in_8(p)
 # define sdc_writeb(v,p)       out_8((p),(v))
 #else
index 73a4e68448fc57fef4a09f0ccaacf19c41790acf..77551f52220275c0589419ced9f7037cc11062b0 100644 (file)
@@ -983,7 +983,11 @@ static int __init i8042_pnp_init(void)
 #if defined(__ia64__)
                return -ENODEV;
 #else
-               pr_info("PNP: No PS/2 controller found. Probing ports directly.\n");
+               pr_info("PNP: No PS/2 controller found.\n");
+               if (x86_platform.legacy.i8042 !=
+                               X86_LEGACY_I8042_EXPECTED_PRESENT)
+                       return -ENODEV;
+               pr_info("Probing ports directly.\n");
                return 0;
 #endif
        }
@@ -1070,8 +1074,8 @@ static int __init i8042_platform_init(void)
 
 #ifdef CONFIG_X86
        u8 a20_on = 0xdf;
-       /* Just return if pre-detection shows no i8042 controller exist */
-       if (!x86_platform.i8042_detect())
+       /* Just return if platform does not have i8042 controller */
+       if (x86_platform.legacy.i8042 == X86_LEGACY_I8042_PLATFORM_ABSENT)
                return -ENODEV;
 #endif
 
index 5a9d521510bf40b13bcf361410589bc2c46ab789..d0fccc8ec259ee4ae98dfeaac9ea770758f75172 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/slab.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/q40_master.h>
 #include <asm/irq.h>
 #include <asm/q40ints.h>
index d189843f3727c52ad360f8f704bb06d6397160f5..f8ead9f9c77eaa7737c1cf94cc1a5dc23051a858 100644 (file)
@@ -13,7 +13,7 @@
  * the Free Software Foundation.
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
index 4613f0aefd087b7dabe28750ed8b1e9de6e64646..d67547bded3ea844e396280e406ce723a08198d5 100644 (file)
@@ -75,7 +75,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/usb/input.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 
 /*
index abf09ac42ce43ef5e32d3202d7fa47f6d8aa2934..b796e891e2eed22e1ffdac3f3098fdf7afbe4ac6 100644 (file)
@@ -56,7 +56,7 @@ Scott Hill shill@gtcocalcomp.com
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/usb.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 #include <asm/byteorder.h>
 #include <linux/bitops.h>
index 019e02707cd5e3c893b3b6602a1847260b3ba401..3ef0f42984f2b1ec716509203988f9ebb70533cb 100644 (file)
@@ -1023,7 +1023,7 @@ again:
        next_tail = (tail + sizeof(*cmd)) % CMD_BUFFER_SIZE;
        left      = (head - next_tail) % CMD_BUFFER_SIZE;
 
-       if (left <= 2) {
+       if (left <= 0x20) {
                struct iommu_cmd sync_cmd;
                int ret;
 
index a88576d50740b2dbdbe6e65b2bfe1985f01c81ca..8ccbd7023194ee592fa91dafb67565d1ad9928aa 100644 (file)
@@ -903,8 +903,10 @@ int __init detect_intel_iommu(void)
                x86_init.iommu.iommu_init = intel_iommu_init;
 #endif
 
-       acpi_put_table(dmar_tbl);
-       dmar_tbl = NULL;
+       if (dmar_tbl) {
+               acpi_put_table(dmar_tbl);
+               dmar_tbl = NULL;
+       }
        up_write(&dmar_global_lock);
 
        return ret ? 1 : -ENODEV;
index c66c273dfd8ab1058030433961fcfaaf2046f846..8a185250ae5a5923d8ab9f34d811caa0f5e09b79 100644 (file)
@@ -2037,6 +2037,25 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
        if (context_present(context))
                goto out_unlock;
 
+       /*
+        * For kdump cases, old valid entries may be cached due to the
+        * in-flight DMA and copied pgtable, but there is no unmapping
+        * behaviour for them, thus we need an explicit cache flush for
+        * the newly-mapped device. For kdump, at this point, the device
+        * is supposed to finish reset at its driver probe stage, so no
+        * in-flight DMA will exist, and we don't need to worry anymore
+        * hereafter.
+        */
+       if (context_copied(context)) {
+               u16 did_old = context_domain_id(context);
+
+               if (did_old >= 0 && did_old < cap_ndoms(iommu->cap))
+                       iommu->flush.flush_context(iommu, did_old,
+                                                  (((u16)bus) << 8) | devfn,
+                                                  DMA_CCMD_MASK_NOBIT,
+                                                  DMA_CCMD_DEVICE_INVL);
+       }
+
        pgd = domain->pgd;
 
        context_clear_entry(context);
@@ -5185,6 +5204,25 @@ static void intel_iommu_remove_device(struct device *dev)
 }
 
 #ifdef CONFIG_INTEL_IOMMU_SVM
+#define MAX_NR_PASID_BITS (20)
+static inline unsigned long intel_iommu_get_pts(struct intel_iommu *iommu)
+{
+       /*
+        * Convert ecap_pss to extend context entry pts encoding, also
+        * respect the soft pasid_max value set by the iommu.
+        * - number of PASID bits = ecap_pss + 1
+        * - number of PASID table entries = 2^(pts + 5)
+        * Therefore, pts = ecap_pss - 4
+        * e.g. KBL ecap_pss = 0x13, PASID has 20 bits, pts = 15
+        */
+       if (ecap_pss(iommu->ecap) < 5)
+               return 0;
+
+       /* pasid_max is encoded as actual number of entries not the bits */
+       return find_first_bit((unsigned long *)&iommu->pasid_max,
+                       MAX_NR_PASID_BITS) - 5;
+}
+
 int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sdev)
 {
        struct device_domain_info *info;
@@ -5217,7 +5255,9 @@ int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sd
 
        if (!(ctx_lo & CONTEXT_PASIDE)) {
                context[1].hi = (u64)virt_to_phys(iommu->pasid_state_table);
-               context[1].lo = (u64)virt_to_phys(iommu->pasid_table) | ecap_pss(iommu->ecap);
+               context[1].lo = (u64)virt_to_phys(iommu->pasid_table) |
+                       intel_iommu_get_pts(iommu);
+
                wmb();
                /* CONTEXT_TT_MULTI_LEVEL and CONTEXT_TT_DEV_IOTLB are both
                 * extended to permit requests-with-PASID if the PASIDE bit
index 8bcee65a0b8c92a22c8d49ac362656a19233e04f..eb0d4d41b15691721ee8b3a6da87d1fada27248a 100644 (file)
@@ -578,13 +578,13 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
 #ifdef CONFIG_SMP
                set_smp_cross_call(armada_mpic_send_doorbell);
                cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_ARMADA_XP_STARTING,
-                                         "AP_IRQ_ARMADA_XP_STARTING",
+                                         "irqchip/armada/ipi:starting",
                                          armada_xp_mpic_starting_cpu, NULL);
 #endif
        } else {
 #ifdef CONFIG_SMP
-               cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_ARMADA_CASC_STARTING,
-                                         "AP_IRQ_ARMADA_CASC_STARTING",
+               cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_ARMADA_XP_STARTING,
+                                         "irqchip/armada/cascade:starting",
                                          mpic_cascaded_starting_cpu, NULL);
 #endif
                irq_set_chained_handler(parent_irq,
index d96b2c947e74e3edab3917551c64fbd1ced0f34c..e7463e3c08143acae3e8cc5682f918c6a0b07ebd 100644 (file)
@@ -245,7 +245,7 @@ bcm2836_arm_irqchip_smp_init(void)
 #ifdef CONFIG_SMP
        /* Unmask IPIs to the boot CPU. */
        cpuhp_setup_state(CPUHP_AP_IRQ_BCM2836_STARTING,
-                         "AP_IRQ_BCM2836_STARTING", bcm2836_cpu_starting,
+                         "irqchip/bcm2836:starting", bcm2836_cpu_starting,
                          bcm2836_cpu_dying);
 
        set_smp_cross_call(bcm2836_arm_irqchip_send_ipi);
index 26e1d7fafb1e088d3e7f389112a1799022bea3ab..c132f29322cc68a13ab76785d6c7d7b77bed542b 100644 (file)
@@ -632,9 +632,9 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
 static void gic_smp_init(void)
 {
        set_smp_cross_call(gic_raise_softirq);
-       cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_GICV3_STARTING,
-                                 "AP_IRQ_GICV3_STARTING", gic_starting_cpu,
-                                 NULL);
+       cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_GIC_STARTING,
+                                 "irqchip/arm/gicv3:starting",
+                                 gic_starting_cpu, NULL);
 }
 
 static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
index d6c404b3584d5118799f8376d384c2f71b728a69..1b1df4f770bdefe0a16e0109624801f8af90f1f7 100644 (file)
@@ -1191,7 +1191,7 @@ static int __init __gic_init_bases(struct gic_chip_data *gic,
                set_smp_cross_call(gic_raise_softirq);
 #endif
                cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_GIC_STARTING,
-                                         "AP_IRQ_GIC_STARTING",
+                                         "irqchip/arm/gic:starting",
                                          gic_starting_cpu, NULL);
                set_handle_irq(gic_handle_irq);
                if (static_key_true(&supports_deactivate))
index 021b0e0833c1f0775c246272b8eeedd0134ddae7..c1b4ee955dbef6e05092efd36e4658ee7d91df4f 100644 (file)
@@ -407,7 +407,7 @@ hip04_of_init(struct device_node *node, struct device_node *parent)
        set_handle_irq(hip04_handle_irq);
 
        hip04_irq_dist_init(&hip04_data);
-       cpuhp_setup_state(CPUHP_AP_IRQ_HIP04_STARTING, "AP_IRQ_HIP04_STARTING",
+       cpuhp_setup_state(CPUHP_AP_IRQ_HIP04_STARTING, "irqchip/hip04:starting",
                          hip04_irq_starting_cpu, NULL);
        return 0;
 }
index c0178a1229402b6e2185d67d3481922ad4994916..c01c09e9916d3f87a6bdbdae79bebeb0f9fffd39 100644 (file)
@@ -152,12 +152,12 @@ static inline void gic_map_to_vpe(unsigned int intr, unsigned int vpe)
 }
 
 #ifdef CONFIG_CLKSRC_MIPS_GIC
-cycle_t gic_read_count(void)
+u64 gic_read_count(void)
 {
        unsigned int hi, hi2, lo;
 
        if (mips_cm_is64)
-               return (cycle_t)gic_read(GIC_REG(SHARED, GIC_SH_COUNTER));
+               return (u64)gic_read(GIC_REG(SHARED, GIC_SH_COUNTER));
 
        do {
                hi = gic_read32(GIC_REG(SHARED, GIC_SH_COUNTER_63_32));
@@ -165,7 +165,7 @@ cycle_t gic_read_count(void)
                hi2 = gic_read32(GIC_REG(SHARED, GIC_SH_COUNTER_63_32));
        } while (hi2 != hi);
 
-       return (((cycle_t) hi) << 32) + lo;
+       return (((u64) hi) << 32) + lo;
 }
 
 unsigned int gic_get_count_width(void)
@@ -179,7 +179,7 @@ unsigned int gic_get_count_width(void)
        return bits;
 }
 
-void gic_write_compare(cycle_t cnt)
+void gic_write_compare(u64 cnt)
 {
        if (mips_cm_is64) {
                gic_write(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE), cnt);
@@ -191,7 +191,7 @@ void gic_write_compare(cycle_t cnt)
        }
 }
 
-void gic_write_cpu_compare(cycle_t cnt, int cpu)
+void gic_write_cpu_compare(u64 cnt, int cpu)
 {
        unsigned long flags;
 
@@ -211,17 +211,17 @@ void gic_write_cpu_compare(cycle_t cnt, int cpu)
        local_irq_restore(flags);
 }
 
-cycle_t gic_read_compare(void)
+u64 gic_read_compare(void)
 {
        unsigned int hi, lo;
 
        if (mips_cm_is64)
-               return (cycle_t)gic_read(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE));
+               return (u64)gic_read(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE));
 
        hi = gic_read32(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_HI));
        lo = gic_read32(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_LO));
 
-       return (((cycle_t) hi) << 32) + lo;
+       return (((u64) hi) << 32) + lo;
 }
 
 void gic_start_count(void)
index 9af48a85c16fcc557e10387ebcc53d346262483c..5e0e250db0be9ed1d12955c35b963ce8fd16f8b2 100644 (file)
@@ -180,7 +180,7 @@ static int st_irq_syscfg_probe(struct platform_device *pdev)
        return st_irq_syscfg_enable(pdev);
 }
 
-static int st_irq_syscfg_resume(struct device *dev)
+static int __maybe_unused st_irq_syscfg_resume(struct device *dev)
 {
        struct st_irq_syscfg *ddata = dev_get_drvdata(dev);
 
index 823f6985b2603198ff7b7ea7c8869db6032ba168..49d0f70c2baee372e824926b37d7394676cb252d 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/moduleparam.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/isdn/capicmd.h>
 #include <linux/isdn/capiutil.h>
 #ifdef AVMB1_COMPAT
index 4d9b195547c5cc253b827c7c6d79d036612e43f6..9fdbd99c7547495556886167a66d9a59e1d6e220 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/slab.h>
 #include <asm/io.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/netdevice.h>
 #include <linux/isdn/capilli.h>
 #include "avmcard.h"
index 19b113faeb7b826b9f57e9ae103ad434ddca43b7..818bd8f231dba327ab623d0adf95baf78568abbb 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/gfp.h>
 #include <asm/io.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/netdevice.h>
 #include <linux/isdn/capilli.h>
 #include "avmcard.h"
index 5d00d72fe482f1300c702efa98bf720e8bfe084f..17beb2869dc17da80d5c56dd02f7a17b16cc2b49 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/netdevice.h>
 #include <linux/isdn/capicmd.h>
 #include <linux/isdn/capiutil.h>
index 997d46abf5b2ba03332074b99cbdc36a9736d5ac..be36d82004d61c01bddc57f40e80fa404478709b 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/seq_file.h>
 #include <linux/skbuff.h>
 
index 0de29b7b712f8d8d0cd92792f76f20b828b3d016..72e58bf07577808bfa3a48db5567cc72bf19683d 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/poll.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "platform.h"
 #include "di_defs.h"
index 4103a8c178d7724b5b4228a0a258e845462351dd..cb88090f9cea3036af14b8e8bcaa9eaeb4d58434 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/proc_fs.h>
 #include <linux/skbuff.h>
 #include <linux/seq_file.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "platform.h"
 #include "di_defs.h"
index 32f34511c416925144e3b04fa2f9051ac5a78e1c..8b7ad4f1ab0160aec609cdfb587b73c03d7c2b12 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
index 56ce98a4e24802c9c5a89311da18ed7807954302..b57efd6ad916aff853ad70657eb88c7b66aa75b4 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/list.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "platform.h"
 #include "debuglib.h"
index eda4741e3f2fc19cf19dd62b1506c9cb7ab66500..4a0425378f37864779135048c097ec1e73cc165a 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "hysdn_defs.h"
 #include "hysdn_pof.h"
index 9719caf7437c3aa71dfa6423ec5b07221f8a2e51..a41896468cb328e89a44e13590a0ae611f413106 100644 (file)
@@ -127,7 +127,7 @@ static int __init ledtrig_cpu_init(void)
 
        register_syscore_ops(&ledtrig_cpu_syscore_ops);
 
-       ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "AP_LEDTRIG_STARTING",
+       ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "leds/trigger:starting",
                                ledtrig_online_cpu, ledtrig_prepare_down_cpu);
        if (ret < 0)
                pr_err("CPU hotplug notifier for ledtrig-cpu could not be registered: %d\n",
index 9e385b38debfd1c9d6a0b374ee8a44098f577e0d..ac219045daf7c0fafa29433237af873bce733719 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/slab.h>
 #include <asm/paravirt.h>
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/poll.h>
 #include <asm/asm-offsets.h>
 #include "lg.h"
index e3abebc912c00a0ffaaa4ba34b09279b394d002b..0bc127e9f16a847bf2924698fd0f8baf846647c2 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/random.h>
 #include <linux/percpu.h>
 #include <asm/tlbflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "lg.h"
 
 /*M:008
index 743253fc638feced540c31871149cc96ae81be0a..d71f6323ac001e0e55c50023521c8d7119087de3 100644 (file)
@@ -45,7 +45,7 @@
 #include <asm/desc.h>
 #include <asm/setup.h>
 #include <asm/lguest.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/fpu/internal.h>
 #include <asm/tlbflush.h>
 #include "../lg.h"
index cd35079c8c98b69469e1e64794b6a7345c382f3b..281fa9e6fc1fee2a0b5caf9bffd2632fe31dc0d2 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/delay.h>
 #include <linux/fs.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sections.h>
 #include <asm/prom.h>
 #include <asm/io.h>
index 08edb2c25b60f0d74921a23160e01b987201c867..227869159ac08198218ef31f7b2eae418db6935f 100644 (file)
@@ -47,7 +47,7 @@
 #include <asm/pmac_feature.h>
 #include <asm/smu.h>
 #include <asm/sections.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define VERSION "0.7"
 #define AUTHOR  "(c) 2005 Benjamin Herrenschmidt, IBM Corp."
index 91081dcdc27214a1344c9717220ddf0cf6d3cd27..43b8db2b54451f769c714b3e75751ab3f83bfa21 100644 (file)
@@ -57,7 +57,7 @@
 #include <asm/pmac_feature.h>
 #include <asm/pmac_pfunc.h>
 #include <asm/pmac_low_i2c.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/cputable.h>
 #include <asm/time.h>
index a00ee41f0573ad458fca83b00be773d0f70716fe..a411c5cb77a18a86e784b70db78008daec27d11d 100644 (file)
@@ -38,7 +38,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Misc minor number allocated for /dev/pmu */
 #define PMU_MINOR      154
index 4a36632c236f09ad9cdde06ff213961c712c3000..4671f8a128723010dafe2d2f6f48df75a492c9fb 100644 (file)
@@ -87,8 +87,7 @@ exit:
 
        if (!err && (chan->txdone_method & TXDONE_BY_POLL))
                /* kick start the timer immediately to avoid delays */
-               hrtimer_start(&chan->mbox->poll_hrt, ktime_set(0, 0),
-                             HRTIMER_MODE_REL);
+               hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
 }
 
 static void tx_tick(struct mbox_chan *chan, int r)
index c72a77048b73befd6ad3de81ebc2be18349958dd..a5a9b17f0f7fcc85c0314a37c0ff880edf8de82b 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/hdreg.h>
 #include <linux/compat.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define DM_MSG_PREFIX "ioctl"
 #define DM_DRIVER_EMAIL "dm-devel@redhat.com"
index efe55a3e80d0c687c46be91a803327fbc50322fd..0c16bb21310109050f461979306408f7ca42866b 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/poll.h>
 #include <linux/ioctl.h>
 #include <linux/wait.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "dmxdev.h"
 
 static int debug;
@@ -562,7 +562,7 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev,
                                 struct dmxdev_filter *filter,
                                 struct dmxdev_feed *feed)
 {
-       ktime_t timeout = ktime_set(0, 0);
+       ktime_t timeout = 0;
        struct dmx_pes_filter_params *para = &filter->params.pes;
        dmx_output_t otype;
        int ret;
index 3ad0b2cd26b11822666e87240719000c8cded6da..bbbff72bbb2af53c2fe255b7e0bc2836558edeed 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/poll.h>
 #include <linux/string.h>
 #include <linux/crc32.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/div64.h>
 
 #include "dvb_demux.h"
index dfc03a95df715560b071dfbc77b7d5421cc46338..bc5e8cfe7ca235134cfcaa5723f27fa146d5d0c5 100644 (file)
@@ -62,7 +62,7 @@
 #include <linux/etherdevice.h>
 #include <linux/dvb/net.h>
 #include <linux/uio.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/crc32.h>
 #include <linux/mutex.h>
 #include <linux/sched.h>
index 7df7fb3738a088bcad69a7a26cbf892669ea93a6..5c4b5a1f604f439562385a6f83609edec4579b9d 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/string.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "dvb_ringbuffer.h"
 
index 05f1dc6c72afc527a4b7e9e32a8e8fc199972cc2..fc9ec0f3679c57f675b9dddbde58ef5d2dd98db1 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index f554809a51e75d5e0102e24a5a8db88ee52a83d3..72139bdae1ca3280848e96a3e0ed9439fb5de415 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index 48176591a80d2dd95d6fdcba40d53cfb8a65361e..54c627859c8ea5d24b15374db4896736ec174b20 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index bbec70c882a38c697d53eccc0eb106060de693c7..0d3f46af25457f5d6e9c4b622abfc19e67c3a0ae 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index e4b3cf49dd38855a5a8a8dc07744bdea37a6af25..59c1a98c5a90307edb117f255517a791ebf4dc9c 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index 81171d8e1c2ccee651472024c78dc8ffe3e583d3..89c28c36c5bf7e5b6e220da6e34c64c1c801dd51 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/i2c/m52790.h>
index 89e458c23983051c436fe1141ad8292022c29bbe..00640233a5e3207bec9c14eb27439e084b6837a3 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/slab.h>
 #include <linux/poll.h>
 #include <linux/wait.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <media/i2c/saa6588.h>
 #include <media/v4l2-device.h>
index 6f49886806ee42e6a3591a8e7605175aeb1a68af..ad456ce051f9f6e2e95a7a88c2214b662e965ec2 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/wait.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index eecad2d1edce60390b66aefa1baa937d9658db2c..119050e1197a4966c4164868f6da1405391c891d 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index 2e06c06cac9baafca1f415ea87fd92830731eabe..cc6104da34ef6f3702b055915b473a4ef0506c0e 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index d6c23bdbcd4aa062818921c13665b99824b86147..ef0d8b8e3df79ccd4c84f26c95ac76c495ff9342 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index 90b693f4e2ab84b4da6b68bf79f5b24fab65149d..ce9f09370e22171167c2ea9f1e31780f40268e77 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/delay.h>
 #include <linux/types.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index f086e5e6e8441778db6fabdd800b995819b64fd3..c885def54b15a0a65ec03d2f19621613e0dc4597 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index 5581f4db02afbdd79e2e856d3999cdd693139c57..45039d7567535e6a3590cd59100a8741c29e5f51 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
index dcfea3502e42c53d47f03f4112ba117fa03ab0ac..c7b3cb406499b0b7d0319f64cc0891e03bcd485a 100644 (file)
@@ -178,8 +178,7 @@ static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer)
        struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer);
 
        cx88_ir_handle_key(ir);
-       missed = hrtimer_forward_now(&ir->timer,
-                                    ktime_set(0, ir->polling * 1000000));
+       missed = hrtimer_forward_now(&ir->timer, ir->polling * 1000000);
        if (missed > 1)
                ir_dprintk("Missed ticks %ld\n", missed - 1);
 
@@ -199,8 +198,7 @@ static int __cx88_ir_start(void *priv)
        if (ir->polling) {
                hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
                ir->timer.function = cx88_ir_work;
-               hrtimer_start(&ir->timer,
-                             ktime_set(0, ir->polling * 1000000),
+               hrtimer_start(&ir->timer, ir->polling * 1000000,
                              HRTIMER_MODE_REL);
        }
        if (ir->sampling) {
index 10cba305dbd282d8d2c3690097de5e7dc4e2d022..6b09a9514d649925028ed6af3358532f109c5218 100644 (file)
@@ -53,7 +53,7 @@
 #include <linux/kthread.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 #include <linux/dvb/video.h>
index e825bc93ea7a9f72d73c00410b6fb20e8c2c43d5..24fba633c21712fa7cc4eec56420dd809a3ea922 100644 (file)
@@ -37,7 +37,7 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-fh.h>
 #include <media/v4l2-event.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
index 7fb649e523f46e543cdc18284068f47c3827c20f..77f4d15f322b2d73e4cf25691ced9fd8f65c261f 100644 (file)
@@ -463,7 +463,7 @@ static int pt3_fetch_thread(void *data)
 
                pt3_proc_dma(adap);
 
-               delay = ktime_set(0, PT3_FETCH_DELAY * NSEC_PER_MSEC);
+               delay = PT3_FETCH_DELAY * NSEC_PER_MSEC;
                set_current_state(TASK_UNINTERRUPTIBLE);
                freezable_schedule_hrtimeout_range(&delay,
                                        PT3_FETCH_DELAY_DELTA * NSEC_PER_MSEC,
index 13a3c07cd259c39800185aec8f2388eb644601ca..3c3cbce0f9ccaa83d965e008126ebcc8ebe29403 100644 (file)
@@ -40,7 +40,7 @@
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #endif
 
 #include "videocodec.h"
index 2170e174c335f345d79e6837df86a88e2ff1145c..94b9b616df989e29d24af197471fb921e3190c73 100644 (file)
@@ -66,7 +66,7 @@
 
 #include <asm/byteorder.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/proc_fs.h>
 
 #include <linux/mutex.h>
index 03c5098499c421e9313d0c4de9838711578f9069..8fe59bf6cd3fc61c7c62026a36389454f4ca23fa 100644 (file)
@@ -34,7 +34,7 @@
 #include <media/v4l2-fh.h>
 #include <linux/mutex.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/m32r.h>
 #include <asm/io.h>
 #include <asm/dma.h>
index 82fb6f2ca01194f3ad593059fa7c84d13481f590..e6efa8c267a062b0aa28b7912e0999ac57ce7e9a 100644 (file)
@@ -109,7 +109,7 @@ static enum hrtimer_restart lirc_rx51_timer_cb(struct hrtimer *timer)
 
                now = timer->base->get_time();
 
-       } while (hrtimer_get_expires_tv64(timer) < now.tv64);
+       } while (hrtimer_get_expires_tv64(timer) < now);
 
        return HRTIMER_RESTART;
 end:
index 70b8a052eb5b9975b6ce2ab333db4eb9e7f8d5a4..3c7ca2c2c108ed41a23469f22c6169adec424e0d 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define BUFFER_COUNT 32
 #define BUFFER_SIZE PAGE_ALIGN(0x4000)
index 3a1618580ed6c6a774713fb44e8c6fcab8d31c5c..655cef39eb3dcdc40ac66f5274824328cfabf6b0 100644 (file)
@@ -39,7 +39,7 @@
 /* Control functions for the cam; brightness, contrast, video mode, etc. */
 
 #ifdef __KERNEL__
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #endif
 #include <asm/errno.h>
 
index 57cfe26a393f613361442b6435195b8726f3bb4a..a5ea1f51729103499c58f3b327ef24252561e526 100644 (file)
@@ -54,7 +54,7 @@
 #if defined(CONFIG_SPI)
 #include <linux/spi/spi.h>
 #endif
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/div64.h>
index 8be561ab26159f525558dcb391225614ddec9c66..fa2124cb31bd380436734211319a291ad135146e 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/init.h>
 #include <linux/kmod.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <media/v4l2-common.h>
 #include <media/v4l2-device.h>
index 02b5f69e1a423f2dd44eede58aaf010d55f3c9d9..7b3b413689316bdfdf0bf73f1fe7a861c00e7463 100644 (file)
@@ -58,7 +58,7 @@
 #include <linux/compat.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
index 69e9d5463564857f610f74c0132f9e311ab59290..8946e19dbfc82107c958e5f36008d42485ec7e1d 100644 (file)
@@ -70,7 +70,7 @@
 #include <linux/workqueue.h>
 #include <linux/delay.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
     /* Override mptbase.h by pre-defining these! */
index 520f5843908023e7ae654b913f45ee9dd581751f..e05c3245930a1e3f94aad4c0a7f85e015759ec76 100644 (file)
@@ -76,7 +76,7 @@
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include "ibmasm.h"
 #include "remote.h"
index 0037153c80a6ad27a7949be67d0f643e52b23edd..2d9c5dd06e423266680294e4d806e2e736d32156 100644 (file)
@@ -450,7 +450,7 @@ bool mei_cldev_enabled(struct mei_cl_device *cldev)
 EXPORT_SYMBOL_GPL(mei_cldev_enabled);
 
 /**
- * mei_cldev_enable_device - enable me client device
+ * mei_cldev_enable - enable me client device
  *     create connection with me client
  *
  * @cldev: me client device
index 391936c1aa041c5bd925d284aa593e65b5ce1065..b0395601c6ae83340f62cd801531632134b85a7a 100644 (file)
@@ -1541,7 +1541,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
 
        rets = first_chunk ? mei_cl_tx_flow_ctrl_creds(cl) : 1;
        if (rets < 0)
-               return rets;
+               goto err;
 
        if (rets == 0) {
                cl_dbg(dev, cl, "No flow control credentials: not sending.\n");
@@ -1575,11 +1575,8 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
                        cb->buf.size, cb->buf_idx);
 
        rets = mei_write_message(dev, &mei_hdr, buf->data + cb->buf_idx);
-       if (rets) {
-               cl->status = rets;
-               list_move_tail(&cb->list, &cmpl_list->list);
-               return rets;
-       }
+       if (rets)
+               goto err;
 
        cl->status = 0;
        cl->writing_state = MEI_WRITING;
@@ -1587,14 +1584,21 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
        cb->completed = mei_hdr.msg_complete == 1;
 
        if (first_chunk) {
-               if (mei_cl_tx_flow_ctrl_creds_reduce(cl))
-                       return -EIO;
+               if (mei_cl_tx_flow_ctrl_creds_reduce(cl)) {
+                       rets = -EIO;
+                       goto err;
+               }
        }
 
        if (mei_hdr.msg_complete)
                list_move_tail(&cb->list, &dev->write_waiting_list.list);
 
        return 0;
+
+err:
+       cl->status = rets;
+       list_move_tail(&cb->list, &cmpl_list->list);
+       return rets;
 }
 
 /**
index bab3f07b1117ea819e74758a50b15b54155087f4..cb1698f268f19023429df520713f20a3de6f6d25 100644 (file)
@@ -43,7 +43,7 @@
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/sd.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "queue.h"
 #include "block.h"
index dca5518b01395a31e98f3a91a2df14736e063652..590a8a4522bed3dd962eb7c4f5cac6a97953f420 100644 (file)
@@ -49,7 +49,7 @@
 
 #include <asm/types.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define DRIVER_NAME "goldfish_mmc"
 
index 220f9200fa52f4bf01178d3b61dbc1926b3bca80..cadea0620cd0547f2698fb1eaef880059dfec676 100644 (file)
@@ -82,7 +82,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/ptrace.h>
index a70eb83e68f12cb82fc6d30f55261883191ce196..8087c36dc6935a8d6caf6d4b770be4fba60e1319 100644 (file)
@@ -30,7 +30,7 @@
 
 
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/ptrace.h>
index 9fb3b0dcdac20cd653387c6d382a0f92daec68c7..664d206a4cbee2c51bf1edcfb8cbfb6c78d200fc 100644 (file)
@@ -70,7 +70,7 @@
 #include <linux/hdreg.h>
 #include <linux/vmalloc.h>
 #include <linux/blkpg.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/mtd/ftl.h>
 
index b66b541877f0aea5c84e947f72bb45b557fc403a..8db740d6eb08117404d2c8e5f02779fcf3bf8829 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/mtd/nftl.h>
 #include <linux/mtd/inftl.h>
 #include <linux/mtd/nand.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/errno.h>
 #include <asm/io.h>
 
index 1388c8d7f309cba12ca501235c5a555a77bd4e52..8d6bb189ea8ed2948435049b829fda0787f5cd48 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/module.h>
 #include <asm/errno.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/mtd/mtd.h>
index d459aca07881d6687045463481a3d51757f39df2..414956eca0c9ee25d2dbe6ebd7f1d5389aef1b80 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/of_device.h>
 #include <linux/slab.h>
 #include <asm/prom.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 #include <linux/mtd/mtd.h>
index 8d58acf33021b5aa8723d50501c30eb9f92ed352..df8a5ef334c0a42e78cfd6e382d413916bd6f2a6 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/spinlock.h>
 #include <linux/hdreg.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "mtdcore.h"
 
index 2a47a3f0e7308ea13b31391d77e8dab83f536dfe..ce5ccc573a9c11a06572e69c03d2356170b1c739 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "mtdcore.h"
 
index 46f27de018c34e35313a559576d850283933d51a..e21161353e76c6a5fb7d68c3f6c01010f8209c04 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/module.h>
 #include <asm/errno.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/init.h>
index 31f89f1c61233365fd3153ca5f30f171b03ead5e..b8c293373eccd8293ab50fea6a4ce25b1745076b 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/if_arp.h>
 #include <linux/slab.h>
 #include <net/route.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "ipddp.h"             /* Our stuff */
 
index 52fe50725d749665b629ad9a78e6447d14b60cf4..4063215c9b54b0bd4f6a4975037f2983e03f554c 100644 (file)
@@ -390,7 +390,7 @@ static void softing_initialize_timestamp(struct softing *card)
        ovf = 0x100000000ULL * 16;
        do_div(ovf, card->pdat->freq ?: 16);
 
-       card->ts_overflow = ktime_add_us(ktime_set(0, 0), ovf);
+       card->ts_overflow = ktime_add_us(0, ovf);
 }
 
 ktime_t softing_raw2ktime(struct softing *card, u32 raw)
@@ -647,7 +647,7 @@ int softing_startstop(struct net_device *dev, int up)
                open_candev(netdev);
                if (dev != netdev) {
                        /* notify other busses on the restart */
-                       softing_netdev_rx(netdev, &msg, ktime_set(0, 0));
+                       softing_netdev_rx(netdev, &msg, 0);
                        ++priv->can.can_stats.restarts;
                }
                netif_wake_queue(netdev);
index 7621f91a8a209e9de74d55de14fbb31947c449ee..5f64deec9f6c1c4d7ef2ca2eb64d385a3da41df4 100644 (file)
@@ -192,7 +192,7 @@ static int softing_handle_1(struct softing *card)
                                /* a dead bus has no overflows */
                                continue;
                        ++netdev->stats.rx_over_errors;
-                       softing_netdev_rx(netdev, &msg, ktime_set(0, 0));
+                       softing_netdev_rx(netdev, &msg, 0);
                }
                /* prepare for other use */
                memset(&msg, 0, sizeof(msg));
index a10ad74cc8d2225a40a7f1afd261c88834a6458a..fe13bfea30ac80b1e61a50b36d9ddfa0b1e90839 100644 (file)
 #include <linux/if_eql.h>
 #include <linux/pkt_sched.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static int eql_open(struct net_device *dev);
 static int eql_close(struct net_device *dev);
index a7533780dddc011cddbb96556cc5adae5d09bcc5..c7f9f2c77da72aefe4c9eb091216850f8e53f6b2 100644 (file)
@@ -88,7 +88,7 @@
 #include <linux/eisa.h>
 #include <linux/bitops.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 
index be5b80103bec8a7805405b0b5f82e53c9aa9c535..e7b1fa56b2904b68d01051640638f9f969557a78 100644 (file)
@@ -72,7 +72,7 @@ static int max_interrupt_work = 20;
 #include <linux/ethtool.h>
 #include <linux/bitops.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 
index 9359a37fedc075fe82474e0a42726bfd9c22e3b3..47c844cc9d2733cabcce27010ad4d4c604bbe9d6 100644 (file)
@@ -92,7 +92,7 @@ earlier 3Com products.
 #include <pcmcia/ciscode.h>
 #include <pcmcia/ds.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 /*====================================================================*/
index b3560a364e536666d7e22dd08700e5eb3267439a..40196f41768a00b9ae63e0ee3d99547b8e7d5f39 100644 (file)
@@ -92,7 +92,7 @@ static int vortex_debug = 1;
 #include <linux/gfp.h>
 #include <asm/irq.h>                   /* For nr_irqs only. */
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Kernel compatibility defines, some common to David Hinds' PCMCIA package.
    This is only in the support-all-kernels source code. */
index a0cacbe846ba3347cf5d1d62a8e3ad84a5b83428..9fe3990319ecd771b103f62f79ffc27a5256cb80 100644 (file)
@@ -119,7 +119,7 @@ static const int multicast_filter_limit = 32;
 #include <linux/bitops.h>
 #include <asm/processor.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/in6.h>
 #include <linux/dma-mapping.h>
 #include <linux/firmware.h>
index 1d84a0544ace95224906572bc5a50919819763da..3da1fc539ef98140003fe11de2f6243d6e5fd939 100644 (file)
@@ -46,7 +46,7 @@
 
 #include <asm/io.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define AXNET_CMD      0x00
 #define AXNET_DATAPORT 0x10    /* NatSemi-defined port window offset. */
index 07355302443d8d4dcefe3ef0fb89a4e426a7526f..1bdea746926c16c722c9da22e4b675903fec505a 100644 (file)
@@ -54,7 +54,7 @@ static int options[MAX_UNITS];
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "8390.h"
 
index 63079a6e20d94910748b49787e84dbca0cd6df4b..bd0a2a14b64990f11c0e111d3823335f169f9d80 100644 (file)
@@ -49,7 +49,7 @@
 
 #include <asm/io.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define PCNET_CMD      0x00
 #define PCNET_DATAPORT 0x10    /* NatSemi-defined port window offset. */
index 3aaad33cdbc6f48d19f1646a6565ae81be96a91e..c12d2618eebf76397b2e71eaeb6f2fafa938fea6 100644 (file)
@@ -45,7 +45,7 @@
 #include <linux/mm.h>
 #include <linux/firmware.h>
 #include <asm/processor.h>             /* Processor type for cache alignment. */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 /*
index 16f0c70266bce75f503a7910709fa67684898539..a1a52eb53b145b1af7b0f414be3f8510a398f420 100644 (file)
@@ -80,7 +80,7 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 #define DRV_NAME "acenic"
index 11cf1e3e0295def5bf7056aceec892692db3c026..9595f1bc535b73306720e4d0005fe58d20256767 100644 (file)
@@ -87,7 +87,7 @@ Revision History:
 
 #include <asm/io.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #if IS_ENABLED(CONFIG_VLAN_8021Q)
 #define AMD8111E_VLAN_TAG_USED 1
index 113a3b3cc50c9d5f6df5fc2267b79f6cc2828c08..b556c926557a10599b1148ba52d7fcf39d6030bd 100644 (file)
@@ -151,7 +151,7 @@ Include Files
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 /* ----------------------------------------------------------------------------
index b03e4f58d02ea550b4a19d7e4f7113ec3b48e4e0..a533a6cc2d530258c3875150565d35aa6fa55fc5 100644 (file)
 #include "xgbe.h"
 #include "xgbe-common.h"
 
-static cycle_t xgbe_cc_read(const struct cyclecounter *cc)
+static u64 xgbe_cc_read(const struct cyclecounter *cc)
 {
        struct xgbe_prv_data *pdata = container_of(cc,
                                                   struct xgbe_prv_data,
index 1df3048a3cdb00b7322e45d95a9efa918a8aec94..48707ed76ffcb44f037992887476bb2cf556dd6f 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/slab.h>
 #include <linux/phy.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 
index 25d1eb4933d0b8b28dc53d07344eb6a47a263893..7e8cf213fd813d8530f65c8439a77fd16ffeff9b 100644 (file)
@@ -1012,15 +1012,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
                goto out;
        }
 
-       /* Insert TSB and checksum infos */
-       if (priv->tsb_en) {
-               skb = bcm_sysport_insert_tsb(skb, dev);
-               if (!skb) {
-                       ret = NETDEV_TX_OK;
-                       goto out;
-               }
-       }
-
        /* The Ethernet switch we are interfaced with needs packets to be at
         * least 64 bytes (including FCS) otherwise they will be discarded when
         * they enter the switch port logic. When Broadcom tags are enabled, we
@@ -1028,13 +1019,21 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
         * (including FCS and tag) because the length verification is done after
         * the Broadcom tag is stripped off the ingress packet.
         */
-       if (skb_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) {
+       if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) {
                ret = NETDEV_TX_OK;
                goto out;
        }
 
-       skb_len = skb->len < ETH_ZLEN + ENET_BRCM_TAG_LEN ?
-                       ETH_ZLEN + ENET_BRCM_TAG_LEN : skb->len;
+       /* Insert TSB and checksum infos */
+       if (priv->tsb_en) {
+               skb = bcm_sysport_insert_tsb(skb, dev);
+               if (!skb) {
+                       ret = NETDEV_TX_OK;
+                       goto out;
+               }
+       }
+
+       skb_len = skb->len;
 
        mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
        if (dma_mapping_error(kdev, mapping)) {
index 688617ac8c29b5b3db2d6ade057d3a79c360d998..d8d06fdfc42b9d685244513c1542b69bd78d7ca9 100644 (file)
@@ -15223,7 +15223,7 @@ void bnx2x_set_rx_ts(struct bnx2x *bp, struct sk_buff *skb)
 }
 
 /* Read the PHC */
-static cycle_t bnx2x_cyclecounter_read(const struct cyclecounter *cc)
+static u64 bnx2x_cyclecounter_read(const struct cyclecounter *cc)
 {
        struct bnx2x *bp = container_of(cc, struct bnx2x, cyclecounter);
        int port = BP_PORT(bp);
index 92be2cd8f817caef709fce5de320663bd44c9dc8..9906fda76087c013da8f1b2ca73a3cf5709480d3 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * macb_pci.c - Cadence GEM PCI wrapper.
+ * Cadence GEM PCI wrapper.
  *
  * Copyright (C) 2016 Cadence Design Systems - http://www.cadence.com
  *
@@ -45,32 +45,27 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        struct macb_platform_data plat_data;
        struct resource res[2];
 
-       /* sanity check */
-       if (!id)
-               return -EINVAL;
-
        /* enable pci device */
-       err = pci_enable_device(pdev);
+       err = pcim_enable_device(pdev);
        if (err < 0) {
-               dev_err(&pdev->dev, "Enabling PCI device has failed: 0x%04X",
-                       err);
-               return -EACCES;
+               dev_err(&pdev->dev, "Enabling PCI device has failed: %d", err);
+               return err;
        }
 
        pci_set_master(pdev);
 
        /* set up resources */
        memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res));
-       res[0].start = pdev->resource[0].start;
-       res[0].end = pdev->resource[0].end;
+       res[0].start = pci_resource_start(pdev, 0);
+       res[0].end = pci_resource_end(pdev, 0);
        res[0].name = PCI_DRIVER_NAME;
        res[0].flags = IORESOURCE_MEM;
-       res[1].start = pdev->irq;
+       res[1].start = pci_irq_vector(pdev, 0);
        res[1].name = PCI_DRIVER_NAME;
        res[1].flags = IORESOURCE_IRQ;
 
-       dev_info(&pdev->dev, "EMAC physical base addr = 0x%p\n",
-                (void *)(uintptr_t)pci_resource_start(pdev, 0));
+       dev_info(&pdev->dev, "EMAC physical base addr: %pa\n",
+                &res[0].start);
 
        /* set up macb platform data */
        memset(&plat_data, 0, sizeof(plat_data));
@@ -100,7 +95,7 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        plat_info.num_res = ARRAY_SIZE(res);
        plat_info.data = &plat_data;
        plat_info.size_data = sizeof(plat_data);
-       plat_info.dma_mask = DMA_BIT_MASK(32);
+       plat_info.dma_mask = pdev->dma_mask;
 
        /* register platform device */
        plat_dev = platform_device_register_full(&plat_info);
@@ -120,7 +115,6 @@ err_hclk_register:
        clk_unregister(plat_data.pclk);
 
 err_pclk_register:
-       pci_disable_device(pdev);
        return err;
 }
 
@@ -130,7 +124,6 @@ static void macb_remove(struct pci_dev *pdev)
        struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev);
 
        platform_device_unregister(plat_dev);
-       pci_disable_device(pdev);
        clk_unregister(plat_data->pclk);
        clk_unregister(plat_data->hclk);
 }
index bbc8bd16cb971d6e2df3035d20ccd4151791a660..dcbce6cac63e2db7a936a7feea312b25ba3f2421 100644 (file)
@@ -77,7 +77,7 @@ config OCTEON_MGMT_ETHERNET
 config LIQUIDIO_VF
        tristate "Cavium LiquidIO VF support"
        depends on 64BIT && PCI_MSI
-       select PTP_1588_CLOCK
+       imply PTP_1588_CLOCK
        ---help---
          This driver supports Cavium LiquidIO Intelligent Server Adapter
          based on CN23XX chips.
index 3a05f9098e759653b671be72e73135d04491a984..d8aff7a4b3c7cc087139cfefc022b4e8cf75fda5 100644 (file)
@@ -44,7 +44,7 @@
 #include <linux/mii.h>
 #include <linux/sockios.h>
 #include <linux/dma-mapping.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "cpl5_cmd.h"
 #include "regs.h"
index 7b2224ae72f238bed5325325bc965726474f7e70..d76491676b5175e52b383e8c17760859b4f69040 100644 (file)
@@ -50,7 +50,7 @@
 #include <linux/stringify.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "common.h"
 #include "cxgb3_ioctl.h"
index 66c37fac59b27193a1963469d53ac3e0d0c78fac..6f951877430bd51db55c0075b176f79480d1e4b4 100644 (file)
@@ -63,7 +63,7 @@
 #include <net/addrconf.h>
 #include <net/bonding.h>
 #include <net/addrconf.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/crash_dump.h>
 
 #include "cxgb4.h"
index fba3b2ad382d61d31fa20210001361fc3bbc6d9c..a267173f59972f174947578935189b1e474dc94b 100644 (file)
@@ -76,6 +76,7 @@ enum {
        CPL_PASS_ESTABLISH    = 0x41,
        CPL_RX_DATA_DDP       = 0x42,
        CPL_PASS_ACCEPT_REQ   = 0x44,
+       CPL_RX_ISCSI_CMP      = 0x45,
        CPL_TRACE_PKT_T5      = 0x48,
        CPL_RX_ISCSI_DDP      = 0x49,
 
@@ -934,6 +935,18 @@ struct cpl_iscsi_data {
        __u8 status;
 };
 
+struct cpl_rx_iscsi_cmp {
+       union opcode_tid ot;
+       __be16 pdu_len_ddp;
+       __be16 len;
+       __be32 seq;
+       __be16 urg;
+       __u8 rsvd;
+       __u8 status;
+       __be32 ulp_crc;
+       __be32 ddpvld;
+};
+
 struct cpl_tx_data_iso {
        __be32 op_to_scsi;
        __u8   reserved1;
index 0f0de5b63622d8ebfb98c124d5768e806a3689e8..d04a6c1634452034217e9dc4ab8771bf02899b86 100644 (file)
@@ -133,17 +133,15 @@ cxgb_find_route6(struct cxgb4_lld_info *lldi,
                if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL)
                        fl6.flowi6_oif = sin6_scope_id;
                dst = ip6_route_output(&init_net, NULL, &fl6);
-               if (!dst)
-                       goto out;
-               if (!cxgb_our_interface(lldi, get_real_dev,
-                                       ip6_dst_idev(dst)->dev) &&
-                   !(ip6_dst_idev(dst)->dev->flags & IFF_LOOPBACK)) {
+               if (dst->error ||
+                   (!cxgb_our_interface(lldi, get_real_dev,
+                                        ip6_dst_idev(dst)->dev) &&
+                    !(ip6_dst_idev(dst)->dev->flags & IFF_LOOPBACK))) {
                        dst_release(dst);
-                       dst = NULL;
+                       return NULL;
                }
        }
 
-out:
        return dst;
 }
 EXPORT_SYMBOL(cxgb_find_route6);
index 90c573b8ccafe027ecf1716c66b545464bd75553..57c17e797ae3a060fb6215be8bf7de372b54e1ac 100644 (file)
@@ -49,7 +49,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 
 /* These identify the driver base version and may not be removed. */
index 51fda3a6b13f85162194e29adb326d7452d71d2e..df4a871df633d269436a30bb108f157143b692a2 100644 (file)
 #include <asm/dma.h>
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #ifdef CONFIG_PPC_PMAC
 #include <asm/machdep.h>
 #endif /* CONFIG_PPC_PMAC */
index df499491945601766f528d90657789e62219bfc3..07e10a45beaafdb3f129561e69b764189692f4a4 100644 (file)
@@ -90,7 +90,7 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq.h>
 
 #ifdef CONFIG_TULIP_DM910X
index 5f1377449b8f79f88eae3789f9ee3b28a39d6e8d..17e566a8b345ceb59ca6ed475b330e77847832d6 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/mii.h>
 #include <linux/crc32.h>
 #include <asm/unaligned.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_SPARC
 #include <asm/prom.h>
index e1c4133b8787b89e8c3b40f55b16b7a0c33e0ec5..f82ebe5d89ee726851678d6972c42e01945d2503 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define uw32(reg, val) iowrite32(val, ioaddr + (reg))
 #define ur32(reg)      ioread32(ioaddr + (reg))
index feda96d585e7b678a0dc2b1f483c8e1e6462eeee..bc9bf88e5831a8ca7b3286a1a97c3b6b01ca6eb7 100644 (file)
@@ -129,7 +129,7 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 #include <linux/rtnetlink.h>
 #include <linux/crc32.h>
 #include <linux/bitops.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>             /* Processor type for cache alignment. */
 #include <asm/io.h>
 #include <asm/irq.h>
index 19e4ea15b504ad2dd2555f98530d72da79cb71ac..a8de7935557800805d0a0eae78d70cccd7f14d68 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/delay.h>
 #include <linux/bitops.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #ifdef CONFIG_NET_POLL_CONTROLLER
 #include <asm/irq.h>
index 8f4f61262d5cb7be21d994d7ffb411a654ae589b..5d8ae5320242635ced82ce1267277c63a9c91a0f 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/bitops.h>
 #include <asm/processor.h>     /* Processor type for cache alignment. */
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/delay.h>
 #include <linux/spinlock.h>
 #include <linux/time.h>
index eab36acfc0d1b7aaa827c2b2c5cac462cb62bde5..2e5b66762e152fb1d68ba3fea4bcfac0cc06e47e 100644 (file)
@@ -91,7 +91,7 @@ static char *media[MAX_UNITS];
 #include <linux/skbuff.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>             /* Processor type for cache alignment. */
 #include <asm/io.h>
 #include <linux/delay.h>
index 57650953ff83e127ecdcb3e606114d619d49db18..7bf78a0d322cc0efe9c4c793359ae5980b55e29d 100644 (file)
@@ -253,7 +253,7 @@ static enum hrtimer_restart ec_bhf_timer_fun(struct hrtimer *timer)
        if (!netif_running(priv->net_dev))
                return HRTIMER_NORESTART;
 
-       hrtimer_forward_now(timer, ktime_set(0, polling_frequency));
+       hrtimer_forward_now(timer, polling_frequency);
        return HRTIMER_RESTART;
 }
 
@@ -427,8 +427,7 @@ static int ec_bhf_open(struct net_device *net_dev)
 
        hrtimer_init(&priv->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        priv->hrtimer.function = ec_bhf_timer_fun;
-       hrtimer_start(&priv->hrtimer, ktime_set(0, polling_frequency),
-                     HRTIMER_MODE_REL);
+       hrtimer_start(&priv->hrtimer, polling_frequency, HRTIMER_MODE_REL);
 
        return 0;
 
index 6cfa63a5e9b48b7f181f0d59916e17cf3f6b55f8..4c30c44b242e67e59d52f5cc00a230ba81ba68d4 100644 (file)
@@ -65,7 +65,7 @@
 /* Number of bytes of an RX frame that are copied to skb->data */
 #define BE_HDR_LEN             ((u16) 64)
 /* allocate extra space to allow tunneling decapsulation without head reallocation */
-#define BE_RX_SKB_ALLOC_SIZE (BE_HDR_LEN + 64)
+#define BE_RX_SKB_ALLOC_SIZE   256
 
 #define BE_MAX_JUMBO_FRAME_SIZE        9018
 #define BE_MIN_MTU             256
index 7e1633bf5a22ccf1c9c123ba541349b5dfea1064..225e9a4877d7b16e058cfa7c0dac9ccb5434bb5b 100644 (file)
@@ -5155,7 +5155,9 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
            skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
            skb->inner_protocol != htons(ETH_P_TEB) ||
            skb_inner_mac_header(skb) - skb_transport_header(skb) !=
-           sizeof(struct udphdr) + sizeof(struct vxlanhdr))
+               sizeof(struct udphdr) + sizeof(struct vxlanhdr) ||
+           !adapter->vxlan_port ||
+           udp_hdr(skb)->dest != adapter->vxlan_port)
                return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
 
        return features;
index 6967b287b6e762342eb0f02f0851a4309dea7330..9cb436cb37454c78c75e5724a7b51a119c654b45 100644 (file)
@@ -88,7 +88,7 @@ static int full_duplex[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
 
 #include <asm/processor.h>     /* Processor type for cache alignment. */
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 /* These identify the driver base version and may not be removed. */
index 624ba9058dc46bd369f7be872b040aee1e814696..c9b7ad65e5633bc2a5147706f5c728f4d1cffa3c 100644 (file)
@@ -733,6 +733,7 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv)
        priv->cgr_data.cgr.cb = dpaa_eth_cgscn;
 
        /* Enable Congestion State Change Notifications and CS taildrop */
+       memset(&initcgr, 0, sizeof(initcgr));
        initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES);
        initcgr.cgr.cscn_en = QM_CGR_EN;
 
@@ -2291,7 +2292,8 @@ static int dpaa_open(struct net_device *net_dev)
        net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev);
        if (!net_dev->phydev) {
                netif_err(priv, ifup, net_dev, "init_phy() failed\n");
-               return -ENODEV;
+               err = -ENODEV;
+               goto phy_init_failed;
        }
 
        for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
@@ -2314,6 +2316,7 @@ mac_start_failed:
        for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++)
                fman_port_disable(mac_dev->port[i]);
 
+phy_init_failed:
        dpaa_eth_napi_disable(priv);
 
        return err;
@@ -2420,6 +2423,7 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv *priv)
        }
 
        /* Enable CS TD, but disable Congestion State Change Notifications. */
+       memset(&initcgr, 0, sizeof(initcgr));
        initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES);
        initcgr.cgr.cscn_en = QM_CGR_EN;
        cs_th = DPAA_INGRESS_CS_THRESHOLD;
index f9e74461bdc0b089c64b751571e8a999a050433b..6ebad3fac81d17e3513de1f7c3d9eec31e56b71e 100644 (file)
@@ -230,7 +230,7 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)
  * cyclecounter structure used to construct a ns counter from the
  * arbitrary fixed point registers
  */
-static cycle_t fec_ptp_read(const struct cyclecounter *cc)
+static u64 fec_ptp_read(const struct cyclecounter *cc)
 {
        struct fec_enet_private *fep =
                container_of(cc, struct fec_enet_private, cc);
index d9f3a480ca1bc3ac8148afe861ada34b57bdbaa8..1f98838f32b7772ebb1920f5f5e5644fa7b6e77e 100644 (file)
@@ -44,7 +44,7 @@
 #include <linux/vmalloc.h>
 #include <asm/pgtable.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "fs_enet.h"
 
index 120c758f5d018cf0d0331749ad6e3cacec66f6c0..6e64989f84783ea1ffe327b06228f156e6e34d8f 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "fs_enet.h"
 
index 777beffa1e1e900d0b6e87fde3742cfa921ea83e..db9c0bcf54cd9308cfac3533e2603f21955b99b5 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/gfp.h>
 
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_8xx
 #include <asm/8xx_immap.h>
index 15abd37d70e3a587dc603947303ed9ce262d0027..96d44cf44fe09f4e3d8b5ff0270869a92315ad59 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/of_platform.h>
 
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_8xx
 #include <asm/8xx_immap.h>
index a89267b94352a33c0749cc9786c0ef489061b873..1582d82483ecac10e14f62057770d194d8b417a2 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mpc5xxx.h>
 
 #include "fs_enet.h"
index 756f7e763d5f9cac17e0cc3909b14379d11b240a..a6e7afa878befd1abe00404b2cd4becfa174d103 100644 (file)
@@ -93,7 +93,7 @@
 #include <asm/mpc85xx.h>
 #endif
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/dma-mapping.h>
 #include <linux/crc32.h>
index 6e8a9c8467b9a62f8383b9b692ceabeb9ad1cf42..5aa814799d70e8a7c91719975a1fbde972bc0e30 100644 (file)
@@ -40,7 +40,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/crc32.h>
 #include <linux/workqueue.h>
index 56588f2e1d91ca6a3128afcdd679c6f5d911692e..a93e0199c3692b2098d13cd75ded6773bd1f20db 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/crc32.h>
 #include <asm/types.h>
index 53c5fcf1436cfaf322120f3bbaeb4066aa8cfa81..9d660888510f3f007905eaa7f8b5dede6eea9d85 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/of_net.h>
 #include <linux/of_platform.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq.h>
 #include <asm/io.h>
 #include <soc/fsl/qe/immap_qe.h>
index 8ba636f61b5063a5978e647145cc0963de74389f..b642990b549c2c2414937bb9479f494b05971aec 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/types.h>
 
 #include "ucc_geth.h"
index 51c4abc51bf4837156c3579ee663da9def9093fe..a69cd19a55ae2f018cf5340f0f2680bff5f36c86 100644 (file)
@@ -54,7 +54,7 @@
 #include <pcmcia/ciscode.h>
 #include <pcmcia/ds.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 /*====================================================================*/
index 52a69c925965200e304d447713acb8360f06eeb6..5909615c27f7cb2629217a87e00537ca694b1680 100644 (file)
@@ -47,7 +47,7 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/dcr.h>
 #include <asm/dcr-regs.h>
 
index ffcf35af48814f44312561536090635a69473230..eccf1da9356badc85df416cca1a519bb1ec417bc 100644 (file)
@@ -4305,24 +4305,24 @@ void e1000e_reinit_locked(struct e1000_adapter *adapter)
 /**
  * e1000e_sanitize_systim - sanitize raw cycle counter reads
  * @hw: pointer to the HW structure
- * @systim: cycle_t value read, sanitized and returned
+ * @systim: time value read, sanitized and returned
  *
  * Errata for 82574/82583 possible bad bits read from SYSTIMH/L:
  * check to see that the time is incrementing at a reasonable
  * rate and is a multiple of incvalue.
  **/
-static cycle_t e1000e_sanitize_systim(struct e1000_hw *hw, cycle_t systim)
+static u64 e1000e_sanitize_systim(struct e1000_hw *hw, u64 systim)
 {
        u64 time_delta, rem, temp;
-       cycle_t systim_next;
+       u64 systim_next;
        u32 incvalue;
        int i;
 
        incvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK;
        for (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) {
                /* latch SYSTIMH on read of SYSTIML */
-               systim_next = (cycle_t)er32(SYSTIML);
-               systim_next |= (cycle_t)er32(SYSTIMH) << 32;
+               systim_next = (u64)er32(SYSTIML);
+               systim_next |= (u64)er32(SYSTIMH) << 32;
 
                time_delta = systim_next - systim;
                temp = time_delta;
@@ -4342,13 +4342,13 @@ static cycle_t e1000e_sanitize_systim(struct e1000_hw *hw, cycle_t systim)
  * e1000e_cyclecounter_read - read raw cycle counter (used by time counter)
  * @cc: cyclecounter structure
  **/
-static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
+static u64 e1000e_cyclecounter_read(const struct cyclecounter *cc)
 {
        struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter,
                                                     cc);
        struct e1000_hw *hw = &adapter->hw;
        u32 systimel, systimeh;
-       cycle_t systim;
+       u64 systim;
        /* SYSTIMH latching upon SYSTIML read does not work well.
         * This means that if SYSTIML overflows after we read it but before
         * we read SYSTIMH, the value of SYSTIMH has been incremented and we
@@ -4368,8 +4368,8 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
                        systimel = systimel_2;
                }
        }
-       systim = (cycle_t)systimel;
-       systim |= (cycle_t)systimeh << 32;
+       systim = (u64)systimel;
+       systim |= (u64)systimeh << 32;
 
        if (adapter->flags2 & FLAG2_CHECK_SYSTIM_OVERFLOW)
                systim = e1000e_sanitize_systim(hw, systim);
index ad03763e009ae4d1e6796c78b865a9bdda6b8489..34cc3be0df8ed7a44e56d4187aef2747dd2620bd 100644 (file)
@@ -127,8 +127,8 @@ static int e1000e_phc_get_syncdevicetime(ktime_t *device,
        unsigned long flags;
        int i;
        u32 tsync_ctrl;
-       cycle_t dev_cycles;
-       cycle_t sys_cycles;
+       u64 dev_cycles;
+       u64 sys_cycles;
 
        tsync_ctrl = er32(TSYNCTXCTL);
        tsync_ctrl |= E1000_TSYNCTXCTL_START_SYNC |
index c30eea8399a7dfb4de23717d33e8169e054cd600..c4477552ce9ef2e153eb1678c783ff9e9fb08eb8 100644 (file)
@@ -77,7 +77,7 @@
 static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter);
 
 /* SYSTIM read access for the 82576 */
-static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
+static u64 igb_ptp_read_82576(const struct cyclecounter *cc)
 {
        struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
        struct e1000_hw *hw = &igb->hw;
@@ -94,7 +94,7 @@ static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
 }
 
 /* SYSTIM read access for the 82580 */
-static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc)
+static u64 igb_ptp_read_82580(const struct cyclecounter *cc)
 {
        struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc);
        struct e1000_hw *hw = &igb->hw;
index d2b29b490ae0167fe8325fd47758a9d6c0ca5a90..e5d72559cca9b060002525e5086ccfc008cc99d6 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "ixgb.h"
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define IXGB_ALL_RAR_ENTRIES 16
 
index a92277683a649b4bf7f42987a7d0ecdad311f04c..1efb404431e95bb97752935b3061aca852133820 100644 (file)
@@ -245,7 +245,7 @@ static void ixgbe_ptp_setup_sdp_x540(struct ixgbe_adapter *adapter)
  * result of SYSTIME is 32bits of "billions of cycles" and 32 bits of
  * "cycles", rather than seconds and nanoseconds.
  */
-static cycle_t ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc)
+static u64 ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc)
 {
        struct ixgbe_adapter *adapter =
                        container_of(hw_cc, struct ixgbe_adapter, hw_cc);
@@ -282,7 +282,7 @@ static cycle_t ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc)
  * cyclecounter structure used to construct a ns counter from the
  * arbitrary fixed point registers
  */
-static cycle_t ixgbe_ptp_read_82599(const struct cyclecounter *cc)
+static u64 ixgbe_ptp_read_82599(const struct cyclecounter *cc)
 {
        struct ixgbe_adapter *adapter =
                container_of(cc, struct ixgbe_adapter, hw_cc);
index cbeea915f02699696072d1da77c724588e5c3b0e..8037426ec50fa4337cd4e0cc40dabb71082fb487 100644 (file)
@@ -900,10 +900,10 @@ static void korina_restart_task(struct work_struct *work)
                                DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR,
                                &lp->rx_dma_regs->dmasm);
 
-       korina_free_ring(dev);
-
        napi_disable(&lp->napi);
 
+       korina_free_ring(dev);
+
        if (korina_init(dev) < 0) {
                printk(KERN_ERR "%s: cannot restart device\n", dev->name);
                return;
@@ -1064,12 +1064,12 @@ static int korina_close(struct net_device *dev)
        tmp = tmp | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR;
        writel(tmp, &lp->rx_dma_regs->dmasm);
 
-       korina_free_ring(dev);
-
        napi_disable(&lp->napi);
 
        cancel_work_sync(&lp->restart_task);
 
+       korina_free_ring(dev);
+
        free_irq(lp->rx_irq, dev);
        free_irq(lp->tx_irq, dev);
        free_irq(lp->ovr_irq, dev);
index dabc5418efcc48287b1e30d95f8a05235755f119..4fe430ceb194519ba87c2360479e27c7ceb0ebda 100644 (file)
@@ -770,6 +770,17 @@ struct mvpp2_rx_desc {
        u32 reserved8;
 };
 
+struct mvpp2_txq_pcpu_buf {
+       /* Transmitted SKB */
+       struct sk_buff *skb;
+
+       /* Physical address of transmitted buffer */
+       dma_addr_t phys;
+
+       /* Size transmitted */
+       size_t size;
+};
+
 /* Per-CPU Tx queue control */
 struct mvpp2_txq_pcpu {
        int cpu;
@@ -785,11 +796,8 @@ struct mvpp2_txq_pcpu {
        /* Number of Tx DMA descriptors reserved for each CPU */
        int reserved_num;
 
-       /* Array of transmitted skb */
-       struct sk_buff **tx_skb;
-
-       /* Array of transmitted buffers' physical addresses */
-       dma_addr_t *tx_buffs;
+       /* Infos about transmitted buffers */
+       struct mvpp2_txq_pcpu_buf *buffs;
 
        /* Index of last TX DMA descriptor that was inserted */
        int txq_put_index;
@@ -979,10 +987,11 @@ static void mvpp2_txq_inc_put(struct mvpp2_txq_pcpu *txq_pcpu,
                              struct sk_buff *skb,
                              struct mvpp2_tx_desc *tx_desc)
 {
-       txq_pcpu->tx_skb[txq_pcpu->txq_put_index] = skb;
-       if (skb)
-               txq_pcpu->tx_buffs[txq_pcpu->txq_put_index] =
-                                                        tx_desc->buf_phys_addr;
+       struct mvpp2_txq_pcpu_buf *tx_buf =
+               txq_pcpu->buffs + txq_pcpu->txq_put_index;
+       tx_buf->skb = skb;
+       tx_buf->size = tx_desc->data_size;
+       tx_buf->phys = tx_desc->buf_phys_addr;
        txq_pcpu->txq_put_index++;
        if (txq_pcpu->txq_put_index == txq_pcpu->size)
                txq_pcpu->txq_put_index = 0;
@@ -4401,17 +4410,16 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
        int i;
 
        for (i = 0; i < num; i++) {
-               dma_addr_t buf_phys_addr =
-                                   txq_pcpu->tx_buffs[txq_pcpu->txq_get_index];
-               struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index];
+               struct mvpp2_txq_pcpu_buf *tx_buf =
+                       txq_pcpu->buffs + txq_pcpu->txq_get_index;
 
                mvpp2_txq_inc_get(txq_pcpu);
 
-               dma_unmap_single(port->dev->dev.parent, buf_phys_addr,
-                                skb_headlen(skb), DMA_TO_DEVICE);
-               if (!skb)
+               dma_unmap_single(port->dev->dev.parent, tx_buf->phys,
+                                tx_buf->size, DMA_TO_DEVICE);
+               if (!tx_buf->skb)
                        continue;
-               dev_kfree_skb_any(skb);
+               dev_kfree_skb_any(tx_buf->skb);
        }
 }
 
@@ -4651,15 +4659,10 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
        for_each_present_cpu(cpu) {
                txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
                txq_pcpu->size = txq->size;
-               txq_pcpu->tx_skb = kmalloc(txq_pcpu->size *
-                                          sizeof(*txq_pcpu->tx_skb),
-                                          GFP_KERNEL);
-               if (!txq_pcpu->tx_skb)
-                       goto error;
-
-               txq_pcpu->tx_buffs = kmalloc(txq_pcpu->size *
-                                            sizeof(dma_addr_t), GFP_KERNEL);
-               if (!txq_pcpu->tx_buffs)
+               txq_pcpu->buffs = kmalloc(txq_pcpu->size *
+                                         sizeof(struct mvpp2_txq_pcpu_buf),
+                                         GFP_KERNEL);
+               if (!txq_pcpu->buffs)
                        goto error;
 
                txq_pcpu->count = 0;
@@ -4673,8 +4676,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
 error:
        for_each_present_cpu(cpu) {
                txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
-               kfree(txq_pcpu->tx_skb);
-               kfree(txq_pcpu->tx_buffs);
+               kfree(txq_pcpu->buffs);
        }
 
        dma_free_coherent(port->dev->dev.parent,
@@ -4693,8 +4695,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port,
 
        for_each_present_cpu(cpu) {
                txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
-               kfree(txq_pcpu->tx_skb);
-               kfree(txq_pcpu->tx_buffs);
+               kfree(txq_pcpu->buffs);
        }
 
        if (txq->descs)
@@ -4912,7 +4913,7 @@ static void mvpp2_timer_set(struct mvpp2_port_pcpu *port_pcpu)
 
        if (!port_pcpu->timer_scheduled) {
                port_pcpu->timer_scheduled = true;
-               interval = ktime_set(0, MVPP2_TXDONE_HRTIMER_PERIOD_NS);
+               interval = MVPP2_TXDONE_HRTIMER_PERIOD_NS;
                hrtimer_start(&port_pcpu->tx_done_timer, interval,
                              HRTIMER_MODE_REL_PINNED);
        }
index a5fc46bbcbe224373b768633f600f3d66d4865d5..504461a464c581bf77b5cca127680f2622221cde 100644 (file)
@@ -38,7 +38,7 @@
 
 /* mlx4_en_read_clock - read raw cycle counter (to be used by time counter)
  */
-static cycle_t mlx4_en_read_clock(const struct cyclecounter *tc)
+static u64 mlx4_en_read_clock(const struct cyclecounter *tc)
 {
        struct mlx4_en_dev *mdev =
                container_of(tc, struct mlx4_en_dev, cycles);
@@ -245,13 +245,9 @@ static u32 freq_to_shift(u16 freq)
 {
        u32 freq_khz = freq * 1000;
        u64 max_val_cycles = freq_khz * 1000 * MLX4_EN_WRAP_AROUND_SEC;
-       u64 tmp_rounded =
-               roundup_pow_of_two(max_val_cycles) > max_val_cycles ?
-               roundup_pow_of_two(max_val_cycles) - 1 : UINT_MAX;
-       u64 max_val_cycles_rounded = is_power_of_2(max_val_cycles + 1) ?
-               max_val_cycles : tmp_rounded;
+       u64 max_val_cycles_rounded = 1ULL << fls64(max_val_cycles - 1);
        /* calculate max possible multiplier in order to fit in 64bit */
-       u64 max_mul = div_u64(0xffffffffffffffffULL, max_val_cycles_rounded);
+       u64 max_mul = div64_u64(ULLONG_MAX, max_val_cycles_rounded);
 
        /* This comes from the reverse of clocksource_khz2mult */
        return ilog2(div_u64(max_mul * freq_khz, 1000000));
index bcd95533905865d38c80f72ac32e34f8a653a839..edbe200ac2fa4a11ad30bb8f08d8f7e3cb910708 100644 (file)
@@ -1638,7 +1638,8 @@ int mlx4_en_start_port(struct net_device *dev)
 
        /* Configure tx cq's and rings */
        for (t = 0 ; t < MLX4_EN_NUM_TX_TYPES; t++) {
-               u8 num_tx_rings_p_up = t == TX ? priv->num_tx_rings_p_up : 1;
+               u8 num_tx_rings_p_up = t == TX ?
+                       priv->num_tx_rings_p_up : priv->tx_ring_num[t];
 
                for (i = 0; i < priv->tx_ring_num[t]; i++) {
                        /* Configure cq */
index 3c37e216bbf324d527a27bee53418f2ecd62e724..eac527e25ec902c2a586e9952272b9e8e599e2c8 100644 (file)
@@ -445,8 +445,14 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
                ring->cqn = priv->rx_cq[ring_ind]->mcq.cqn;
 
                ring->stride = stride;
-               if (ring->stride <= TXBB_SIZE)
+               if (ring->stride <= TXBB_SIZE) {
+                       /* Stamp first unused send wqe */
+                       __be32 *ptr = (__be32 *)ring->buf;
+                       __be32 stamp = cpu_to_be32(1 << STAMP_SHIFT);
+                       *ptr = stamp;
+                       /* Move pointer to start of rx section */
                        ring->buf += TXBB_SIZE;
+               }
 
                ring->log_stride = ffs(ring->stride) - 1;
                ring->buf_size = ring->size * ring->stride;
index 2a9dd460a95f8149d884af048dc651eaaec4904f..e1f9e7cebf8f7adcf0a095513086b949c246aab6 100644 (file)
@@ -118,8 +118,13 @@ static int mlx4_alloc_icm_coherent(struct device *dev, struct scatterlist *mem,
        if (!buf)
                return -ENOMEM;
 
+       if (offset_in_page(buf)) {
+               dma_free_coherent(dev, PAGE_SIZE << order,
+                                 buf, sg_dma_address(mem));
+               return -ENOMEM;
+       }
+
        sg_set_buf(mem, buf, PAGE_SIZE << order);
-       BUG_ON(mem->offset);
        sg_dma_len(mem) = PAGE_SIZE << order;
        return 0;
 }
index b2ca8a635b2e0b4e974acf649ba6c9be9cae00e2..bffa6f345f2f40e35ebab8e546237da4fbe6b6a8 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/io-mapping.h>
 #include <linux/delay.h>
 #include <linux/kmod.h>
+#include <linux/etherdevice.h>
 #include <net/devlink.h>
 
 #include <linux/mlx4/device.h>
@@ -782,6 +783,23 @@ int mlx4_is_slave_active(struct mlx4_dev *dev, int slave)
 }
 EXPORT_SYMBOL(mlx4_is_slave_active);
 
+void mlx4_handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
+                                      struct _rule_hw *eth_header)
+{
+       if (is_multicast_ether_addr(eth_header->eth.dst_mac) ||
+           is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
+               struct mlx4_net_trans_rule_hw_eth *eth =
+                       (struct mlx4_net_trans_rule_hw_eth *)eth_header;
+               struct _rule_hw *next_rule = (struct _rule_hw *)(eth + 1);
+               bool last_rule = next_rule->size == 0 && next_rule->id == 0 &&
+                       next_rule->rsvd == 0;
+
+               if (last_rule)
+                       ctrl->prio = cpu_to_be16(MLX4_DOMAIN_NIC);
+       }
+}
+EXPORT_SYMBOL(mlx4_handle_eth_header_mcast_prio);
+
 static void slave_adjust_steering_mode(struct mlx4_dev *dev,
                                       struct mlx4_dev_cap *dev_cap,
                                       struct mlx4_init_hca_param *hca_param)
@@ -1823,10 +1841,10 @@ static void unmap_bf_area(struct mlx4_dev *dev)
                io_mapping_free(mlx4_priv(dev)->bf_mapping);
 }
 
-cycle_t mlx4_read_clock(struct mlx4_dev *dev)
+u64 mlx4_read_clock(struct mlx4_dev *dev)
 {
        u32 clockhi, clocklo, clockhi1;
-       cycle_t cycles;
+       u64 cycles;
        int i;
        struct mlx4_priv *priv = mlx4_priv(dev);
 
index c548beaaf9109e376933660dffb39632622dbfc9..56185a0b827df6394a1edba70cf6925683ffb403 100644 (file)
@@ -4164,22 +4164,6 @@ static int validate_eth_header_mac(int slave, struct _rule_hw *eth_header,
        return 0;
 }
 
-static void handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
-                                        struct _rule_hw *eth_header)
-{
-       if (is_multicast_ether_addr(eth_header->eth.dst_mac) ||
-           is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
-               struct mlx4_net_trans_rule_hw_eth *eth =
-                       (struct mlx4_net_trans_rule_hw_eth *)eth_header;
-               struct _rule_hw *next_rule = (struct _rule_hw *)(eth + 1);
-               bool last_rule = next_rule->size == 0 && next_rule->id == 0 &&
-                       next_rule->rsvd == 0;
-
-               if (last_rule)
-                       ctrl->prio = cpu_to_be16(MLX4_DOMAIN_NIC);
-       }
-}
-
 /*
  * In case of missing eth header, append eth header with a MAC address
  * assigned to the VF.
@@ -4363,10 +4347,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
        header_id = map_hw_to_sw_id(be16_to_cpu(rule_header->id));
 
        if (header_id == MLX4_NET_TRANS_RULE_ID_ETH)
-               handle_eth_header_mcast_prio(ctrl, rule_header);
-
-       if (slave == dev->caps.function)
-               goto execute;
+               mlx4_handle_eth_header_mcast_prio(ctrl, rule_header);
 
        switch (header_id) {
        case MLX4_NET_TRANS_RULE_ID_ETH:
@@ -4394,7 +4375,6 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
                goto err_put_qp;
        }
 
-execute:
        err = mlx4_cmd_imm(dev, inbox->dma, &vhcr->out_param,
                           vhcr->in_modifier, 0,
                           MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A,
@@ -4473,6 +4453,7 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave,
        struct res_qp *rqp;
        struct res_fs_rule *rrule;
        u64 mirr_reg_id;
+       int qpn;
 
        if (dev->caps.steering_mode !=
            MLX4_STEERING_MODE_DEVICE_MANAGED)
@@ -4489,10 +4470,11 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave,
        }
        mirr_reg_id = rrule->mirr_rule_id;
        kfree(rrule->mirr_mbox);
+       qpn = rrule->qpn;
 
        /* Release the rule form busy state before removal */
        put_res(dev, slave, vhcr->in_param, RES_FS_RULE);
-       err = get_res(dev, slave, rrule->qpn, RES_QP, &rqp);
+       err = get_res(dev, slave, qpn, RES_QP, &rqp);
        if (err)
                return err;
 
@@ -4517,7 +4499,7 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave,
        if (!err)
                atomic_dec(&rqp->ref_count);
 out:
-       put_res(dev, slave, rrule->qpn, RES_QP);
+       put_res(dev, slave, qpn, RES_QP);
        return err;
 }
 
index 2cd8e56a573be122a1568687fe436ead5e75ceda..746a92c1364435da17275527f8a2c06f6f48624b 100644 (file)
@@ -49,7 +49,7 @@ void mlx5e_fill_hwstamp(struct mlx5e_tstamp *tstamp, u64 timestamp,
        hwts->hwtstamp = ns_to_ktime(nsec);
 }
 
-static cycle_t mlx5e_read_internal_timer(const struct cyclecounter *cc)
+static u64 mlx5e_read_internal_timer(const struct cyclecounter *cc)
 {
        struct mlx5e_tstamp *tstamp = container_of(cc, struct mlx5e_tstamp,
                                                   cycles);
index 7f6c225666c18b193f642ba74cb8637e471ab3fc..f0b460f47f2992caad4eec7ea0d655296a46e99c 100644 (file)
@@ -723,6 +723,9 @@ static void mlx5e_ets_init(struct mlx5e_priv *priv)
        int i;
        struct ieee_ets ets;
 
+       if (!MLX5_CAP_GEN(priv->mdev, ets))
+               return;
+
        memset(&ets, 0, sizeof(ets));
        ets.ets_cap = mlx5_max_tc(priv->mdev) + 1;
        for (i = 0; i < ets.ets_cap; i++) {
index 352462af8d51aced0ba2c2a0daa729e7aa05f68f..33a399a8b5d52297379ade73f37e61df266905fa 100644 (file)
@@ -171,7 +171,6 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
                return NUM_SW_COUNTERS +
                       MLX5E_NUM_Q_CNTRS(priv) +
                       NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS +
-                      NUM_PCIE_COUNTERS +
                       MLX5E_NUM_RQ_STATS(priv) +
                       MLX5E_NUM_SQ_STATS(priv) +
                       MLX5E_NUM_PFC_COUNTERS(priv) +
@@ -219,14 +218,6 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
                strcpy(data + (idx++) * ETH_GSTRING_LEN,
                       pport_2819_stats_desc[i].format);
 
-       for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
-               strcpy(data + (idx++) * ETH_GSTRING_LEN,
-                      pcie_perf_stats_desc[i].format);
-
-       for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
-               strcpy(data + (idx++) * ETH_GSTRING_LEN,
-                      pcie_tas_stats_desc[i].format);
-
        for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
                for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
                        sprintf(data + (idx++) * ETH_GSTRING_LEN,
@@ -339,14 +330,6 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
                data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters,
                                                  pport_2819_stats_desc, i);
 
-       for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
-               data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
-                                                 pcie_perf_stats_desc, i);
-
-       for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
-               data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_tas_counters,
-                                                 pcie_tas_stats_desc, i);
-
        for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
                for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
                        data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
index 3691451c728c0c4731e4fbc7946a8549490edc4d..d088effd7160355849faacead1326f2198d12e8d 100644 (file)
@@ -247,6 +247,7 @@ static int set_flow_attrs(u32 *match_c, u32 *match_v,
        }
        if (fs->flow_type & FLOW_MAC_EXT &&
            !is_zero_ether_addr(fs->m_ext.h_dest)) {
+               mask_spec(fs->m_ext.h_dest, fs->h_ext.h_dest, ETH_ALEN);
                ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4,
                                             outer_headers_c, dmac_47_16),
                                fs->m_ext.h_dest);
index cbfa38fc72c0875d6754595e1335c5d1a5af26ff..1236b27b149386ab61f1c25ab26c84d43d561ab9 100644 (file)
@@ -291,36 +291,12 @@ static void mlx5e_update_q_counter(struct mlx5e_priv *priv)
                                      &qcnt->rx_out_of_buffer);
 }
 
-static void mlx5e_update_pcie_counters(struct mlx5e_priv *priv)
-{
-       struct mlx5e_pcie_stats *pcie_stats = &priv->stats.pcie;
-       struct mlx5_core_dev *mdev = priv->mdev;
-       int sz = MLX5_ST_SZ_BYTES(mpcnt_reg);
-       void *out;
-       u32 *in;
-
-       in = mlx5_vzalloc(sz);
-       if (!in)
-               return;
-
-       out = pcie_stats->pcie_perf_counters;
-       MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP);
-       mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
-
-       out = pcie_stats->pcie_tas_counters;
-       MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP);
-       mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
-
-       kvfree(in);
-}
-
 void mlx5e_update_stats(struct mlx5e_priv *priv)
 {
        mlx5e_update_q_counter(priv);
        mlx5e_update_vport_counters(priv);
        mlx5e_update_pport_counters(priv);
        mlx5e_update_sw_counters(priv);
-       mlx5e_update_pcie_counters(priv);
 }
 
 void mlx5e_update_stats_work(struct work_struct *work)
@@ -3805,14 +3781,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
 
        mlx5_lag_add(mdev, netdev);
 
-       if (mlx5e_vxlan_allowed(mdev)) {
-               rtnl_lock();
-               udp_tunnel_get_rx_info(netdev);
-               rtnl_unlock();
-       }
-
        mlx5e_enable_async_events(priv);
-       queue_work(priv->wq, &priv->set_rx_mode_work);
 
        if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
                mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id);
@@ -3822,6 +3791,18 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
                rep.netdev = netdev;
                mlx5_eswitch_register_vport_rep(esw, 0, &rep);
        }
+
+       if (netdev->reg_state != NETREG_REGISTERED)
+               return;
+
+       /* Device already registered: sync netdev system state */
+       if (mlx5e_vxlan_allowed(mdev)) {
+               rtnl_lock();
+               udp_tunnel_get_rx_info(netdev);
+               rtnl_unlock();
+       }
+
+       queue_work(priv->wq, &priv->set_rx_mode_work);
 }
 
 static void mlx5e_nic_disable(struct mlx5e_priv *priv)
@@ -3966,10 +3947,6 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
        const struct mlx5e_profile *profile = priv->profile;
 
        set_bit(MLX5E_STATE_DESTROYING, &priv->state);
-       if (profile->disable)
-               profile->disable(priv);
-
-       flush_workqueue(priv->wq);
 
        rtnl_lock();
        if (netif_running(netdev))
@@ -3977,6 +3954,10 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
        netif_device_detach(netdev);
        rtnl_unlock();
 
+       if (profile->disable)
+               profile->disable(priv);
+       flush_workqueue(priv->wq);
+
        mlx5e_destroy_q_counter(priv);
        profile->cleanup_rx(priv);
        mlx5e_close_drop_rq(priv);
index f202f872f57f6ee0c3e4aad428ffafa7be1a71a2..ba5db1dd23a97a7d378ec3ea8e36fa099d0a462a 100644 (file)
@@ -39,7 +39,7 @@
 #define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \
        (*(u32 *)((char *)ptr + dsc[i].offset))
 #define MLX5E_READ_CTR32_BE(ptr, dsc, i) \
-       be32_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset))
+       be64_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset))
 
 #define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld)
 #define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld)
@@ -276,32 +276,6 @@ static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
        { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
 };
 
-#define PCIE_PERF_OFF(c) \
-       MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c)
-#define PCIE_PERF_GET(pcie_stats, c) \
-       MLX5_GET(mpcnt_reg, pcie_stats->pcie_perf_counters, \
-                counter_set.pcie_perf_cntrs_grp_data_layout.c)
-#define PCIE_TAS_OFF(c) \
-       MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_tas_cntrs_grp_data_layout.c)
-#define PCIE_TAS_GET(pcie_stats, c) \
-       MLX5_GET(mpcnt_reg, pcie_stats->pcie_tas_counters, \
-                counter_set.pcie_tas_cntrs_grp_data_layout.c)
-
-struct mlx5e_pcie_stats {
-       __be64 pcie_perf_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
-       __be64 pcie_tas_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
-};
-
-static const struct counter_desc pcie_perf_stats_desc[] = {
-       { "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) },
-       { "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
-};
-
-static const struct counter_desc pcie_tas_stats_desc[] = {
-       { "tx_pci_transport_nonfatal_msg", PCIE_TAS_OFF(non_fatal_err_msg_sent) },
-       { "tx_pci_transport_fatal_msg", PCIE_TAS_OFF(fatal_err_msg_sent) },
-};
-
 struct mlx5e_rq_stats {
        u64 packets;
        u64 bytes;
@@ -386,8 +360,6 @@ static const struct counter_desc sq_stats_desc[] = {
 #define NUM_PPORT_802_3_COUNTERS       ARRAY_SIZE(pport_802_3_stats_desc)
 #define NUM_PPORT_2863_COUNTERS                ARRAY_SIZE(pport_2863_stats_desc)
 #define NUM_PPORT_2819_COUNTERS                ARRAY_SIZE(pport_2819_stats_desc)
-#define NUM_PCIE_PERF_COUNTERS         ARRAY_SIZE(pcie_perf_stats_desc)
-#define NUM_PCIE_TAS_COUNTERS          ARRAY_SIZE(pcie_tas_stats_desc)
 #define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \
        ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
 #define NUM_PPORT_PER_PRIO_PFC_COUNTERS \
@@ -397,7 +369,6 @@ static const struct counter_desc sq_stats_desc[] = {
                                         NUM_PPORT_2819_COUNTERS  + \
                                         NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
                                         NUM_PPORT_PRIO)
-#define NUM_PCIE_COUNTERS              (NUM_PCIE_PERF_COUNTERS + NUM_PCIE_TAS_COUNTERS)
 #define NUM_RQ_STATS                   ARRAY_SIZE(rq_stats_desc)
 #define NUM_SQ_STATS                   ARRAY_SIZE(sq_stats_desc)
 
@@ -406,7 +377,6 @@ struct mlx5e_stats {
        struct mlx5e_qcounter_stats qcnt;
        struct mlx5e_vport_stats vport;
        struct mlx5e_pport_stats pport;
-       struct mlx5e_pcie_stats pcie;
        struct rtnl_link_stats64 vf_vport;
 };
 
index d6807c3cc461f001aa01072e395adf2e93095bfd..f14d9c9ba77394b83aea50564afd3c762613467a 100644 (file)
@@ -1860,7 +1860,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
 
        if (!ESW_ALLOWED(esw))
                return -EPERM;
-       if (!LEGAL_VPORT(esw, vport))
+       if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
                return -EINVAL;
 
        mutex_lock(&esw->state_lock);
index 466e161010f759e08ab2253326da4f2a0192aa1d..03293ed1cc22d2716ff5708dc2312b7291cc1899 100644 (file)
@@ -695,6 +695,12 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports)
                if (err)
                        goto err_reps;
        }
+
+       /* disable PF RoCE so missed packets don't go through RoCE steering */
+       mlx5_dev_list_lock();
+       mlx5_remove_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
+       mlx5_dev_list_unlock();
+
        return 0;
 
 err_reps:
@@ -718,6 +724,11 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw)
 {
        int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs;
 
+       /* enable back PF RoCE */
+       mlx5_dev_list_lock();
+       mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
+       mlx5_dev_list_unlock();
+
        mlx5_eswitch_disable_sriov(esw);
        err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY);
        if (err) {
index a263d8904a4cf84de718ad9dd4b2d8ddca9a5194..0ac7a2fc916c438bc535b20d45964009747f0b33 100644 (file)
@@ -1263,6 +1263,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
        nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD);
        handle = add_rule_fte(fte, fg, dest, dest_num, false);
        if (IS_ERR(handle)) {
+               unlock_ref_node(&fte->node);
                kfree(fte);
                goto unlock_fg;
        }
index 7b4c339a8a9a233edd0be5b4dd04a09b975810fa..6547f22e6b9b919010eada133093654348dff671 100644 (file)
@@ -503,6 +503,13 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
        MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size,
                 to_fw_pkey_sz(dev, 128));
 
+       /* Check log_max_qp from HCA caps to set in current profile */
+       if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < profile[prof_sel].log_max_qp) {
+               mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n",
+                              profile[prof_sel].log_max_qp,
+                              MLX5_CAP_GEN_MAX(dev, log_max_qp));
+               profile[prof_sel].log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp);
+       }
        if (prof->mask & MLX5_PROF_MASK_QP_SIZE)
                MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp,
                         prof->log_max_qp);
@@ -557,7 +564,7 @@ int mlx5_core_disable_hca(struct mlx5_core_dev *dev, u16 func_id)
        return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
 }
 
-cycle_t mlx5_read_internal_timer(struct mlx5_core_dev *dev)
+u64 mlx5_read_internal_timer(struct mlx5_core_dev *dev)
 {
        u32 timer_h, timer_h1, timer_l;
 
@@ -567,7 +574,7 @@ cycle_t mlx5_read_internal_timer(struct mlx5_core_dev *dev)
        if (timer_h != timer_h1) /* wrap around */
                timer_l = ioread32be(&dev->iseg->internal_timer_l);
 
-       return (cycle_t)timer_l | (cycle_t)timer_h1 << 32;
+       return (u64)timer_l | (u64)timer_h1 << 32;
 }
 
 static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
@@ -575,7 +582,6 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
        struct mlx5_priv *priv  = &mdev->priv;
        struct msix_entry *msix = priv->msix_arr;
        int irq                 = msix[i + MLX5_EQ_VEC_COMP_BASE].vector;
-       int numa_node           = priv->numa_node;
        int err;
 
        if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) {
@@ -583,7 +589,7 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
                return -ENOMEM;
        }
 
-       cpumask_set_cpu(cpumask_local_spread(i, numa_node),
+       cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node),
                        priv->irq_info[i].mask);
 
        err = irq_set_affinity_hint(irq, priv->irq_info[i].mask);
@@ -1189,6 +1195,8 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
 {
        int err = 0;
 
+       mlx5_drain_health_wq(dev);
+
        mutex_lock(&dev->intf_state_mutex);
        if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) {
                dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n",
@@ -1351,10 +1359,9 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
 
        mlx5_enter_error_state(dev);
        mlx5_unload_one(dev, priv, false);
-       /* In case of kernel call save the pci state and drain health wq */
+       /* In case of kernel call save the pci state */
        if (state) {
                pci_save_state(pdev);
-               mlx5_drain_health_wq(dev);
                mlx5_pci_disable_device(dev);
        }
 
index e0a8fbdd1446829e883352ad4cacb3c19f6ad7be..d4a99c9757cbef7bd0a102da9e5277088ef31720 100644 (file)
@@ -106,7 +106,7 @@ int mlx5_modify_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
 int mlx5_destroy_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
                                        u32 element_id);
 int mlx5_wait_for_vf_pages(struct mlx5_core_dev *dev);
-cycle_t mlx5_read_internal_timer(struct mlx5_core_dev *dev);
+u64 mlx5_read_internal_timer(struct mlx5_core_dev *dev);
 u32 mlx5_get_msix_vec(struct mlx5_core_dev *dev, int vecidx);
 struct mlx5_eq *mlx5_eqn2eq(struct mlx5_core_dev *dev, int eqn);
 void mlx5_cq_tasklet_cb(unsigned long data);
index 53126bf68ea937e7b2c6951787c25450ec0ebdb5..01d0efa9c5c7419b6e2fa99ed6b99562811bcbd5 100644 (file)
@@ -942,7 +942,7 @@ static void mlxsw_sp_router_neigh_update_hw(struct work_struct *work)
        char rauht_pl[MLXSW_REG_RAUHT_LEN];
        struct net_device *dev;
        bool entry_connected;
-       u8 nud_state;
+       u8 nud_state, dead;
        bool updating;
        bool removing;
        bool adding;
@@ -953,10 +953,11 @@ static void mlxsw_sp_router_neigh_update_hw(struct work_struct *work)
        dip = ntohl(*((__be32 *) n->primary_key));
        memcpy(neigh_entry->ha, n->ha, sizeof(neigh_entry->ha));
        nud_state = n->nud_state;
+       dead = n->dead;
        dev = n->dev;
        read_unlock_bh(&n->lock);
 
-       entry_connected = nud_state & NUD_VALID;
+       entry_connected = nud_state & NUD_VALID && !dead;
        adding = (!neigh_entry->offloaded) && entry_connected;
        updating = neigh_entry->offloaded && entry_connected;
        removing = neigh_entry->offloaded && !entry_connected;
@@ -1351,7 +1352,7 @@ static int mlxsw_sp_nexthop_init(struct mlxsw_sp *mlxsw_sp,
        struct mlxsw_sp_neigh_entry *neigh_entry;
        struct net_device *dev = fib_nh->nh_dev;
        struct neighbour *n;
-       u8 nud_state;
+       u8 nud_state, dead;
 
        /* Take a reference of neigh here ensuring that neigh would
         * not be detructed before the nexthop entry is finished.
@@ -1383,8 +1384,9 @@ static int mlxsw_sp_nexthop_init(struct mlxsw_sp *mlxsw_sp,
        list_add_tail(&nh->neigh_list_node, &neigh_entry->nexthop_list);
        read_lock_bh(&n->lock);
        nud_state = n->nud_state;
+       dead = n->dead;
        read_unlock_bh(&n->lock);
-       __mlxsw_sp_nexthop_neigh_update(nh, !(nud_state & NUD_VALID));
+       __mlxsw_sp_nexthop_neigh_update(nh, !(nud_state & NUD_VALID && !dead));
 
        return 0;
 }
@@ -1394,6 +1396,7 @@ static void mlxsw_sp_nexthop_fini(struct mlxsw_sp *mlxsw_sp,
 {
        struct mlxsw_sp_neigh_entry *neigh_entry = nh->neigh_entry;
 
+       __mlxsw_sp_nexthop_neigh_update(nh, true);
        list_del(&nh->neigh_list_node);
 
        /* If that is the last nexthop connected to that neigh, remove from
@@ -1452,6 +1455,8 @@ mlxsw_sp_nexthop_group_destroy(struct mlxsw_sp *mlxsw_sp,
                nh = &nh_grp->nexthops[i];
                mlxsw_sp_nexthop_fini(mlxsw_sp, nh);
        }
+       mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp);
+       WARN_ON_ONCE(nh_grp->adj_index_valid);
        kfree(nh_grp);
 }
 
index 22b0821c1da02ddf0630f8a5e33d5a01af58b1a1..90eac63f9606a446f696bf120379f19776b6fec0 100644 (file)
@@ -51,7 +51,7 @@
 #include <asm/processor.h>     /* Processor type for cache alignment. */
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define DRV_NAME       "natsemi"
 #define DRV_VERSION    "2.1"
index 93c4bdc0cdca5a9ebb61a4a9fb8f945039f7b604..f9d2eb9a920a8720b83cf95d12fabe0a9a44ebb3 100644 (file)
 #include <linux/slab.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define DRV_NAME "ns83820"
 
index 2d04679a923a71454511e572a2714796b760bc69..baff744b560e4115755f6a88c8a563e540d6cff7 100644 (file)
@@ -160,7 +160,7 @@ static int tx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 #include <linux/delay.h>
 #include <linux/bitops.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>     /* Processor type for cache alignment. */
 #include <asm/io.h>
 #include <asm/unaligned.h>
index 2a2ca5fa0c690281cbb433b450340279fdd91857..fa7770da6ef8ca0f29ab6b9f462cbf04f1bc6616 100644 (file)
@@ -100,7 +100,7 @@ static int gx_fix;
 #include <linux/ethtool.h>
 #include <linux/crc32.h>
 #include <linux/bitops.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>             /* Processor type for cache alignment. */
 #include <asm/unaligned.h>
 #include <asm/io.h>
index b7c89ebcf4a24552f5517aeb90041e760c8dc15e..0b3cd58093d5ecf00abef6eda1386f13ac5e287b 100644 (file)
@@ -76,7 +76,7 @@
 #include <linux/cache.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* These identify the driver base version and may not be removed. */
 static char version[] =
index f9b97f5946f8919aa1d8ff63044c796775cd01cc..44389c90056a0f197a97f5d36478ec597f266004 100644 (file)
@@ -326,6 +326,7 @@ enum cfg_version {
 static const struct pci_device_id rtl8169_pci_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8129), 0, 0, RTL_CFG_0 },
        { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8136), 0, 0, RTL_CFG_2 },
+       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8161), 0, 0, RTL_CFG_1 },
        { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8167), 0, 0, RTL_CFG_0 },
        { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8168), 0, 0, RTL_CFG_1 },
        { PCI_DEVICE(PCI_VENDOR_ID_REALTEK,     0x8169), 0, 0, RTL_CFG_0 },
index f341c1bc7001678326985746bd0ce65d1572994a..00fafabab1d08ed505130ceab5306255c9910087 100644 (file)
@@ -819,6 +819,7 @@ static struct sh_eth_cpu_data sh7734_data = {
        .tsu            = 1,
        .hw_crc         = 1,
        .select_mii     = 1,
+       .shift_rd0      = 1,
 };
 
 /* SH7763 */
@@ -1656,7 +1657,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
        else
                goto out;
 
-       if (!likely(mdp->irq_enabled)) {
+       if (unlikely(!mdp->irq_enabled)) {
                sh_eth_write(ndev, 0, EESIPR);
                goto out;
        }
index de2947ccc5ad7d30d9cb7bc68483154cb9d119cd..5eb0e684fd76a3de1f46210f9a9b6118d98041e3 100644 (file)
@@ -1323,7 +1323,8 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
        }
 
        /* don't fail init if RSS setup doesn't work */
-       efx->type->rx_push_rss_config(efx, false, efx->rx_indir_table);
+       rc = efx->type->rx_push_rss_config(efx, false, efx->rx_indir_table);
+       efx->rss_active = (rc == 0);
 
        return 0;
 }
index 87bdc56b4e3a636450e4f39e49b37606332d8268..18ebaea44e8257255c6a910958e4b00466600903 100644 (file)
@@ -975,6 +975,8 @@ efx_ethtool_get_rxnfc(struct net_device *net_dev,
 
        case ETHTOOL_GRXFH: {
                info->data = 0;
+               if (!efx->rss_active) /* No RSS */
+                       return 0;
                switch (info->flow_type) {
                case UDP_V4_FLOW:
                        if (efx->rx_hash_udp_4tuple)
index 1a635ced62d0581634748d4b8bdcb15a2e0da69c..1c62c1a00fca49679cb8a69a1ac1a5564be9868d 100644 (file)
@@ -860,6 +860,7 @@ struct vfdi_status;
  * @rx_hash_key: Toeplitz hash key for RSS
  * @rx_indir_table: Indirection table for RSS
  * @rx_scatter: Scatter mode enabled for receives
+ * @rss_active: RSS enabled on hardware
  * @rx_hash_udp_4tuple: UDP 4-tuple hashing enabled
  * @int_error_count: Number of internal errors seen recently
  * @int_error_expire: Time at which error count will be expired
@@ -998,6 +999,7 @@ struct efx_nic {
        u8 rx_hash_key[40];
        u32 rx_indir_table[128];
        bool rx_scatter;
+       bool rss_active;
        bool rx_hash_udp_4tuple;
 
        unsigned int_error_count;
index a3901bc96586e5eff4f58105032ea2565c083769..4e54e5dc9fcb49bf03667843d47a4a2cf1aa978b 100644 (file)
@@ -403,6 +403,7 @@ static int siena_init_nic(struct efx_nic *efx)
        efx_writeo(efx, &temp, FR_AZ_RX_CFG);
 
        siena_rx_push_rss_config(efx, false, efx->rx_indir_table);
+       efx->rss_active = true;
 
        /* Enable event logging */
        rc = efx_mcdi_log_ctrl(efx, true, false, 0);
index 42051ab98cf003dc2ae49a57d29f958508375269..d390b9663dc32c9ee44393765235cb214150717c 100644 (file)
@@ -60,7 +60,7 @@
 #include <asm/byteorder.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sn/types.h>
 #include <asm/sn/ioc3.h>
 #include <asm/pci/bridge.h>
index 39fca6c0b68dbf62454c1c4092770b0509f50946..19a458716f1ae11cb6e27100834771d0ff5fc6f6 100644 (file)
@@ -74,7 +74,7 @@
 #include <asm/processor.h>      /* Processor type for cache alignment. */
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>       /* User space memory access functions */
+#include <linux/uaccess.h>     /* User space memory access functions */
 
 #include "sis900.h"
 
index fe9760ffab517b9cfef43f8f7fe0f66fc33dedd0..55a95e1d69d68b45ec85a8648e85d24e3673a4a0 100644 (file)
@@ -86,7 +86,7 @@ static int rx_copybreak;
 #include <linux/crc32.h>
 #include <linux/bitops.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 /* These identify the driver base version and may not be removed. */
index f1c75e291e55ba4324a34bd84948f95f317039be..67154621abcf9775a605f9066bfe7ff41418b56c 100644 (file)
@@ -52,7 +52,7 @@
 #include <pcmcia/ss.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*====================================================================*/
 
index c35597586121e5c3b41f6453711e3ea9920af463..3dc7d279f80513a948d2b855c5a09e16f63d5686 100644 (file)
@@ -60,8 +60,9 @@ struct oxnas_dwmac {
        struct regmap   *regmap;
 };
 
-static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac)
+static int oxnas_dwmac_init(struct platform_device *pdev, void *priv)
 {
+       struct oxnas_dwmac *dwmac = priv;
        unsigned int value;
        int ret;
 
@@ -105,20 +106,20 @@ static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac)
        return 0;
 }
 
+static void oxnas_dwmac_exit(struct platform_device *pdev, void *priv)
+{
+       struct oxnas_dwmac *dwmac = priv;
+
+       clk_disable_unprepare(dwmac->clk);
+}
+
 static int oxnas_dwmac_probe(struct platform_device *pdev)
 {
        struct plat_stmmacenet_data *plat_dat;
        struct stmmac_resources stmmac_res;
-       struct device_node *sysctrl;
        struct oxnas_dwmac *dwmac;
        int ret;
 
-       sysctrl = of_parse_phandle(pdev->dev.of_node, "oxsemi,sys-ctrl", 0);
-       if (!sysctrl) {
-               dev_err(&pdev->dev, "failed to get sys-ctrl node\n");
-               return -EINVAL;
-       }
-
        ret = stmmac_get_platform_resources(pdev, &stmmac_res);
        if (ret)
                return ret;
@@ -128,72 +129,48 @@ static int oxnas_dwmac_probe(struct platform_device *pdev)
                return PTR_ERR(plat_dat);
 
        dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
-       if (!dwmac)
-               return -ENOMEM;
+       if (!dwmac) {
+               ret = -ENOMEM;
+               goto err_remove_config_dt;
+       }
 
        dwmac->dev = &pdev->dev;
        plat_dat->bsp_priv = dwmac;
+       plat_dat->init = oxnas_dwmac_init;
+       plat_dat->exit = oxnas_dwmac_exit;
 
-       dwmac->regmap = syscon_node_to_regmap(sysctrl);
+       dwmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+                                                       "oxsemi,sys-ctrl");
        if (IS_ERR(dwmac->regmap)) {
                dev_err(&pdev->dev, "failed to have sysctrl regmap\n");
-               return PTR_ERR(dwmac->regmap);
+               ret = PTR_ERR(dwmac->regmap);
+               goto err_remove_config_dt;
        }
 
        dwmac->clk = devm_clk_get(&pdev->dev, "gmac");
-       if (IS_ERR(dwmac->clk))
-               return PTR_ERR(dwmac->clk);
+       if (IS_ERR(dwmac->clk)) {
+               ret = PTR_ERR(dwmac->clk);
+               goto err_remove_config_dt;
+       }
 
-       ret = oxnas_dwmac_init(dwmac);
+       ret = oxnas_dwmac_init(pdev, plat_dat->bsp_priv);
        if (ret)
-               return ret;
+               goto err_remove_config_dt;
 
        ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
        if (ret)
-               clk_disable_unprepare(dwmac->clk);
+               goto err_dwmac_exit;
 
-       return ret;
-}
 
-static int oxnas_dwmac_remove(struct platform_device *pdev)
-{
-       struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
-       int ret = stmmac_dvr_remove(&pdev->dev);
-
-       clk_disable_unprepare(dwmac->clk);
-
-       return ret;
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int oxnas_dwmac_suspend(struct device *dev)
-{
-       struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev);
-       int ret;
-
-       ret = stmmac_suspend(dev);
-       clk_disable_unprepare(dwmac->clk);
-
-       return ret;
-}
-
-static int oxnas_dwmac_resume(struct device *dev)
-{
-       struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev);
-       int ret;
-
-       ret = oxnas_dwmac_init(dwmac);
-       if (ret)
-               return ret;
+       return 0;
 
-       ret = stmmac_resume(dev);
+err_dwmac_exit:
+       oxnas_dwmac_exit(pdev, plat_dat->bsp_priv);
+err_remove_config_dt:
+       stmmac_remove_config_dt(pdev, plat_dat);
 
        return ret;
 }
-#endif /* CONFIG_PM_SLEEP */
-
-static SIMPLE_DEV_PM_OPS(oxnas_dwmac_pm_ops,
-       oxnas_dwmac_suspend, oxnas_dwmac_resume);
 
 static const struct of_device_id oxnas_dwmac_match[] = {
        { .compatible = "oxsemi,ox820-dwmac" },
@@ -203,10 +180,10 @@ MODULE_DEVICE_TABLE(of, oxnas_dwmac_match);
 
 static struct platform_driver oxnas_dwmac_driver = {
        .probe  = oxnas_dwmac_probe,
-       .remove = oxnas_dwmac_remove,
+       .remove = stmmac_pltfr_remove,
        .driver = {
                .name           = "oxnas-dwmac",
-               .pm             = &oxnas_dwmac_pm_ops,
+               .pm             = &stmmac_pltfr_pm_ops,
                .of_match_table = oxnas_dwmac_match,
        },
 };
index 77ab0a85f0673d4b2f5748403ecc249d520a5f00..fa6e9704c07779b6bc70d635765044360ff6adab 100644 (file)
@@ -864,6 +864,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
        int ret;
        struct device *dev = &bsp_priv->pdev->dev;
 
+       ret = gmac_clk_enable(bsp_priv, true);
+       if (ret)
+               return ret;
+
        /*rmii or rgmii*/
        if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_RGMII) {
                dev_info(dev, "init for RGMII\n");
@@ -880,10 +884,6 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
        if (ret)
                return ret;
 
-       ret = gmac_clk_enable(bsp_priv, true);
-       if (ret)
-               return ret;
-
        pm_runtime_enable(dev);
        pm_runtime_get_sync(dev);
 
index b21d03fe4f43ebba864ce3302eabc427e97acbb5..be3c91c7f211d94ad7386b77de73676933a46dcd 100644 (file)
@@ -539,7 +539,7 @@ struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins,
        mac->mii.reg_shift = 6;
        mac->mii.reg_mask = 0x000007C0;
        mac->mii.clk_csr_shift = 2;
-       mac->mii.clk_csr_mask = 0xF;
+       mac->mii.clk_csr_mask = GENMASK(5, 2);
 
        /* Get and dump the chip ID */
        *synopsys_id = stmmac_get_synopsys_id(hwid);
index a1d582f47b1ad19c07831fd9fa36ad8e358b3f0d..9dd2987e284dcb9f96fd3a48e98e606b26326d3a 100644 (file)
@@ -197,7 +197,7 @@ struct mac_device_info *dwmac100_setup(void __iomem *ioaddr, int *synopsys_id)
        mac->mii.reg_shift = 6;
        mac->mii.reg_mask = 0x000007C0;
        mac->mii.clk_csr_shift = 2;
-       mac->mii.clk_csr_mask = 0xF;
+       mac->mii.clk_csr_mask = GENMASK(5, 2);
 
        /* Synopsys Id is not available on old chips */
        *synopsys_id = 0;
index bb40382e205deffd9a3312099723b72f84da18a5..39eb7a65bb9f6a6137ffe13c4c2e776720311db1 100644 (file)
@@ -3339,13 +3339,6 @@ int stmmac_dvr_probe(struct device *device,
 
        spin_lock_init(&priv->lock);
 
-       ret = register_netdev(ndev);
-       if (ret) {
-               netdev_err(priv->dev, "%s: ERROR %i registering the device\n",
-                          __func__, ret);
-               goto error_netdev_register;
-       }
-
        /* If a specific clk_csr value is passed from the platform
         * this means that the CSR Clock Range selection cannot be
         * changed at run-time and it is fixed. Viceversa the driver'll try to
@@ -3372,11 +3365,21 @@ int stmmac_dvr_probe(struct device *device,
                }
        }
 
-       return 0;
+       ret = register_netdev(ndev);
+       if (ret) {
+               netdev_err(priv->dev, "%s: ERROR %i registering the device\n",
+                          __func__, ret);
+               goto error_netdev_register;
+       }
+
+       return ret;
 
-error_mdio_register:
-       unregister_netdev(ndev);
 error_netdev_register:
+       if (priv->hw->pcs != STMMAC_PCS_RGMII &&
+           priv->hw->pcs != STMMAC_PCS_TBI &&
+           priv->hw->pcs != STMMAC_PCS_RTBI)
+               stmmac_mdio_unregister(ndev);
+error_mdio_register:
        netif_napi_del(&priv->napi);
 error_hw_init:
        clk_disable_unprepare(priv->pclk);
index 23322fd9e3acfba03cfc3b328322040649d27913..b0344c21375292fe3489a4872400be6535785491 100644 (file)
@@ -81,8 +81,8 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
        value |= (phyaddr << priv->hw->mii.addr_shift)
                & priv->hw->mii.addr_mask;
        value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
-       value |= (priv->clk_csr & priv->hw->mii.clk_csr_mask)
-               << priv->hw->mii.clk_csr_shift;
+       value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift)
+               & priv->hw->mii.clk_csr_mask;
        if (priv->plat->has_gmac4)
                value |= MII_GMAC4_READ;
 
@@ -116,16 +116,18 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
        unsigned int mii_address = priv->hw->mii.addr;
        unsigned int mii_data = priv->hw->mii.data;
 
-       u32 value = MII_WRITE | MII_BUSY;
+       u32 value = MII_BUSY;
 
        value |= (phyaddr << priv->hw->mii.addr_shift)
                & priv->hw->mii.addr_mask;
        value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
 
-       value |= ((priv->clk_csr & priv->hw->mii.clk_csr_mask)
-               << priv->hw->mii.clk_csr_shift);
+       value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift)
+               & priv->hw->mii.clk_csr_mask;
        if (priv->plat->has_gmac4)
                value |= MII_GMAC4_WRITE;
+       else
+               value |= MII_WRITE;
 
        /* Wait until any existing MII operation is complete */
        if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
index e9e5ef241c6f9f37bc14766611e21dee728088f9..0e8e89f17dbb1128c6b562b17ae736622b6cf45b 100644 (file)
@@ -99,7 +99,7 @@
 #include <linux/atomic.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define cas_page_map(x)      kmap_atomic((x))
 #define cas_page_unmap(x)    kunmap_atomic((x))
index 66ecf0fcc3309f89b832770d3c7644871170c0fa..d277e410797694f3e8dd8cd40430cd23e1148b17 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <asm/io.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/irq.h>
 
 #ifdef CONFIG_SPARC
index ca96408058b05d49a2c64daba4591f512db0da28..72ff05cd3ed80c883d2bc34a969e8bdb1b61992a 100644 (file)
@@ -49,7 +49,7 @@
 #include <asm/prom.h>
 #include <asm/auxio.h>
 #endif
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/pgtable.h>
 #include <asm/irq.h>
index 0c0d48e5bea4ee709764a3cecb22e2490ec0694a..32279d21c8363d4976c6d313599fbc0e015e6a36 100644 (file)
@@ -121,7 +121,7 @@ static int cpts_fifo_read(struct cpts *cpts, int match)
        return type == match ? 0 : -1;
 }
 
-static cycle_t cpts_systim_read(const struct cyclecounter *cc)
+static u64 cpts_systim_read(const struct cyclecounter *cc)
 {
        u64 val = 0;
        struct cpts_event *event;
index 0aaf975bb3470cfdc6fb218058fc2d8f0e87959d..2255f9a6f3bc28ee0d712b464137ecc7784e1c2f 100644 (file)
@@ -751,7 +751,7 @@ static void tile_net_schedule_tx_wake_timer(struct net_device *dev,
                &info->mpipe[instance].tx_wake[priv->echannel];
 
        hrtimer_start(&tx_wake->timer,
-                     ktime_set(0, TX_TIMER_DELAY_USEC * 1000UL),
+                     TX_TIMER_DELAY_USEC * 1000UL,
                      HRTIMER_MODE_REL_PINNED);
 }
 
@@ -770,7 +770,7 @@ static void tile_net_schedule_egress_timer(void)
 
        if (!info->egress_timer_scheduled) {
                hrtimer_start(&info->egress_timer,
-                             ktime_set(0, EGRESS_TIMER_DELAY_USEC * 1000UL),
+                             EGRESS_TIMER_DELAY_USEC * 1000UL,
                              HRTIMER_MODE_REL_PINNED);
                info->egress_timer_scheduled = true;
        }
index ba5c5424905512074f86fa52145d806813a6ea1b..0a6c4e804eeda9dbad5911626b3157d70da95f1b 100644 (file)
@@ -114,7 +114,7 @@ static const int multicast_filter_limit = 32;
 #include <asm/processor.h>     /* Processor type for cache alignment. */
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/dmi.h>
 
 /* These identify the driver base version and may not be removed. */
index 3b08ec766076aa46de255a826468f5fe2ac4a3fb..f71883264cc061d6cb6d763781066093db196ed0 100644 (file)
@@ -88,7 +88,7 @@
 #include <pcmcia/ciscode.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifndef MANFID_COMPAQ
   #define MANFID_COMPAQ           0x0138
index e26398b5a7dcfec95bb2ca33cb521753a832eeab..d0a68bdd5f63b5934fd8dbf227929a1291fb848c 100644 (file)
@@ -1483,7 +1483,7 @@ void mac_drv_clear_rx_queue(struct s_smc *smc)
        r = queue->rx_curr_get ;
        while (queue->rx_used) {
                DRV_BUF_FLUSH(r,DDI_DMA_SYNC_FORCPU) ;
-               DB_RX("switch OWN bit of RxD 0x%x ",r,0,5) ;
+               DB_RX("switch OWN bit of RxD 0x%p ",r,0,5) ;
                r->rxd_rbctrl &= ~cpu_to_le32(BMU_OWN) ;
                frag_count = 1 ;
                DRV_BUF_FLUSH(r,DDI_DMA_SYNC_FORDEV) ;
@@ -1645,7 +1645,7 @@ void hwm_tx_frag(struct s_smc *smc, char far *virt, u_long phys, int len,
        DB_TX("hwm_tx_frag: len = %d, frame_status = %x ",len,frame_status,2) ;
        if (frame_status & LAN_TX) {
                /* '*t' is already defined */
-               DB_TX("LAN_TX: TxD = %x, virt = %x ",t,virt,3) ;
+               DB_TX("LAN_TX: TxD = %p, virt = %p ",t,virt,3) ;
                t->txd_virt = virt ;
                t->txd_txdscr = cpu_to_le32(smc->os.hwm.tx_descr) ;
                t->txd_tbadr = cpu_to_le32(phys) ;
@@ -1819,7 +1819,7 @@ void smt_send_mbuf(struct s_smc *smc, SMbuf *mb, int fc)
        __le32  tbctrl;
 
        NDD_TRACE("THSB",mb,fc,0) ;
-       DB_TX("smt_send_mbuf: mb = 0x%x, fc = 0x%x",mb,fc,4) ;
+       DB_TX("smt_send_mbuf: mb = 0x%p, fc = 0x%x",mb,fc,4) ;
 
        mb->sm_off-- ;  /* set to fc */
        mb->sm_len++ ;  /* + fc */
@@ -1960,7 +1960,7 @@ static void mac_drv_clear_txd(struct s_smc *smc)
 
                        do {
                                DRV_BUF_FLUSH(t1,DDI_DMA_SYNC_FORCPU) ;
-                               DB_TX("check OWN/EOF bit of TxD 0x%x",t1,0,5) ;
+                               DB_TX("check OWN/EOF bit of TxD 0x%p",t1,0,5) ;
                                tbctrl = le32_to_cpu(CR_READ(t1->txd_tbctrl));
 
                                if (tbctrl & BMU_OWN || !queue->tx_used){
@@ -1988,7 +1988,7 @@ static void mac_drv_clear_txd(struct s_smc *smc)
                        }
                        else {
 #ifndef PASS_1ST_TXD_2_TX_COMP
-                               DB_TX("mac_drv_tx_comp for TxD 0x%x",t2,0,4) ;
+                               DB_TX("mac_drv_tx_comp for TxD 0x%p",t2,0,4) ;
                                mac_drv_tx_complete(smc,t2) ;
 #else
                                DB_TX("mac_drv_tx_comp for TxD 0x%x",
@@ -2052,7 +2052,7 @@ void mac_drv_clear_tx_queue(struct s_smc *smc)
                tx_used = queue->tx_used ;
                while (tx_used) {
                        DRV_BUF_FLUSH(t,DDI_DMA_SYNC_FORCPU) ;
-                       DB_TX("switch OWN bit of TxD 0x%x ",t,0,5) ;
+                       DB_TX("switch OWN bit of TxD 0x%p ",t,0,5) ;
                        t->txd_tbctrl &= ~cpu_to_le32(BMU_OWN) ;
                        DRV_BUF_FLUSH(t,DDI_DMA_SYNC_FORDEV) ;
                        t = t->txd_next ;
index 441b4dc79450c1009151692565586c53060e5c83..52fa162a31e097af411cd20592a05fc501c5bbed 100644 (file)
@@ -284,7 +284,7 @@ void smt_pmf_received_pack(struct s_smc *smc, SMbuf *mb, int local)
        SMbuf           *reply ;
 
        sm = smtod(mb,struct smt_header *) ;
-       DB_SMT("SMT: processing PMF frame at %x len %d\n",sm,mb->sm_len) ;
+       DB_SMT("SMT: processing PMF frame at %p len %d\n",sm,mb->sm_len) ;
 #ifdef DEBUG
        dump_smt(smc,sm,"PMF Received") ;
 #endif
index 3a639180e4a016bb003da2c3417d58f61f797635..2414f1dc8ddd8e10a36f8f279bca0a64bb24acf8 100644 (file)
@@ -88,7 +88,7 @@ static const char * const boot_msg =
 
 #include <asm/byteorder.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include       "h/types.h"
 #undef ADDR                    // undo Linux definition
index cd78b7cacc753150a7e63f1ecd33d59e75d12e5e..e80a08903fcf413ed27a11c04fc3eb8a8683cba6 100644 (file)
@@ -504,7 +504,7 @@ void smt_received_pack(struct s_smc *smc, SMbuf *mb, int fs)
 #endif
 
        smt_swap_para(sm,(int) mb->sm_len,1) ;
-       DB_SMT("SMT : received packet [%s] at 0x%x\n",
+       DB_SMT("SMT : received packet [%s] at 0x%p\n",
                smt_type_name[m_fc(mb) & 0xf],sm) ;
        DB_SMT("SMT : version %d, class %s\n",sm->smt_version,
                smt_class_name[(sm->smt_class>LAST_CLASS)?0 : sm->smt_class]) ;
index 470b3dcd54e5ba844aa64a11eeee3b0551d1b235..922bf440e9f1cb2d20ba2d2419f73972b09714c3 100644 (file)
@@ -13,7 +13,7 @@
  */
 
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/string.h>
 #include <linux/mm.h>
index 78dbc44540f651edacb6ad0ecec242717ae4ba3f..7d054697b199b198ed4ded3ad25ca7089ebf0203 100644 (file)
@@ -55,7 +55,7 @@
 #include <linux/jiffies.h>
 #include <linux/random.h>
 #include <net/ax25.h> 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* --------------------------------------------------------------------- */
 
index 072cddce92640bdaf3a3c39e3351debf35810a3b..809dc25909d1c57eabf8a7b1bedd76a7fa399678 100644 (file)
@@ -86,7 +86,7 @@
 #include <linux/bitops.h>
 #include <linux/jiffies.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* --------------------------------------------------------------------- */
 
index 7b916d5b14b93c3db87399d747071a915256379d..ebc06822fd4d658f9259752a1d370cd3417b60a6 100644 (file)
@@ -82,7 +82,7 @@
 #include <linux/jiffies.h>
 #include <linux/time64.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 
index f9a8976195ba05f0fc07723969e5bb2136140a9b..60fcf512c208c8f3ed2e473f21e99701763d49b8 100644 (file)
@@ -67,7 +67,7 @@
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/hdlcdrv.h>
 #include <linux/baycom.h>
index 622ab3ab9e935af2c5f68f8df6aa25e5452a451a..f62e7f325cf92edeca25c40a1d11e53166017049 100644 (file)
@@ -69,7 +69,7 @@
 #include <linux/if_arp.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
index e4137c1b3df9451fe78593e42f8a1f2d4ea7d956..2479072981a1329a6bcbb5cd252bbeb1fe831b05 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/dma.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <net/ax25.h>
 #include "z8530.h"
 
index 4bad0b894e9c9fccbe89ae0427a01a4d07f226e4..8c3633c1d0789718fc528b9873e8295e6ab6b09e 100644 (file)
@@ -58,7 +58,7 @@
 #include <linux/hdlcdrv.h>
 #include <linux/random.h>
 #include <net/ax25.h> 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/crc-ccitt.h>
 
index 1dfe2304daa76431d32a153bae66a82ac0e96c6e..ece59c54a653348014b686882e28e5bf1b335e37 100644 (file)
@@ -17,7 +17,7 @@
  */
 #include <linux/module.h>
 #include <linux/bitops.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/crc16.h>
 #include <linux/string.h>
 #include <linux/mm.h>
index b8083161ef461d87c613323c2893cac4ba2550b6..6754cd01c605646421f81ec7aa519cca7a7ec4c4 100644 (file)
 
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "z8530.h"
 
index aaff07c10058520fdba0b9e419bc95d8219a381c..b6891ada1d7b7b67311fc8f1e6b04115ba341d11 100644 (file)
@@ -68,7 +68,7 @@
 #include <linux/seq_file.h>
 #include <net/net_namespace.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/init.h>
 
 #include <linux/yam.h>
index f5a9728b89f3d63383bbe2f12ed19c613b7fd8ed..dd7fc6659ad40222f48d29bee637479ebc475322 100644 (file)
@@ -46,7 +46,7 @@
 #include <asm/byteorder.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define rr_if_busy(dev)     netif_queue_stopped(dev)
 #define rr_if_running(dev)  netif_running(dev)
index 057025722e3d006f4e78b0a53c20bec0440a726b..46d53a6c8cf868a18ab82a27e730c36e1bc6fb0b 100644 (file)
@@ -510,7 +510,7 @@ at86rf230_async_state_delay(void *context)
        case STATE_TRX_OFF:
                switch (ctx->to_state) {
                case STATE_RX_AACK_ON:
-                       tim = ktime_set(0, c->t_off_to_aack * NSEC_PER_USEC);
+                       tim = c->t_off_to_aack * NSEC_PER_USEC;
                        /* state change from TRX_OFF to RX_AACK_ON to do a
                         * calibration, we need to reset the timeout for the
                         * next one.
@@ -519,7 +519,7 @@ at86rf230_async_state_delay(void *context)
                        goto change;
                case STATE_TX_ARET_ON:
                case STATE_TX_ON:
-                       tim = ktime_set(0, c->t_off_to_tx_on * NSEC_PER_USEC);
+                       tim = c->t_off_to_tx_on * NSEC_PER_USEC;
                        /* state change from TRX_OFF to TX_ON or ARET_ON to do
                         * a calibration, we need to reset the timeout for the
                         * next one.
@@ -539,8 +539,7 @@ at86rf230_async_state_delay(void *context)
                         * to TX_ON or TRX_OFF.
                         */
                        if (!force) {
-                               tim = ktime_set(0, (c->t_frame + c->t_p_ack) *
-                                                  NSEC_PER_USEC);
+                               tim = (c->t_frame + c->t_p_ack) * NSEC_PER_USEC;
                                goto change;
                        }
                        break;
@@ -552,7 +551,7 @@ at86rf230_async_state_delay(void *context)
        case STATE_P_ON:
                switch (ctx->to_state) {
                case STATE_TRX_OFF:
-                       tim = ktime_set(0, c->t_reset_to_off * NSEC_PER_USEC);
+                       tim = c->t_reset_to_off * NSEC_PER_USEC;
                        goto change;
                default:
                        break;
index 031093e1c25f55244e6bdfde4ebeb65c0f2f10c1..dbfbb33ac66c2caf05e22d7e4b0bd54629bec635 100644 (file)
@@ -99,6 +99,11 @@ struct ipvl_port {
        int                     count;
 };
 
+struct ipvl_skb_cb {
+       bool tx_pkt;
+};
+#define IPVL_SKB_CB(_skb) ((struct ipvl_skb_cb *)&((_skb)->cb[0]))
+
 static inline struct ipvl_port *ipvlan_port_get_rcu(const struct net_device *d)
 {
        return rcu_dereference(d->rx_handler_data);
index b4e990743e1da0cb3a946f5473d02cce7447bd1a..83ce74acf82d5e08676cb0d796aac1fe1b524071 100644 (file)
@@ -198,7 +198,7 @@ void ipvlan_process_multicast(struct work_struct *work)
        unsigned int mac_hash;
        int ret;
        u8 pkt_type;
-       bool hlocal, dlocal;
+       bool tx_pkt;
 
        __skb_queue_head_init(&list);
 
@@ -207,8 +207,11 @@ void ipvlan_process_multicast(struct work_struct *work)
        spin_unlock_bh(&port->backlog.lock);
 
        while ((skb = __skb_dequeue(&list)) != NULL) {
+               struct net_device *dev = skb->dev;
+               bool consumed = false;
+
                ethh = eth_hdr(skb);
-               hlocal = ether_addr_equal(ethh->h_source, port->dev->dev_addr);
+               tx_pkt = IPVL_SKB_CB(skb)->tx_pkt;
                mac_hash = ipvlan_mac_hash(ethh->h_dest);
 
                if (ether_addr_equal(ethh->h_dest, port->dev->broadcast))
@@ -216,41 +219,45 @@ void ipvlan_process_multicast(struct work_struct *work)
                else
                        pkt_type = PACKET_MULTICAST;
 
-               dlocal = false;
                rcu_read_lock();
                list_for_each_entry_rcu(ipvlan, &port->ipvlans, pnode) {
-                       if (hlocal && (ipvlan->dev == skb->dev)) {
-                               dlocal = true;
+                       if (tx_pkt && (ipvlan->dev == skb->dev))
                                continue;
-                       }
                        if (!test_bit(mac_hash, ipvlan->mac_filters))
                                continue;
-
+                       if (!(ipvlan->dev->flags & IFF_UP))
+                               continue;
                        ret = NET_RX_DROP;
                        len = skb->len + ETH_HLEN;
                        nskb = skb_clone(skb, GFP_ATOMIC);
-                       if (!nskb)
-                               goto acct;
-
-                       nskb->pkt_type = pkt_type;
-                       nskb->dev = ipvlan->dev;
-                       if (hlocal)
-                               ret = dev_forward_skb(ipvlan->dev, nskb);
-                       else
-                               ret = netif_rx(nskb);
-acct:
+                       local_bh_disable();
+                       if (nskb) {
+                               consumed = true;
+                               nskb->pkt_type = pkt_type;
+                               nskb->dev = ipvlan->dev;
+                               if (tx_pkt)
+                                       ret = dev_forward_skb(ipvlan->dev, nskb);
+                               else
+                                       ret = netif_rx(nskb);
+                       }
                        ipvlan_count_rx(ipvlan, len, ret == NET_RX_SUCCESS, true);
+                       local_bh_enable();
                }
                rcu_read_unlock();
 
-               if (dlocal) {
+               if (tx_pkt) {
                        /* If the packet originated here, send it out. */
                        skb->dev = port->dev;
                        skb->pkt_type = pkt_type;
                        dev_queue_xmit(skb);
                } else {
-                       kfree_skb(skb);
+                       if (consumed)
+                               consume_skb(skb);
+                       else
+                               kfree_skb(skb);
                }
+               if (dev)
+                       dev_put(dev);
        }
 }
 
@@ -470,15 +477,24 @@ out:
 }
 
 static void ipvlan_multicast_enqueue(struct ipvl_port *port,
-                                    struct sk_buff *skb)
+                                    struct sk_buff *skb, bool tx_pkt)
 {
        if (skb->protocol == htons(ETH_P_PAUSE)) {
                kfree_skb(skb);
                return;
        }
 
+       /* Record that the deferred packet is from TX or RX path. By
+        * looking at mac-addresses on packet will lead to erronus decisions.
+        * (This would be true for a loopback-mode on master device or a
+        * hair-pin mode of the switch.)
+        */
+       IPVL_SKB_CB(skb)->tx_pkt = tx_pkt;
+
        spin_lock(&port->backlog.lock);
        if (skb_queue_len(&port->backlog) < IPVLAN_QBACKLOG_LIMIT) {
+               if (skb->dev)
+                       dev_hold(skb->dev);
                __skb_queue_tail(&port->backlog, skb);
                spin_unlock(&port->backlog.lock);
                schedule_work(&port->wq);
@@ -537,7 +553,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
 
        } else if (is_multicast_ether_addr(eth->h_dest)) {
                ipvlan_skb_crossing_ns(skb, NULL);
-               ipvlan_multicast_enqueue(ipvlan->port, skb);
+               ipvlan_multicast_enqueue(ipvlan->port, skb, true);
                return NET_XMIT_SUCCESS;
        }
 
@@ -634,7 +650,7 @@ static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb,
                         */
                        if (nskb) {
                                ipvlan_skb_crossing_ns(nskb, NULL);
-                               ipvlan_multicast_enqueue(port, nskb);
+                               ipvlan_multicast_enqueue(port, nskb, false);
                        }
                }
        } else {
index 693ec5b6622233cd3a28c64c11d6abb97585318b..8b0f99300cbc97d8c8b93c3dfa99cd841914c086 100644 (file)
@@ -135,6 +135,7 @@ err:
 static void ipvlan_port_destroy(struct net_device *dev)
 {
        struct ipvl_port *port = ipvlan_port_get_rtnl(dev);
+       struct sk_buff *skb;
 
        dev->priv_flags &= ~IFF_IPVLAN_MASTER;
        if (port->mode == IPVLAN_MODE_L3S) {
@@ -144,7 +145,11 @@ static void ipvlan_port_destroy(struct net_device *dev)
        }
        netdev_rx_handler_unregister(dev);
        cancel_work_sync(&port->wq);
-       __skb_queue_purge(&port->backlog);
+       while ((skb = __skb_dequeue(&port->backlog)) != NULL) {
+               if (skb->dev)
+                       dev_put(skb->dev);
+               kfree_skb(skb);
+       }
        kfree(port);
 }
 
index 7a3f990c193546c42888f937497718d18c2b80e5..7a20a9a4663ac161ba6c674f26006999e4b71ade 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/slab.h>
 #include <linux/tty.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/delay.h>
 #include <linux/mutex.h>
 
index fb5d162ec7d2a563ae55b1fcbe6e64d989ddebd8..24c0f169a7b19915f08392adcc16a26e37ff257e 100644 (file)
@@ -71,7 +71,7 @@
 
 #include <asm/unaligned.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/irda/irda.h>
 #include <net/irda/wrapper.h>
index 8e6e0edf24406e266498760d1b3f4c66c19d677b..3affded3e30d65c15bf0a697d5af2d38212e8adb 100644 (file)
 
 #include <asm/unaligned.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/irda/irda.h>
 #include <net/irda/wrapper.h>
index 37f23a189b35147bcf21b58f742cc861dbbf01b8..741452c7ce354cad89443127254e0689e62076df 100644 (file)
@@ -87,7 +87,7 @@
 
 #include <asm/unaligned.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/irda/irda.h>
 #include <net/irda/wrapper.h>
index bca6a1e72d1d33ea2fd3e530cbbe516890f4eed5..6f6ed75b63c97e7eaa2e49e7fcb385ca965f1ca5 100644 (file)
@@ -55,7 +55,7 @@
 
 #include <asm/unaligned.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/irda/irda.h>
 #include <net/irda/wrapper.h>
index a0849f49bbec7401c3c6a366e0ca5c8d98fb651f..ffedad2a360afb8154f0e1e8b9be0c1d388fa5d9 100644 (file)
@@ -45,7 +45,7 @@ MODULE_LICENSE("GPL");
 #include <linux/seq_file.h>
 #include <linux/math64.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 #include <net/irda/irda.h>
index 6255973e3dda35fd41464ce51f0f9fb9f0b8364b..1e05b7c2d157a22e06d115bcdd1d268876be03a7 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/fcntl.h>
 #include <linux/in.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 #include <linux/inet.h>
index 36e3e2033ecab816a3e03edddd47a3232e6961ca..e28913d9ea7eff560cd0da0325f6148a85c904d6 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define MII_DM9161_SCR         0x10
 #define MII_DM9161_SCR_INIT    0x0610
index 22b51f01a94a7f3a67fd1a0fde91183c25c0e66f..567280a72241706f161e4b0b3022458c78e501a5 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 MODULE_DESCRIPTION("ICPlus IP175C/IP101A/IP101G/IC1001 PHY drivers");
 MODULE_AUTHOR("Michael Barkowski");
index b9fde1bcf0f0c302ed79d97c6a717d5f1ddfe7fe..8d198a1f003140210bc61e3b80a757f94b6d8608 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* The Level one LXT970 is used by many boards                              */
 
index d470db89e8dde1d32973a07dea84dd6dbbe05941..dbef8002bc2872c2546e4768a6391df3930b6bfa 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* ------------------------------------------------------------------------- */
 /* The Quality Semiconductor QS6612 is used on the RPX CLLF                  */
index 9c889e0303dd1f079c301c9a008fa8a0a094e90b..feb9569e33456b7fd73ed03a826d693506dd0d81 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/jiffies.h>
 #include <linux/slab.h>
 #include <asm/unaligned.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/string.h>
 
 #define PPP_VERSION    "2.4.2"
index 925d3e295bac0f2674678bbfeec43838449c8532..9ae53986cb4a5c3a4b929a854dc412f15bbe1cfe 100644 (file)
@@ -47,7 +47,7 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <asm/unaligned.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define PPP_VERSION    "2.4.2"
 
index f017c72bb7fd3a3fbc09fc8d9ceeefd767eb41e8..d7e405268983b44c337a7d854ac7e429277845d4 100644 (file)
@@ -83,7 +83,7 @@
 #include <net/netns/generic.h>
 #include <net/sock.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define PPPOE_HASH_BITS 4
 #define PPPOE_HASH_SIZE (1 << PPPOE_HASH_BITS)
index b9c8be6283d375e7a7cf483d0e70535cc12d7655..c0599b3b23c06b179c843562dc7026f3e7d2f8df 100644 (file)
@@ -34,7 +34,7 @@
 
 #include <net/sock.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static const struct pppox_proto *pppox_protos[PX_MAX_PROTO + 1];
 
index 8b8b532597830e47cc22a4415a6e68c07bc857d5..7820fced33f6286a180b88d9341e2f3e909924c3 100644 (file)
@@ -55,7 +55,7 @@ static char version[] = "sb1000.c:v1.1.2 6/01/98 (fventuri@mediaone.net)\n";
 
 #include <asm/io.h>
 #include <asm/processor.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef SB1000_DEBUG
 static int sb1000_debug = SB1000_DEBUG;
index 27ed25252aac502838527ec48ba48eda754ed69c..5782733959f0e0a7648d92ae1717065eb72b85fd 100644 (file)
@@ -75,7 +75,7 @@
 #include <linux/skbuff.h>
 #include <net/sock.h>
 #include <linux/timer.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <net/checksum.h>
 #include <asm/unaligned.h>
 
index 7e933d8ff811e1b70b0f4f113983d0d431b0679c..9841f3dc068227ae93777eaca1ad30869d8670b1 100644 (file)
@@ -64,7 +64,7 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/sched.h>
 #include <linux/string.h>
index 57e88b8147002237fd34ec39ebeb33093e6503e0..cd8e02c94be0e514f226b8109e59e5ec29dad7de 100644 (file)
@@ -73,7 +73,7 @@
 #include <linux/uio.h>
 #include <linux/skb_array.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Uncomment to enable debugging */
 /* #define TUN_DEBUG 1 */
index 6c646e228833c07b0369c28684f0a6b4aa27cf2c..6e98ede997d3f08d4ac3fa967382b55e4dfc287d 100644 (file)
@@ -1367,6 +1367,7 @@ static struct usb_driver asix_driver = {
        .probe =        usbnet_probe,
        .suspend =      asix_suspend,
        .resume =       asix_resume,
+       .reset_resume = asix_resume,
        .disconnect =   usbnet_disconnect,
        .supports_autosuspend = 1,
        .disable_hub_initiated_lpm = 1,
index a1f2f6f1e6149840551cd2418299800119ee65a2..3daa41bdd4eae0e5d44451458cb456175f8aedb2 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/crc32.h>
 #include <linux/bitops.h>
 #include <linux/gfp.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #undef DEBUG
 
index 2d1a6f2e16ab811283b0864f6fa551a5572096f3..f317984f75360141ee606b8ca31b78baa853a1d5 100644 (file)
@@ -1282,7 +1282,7 @@ static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx)
        /* start timer, if not already started */
        if (!(hrtimer_active(&ctx->tx_timer) || atomic_read(&ctx->stop)))
                hrtimer_start(&ctx->tx_timer,
-                               ktime_set(0, ctx->timer_interval),
+                               ctx->timer_interval,
                                HRTIMER_MODE_REL);
 }
 
index 338aed5da14d849c17f5e9125f3a1652d0859ac1..876f02f4945eafdc2fb5cfa0f9dcb54d9b498af4 100644 (file)
@@ -54,7 +54,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/wait.h>
 #include <linux/firmware.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 #undef DEBUG
index 399f7ee57aead0db2b7a5de51d245020bc21b4b8..24e803fe9a534c2e23dee6418496dd2755ff8de9 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/usb.h>
 #include <linux/module.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "pegasus.h"
 
 /*
index 93a1bda1c1e5e1161b2a4f44519e5fe625cf51bd..95b7bd0d7abcac85482da6067626e034a57b56b3 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/usb.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Version Information */
 #define DRIVER_VERSION "v0.6.2 (2004/08/27)"
index 08327e005cccf27fc18db64d234aaefd0dcd1a1f..4a105006ca637bc985698fa378ff6d14e1494b3f 100644 (file)
@@ -333,9 +333,9 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
 static void virtnet_xdp_xmit(struct virtnet_info *vi,
                             struct receive_queue *rq,
                             struct send_queue *sq,
-                            struct xdp_buff *xdp)
+                            struct xdp_buff *xdp,
+                            void *data)
 {
-       struct page *page = virt_to_head_page(xdp->data);
        struct virtio_net_hdr_mrg_rxbuf *hdr;
        unsigned int num_sg, len;
        void *xdp_sent;
@@ -343,32 +343,46 @@ static void virtnet_xdp_xmit(struct virtnet_info *vi,
 
        /* Free up any pending old buffers before queueing new ones. */
        while ((xdp_sent = virtqueue_get_buf(sq->vq, &len)) != NULL) {
-               struct page *sent_page = virt_to_head_page(xdp_sent);
+               if (vi->mergeable_rx_bufs) {
+                       struct page *sent_page = virt_to_head_page(xdp_sent);
 
-               if (vi->mergeable_rx_bufs)
                        put_page(sent_page);
-               else
-                       give_pages(rq, sent_page);
+               } else { /* small buffer */
+                       struct sk_buff *skb = xdp_sent;
+
+                       kfree_skb(skb);
+               }
        }
 
-       /* Zero header and leave csum up to XDP layers */
-       hdr = xdp->data;
-       memset(hdr, 0, vi->hdr_len);
+       if (vi->mergeable_rx_bufs) {
+               /* Zero header and leave csum up to XDP layers */
+               hdr = xdp->data;
+               memset(hdr, 0, vi->hdr_len);
+
+               num_sg = 1;
+               sg_init_one(sq->sg, xdp->data, xdp->data_end - xdp->data);
+       } else { /* small buffer */
+               struct sk_buff *skb = data;
+
+               /* Zero header and leave csum up to XDP layers */
+               hdr = skb_vnet_hdr(skb);
+               memset(hdr, 0, vi->hdr_len);
 
-       num_sg = 1;
-       sg_init_one(sq->sg, xdp->data, xdp->data_end - xdp->data);
+               num_sg = 2;
+               sg_init_table(sq->sg, 2);
+               sg_set_buf(sq->sg, hdr, vi->hdr_len);
+               skb_to_sgvec(skb, sq->sg + 1, 0, skb->len);
+       }
        err = virtqueue_add_outbuf(sq->vq, sq->sg, num_sg,
-                                  xdp->data, GFP_ATOMIC);
+                                  data, GFP_ATOMIC);
        if (unlikely(err)) {
-               if (vi->mergeable_rx_bufs)
+               if (vi->mergeable_rx_bufs) {
+                       struct page *page = virt_to_head_page(xdp->data);
+
                        put_page(page);
-               else
-                       give_pages(rq, page);
+               } else /* small buffer */
+                       kfree_skb(data);
                return; // On error abort to avoid unnecessary kick
-       } else if (!vi->mergeable_rx_bufs) {
-               /* If not mergeable bufs must be big packets so cleanup pages */
-               give_pages(rq, (struct page *)page->private);
-               page->private = 0;
        }
 
        virtqueue_kick(sq->vq);
@@ -377,23 +391,26 @@ static void virtnet_xdp_xmit(struct virtnet_info *vi,
 static u32 do_xdp_prog(struct virtnet_info *vi,
                       struct receive_queue *rq,
                       struct bpf_prog *xdp_prog,
-                      struct page *page, int offset, int len)
+                      void *data, int len)
 {
        int hdr_padded_len;
        struct xdp_buff xdp;
+       void *buf;
        unsigned int qp;
        u32 act;
-       u8 *buf;
-
-       buf = page_address(page) + offset;
 
-       if (vi->mergeable_rx_bufs)
+       if (vi->mergeable_rx_bufs) {
                hdr_padded_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
-       else
-               hdr_padded_len = sizeof(struct padded_vnet_hdr);
+               xdp.data = data + hdr_padded_len;
+               xdp.data_end = xdp.data + (len - vi->hdr_len);
+               buf = data;
+       } else { /* small buffers */
+               struct sk_buff *skb = data;
 
-       xdp.data = buf + hdr_padded_len;
-       xdp.data_end = xdp.data + (len - vi->hdr_len);
+               xdp.data = skb->data;
+               xdp.data_end = xdp.data + len;
+               buf = skb->data;
+       }
 
        act = bpf_prog_run_xdp(xdp_prog, &xdp);
        switch (act) {
@@ -403,8 +420,8 @@ static u32 do_xdp_prog(struct virtnet_info *vi,
                qp = vi->curr_queue_pairs -
                        vi->xdp_queue_pairs +
                        smp_processor_id();
-               xdp.data = buf + (vi->mergeable_rx_bufs ? 0 : 4);
-               virtnet_xdp_xmit(vi, rq, &vi->sq[qp], &xdp);
+               xdp.data = buf;
+               virtnet_xdp_xmit(vi, rq, &vi->sq[qp], &xdp, data);
                return XDP_TX;
        default:
                bpf_warn_invalid_xdp_action(act);
@@ -414,26 +431,17 @@ static u32 do_xdp_prog(struct virtnet_info *vi,
        }
 }
 
-static struct sk_buff *receive_small(struct virtnet_info *vi, void *buf, unsigned int len)
+static struct sk_buff *receive_small(struct net_device *dev,
+                                    struct virtnet_info *vi,
+                                    struct receive_queue *rq,
+                                    void *buf, unsigned int len)
 {
        struct sk_buff * skb = buf;
+       struct bpf_prog *xdp_prog;
 
        len -= vi->hdr_len;
        skb_trim(skb, len);
 
-       return skb;
-}
-
-static struct sk_buff *receive_big(struct net_device *dev,
-                                  struct virtnet_info *vi,
-                                  struct receive_queue *rq,
-                                  void *buf,
-                                  unsigned int len)
-{
-       struct bpf_prog *xdp_prog;
-       struct page *page = buf;
-       struct sk_buff *skb;
-
        rcu_read_lock();
        xdp_prog = rcu_dereference(rq->xdp_prog);
        if (xdp_prog) {
@@ -442,7 +450,7 @@ static struct sk_buff *receive_big(struct net_device *dev,
 
                if (unlikely(hdr->hdr.gso_type || hdr->hdr.flags))
                        goto err_xdp;
-               act = do_xdp_prog(vi, rq, xdp_prog, page, 0, len);
+               act = do_xdp_prog(vi, rq, xdp_prog, skb, len);
                switch (act) {
                case XDP_PASS:
                        break;
@@ -456,18 +464,33 @@ static struct sk_buff *receive_big(struct net_device *dev,
        }
        rcu_read_unlock();
 
-       skb = page_to_skb(vi, rq, page, 0, len, PAGE_SIZE);
+       return skb;
+
+err_xdp:
+       rcu_read_unlock();
+       dev->stats.rx_dropped++;
+       kfree_skb(skb);
+xdp_xmit:
+       return NULL;
+}
+
+static struct sk_buff *receive_big(struct net_device *dev,
+                                  struct virtnet_info *vi,
+                                  struct receive_queue *rq,
+                                  void *buf,
+                                  unsigned int len)
+{
+       struct page *page = buf;
+       struct sk_buff *skb = page_to_skb(vi, rq, page, 0, len, PAGE_SIZE);
+
        if (unlikely(!skb))
                goto err;
 
        return skb;
 
-err_xdp:
-       rcu_read_unlock();
 err:
        dev->stats.rx_dropped++;
        give_pages(rq, page);
-xdp_xmit:
        return NULL;
 }
 
@@ -483,7 +506,7 @@ xdp_xmit:
  * anymore.
  */
 static struct page *xdp_linearize_page(struct receive_queue *rq,
-                                      u16 num_buf,
+                                      u16 *num_buf,
                                       struct page *p,
                                       int offset,
                                       unsigned int *len)
@@ -497,7 +520,7 @@ static struct page *xdp_linearize_page(struct receive_queue *rq,
        memcpy(page_address(page) + page_off, page_address(p) + offset, *len);
        page_off += *len;
 
-       while (--num_buf) {
+       while (--*num_buf) {
                unsigned int buflen;
                unsigned long ctx;
                void *buf;
@@ -507,19 +530,22 @@ static struct page *xdp_linearize_page(struct receive_queue *rq,
                if (unlikely(!ctx))
                        goto err_buf;
 
+               buf = mergeable_ctx_to_buf_address(ctx);
+               p = virt_to_head_page(buf);
+               off = buf - page_address(p);
+
                /* guard against a misconfigured or uncooperative backend that
                 * is sending packet larger than the MTU.
                 */
-               if ((page_off + buflen) > PAGE_SIZE)
+               if ((page_off + buflen) > PAGE_SIZE) {
+                       put_page(p);
                        goto err_buf;
-
-               buf = mergeable_ctx_to_buf_address(ctx);
-               p = virt_to_head_page(buf);
-               off = buf - page_address(p);
+               }
 
                memcpy(page_address(page) + page_off,
                       page_address(p) + off, buflen);
                page_off += buflen;
+               put_page(p);
        }
 
        *len = page_off;
@@ -552,16 +578,10 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
                struct page *xdp_page;
                u32 act;
 
-               /* No known backend devices should send packets with
-                * more than a single buffer when XDP conditions are
-                * met. However it is not strictly illegal so the case
-                * is handled as an exception and a warning is thrown.
-                */
+               /* This happens when rx buffer size is underestimated */
                if (unlikely(num_buf > 1)) {
-                       bpf_warn_invalid_xdp_buffer();
-
                        /* linearize data for XDP */
-                       xdp_page = xdp_linearize_page(rq, num_buf,
+                       xdp_page = xdp_linearize_page(rq, &num_buf,
                                                      page, offset, &len);
                        if (!xdp_page)
                                goto err_xdp;
@@ -575,16 +595,25 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
                 * the receive path after XDP is loaded. In practice I
                 * was not able to create this condition.
                 */
-               if (unlikely(hdr->hdr.gso_type || hdr->hdr.flags))
+               if (unlikely(hdr->hdr.gso_type))
                        goto err_xdp;
 
-               act = do_xdp_prog(vi, rq, xdp_prog, page, offset, len);
+               act = do_xdp_prog(vi, rq, xdp_prog,
+                                 page_address(xdp_page) + offset, len);
                switch (act) {
                case XDP_PASS:
-                       if (unlikely(xdp_page != page))
-                               __free_pages(xdp_page, 0);
+                       /* We can only create skb based on xdp_page. */
+                       if (unlikely(xdp_page != page)) {
+                               rcu_read_unlock();
+                               put_page(page);
+                               head_skb = page_to_skb(vi, rq, xdp_page,
+                                                      0, len, PAGE_SIZE);
+                               ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len);
+                               return head_skb;
+                       }
                        break;
                case XDP_TX:
+                       ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len);
                        if (unlikely(xdp_page != page))
                                goto err_xdp;
                        rcu_read_unlock();
@@ -593,6 +622,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
                default:
                        if (unlikely(xdp_page != page))
                                __free_pages(xdp_page, 0);
+                       ewma_pkt_len_add(&rq->mrg_avg_pkt_len, len);
                        goto err_xdp;
                }
        }
@@ -704,7 +734,7 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
        else if (vi->big_packets)
                skb = receive_big(dev, vi, rq, buf, len);
        else
-               skb = receive_small(vi, buf, len);
+               skb = receive_small(dev, vi, rq, buf, len);
 
        if (unlikely(!skb))
                return;
@@ -1678,7 +1708,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog)
        int i, err;
 
        if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||
-           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) {
+           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) ||
+           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) ||
+           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO)) {
                netdev_warn(dev, "can't set XDP while host is implementing LRO, disable LRO first\n");
                return -EOPNOTSUPP;
        }
@@ -2452,13 +2484,13 @@ static __init int virtio_net_driver_init(void)
 {
        int ret;
 
-       ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "AP_VIRT_NET_ONLINE",
+       ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "virtio/net:online",
                                      virtnet_cpu_online,
                                      virtnet_cpu_down_prep);
        if (ret < 0)
                goto out;
        virtionet_online = ret;
-       ret = cpuhp_setup_state_multi(CPUHP_VIRT_NET_DEAD, "VIRT_NET_DEAD",
+       ret = cpuhp_setup_state_multi(CPUHP_VIRT_NET_DEAD, "virtio/net:dead",
                                      NULL, virtnet_cpu_dead);
        if (ret)
                goto err_dead;
index 7532646c3b7bedb89c2cbe95e84f09e32e0a8391..23dfb0eac0981704f2770bc3abe9bb32a80e3fc9 100644 (file)
@@ -967,6 +967,7 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
         */
        need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
        if (!ipv6_ndisc_frame(skb) && !need_strict) {
+               vrf_rx_stats(vrf_dev, skb->len);
                skb->dev = vrf_dev;
                skb->skb_iif = vrf_dev->ifindex;
 
@@ -1011,6 +1012,8 @@ static struct sk_buff *vrf_ip_rcv(struct net_device *vrf_dev,
                goto out;
        }
 
+       vrf_rx_stats(vrf_dev, skb->len);
+
        skb_push(skb, skb->mac_len);
        dev_queue_xmit_nit(skb, vrf_dev);
        skb_pull(skb, skb->mac_len);
index ae6ecf4011892f4fa50861cfff6ee4bf158639fe..65ee2a6f248cfcbd2761272431c37627eafaced5 100644 (file)
@@ -52,7 +52,7 @@
 
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static const char version[] = "DLCI driver v0.35, 4 Jan 1997, mike.mclagan@linux.org";
 
index 7351e5440ed78b74aa383de3d26ae74add0a4499..799830ffcae2b9ef48d18b94e28f97777555b78f 100644 (file)
@@ -95,7 +95,7 @@
 
 #include <asm/cache.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 
index 03696d35ee9cce109812a8215c4e3b7d118764e5..33265eb50420eee1f0cbef33c9d0f0e31889daa0 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/if.h>
 #include <linux/hdlc.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "farsync.h"
 
index dc334c85d966883854ecf42e5885101a793e54b2..166696d2c496e232b1073d0244272540035ce169 100644 (file)
@@ -39,7 +39,7 @@
 #include <linux/string.h>
 #include <linux/types.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "hd64570.h"
 
 #define get_msci(port)   (phy_node(port) ?   MSCI1_OFFSET :   MSCI0_OFFSET)
index e92ecf1d33148999a5714997fb8af4a5ed626894..7ef49dab68556b9309293383844a530a18db3681 100644 (file)
@@ -39,7 +39,7 @@
 #include <linux/string.h>
 #include <linux/types.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "hd64572.h"
 
 #define NAPI_WEIGHT            16
index 6676607164d651a729ceb709d1903561bf92ef76..9df9ed62beff0cb3b2c0be7dbe1f15e646da74de 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/if_arp.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
index 001b7796740dc3b6a78214cc42fb42978140ab44..4698450c77d1ef8cac62c163e3e8f8c06b99dc13 100644 (file)
@@ -59,7 +59,7 @@
 #include <asm/processor.h>             /* Processor type for cache alignment. */
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 //#include <asm/spinlock.h>
 
 #define DRIVER_MAJOR_VERSION     1
index ff2e4a5654c7cb29a907d39603b68760123c33f8..cffe23bd16e1a32cbf0076e1fbb0ddc7dc950a8d 100644 (file)
@@ -19,7 +19,7 @@
 #include <asm/io.h>
 #include <asm/dma.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "lmc.h"
 #include "lmc_var.h"
index 3f83be98d46925e83adf6d2a97e28e8ab4eb34dd..3ca3419c54a047a635cdc585536ebeb4a0b38f0e 100644 (file)
@@ -63,7 +63,7 @@
 #include <asm/types.h>
 #include <asm/byteorder.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "sbni.h"
 
index 421ac5f856994731fc7a0f3752c32dcebda15bf1..236c625380368affa00c5c65bbed1c3563ffa0b6 100644 (file)
@@ -56,7 +56,7 @@
 
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static const char* version = "SDLA driver v0.30, 12 Sep 1996, mike.mclagan@linux.org";
 
index b776a0ab106c0d55b1b7cdf14b79d91621d27aa1..9d9b4e0def2a531344c8fd3d78258e1690340350 100644 (file)
@@ -218,7 +218,7 @@ static int slic_ds26522_probe(struct spi_device *spi)
 
        ret = slic_ds26522_init_configure(spi);
        if (ret == 0)
-               pr_info("DS26522 cs%d configurated\n", spi->chip_select);
+               pr_info("DS26522 cs%d configured\n", spi->chip_select);
 
        return ret;
 }
index c893314a191f6b473af17f593c65d8b63ed5dbc8..50d6ee6afe26fc362f843af5314c1644cf033e8f 100644 (file)
@@ -8271,7 +8271,7 @@ void ath10k_wmi_free_host_mem(struct ath10k *ar)
                dma_unmap_single(ar->dev,
                                 ar->wmi.mem_chunks[i].paddr,
                                 ar->wmi.mem_chunks[i].len,
-                                DMA_TO_DEVICE);
+                                DMA_BIDIRECTIONAL);
                kfree(ar->wmi.mem_chunks[i].vaddr);
        }
 
index 486afa98a5b8d1d73a56829f6d16ecb1316cb66e..4e2f3ac266c3750d069a2176b97dd1726b310f57 100644 (file)
@@ -2713,7 +2713,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
                fifo_list = &txq->txq_fifo[txq->txq_tailidx];
                if (list_empty(fifo_list)) {
                        ath_txq_unlock(sc, txq);
-                       return;
+                       break;
                }
 
                bf = list_first_entry(fifo_list, struct ath_buf, list);
index eb92d5ab7a27bf3a9e32bfcd319151d8ac78a294..e12f62356fd14791299160c2f63d8a0d281ad206 100644 (file)
@@ -48,7 +48,7 @@
 #include <linux/timer.h>
 #include <asm/byteorder.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
index ccae3bbe7db24deb3a5656c2ba9556ad6dbf7cfa..7ffc4aba5bab0683fe993d1d5eef9e8e3d8389d0 100644 (file)
@@ -6868,7 +6868,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
 
        err = brcmf_p2p_attach(cfg, p2pdev_forced);
        if (err) {
-               brcmf_err("P2P initilisation failed (%d)\n", err);
+               brcmf_err("P2P initialisation failed (%d)\n", err);
                goto wiphy_unreg_out;
        }
        err = brcmf_btcoex_attach(cfg);
@@ -6893,7 +6893,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
        err = brcmf_fweh_activate_events(ifp);
        if (err) {
                brcmf_err("FWEH activation failed (%d)\n", err);
-               goto wiphy_unreg_out;
+               goto detach;
        }
 
        /* Fill in some of the advertised nl80211 supported features */
@@ -6908,6 +6908,9 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
 
        return cfg;
 
+detach:
+       brcmf_btcoex_detach(cfg);
+       brcmf_p2p_detach(&cfg->p2p);
 wiphy_unreg_out:
        wiphy_unregister(cfg->wiphy);
 priv_out:
index f273cab0da1022647842caf27020b01d613f05ba..9a25e79a46cf2d256c70c905bf9d03ebbe19afe8 100644 (file)
@@ -137,6 +137,7 @@ static int brcmf_pno_add_ssid(struct brcmf_if *ifp, struct cfg80211_ssid *ssid,
        pfn.wpa_auth = cpu_to_le32(BRCMF_PNO_WPA_AUTH_ANY);
        pfn.wsec = cpu_to_le32(0);
        pfn.infra = cpu_to_le32(1);
+       pfn.flags = 0;
        if (active)
                pfn.flags = cpu_to_le32(1 << BRCMF_PNO_HIDDEN_BIT);
        pfn.ssid.SSID_len = cpu_to_le32(ssid->ssid_len);
index 64176090b196562008bfd72257b3b980202bf737..356aba9d3d538a3029431e44b99dd6e4ed89529a 100644 (file)
@@ -148,7 +148,7 @@ that only one external action is invoked at a time.
 #include <linux/dma-mapping.h>
 #include <linux/proc_fs.h>
 #include <linux/skbuff.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
index 218f2a32de21758e105bb4a12e782e65e11ea90a..ce7eda20a68f8a8f9a0840de39586f89fcf69f58 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/types.h>
 #include <linux/wireless.h>
 #include <linux/etherdevice.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "libipw.h"
 
index 2332075565f2eba6ec53891ee302759e75293497..c58c5b2dcce54e19f6df789511c60f20644e4830 100644 (file)
@@ -46,7 +46,7 @@
 #include <linux/types.h>
 #include <linux/wireless.h>
 #include <linux/etherdevice.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <net/net_namespace.h>
 #include <net/arp.h>
 
index 1c1ec7bb93023567f63e01e386076b1d20f1b326..6df19f03355af346f702d629c37fcc4ece4a5032 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/types.h>
 #include <linux/wireless.h>
 #include <linux/etherdevice.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/ctype.h>
 
 #include <net/lib80211.h>
index e8c039879b05a57ef5213a43a51c4cd1785ed8f4..048f1e3ada1191b1a2217972cff4c30f47fddd58 100644 (file)
@@ -39,7 +39,7 @@
 #include <linux/types.h>
 #include <linux/wireless.h>
 #include <linux/etherdevice.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "libipw.h"
 
index a8a9bd8e176a35f3e56f50f32f8fe00c685d6440..544ef7adde7d2a0dde98479f5a6b134b9a54d146 100644 (file)
@@ -32,7 +32,7 @@
 
 
 #include <asm/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/slab.h>
 #include <linux/netdevice.h>
index 1a16b8cb366eb837fd6d081d79c5d9774627726d..544fc09dcb62435dc7316b2d8463c76d386ed91e 100644 (file)
@@ -27,7 +27,7 @@
 #include <net/net_namespace.h>
 #include <net/iw_handler.h>
 #include <net/lib80211.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "hostap_wlan.h"
 #include "hostap_80211.h"
index 6700387ef9ab65f5e5f2bf4884ba8369c102cfbd..ce9d4db0d9caba299535397a55f2ae911c18d328 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/delay.h>
 #include <linux/ktime.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 #include "prismcompat.h"
index 48e8a978a832daf2f727d0b43bfb386ededf179d..334717b0a2be86d9cdfdda88737bba624bf8d3d9 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/pci.h>
 #include <linux/etherdevice.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "prismcompat.h"
 #include "isl_ioctl.h"
index 9f61293f1a5683fd6dc8042c273a64944d8061c8..f38c44061b5ba664f832d62b4a899b8a80568b1f 100644 (file)
@@ -177,7 +177,7 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
        if (rt2800usb_txstatus_pending(rt2x00dev)) {
                /* Read register after 1 ms */
                hrtimer_start(&rt2x00dev->txstatus_timer,
-                             ktime_set(0, TXSTATUS_READ_INTERVAL),
+                             TXSTATUS_READ_INTERVAL,
                              HRTIMER_MODE_REL);
                return false;
        }
@@ -204,7 +204,7 @@ static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev)
 
        /* Read TX_STA_FIFO register after 2 ms */
        hrtimer_start(&rt2x00dev->txstatus_timer,
-                     ktime_set(0, 2*TXSTATUS_READ_INTERVAL),
+                     2 * TXSTATUS_READ_INTERVAL,
                      HRTIMER_MODE_REL);
 }
 
index 4fdc7223c894b29671b03403856ffa0c5fb85a97..b94479441b0c77f41dada030834c8c4b64a86210 100644 (file)
@@ -53,7 +53,7 @@
 
 #include <asm/io.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Warning : these stuff will slow down the driver... */
 #define WIRELESS_SPY           /* Enable spying addresses */
index 2caa4ad04dba4a6e66a02b74173ab1b016ca7af1..ded1493fee9c975742ede341b991b4446a48e3d7 100644 (file)
@@ -1829,7 +1829,8 @@ bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
 
        spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
        pskb = __skb_dequeue(&ring->queue);
-       dev_kfree_skb_irq(pskb);
+       if (pskb)
+               dev_kfree_skb_irq(pskb);
 
        /*this is wrong, fill_tx_cmddesc needs update*/
        pdesc = &ring->desc[0];
index d9d29ab8818460e1c33db89720a45bb0ed9dc50b..acec0d9ec422b22ee0c92b26da3d99c9dd0c5878 100644 (file)
@@ -51,7 +51,7 @@
 #include <pcmcia/ds.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "wl3501.h"
 
index 6ccba0d862df704877db1589fff036d40c10cf36..019a158e1128d7a27cdbea269a9149bc90b364dd 100644 (file)
@@ -138,11 +138,11 @@ static int amd_ntb_mw_set_trans(struct ntb_dev *ntb, int idx,
        base_addr = pci_resource_start(ndev->ntb.pdev, bar);
 
        if (bar != 1) {
-               xlat_reg = AMD_BAR23XLAT_OFFSET + ((bar - 2) << 3);
-               limit_reg = AMD_BAR23LMT_OFFSET + ((bar - 2) << 3);
+               xlat_reg = AMD_BAR23XLAT_OFFSET + ((bar - 2) << 2);
+               limit_reg = AMD_BAR23LMT_OFFSET + ((bar - 2) << 2);
 
                /* Set the limit if supported */
-               limit = base_addr + size;
+               limit = size;
 
                /* set and verify setting the translation address */
                write64(addr, peer_mmio + xlat_reg);
@@ -164,14 +164,8 @@ static int amd_ntb_mw_set_trans(struct ntb_dev *ntb, int idx,
                xlat_reg = AMD_BAR1XLAT_OFFSET;
                limit_reg = AMD_BAR1LMT_OFFSET;
 
-               /* split bar addr range must all be 32 bit */
-               if (addr & (~0ull << 32))
-                       return -EINVAL;
-               if ((addr + size) & (~0ull << 32))
-                       return -EINVAL;
-
                /* Set the limit if supported */
-               limit = base_addr + size;
+               limit = size;
 
                /* set and verify setting the translation address */
                write64(addr, peer_mmio + xlat_reg);
@@ -199,6 +193,11 @@ static int amd_link_is_up(struct amd_ntb_dev *ndev)
        if (!ndev->peer_sta)
                return NTB_LNK_STA_ACTIVE(ndev->cntl_sta);
 
+       if (ndev->peer_sta & AMD_LINK_UP_EVENT) {
+               ndev->peer_sta = 0;
+               return 1;
+       }
+
        /* If peer_sta is reset or D0 event, the ISR has
         * started a timer to check link status of hardware.
         * So here just clear status bit. And if peer_sta is
@@ -207,7 +206,7 @@ static int amd_link_is_up(struct amd_ntb_dev *ndev)
         */
        if (ndev->peer_sta & AMD_PEER_RESET_EVENT)
                ndev->peer_sta &= ~AMD_PEER_RESET_EVENT;
-       else if (ndev->peer_sta & AMD_PEER_D0_EVENT)
+       else if (ndev->peer_sta & (AMD_PEER_D0_EVENT | AMD_LINK_DOWN_EVENT))
                ndev->peer_sta = 0;
 
        return 0;
@@ -491,6 +490,8 @@ static void amd_handle_event(struct amd_ntb_dev *ndev, int vec)
                break;
        case AMD_PEER_D3_EVENT:
        case AMD_PEER_PMETO_EVENT:
+       case AMD_LINK_UP_EVENT:
+       case AMD_LINK_DOWN_EVENT:
                amd_ack_smu(ndev, status);
 
                /* link down */
@@ -598,7 +599,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev,
 
 err_msix_request:
        while (i-- > 0)
-               free_irq(ndev->msix[i].vector, ndev);
+               free_irq(ndev->msix[i].vector, &ndev->vec[i]);
        pci_disable_msix(pdev);
 err_msix_enable:
        kfree(ndev->msix);
index 2eac3cd3e6469689ede8fe472f32993238817ad8..13d73ed94a52d55c05d94c91629c7e2e595f13fc 100644 (file)
@@ -148,9 +148,12 @@ enum {
        AMD_PEER_D3_EVENT       = BIT(2),
        AMD_PEER_PMETO_EVENT    = BIT(3),
        AMD_PEER_D0_EVENT       = BIT(4),
+       AMD_LINK_UP_EVENT       = BIT(5),
+       AMD_LINK_DOWN_EVENT     = BIT(6),
        AMD_EVENT_INTMASK       = (AMD_PEER_FLUSH_EVENT |
                                AMD_PEER_RESET_EVENT | AMD_PEER_D3_EVENT |
-                               AMD_PEER_PMETO_EVENT | AMD_PEER_D0_EVENT),
+                               AMD_PEER_PMETO_EVENT | AMD_PEER_D0_EVENT |
+                               AMD_LINK_UP_EVENT | AMD_LINK_DOWN_EVENT),
 
        AMD_PMESTAT_OFFSET      = 0x480,
        AMD_PMSGTRIG_OFFSET     = 0x490,
index 7310a261c858bab090bab14ecf3646626aac7651..eca9688bf9d9fdff11ea091b9b2e3d9c115ab8e0 100644 (file)
@@ -86,7 +86,12 @@ static const struct intel_ntb_xlat_reg xeon_pri_xlat;
 static const struct intel_ntb_xlat_reg xeon_sec_xlat;
 static struct intel_b2b_addr xeon_b2b_usd_addr;
 static struct intel_b2b_addr xeon_b2b_dsd_addr;
+static const struct intel_ntb_reg skx_reg;
+static const struct intel_ntb_alt_reg skx_pri_reg;
+static const struct intel_ntb_alt_reg skx_b2b_reg;
+static const struct intel_ntb_xlat_reg skx_sec_xlat;
 static const struct ntb_dev_ops intel_ntb_ops;
+static const struct ntb_dev_ops intel_ntb3_ops;
 
 static const struct file_operations intel_ntb_debugfs_info;
 static struct dentry *debugfs_dir;
@@ -145,6 +150,9 @@ module_param_named(xeon_b2b_dsd_bar5_addr32,
 MODULE_PARM_DESC(xeon_b2b_dsd_bar5_addr32,
                 "XEON B2B DSD split-BAR 5 32-bit address");
 
+static inline enum ntb_topo xeon_ppd_topo(struct intel_ntb_dev *ndev, u8 ppd);
+static int xeon_init_isr(struct intel_ntb_dev *ndev);
+
 #ifndef ioread64
 #ifdef readq
 #define ioread64 readq
@@ -206,6 +214,14 @@ static inline int pdev_is_xeon(struct pci_dev *pdev)
        return 0;
 }
 
+static inline int pdev_is_skx_xeon(struct pci_dev *pdev)
+{
+       if (pdev->device == PCI_DEVICE_ID_INTEL_NTB_B2B_SKX)
+               return 1;
+
+       return 0;
+}
+
 static inline void ndev_reset_unsafe_flags(struct intel_ntb_dev *ndev)
 {
        ndev->unsafe_flags = 0;
@@ -390,6 +406,9 @@ static irqreturn_t ndev_interrupt(struct intel_ntb_dev *ndev, int vec)
 
        vec_mask = ndev_vec_mask(ndev, vec);
 
+       if ((ndev->hwerr_flags & NTB_HWERR_MSIX_VECTOR32_BAD) && (vec == 31))
+               vec_mask |= ndev->db_link_mask;
+
        dev_dbg(ndev_dev(ndev), "vec %d vec_mask %llx\n", vec, vec_mask);
 
        ndev->last_ts = jiffies;
@@ -409,6 +428,9 @@ static irqreturn_t ndev_vec_isr(int irq, void *dev)
 {
        struct intel_ntb_vec *nvec = dev;
 
+       dev_dbg(ndev_dev(nvec->ndev), "irq: %d  nvec->num: %d\n",
+               irq, nvec->num);
+
        return ndev_interrupt(nvec->ndev, nvec->num);
 }
 
@@ -465,14 +487,14 @@ static int ndev_init_isr(struct intel_ntb_dev *ndev,
                        goto err_msix_request;
        }
 
-       dev_dbg(ndev_dev(ndev), "Using msix interrupts\n");
+       dev_dbg(ndev_dev(ndev), "Using %d msix interrupts\n", msix_count);
        ndev->db_vec_count = msix_count;
        ndev->db_vec_shift = msix_shift;
        return 0;
 
 err_msix_request:
        while (i-- > 0)
-               free_irq(ndev->msix[i].vector, ndev);
+               free_irq(ndev->msix[i].vector, &ndev->vec[i]);
        pci_disable_msix(pdev);
 err_msix_enable:
        kfree(ndev->msix);
@@ -547,8 +569,171 @@ static void ndev_deinit_isr(struct intel_ntb_dev *ndev)
        }
 }
 
-static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
-                                size_t count, loff_t *offp)
+static ssize_t ndev_ntb3_debugfs_read(struct file *filp, char __user *ubuf,
+                                     size_t count, loff_t *offp)
+{
+       struct intel_ntb_dev *ndev;
+       void __iomem *mmio;
+       char *buf;
+       size_t buf_size;
+       ssize_t ret, off;
+       union { u64 v64; u32 v32; u16 v16; } u;
+
+       ndev = filp->private_data;
+       mmio = ndev->self_mmio;
+
+       buf_size = min(count, 0x800ul);
+
+       buf = kmalloc(buf_size, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+
+       off = 0;
+
+       off += scnprintf(buf + off, buf_size - off,
+                        "NTB Device Information:\n");
+
+       off += scnprintf(buf + off, buf_size - off,
+                        "Connection Topology -\t%s\n",
+                        ntb_topo_string(ndev->ntb.topo));
+
+       off += scnprintf(buf + off, buf_size - off,
+                        "NTB CTL -\t\t%#06x\n", ndev->ntb_ctl);
+       off += scnprintf(buf + off, buf_size - off,
+                        "LNK STA -\t\t%#06x\n", ndev->lnk_sta);
+
+       if (!ndev->reg->link_is_up(ndev))
+               off += scnprintf(buf + off, buf_size - off,
+                                "Link Status -\t\tDown\n");
+       else {
+               off += scnprintf(buf + off, buf_size - off,
+                                "Link Status -\t\tUp\n");
+               off += scnprintf(buf + off, buf_size - off,
+                                "Link Speed -\t\tPCI-E Gen %u\n",
+                                NTB_LNK_STA_SPEED(ndev->lnk_sta));
+               off += scnprintf(buf + off, buf_size - off,
+                                "Link Width -\t\tx%u\n",
+                                NTB_LNK_STA_WIDTH(ndev->lnk_sta));
+       }
+
+       off += scnprintf(buf + off, buf_size - off,
+                        "Memory Window Count -\t%u\n", ndev->mw_count);
+       off += scnprintf(buf + off, buf_size - off,
+                        "Scratchpad Count -\t%u\n", ndev->spad_count);
+       off += scnprintf(buf + off, buf_size - off,
+                        "Doorbell Count -\t%u\n", ndev->db_count);
+       off += scnprintf(buf + off, buf_size - off,
+                        "Doorbell Vector Count -\t%u\n", ndev->db_vec_count);
+       off += scnprintf(buf + off, buf_size - off,
+                        "Doorbell Vector Shift -\t%u\n", ndev->db_vec_shift);
+
+       off += scnprintf(buf + off, buf_size - off,
+                        "Doorbell Valid Mask -\t%#llx\n", ndev->db_valid_mask);
+       off += scnprintf(buf + off, buf_size - off,
+                        "Doorbell Link Mask -\t%#llx\n", ndev->db_link_mask);
+       off += scnprintf(buf + off, buf_size - off,
+                        "Doorbell Mask Cached -\t%#llx\n", ndev->db_mask);
+
+       u.v64 = ndev_db_read(ndev, mmio + ndev->self_reg->db_mask);
+       off += scnprintf(buf + off, buf_size - off,
+                        "Doorbell Mask -\t\t%#llx\n", u.v64);
+
+       u.v64 = ndev_db_read(ndev, mmio + ndev->self_reg->db_bell);
+       off += scnprintf(buf + off, buf_size - off,
+                        "Doorbell Bell -\t\t%#llx\n", u.v64);
+
+       off += scnprintf(buf + off, buf_size - off,
+                        "\nNTB Incoming XLAT:\n");
+
+       u.v64 = ioread64(mmio + SKX_IMBAR1XBASE_OFFSET);
+       off += scnprintf(buf + off, buf_size - off,
+                        "IMBAR1XBASE -\t\t%#018llx\n", u.v64);
+
+       u.v64 = ioread64(mmio + SKX_IMBAR2XBASE_OFFSET);
+       off += scnprintf(buf + off, buf_size - off,
+                        "IMBAR2XBASE -\t\t%#018llx\n", u.v64);
+
+       u.v64 = ioread64(mmio + SKX_IMBAR1XLMT_OFFSET);
+       off += scnprintf(buf + off, buf_size - off,
+                        "IMBAR1XLMT -\t\t\t%#018llx\n", u.v64);
+
+       u.v64 = ioread64(mmio + SKX_IMBAR2XLMT_OFFSET);
+       off += scnprintf(buf + off, buf_size - off,
+                        "IMBAR2XLMT -\t\t\t%#018llx\n", u.v64);
+
+       if (ntb_topo_is_b2b(ndev->ntb.topo)) {
+               off += scnprintf(buf + off, buf_size - off,
+                                "\nNTB Outgoing B2B XLAT:\n");
+
+               u.v64 = ioread64(mmio + SKX_EMBAR1XBASE_OFFSET);
+               off += scnprintf(buf + off, buf_size - off,
+                                "EMBAR1XBASE -\t\t%#018llx\n", u.v64);
+
+               u.v64 = ioread64(mmio + SKX_EMBAR2XBASE_OFFSET);
+               off += scnprintf(buf + off, buf_size - off,
+                                "EMBAR2XBASE -\t\t%#018llx\n", u.v64);
+
+               u.v64 = ioread64(mmio + SKX_EMBAR1XLMT_OFFSET);
+               off += scnprintf(buf + off, buf_size - off,
+                                "EMBAR1XLMT -\t\t%#018llx\n", u.v64);
+
+               u.v64 = ioread64(mmio + SKX_EMBAR2XLMT_OFFSET);
+               off += scnprintf(buf + off, buf_size - off,
+                                "EMBAR2XLMT -\t\t%#018llx\n", u.v64);
+
+               off += scnprintf(buf + off, buf_size - off,
+                                "\nNTB Secondary BAR:\n");
+
+               u.v64 = ioread64(mmio + SKX_EMBAR0_OFFSET);
+               off += scnprintf(buf + off, buf_size - off,
+                                "EMBAR0 -\t\t%#018llx\n", u.v64);
+
+               u.v64 = ioread64(mmio + SKX_EMBAR1_OFFSET);
+               off += scnprintf(buf + off, buf_size - off,
+                                "EMBAR1 -\t\t%#018llx\n", u.v64);
+
+               u.v64 = ioread64(mmio + SKX_EMBAR2_OFFSET);
+               off += scnprintf(buf + off, buf_size - off,
+                                "EMBAR2 -\t\t%#018llx\n", u.v64);
+       }
+
+       off += scnprintf(buf + off, buf_size - off,
+                        "\nNTB Statistics:\n");
+
+       u.v16 = ioread16(mmio + SKX_USMEMMISS_OFFSET);
+       off += scnprintf(buf + off, buf_size - off,
+                        "Upstream Memory Miss -\t%u\n", u.v16);
+
+       off += scnprintf(buf + off, buf_size - off,
+                        "\nNTB Hardware Errors:\n");
+
+       if (!pci_read_config_word(ndev->ntb.pdev,
+                                 SKX_DEVSTS_OFFSET, &u.v16))
+               off += scnprintf(buf + off, buf_size - off,
+                                "DEVSTS -\t\t%#06x\n", u.v16);
+
+       if (!pci_read_config_word(ndev->ntb.pdev,
+                                 SKX_LINK_STATUS_OFFSET, &u.v16))
+               off += scnprintf(buf + off, buf_size - off,
+                                "LNKSTS -\t\t%#06x\n", u.v16);
+
+       if (!pci_read_config_dword(ndev->ntb.pdev,
+                                  SKX_UNCERRSTS_OFFSET, &u.v32))
+               off += scnprintf(buf + off, buf_size - off,
+                                "UNCERRSTS -\t\t%#06x\n", u.v32);
+
+       if (!pci_read_config_dword(ndev->ntb.pdev,
+                                  SKX_CORERRSTS_OFFSET, &u.v32))
+               off += scnprintf(buf + off, buf_size - off,
+                                "CORERRSTS -\t\t%#06x\n", u.v32);
+
+       ret = simple_read_from_buffer(ubuf, count, offp, buf, off);
+       kfree(buf);
+       return ret;
+}
+
+static ssize_t ndev_ntb_debugfs_read(struct file *filp, char __user *ubuf,
+                                    size_t count, loff_t *offp)
 {
        struct intel_ntb_dev *ndev;
        struct pci_dev *pdev;
@@ -813,6 +998,20 @@ static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
        return ret;
 }
 
+static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
+                                size_t count, loff_t *offp)
+{
+       struct intel_ntb_dev *ndev = filp->private_data;
+
+       if (pdev_is_xeon(ndev->ntb.pdev) ||
+           pdev_is_atom(ndev->ntb.pdev))
+               return ndev_ntb_debugfs_read(filp, ubuf, count, offp);
+       else if (pdev_is_skx_xeon(ndev->ntb.pdev))
+               return ndev_ntb3_debugfs_read(filp, ubuf, count, offp);
+
+       return -ENXIO;
+}
+
 static void ndev_init_debugfs(struct intel_ntb_dev *ndev)
 {
        if (!debugfs_dir) {
@@ -1428,6 +1627,383 @@ static void atom_deinit_dev(struct intel_ntb_dev *ndev)
        atom_deinit_isr(ndev);
 }
 
+/* Skylake Xeon NTB */
+
+static u64 skx_db_ioread(void __iomem *mmio)
+{
+       return ioread64(mmio);
+}
+
+static void skx_db_iowrite(u64 bits, void __iomem *mmio)
+{
+       iowrite64(bits, mmio);
+}
+
+static int skx_init_isr(struct intel_ntb_dev *ndev)
+{
+       int i;
+
+       /*
+        * The MSIX vectors and the interrupt status bits are not lined up
+        * on Skylake. By default the link status bit is bit 32, however it
+        * is by default MSIX vector0. We need to fixup to line them up.
+        * The vectors at reset is 1-32,0. We need to reprogram to 0-32.
+        */
+
+       for (i = 0; i < SKX_DB_MSIX_VECTOR_COUNT; i++)
+               iowrite8(i, ndev->self_mmio + SKX_INTVEC_OFFSET + i);
+
+       /* move link status down one as workaround */
+       if (ndev->hwerr_flags & NTB_HWERR_MSIX_VECTOR32_BAD) {
+               iowrite8(SKX_DB_MSIX_VECTOR_COUNT - 2,
+                        ndev->self_mmio + SKX_INTVEC_OFFSET +
+                        (SKX_DB_MSIX_VECTOR_COUNT - 1));
+       }
+
+       return ndev_init_isr(ndev, SKX_DB_MSIX_VECTOR_COUNT,
+                            SKX_DB_MSIX_VECTOR_COUNT,
+                            SKX_DB_MSIX_VECTOR_SHIFT,
+                            SKX_DB_TOTAL_SHIFT);
+}
+
+static int skx_setup_b2b_mw(struct intel_ntb_dev *ndev,
+                           const struct intel_b2b_addr *addr,
+                           const struct intel_b2b_addr *peer_addr)
+{
+       struct pci_dev *pdev;
+       void __iomem *mmio;
+       resource_size_t bar_size;
+       phys_addr_t bar_addr;
+       int b2b_bar;
+       u8 bar_sz;
+
+       pdev = ndev_pdev(ndev);
+       mmio = ndev->self_mmio;
+
+       if (ndev->b2b_idx == UINT_MAX) {
+               dev_dbg(ndev_dev(ndev), "not using b2b mw\n");
+               b2b_bar = 0;
+               ndev->b2b_off = 0;
+       } else {
+               b2b_bar = ndev_mw_to_bar(ndev, ndev->b2b_idx);
+               if (b2b_bar < 0)
+                       return -EIO;
+
+               dev_dbg(ndev_dev(ndev), "using b2b mw bar %d\n", b2b_bar);
+
+               bar_size = pci_resource_len(ndev->ntb.pdev, b2b_bar);
+
+               dev_dbg(ndev_dev(ndev), "b2b bar size %#llx\n", bar_size);
+
+               if (b2b_mw_share && ((bar_size >> 1) >= XEON_B2B_MIN_SIZE)) {
+                       dev_dbg(ndev_dev(ndev),
+                               "b2b using first half of bar\n");
+                       ndev->b2b_off = bar_size >> 1;
+               } else if (bar_size >= XEON_B2B_MIN_SIZE) {
+                       dev_dbg(ndev_dev(ndev),
+                               "b2b using whole bar\n");
+                       ndev->b2b_off = 0;
+                       --ndev->mw_count;
+               } else {
+                       dev_dbg(ndev_dev(ndev),
+                               "b2b bar size is too small\n");
+                       return -EIO;
+               }
+       }
+
+       /*
+        * Reset the secondary bar sizes to match the primary bar sizes,
+        * except disable or halve the size of the b2b secondary bar.
+        */
+       pci_read_config_byte(pdev, SKX_IMBAR1SZ_OFFSET, &bar_sz);
+       dev_dbg(ndev_dev(ndev), "IMBAR1SZ %#x\n", bar_sz);
+       if (b2b_bar == 1) {
+               if (ndev->b2b_off)
+                       bar_sz -= 1;
+               else
+                       bar_sz = 0;
+       }
+
+       pci_write_config_byte(pdev, SKX_EMBAR1SZ_OFFSET, bar_sz);
+       pci_read_config_byte(pdev, SKX_EMBAR1SZ_OFFSET, &bar_sz);
+       dev_dbg(ndev_dev(ndev), "EMBAR1SZ %#x\n", bar_sz);
+
+       pci_read_config_byte(pdev, SKX_IMBAR2SZ_OFFSET, &bar_sz);
+       dev_dbg(ndev_dev(ndev), "IMBAR2SZ %#x\n", bar_sz);
+       if (b2b_bar == 2) {
+               if (ndev->b2b_off)
+                       bar_sz -= 1;
+               else
+                       bar_sz = 0;
+       }
+
+       pci_write_config_byte(pdev, SKX_EMBAR2SZ_OFFSET, bar_sz);
+       pci_read_config_byte(pdev, SKX_EMBAR2SZ_OFFSET, &bar_sz);
+       dev_dbg(ndev_dev(ndev), "EMBAR2SZ %#x\n", bar_sz);
+
+       /* SBAR01 hit by first part of the b2b bar */
+       if (b2b_bar == 0)
+               bar_addr = addr->bar0_addr;
+       else if (b2b_bar == 1)
+               bar_addr = addr->bar2_addr64;
+       else if (b2b_bar == 2)
+               bar_addr = addr->bar4_addr64;
+       else
+               return -EIO;
+
+       /* setup incoming bar limits == base addrs (zero length windows) */
+       bar_addr = addr->bar2_addr64 + (b2b_bar == 1 ? ndev->b2b_off : 0);
+       iowrite64(bar_addr, mmio + SKX_IMBAR1XLMT_OFFSET);
+       bar_addr = ioread64(mmio + SKX_IMBAR1XLMT_OFFSET);
+       dev_dbg(ndev_dev(ndev), "IMBAR1XLMT %#018llx\n", bar_addr);
+
+       bar_addr = addr->bar4_addr64 + (b2b_bar == 2 ? ndev->b2b_off : 0);
+       iowrite64(bar_addr, mmio + SKX_IMBAR2XLMT_OFFSET);
+       bar_addr = ioread64(mmio + SKX_IMBAR2XLMT_OFFSET);
+       dev_dbg(ndev_dev(ndev), "IMBAR2XLMT %#018llx\n", bar_addr);
+
+       /* zero incoming translation addrs */
+       iowrite64(0, mmio + SKX_IMBAR1XBASE_OFFSET);
+       iowrite64(0, mmio + SKX_IMBAR2XBASE_OFFSET);
+
+       ndev->peer_mmio = ndev->self_mmio;
+
+       return 0;
+}
+
+static int skx_init_ntb(struct intel_ntb_dev *ndev)
+{
+       int rc;
+
+
+       ndev->mw_count = XEON_MW_COUNT;
+       ndev->spad_count = SKX_SPAD_COUNT;
+       ndev->db_count = SKX_DB_COUNT;
+       ndev->db_link_mask = SKX_DB_LINK_BIT;
+
+       /* DB fixup for using 31 right now */
+       if (ndev->hwerr_flags & NTB_HWERR_MSIX_VECTOR32_BAD)
+               ndev->db_link_mask |= BIT_ULL(31);
+
+       switch (ndev->ntb.topo) {
+       case NTB_TOPO_B2B_USD:
+       case NTB_TOPO_B2B_DSD:
+               ndev->self_reg = &skx_pri_reg;
+               ndev->peer_reg = &skx_b2b_reg;
+               ndev->xlat_reg = &skx_sec_xlat;
+
+               if (ndev->ntb.topo == NTB_TOPO_B2B_USD) {
+                       rc = skx_setup_b2b_mw(ndev,
+                                             &xeon_b2b_dsd_addr,
+                                             &xeon_b2b_usd_addr);
+               } else {
+                       rc = skx_setup_b2b_mw(ndev,
+                                             &xeon_b2b_usd_addr,
+                                             &xeon_b2b_dsd_addr);
+               }
+
+               if (rc)
+                       return rc;
+
+               /* Enable Bus Master and Memory Space on the secondary side */
+               iowrite16(PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER,
+                         ndev->self_mmio + SKX_SPCICMD_OFFSET);
+
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       ndev->db_valid_mask = BIT_ULL(ndev->db_count) - 1;
+
+       ndev->reg->db_iowrite(ndev->db_valid_mask,
+                             ndev->self_mmio +
+                             ndev->self_reg->db_mask);
+
+       return 0;
+}
+
+static int skx_init_dev(struct intel_ntb_dev *ndev)
+{
+       struct pci_dev *pdev;
+       u8 ppd;
+       int rc;
+
+       pdev = ndev_pdev(ndev);
+
+       ndev->reg = &skx_reg;
+
+       rc = pci_read_config_byte(pdev, XEON_PPD_OFFSET, &ppd);
+       if (rc)
+               return -EIO;
+
+       ndev->ntb.topo = xeon_ppd_topo(ndev, ppd);
+       dev_dbg(ndev_dev(ndev), "ppd %#x topo %s\n", ppd,
+               ntb_topo_string(ndev->ntb.topo));
+       if (ndev->ntb.topo == NTB_TOPO_NONE)
+               return -EINVAL;
+
+       if (pdev_is_skx_xeon(pdev))
+               ndev->hwerr_flags |= NTB_HWERR_MSIX_VECTOR32_BAD;
+
+       rc = skx_init_ntb(ndev);
+       if (rc)
+               return rc;
+
+       return skx_init_isr(ndev);
+}
+
+static int intel_ntb3_link_enable(struct ntb_dev *ntb,
+                                 enum ntb_speed max_speed,
+                                 enum ntb_width max_width)
+{
+       struct intel_ntb_dev *ndev;
+       u32 ntb_ctl;
+
+       ndev = container_of(ntb, struct intel_ntb_dev, ntb);
+
+       dev_dbg(ndev_dev(ndev),
+               "Enabling link with max_speed %d max_width %d\n",
+               max_speed, max_width);
+
+       if (max_speed != NTB_SPEED_AUTO)
+               dev_dbg(ndev_dev(ndev), "ignoring max_speed %d\n", max_speed);
+       if (max_width != NTB_WIDTH_AUTO)
+               dev_dbg(ndev_dev(ndev), "ignoring max_width %d\n", max_width);
+
+       ntb_ctl = ioread32(ndev->self_mmio + ndev->reg->ntb_ctl);
+       ntb_ctl &= ~(NTB_CTL_DISABLE | NTB_CTL_CFG_LOCK);
+       ntb_ctl |= NTB_CTL_P2S_BAR2_SNOOP | NTB_CTL_S2P_BAR2_SNOOP;
+       ntb_ctl |= NTB_CTL_P2S_BAR4_SNOOP | NTB_CTL_S2P_BAR4_SNOOP;
+       iowrite32(ntb_ctl, ndev->self_mmio + ndev->reg->ntb_ctl);
+
+       return 0;
+}
+static int intel_ntb3_mw_set_trans(struct ntb_dev *ntb, int idx,
+                                  dma_addr_t addr, resource_size_t size)
+{
+       struct intel_ntb_dev *ndev = ntb_ndev(ntb);
+       unsigned long xlat_reg, limit_reg;
+       resource_size_t bar_size, mw_size;
+       void __iomem *mmio;
+       u64 base, limit, reg_val;
+       int bar;
+
+       if (idx >= ndev->b2b_idx && !ndev->b2b_off)
+               idx += 1;
+
+       bar = ndev_mw_to_bar(ndev, idx);
+       if (bar < 0)
+               return bar;
+
+       bar_size = pci_resource_len(ndev->ntb.pdev, bar);
+
+       if (idx == ndev->b2b_idx)
+               mw_size = bar_size - ndev->b2b_off;
+       else
+               mw_size = bar_size;
+
+       /* hardware requires that addr is aligned to bar size */
+       if (addr & (bar_size - 1))
+               return -EINVAL;
+
+       /* make sure the range fits in the usable mw size */
+       if (size > mw_size)
+               return -EINVAL;
+
+       mmio = ndev->self_mmio;
+       xlat_reg = ndev->xlat_reg->bar2_xlat + (idx * 0x10);
+       limit_reg = ndev->xlat_reg->bar2_limit + (idx * 0x10);
+       base = pci_resource_start(ndev->ntb.pdev, bar);
+
+       /* Set the limit if supported, if size is not mw_size */
+       if (limit_reg && size != mw_size)
+               limit = base + size;
+       else
+               limit = base + mw_size;
+
+       /* set and verify setting the translation address */
+       iowrite64(addr, mmio + xlat_reg);
+       reg_val = ioread64(mmio + xlat_reg);
+       if (reg_val != addr) {
+               iowrite64(0, mmio + xlat_reg);
+               return -EIO;
+       }
+
+       dev_dbg(ndev_dev(ndev), "BAR %d IMBARXBASE: %#Lx\n", bar, reg_val);
+
+       /* set and verify setting the limit */
+       iowrite64(limit, mmio + limit_reg);
+       reg_val = ioread64(mmio + limit_reg);
+       if (reg_val != limit) {
+               iowrite64(base, mmio + limit_reg);
+               iowrite64(0, mmio + xlat_reg);
+               return -EIO;
+       }
+
+       dev_dbg(ndev_dev(ndev), "BAR %d IMBARXLMT: %#Lx\n", bar, reg_val);
+
+       /* setup the EP */
+       limit_reg = ndev->xlat_reg->bar2_limit + (idx * 0x10) + 0x4000;
+       base = ioread64(mmio + SKX_EMBAR1_OFFSET + (8 * idx));
+       base &= ~0xf;
+
+       if (limit_reg && size != mw_size)
+               limit = base + size;
+       else
+               limit = base + mw_size;
+
+       /* set and verify setting the limit */
+       iowrite64(limit, mmio + limit_reg);
+       reg_val = ioread64(mmio + limit_reg);
+       if (reg_val != limit) {
+               iowrite64(base, mmio + limit_reg);
+               iowrite64(0, mmio + xlat_reg);
+               return -EIO;
+       }
+
+       dev_dbg(ndev_dev(ndev), "BAR %d EMBARXLMT: %#Lx\n", bar, reg_val);
+
+       return 0;
+}
+
+static int intel_ntb3_peer_db_set(struct ntb_dev *ntb, u64 db_bits)
+{
+       struct intel_ntb_dev *ndev = ntb_ndev(ntb);
+       int bit;
+
+       if (db_bits & ~ndev->db_valid_mask)
+               return -EINVAL;
+
+       while (db_bits) {
+               bit = __ffs(db_bits);
+               iowrite32(1, ndev->peer_mmio +
+                               ndev->peer_reg->db_bell + (bit * 4));
+               db_bits &= db_bits - 1;
+       }
+
+       return 0;
+}
+
+static u64 intel_ntb3_db_read(struct ntb_dev *ntb)
+{
+       struct intel_ntb_dev *ndev = ntb_ndev(ntb);
+
+       return ndev_db_read(ndev,
+                           ndev->self_mmio +
+                           ndev->self_reg->db_clear);
+}
+
+static int intel_ntb3_db_clear(struct ntb_dev *ntb, u64 db_bits)
+{
+       struct intel_ntb_dev *ndev = ntb_ndev(ntb);
+
+       return ndev_db_write(ndev, db_bits,
+                            ndev->self_mmio +
+                            ndev->self_reg->db_clear);
+}
+
 /* XEON */
 
 static u64 xeon_db_ioread(void __iomem *mmio)
@@ -2120,6 +2696,24 @@ static int intel_ntb_pci_probe(struct pci_dev *pdev,
                if (rc)
                        goto err_init_dev;
 
+       } else if (pdev_is_skx_xeon(pdev)) {
+               ndev = kzalloc_node(sizeof(*ndev), GFP_KERNEL, node);
+               if (!ndev) {
+                       rc = -ENOMEM;
+                       goto err_ndev;
+               }
+
+               ndev_init_struct(ndev, pdev);
+               ndev->ntb.ops = &intel_ntb3_ops;
+
+               rc = intel_ntb_init_pci(ndev, pdev);
+               if (rc)
+                       goto err_init_pci;
+
+               rc = skx_init_dev(ndev);
+               if (rc)
+                       goto err_init_dev;
+
        } else {
                rc = -EINVAL;
                goto err_ndev;
@@ -2143,7 +2737,7 @@ err_register:
        ndev_deinit_debugfs(ndev);
        if (pdev_is_atom(pdev))
                atom_deinit_dev(ndev);
-       else if (pdev_is_xeon(pdev))
+       else if (pdev_is_xeon(pdev) || pdev_is_skx_xeon(pdev))
                xeon_deinit_dev(ndev);
 err_init_dev:
        intel_ntb_deinit_pci(ndev);
@@ -2161,7 +2755,7 @@ static void intel_ntb_pci_remove(struct pci_dev *pdev)
        ndev_deinit_debugfs(ndev);
        if (pdev_is_atom(pdev))
                atom_deinit_dev(ndev);
-       else if (pdev_is_xeon(pdev))
+       else if (pdev_is_xeon(pdev) || pdev_is_skx_xeon(pdev))
                xeon_deinit_dev(ndev);
        intel_ntb_deinit_pci(ndev);
        kfree(ndev);
@@ -2257,6 +2851,36 @@ static struct intel_b2b_addr xeon_b2b_dsd_addr = {
        .bar5_addr32            = XEON_B2B_BAR5_ADDR32,
 };
 
+static const struct intel_ntb_reg skx_reg = {
+       .poll_link              = xeon_poll_link,
+       .link_is_up             = xeon_link_is_up,
+       .db_ioread              = skx_db_ioread,
+       .db_iowrite             = skx_db_iowrite,
+       .db_size                = sizeof(u64),
+       .ntb_ctl                = SKX_NTBCNTL_OFFSET,
+       .mw_bar                 = {2, 4},
+};
+
+static const struct intel_ntb_alt_reg skx_pri_reg = {
+       .db_bell                = SKX_EM_DOORBELL_OFFSET,
+       .db_clear               = SKX_IM_INT_STATUS_OFFSET,
+       .db_mask                = SKX_IM_INT_DISABLE_OFFSET,
+       .spad                   = SKX_IM_SPAD_OFFSET,
+};
+
+static const struct intel_ntb_alt_reg skx_b2b_reg = {
+       .db_bell                = SKX_IM_DOORBELL_OFFSET,
+       .db_clear               = SKX_EM_INT_STATUS_OFFSET,
+       .db_mask                = SKX_EM_INT_DISABLE_OFFSET,
+       .spad                   = SKX_B2B_SPAD_OFFSET,
+};
+
+static const struct intel_ntb_xlat_reg skx_sec_xlat = {
+/*     .bar0_base              = SKX_EMBAR0_OFFSET, */
+       .bar2_limit             = SKX_IMBAR1XLMT_OFFSET,
+       .bar2_xlat              = SKX_IMBAR1XBASE_OFFSET,
+};
+
 /* operations for primary side of local ntb */
 static const struct ntb_dev_ops intel_ntb_ops = {
        .mw_count               = intel_ntb_mw_count,
@@ -2284,6 +2908,31 @@ static const struct ntb_dev_ops intel_ntb_ops = {
        .peer_spad_write        = intel_ntb_peer_spad_write,
 };
 
+static const struct ntb_dev_ops intel_ntb3_ops = {
+       .mw_count               = intel_ntb_mw_count,
+       .mw_get_range           = intel_ntb_mw_get_range,
+       .mw_set_trans           = intel_ntb3_mw_set_trans,
+       .link_is_up             = intel_ntb_link_is_up,
+       .link_enable            = intel_ntb3_link_enable,
+       .link_disable           = intel_ntb_link_disable,
+       .db_valid_mask          = intel_ntb_db_valid_mask,
+       .db_vector_count        = intel_ntb_db_vector_count,
+       .db_vector_mask         = intel_ntb_db_vector_mask,
+       .db_read                = intel_ntb3_db_read,
+       .db_clear               = intel_ntb3_db_clear,
+       .db_set_mask            = intel_ntb_db_set_mask,
+       .db_clear_mask          = intel_ntb_db_clear_mask,
+       .peer_db_addr           = intel_ntb_peer_db_addr,
+       .peer_db_set            = intel_ntb3_peer_db_set,
+       .spad_is_unsafe         = intel_ntb_spad_is_unsafe,
+       .spad_count             = intel_ntb_spad_count,
+       .spad_read              = intel_ntb_spad_read,
+       .spad_write             = intel_ntb_spad_write,
+       .peer_spad_addr         = intel_ntb_peer_spad_addr,
+       .peer_spad_read         = intel_ntb_peer_spad_read,
+       .peer_spad_write        = intel_ntb_peer_spad_write,
+};
+
 static const struct file_operations intel_ntb_debugfs_info = {
        .owner = THIS_MODULE,
        .open = simple_open,
@@ -2307,6 +2956,7 @@ static const struct pci_device_id intel_ntb_pci_tbl[] = {
        {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_SS_IVT)},
        {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_SS_HSX)},
        {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_SS_BDX)},
+       {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_NTB_B2B_SKX)},
        {0}
 };
 MODULE_DEVICE_TABLE(pci, intel_ntb_pci_tbl);
index 3ec149cf656276dd362fad25b37661b69d5fb3d0..f2cf8a783f1eef7c64dc49896174ee4eafc78d01 100644 (file)
@@ -70,6 +70,7 @@
 #define PCI_DEVICE_ID_INTEL_NTB_B2B_BDX        0x6F0D
 #define PCI_DEVICE_ID_INTEL_NTB_PS_BDX 0x6F0E
 #define PCI_DEVICE_ID_INTEL_NTB_SS_BDX 0x6F0F
+#define PCI_DEVICE_ID_INTEL_NTB_B2B_SKX        0x201C
 
 /* Intel Xeon hardware */
 
 #define XEON_DB_TOTAL_SHIFT            16
 #define XEON_SPAD_COUNT                        16
 
+/* Intel Skylake Xeon hardware */
+#define SKX_IMBAR1SZ_OFFSET            0x00d0
+#define SKX_IMBAR2SZ_OFFSET            0x00d1
+#define SKX_EMBAR1SZ_OFFSET            0x00d2
+#define SKX_EMBAR2SZ_OFFSET            0x00d3
+#define SKX_DEVCTRL_OFFSET             0x0098
+#define SKX_DEVSTS_OFFSET              0x009a
+#define SKX_UNCERRSTS_OFFSET           0x014c
+#define SKX_CORERRSTS_OFFSET           0x0158
+#define SKX_LINK_STATUS_OFFSET         0x01a2
+
+#define SKX_NTBCNTL_OFFSET             0x0000
+#define SKX_IMBAR1XBASE_OFFSET         0x0010          /* SBAR2XLAT */
+#define SKX_IMBAR1XLMT_OFFSET          0x0018          /* SBAR2LMT */
+#define SKX_IMBAR2XBASE_OFFSET         0x0020          /* SBAR4XLAT */
+#define SKX_IMBAR2XLMT_OFFSET          0x0028          /* SBAR4LMT */
+#define SKX_IM_INT_STATUS_OFFSET       0x0040
+#define SKX_IM_INT_DISABLE_OFFSET      0x0048
+#define SKX_IM_SPAD_OFFSET             0x0080          /* SPAD */
+#define SKX_USMEMMISS_OFFSET           0x0070
+#define SKX_INTVEC_OFFSET              0x00d0
+#define SKX_IM_DOORBELL_OFFSET         0x0100          /* SDOORBELL0 */
+#define SKX_B2B_SPAD_OFFSET            0x0180          /* B2B SPAD */
+#define SKX_EMBAR0XBASE_OFFSET         0x4008          /* B2B_XLAT */
+#define SKX_EMBAR1XBASE_OFFSET         0x4010          /* PBAR2XLAT */
+#define SKX_EMBAR1XLMT_OFFSET          0x4018          /* PBAR2LMT */
+#define SKX_EMBAR2XBASE_OFFSET         0x4020          /* PBAR4XLAT */
+#define SKX_EMBAR2XLMT_OFFSET          0x4028          /* PBAR4LMT */
+#define SKX_EM_INT_STATUS_OFFSET       0x4040
+#define SKX_EM_INT_DISABLE_OFFSET      0x4048
+#define SKX_EM_SPAD_OFFSET             0x4080          /* remote SPAD */
+#define SKX_EM_DOORBELL_OFFSET         0x4100          /* PDOORBELL0 */
+#define SKX_SPCICMD_OFFSET             0x4504          /* SPCICMD */
+#define SKX_EMBAR0_OFFSET              0x4510          /* SBAR0BASE */
+#define SKX_EMBAR1_OFFSET              0x4518          /* SBAR23BASE */
+#define SKX_EMBAR2_OFFSET              0x4520          /* SBAR45BASE */
+
+#define SKX_DB_COUNT                   32
+#define SKX_DB_LINK                    32
+#define SKX_DB_LINK_BIT                        BIT_ULL(SKX_DB_LINK)
+#define SKX_DB_MSIX_VECTOR_COUNT       33
+#define SKX_DB_MSIX_VECTOR_SHIFT       1
+#define SKX_DB_TOTAL_SHIFT             33
+#define SKX_SPAD_COUNT                 16
+
 /* Intel Atom hardware */
 
 #define ATOM_SBAR2XLAT_OFFSET          0x0008
 #define NTB_HWERR_SDOORBELL_LOCKUP     BIT_ULL(0)
 #define NTB_HWERR_SB01BASE_LOCKUP      BIT_ULL(1)
 #define NTB_HWERR_B2BDOORBELL_BIT14    BIT_ULL(2)
+#define NTB_HWERR_MSIX_VECTOR32_BAD    BIT_ULL(3)
 
 /* flags to indicate unsafe api */
 #define NTB_UNSAFE_DB                  BIT_ULL(0)
@@ -263,6 +310,7 @@ struct intel_ntb_reg {
 struct intel_ntb_alt_reg {
        unsigned long                   db_bell;
        unsigned long                   db_mask;
+       unsigned long                   db_clear;
        unsigned long                   spad;
 };
 
index 4eb8adb345084430947ccabdf6962c1099fbb703..f81aa4b18d9f4dd76ec0be63f46865d3b04f89c6 100644 (file)
@@ -66,6 +66,7 @@
 #define NTB_TRANSPORT_VER      "4"
 #define NTB_TRANSPORT_NAME     "ntb_transport"
 #define NTB_TRANSPORT_DESC     "Software Queue-Pair Transport over NTB"
+#define NTB_TRANSPORT_MIN_SPADS (MW0_SZ_HIGH + 2)
 
 MODULE_DESCRIPTION(NTB_TRANSPORT_DESC);
 MODULE_VERSION(NTB_TRANSPORT_VER);
@@ -242,9 +243,6 @@ enum {
        NUM_MWS,
        MW0_SZ_HIGH,
        MW0_SZ_LOW,
-       MW1_SZ_HIGH,
-       MW1_SZ_LOW,
-       MAX_SPAD,
 };
 
 #define dev_client_dev(__dev) \
@@ -811,7 +809,7 @@ static void ntb_transport_link_cleanup(struct ntb_transport_ctx *nt)
 {
        struct ntb_transport_qp *qp;
        u64 qp_bitmap_alloc;
-       int i;
+       unsigned int i, count;
 
        qp_bitmap_alloc = nt->qp_bitmap & ~nt->qp_bitmap_free;
 
@@ -831,7 +829,8 @@ static void ntb_transport_link_cleanup(struct ntb_transport_ctx *nt)
         * goes down, blast them now to give them a sane value the next
         * time they are accessed
         */
-       for (i = 0; i < MAX_SPAD; i++)
+       count = ntb_spad_count(nt->ndev);
+       for (i = 0; i < count; i++)
                ntb_spad_write(nt->ndev, i, 0);
 }
 
@@ -960,7 +959,6 @@ static void ntb_qp_link_work(struct work_struct *work)
        ntb_peer_spad_write(nt->ndev, QP_LINKS, val | BIT(qp->qp_num));
 
        /* query remote spad for qp ready bits */
-       ntb_peer_spad_read(nt->ndev, QP_LINKS);
        dev_dbg_ratelimited(&pdev->dev, "Remote QP link status = %x\n", val);
 
        /* See if the remote side is up */
@@ -1064,17 +1062,12 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
 {
        struct ntb_transport_ctx *nt;
        struct ntb_transport_mw *mw;
-       unsigned int mw_count, qp_count;
+       unsigned int mw_count, qp_count, spad_count, max_mw_count_for_spads;
        u64 qp_bitmap;
        int node;
        int rc, i;
 
        mw_count = ntb_mw_count(ndev);
-       if (ntb_spad_count(ndev) < (NUM_MWS + 1 + mw_count * 2)) {
-               dev_err(&ndev->dev, "Not enough scratch pad registers for %s",
-                       NTB_TRANSPORT_NAME);
-               return -EIO;
-       }
 
        if (ntb_db_is_unsafe(ndev))
                dev_dbg(&ndev->dev,
@@ -1090,8 +1083,18 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
                return -ENOMEM;
 
        nt->ndev = ndev;
+       spad_count = ntb_spad_count(ndev);
+
+       /* Limit the MW's based on the availability of scratchpads */
+
+       if (spad_count < NTB_TRANSPORT_MIN_SPADS) {
+               nt->mw_count = 0;
+               rc = -EINVAL;
+               goto err;
+       }
 
-       nt->mw_count = mw_count;
+       max_mw_count_for_spads = (spad_count - MW0_SZ_HIGH) / 2;
+       nt->mw_count = min(mw_count, max_mw_count_for_spads);
 
        nt->mw_vec = kzalloc_node(mw_count * sizeof(*nt->mw_vec),
                                  GFP_KERNEL, node);
index 5371b374f1fe1a870c561b8392d55f4e4bafb941..e8f68f5732f11de4dacd10487df30a7f768506df 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 static int
index b40cfb076f02446fda62aea907301e4a62dcc17a..2fc86dc7a8df3e487c8222fa84310e7832c9c0a8 100644 (file)
@@ -1193,8 +1193,8 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
                blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
                blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX));
        }
-       if (ctrl->stripe_size)
-               blk_queue_chunk_sectors(q, ctrl->stripe_size >> 9);
+       if (ctrl->quirks & NVME_QUIRK_STRIPE_SIZE)
+               blk_queue_chunk_sectors(q, ctrl->max_hw_sectors);
        blk_queue_virt_boundary(q, ctrl->page_size - 1);
        if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
                vwc = true;
@@ -1250,19 +1250,6 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
        ctrl->max_hw_sectors =
                min_not_zero(ctrl->max_hw_sectors, max_hw_sectors);
 
-       if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && id->vs[3]) {
-               unsigned int max_hw_sectors;
-
-               ctrl->stripe_size = 1 << (id->vs[3] + page_shift);
-               max_hw_sectors = ctrl->stripe_size >> (page_shift - 9);
-               if (ctrl->max_hw_sectors) {
-                       ctrl->max_hw_sectors = min(max_hw_sectors,
-                                                       ctrl->max_hw_sectors);
-               } else {
-                       ctrl->max_hw_sectors = max_hw_sectors;
-               }
-       }
-
        nvme_set_queue_limits(ctrl, ctrl->admin_q);
        ctrl->sgls = le32_to_cpu(id->sgls);
        ctrl->kas = le16_to_cpu(id->kas);
index 771e2e76187222dfb71616f5665c7b2b22802c74..aa0bc60810a74ff93cf05b294b2a9d4968ecf397 100644 (file)
@@ -1491,19 +1491,20 @@ static int
 nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize)
 {
        struct nvme_fc_queue *queue = &ctrl->queues[1];
-       int i, j, ret;
+       int i, ret;
 
        for (i = 1; i < ctrl->queue_count; i++, queue++) {
                ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize);
-               if (ret) {
-                       for (j = i-1; j >= 0; j--)
-                               __nvme_fc_delete_hw_queue(ctrl,
-                                               &ctrl->queues[j], j);
-                       return ret;
-               }
+               if (ret)
+                       goto delete_queues;
        }
 
        return 0;
+
+delete_queues:
+       for (; i >= 0; i--)
+               __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i);
+       return ret;
 }
 
 static int
@@ -2401,8 +2402,8 @@ __nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
        WARN_ON_ONCE(!changed);
 
        dev_info(ctrl->ctrl.device,
-               "NVME-FC{%d}: new ctrl: NQN \"%s\" (%p)\n",
-               ctrl->cnum, ctrl->ctrl.opts->subsysnqn, &ctrl);
+               "NVME-FC{%d}: new ctrl: NQN \"%s\"\n",
+               ctrl->cnum, ctrl->ctrl.opts->subsysnqn);
 
        kref_get(&ctrl->ctrl.kref);
 
index bd5321441d127143b87563e5463d2944aa0c1b0e..6377e14586dc5c837749049cf3dafc7b210a3026 100644 (file)
@@ -135,7 +135,6 @@ struct nvme_ctrl {
 
        u32 page_size;
        u32 max_hw_sectors;
-       u32 stripe_size;
        u16 oncs;
        u16 vid;
        atomic_t abort_limit;
index 3d21a154dce79deceeff77cd16ef5c6bf2a71978..19beeb7b2ac26a5bf0f81bf4e8b995bf29dba195 100644 (file)
@@ -712,15 +712,8 @@ static void __nvme_process_cq(struct nvme_queue *nvmeq, unsigned int *tag)
                req = blk_mq_tag_to_rq(*nvmeq->tags, cqe.command_id);
                nvme_req(req)->result = cqe.result;
                blk_mq_complete_request(req, le16_to_cpu(cqe.status) >> 1);
-
        }
 
-       /* If the controller ignores the cq head doorbell and continuously
-        * writes to the queue, it is theoretically possible to wrap around
-        * the queue twice and mistakenly return IRQ_NONE.  Linux only
-        * requires that 0.1% of your interrupts are handled, so this isn't
-        * a big problem.
-        */
        if (head == nvmeq->cq_head && phase == nvmeq->cq_phase)
                return;
 
@@ -1909,10 +1902,10 @@ static int nvme_dev_map(struct nvme_dev *dev)
        if (!dev->bar)
                goto release;
 
-       return 0;
+       return 0;
   release:
-       pci_release_mem_regions(pdev);
-       return -ENODEV;
+       pci_release_mem_regions(pdev);
+       return -ENODEV;
 }
 
 static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
index b71e95044b43e3e62a5d063047064a46d88a6d9f..a5c09e703bd8636d96c9c0c7d603226e46518f61 100644 (file)
@@ -2160,30 +2160,6 @@ static int nvme_trans_synchronize_cache(struct nvme_ns *ns,
        return nvme_trans_status_code(hdr, nvme_sc);
 }
 
-static int nvme_trans_start_stop(struct nvme_ns *ns, struct sg_io_hdr *hdr,
-                                                       u8 *cmd)
-{
-       u8 immed, no_flush;
-
-       immed = cmd[1] & 0x01;
-       no_flush = cmd[4] & 0x04;
-
-       if (immed != 0) {
-               return nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION,
-                                       ILLEGAL_REQUEST, SCSI_ASC_INVALID_CDB,
-                                       SCSI_ASCQ_CAUSE_NOT_REPORTABLE);
-       } else {
-               if (no_flush == 0) {
-                       /* Issue NVME FLUSH command prior to START STOP UNIT */
-                       int res = nvme_trans_synchronize_cache(ns, hdr);
-                       if (res)
-                               return res;
-               }
-
-               return 0;
-       }
-}
-
 static int nvme_trans_format_unit(struct nvme_ns *ns, struct sg_io_hdr *hdr,
                                                        u8 *cmd)
 {
@@ -2439,9 +2415,6 @@ static int nvme_scsi_translate(struct nvme_ns *ns, struct sg_io_hdr *hdr)
        case SECURITY_PROTOCOL_OUT:
                retcode = nvme_trans_security_protocol(ns, hdr, cmd);
                break;
-       case START_STOP:
-               retcode = nvme_trans_start_stop(ns, hdr, cmd);
-               break;
        case SYNCHRONIZE_CACHE:
                retcode = nvme_trans_synchronize_cache(ns, hdr);
                break;
index ec1ad2aa0a4ca941e8fe51db94cc7ffa452c1693..95ae52390478fe62fdb59605ee2c7a6d0583a919 100644 (file)
@@ -382,7 +382,6 @@ static void nvmet_execute_set_features(struct nvmet_req *req)
 {
        struct nvmet_subsys *subsys = req->sq->ctrl->subsys;
        u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10[0]);
-       u64 val;
        u32 val32;
        u16 status = 0;
 
@@ -392,8 +391,7 @@ static void nvmet_execute_set_features(struct nvmet_req *req)
                        (subsys->max_qid - 1) | ((subsys->max_qid - 1) << 16));
                break;
        case NVME_FEAT_KATO:
-               val = le64_to_cpu(req->cmd->prop_set.value);
-               val32 = val & 0xffff;
+               val32 = le32_to_cpu(req->cmd->common.cdw10[1]);
                req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000);
                nvmet_set_result(req, req->sq->ctrl->kato);
                break;
index bcb8ebeb01c5d26515c8047e4eed765dbdc4da45..4e8e6a22bce162a61eec428e9c435acb26b74046 100644 (file)
@@ -845,7 +845,7 @@ fcloop_create_remote_port(struct device *dev, struct device_attribute *attr,
        rport->lport = nport->lport;
        nport->rport = rport;
 
-       return ret ? ret : count;
+       return count;
 }
 
 
@@ -952,7 +952,7 @@ fcloop_create_target_port(struct device *dev, struct device_attribute *attr,
        tport->lport = nport->lport;
        nport->tport = tport;
 
-       return ret ? ret : count;
+       return count;
 }
 
 
index 965911d9b36a77af3867ff6361169f977e71392b..398ea7f54826b6bef0db0aa35aa2b1bb8493f432 100644 (file)
@@ -981,8 +981,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
  * @cell: nvmem cell to be read.
  * @len: pointer to length of cell which will be populated on successful read.
  *
- * Return: ERR_PTR() on error or a valid pointer to a char * buffer on success.
- * The buffer should be freed by the consumer with a kfree().
+ * Return: ERR_PTR() on error or a valid pointer to a buffer on success. The
+ * buffer should be freed by the consumer with a kfree().
  */
 void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
 {
index ac27b9bac3b9a9abe219e7d60fab8ea946c0abd8..8e7b120696fa91da63a44bc7f4f8422b5d24bc7e 100644 (file)
@@ -71,7 +71,7 @@ static struct nvmem_config imx_ocotp_nvmem_config = {
 
 static const struct of_device_id imx_ocotp_dt_ids[] = {
        { .compatible = "fsl,imx6q-ocotp",  (void *)128 },
-       { .compatible = "fsl,imx6sl-ocotp", (void *)32 },
+       { .compatible = "fsl,imx6sl-ocotp", (void *)64 },
        { .compatible = "fsl,imx6sx-ocotp", (void *)128 },
        { },
 };
index b5305f08b1848bf123f3448fba123a2761e17286..2bdb6c3893281c65d12a3916c037c07acba8480d 100644 (file)
@@ -21,11 +21,11 @@ static int qfprom_reg_read(void *context,
                        unsigned int reg, void *_val, size_t bytes)
 {
        void __iomem *base = context;
-       u32 *val = _val;
-       int i = 0, words = bytes / 4;
+       u8 *val = _val;
+       int i = 0, words = bytes;
 
        while (words--)
-               *val++ = readl(base + reg + (i++ * 4));
+               *val++ = readb(base + reg + i++);
 
        return 0;
 }
@@ -34,11 +34,11 @@ static int qfprom_reg_write(void *context,
                         unsigned int reg, void *_val, size_t bytes)
 {
        void __iomem *base = context;
-       u32 *val = _val;
-       int i = 0, words = bytes / 4;
+       u8 *val = _val;
+       int i = 0, words = bytes;
 
        while (words--)
-               writel(*val++, base + reg + (i++ * 4));
+               writeb(*val++, base + reg + i++);
 
        return 0;
 }
@@ -53,7 +53,7 @@ static int qfprom_remove(struct platform_device *pdev)
 static struct nvmem_config econfig = {
        .name = "qfprom",
        .owner = THIS_MODULE,
-       .stride = 4,
+       .stride = 1,
        .word_size = 1,
        .reg_read = qfprom_reg_read,
        .reg_write = qfprom_reg_write,
index c0cc4e7ff023b685dd5a2159fe16d7cd0deb6ad3..67935fbbbcabf706914a874de4bdef137ff38564 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/capability.h>
 #include <linux/dcookies.h>
 #include <linux/fs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "oprof.h"
 #include "event_buffer.h"
index 134398e0231be380c0af84e960e95b838cd2dce2..d77ebbfc67c98f8b63cdde527b8a59d7135486bd 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/oprofile.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "oprof.h"
 
index 3ed6238f8f6e0c65279ef35a182f57edb019f19d..553ef8a5d588685ff02f98bde7110dfb421accaa 100644 (file)
@@ -48,7 +48,7 @@
 
 #include <asm/byteorder.h>
 #include <asm/cache.h>         /* for L1_CACHE_BYTES */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/dma.h>
 #include <asm/io.h>
index f78f6f1aef47409f6066ea68560690c87dd386e7..1bf988010855ba01a8e504b7cd32ca2d3fd392cb 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/pci.h>
 #include <linux/gfp.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/io.h>
 #include <asm/hardware.h>
index 783906fe659a2824987fe4b5cc9397c866ba91f7..4dd9b1308128a4eb34aecd2824ce245f6a069fd1 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/slab.h>
 #include <linux/fs.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/eisa_eeprom.h>
 
 #define        EISA_EEPROM_MINOR 241
index 21905fef2cbf0d34259e37069e50140a66101441..d9bffe8d29b967a8067b27c85183e73ccf32699d 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 #include <asm/eisa_bus.h>
index b48243131993a6faddff840551c93a86b53ffec1..ff1a332d76e4fe73eb418f87b43a2c083d6a01f3 100644 (file)
@@ -49,7 +49,7 @@
 #include <asm/param.h>         /* HZ */
 #include <asm/led.h>
 #include <asm/pdc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* The control of the LEDs and LCDs on PARISC-machines have to be done 
    completely in software. The necessary calculations are done in a work queue
index 3651c3871d5b45f4afc735709503aa315139c362..055f83fddc188d42e37869b4d403dfab635c9461 100644 (file)
@@ -68,7 +68,7 @@
 
 #include <asm/pdc.h>
 #include <asm/page.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/hardware.h>
 
 #define PDCS_VERSION   "0.30"
index 5bed17f68ef4d164bdef53a22c6c0c65c6e83e8c..d998d0ed2bec55af24c49f6fb182a9c2fc92daa2 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/sched.h>
 
 #include <asm/current.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #undef DEBUG
 
index 2e21af43d91ea26bcdfbe7ec3cc8354be086749c..c0e7d21c88c25da720b7156b1143374a4d574325 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/parport.h>
 #include <linux/delay.h>
 #include <linux/sched.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #undef DEBUG /* undef me for production */
 
index 6e3a60c788736a1e01c6d56377a4222d5e880e4a..dd6d4ccb41e4df9e97cd54d5f19337f3c69a6266 100644 (file)
@@ -34,7 +34,7 @@
 
 #include <asm/io.h>
 #include <asm/dma.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/superio.h>
 
 #include <linux/parport.h>
index d763bc9e44c1c1a0e98d7f69b490afdc0721004e..4d1d6eaf333ddb64362ed7b9a7bca613c0c763d1 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/ctype.h>
 #include <linux/string.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static const struct {
        const char *token;
index 74ed3e459a3e8fd41d0e1015d3e845a35142d8db..8ee44a104ac47939f7693370143c78135c3735c6 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/sysctl.h>
 #include <linux/device.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)
 
index f6221d739f59d73bfb09f49bc66a8cf33b2e9cdf..68d105aaf4e2ef9daf6ee37800cff620805b3487 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/kobject.h>
 #include <linux/moduleparam.h>
 #include <linux/pci.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "acpiphp.h"
 #include "../pci.h"
index ec009a7dba209868e88b9f002ff4c3b84d8f55f9..33d300d124110b07f4c5d987937c4d38b4e69f08 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "cpqphp.h"
 #include "cpqphp_nvram.h"
index c25fc906105935b91b6567af72ba7b978d7760d4..daae8071a15674f6d881aa79e1413d33b5d9c7c3 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/workqueue.h>
 #include <linux/pci.h>
 #include <linux/pci_hotplug.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "cpqphp.h"
 #include "cpqphp_nvram.h"
 
index 56013d0daf7f0d0b528bb3c7d28c2c0abb9ea8ba..7b0e97be9063d971dbd327836ab1c9cd2377287d 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/mutex.h>
 #include <linux/pci.h>
 #include <linux/pci_hotplug.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "../pci.h"
 #include "cpci_hotplug.h"
 
index 2408abe4ee8c68919d8a79465e62ab16f3c8660e..f82710a8694ddd48925a8ba92ef196e033e06dc8 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/capability.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 #include "pci.h"
 
index 9236e40ac05592f37eb895fe2b5ea5ef7bee6290..1800befa8b8baa1ca87052b7a4dc4e36cde9b2d8 100644 (file)
@@ -3044,7 +3044,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0e0d, quirk_intel_ntb);
 static ktime_t fixup_debug_start(struct pci_dev *dev,
                                 void (*fn)(struct pci_dev *dev))
 {
-       ktime_t calltime = ktime_set(0, 0);
+       ktime_t calltime = 0;
 
        dev_dbg(&dev->dev, "calling %pF\n", fn);
        if (initcall_debug) {
index b91c4da6836574f78df3785ae9ef419b80e069be..9bf993e1f71e837faebe8227accb6a7225a3d7cc 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/errno.h>
 #include <linux/pci.h>
 #include <linux/syscalls.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "pci.h"
 
 SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
index b37b5729456663bc1639d7ed544634432d883470..6d9335865880e18bd3d8e6172e876fe38180a22a 100644 (file)
@@ -1084,7 +1084,7 @@ static int arm_pmu_hp_init(void)
        int ret;
 
        ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_STARTING,
-                                     "AP_PERF_ARM_STARTING",
+                                     "perf/arm/pmu:starting",
                                      arm_perf_starting_cpu, NULL);
        if (ret)
                pr_err("CPU hotplug notifier for ARM PMU could not be registered: %d\n",
index a579126832afde2d758d629f58338af2d9e9378f..620c231a2889ef6879269a80ccbfaa3e4493958f 100644 (file)
@@ -212,7 +212,7 @@ static int meson_pmx_request_gpio(struct pinctrl_dev *pcdev,
 {
        struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev);
 
-       meson_pmx_disable_other_groups(pc, range->pin_base + offset, -1);
+       meson_pmx_disable_other_groups(pc, offset, -1);
 
        return 0;
 }
index aea310a918210ebc96bcb2739ac3c50d10329f8d..c9a146948192dba19ca5da1587791c25b315d628 100644 (file)
@@ -382,26 +382,21 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 {
        int ret = 0;
        u32 pin_reg;
-       unsigned long flags;
-       bool level_trig;
-       u32 active_level;
+       unsigned long flags, irq_flags;
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
        struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
 
        spin_lock_irqsave(&gpio_dev->lock, flags);
        pin_reg = readl(gpio_dev->base + (d->hwirq)*4);
 
-       /*
-        * When level_trig is set EDGE and active_level is set HIGH in BIOS
-        * default settings, ignore incoming settings from client and use
-        * BIOS settings to configure GPIO register.
+       /* Ignore the settings coming from the client and
+        * read the values from the ACPI tables
+        * while setting the trigger type
         */
-       level_trig = !(pin_reg & (LEVEL_TRIGGER << LEVEL_TRIG_OFF));
-       active_level = pin_reg & (ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
 
-       if(level_trig &&
-          ((active_level >> ACTIVE_LEVEL_OFF) == ACTIVE_HIGH))
-               type = IRQ_TYPE_EDGE_FALLING;
+       irq_flags = irq_get_trigger_type(d->irq);
+       if (irq_flags != IRQ_TYPE_NONE)
+               type = irq_flags;
 
        switch (type & IRQ_TYPE_SENSE_MASK) {
        case IRQ_TYPE_EDGE_RISING:
index 12f7d1eb65bc71e891f3eb88a750953dbd1ce68b..07409fde02b23f85005c0403ba146fce50cde970 100644 (file)
@@ -56,6 +56,17 @@ static const struct samsung_pin_bank_type bank_type_alive = {
        .reg_offset = { 0x00, 0x04, 0x08, 0x0c, },
 };
 
+/* Exynos5433 has the 4bit widths for PINCFG_TYPE_DRV bitfields. */
+static const struct samsung_pin_bank_type exynos5433_bank_type_off = {
+       .fld_width = { 4, 1, 2, 4, 2, 2, },
+       .reg_offset = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, },
+};
+
+static const struct samsung_pin_bank_type exynos5433_bank_type_alive = {
+       .fld_width = { 4, 1, 2, 4, },
+       .reg_offset = { 0x00, 0x04, 0x08, 0x0c, },
+};
+
 static void exynos_irq_mask(struct irq_data *irqd)
 {
        struct irq_chip *chip = irq_data_get_irq_chip(irqd);
@@ -1335,82 +1346,82 @@ const struct samsung_pin_ctrl exynos5420_pin_ctrl[] __initconst = {
 
 /* pin banks of exynos5433 pin-controller - ALIVE */
 static const struct samsung_pin_bank_data exynos5433_pin_banks0[] = {
-       EXYNOS_PIN_BANK_EINTW(8, 0x000, "gpa0", 0x00),
-       EXYNOS_PIN_BANK_EINTW(8, 0x020, "gpa1", 0x04),
-       EXYNOS_PIN_BANK_EINTW(8, 0x040, "gpa2", 0x08),
-       EXYNOS_PIN_BANK_EINTW(8, 0x060, "gpa3", 0x0c),
-       EXYNOS_PIN_BANK_EINTW_EXT(8, 0x020, "gpf1", 0x1004, 1),
-       EXYNOS_PIN_BANK_EINTW_EXT(4, 0x040, "gpf2", 0x1008, 1),
-       EXYNOS_PIN_BANK_EINTW_EXT(4, 0x060, "gpf3", 0x100c, 1),
-       EXYNOS_PIN_BANK_EINTW_EXT(8, 0x080, "gpf4", 0x1010, 1),
-       EXYNOS_PIN_BANK_EINTW_EXT(8, 0x0a0, "gpf5", 0x1014, 1),
+       EXYNOS5433_PIN_BANK_EINTW(8, 0x000, "gpa0", 0x00),
+       EXYNOS5433_PIN_BANK_EINTW(8, 0x020, "gpa1", 0x04),
+       EXYNOS5433_PIN_BANK_EINTW(8, 0x040, "gpa2", 0x08),
+       EXYNOS5433_PIN_BANK_EINTW(8, 0x060, "gpa3", 0x0c),
+       EXYNOS5433_PIN_BANK_EINTW_EXT(8, 0x020, "gpf1", 0x1004, 1),
+       EXYNOS5433_PIN_BANK_EINTW_EXT(4, 0x040, "gpf2", 0x1008, 1),
+       EXYNOS5433_PIN_BANK_EINTW_EXT(4, 0x060, "gpf3", 0x100c, 1),
+       EXYNOS5433_PIN_BANK_EINTW_EXT(8, 0x080, "gpf4", 0x1010, 1),
+       EXYNOS5433_PIN_BANK_EINTW_EXT(8, 0x0a0, "gpf5", 0x1014, 1),
 };
 
 /* pin banks of exynos5433 pin-controller - AUD */
 static const struct samsung_pin_bank_data exynos5433_pin_banks1[] = {
-       EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz0", 0x00),
-       EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04),
+       EXYNOS5433_PIN_BANK_EINTG(7, 0x000, "gpz0", 0x00),
+       EXYNOS5433_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04),
 };
 
 /* pin banks of exynos5433 pin-controller - CPIF */
 static const struct samsung_pin_bank_data exynos5433_pin_banks2[] = {
-       EXYNOS_PIN_BANK_EINTG(2, 0x000, "gpv6", 0x00),
+       EXYNOS5433_PIN_BANK_EINTG(2, 0x000, "gpv6", 0x00),
 };
 
 /* pin banks of exynos5433 pin-controller - eSE */
 static const struct samsung_pin_bank_data exynos5433_pin_banks3[] = {
-       EXYNOS_PIN_BANK_EINTG(3, 0x000, "gpj2", 0x00),
+       EXYNOS5433_PIN_BANK_EINTG(3, 0x000, "gpj2", 0x00),
 };
 
 /* pin banks of exynos5433 pin-controller - FINGER */
 static const struct samsung_pin_bank_data exynos5433_pin_banks4[] = {
-       EXYNOS_PIN_BANK_EINTG(4, 0x000, "gpd5", 0x00),
+       EXYNOS5433_PIN_BANK_EINTG(4, 0x000, "gpd5", 0x00),
 };
 
 /* pin banks of exynos5433 pin-controller - FSYS */
 static const struct samsung_pin_bank_data exynos5433_pin_banks5[] = {
-       EXYNOS_PIN_BANK_EINTG(6, 0x000, "gph1", 0x00),
-       EXYNOS_PIN_BANK_EINTG(7, 0x020, "gpr4", 0x04),
-       EXYNOS_PIN_BANK_EINTG(5, 0x040, "gpr0", 0x08),
-       EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpr1", 0x0c),
-       EXYNOS_PIN_BANK_EINTG(2, 0x080, "gpr2", 0x10),
-       EXYNOS_PIN_BANK_EINTG(8, 0x0a0, "gpr3", 0x14),
+       EXYNOS5433_PIN_BANK_EINTG(6, 0x000, "gph1", 0x00),
+       EXYNOS5433_PIN_BANK_EINTG(7, 0x020, "gpr4", 0x04),
+       EXYNOS5433_PIN_BANK_EINTG(5, 0x040, "gpr0", 0x08),
+       EXYNOS5433_PIN_BANK_EINTG(8, 0x060, "gpr1", 0x0c),
+       EXYNOS5433_PIN_BANK_EINTG(2, 0x080, "gpr2", 0x10),
+       EXYNOS5433_PIN_BANK_EINTG(8, 0x0a0, "gpr3", 0x14),
 };
 
 /* pin banks of exynos5433 pin-controller - IMEM */
 static const struct samsung_pin_bank_data exynos5433_pin_banks6[] = {
-       EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpf0", 0x00),
+       EXYNOS5433_PIN_BANK_EINTG(8, 0x000, "gpf0", 0x00),
 };
 
 /* pin banks of exynos5433 pin-controller - NFC */
 static const struct samsung_pin_bank_data exynos5433_pin_banks7[] = {
-       EXYNOS_PIN_BANK_EINTG(3, 0x000, "gpj0", 0x00),
+       EXYNOS5433_PIN_BANK_EINTG(3, 0x000, "gpj0", 0x00),
 };
 
 /* pin banks of exynos5433 pin-controller - PERIC */
 static const struct samsung_pin_bank_data exynos5433_pin_banks8[] = {
-       EXYNOS_PIN_BANK_EINTG(6, 0x000, "gpv7", 0x00),
-       EXYNOS_PIN_BANK_EINTG(5, 0x020, "gpb0", 0x04),
-       EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpc0", 0x08),
-       EXYNOS_PIN_BANK_EINTG(2, 0x060, "gpc1", 0x0c),
-       EXYNOS_PIN_BANK_EINTG(6, 0x080, "gpc2", 0x10),
-       EXYNOS_PIN_BANK_EINTG(8, 0x0a0, "gpc3", 0x14),
-       EXYNOS_PIN_BANK_EINTG(2, 0x0c0, "gpg0", 0x18),
-       EXYNOS_PIN_BANK_EINTG(4, 0x0e0, "gpd0", 0x1c),
-       EXYNOS_PIN_BANK_EINTG(6, 0x100, "gpd1", 0x20),
-       EXYNOS_PIN_BANK_EINTG(8, 0x120, "gpd2", 0x24),
-       EXYNOS_PIN_BANK_EINTG(5, 0x140, "gpd4", 0x28),
-       EXYNOS_PIN_BANK_EINTG(2, 0x160, "gpd8", 0x2c),
-       EXYNOS_PIN_BANK_EINTG(7, 0x180, "gpd6", 0x30),
-       EXYNOS_PIN_BANK_EINTG(3, 0x1a0, "gpd7", 0x34),
-       EXYNOS_PIN_BANK_EINTG(5, 0x1c0, "gpg1", 0x38),
-       EXYNOS_PIN_BANK_EINTG(2, 0x1e0, "gpg2", 0x3c),
-       EXYNOS_PIN_BANK_EINTG(8, 0x200, "gpg3", 0x40),
+       EXYNOS5433_PIN_BANK_EINTG(6, 0x000, "gpv7", 0x00),
+       EXYNOS5433_PIN_BANK_EINTG(5, 0x020, "gpb0", 0x04),
+       EXYNOS5433_PIN_BANK_EINTG(8, 0x040, "gpc0", 0x08),
+       EXYNOS5433_PIN_BANK_EINTG(2, 0x060, "gpc1", 0x0c),
+       EXYNOS5433_PIN_BANK_EINTG(6, 0x080, "gpc2", 0x10),
+       EXYNOS5433_PIN_BANK_EINTG(8, 0x0a0, "gpc3", 0x14),
+       EXYNOS5433_PIN_BANK_EINTG(2, 0x0c0, "gpg0", 0x18),
+       EXYNOS5433_PIN_BANK_EINTG(4, 0x0e0, "gpd0", 0x1c),
+       EXYNOS5433_PIN_BANK_EINTG(6, 0x100, "gpd1", 0x20),
+       EXYNOS5433_PIN_BANK_EINTG(8, 0x120, "gpd2", 0x24),
+       EXYNOS5433_PIN_BANK_EINTG(5, 0x140, "gpd4", 0x28),
+       EXYNOS5433_PIN_BANK_EINTG(2, 0x160, "gpd8", 0x2c),
+       EXYNOS5433_PIN_BANK_EINTG(7, 0x180, "gpd6", 0x30),
+       EXYNOS5433_PIN_BANK_EINTG(3, 0x1a0, "gpd7", 0x34),
+       EXYNOS5433_PIN_BANK_EINTG(5, 0x1c0, "gpg1", 0x38),
+       EXYNOS5433_PIN_BANK_EINTG(2, 0x1e0, "gpg2", 0x3c),
+       EXYNOS5433_PIN_BANK_EINTG(8, 0x200, "gpg3", 0x40),
 };
 
 /* pin banks of exynos5433 pin-controller - TOUCH */
 static const struct samsung_pin_bank_data exynos5433_pin_banks9[] = {
-       EXYNOS_PIN_BANK_EINTG(3, 0x000, "gpj1", 0x00),
+       EXYNOS5433_PIN_BANK_EINTG(3, 0x000, "gpj1", 0x00),
 };
 
 /*
index 5821525a2c8473fa026b3dc84cd6eb999c243b2a..a473092fb8d2362f11a1a48beb7f545b7c9f25ce 100644 (file)
                .pctl_res_idx   = pctl_idx,             \
        }                                               \
 
+#define EXYNOS5433_PIN_BANK_EINTG(pins, reg, id, offs)         \
+       {                                                       \
+               .type           = &exynos5433_bank_type_off,    \
+               .pctl_offset    = reg,                          \
+               .nr_pins        = pins,                         \
+               .eint_type      = EINT_TYPE_GPIO,               \
+               .eint_offset    = offs,                         \
+               .name           = id                            \
+       }
+
+#define EXYNOS5433_PIN_BANK_EINTW(pins, reg, id, offs)         \
+       {                                                       \
+               .type           = &exynos5433_bank_type_alive,  \
+               .pctl_offset    = reg,                          \
+               .nr_pins        = pins,                         \
+               .eint_type      = EINT_TYPE_WKUP,               \
+               .eint_offset    = offs,                         \
+               .name           = id                            \
+       }
+
+#define EXYNOS5433_PIN_BANK_EINTW_EXT(pins, reg, id, offs, pctl_idx) \
+       {                                                       \
+               .type           = &exynos5433_bank_type_alive,  \
+               .pctl_offset    = reg,                          \
+               .nr_pins        = pins,                         \
+               .eint_type      = EINT_TYPE_WKUP,               \
+               .eint_offset    = offs,                         \
+               .name           = id,                           \
+               .pctl_res_idx   = pctl_idx,                     \
+       }                                                       \
+
 /**
  * struct exynos_weint_data: irq specific data for all the wakeup interrupts
  * generated by the external wakeup interrupt controller.
index 5fe8be089b8b2dc51ced608e0790c7ce05b8dd18..59aa8e302bc3f9ab9dd26b43e6bf53ef812631fd 100644 (file)
@@ -1034,7 +1034,7 @@ config SURFACE_PRO3_BUTTON
 
 config SURFACE_3_BUTTON
        tristate "Power/home/volume buttons driver for Microsoft Surface 3 tablet"
-       depends on ACPI && KEYBOARD_GPIO
+       depends on ACPI && KEYBOARD_GPIO && I2C
        ---help---
          This driver handles the power/home/volume buttons on the Microsoft Surface 3 tablet.
 
index 61f39abf5dc8f24b738a2dafc5117b40a2521fd5..82d67715ce76d9ff0442ecdcdbd2dbb324380203 100644 (file)
@@ -177,43 +177,43 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event);
 
 #if IS_ENABLED(CONFIG_LEDS_CLASS)
 static enum led_brightness logolamp_get(struct led_classdev *cdev);
-static void logolamp_set(struct led_classdev *cdev,
+static int logolamp_set(struct led_classdev *cdev,
                               enum led_brightness brightness);
 
 static struct led_classdev logolamp_led = {
  .name = "fujitsu::logolamp",
  .brightness_get = logolamp_get,
- .brightness_set = logolamp_set
+ .brightness_set_blocking = logolamp_set
 };
 
 static enum led_brightness kblamps_get(struct led_classdev *cdev);
-static void kblamps_set(struct led_classdev *cdev,
+static int kblamps_set(struct led_classdev *cdev,
                               enum led_brightness brightness);
 
 static struct led_classdev kblamps_led = {
  .name = "fujitsu::kblamps",
  .brightness_get = kblamps_get,
- .brightness_set = kblamps_set
+ .brightness_set_blocking = kblamps_set
 };
 
 static enum led_brightness radio_led_get(struct led_classdev *cdev);
-static void radio_led_set(struct led_classdev *cdev,
+static int radio_led_set(struct led_classdev *cdev,
                               enum led_brightness brightness);
 
 static struct led_classdev radio_led = {
  .name = "fujitsu::radio_led",
  .brightness_get = radio_led_get,
- .brightness_set = radio_led_set
+ .brightness_set_blocking = radio_led_set
 };
 
 static enum led_brightness eco_led_get(struct led_classdev *cdev);
-static void eco_led_set(struct led_classdev *cdev,
+static int eco_led_set(struct led_classdev *cdev,
                               enum led_brightness brightness);
 
 static struct led_classdev eco_led = {
  .name = "fujitsu::eco_led",
  .brightness_get = eco_led_get,
- .brightness_set = eco_led_set
+ .brightness_set_blocking = eco_led_set
 };
 #endif
 
@@ -267,48 +267,48 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
 #if IS_ENABLED(CONFIG_LEDS_CLASS)
 /* LED class callbacks */
 
-static void logolamp_set(struct led_classdev *cdev,
+static int logolamp_set(struct led_classdev *cdev,
                               enum led_brightness brightness)
 {
        if (brightness >= LED_FULL) {
                call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON);
-               call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_ON);
+               return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_ON);
        } else if (brightness >= LED_HALF) {
                call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON);
-               call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_OFF);
+               return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_OFF);
        } else {
-               call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_OFF);
+               return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_OFF);
        }
 }
 
-static void kblamps_set(struct led_classdev *cdev,
+static int kblamps_set(struct led_classdev *cdev,
                               enum led_brightness brightness)
 {
        if (brightness >= LED_FULL)
-               call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON);
+               return call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON);
        else
-               call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF);
+               return call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF);
 }
 
-static void radio_led_set(struct led_classdev *cdev,
+static int radio_led_set(struct led_classdev *cdev,
                                enum led_brightness brightness)
 {
        if (brightness >= LED_FULL)
-               call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, RADIO_LED_ON);
+               return call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, RADIO_LED_ON);
        else
-               call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, 0x0);
+               return call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, 0x0);
 }
 
-static void eco_led_set(struct led_classdev *cdev,
+static int eco_led_set(struct led_classdev *cdev,
                                enum led_brightness brightness)
 {
        int curr;
 
        curr = call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0);
        if (brightness >= LED_FULL)
-               call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON);
+               return call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON);
        else
-               call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON);
+               return call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON);
 }
 
 static enum led_brightness logolamp_get(struct led_classdev *cdev)
index 978e6d6405729cb32391f73c65ac23a1b0eeebef..9a32f8627eccfd2054e96ec895234c0ca29cd70d 100644 (file)
@@ -283,7 +283,7 @@ static int __init msi_wmi_input_setup(void)
        if (err)
                goto err_free_keymap;
 
-       last_pressed = ktime_set(0, 0);
+       last_pressed = 0;
 
        return 0;
 
index c890a49587e45da50ff4305164dcf6cd9f6162d4..aa2ee51d3547b3630c2199f7ad569efbf738d7a6 100644 (file)
@@ -68,7 +68,7 @@
 #include <linux/poll.h>
 #include <linux/miscdevice.h>
 #endif
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <acpi/video.h>
 
 #define dprintk(fmt, ...)                      \
index aa65a857a6b1fa9c4b5b366ba09db915b82b7781..cacb43fb1df7fcbd5f643788fa960a4cdb6e4e36 100644 (file)
@@ -82,7 +82,7 @@
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/initval.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <acpi/video.h>
 
 /* ThinkPad CMOS commands */
index 4b6808ff0e5df3517f5e72a9fdd71ed6f05d0a9e..5c5b3d47b5f6fa52fe064ebe32f86106caafeb6c 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/slab.h>
 #include <linux/mutex.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "base.h"
 
index c212db0fc65de583e749d7cabaac54a2849133a6..5ee6b2a5f8d5cce1bf0932d27ba9ff589b4dbab1 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/seq_file.h>
 #include <linux/init.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "pnpbios.h"
 
index 15fed9d8f871a715dfada3dd22b8ca0e461dd66a..bfcd6fba6363bc01e5db313d6094dc1573424dd0 100644 (file)
@@ -169,7 +169,7 @@ static void ltc2952_poweroff_kill(void)
 
 static void ltc2952_poweroff_default(struct ltc2952_poweroff *data)
 {
-       data->wde_interval = ktime_set(0, 300L*1E6L);
+       data->wde_interval = 300L * 1E6L;
        data->trigger_delay = ktime_set(2, 500L*1E6L);
 
        hrtimer_init(&data->timer_trigger, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
index 84a52db9b05f905bae3c294b88d116e77327f8c5..fc0fa7577636dab1c02c3a34ea9e2c18b3255bfd 100644 (file)
@@ -363,7 +363,7 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
                rtc_timer_remove(rtc, &rtc->aie_timer);
 
        rtc->aie_timer.node.expires = rtc_tm_to_ktime(alarm->time);
-       rtc->aie_timer.period = ktime_set(0, 0);
+       rtc->aie_timer.period = 0;
        if (alarm->enabled)
                err = rtc_timer_enqueue(rtc, &rtc->aie_timer);
 
@@ -391,11 +391,11 @@ int rtc_initialize_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
                return err;
 
        rtc->aie_timer.node.expires = rtc_tm_to_ktime(alarm->time);
-       rtc->aie_timer.period = ktime_set(0, 0);
+       rtc->aie_timer.period = 0;
 
        /* Alarm has to be enabled & in the future for us to enqueue it */
-       if (alarm->enabled && (rtc_tm_to_ktime(now).tv64 <
-                        rtc->aie_timer.node.expires.tv64)) {
+       if (alarm->enabled && (rtc_tm_to_ktime(now) <
+                        rtc->aie_timer.node.expires)) {
 
                rtc->aie_timer.enabled = 1;
                timerqueue_add(&rtc->timerqueue, &rtc->aie_timer.node);
@@ -554,7 +554,7 @@ enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer)
        int count;
        rtc = container_of(timer, struct rtc_device, pie_timer);
 
-       period = ktime_set(0, NSEC_PER_SEC/rtc->irq_freq);
+       period = NSEC_PER_SEC / rtc->irq_freq;
        count = hrtimer_forward_now(timer, period);
 
        rtc_handle_legacy_irq(rtc, count, RTC_PF);
@@ -665,7 +665,7 @@ static int rtc_update_hrtimer(struct rtc_device *rtc, int enabled)
                return -1;
 
        if (enabled) {
-               ktime_t period = ktime_set(0, NSEC_PER_SEC / rtc->irq_freq);
+               ktime_t period = NSEC_PER_SEC / rtc->irq_freq;
 
                hrtimer_start(&rtc->pie_timer, period, HRTIMER_MODE_REL);
        }
@@ -766,7 +766,7 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
 
        /* Skip over expired timers */
        while (next) {
-               if (next->expires.tv64 >= now.tv64)
+               if (next->expires >= now)
                        break;
                next = timerqueue_iterate_next(next);
        }
@@ -858,7 +858,7 @@ again:
        __rtc_read_time(rtc, &tm);
        now = rtc_tm_to_ktime(tm);
        while ((next = timerqueue_getnext(&rtc->timerqueue))) {
-               if (next->expires.tv64 > now.tv64)
+               if (next->expires > now)
                        break;
 
                /* expire timer */
index 84ca314c87e3362431e737e66c84a0396d4acc00..dd46e96a3034239b875a4ea3eeb9f5c8f01c4db3 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/slab.h>
 
 #include <asm/debug.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ipl.h>
 
 /* This is ugly... */
index 67bf50c9946f939a663fc280cacc0a9d21fe9bef..ade04216c970094f0e5d8c76cf62c738d9140780 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/idals.h>
 #include <asm/ebcdic.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cio.h>
 #include <asm/ccwdev.h>
 #include <asm/itcw.h>
index 6c5d671304b435e030b28327cd50ab6f13c439eb..8713fefd794bfa7e89cfc79c07f06460236304b5 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 #include <asm/ebcdic.h>
 
index 113c1c1fa1af89ad390b680d07adf2ae66bb33ef..9e3419124264ab05ffe3cbe93a06489179c1f7d6 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <asm/debug.h>
 #include <asm/ebcdic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* This is ugly... */
 #define PRINTK_HEADER "dasd_erp:"
index e2fa759bf2ad42683b571e8a44a434ff3936b408..8b1341fb2e0db757d0ce753c0ebb8fe481c04515 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/fs.h>
 #include <linux/blkpg.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* This is ugly... */
 #define PRINTK_HEADER "dasd_gendisk:"
index 9dfbd972f844ef44cc237ce36236b993dc6baa4d..ec65c1e51c2a11d1cfeecab888d6c093f925205f 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/ccwdev.h>
 #include <asm/schid.h>
 #include <asm/cmb.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* This is ugly... */
 #define PRINTK_HEADER "dasd_ioctl:"
index bad7a196bf8401e053db9d7499058953067e9c5a..70dc2c4cd3f75408e786e0490876e03510a6f505 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/proc_fs.h>
 
 #include <asm/debug.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* This is ugly... */
 #define PRINTK_HEADER "dasd_proc:"
index 288f59a4147b1ffee2c330166c957f29406ed500..b9d7e755c8a37890961d06f95c77052cbd74d92f 100644 (file)
@@ -41,7 +41,7 @@
 #include <linux/suspend.h>
 #include <linux/platform_device.h>
 #include <linux/gfp.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define XPRAM_NAME     "xpram"
 #define XPRAM_DEVS     1       /* one partition */
index 1b8d825623bd409f74c12103a10d3a9c3f49d229..9ec4ae0561582544359933042769d263e7c62b4f 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/cio.h>
 #include <asm/io.h>
 #include <asm/ebcdic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/delay.h>
 #include <asm/cpcmd.h>
 #include <asm/setup.h>
index 7b9c50aa4cc922973cb2cd758244f264b81849d1..82c913318b73be149ac829b0c1e547a658686c8a 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/consolemap.h>
 #include <linux/kbd_kern.h>
 #include <linux/kbd_diacr.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "keyboard.h"
 
index ebdeaa53182de968ec3216318b2504c5ecdee1d2..027ac6ae5eea512c530a9afbb87bb31ad2bedd8e 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/device.h>
 #include <linux/slab.h>
 #include <net/iucv/iucv.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ebcdic.h>
 #include <asm/extmem.h>
 
index 9b5d1138b2e2b2218bc15cbe8b0adf873b3a343e..571a7e3527553ad905612007b860197ca4105b5a 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ebcdic.h>
 #include <asm/io.h>
 #include <asm/appldata.h>
index 6010cd347a08700701379ef17f738a12755eb110..91b26df5227d7b69ec7f82be9bbb807d7e9770e4 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/ctype.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "sclp.h"
 #include "sclp_rw.h"
index 9259017a12952be84e033783713620b96ec8284a..236b736ae136485bd0c39a5b27d70aaea2e2aaa5 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/gfp.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "ctrlchar.h"
 #include "sclp.h"
index 68d6ee7ae504dceab936071319152574304316ff..095481d32236e802d13ab236e72367e638f17caa 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/reboot.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "sclp.h"
 #include "ctrlchar.h"
 
index 77f9b9c2f7019d822a5bb9b96459af51f169d67f..46ac1164f2428e9a0d12b7fea20339bbda551a99 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/mtio.h>
 #include <linux/compat.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define TAPE_DBF_AREA  tape_core_dbf
 
index 272cb6cd1b2ac34afc9b9f38e7fe71f3c0b3f18d..e5ebe2fbee2353435002ec357542efd336c47f12 100644 (file)
@@ -24,7 +24,7 @@
 #include <asm/ccwdev.h>
 #include <asm/cio.h>
 #include <asm/ebcdic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "raw3270.h"
 #include "tty3270.h"
index 2a67b496a9e28869dd9443aa5b823be6003b900f..65f5a794f26d030380142837969bff389ad3c127 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/compat.h>
 #include <asm/cpcmd.h>
 #include <asm/debug.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "vmcp.h"
 
 static debug_info_t *vmcp_debug;
index 3167e85819941c95a921423ba85a64e78d081fbc..57974a1e0e03ca8121c4e4458c3feeabfce77b26 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cpcmd.h>
 #include <asm/debug.h>
 #include <asm/ebcdic.h>
index ff18f373af9acbccf0f9ec05887362811d582e21..04aceb694d5158ef5261930a0da02f04ef132c03 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cio.h>
 #include <asm/ccwdev.h>
 #include <asm/debug.h>
index f771e5e9e26be837e744394c69483bc9a66ce49c..d3b51edb056e64cde8760b5ad8cf98ef52a5993c 100644 (file)
@@ -23,7 +23,7 @@
 #include <asm/ipl.h>
 #include <asm/sclp.h>
 #include <asm/setup.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/debug.h>
 #include <asm/processor.h>
 #include <asm/irqflags.h>
index 9082476b51db9122a8a41186e7e40e1a97172368..bf7f5d4c50e130d8995d78ae5088b9212f8aacaf 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/ctype.h>
 #include <linux/device.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cio.h>
 #include <asm/ipl.h>
 
index 6d75984a3d85f29c464ddcc384839968a6633fb2..5fa6991928647971ef52047dad1294455219ada8 100644 (file)
@@ -333,7 +333,7 @@ void ap_wait(enum ap_wait wait)
        case AP_WAIT_TIMEOUT:
                spin_lock_bh(&ap_poll_timer_lock);
                if (!hrtimer_is_queued(&ap_poll_timer)) {
-                       hr_time = ktime_set(0, poll_timeout);
+                       hr_time = poll_timeout;
                        hrtimer_forward_now(&ap_poll_timer, hr_time);
                        hrtimer_restart(&ap_poll_timer);
                }
@@ -860,7 +860,7 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf,
            time > 120000000000ULL)
                return -EINVAL;
        poll_timeout = time;
-       hr_time = ktime_set(0, poll_timeout);
+       hr_time = poll_timeout;
 
        spin_lock_bh(&ap_poll_timer_lock);
        hrtimer_cancel(&ap_poll_timer);
index 854a6e58dfea9f7181c346b1af405801e0aa3fd0..51eece9af57778d3dc62a7b347add9855592ec44 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/compat.h>
 #include <linux/slab.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/hw_random.h>
 #include <linux/debugfs.h>
 #include <asm/debug.h>
index c7d48a18199e5171cc40ab426a4734852aaf7c0a..b97c5d5ee5a4aba9e70f88f791b674046092a6f7 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/mod_devicetable.h>
 
 #include "ap_bus.h"
index 26ceaa6967650b683b24ebee498d09c0feb8b4fd..600604782b65e972705d01984568134949e61039 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/mod_devicetable.h>
 
 #include "ap_bus.h"
index 2981024a24387aeb001357834805ba886ad3531e..3f85b97ab8d2704820ba1f6f038a99534a14461a 100644 (file)
@@ -62,7 +62,7 @@
 #include <net/dst.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ebcdic.h>
 
 #include <net/iucv/iucv.h>
index 581001989937ce1e0aaab11c26136d5e11b4fa4d..d5bf36ec8a751326062e47abe80ddd1f61a5f43b 100644 (file)
@@ -289,11 +289,12 @@ void zfcp_dbf_rec_trig(char *tag, struct zfcp_adapter *adapter,
 
 
 /**
- * zfcp_dbf_rec_run - trace event related to running recovery
+ * zfcp_dbf_rec_run_lvl - trace event related to running recovery
+ * @level: trace level to be used for event
  * @tag: identifier for event
  * @erp: erp_action running
  */
-void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp)
+void zfcp_dbf_rec_run_lvl(int level, char *tag, struct zfcp_erp_action *erp)
 {
        struct zfcp_dbf *dbf = erp->adapter->dbf;
        struct zfcp_dbf_rec *rec = &dbf->rec_buf;
@@ -319,10 +320,20 @@ void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp)
        else
                rec->u.run.rec_count = atomic_read(&erp->adapter->erp_counter);
 
-       debug_event(dbf->rec, 1, rec, sizeof(*rec));
+       debug_event(dbf->rec, level, rec, sizeof(*rec));
        spin_unlock_irqrestore(&dbf->rec_lock, flags);
 }
 
+/**
+ * zfcp_dbf_rec_run - trace event related to running recovery
+ * @tag: identifier for event
+ * @erp: erp_action running
+ */
+void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp)
+{
+       zfcp_dbf_rec_run_lvl(1, tag, erp);
+}
+
 /**
  * zfcp_dbf_rec_run_wka - trace wka port event with info like running recovery
  * @tag: identifier for event
index 36d07584271d569d27ec2eeb3706235d6459e026..db186d44cfafb6036a7e452e68e2c8f078cff6d1 100644 (file)
@@ -2,7 +2,7 @@
  * zfcp device driver
  * debug feature declarations
  *
- * Copyright IBM Corp. 2008, 2015
+ * Copyright IBM Corp. 2008, 2016
  */
 
 #ifndef ZFCP_DBF_H
@@ -283,6 +283,30 @@ struct zfcp_dbf {
        struct zfcp_dbf_scsi            scsi_buf;
 };
 
+/**
+ * zfcp_dbf_hba_fsf_resp_suppress - true if we should not trace by default
+ * @req: request that has been completed
+ *
+ * Returns true if FCP response with only benign residual under count.
+ */
+static inline
+bool zfcp_dbf_hba_fsf_resp_suppress(struct zfcp_fsf_req *req)
+{
+       struct fsf_qtcb *qtcb = req->qtcb;
+       u32 fsf_stat = qtcb->header.fsf_status;
+       struct fcp_resp *fcp_rsp;
+       u8 rsp_flags, fr_status;
+
+       if (qtcb->prefix.qtcb_type != FSF_IO_COMMAND)
+               return false; /* not an FCP response */
+       fcp_rsp = (struct fcp_resp *)&qtcb->bottom.io.fcp_rsp;
+       rsp_flags = fcp_rsp->fr_flags;
+       fr_status = fcp_rsp->fr_status;
+       return (fsf_stat == FSF_FCP_RSP_AVAILABLE) &&
+               (rsp_flags == FCP_RESID_UNDER) &&
+               (fr_status == SAM_STAT_GOOD);
+}
+
 static inline
 void zfcp_dbf_hba_fsf_resp(char *tag, int level, struct zfcp_fsf_req *req)
 {
@@ -304,7 +328,9 @@ void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req)
                zfcp_dbf_hba_fsf_resp("fs_perr", 1, req);
 
        } else if (qtcb->header.fsf_status != FSF_GOOD) {
-               zfcp_dbf_hba_fsf_resp("fs_ferr", 1, req);
+               zfcp_dbf_hba_fsf_resp("fs_ferr",
+                                     zfcp_dbf_hba_fsf_resp_suppress(req)
+                                     ? 5 : 1, req);
 
        } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
                   (req->fsf_command == FSF_QTCB_OPEN_LUN)) {
@@ -388,4 +414,15 @@ void zfcp_dbf_scsi_devreset(char *tag, struct scsi_cmnd *scmnd, u8 flag)
        _zfcp_dbf_scsi(tmp_tag, 1, scmnd, NULL);
 }
 
+/**
+ * zfcp_dbf_scsi_nullcmnd() - trace NULLify of SCSI command in dev/tgt-reset.
+ * @scmnd: SCSI command that was NULLified.
+ * @fsf_req: request that owned @scmnd.
+ */
+static inline void zfcp_dbf_scsi_nullcmnd(struct scsi_cmnd *scmnd,
+                                         struct zfcp_fsf_req *fsf_req)
+{
+       _zfcp_dbf_scsi("scfc__1", 3, scmnd, fsf_req);
+}
+
 #endif /* ZFCP_DBF_H */
index a59d678125bd0e0ad0bd1ca74b0d42985abb25d8..7ccfce55903423f5e998fe3d93f6942a5879376f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Error Recovery Procedures (ERP).
  *
- * Copyright IBM Corp. 2002, 2015
+ * Copyright IBM Corp. 2002, 2016
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -1204,6 +1204,62 @@ static void zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action)
        }
 }
 
+/**
+ * zfcp_erp_try_rport_unblock - unblock rport if no more/new recovery
+ * @port: zfcp_port whose fc_rport we should try to unblock
+ */
+static void zfcp_erp_try_rport_unblock(struct zfcp_port *port)
+{
+       unsigned long flags;
+       struct zfcp_adapter *adapter = port->adapter;
+       int port_status;
+       struct Scsi_Host *shost = adapter->scsi_host;
+       struct scsi_device *sdev;
+
+       write_lock_irqsave(&adapter->erp_lock, flags);
+       port_status = atomic_read(&port->status);
+       if ((port_status & ZFCP_STATUS_COMMON_UNBLOCKED)    == 0 ||
+           (port_status & (ZFCP_STATUS_COMMON_ERP_INUSE |
+                           ZFCP_STATUS_COMMON_ERP_FAILED)) != 0) {
+               /* new ERP of severity >= port triggered elsewhere meanwhile or
+                * local link down (adapter erp_failed but not clear unblock)
+                */
+               zfcp_dbf_rec_run_lvl(4, "ertru_p", &port->erp_action);
+               write_unlock_irqrestore(&adapter->erp_lock, flags);
+               return;
+       }
+       spin_lock(shost->host_lock);
+       __shost_for_each_device(sdev, shost) {
+               struct zfcp_scsi_dev *zsdev = sdev_to_zfcp(sdev);
+               int lun_status;
+
+               if (zsdev->port != port)
+                       continue;
+               /* LUN under port of interest */
+               lun_status = atomic_read(&zsdev->status);
+               if ((lun_status & ZFCP_STATUS_COMMON_ERP_FAILED) != 0)
+                       continue; /* unblock rport despite failed LUNs */
+               /* LUN recovery not given up yet [maybe follow-up pending] */
+               if ((lun_status & ZFCP_STATUS_COMMON_UNBLOCKED) == 0 ||
+                   (lun_status & ZFCP_STATUS_COMMON_ERP_INUSE) != 0) {
+                       /* LUN blocked:
+                        * not yet unblocked [LUN recovery pending]
+                        * or meanwhile blocked [new LUN recovery triggered]
+                        */
+                       zfcp_dbf_rec_run_lvl(4, "ertru_l", &zsdev->erp_action);
+                       spin_unlock(shost->host_lock);
+                       write_unlock_irqrestore(&adapter->erp_lock, flags);
+                       return;
+               }
+       }
+       /* now port has no child or all children have completed recovery,
+        * and no ERP of severity >= port was meanwhile triggered elsewhere
+        */
+       zfcp_scsi_schedule_rport_register(port);
+       spin_unlock(shost->host_lock);
+       write_unlock_irqrestore(&adapter->erp_lock, flags);
+}
+
 static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
 {
        struct zfcp_adapter *adapter = act->adapter;
@@ -1214,6 +1270,7 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
        case ZFCP_ERP_ACTION_REOPEN_LUN:
                if (!(act->status & ZFCP_STATUS_ERP_NO_REF))
                        scsi_device_put(sdev);
+               zfcp_erp_try_rport_unblock(port);
                break;
 
        case ZFCP_ERP_ACTION_REOPEN_PORT:
@@ -1224,7 +1281,7 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
                 */
                if (act->step != ZFCP_ERP_STEP_UNINITIALIZED)
                        if (result == ZFCP_ERP_SUCCEEDED)
-                               zfcp_scsi_schedule_rport_register(port);
+                               zfcp_erp_try_rport_unblock(port);
                /* fall through */
        case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
                put_device(&port->dev);
index 968a0ab4b398c23329f5713b07091db1ab80d92d..9afdbc32b23f6386a7dce2b51e4cf67ad562d215 100644 (file)
@@ -3,7 +3,7 @@
  *
  * External function declarations.
  *
- * Copyright IBM Corp. 2002, 2015
+ * Copyright IBM Corp. 2002, 2016
  */
 
 #ifndef ZFCP_EXT_H
@@ -35,6 +35,8 @@ extern void zfcp_dbf_adapter_unregister(struct zfcp_adapter *);
 extern void zfcp_dbf_rec_trig(char *, struct zfcp_adapter *,
                              struct zfcp_port *, struct scsi_device *, u8, u8);
 extern void zfcp_dbf_rec_run(char *, struct zfcp_erp_action *);
+extern void zfcp_dbf_rec_run_lvl(int level, char *tag,
+                                struct zfcp_erp_action *erp);
 extern void zfcp_dbf_rec_run_wka(char *, struct zfcp_fc_wka_port *, u64);
 extern void zfcp_dbf_hba_fsf_uss(char *, struct zfcp_fsf_req *);
 extern void zfcp_dbf_hba_fsf_res(char *, int, struct zfcp_fsf_req *);
index be1c04b334c51f678d643e4c488173f8fd6be0ee..ea3c76ac0de14dc8ea9ad147d1f5b9ab80cc1172 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Interface to the FSF support functions.
  *
- * Copyright IBM Corp. 2002, 2015
+ * Copyright IBM Corp. 2002, 2016
  */
 
 #ifndef FSF_H
@@ -78,6 +78,7 @@
 #define FSF_APP_TAG_CHECK_FAILURE              0x00000082
 #define FSF_REF_TAG_CHECK_FAILURE              0x00000083
 #define FSF_ADAPTER_STATUS_AVAILABLE           0x000000AD
+#define FSF_FCP_RSP_AVAILABLE                  0x000000AF
 #define FSF_UNKNOWN_COMMAND                    0x000000E2
 #define FSF_UNKNOWN_OP_SUBTYPE                  0x000000E3
 #define FSF_INVALID_COMMAND_OPTION              0x000000E5
index 7c2c6194dfca58e1eb2fe6466abf64fd928deb96..703fce59befef0be884449e00addad4a49981d61 100644 (file)
@@ -4,7 +4,7 @@
  * Data structure and helper functions for tracking pending FSF
  * requests.
  *
- * Copyright IBM Corp. 2009
+ * Copyright IBM Corp. 2009, 2016
  */
 
 #ifndef ZFCP_REQLIST_H
@@ -180,4 +180,32 @@ static inline void zfcp_reqlist_move(struct zfcp_reqlist *rl,
        spin_unlock_irqrestore(&rl->lock, flags);
 }
 
+/**
+ * zfcp_reqlist_apply_for_all() - apply a function to every request.
+ * @rl: the requestlist that contains the target requests.
+ * @f: the function to apply to each request; the first parameter of the
+ *     function will be the target-request; the second parameter is the same
+ *     pointer as given with the argument @data.
+ * @data: freely chosen argument; passed through to @f as second parameter.
+ *
+ * Uses :c:macro:`list_for_each_entry` to iterate over the lists in the hash-
+ * table (not a 'safe' variant, so don't modify the list).
+ *
+ * Holds @rl->lock over the entire request-iteration.
+ */
+static inline void
+zfcp_reqlist_apply_for_all(struct zfcp_reqlist *rl,
+                          void (*f)(struct zfcp_fsf_req *, void *), void *data)
+{
+       struct zfcp_fsf_req *req;
+       unsigned long flags;
+       unsigned int i;
+
+       spin_lock_irqsave(&rl->lock, flags);
+       for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
+               list_for_each_entry(req, &rl->buckets[i], list)
+                       f(req, data);
+       spin_unlock_irqrestore(&rl->lock, flags);
+}
+
 #endif /* ZFCP_REQLIST_H */
index 9069f98a18172e754c943010654de65e91c2fb7c..07ffdbb5107f732082e88c94b0362b845e7e17d6 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Interface to Linux SCSI midlayer.
  *
- * Copyright IBM Corp. 2002, 2015
+ * Copyright IBM Corp. 2002, 2016
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -88,9 +88,7 @@ int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt)
        }
 
        if (unlikely(!(status & ZFCP_STATUS_COMMON_UNBLOCKED))) {
-               /* This could be either
-                * open LUN pending: this is temporary, will result in
-                *      open LUN or ERP_FAILED, so retry command
+               /* This could be
                 * call to rport_delete pending: mimic retry from
                 *      fc_remote_port_chkready until rport is BLOCKED
                 */
@@ -209,6 +207,57 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
        return retval;
 }
 
+struct zfcp_scsi_req_filter {
+       u8 tmf_scope;
+       u32 lun_handle;
+       u32 port_handle;
+};
+
+static void zfcp_scsi_forget_cmnd(struct zfcp_fsf_req *old_req, void *data)
+{
+       struct zfcp_scsi_req_filter *filter =
+               (struct zfcp_scsi_req_filter *)data;
+
+       /* already aborted - prevent side-effects - or not a SCSI command */
+       if (old_req->data == NULL || old_req->fsf_command != FSF_QTCB_FCP_CMND)
+               return;
+
+       /* (tmf_scope == FCP_TMF_TGT_RESET || tmf_scope == FCP_TMF_LUN_RESET) */
+       if (old_req->qtcb->header.port_handle != filter->port_handle)
+               return;
+
+       if (filter->tmf_scope == FCP_TMF_LUN_RESET &&
+           old_req->qtcb->header.lun_handle != filter->lun_handle)
+               return;
+
+       zfcp_dbf_scsi_nullcmnd((struct scsi_cmnd *)old_req->data, old_req);
+       old_req->data = NULL;
+}
+
+static void zfcp_scsi_forget_cmnds(struct zfcp_scsi_dev *zsdev, u8 tm_flags)
+{
+       struct zfcp_adapter *adapter = zsdev->port->adapter;
+       struct zfcp_scsi_req_filter filter = {
+               .tmf_scope = FCP_TMF_TGT_RESET,
+               .port_handle = zsdev->port->handle,
+       };
+       unsigned long flags;
+
+       if (tm_flags == FCP_TMF_LUN_RESET) {
+               filter.tmf_scope = FCP_TMF_LUN_RESET;
+               filter.lun_handle = zsdev->lun_handle;
+       }
+
+       /*
+        * abort_lock secures against other processings - in the abort-function
+        * and normal cmnd-handler - of (struct zfcp_fsf_req *)->data
+        */
+       write_lock_irqsave(&adapter->abort_lock, flags);
+       zfcp_reqlist_apply_for_all(adapter->req_list, zfcp_scsi_forget_cmnd,
+                                  &filter);
+       write_unlock_irqrestore(&adapter->abort_lock, flags);
+}
+
 static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
 {
        struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
@@ -241,8 +290,10 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
        if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCFAILED) {
                zfcp_dbf_scsi_devreset("fail", scpnt, tm_flags);
                retval = FAILED;
-       } else
+       } else {
                zfcp_dbf_scsi_devreset("okay", scpnt, tm_flags);
+               zfcp_scsi_forget_cmnds(zfcp_sdev, tm_flags);
+       }
 
        zfcp_fsf_req_free(fsf_req);
        return retval;
index 33fbe8249fd5c16b25d83d29c0e4f86ea0e8608c..04efed171c88981e23e23bf6ac8438c42ebae69a 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>               /* put_/get_user                        */
+#include <linux/uaccess.h>             /* put_/get_user                        */
 #include <asm/io.h>
 
 #include <asm/display7seg.h>
index 5609b602c54d31077f4f6136129eda7ffda310e1..56e962a014939e31c7ad74687263ecd69558ef7b 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/envctrl.h>
 #include <asm/io.h>
 
index 206ef4232adf3a03933b4b28ca490c6181ee9aab..216f923161d1007866130c22872ef22f604197d9 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/upa.h>
index a40ee1e37486bd9b05062074507fd2a64d472677..6ff61dad5e21570f27ed68474bbe60f9e7095948 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/string.h>
 #include <linux/genhd.h>
 #include <linux/blkdev.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/pcic.h>
index 4612691c6619e6ed19bd29790028e5c94e32fe00..2c2e6a3b4c7e51b6d61981b93a7cb3c7b19b16fa 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/fs.h>
 #include <asm/oplib.h>
 #include <asm/prom.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/openpromio.h>
 #ifdef CONFIG_PCI
 #include <linux/pci.h>
index a56a7b243e91fae96b05cae0118d96e9d284dd7b..00e7968a1d70f6b120aa0309087d196f77f5f145 100644 (file)
@@ -1,8 +1,8 @@
 /*
    3w-9xxx.c -- 3ware 9000 Storage Controller device driver for Linux.
 
-   Written By: Adam Radford <linuxraid@lsi.com>
-   Modifications By: Tom Couch <linuxraid@lsi.com>
+   Written By: Adam Radford <aradford@gmail.com>
+   Modifications By: Tom Couch
 
    Copyright (C) 2004-2009 Applied Micro Circuits Corporation.
    Copyright (C) 2010 LSI Corporation.
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
    Bugs/Comments/Suggestions should be mailed to:
-   linuxraid@lsi.com
-
-   For more information, goto:
-   http://www.lsi.com
+   aradford@gmail.com
 
    Note: This version of the driver does not contain a bundled firmware
          image.
@@ -95,7 +92,7 @@
 #include <linux/slab.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_tcq.h>
index 0fdc83cfa0e1a28a42757ae52f434523238075b3..b6c208cc474f0e4ae5d37b0c7465c99129121cc7 100644 (file)
@@ -1,8 +1,8 @@
 /*
    3w-9xxx.h -- 3ware 9000 Storage Controller device driver for Linux.
 
-   Written By: Adam Radford <linuxraid@lsi.com>
-   Modifications By: Tom Couch <linuxraid@lsi.com>
+   Written By: Adam Radford <aradford@gmail.com>
+   Modifications By: Tom Couch
 
    Copyright (C) 2004-2009 Applied Micro Circuits Corporation.
    Copyright (C) 2010 LSI Corporation.
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
    Bugs/Comments/Suggestions should be mailed to:
-   linuxraid@lsi.com
-
-   For more information, goto:
-   http://www.lsi.com
+   aradford@gmail.com
 */
 
 #ifndef _3W_9XXX_H
index f8374850f714dd09c53aa1eb25a38bbcb7d0ee8d..b150e131b2e76a172aa13bbf84949ec0cc269cd4 100644 (file)
@@ -1,7 +1,7 @@
 /*
    3w-sas.c -- LSI 3ware SAS/SATA-RAID Controller device driver for Linux.
 
-   Written By: Adam Radford <linuxraid@lsi.com>
+   Written By: Adam Radford <aradford@gmail.com>
 
    Copyright (C) 2009 LSI Corporation.
 
    LSI 3ware 9750 6Gb/s SAS/SATA-RAID
 
    Bugs/Comments/Suggestions should be mailed to:
-   linuxraid@lsi.com
-
-   For more information, goto:
-   http://www.lsi.com
+   aradford@gmail.com
 
    History
    -------
@@ -67,7 +64,7 @@
 #include <linux/slab.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_tcq.h>
index fec6449c7595132f706439277cd396b4dc66c0a8..05e77d84c16d95254544750c4e297a35887fc5dc 100644 (file)
@@ -1,7 +1,7 @@
 /*
    3w-sas.h -- LSI 3ware SAS/SATA-RAID Controller device driver for Linux.
 
-   Written By: Adam Radford <linuxraid@lsi.com>
+   Written By: Adam Radford <aradford@gmail.com>
 
    Copyright (C) 2009 LSI Corporation.
 
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
    Bugs/Comments/Suggestions should be mailed to:
-   linuxraid@lsi.com
-
-   For more information, goto:
-   http://www.lsi.com
+   aradford@gmail.com
 */
 
 #ifndef _3W_SAS_H
index 25aba1613e2157f7a2e468007c202a16015b3f40..33261b690774a8deeb8ec20835d0b24100a926b0 100644 (file)
@@ -1,7 +1,7 @@
 /* 
    3w-xxxx.c -- 3ware Storage Controller device driver for Linux.
 
-   Written By: Adam Radford <linuxraid@lsi.com>
+   Written By: Adam Radford <aradford@gmail.com>
    Modifications By: Joel Jacobson <linux@3ware.com>
                     Arnaldo Carvalho de Melo <acme@conectiva.com.br>
                      Brad Strand <linux@3ware.com>
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
    Bugs/Comments/Suggestions should be mailed to:                            
-   linuxraid@lsi.com
 
-   For more information, goto:
-   http://www.lsi.com
+   aradford@gmail.com
+
 
    History
    -------
 #include <linux/mutex.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_tcq.h>
index 6f65e663d3932108edaed6b75eba328d469f4fce..69e80c1ed1ca642806698177f0c345e2d600b2c5 100644 (file)
@@ -1,7 +1,7 @@
 /* 
    3w-xxxx.h -- 3ware Storage Controller device driver for Linux.
    
-   Written By: Adam Radford <linuxraid@lsi.com>
+   Written By: Adam Radford <aradford@gmail.com>
    Modifications By: Joel Jacobson <linux@3ware.com>
                     Arnaldo Carvalho de Melo <acme@conectiva.com.br>
                      Brad Strand <linux@3ware.com>
@@ -45,7 +45,8 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
    Bugs/Comments/Suggestions should be mailed to:                            
-   linuxraid@lsi.com
+
+   aradford@gmail.com
    
    For more information, goto:
    http://www.lsi.com
index dfa93347c752479aeff9f4c307911add845a880e..a4f6b0d955159cde292b9c7f09811d5d542c3fa8 100644 (file)
@@ -1233,6 +1233,7 @@ config SCSI_QLOGICPTI
 
 source "drivers/scsi/qla2xxx/Kconfig"
 source "drivers/scsi/qla4xxx/Kconfig"
+source "drivers/scsi/qedi/Kconfig"
 
 config SCSI_LPFC
        tristate "Emulex LightPulse Fibre Channel Support"
index a2d03957cbe2e85626199e854f6ad1e26f5128ee..736b77414a4baae3fe9520dc1eea00df591b4d7f 100644 (file)
@@ -131,6 +131,7 @@ obj-$(CONFIG_PS3_ROM)               += ps3rom.o
 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)  += libiscsi.o bnx2i/
+obj-$(CONFIG_QEDI)          += libiscsi.o qedi/
 obj-$(CONFIG_BE2ISCSI)         += libiscsi.o be2iscsi/
 obj-$(CONFIG_SCSI_ESAS2R)      += esas2r/
 obj-$(CONFIG_SCSI_PMCRAID)     += pmcraid.o
index d849ffa378b1ef19f80af760d53ae29774007e7c..4f5ca794bb71507a90879af23f0f4ea998fea9ec 100644 (file)
@@ -97,9 +97,6 @@
  * and macros and include this file in your driver.
  *
  * These macros control options :
- * AUTOPROBE_IRQ - if defined, the NCR5380_probe_irq() function will be
- * defined.
- *
  * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically
  * for commands that return with a CHECK CONDITION status.
  *
  * NCR5380_dma_residual   - residual byte count
  *
  * The generic driver is initialized by calling NCR5380_init(instance),
- * after setting the appropriate host specific fields and ID.  If the
- * driver wishes to autoprobe for an IRQ line, the NCR5380_probe_irq(instance,
- * possible) function may be used.
+ * after setting the appropriate host specific fields and ID.
  */
 
 #ifndef NCR5380_io_delay
@@ -351,76 +346,6 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
 }
 #endif
 
-
-static int probe_irq;
-
-/**
- * probe_intr  -       helper for IRQ autoprobe
- * @irq: interrupt number
- * @dev_id: unused
- * @regs: unused
- *
- * Set a flag to indicate the IRQ in question was received. This is
- * used by the IRQ probe code.
- */
-
-static irqreturn_t probe_intr(int irq, void *dev_id)
-{
-       probe_irq = irq;
-       return IRQ_HANDLED;
-}
-
-/**
- * NCR5380_probe_irq   -       find the IRQ of an NCR5380
- * @instance: NCR5380 controller
- * @possible: bitmask of ISA IRQ lines
- *
- * Autoprobe for the IRQ line used by the NCR5380 by triggering an IRQ
- * and then looking to see what interrupt actually turned up.
- */
-
-static int __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance,
-                                               int possible)
-{
-       struct NCR5380_hostdata *hostdata = shost_priv(instance);
-       unsigned long timeout;
-       int trying_irqs, i, mask;
-
-       for (trying_irqs = 0, i = 1, mask = 2; i < 16; ++i, mask <<= 1)
-               if ((mask & possible) && (request_irq(i, &probe_intr, 0, "NCR-probe", NULL) == 0))
-                       trying_irqs |= mask;
-
-       timeout = jiffies + msecs_to_jiffies(250);
-       probe_irq = NO_IRQ;
-
-       /*
-        * A interrupt is triggered whenever BSY = false, SEL = true
-        * and a bit set in the SELECT_ENABLE_REG is asserted on the
-        * SCSI bus.
-        *
-        * Note that the bus is only driven when the phase control signals
-        * (I/O, C/D, and MSG) match those in the TCR, so we must reset that
-        * to zero.
-        */
-
-       NCR5380_write(TARGET_COMMAND_REG, 0);
-       NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
-       NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
-       NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL);
-
-       while (probe_irq == NO_IRQ && time_before(jiffies, timeout))
-               schedule_timeout_uninterruptible(1);
-
-       NCR5380_write(SELECT_ENABLE_REG, 0);
-       NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-
-       for (i = 1, mask = 2; i < 16; ++i, mask <<= 1)
-               if (trying_irqs & mask)
-                       free_irq(i, NULL);
-
-       return probe_irq;
-}
-
 /**
  * NCR58380_info - report driver and host information
  * @instance: relevant scsi host instance
index 3c6ce5434449677026551e8d1acd5c447785bb8e..51a3567a6fb2a36a3eb44fbf94edf5536e333fe4 100644 (file)
 
 #define PHASE_SR_TO_TCR(phase) ((phase) >> 2)
 
-/*
- * These are "special" values for the irq and dma_channel fields of the 
- * Scsi_Host structure
- */
-
-#define DMA_NONE       255
-#define IRQ_AUTO       254
-#define DMA_AUTO       254
-#define PORT_AUTO      0xffff  /* autoprobe io port for 53c400a */
-
 #ifndef NO_IRQ
 #define NO_IRQ         0
 #endif
@@ -290,7 +280,6 @@ static void NCR5380_print(struct Scsi_Host *instance);
 #define NCR5380_dprint_phase(flg, arg) do {} while (0)
 #endif
 
-static int NCR5380_probe_irq(struct Scsi_Host *instance, int possible);
 static int NCR5380_init(struct Scsi_Host *instance, int flags);
 static int NCR5380_maybe_reset_bus(struct Scsi_Host *);
 static void NCR5380_exit(struct Scsi_Host *instance);
index 6678d1fd897bec099a0ac4fe147d3c11af01e614..1ee7c654f7b80a44b395715fb5675aa3cef3940d 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/slab.h>
 #include <linux/completion.h>
 #include <linux/blkdev.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/highmem.h> /* For flush_kernel_dcache_page */
 #include <linux/module.h>
 
index 5648b715fed9c2d4e448c9f477953ecb83e94641..e1daff230c7dab05b794cf44a8675d9cad04fcaa 100644 (file)
@@ -41,7 +41,7 @@
 #include <linux/delay.h> /* ssleep prototype */
 #include <linux/kthread.h>
 #include <linux/semaphore.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <scsi/scsi_host.h>
 
 #include "aacraid.h"
index e4f3e22fcbd9b3d4463374375e7ee32542f409d4..3ecbf20ca29f96b970cd4b14c38eb3fdbb3b1511 100644 (file)
@@ -160,7 +160,6 @@ static const struct pci_device_id aac_pci_tbl[] = {
        { 0x9005, 0x028b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 62 }, /* Adaptec PMC Series 6 (Tupelo) */
        { 0x9005, 0x028c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 63 }, /* Adaptec PMC Series 7 (Denali) */
        { 0x9005, 0x028d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 64 }, /* Adaptec PMC Series 8 */
-       { 0x9005, 0x028f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 65 }, /* Adaptec PMC Series 9 */
        { 0,}
 };
 MODULE_DEVICE_TABLE(pci, aac_pci_tbl);
@@ -239,7 +238,6 @@ static struct aac_driver_ident aac_drivers[] = {
        { aac_src_init, "aacraid", "ADAPTEC ", "RAID            ", 2, AAC_QUIRK_SRC }, /* Adaptec PMC Series 6 (Tupelo) */
        { aac_srcv_init, "aacraid", "ADAPTEC ", "RAID            ", 2, AAC_QUIRK_SRC }, /* Adaptec PMC Series 7 (Denali) */
        { aac_srcv_init, "aacraid", "ADAPTEC ", "RAID            ", 2, AAC_QUIRK_SRC }, /* Adaptec PMC Series 8 */
-       { aac_srcv_init, "aacraid", "ADAPTEC ", "RAID            ", 2, AAC_QUIRK_SRC } /* Adaptec PMC Series 9 */
 };
 
 /**
index 9e45749d55ed59f43c2da142405a6eb5ba6cd97d..af032c46ec0e1950deecbc69a33c24035bb4ecae 100644 (file)
@@ -61,7 +61,7 @@
 #include <linux/circ_buf.h>
 #include <asm/dma.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
index 9d253cb83ee762692c1ec0f56303f3c7fc8b416e..d9e15210b110efcd3147d5a02f0e06c0673d4ad3 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/fs.h>
 #include <linux/pci.h>
 #include <linux/firmware.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/fcntl.h>
 
 #include "bfad_drv.h"
index 0990130821fa5ac8a3fc876fd5b055f81a31237a..c639d5a02656abf9678f1ef358c4166e5db04a66 100644 (file)
@@ -127,13 +127,6 @@ module_param_named(log_fka, bnx2fc_log_fka, uint, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(log_fka, " Print message to kernel log when fcoe is "
        "initiating a FIP keep alive when debug logging is enabled.");
 
-static int bnx2fc_cpu_callback(struct notifier_block *nfb,
-                            unsigned long action, void *hcpu);
-/* notification function for CPU hotplug events */
-static struct notifier_block bnx2fc_cpu_notifier = {
-       .notifier_call = bnx2fc_cpu_callback,
-};
-
 static inline struct net_device *bnx2fc_netdev(const struct fc_lport *lport)
 {
        return ((struct bnx2fc_interface *)
@@ -2622,37 +2615,19 @@ static void bnx2fc_percpu_thread_destroy(unsigned int cpu)
                kthread_stop(thread);
 }
 
-/**
- * bnx2fc_cpu_callback - Handler for CPU hotplug events
- *
- * @nfb:    The callback data block
- * @action: The event triggering the callback
- * @hcpu:   The index of the CPU that the event is for
- *
- * This creates or destroys per-CPU data for fcoe
- *
- * Returns NOTIFY_OK always.
- */
-static int bnx2fc_cpu_callback(struct notifier_block *nfb,
-                            unsigned long action, void *hcpu)
+
+static int bnx2fc_cpu_online(unsigned int cpu)
 {
-       unsigned cpu = (unsigned long)hcpu;
+       printk(PFX "CPU %x online: Create Rx thread\n", cpu);
+       bnx2fc_percpu_thread_create(cpu);
+       return 0;
+}
 
-       switch (action) {
-       case CPU_ONLINE:
-       case CPU_ONLINE_FROZEN:
-               printk(PFX "CPU %x online: Create Rx thread\n", cpu);
-               bnx2fc_percpu_thread_create(cpu);
-               break;
-       case CPU_DEAD:
-       case CPU_DEAD_FROZEN:
-               printk(PFX "CPU %x offline: Remove Rx thread\n", cpu);
-               bnx2fc_percpu_thread_destroy(cpu);
-               break;
-       default:
-               break;
-       }
-       return NOTIFY_OK;
+static int bnx2fc_cpu_dead(unsigned int cpu)
+{
+       printk(PFX "CPU %x offline: Remove Rx thread\n", cpu);
+       bnx2fc_percpu_thread_destroy(cpu);
+       return 0;
 }
 
 static int bnx2fc_slave_configure(struct scsi_device *sdev)
@@ -2664,6 +2639,8 @@ static int bnx2fc_slave_configure(struct scsi_device *sdev)
        return 0;
 }
 
+static enum cpuhp_state bnx2fc_online_state;
+
 /**
  * bnx2fc_mod_init - module init entry point
  *
@@ -2724,21 +2701,31 @@ static int __init bnx2fc_mod_init(void)
                spin_lock_init(&p->fp_work_lock);
        }
 
-       cpu_notifier_register_begin();
+       get_online_cpus();
 
-       for_each_online_cpu(cpu) {
+       for_each_online_cpu(cpu)
                bnx2fc_percpu_thread_create(cpu);
-       }
 
-       /* Initialize per CPU interrupt thread */
-       __register_hotcpu_notifier(&bnx2fc_cpu_notifier);
+       rc = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+                                      "scsi/bnx2fc:online",
+                                      bnx2fc_cpu_online, NULL);
+       if (rc < 0)
+               goto stop_threads;
+       bnx2fc_online_state = rc;
 
-       cpu_notifier_register_done();
+       cpuhp_setup_state_nocalls(CPUHP_SCSI_BNX2FC_DEAD, "scsi/bnx2fc:dead",
+                                 NULL, bnx2fc_cpu_dead);
+       put_online_cpus();
 
        cnic_register_driver(CNIC_ULP_FCOE, &bnx2fc_cnic_cb);
 
        return 0;
 
+stop_threads:
+       for_each_online_cpu(cpu)
+               bnx2fc_percpu_thread_destroy(cpu);
+       put_online_cpus();
+       kthread_stop(l2_thread);
 free_wq:
        destroy_workqueue(bnx2fc_wq);
 release_bt:
@@ -2797,16 +2784,16 @@ static void __exit bnx2fc_mod_exit(void)
        if (l2_thread)
                kthread_stop(l2_thread);
 
-       cpu_notifier_register_begin();
-
+       get_online_cpus();
        /* Destroy per cpu threads */
        for_each_online_cpu(cpu) {
                bnx2fc_percpu_thread_destroy(cpu);
        }
 
-       __unregister_hotcpu_notifier(&bnx2fc_cpu_notifier);
+       cpuhp_remove_state_nocalls(bnx2fc_online_state);
+       cpuhp_remove_state_nocalls(CPUHP_SCSI_BNX2FC_DEAD);
 
-       cpu_notifier_register_done();
+       put_online_cpus();
 
        destroy_workqueue(bnx2fc_wq);
        /*
index c8b410c24cf03215a588e41557b3eaf7faa46c13..86afc002814cd07bbc3b55b64ca31201208a514b 100644 (file)
@@ -70,14 +70,6 @@ u64 iscsi_error_mask = 0x00;
 
 DEFINE_PER_CPU(struct bnx2i_percpu_s, bnx2i_percpu);
 
-static int bnx2i_cpu_callback(struct notifier_block *nfb,
-                             unsigned long action, void *hcpu);
-/* notification function for CPU hotplug events */
-static struct notifier_block bnx2i_cpu_notifier = {
-       .notifier_call = bnx2i_cpu_callback,
-};
-
-
 /**
  * bnx2i_identify_device - identifies NetXtreme II device type
  * @hba:               Adapter structure pointer
@@ -461,41 +453,21 @@ static void bnx2i_percpu_thread_destroy(unsigned int cpu)
                kthread_stop(thread);
 }
 
-
-/**
- * bnx2i_cpu_callback - Handler for CPU hotplug events
- *
- * @nfb:       The callback data block
- * @action:    The event triggering the callback
- * @hcpu:      The index of the CPU that the event is for
- *
- * This creates or destroys per-CPU data for iSCSI
- *
- * Returns NOTIFY_OK always.
- */
-static int bnx2i_cpu_callback(struct notifier_block *nfb,
-                             unsigned long action, void *hcpu)
+static int bnx2i_cpu_online(unsigned int cpu)
 {
-       unsigned cpu = (unsigned long)hcpu;
+       pr_info("bnx2i: CPU %x online: Create Rx thread\n", cpu);
+       bnx2i_percpu_thread_create(cpu);
+       return 0;
+}
 
-       switch (action) {
-       case CPU_ONLINE:
-       case CPU_ONLINE_FROZEN:
-               printk(KERN_INFO "bnx2i: CPU %x online: Create Rx thread\n",
-                       cpu);
-               bnx2i_percpu_thread_create(cpu);
-               break;
-       case CPU_DEAD:
-       case CPU_DEAD_FROZEN:
-               printk(KERN_INFO "CPU %x offline: Remove Rx thread\n", cpu);
-               bnx2i_percpu_thread_destroy(cpu);
-               break;
-       default:
-               break;
-       }
-       return NOTIFY_OK;
+static int bnx2i_cpu_dead(unsigned int cpu)
+{
+       pr_info("CPU %x offline: Remove Rx thread\n", cpu);
+       bnx2i_percpu_thread_destroy(cpu);
+       return 0;
 }
 
+static enum cpuhp_state bnx2i_online_state;
 
 /**
  * bnx2i_mod_init - module init entry point
@@ -539,18 +511,28 @@ static int __init bnx2i_mod_init(void)
                p->iothread = NULL;
        }
 
-       cpu_notifier_register_begin();
+       get_online_cpus();
 
        for_each_online_cpu(cpu)
                bnx2i_percpu_thread_create(cpu);
 
-       /* Initialize per CPU interrupt thread */
-       __register_hotcpu_notifier(&bnx2i_cpu_notifier);
-
-       cpu_notifier_register_done();
+       err = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+                                      "scsi/bnx2i:online",
+                                      bnx2i_cpu_online, NULL);
+       if (err < 0)
+               goto remove_threads;
+       bnx2i_online_state = err;
 
+       cpuhp_setup_state_nocalls(CPUHP_SCSI_BNX2I_DEAD, "scsi/bnx2i:dead",
+                                 NULL, bnx2i_cpu_dead);
+       put_online_cpus();
        return 0;
 
+remove_threads:
+       for_each_online_cpu(cpu)
+               bnx2i_percpu_thread_destroy(cpu);
+       put_online_cpus();
+       cnic_unregister_driver(CNIC_ULP_ISCSI);
 unreg_xport:
        iscsi_unregister_transport(&bnx2i_iscsi_transport);
 out:
@@ -587,14 +569,14 @@ static void __exit bnx2i_mod_exit(void)
        }
        mutex_unlock(&bnx2i_dev_lock);
 
-       cpu_notifier_register_begin();
+       get_online_cpus();
 
        for_each_online_cpu(cpu)
                bnx2i_percpu_thread_destroy(cpu);
 
-       __unregister_hotcpu_notifier(&bnx2i_cpu_notifier);
-
-       cpu_notifier_register_done();
+       cpuhp_remove_state_nocalls(bnx2i_online_state);
+       cpuhp_remove_state_nocalls(CPUHP_SCSI_BNX2I_DEAD);
+       put_online_cpus();
 
        iscsi_unregister_transport(&bnx2i_iscsi_transport);
        cnic_unregister_driver(CNIC_ULP_ISCSI);
index 9e6f647ff1c16828f48d5abed6ce248155106977..9a2fdc305cf2a9a0c7b4f4fabae4191bb9f12ad1 100644 (file)
@@ -189,7 +189,6 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
                                struct l2t_entry *e)
 {
        struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk->cdev);
-       int t4 = is_t4(lldi->adapter_type);
        int wscale = cxgbi_sock_compute_wscale(csk->mss_idx);
        unsigned long long opt0;
        unsigned int opt2;
@@ -232,7 +231,7 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
                        csk, &req->local_ip, ntohs(req->local_port),
                        &req->peer_ip, ntohs(req->peer_port),
                        csk->atid, csk->rss_qid);
-       } else {
+       } else if (is_t5(lldi->adapter_type)) {
                struct cpl_t5_act_open_req *req =
                                (struct cpl_t5_act_open_req *)skb->head;
                u32 isn = (prandom_u32() & ~7UL) - 1;
@@ -260,12 +259,45 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
                        csk, &req->local_ip, ntohs(req->local_port),
                        &req->peer_ip, ntohs(req->peer_port),
                        csk->atid, csk->rss_qid);
+       } else {
+               struct cpl_t6_act_open_req *req =
+                               (struct cpl_t6_act_open_req *)skb->head;
+               u32 isn = (prandom_u32() & ~7UL) - 1;
+
+               INIT_TP_WR(req, 0);
+               OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
+                                                           qid_atid));
+               req->local_port = csk->saddr.sin_port;
+               req->peer_port = csk->daddr.sin_port;
+               req->local_ip = csk->saddr.sin_addr.s_addr;
+               req->peer_ip = csk->daddr.sin_addr.s_addr;
+               req->opt0 = cpu_to_be64(opt0);
+               req->params = cpu_to_be64(FILTER_TUPLE_V(
+                               cxgb4_select_ntuple(
+                                       csk->cdev->ports[csk->port_id],
+                                       csk->l2t)));
+               req->rsvd = cpu_to_be32(isn);
+
+               opt2 |= T5_ISS_VALID;
+               opt2 |= RX_FC_DISABLE_F;
+               opt2 |= T5_OPT_2_VALID_F;
+
+               req->opt2 = cpu_to_be32(opt2);
+               req->rsvd2 = cpu_to_be32(0);
+               req->opt3 = cpu_to_be32(0);
+
+               log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
+                         "csk t6 0x%p, %pI4:%u-%pI4:%u, atid %d, qid %u.\n",
+                         csk, &req->local_ip, ntohs(req->local_port),
+                         &req->peer_ip, ntohs(req->peer_port),
+                         csk->atid, csk->rss_qid);
        }
 
        set_wr_txq(skb, CPL_PRIORITY_SETUP, csk->port_id);
 
        pr_info_ipaddr("t%d csk 0x%p,%u,0x%lx,%u, rss_qid %u.\n",
-                      (&csk->saddr), (&csk->daddr), t4 ? 4 : 5, csk,
+                      (&csk->saddr), (&csk->daddr),
+                      CHELSIO_CHIP_VERSION(lldi->adapter_type), csk,
                       csk->state, csk->flags, csk->atid, csk->rss_qid);
 
        cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t);
@@ -276,7 +308,6 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
                               struct l2t_entry *e)
 {
        struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk->cdev);
-       int t4 = is_t4(lldi->adapter_type);
        int wscale = cxgbi_sock_compute_wscale(csk->mss_idx);
        unsigned long long opt0;
        unsigned int opt2;
@@ -294,10 +325,9 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
 
        opt2 = RX_CHANNEL_V(0) |
                RSS_QUEUE_VALID_F |
-               RX_FC_DISABLE_F |
                RSS_QUEUE_V(csk->rss_qid);
 
-       if (t4) {
+       if (is_t4(lldi->adapter_type)) {
                struct cpl_act_open_req6 *req =
                            (struct cpl_act_open_req6 *)skb->head;
 
@@ -322,7 +352,7 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
                req->params = cpu_to_be32(cxgb4_select_ntuple(
                                          csk->cdev->ports[csk->port_id],
                                          csk->l2t));
-       } else {
+       } else if (is_t5(lldi->adapter_type)) {
                struct cpl_t5_act_open_req6 *req =
                                (struct cpl_t5_act_open_req6 *)skb->head;
 
@@ -345,12 +375,41 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
                req->params = cpu_to_be64(FILTER_TUPLE_V(cxgb4_select_ntuple(
                                          csk->cdev->ports[csk->port_id],
                                          csk->l2t)));
+       } else {
+               struct cpl_t6_act_open_req6 *req =
+                               (struct cpl_t6_act_open_req6 *)skb->head;
+
+               INIT_TP_WR(req, 0);
+               OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ6,
+                                                           qid_atid));
+               req->local_port = csk->saddr6.sin6_port;
+               req->peer_port = csk->daddr6.sin6_port;
+               req->local_ip_hi = *(__be64 *)(csk->saddr6.sin6_addr.s6_addr);
+               req->local_ip_lo = *(__be64 *)(csk->saddr6.sin6_addr.s6_addr +
+                                                                       8);
+               req->peer_ip_hi = *(__be64 *)(csk->daddr6.sin6_addr.s6_addr);
+               req->peer_ip_lo = *(__be64 *)(csk->daddr6.sin6_addr.s6_addr +
+                                                                       8);
+               req->opt0 = cpu_to_be64(opt0);
+
+               opt2 |= RX_FC_DISABLE_F;
+               opt2 |= T5_OPT_2_VALID_F;
+
+               req->opt2 = cpu_to_be32(opt2);
+
+               req->params = cpu_to_be64(FILTER_TUPLE_V(cxgb4_select_ntuple(
+                                         csk->cdev->ports[csk->port_id],
+                                         csk->l2t)));
+
+               req->rsvd2 = cpu_to_be32(0);
+               req->opt3 = cpu_to_be32(0);
        }
 
        set_wr_txq(skb, CPL_PRIORITY_SETUP, csk->port_id);
 
        pr_info("t%d csk 0x%p,%u,0x%lx,%u, [%pI6]:%u-[%pI6]:%u, rss_qid %u.\n",
-               t4 ? 4 : 5, csk, csk->state, csk->flags, csk->atid,
+               CHELSIO_CHIP_VERSION(lldi->adapter_type), csk, csk->state,
+               csk->flags, csk->atid,
                &csk->saddr6.sin6_addr, ntohs(csk->saddr.sin_port),
                &csk->daddr6.sin6_addr, ntohs(csk->daddr.sin_port),
                csk->rss_qid);
@@ -742,7 +801,7 @@ static void do_act_establish(struct cxgbi_device *cdev, struct sk_buff *skb)
                       (&csk->saddr), (&csk->daddr),
                       atid, tid, csk, csk->state, csk->flags, rcv_isn);
 
-       module_put(THIS_MODULE);
+       module_put(cdev->owner);
 
        cxgbi_sock_get(csk);
        csk->tid = tid;
@@ -891,7 +950,7 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb)
        if (is_neg_adv(status))
                goto rel_skb;
 
-       module_put(THIS_MODULE);
+       module_put(cdev->owner);
 
        if (status && status != CPL_ERR_TCAM_FULL &&
            status != CPL_ERR_CONN_EXIST &&
@@ -1173,6 +1232,101 @@ rel_skb:
        __kfree_skb(skb);
 }
 
+static void do_rx_iscsi_data(struct cxgbi_device *cdev, struct sk_buff *skb)
+{
+       struct cxgbi_sock *csk;
+       struct cpl_iscsi_hdr *cpl = (struct cpl_iscsi_hdr *)skb->data;
+       struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
+       struct tid_info *t = lldi->tids;
+       struct sk_buff *lskb;
+       u32 tid = GET_TID(cpl);
+       u16 pdu_len_ddp = be16_to_cpu(cpl->pdu_len_ddp);
+
+       csk = lookup_tid(t, tid);
+       if (unlikely(!csk)) {
+               pr_err("can't find conn. for tid %u.\n", tid);
+               goto rel_skb;
+       }
+
+       log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_PDU_RX,
+                 "csk 0x%p,%u,0x%lx, tid %u, skb 0x%p,%u, 0x%x.\n",
+                 csk, csk->state, csk->flags, csk->tid, skb,
+                 skb->len, pdu_len_ddp);
+
+       spin_lock_bh(&csk->lock);
+
+       if (unlikely(csk->state >= CTP_PASSIVE_CLOSE)) {
+               log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
+                         "csk 0x%p,%u,0x%lx,%u, bad state.\n",
+                         csk, csk->state, csk->flags, csk->tid);
+
+               if (csk->state != CTP_ABORTING)
+                       goto abort_conn;
+               else
+                       goto discard;
+       }
+
+       cxgbi_skcb_tcp_seq(skb) = be32_to_cpu(cpl->seq);
+       cxgbi_skcb_flags(skb) = 0;
+
+       skb_reset_transport_header(skb);
+       __skb_pull(skb, sizeof(*cpl));
+       __pskb_trim(skb, ntohs(cpl->len));
+
+       if (!csk->skb_ulp_lhdr)
+               csk->skb_ulp_lhdr = skb;
+
+       lskb = csk->skb_ulp_lhdr;
+       cxgbi_skcb_set_flag(lskb, SKCBF_RX_DATA);
+
+       log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_PDU_RX,
+                 "csk 0x%p,%u,0x%lx, skb 0x%p data, 0x%p.\n",
+                 csk, csk->state, csk->flags, skb, lskb);
+
+       __skb_queue_tail(&csk->receive_queue, skb);
+       spin_unlock_bh(&csk->lock);
+       return;
+
+abort_conn:
+       send_abort_req(csk);
+discard:
+       spin_unlock_bh(&csk->lock);
+rel_skb:
+       __kfree_skb(skb);
+}
+
+static void
+cxgb4i_process_ddpvld(struct cxgbi_sock *csk,
+                     struct sk_buff *skb, u32 ddpvld)
+{
+       if (ddpvld & (1 << CPL_RX_DDP_STATUS_HCRC_SHIFT)) {
+               pr_info("csk 0x%p, lhdr 0x%p, status 0x%x, hcrc bad 0x%lx.\n",
+                       csk, skb, ddpvld, cxgbi_skcb_flags(skb));
+               cxgbi_skcb_set_flag(skb, SKCBF_RX_HCRC_ERR);
+       }
+
+       if (ddpvld & (1 << CPL_RX_DDP_STATUS_DCRC_SHIFT)) {
+               pr_info("csk 0x%p, lhdr 0x%p, status 0x%x, dcrc bad 0x%lx.\n",
+                       csk, skb, ddpvld, cxgbi_skcb_flags(skb));
+               cxgbi_skcb_set_flag(skb, SKCBF_RX_DCRC_ERR);
+       }
+
+       if (ddpvld & (1 << CPL_RX_DDP_STATUS_PAD_SHIFT)) {
+               log_debug(1 << CXGBI_DBG_PDU_RX,
+                         "csk 0x%p, lhdr 0x%p, status 0x%x, pad bad.\n",
+                         csk, skb, ddpvld);
+               cxgbi_skcb_set_flag(skb, SKCBF_RX_PAD_ERR);
+       }
+
+       if ((ddpvld & (1 << CPL_RX_DDP_STATUS_DDP_SHIFT)) &&
+           !cxgbi_skcb_test_flag(skb, SKCBF_RX_DATA)) {
+               log_debug(1 << CXGBI_DBG_PDU_RX,
+                         "csk 0x%p, lhdr 0x%p, 0x%x, data ddp'ed.\n",
+                         csk, skb, ddpvld);
+               cxgbi_skcb_set_flag(skb, SKCBF_RX_DATA_DDPD);
+       }
+}
+
 static void do_rx_data_ddp(struct cxgbi_device *cdev,
                                  struct sk_buff *skb)
 {
@@ -1182,7 +1336,7 @@ static void do_rx_data_ddp(struct cxgbi_device *cdev,
        unsigned int tid = GET_TID(rpl);
        struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
        struct tid_info *t = lldi->tids;
-       unsigned int status = ntohl(rpl->ddpvld);
+       u32 ddpvld = be32_to_cpu(rpl->ddpvld);
 
        csk = lookup_tid(t, tid);
        if (unlikely(!csk)) {
@@ -1192,7 +1346,7 @@ static void do_rx_data_ddp(struct cxgbi_device *cdev,
 
        log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_PDU_RX,
                "csk 0x%p,%u,0x%lx, skb 0x%p,0x%x, lhdr 0x%p.\n",
-               csk, csk->state, csk->flags, skb, status, csk->skb_ulp_lhdr);
+               csk, csk->state, csk->flags, skb, ddpvld, csk->skb_ulp_lhdr);
 
        spin_lock_bh(&csk->lock);
 
@@ -1220,29 +1374,8 @@ static void do_rx_data_ddp(struct cxgbi_device *cdev,
                pr_info("tid 0x%x, RX_DATA_DDP pdulen %u != %u.\n",
                        csk->tid, ntohs(rpl->len), cxgbi_skcb_rx_pdulen(lskb));
 
-       if (status & (1 << CPL_RX_DDP_STATUS_HCRC_SHIFT)) {
-               pr_info("csk 0x%p, lhdr 0x%p, status 0x%x, hcrc bad 0x%lx.\n",
-                       csk, lskb, status, cxgbi_skcb_flags(lskb));
-               cxgbi_skcb_set_flag(lskb, SKCBF_RX_HCRC_ERR);
-       }
-       if (status & (1 << CPL_RX_DDP_STATUS_DCRC_SHIFT)) {
-               pr_info("csk 0x%p, lhdr 0x%p, status 0x%x, dcrc bad 0x%lx.\n",
-                       csk, lskb, status, cxgbi_skcb_flags(lskb));
-               cxgbi_skcb_set_flag(lskb, SKCBF_RX_DCRC_ERR);
-       }
-       if (status & (1 << CPL_RX_DDP_STATUS_PAD_SHIFT)) {
-               log_debug(1 << CXGBI_DBG_PDU_RX,
-                       "csk 0x%p, lhdr 0x%p, status 0x%x, pad bad.\n",
-                       csk, lskb, status);
-               cxgbi_skcb_set_flag(lskb, SKCBF_RX_PAD_ERR);
-       }
-       if ((status & (1 << CPL_RX_DDP_STATUS_DDP_SHIFT)) &&
-               !cxgbi_skcb_test_flag(lskb, SKCBF_RX_DATA)) {
-               log_debug(1 << CXGBI_DBG_PDU_RX,
-                       "csk 0x%p, lhdr 0x%p, 0x%x, data ddp'ed.\n",
-                       csk, lskb, status);
-               cxgbi_skcb_set_flag(lskb, SKCBF_RX_DATA_DDPD);
-       }
+       cxgb4i_process_ddpvld(csk, lskb, ddpvld);
+
        log_debug(1 << CXGBI_DBG_PDU_RX,
                "csk 0x%p, lskb 0x%p, f 0x%lx.\n",
                csk, lskb, cxgbi_skcb_flags(lskb));
@@ -1260,6 +1393,98 @@ rel_skb:
        __kfree_skb(skb);
 }
 
+static void
+do_rx_iscsi_cmp(struct cxgbi_device *cdev, struct sk_buff *skb)
+{
+       struct cxgbi_sock *csk;
+       struct cpl_rx_iscsi_cmp *rpl = (struct cpl_rx_iscsi_cmp *)skb->data;
+       struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
+       struct tid_info *t = lldi->tids;
+       struct sk_buff *data_skb = NULL;
+       u32 tid = GET_TID(rpl);
+       u32 ddpvld = be32_to_cpu(rpl->ddpvld);
+       u32 seq = be32_to_cpu(rpl->seq);
+       u16 pdu_len_ddp = be16_to_cpu(rpl->pdu_len_ddp);
+
+       csk = lookup_tid(t, tid);
+       if (unlikely(!csk)) {
+               pr_err("can't find connection for tid %u.\n", tid);
+               goto rel_skb;
+       }
+
+       log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_PDU_RX,
+                 "csk 0x%p,%u,0x%lx, skb 0x%p,0x%x, lhdr 0x%p, len %u, "
+                 "pdu_len_ddp %u, status %u.\n",
+                 csk, csk->state, csk->flags, skb, ddpvld, csk->skb_ulp_lhdr,
+                 ntohs(rpl->len), pdu_len_ddp,  rpl->status);
+
+       spin_lock_bh(&csk->lock);
+
+       if (unlikely(csk->state >= CTP_PASSIVE_CLOSE)) {
+               log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
+                         "csk 0x%p,%u,0x%lx,%u, bad state.\n",
+                         csk, csk->state, csk->flags, csk->tid);
+
+               if (csk->state != CTP_ABORTING)
+                       goto abort_conn;
+               else
+                       goto discard;
+       }
+
+       cxgbi_skcb_tcp_seq(skb) = seq;
+       cxgbi_skcb_flags(skb) = 0;
+       cxgbi_skcb_rx_pdulen(skb) = 0;
+
+       skb_reset_transport_header(skb);
+       __skb_pull(skb, sizeof(*rpl));
+       __pskb_trim(skb, be16_to_cpu(rpl->len));
+
+       csk->rcv_nxt = seq + pdu_len_ddp;
+
+       if (csk->skb_ulp_lhdr) {
+               data_skb = skb_peek(&csk->receive_queue);
+               if (!data_skb ||
+                   !cxgbi_skcb_test_flag(data_skb, SKCBF_RX_DATA)) {
+                       pr_err("Error! freelist data not found 0x%p, tid %u\n",
+                              data_skb, tid);
+
+                       goto abort_conn;
+               }
+               __skb_unlink(data_skb, &csk->receive_queue);
+
+               cxgbi_skcb_set_flag(skb, SKCBF_RX_DATA);
+
+               __skb_queue_tail(&csk->receive_queue, skb);
+               __skb_queue_tail(&csk->receive_queue, data_skb);
+       } else {
+                __skb_queue_tail(&csk->receive_queue, skb);
+       }
+
+       csk->skb_ulp_lhdr = NULL;
+
+       cxgbi_skcb_set_flag(skb, SKCBF_RX_HDR);
+       cxgbi_skcb_set_flag(skb, SKCBF_RX_STATUS);
+       cxgbi_skcb_set_flag(skb, SKCBF_RX_ISCSI_COMPL);
+       cxgbi_skcb_rx_ddigest(skb) = be32_to_cpu(rpl->ulp_crc);
+
+       cxgb4i_process_ddpvld(csk, skb, ddpvld);
+
+       log_debug(1 << CXGBI_DBG_PDU_RX, "csk 0x%p, skb 0x%p, f 0x%lx.\n",
+                 csk, skb, cxgbi_skcb_flags(skb));
+
+       cxgbi_conn_pdu_ready(csk);
+       spin_unlock_bh(&csk->lock);
+
+       return;
+
+abort_conn:
+       send_abort_req(csk);
+discard:
+       spin_unlock_bh(&csk->lock);
+rel_skb:
+       __kfree_skb(skb);
+}
+
 static void do_fw4_ack(struct cxgbi_device *cdev, struct sk_buff *skb)
 {
        struct cxgbi_sock *csk;
@@ -1382,7 +1607,6 @@ static int init_act_open(struct cxgbi_sock *csk)
        void *daddr;
        unsigned int step;
        unsigned int size, size6;
-       int t4 = is_t4(lldi->adapter_type);
        unsigned int linkspeed;
        unsigned int rcv_winf, snd_winf;
 
@@ -1428,12 +1652,15 @@ static int init_act_open(struct cxgbi_sock *csk)
                cxgb4_clip_get(ndev, (const u32 *)&csk->saddr6.sin6_addr, 1);
 #endif
 
-       if (t4) {
+       if (is_t4(lldi->adapter_type)) {
                size = sizeof(struct cpl_act_open_req);
                size6 = sizeof(struct cpl_act_open_req6);
-       } else {
+       } else if (is_t5(lldi->adapter_type)) {
                size = sizeof(struct cpl_t5_act_open_req);
                size6 = sizeof(struct cpl_t5_act_open_req6);
+       } else {
+               size = sizeof(struct cpl_t6_act_open_req);
+               size6 = sizeof(struct cpl_t6_act_open_req6);
        }
 
        if (csk->csk_family == AF_INET)
@@ -1452,8 +1679,8 @@ static int init_act_open(struct cxgbi_sock *csk)
                csk->mtu = dst_mtu(csk->dst);
        cxgb4_best_mtu(lldi->mtus, csk->mtu, &csk->mss_idx);
        csk->tx_chan = cxgb4_port_chan(ndev);
-       /* SMT two entries per row */
-       csk->smac_idx = ((cxgb4_port_viid(ndev) & 0x7F)) << 1;
+       csk->smac_idx = cxgb4_tp_smt_idx(lldi->adapter_type,
+                                        cxgb4_port_viid(ndev));
        step = lldi->ntxq / lldi->nchan;
        csk->txq_idx = cxgb4_port_idx(ndev) * step;
        step = lldi->nrxq / lldi->nchan;
@@ -1486,7 +1713,11 @@ static int init_act_open(struct cxgbi_sock *csk)
                       csk->mtu, csk->mss_idx, csk->smac_idx);
 
        /* must wait for either a act_open_rpl or act_open_establish */
-       try_module_get(THIS_MODULE);
+       if (!try_module_get(cdev->owner)) {
+               pr_err("%s, try_module_get failed.\n", ndev->name);
+               goto rel_resource;
+       }
+
        cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN);
        if (csk->csk_family == AF_INET)
                send_act_open_req(csk, skb, csk->l2t);
@@ -1521,10 +1752,11 @@ static cxgb4i_cplhandler_func cxgb4i_cplhandlers[NUM_CPL_CMDS] = {
        [CPL_CLOSE_CON_RPL] = do_close_con_rpl,
        [CPL_FW4_ACK] = do_fw4_ack,
        [CPL_ISCSI_HDR] = do_rx_iscsi_hdr,
-       [CPL_ISCSI_DATA] = do_rx_iscsi_hdr,
+       [CPL_ISCSI_DATA] = do_rx_iscsi_data,
        [CPL_SET_TCB_RPL] = do_set_tcb_rpl,
        [CPL_RX_DATA_DDP] = do_rx_data_ddp,
        [CPL_RX_ISCSI_DDP] = do_rx_data_ddp,
+       [CPL_RX_ISCSI_CMP] = do_rx_iscsi_cmp,
        [CPL_RX_DATA] = do_rx_data,
 };
 
@@ -1794,10 +2026,12 @@ static void *t4_uld_add(const struct cxgb4_lld_info *lldi)
        cdev->nports = lldi->nports;
        cdev->mtus = lldi->mtus;
        cdev->nmtus = NMTUS;
-       cdev->rx_credit_thres = cxgb4i_rx_credit_thres;
+       cdev->rx_credit_thres = (CHELSIO_CHIP_VERSION(lldi->adapter_type) <=
+                                CHELSIO_T5) ? cxgb4i_rx_credit_thres : 0;
        cdev->skb_tx_rsvd = CXGB4I_TX_HEADER_LEN;
        cdev->skb_rx_extra = sizeof(struct cpl_iscsi_hdr);
        cdev->itp = &cxgb4i_iscsi_transport;
+       cdev->owner = THIS_MODULE;
 
        cdev->pfvf = FW_VIID_PFN_G(cxgb4_port_viid(lldi->ports[0]))
                        << FW_VIID_PFN_S;
index 2ffe029ff2b6ff29fbaaada58d277d89d2643f31..9167bcd9fffe9b3a5fea9005671239a96551aace 100644 (file)
@@ -642,6 +642,12 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
                        n->dev->name, ndev->name, mtu);
        }
 
+       if (!(ndev->flags & IFF_UP) || !netif_carrier_ok(ndev)) {
+               pr_info("%s interface not up.\n", ndev->name);
+               err = -ENETDOWN;
+               goto rel_neigh;
+       }
+
        cdev = cxgbi_device_find_by_netdev(ndev, &port);
        if (!cdev) {
                pr_info("dst %pI4, %s, NOT cxgbi device.\n",
@@ -736,6 +742,12 @@ static struct cxgbi_sock *cxgbi_check_route6(struct sockaddr *dst_addr)
        }
        ndev = n->dev;
 
+       if (!(ndev->flags & IFF_UP) || !netif_carrier_ok(ndev)) {
+               pr_info("%s interface not up.\n", ndev->name);
+               err = -ENETDOWN;
+               goto rel_rt;
+       }
+
        if (ipv6_addr_is_multicast(&daddr6->sin6_addr)) {
                pr_info("multi-cast route %pI6 port %u, dev %s.\n",
                        daddr6->sin6_addr.s6_addr,
@@ -896,6 +908,7 @@ EXPORT_SYMBOL_GPL(cxgbi_sock_fail_act_open);
 void cxgbi_sock_act_open_req_arp_failure(void *handle, struct sk_buff *skb)
 {
        struct cxgbi_sock *csk = (struct cxgbi_sock *)skb->sk;
+       struct module *owner = csk->cdev->owner;
 
        log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p,%u,0x%lx,%u.\n",
                csk, (csk)->state, (csk)->flags, (csk)->tid);
@@ -906,6 +919,8 @@ void cxgbi_sock_act_open_req_arp_failure(void *handle, struct sk_buff *skb)
        spin_unlock_bh(&csk->lock);
        cxgbi_sock_put(csk);
        __kfree_skb(skb);
+
+       module_put(owner);
 }
 EXPORT_SYMBOL_GPL(cxgbi_sock_act_open_req_arp_failure);
 
@@ -1574,6 +1589,25 @@ static int skb_read_pdu_bhs(struct iscsi_conn *conn, struct sk_buff *skb)
                return -EIO;
        }
 
+       if (cxgbi_skcb_test_flag(skb, SKCBF_RX_ISCSI_COMPL) &&
+           cxgbi_skcb_test_flag(skb, SKCBF_RX_DATA_DDPD)) {
+               /* If completion flag is set and data is directly
+                * placed in to the host memory then update
+                * task->exp_datasn to the datasn in completion
+                * iSCSI hdr as T6 adapter generates completion only
+                * for the last pdu of a sequence.
+                */
+               itt_t itt = ((struct iscsi_data *)skb->data)->itt;
+               struct iscsi_task *task = iscsi_itt_to_ctask(conn, itt);
+               u32 data_sn = be32_to_cpu(((struct iscsi_data *)
+                                                       skb->data)->datasn);
+               if (task && task->sc) {
+                       struct iscsi_tcp_task *tcp_task = task->dd_data;
+
+                       tcp_task->exp_datasn = data_sn;
+               }
+       }
+
        return read_pdu_skb(conn, skb, 0, 0);
 }
 
@@ -1627,15 +1661,15 @@ static void csk_return_rx_credits(struct cxgbi_sock *csk, int copied)
                csk->rcv_wup, cdev->rx_credit_thres,
                csk->rcv_win);
 
+       if (!cdev->rx_credit_thres)
+               return;
+
        if (csk->state != CTP_ESTABLISHED)
                return;
 
        credits = csk->copied_seq - csk->rcv_wup;
        if (unlikely(!credits))
                return;
-       if (unlikely(cdev->rx_credit_thres == 0))
-               return;
-
        must_send = credits + 16384 >= csk->rcv_win;
        if (must_send || credits >= cdev->rx_credit_thres)
                csk->rcv_wup += cdev->csk_send_rx_credits(csk, credits);
index e7802738f5d28e0b7e7fe4e3f6bf8075197b838f..95ba99044c3e9c2af6f0a8deb656b878c15cf656 100644 (file)
@@ -207,6 +207,7 @@ enum cxgbi_skcb_flags {
        SKCBF_RX_HDR,           /* received pdu header */
        SKCBF_RX_DATA,          /* received pdu payload */
        SKCBF_RX_STATUS,        /* received ddp status */
+       SKCBF_RX_ISCSI_COMPL,   /* received iscsi completion */
        SKCBF_RX_DATA_DDPD,     /* pdu payload ddp'd */
        SKCBF_RX_HCRC_ERR,      /* header digest error */
        SKCBF_RX_DCRC_ERR,      /* data digest error */
@@ -467,6 +468,7 @@ struct cxgbi_device {
        struct pci_dev *pdev;
        struct dentry *debugfs_root;
        struct iscsi_transport *itp;
+       struct module *owner;
 
        unsigned int pfvf;
        unsigned int rx_credit_thres;
index 27c0dce22e72a1188dcec434a12bee7d0a72ff33..5f75e638ec95af5476f15780bf4fa6f7ea12a0b7 100644 (file)
@@ -37,7 +37,7 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
 ////////////////////////////////////////////////////////////////
 
 #include <linux/ioctl.h>       /* For SCSI-Passthrough */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/stat.h>
 #include <linux/slab.h>                /* for kmalloc() */
index de5147a8c959aaa7cc070d55a9040e9f1ead37fd..6f9665d50d84bb485d3ba9cf99da05bae0f1c018 100644 (file)
@@ -37,7 +37,7 @@
 #define MAX_CARDS 8
 
 /* old-style parameters for compatibility */
-static int ncr_irq;
+static int ncr_irq = -1;
 static int ncr_addr;
 static int ncr_5380;
 static int ncr_53c400;
@@ -52,9 +52,9 @@ module_param(ncr_53c400a, int, 0);
 module_param(dtc_3181e, int, 0);
 module_param(hp_c2502, int, 0);
 
-static int irq[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+static int irq[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
 module_param_array(irq, int, NULL, 0);
-MODULE_PARM_DESC(irq, "IRQ number(s)");
+MODULE_PARM_DESC(irq, "IRQ number(s) (0=none, 254=auto [default])");
 
 static int base[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
 module_param_array(base, int, NULL, 0);
@@ -67,6 +67,56 @@ MODULE_PARM_DESC(card, "card type (0=NCR5380, 1=NCR53C400, 2=NCR53C400A, 3=DTC31
 MODULE_ALIAS("g_NCR5380_mmio");
 MODULE_LICENSE("GPL");
 
+static void g_NCR5380_trigger_irq(struct Scsi_Host *instance)
+{
+       struct NCR5380_hostdata *hostdata = shost_priv(instance);
+
+       /*
+        * An interrupt is triggered whenever BSY = false, SEL = true
+        * and a bit set in the SELECT_ENABLE_REG is asserted on the
+        * SCSI bus.
+        *
+        * Note that the bus is only driven when the phase control signals
+        * (I/O, C/D, and MSG) match those in the TCR.
+        */
+       NCR5380_write(TARGET_COMMAND_REG,
+                     PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG) & PHASE_MASK));
+       NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
+       NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
+       NCR5380_write(INITIATOR_COMMAND_REG,
+                     ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL);
+
+       msleep(1);
+
+       NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+       NCR5380_write(SELECT_ENABLE_REG, 0);
+       NCR5380_write(TARGET_COMMAND_REG, 0);
+}
+
+/**
+ * g_NCR5380_probe_irq - find the IRQ of a NCR5380 or equivalent
+ * @instance: SCSI host instance
+ *
+ * Autoprobe for the IRQ line used by the card by triggering an IRQ
+ * and then looking to see what interrupt actually turned up.
+ */
+
+static int g_NCR5380_probe_irq(struct Scsi_Host *instance)
+{
+       struct NCR5380_hostdata *hostdata = shost_priv(instance);
+       int irq_mask, irq;
+
+       NCR5380_read(RESET_PARITY_INTERRUPT_REG);
+       irq_mask = probe_irq_on();
+       g_NCR5380_trigger_irq(instance);
+       irq = probe_irq_off(irq_mask);
+       NCR5380_read(RESET_PARITY_INTERRUPT_REG);
+
+       if (irq <= 0)
+               return NO_IRQ;
+       return irq;
+}
+
 /*
  * Configure I/O address of 53C400A or DTC436 by writing magic numbers
  * to ports 0x779 and 0x379.
@@ -81,14 +131,33 @@ static void magic_configure(int idx, u8 irq, u8 magic[])
        outb(magic[3], 0x379);
        outb(magic[4], 0x379);
 
-       /* allowed IRQs for HP C2502 */
-       if (irq != 2 && irq != 3 && irq != 4 && irq != 5 && irq != 7)
-               irq = 0;
+       if (irq == 9)
+               irq = 2;
+
        if (idx >= 0 && idx <= 7)
                cfg = 0x80 | idx | (irq << 4);
        outb(cfg, 0x379);
 }
 
+static irqreturn_t legacy_empty_irq_handler(int irq, void *dev_id)
+{
+       return IRQ_HANDLED;
+}
+
+static int legacy_find_free_irq(int *irq_table)
+{
+       while (*irq_table != -1) {
+               if (!request_irq(*irq_table, legacy_empty_irq_handler,
+                                IRQF_PROBE_SHARED, "Test IRQ",
+                                (void *)irq_table)) {
+                       free_irq(*irq_table, (void *) irq_table);
+                       return *irq_table;
+               }
+               irq_table++;
+       }
+       return -1;
+}
+
 static unsigned int ncr_53c400a_ports[] = {
        0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
 };
@@ -101,6 +170,9 @@ static u8 ncr_53c400a_magic[] = {   /* 53C400A & DTC436 */
 static u8 hp_c2502_magic[] = { /* HP C2502 */
        0x0f, 0x22, 0xf0, 0x20, 0x80
 };
+static int hp_c2502_irqs[] = {
+       9, 5, 7, 3, 4, -1
+};
 
 static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
                        struct device *pdev, int base, int irq, int board)
@@ -248,6 +320,13 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
                }
        }
 
+       /* Check for vacant slot */
+       NCR5380_write(MODE_REG, 0);
+       if (NCR5380_read(MODE_REG) != 0) {
+               ret = -ENODEV;
+               goto out_unregister;
+       }
+
        ret = NCR5380_init(instance, flags | FLAG_LATE_DMA_SETUP);
        if (ret)
                goto out_unregister;
@@ -262,31 +341,59 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
 
        NCR5380_maybe_reset_bus(instance);
 
-       if (irq != IRQ_AUTO)
-               instance->irq = irq;
-       else
-               instance->irq = NCR5380_probe_irq(instance, 0xffff);
-
        /* Compatibility with documented NCR5380 kernel parameters */
-       if (instance->irq == 255)
-               instance->irq = NO_IRQ;
+       if (irq == 255 || irq == 0)
+               irq = NO_IRQ;
+       else if (irq == -1)
+               irq = IRQ_AUTO;
+
+       if (board == BOARD_HP_C2502) {
+               int *irq_table = hp_c2502_irqs;
+               int board_irq = -1;
+
+               switch (irq) {
+               case NO_IRQ:
+                       board_irq = 0;
+                       break;
+               case IRQ_AUTO:
+                       board_irq = legacy_find_free_irq(irq_table);
+                       break;
+               default:
+                       while (*irq_table != -1)
+                               if (*irq_table++ == irq)
+                                       board_irq = irq;
+               }
+
+               if (board_irq <= 0) {
+                       board_irq = 0;
+                       irq = NO_IRQ;
+               }
+
+               magic_configure(port_idx, board_irq, magic);
+       }
+
+       if (irq == IRQ_AUTO) {
+               instance->irq = g_NCR5380_probe_irq(instance);
+               if (instance->irq == NO_IRQ)
+                       shost_printk(KERN_INFO, instance, "no irq detected\n");
+       } else {
+               instance->irq = irq;
+               if (instance->irq == NO_IRQ)
+                       shost_printk(KERN_INFO, instance, "no irq provided\n");
+       }
 
        if (instance->irq != NO_IRQ) {
-               /* set IRQ for HP C2502 */
-               if (board == BOARD_HP_C2502)
-                       magic_configure(port_idx, instance->irq, magic);
                if (request_irq(instance->irq, generic_NCR5380_intr,
                                0, "NCR5380", instance)) {
-                       printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
                        instance->irq = NO_IRQ;
+                       shost_printk(KERN_INFO, instance,
+                                    "irq %d denied\n", instance->irq);
+               } else {
+                       shost_printk(KERN_INFO, instance,
+                                    "irq %d acquired\n", instance->irq);
                }
        }
 
-       if (instance->irq == NO_IRQ) {
-               printk(KERN_INFO "scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no);
-               printk(KERN_INFO "scsi%d : please jumper the board for a free IRQ.\n", instance->host_no);
-       }
-
        ret = scsi_add_host(instance, pdev);
        if (ret)
                goto out_free_irq;
@@ -597,7 +704,7 @@ static int __init generic_NCR5380_init(void)
        int ret = 0;
 
        /* compatibility with old-style parameters */
-       if (irq[0] == 0 && base[0] == 0 && card[0] == -1) {
+       if (irq[0] == -1 && base[0] == 0 && card[0] == -1) {
                irq[0] = ncr_irq;
                base[0] = ncr_addr;
                if (ncr_5380)
index 3ce5b65ccb00b618012ef0825390a6a098950cd6..81b22d989648b0107f6c0f3128cc25348a88e775 100644 (file)
@@ -51,4 +51,6 @@
 #define BOARD_DTC3181E 3
 #define BOARD_HP_C2502 4
 
+#define IRQ_AUTO       254
+
 #endif /* GENERIC_NCR5380_H */
index 0a767740bf02c15c2efdfbf04b3ae9f7f2c5527f..d020a13646ae648914ae65e2438e2d474d023662 100644 (file)
 
 #include <asm/dma.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/spinlock.h>
 #include <linux/blkdev.h>
 #include <linux/scatterlist.h>
index 691a0931695238cf07fcfc544dfe33740cb38a1c..cbc0c5fe5a60188515dab3dd99be83ce62732e1c 100644 (file)
@@ -1557,10 +1557,9 @@ static void hpsa_monitor_offline_device(struct ctlr_info *h,
 
        /* Device is not on the list, add it. */
        device = kmalloc(sizeof(*device), GFP_KERNEL);
-       if (!device) {
-               dev_warn(&h->pdev->dev, "out of memory in %s\n", __func__);
+       if (!device)
                return;
-       }
+
        memcpy(device->scsi3addr, scsi3addr, sizeof(device->scsi3addr));
        spin_lock_irqsave(&h->offline_device_lock, flags);
        list_add_tail(&device->offline_list, &h->offline_device_list);
@@ -2142,17 +2141,15 @@ static int hpsa_alloc_sg_chain_blocks(struct ctlr_info *h)
 
        h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds,
                                GFP_KERNEL);
-       if (!h->cmd_sg_list) {
-               dev_err(&h->pdev->dev, "Failed to allocate SG list\n");
+       if (!h->cmd_sg_list)
                return -ENOMEM;
-       }
+
        for (i = 0; i < h->nr_cmds; i++) {
                h->cmd_sg_list[i] = kmalloc(sizeof(*h->cmd_sg_list[i]) *
                                                h->chainsize, GFP_KERNEL);
-               if (!h->cmd_sg_list[i]) {
-                       dev_err(&h->pdev->dev, "Failed to allocate cmd SG\n");
+               if (!h->cmd_sg_list[i])
                        goto clean;
-               }
+
        }
        return 0;
 
@@ -3454,11 +3451,8 @@ static void hpsa_get_sas_address(struct ctlr_info *h, unsigned char *scsi3addr,
                struct bmic_sense_subsystem_info *ssi;
 
                ssi = kzalloc(sizeof(*ssi), GFP_KERNEL);
-               if (ssi == NULL) {
-                       dev_warn(&h->pdev->dev,
-                               "%s: out of memory\n", __func__);
+               if (!ssi)
                        return;
-               }
 
                rc = hpsa_bmic_sense_subsystem_information(h,
                                        scsi3addr, 0, ssi, sizeof(*ssi));
@@ -4335,8 +4329,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
 
                currentsd[i] = kzalloc(sizeof(*currentsd[i]), GFP_KERNEL);
                if (!currentsd[i]) {
-                       dev_warn(&h->pdev->dev, "out of memory at %s:%d\n",
-                               __FILE__, __LINE__);
                        h->drv_req_rescan = 1;
                        goto out;
                }
@@ -8597,14 +8589,12 @@ static int hpsa_luns_changed(struct ctlr_info *h)
         */
 
        if (!h->lastlogicals)
-               goto out;
+               return rc;
 
        logdev = kzalloc(sizeof(*logdev), GFP_KERNEL);
-       if (!logdev) {
-               dev_warn(&h->pdev->dev,
-                       "Out of memory, can't track lun changes.\n");
-               goto out;
-       }
+       if (!logdev)
+               return rc;
+
        if (hpsa_scsi_do_report_luns(h, 1, logdev, sizeof(*logdev), 0)) {
                dev_warn(&h->pdev->dev,
                        "report luns failed, can't track lun changes.\n");
@@ -8998,11 +8988,8 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
                return;
 
        options = kzalloc(sizeof(*options), GFP_KERNEL);
-       if (!options) {
-               dev_err(&h->pdev->dev,
-                       "Error: failed to disable rld caching, during alloc.\n");
+       if (!options)
                return;
-       }
 
        c = cmd_alloc(h);
 
index a83f705ed8a54172f21e8655e52c6c618edbcb9a..db17ad15b0c1580222031247eac8b25b41c9a0a8 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/timer.h>
 #include <linux/spinlock.h>
 #include <linux/gfp.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/div64.h>
 #include <scsi/scsi_cmnd.h>
index d9534ee6ef524fb1fab03680bdde2ed34a4202b7..50cd01165e355b092fb954d2399f42798d5e3e00 100644 (file)
@@ -95,6 +95,7 @@ static int fast_fail = 1;
 static int client_reserve = 1;
 static char partition_name[97] = "UNKNOWN";
 static unsigned int partition_number = -1;
+static LIST_HEAD(ibmvscsi_head);
 
 static struct scsi_transport_template *ibmvscsi_transport_template;
 
@@ -232,6 +233,7 @@ static void ibmvscsi_task(void *data)
                while ((crq = crq_queue_next_crq(&hostdata->queue)) != NULL) {
                        ibmvscsi_handle_crq(crq, hostdata);
                        crq->valid = VIOSRP_CRQ_FREE;
+                       wmb();
                }
 
                vio_enable_interrupts(vdev);
@@ -240,6 +242,7 @@ static void ibmvscsi_task(void *data)
                        vio_disable_interrupts(vdev);
                        ibmvscsi_handle_crq(crq, hostdata);
                        crq->valid = VIOSRP_CRQ_FREE;
+                       wmb();
                } else {
                        done = 1;
                }
@@ -992,7 +995,7 @@ static void handle_cmd_rsp(struct srp_event_struct *evt_struct)
        if (unlikely(rsp->opcode != SRP_RSP)) {
                if (printk_ratelimit())
                        dev_warn(evt_struct->hostdata->dev,
-                                "bad SRP RSP type %d\n", rsp->opcode);
+                                "bad SRP RSP type %#02x\n", rsp->opcode);
        }
        
        if (cmnd) {
@@ -2270,6 +2273,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
        }
 
        dev_set_drvdata(&vdev->dev, hostdata);
+       list_add_tail(&hostdata->host_list, &ibmvscsi_head);
        return 0;
 
       add_srp_port_failed:
@@ -2291,6 +2295,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
 static int ibmvscsi_remove(struct vio_dev *vdev)
 {
        struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev);
+       list_del(&hostdata->host_list);
        unmap_persist_bufs(hostdata);
        release_event_pool(&hostdata->pool, hostdata);
        ibmvscsi_release_crq_queue(&hostdata->queue, hostdata,
index e0f6c3aeb4eef35aa390afaa5d7cd6174d8f7a48..3a7875575616e3eec27443a0db7ef9882fcc2528 100644 (file)
@@ -90,6 +90,7 @@ struct event_pool {
 
 /* all driver data associated with a host adapter */
 struct ibmvscsi_host_data {
+       struct list_head host_list;
        atomic_t request_limit;
        int client_migrated;
        int reset_crq;
index 2583e8b50b21c2cfa6ec3d10e624adb8141d5c9d..3d3768aaab4f2bb79ccbaf40f1f569114e4f9b30 100644 (file)
@@ -1694,7 +1694,7 @@ static void srp_snd_msg_failed(struct scsi_info *vscsi, long rc)
                if (!vscsi->rsp_q_timer.started) {
                        if (vscsi->rsp_q_timer.timer_pops <
                            MAX_TIMER_POPS) {
-                               kt = ktime_set(0, WAIT_NANO_SECONDS);
+                               kt = WAIT_NANO_SECONDS;
                        } else {
                                /*
                                 * slide the timeslice if the maximum
index 45b9566b928e1895553d85c98056f9aa65793dc5..b782bb60baf0e8d49e64a34f518dd3fec5fcd6ed 100644 (file)
@@ -51,7 +51,7 @@
    #define _IPS_H_
 
 #include <linux/nmi.h>
-   #include <asm/uaccess.h>
+#include <linux/uaccess.h>
    #include <asm/io.h>
 
    /*
index 9d05302a3bcd503f1d21d1c453c68a64ace13024..3c63c292cb92d5bc92d297ca8bef61ec643d0140 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/mm.h>
 #include <linux/fs.h>
 #include <linux/blkdev.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/completion.h>
 #include <linux/delay.h>
index 55b425c0a65459a8f8f1a93b218278a6aa6633e7..a30e725f2d5c56d6e82cfa5761e9dc2f7bac3b13 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <linux/spinlock.h>
 #include <linux/fs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/pci.h>
index 6484c382f67089672482e06c9e1df9ab726f800c..d5cf15eb8c5e3e794803f95724e5f4a52a1ee9b2 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/delay.h>
 #include <linux/uio.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fs.h>
 #include <linux/compat.h>
 #include <linux/blkdev.h>
index 8de0eda8cd006ac9ec0192256c56aec182bd08b9..394fe1338d0976a42f183e328dfaed02f540560f 100644 (file)
@@ -402,6 +402,9 @@ struct MPT3SAS_DEVICE {
        u8      block;
        u8      tlr_snoop_check;
        u8      ignore_delay_remove;
+       /* Iopriority Command Handling */
+       u8      ncq_prio_enable;
+
 };
 
 #define MPT3_CMD_NOT_USED      0x8000  /* free */
@@ -1458,4 +1461,7 @@ mpt3sas_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
        struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request,
        u16 smid);
 
+/* NCQ Prio Handling Check */
+bool scsih_ncq_prio_supp(struct scsi_device *sdev);
+
 #endif /* MPT3SAS_BASE_H_INCLUDED */
index 050bd788ad029818de9151eaafb3584387755c36..95f0f24bac05598e1c8246cb1078de9163a66e5d 100644 (file)
@@ -3325,8 +3325,6 @@ static DEVICE_ATTR(diag_trigger_mpi, S_IRUGO | S_IWUSR,
 
 /*********** diagnostic trigger suppport *** END ****************************/
 
-
-
 /*****************************************/
 
 struct device_attribute *mpt3sas_host_attrs[] = {
@@ -3402,9 +3400,50 @@ _ctl_device_handle_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR(sas_device_handle, S_IRUGO, _ctl_device_handle_show, NULL);
 
+/**
+ * _ctl_device_ncq_io_prio_show - send prioritized io commands to device
+ * @dev - pointer to embedded device
+ * @buf - the buffer returned
+ *
+ * A sysfs 'read/write' sdev attribute, only works with SATA
+ */
+static ssize_t
+_ctl_device_ncq_prio_enable_show(struct device *dev,
+                                struct device_attribute *attr, char *buf)
+{
+       struct scsi_device *sdev = to_scsi_device(dev);
+       struct MPT3SAS_DEVICE *sas_device_priv_data = sdev->hostdata;
+
+       return snprintf(buf, PAGE_SIZE, "%d\n",
+                       sas_device_priv_data->ncq_prio_enable);
+}
+
+static ssize_t
+_ctl_device_ncq_prio_enable_store(struct device *dev,
+                                 struct device_attribute *attr,
+                                 const char *buf, size_t count)
+{
+       struct scsi_device *sdev = to_scsi_device(dev);
+       struct MPT3SAS_DEVICE *sas_device_priv_data = sdev->hostdata;
+       bool ncq_prio_enable = 0;
+
+       if (kstrtobool(buf, &ncq_prio_enable))
+               return -EINVAL;
+
+       if (!scsih_ncq_prio_supp(sdev))
+               return -EINVAL;
+
+       sas_device_priv_data->ncq_prio_enable = ncq_prio_enable;
+       return strlen(buf);
+}
+static DEVICE_ATTR(sas_ncq_prio_enable, S_IRUGO | S_IWUSR,
+                  _ctl_device_ncq_prio_enable_show,
+                  _ctl_device_ncq_prio_enable_store);
+
 struct device_attribute *mpt3sas_dev_attrs[] = {
        &dev_attr_sas_address,
        &dev_attr_sas_device_handle,
+       &dev_attr_sas_ncq_prio_enable,
        NULL,
 };
 
index 5c8f75247d739489313613e2f18965fd63b80e86..b5c966e319d315474b94703b93ab0343013dd973 100644 (file)
@@ -4053,6 +4053,8 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
        struct MPT3SAS_DEVICE *sas_device_priv_data;
        struct MPT3SAS_TARGET *sas_target_priv_data;
        struct _raid_device *raid_device;
+       struct request *rq = scmd->request;
+       int class;
        Mpi2SCSIIORequest_t *mpi_request;
        u32 mpi_control;
        u16 smid;
@@ -4115,7 +4117,12 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 
        /* set tags */
        mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
-
+       /* NCQ Prio supported, make sure control indicated high priority */
+       if (sas_device_priv_data->ncq_prio_enable) {
+               class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq));
+               if (class == IOPRIO_CLASS_RT)
+                       mpi_control |= 1 << MPI2_SCSIIO_CONTROL_CMDPRI_SHIFT;
+       }
        /* Make sure Device is not raid volume.
         * We do not expose raid functionality to upper layer for warpdrive.
         */
@@ -9099,6 +9106,31 @@ scsih_pci_mmio_enabled(struct pci_dev *pdev)
        return PCI_ERS_RESULT_RECOVERED;
 }
 
+/**
+ * scsih__ncq_prio_supp - Check for NCQ command priority support
+ * @sdev: scsi device struct
+ *
+ * This is called when a user indicates they would like to enable
+ * ncq command priorities. This works only on SATA devices.
+ */
+bool scsih_ncq_prio_supp(struct scsi_device *sdev)
+{
+       unsigned char *buf;
+       bool ncq_prio_supp = false;
+
+       if (!scsi_device_supports_vpd(sdev))
+               return ncq_prio_supp;
+
+       buf = kmalloc(SCSI_VPD_PG_LEN, GFP_KERNEL);
+       if (!buf)
+               return ncq_prio_supp;
+
+       if (!scsi_get_vpd_page(sdev, 0x89, buf, SCSI_VPD_PG_LEN))
+               ncq_prio_supp = (buf[213] >> 4) & 1;
+
+       kfree(buf);
+       return ncq_prio_supp;
+}
 /*
  * The pci device ids are defined in mpi/mpi2_cnfg.h.
  */
index a2960f5d98eca5156288ed6735e5109800790f1b..e8196c55b633bcedb6cb6f52e2badf5e2867c164 100644 (file)
@@ -52,7 +52,7 @@ static const char * osst_version = "0.99.4";
 #include <linux/delay.h>
 #include <linux/jiffies.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/dma.h>
 
 /* The driver prints some debugging information on the console if DEBUG
diff --git a/drivers/scsi/qedi/Kconfig b/drivers/scsi/qedi/Kconfig
new file mode 100644 (file)
index 0000000..23ca8a2
--- /dev/null
@@ -0,0 +1,10 @@
+config QEDI
+       tristate "QLogic QEDI 25/40/100Gb iSCSI Initiator Driver Support"
+       depends on PCI && SCSI
+       depends on QED
+       select SCSI_ISCSI_ATTRS
+       select QED_LL2
+       select QED_ISCSI
+       ---help---
+       This driver supports iSCSI offload for the QLogic FastLinQ
+       41000 Series Converged Network Adapters.
diff --git a/drivers/scsi/qedi/Makefile b/drivers/scsi/qedi/Makefile
new file mode 100644 (file)
index 0000000..2b3e16b
--- /dev/null
@@ -0,0 +1,5 @@
+obj-$(CONFIG_QEDI) := qedi.o
+qedi-y := qedi_main.o qedi_iscsi.o qedi_fw.o qedi_sysfs.o \
+           qedi_dbg.o
+
+qedi-$(CONFIG_DEBUG_FS) += qedi_debugfs.o
diff --git a/drivers/scsi/qedi/qedi.h b/drivers/scsi/qedi/qedi.h
new file mode 100644 (file)
index 0000000..5ca3e8c
--- /dev/null
@@ -0,0 +1,364 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#ifndef _QEDI_H_
+#define _QEDI_H_
+
+#define __PREVENT_QED_HSI__
+
+#include <scsi/scsi_transport_iscsi.h>
+#include <scsi/libiscsi.h>
+#include <scsi/scsi_host.h>
+#include <linux/uio_driver.h>
+
+#include "qedi_hsi.h"
+#include <linux/qed/qed_if.h>
+#include "qedi_dbg.h"
+#include <linux/qed/qed_iscsi_if.h>
+#include <linux/qed/qed_ll2_if.h>
+#include "qedi_version.h"
+
+#define QEDI_MODULE_NAME               "qedi"
+
+struct qedi_endpoint;
+
+/*
+ * PCI function probe defines
+ */
+#define QEDI_MODE_NORMAL       0
+#define QEDI_MODE_RECOVERY     1
+
+#define ISCSI_WQE_SET_PTU_INVALIDATE   1
+#define QEDI_MAX_ISCSI_TASK            4096
+#define QEDI_MAX_TASK_NUM              0x0FFF
+#define QEDI_MAX_ISCSI_CONNS_PER_HBA   1024
+#define QEDI_ISCSI_MAX_BDS_PER_CMD     256     /* Firmware max BDs is 256 */
+#define MAX_OUSTANDING_TASKS_PER_CON   1024
+
+#define QEDI_MAX_BD_LEN                0xffff
+#define QEDI_BD_SPLIT_SZ       0x1000
+#define QEDI_PAGE_SIZE         4096
+#define QEDI_FAST_SGE_COUNT    4
+/* MAX Length for cached SGL */
+#define MAX_SGLEN_FOR_CACHESGL ((1U << 16) - 1)
+
+#define MAX_NUM_MSIX_PF         8
+#define MIN_NUM_CPUS_MSIX(x)   min((x)->msix_count, num_online_cpus())
+
+#define QEDI_LOCAL_PORT_MIN     60000
+#define QEDI_LOCAL_PORT_MAX     61024
+#define QEDI_LOCAL_PORT_RANGE   (QEDI_LOCAL_PORT_MAX - QEDI_LOCAL_PORT_MIN)
+#define QEDI_LOCAL_PORT_INVALID        0xffff
+#define TX_RX_RING             16
+#define RX_RING                        (TX_RX_RING - 1)
+#define LL2_SINGLE_BUF_SIZE    0x400
+#define QEDI_PAGE_SIZE         4096
+#define QEDI_PAGE_ALIGN(addr)  ALIGN(addr, QEDI_PAGE_SIZE)
+#define QEDI_PAGE_MASK         (~((QEDI_PAGE_SIZE) - 1))
+
+#define QEDI_PAGE_SIZE         4096
+#define QEDI_PATH_HANDLE       0xFE0000000UL
+
+struct qedi_uio_ctrl {
+       /* meta data */
+       u32 uio_hsi_version;
+
+       /* user writes */
+       u32 host_tx_prod;
+       u32 host_rx_cons;
+       u32 host_rx_bd_cons;
+       u32 host_tx_pkt_len;
+       u32 host_rx_cons_cnt;
+
+       /* driver writes */
+       u32 hw_tx_cons;
+       u32 hw_rx_prod;
+       u32 hw_rx_bd_prod;
+       u32 hw_rx_prod_cnt;
+
+       /* other */
+       u8 mac_addr[6];
+       u8 reserve[2];
+};
+
+struct qedi_rx_bd {
+       u32 rx_pkt_index;
+       u32 rx_pkt_len;
+       u16 vlan_id;
+};
+
+#define QEDI_RX_DESC_CNT       (QEDI_PAGE_SIZE / sizeof(struct qedi_rx_bd))
+#define QEDI_MAX_RX_DESC_CNT   (QEDI_RX_DESC_CNT - 1)
+#define QEDI_NUM_RX_BD         (QEDI_RX_DESC_CNT * 1)
+#define QEDI_MAX_RX_BD         (QEDI_NUM_RX_BD - 1)
+
+#define QEDI_NEXT_RX_IDX(x)    ((((x) & (QEDI_MAX_RX_DESC_CNT)) ==     \
+                                 (QEDI_MAX_RX_DESC_CNT - 1)) ?         \
+                                (x) + 2 : (x) + 1)
+
+struct qedi_uio_dev {
+       struct uio_info         qedi_uinfo;
+       u32                     uio_dev;
+       struct list_head        list;
+
+       u32                     ll2_ring_size;
+       void                    *ll2_ring;
+
+       u32                     ll2_buf_size;
+       void                    *ll2_buf;
+
+       void                    *rx_pkt;
+       void                    *tx_pkt;
+
+       struct qedi_ctx         *qedi;
+       struct pci_dev          *pdev;
+       void                    *uctrl;
+};
+
+/* List to maintain the skb pointers */
+struct skb_work_list {
+       struct list_head list;
+       struct sk_buff *skb;
+       u16 vlan_id;
+};
+
+/* Queue sizes in number of elements */
+#define QEDI_SQ_SIZE           MAX_OUSTANDING_TASKS_PER_CON
+#define QEDI_CQ_SIZE           2048
+#define QEDI_CMDQ_SIZE         QEDI_MAX_ISCSI_TASK
+#define QEDI_PROTO_CQ_PROD_IDX 0
+
+struct qedi_glbl_q_params {
+       u64 hw_p_cq;    /* Completion queue PBL */
+       u64 hw_p_rq;    /* Request queue PBL */
+       u64 hw_p_cmdq;  /* Command queue PBL */
+};
+
+struct global_queue {
+       union iscsi_cqe *cq;
+       dma_addr_t cq_dma;
+       u32 cq_mem_size;
+       u32 cq_cons_idx; /* Completion queue consumer index */
+
+       void *cq_pbl;
+       dma_addr_t cq_pbl_dma;
+       u32 cq_pbl_size;
+
+};
+
+struct qedi_fastpath {
+       struct qed_sb_info      *sb_info;
+       u16                     sb_id;
+#define QEDI_NAME_SIZE         16
+       char                    name[QEDI_NAME_SIZE];
+       struct qedi_ctx         *qedi;
+};
+
+/* Used to pass fastpath information needed to process CQEs */
+struct qedi_io_work {
+       struct list_head list;
+       struct iscsi_cqe_solicited cqe;
+       u16     que_idx;
+};
+
+/**
+ * struct iscsi_cid_queue - Per adapter iscsi cid queue
+ *
+ * @cid_que_base:           queue base memory
+ * @cid_que:                queue memory pointer
+ * @cid_q_prod_idx:         produce index
+ * @cid_q_cons_idx:         consumer index
+ * @cid_q_max_idx:          max index. used to detect wrap around condition
+ * @cid_free_cnt:           queue size
+ * @conn_cid_tbl:           iscsi cid to conn structure mapping table
+ *
+ * Per adapter iSCSI CID Queue
+ */
+struct iscsi_cid_queue {
+       void *cid_que_base;
+       u32 *cid_que;
+       u32 cid_q_prod_idx;
+       u32 cid_q_cons_idx;
+       u32 cid_q_max_idx;
+       u32 cid_free_cnt;
+       struct qedi_conn **conn_cid_tbl;
+};
+
+struct qedi_portid_tbl {
+       spinlock_t      lock;   /* Port id lock */
+       u16             start;
+       u16             max;
+       u16             next;
+       unsigned long   *table;
+};
+
+struct qedi_itt_map {
+       __le32  itt;
+       struct qedi_cmd *p_cmd;
+};
+
+/* I/O tracing entry */
+#define QEDI_IO_TRACE_SIZE             2048
+struct qedi_io_log {
+#define QEDI_IO_TRACE_REQ              0
+#define QEDI_IO_TRACE_RSP              1
+       u8 direction;
+       u16 task_id;
+       u32 cid;
+       u32 port_id;    /* Remote port fabric ID */
+       int lun;
+       u8 op;          /* SCSI CDB */
+       u8 lba[4];
+       unsigned int bufflen;   /* SCSI buffer length */
+       unsigned int sg_count;  /* Number of SG elements */
+       u8 fast_sgs;            /* number of fast sgls */
+       u8 slow_sgs;            /* number of slow sgls */
+       u8 cached_sgs;          /* number of cached sgls */
+       int result;             /* Result passed back to mid-layer */
+       unsigned long jiffies;  /* Time stamp when I/O logged */
+       int refcount;           /* Reference count for task id */
+       unsigned int blk_req_cpu; /* CPU that the task is queued on by
+                                  * blk layer
+                                  */
+       unsigned int req_cpu;   /* CPU that the task is queued on */
+       unsigned int intr_cpu;  /* Interrupt CPU that the task is received on */
+       unsigned int blk_rsp_cpu;/* CPU that task is actually processed and
+                                 * returned to blk layer
+                                 */
+       bool cached_sge;
+       bool slow_sge;
+       bool fast_sge;
+};
+
+/* Number of entries in BDQ */
+#define QEDI_BDQ_NUM           256
+#define QEDI_BDQ_BUF_SIZE      256
+
+/* DMA coherent buffers for BDQ */
+struct qedi_bdq_buf {
+       void *buf_addr;
+       dma_addr_t buf_dma;
+};
+
+/* Main port level struct */
+struct qedi_ctx {
+       struct qedi_dbg_ctx dbg_ctx;
+       struct Scsi_Host *shost;
+       struct pci_dev *pdev;
+       struct qed_dev *cdev;
+       struct qed_dev_iscsi_info dev_info;
+       struct qed_int_info int_info;
+       struct qedi_glbl_q_params *p_cpuq;
+       struct global_queue **global_queues;
+       /* uio declaration */
+       struct qedi_uio_dev *udev;
+       struct list_head ll2_skb_list;
+       spinlock_t ll2_lock;    /* Light L2 lock */
+       spinlock_t hba_lock;    /* per port lock */
+       struct task_struct *ll2_recv_thread;
+       unsigned long flags;
+#define UIO_DEV_OPENED         1
+#define QEDI_IOTHREAD_WAKE     2
+#define QEDI_IN_RECOVERY       5
+#define QEDI_IN_OFFLINE                6
+
+       u8 mac[ETH_ALEN];
+       u32 src_ip[4];
+       u8 ip_type;
+
+       /* Physical address of above array */
+       dma_addr_t hw_p_cpuq;
+
+       struct qedi_bdq_buf bdq[QEDI_BDQ_NUM];
+       void *bdq_pbl;
+       dma_addr_t bdq_pbl_dma;
+       size_t bdq_pbl_mem_size;
+       void *bdq_pbl_list;
+       dma_addr_t bdq_pbl_list_dma;
+       u8 bdq_pbl_list_num_entries;
+       void __iomem *bdq_primary_prod;
+       void __iomem *bdq_secondary_prod;
+       u16 bdq_prod_idx;
+       u16 rq_num_entries;
+
+       u32 msix_count;
+       u32 max_sqes;
+       u8 num_queues;
+       u32 max_active_conns;
+
+       struct iscsi_cid_queue cid_que;
+       struct qedi_endpoint **ep_tbl;
+       struct qedi_portid_tbl lcl_port_tbl;
+
+       /* Rx fast path intr context */
+       struct qed_sb_info      *sb_array;
+       struct qedi_fastpath    *fp_array;
+       struct qed_iscsi_tid    tasks;
+
+#define QEDI_LINK_DOWN         0
+#define QEDI_LINK_UP           1
+       atomic_t link_state;
+
+#define QEDI_RESERVE_TASK_ID   0
+#define MAX_ISCSI_TASK_ENTRIES 4096
+#define QEDI_INVALID_TASK_ID   (MAX_ISCSI_TASK_ENTRIES + 1)
+       unsigned long task_idx_map[MAX_ISCSI_TASK_ENTRIES / BITS_PER_LONG];
+       struct qedi_itt_map *itt_map;
+       u16 tid_reuse_count[QEDI_MAX_ISCSI_TASK];
+       struct qed_pf_params pf_params;
+
+       struct workqueue_struct *tmf_thread;
+       struct workqueue_struct *offload_thread;
+
+       u16 ll2_mtu;
+
+       struct workqueue_struct *dpc_wq;
+
+       spinlock_t task_idx_lock;       /* To protect gbl context */
+       s32 last_tidx_alloc;
+       s32 last_tidx_clear;
+
+       struct qedi_io_log io_trace_buf[QEDI_IO_TRACE_SIZE];
+       spinlock_t io_trace_lock;       /* prtect trace Log buf */
+       u16 io_trace_idx;
+       unsigned int intr_cpu;
+       u32 cached_sgls;
+       bool use_cached_sge;
+       u32 slow_sgls;
+       bool use_slow_sge;
+       u32 fast_sgls;
+       bool use_fast_sge;
+
+       atomic_t num_offloads;
+};
+
+struct qedi_work {
+       struct list_head list;
+       struct qedi_ctx *qedi;
+       union iscsi_cqe cqe;
+       u16     que_idx;
+       bool is_solicited;
+};
+
+struct qedi_percpu_s {
+       struct task_struct *iothread;
+       struct list_head work_list;
+       spinlock_t p_work_lock;         /* Per cpu worker lock */
+};
+
+static inline void *qedi_get_task_mem(struct qed_iscsi_tid *info, u32 tid)
+{
+       return (info->blocks[tid / info->num_tids_per_block] +
+               (tid % info->num_tids_per_block) * info->size);
+}
+
+#define QEDI_U64_HI(val) ((u32)(((u64)(val)) >> 32))
+#define QEDI_U64_LO(val) ((u32)(((u64)(val)) & 0xffffffff))
+
+#endif /* _QEDI_H_ */
diff --git a/drivers/scsi/qedi/qedi_dbg.c b/drivers/scsi/qedi/qedi_dbg.c
new file mode 100644 (file)
index 0000000..2bdedb9
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#include "qedi_dbg.h"
+#include <linux/vmalloc.h>
+
+void
+qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
+            const char *fmt, ...)
+{
+       va_list va;
+       struct va_format vaf;
+       char nfunc[32];
+
+       memset(nfunc, 0, sizeof(nfunc));
+       memcpy(nfunc, func, sizeof(nfunc) - 1);
+
+       va_start(va, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &va;
+
+       if (likely(qedi) && likely(qedi->pdev))
+               pr_err("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev),
+                      nfunc, line, qedi->host_no, &vaf);
+       else
+               pr_err("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf);
+
+       va_end(va);
+}
+
+void
+qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
+             const char *fmt, ...)
+{
+       va_list va;
+       struct va_format vaf;
+       char nfunc[32];
+
+       memset(nfunc, 0, sizeof(nfunc));
+       memcpy(nfunc, func, sizeof(nfunc) - 1);
+
+       va_start(va, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &va;
+
+       if (!(qedi_dbg_log & QEDI_LOG_WARN))
+               return;
+
+       if (likely(qedi) && likely(qedi->pdev))
+               pr_warn("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev),
+                       nfunc, line, qedi->host_no, &vaf);
+       else
+               pr_warn("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf);
+
+       va_end(va);
+}
+
+void
+qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
+               const char *fmt, ...)
+{
+       va_list va;
+       struct va_format vaf;
+       char nfunc[32];
+
+       memset(nfunc, 0, sizeof(nfunc));
+       memcpy(nfunc, func, sizeof(nfunc) - 1);
+
+       va_start(va, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &va;
+
+       if (!(qedi_dbg_log & QEDI_LOG_NOTICE))
+               return;
+
+       if (likely(qedi) && likely(qedi->pdev))
+               pr_notice("[%s]:[%s:%d]:%d: %pV",
+                         dev_name(&qedi->pdev->dev), nfunc, line,
+                         qedi->host_no, &vaf);
+       else
+               pr_notice("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf);
+
+       va_end(va);
+}
+
+void
+qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
+             u32 level, const char *fmt, ...)
+{
+       va_list va;
+       struct va_format vaf;
+       char nfunc[32];
+
+       memset(nfunc, 0, sizeof(nfunc));
+       memcpy(nfunc, func, sizeof(nfunc) - 1);
+
+       va_start(va, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &va;
+
+       if (!(qedi_dbg_log & level))
+               return;
+
+       if (likely(qedi) && likely(qedi->pdev))
+               pr_info("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev),
+                       nfunc, line, qedi->host_no, &vaf);
+       else
+               pr_info("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf);
+
+       va_end(va);
+}
+
+int
+qedi_create_sysfs_attr(struct Scsi_Host *shost, struct sysfs_bin_attrs *iter)
+{
+       int ret = 0;
+
+       for (; iter->name; iter++) {
+               ret = sysfs_create_bin_file(&shost->shost_gendev.kobj,
+                                           iter->attr);
+               if (ret)
+                       pr_err("Unable to create sysfs %s attr, err(%d).\n",
+                              iter->name, ret);
+       }
+       return ret;
+}
+
+void
+qedi_remove_sysfs_attr(struct Scsi_Host *shost, struct sysfs_bin_attrs *iter)
+{
+       for (; iter->name; iter++)
+               sysfs_remove_bin_file(&shost->shost_gendev.kobj, iter->attr);
+}
diff --git a/drivers/scsi/qedi/qedi_dbg.h b/drivers/scsi/qedi/qedi_dbg.h
new file mode 100644 (file)
index 0000000..c55572b
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#ifndef _QEDI_DBG_H_
+#define _QEDI_DBG_H_
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/compiler.h>
+#include <linux/string.h>
+#include <linux/version.h>
+#include <linux/pci.h>
+#include <linux/delay.h>
+#include <scsi/scsi_transport.h>
+#include <scsi/scsi_transport_iscsi.h>
+#include <linux/fs.h>
+
+#define __PREVENT_QED_HSI__
+#include <linux/qed/common_hsi.h>
+#include <linux/qed/qed_if.h>
+
+extern uint qedi_dbg_log;
+
+/* Debug print level definitions */
+#define QEDI_LOG_DEFAULT       0x1             /* Set default logging mask */
+#define QEDI_LOG_INFO          0x2             /* Informational logs,
+                                                * MAC address, WWPN, WWNN
+                                                */
+#define QEDI_LOG_DISC          0x4             /* Init, discovery, rport */
+#define QEDI_LOG_LL2           0x8             /* LL2, VLAN logs */
+#define QEDI_LOG_CONN          0x10            /* Connection setup, cleanup */
+#define QEDI_LOG_EVT           0x20            /* Events, link, mtu */
+#define QEDI_LOG_TIMER         0x40            /* Timer events */
+#define QEDI_LOG_MP_REQ                0x80            /* Middle Path (MP) logs */
+#define QEDI_LOG_SCSI_TM       0x100           /* SCSI Aborts, Task Mgmt */
+#define QEDI_LOG_UNSOL         0x200           /* unsolicited event logs */
+#define QEDI_LOG_IO            0x400           /* scsi cmd, completion */
+#define QEDI_LOG_MQ            0x800           /* Multi Queue logs */
+#define QEDI_LOG_BSG           0x1000          /* BSG logs */
+#define QEDI_LOG_DEBUGFS       0x2000          /* debugFS logs */
+#define QEDI_LOG_LPORT         0x4000          /* lport logs */
+#define QEDI_LOG_ELS           0x8000          /* ELS logs */
+#define QEDI_LOG_NPIV          0x10000         /* NPIV logs */
+#define QEDI_LOG_SESS          0x20000         /* Conection setup, cleanup */
+#define QEDI_LOG_UIO           0x40000         /* iSCSI UIO logs */
+#define QEDI_LOG_TID           0x80000         /* FW TID context acquire,
+                                                * free
+                                                */
+#define QEDI_TRACK_TID         0x100000        /* Track TID state. To be
+                                                * enabled only at module load
+                                                * and not run-time.
+                                                */
+#define QEDI_TRACK_CMD_LIST    0x300000        /* Track active cmd list nodes,
+                                               * done with reference to TID,
+                                               * hence TRACK_TID also enabled.
+                                               */
+#define QEDI_LOG_NOTICE                0x40000000      /* Notice logs */
+#define QEDI_LOG_WARN          0x80000000      /* Warning logs */
+
+/* Debug context structure */
+struct qedi_dbg_ctx {
+       unsigned int host_no;
+       struct pci_dev *pdev;
+#ifdef CONFIG_DEBUG_FS
+       struct dentry *bdf_dentry;
+#endif
+};
+
+#define QEDI_ERR(pdev, fmt, ...)       \
+               qedi_dbg_err(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
+#define QEDI_WARN(pdev, fmt, ...)      \
+               qedi_dbg_warn(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
+#define QEDI_NOTICE(pdev, fmt, ...)    \
+               qedi_dbg_notice(pdev, __func__, __LINE__, fmt, ## __VA_ARGS__)
+#define QEDI_INFO(pdev, level, fmt, ...)       \
+               qedi_dbg_info(pdev, __func__, __LINE__, level, fmt,     \
+                             ## __VA_ARGS__)
+
+void qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
+                 const char *fmt, ...);
+void qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
+                  const char *fmt, ...);
+void qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
+                    const char *fmt, ...);
+void qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line,
+                  u32 info, const char *fmt, ...);
+
+struct Scsi_Host;
+
+struct sysfs_bin_attrs {
+       char *name;
+       struct bin_attribute *attr;
+};
+
+int qedi_create_sysfs_attr(struct Scsi_Host *shost,
+                          struct sysfs_bin_attrs *iter);
+void qedi_remove_sysfs_attr(struct Scsi_Host *shost,
+                           struct sysfs_bin_attrs *iter);
+
+#ifdef CONFIG_DEBUG_FS
+/* DebugFS related code */
+struct qedi_list_of_funcs {
+       char *oper_str;
+       ssize_t (*oper_func)(struct qedi_dbg_ctx *qedi);
+};
+
+struct qedi_debugfs_ops {
+       char *name;
+       struct qedi_list_of_funcs *qedi_funcs;
+};
+
+#define qedi_dbg_fileops(drv, ops) \
+{ \
+       .owner  = THIS_MODULE, \
+       .open   = simple_open, \
+       .read   = drv##_dbg_##ops##_cmd_read, \
+       .write  = drv##_dbg_##ops##_cmd_write \
+}
+
+/* Used for debugfs sequential files */
+#define qedi_dbg_fileops_seq(drv, ops) \
+{ \
+       .owner = THIS_MODULE, \
+       .open = drv##_dbg_##ops##_open, \
+       .read = seq_read, \
+       .llseek = seq_lseek, \
+       .release = single_release, \
+}
+
+void qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
+                       struct qedi_debugfs_ops *dops,
+                       const struct file_operations *fops);
+void qedi_dbg_host_exit(struct qedi_dbg_ctx *qedi);
+void qedi_dbg_init(char *drv_name);
+void qedi_dbg_exit(void);
+#endif /* CONFIG_DEBUG_FS */
+
+#endif /* _QEDI_DBG_H_ */
diff --git a/drivers/scsi/qedi/qedi_debugfs.c b/drivers/scsi/qedi/qedi_debugfs.c
new file mode 100644 (file)
index 0000000..9559362
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#include "qedi.h"
+#include "qedi_dbg.h"
+
+#include <linux/uaccess.h>
+#include <linux/debugfs.h>
+#include <linux/module.h>
+
+int do_not_recover;
+static struct dentry *qedi_dbg_root;
+
+void
+qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
+                  struct qedi_debugfs_ops *dops,
+                  const struct file_operations *fops)
+{
+       char host_dirname[32];
+       struct dentry *file_dentry = NULL;
+
+       sprintf(host_dirname, "host%u", qedi->host_no);
+       qedi->bdf_dentry = debugfs_create_dir(host_dirname, qedi_dbg_root);
+       if (!qedi->bdf_dentry)
+               return;
+
+       while (dops) {
+               if (!(dops->name))
+                       break;
+
+               file_dentry = debugfs_create_file(dops->name, 0600,
+                                                 qedi->bdf_dentry, qedi,
+                                                 fops);
+               if (!file_dentry) {
+                       QEDI_INFO(qedi, QEDI_LOG_DEBUGFS,
+                                 "Debugfs entry %s creation failed\n",
+                                 dops->name);
+                       debugfs_remove_recursive(qedi->bdf_dentry);
+                       return;
+               }
+               dops++;
+               fops++;
+       }
+}
+
+void
+qedi_dbg_host_exit(struct qedi_dbg_ctx *qedi)
+{
+       debugfs_remove_recursive(qedi->bdf_dentry);
+       qedi->bdf_dentry = NULL;
+}
+
+void
+qedi_dbg_init(char *drv_name)
+{
+       qedi_dbg_root = debugfs_create_dir(drv_name, NULL);
+       if (!qedi_dbg_root)
+               QEDI_INFO(NULL, QEDI_LOG_DEBUGFS, "Init of debugfs failed\n");
+}
+
+void
+qedi_dbg_exit(void)
+{
+       debugfs_remove_recursive(qedi_dbg_root);
+       qedi_dbg_root = NULL;
+}
+
+static ssize_t
+qedi_dbg_do_not_recover_enable(struct qedi_dbg_ctx *qedi_dbg)
+{
+       if (!do_not_recover)
+               do_not_recover = 1;
+
+       QEDI_INFO(qedi_dbg, QEDI_LOG_DEBUGFS, "do_not_recover=%d\n",
+                 do_not_recover);
+       return 0;
+}
+
+static ssize_t
+qedi_dbg_do_not_recover_disable(struct qedi_dbg_ctx *qedi_dbg)
+{
+       if (do_not_recover)
+               do_not_recover = 0;
+
+       QEDI_INFO(qedi_dbg, QEDI_LOG_DEBUGFS, "do_not_recover=%d\n",
+                 do_not_recover);
+       return 0;
+}
+
+static struct qedi_list_of_funcs qedi_dbg_do_not_recover_ops[] = {
+       { "enable", qedi_dbg_do_not_recover_enable },
+       { "disable", qedi_dbg_do_not_recover_disable },
+       { NULL, NULL }
+};
+
+struct qedi_debugfs_ops qedi_debugfs_ops[] = {
+       { "gbl_ctx", NULL },
+       { "do_not_recover", qedi_dbg_do_not_recover_ops},
+       { "io_trace", NULL },
+       { NULL, NULL }
+};
+
+static ssize_t
+qedi_dbg_do_not_recover_cmd_write(struct file *filp, const char __user *buffer,
+                                 size_t count, loff_t *ppos)
+{
+       size_t cnt = 0;
+       struct qedi_dbg_ctx *qedi_dbg =
+                       (struct qedi_dbg_ctx *)filp->private_data;
+       struct qedi_list_of_funcs *lof = qedi_dbg_do_not_recover_ops;
+
+       if (*ppos)
+               return 0;
+
+       while (lof) {
+               if (!(lof->oper_str))
+                       break;
+
+               if (!strncmp(lof->oper_str, buffer, strlen(lof->oper_str))) {
+                       cnt = lof->oper_func(qedi_dbg);
+                       break;
+               }
+
+               lof++;
+       }
+       return (count - cnt);
+}
+
+static ssize_t
+qedi_dbg_do_not_recover_cmd_read(struct file *filp, char __user *buffer,
+                                size_t count, loff_t *ppos)
+{
+       size_t cnt = 0;
+
+       if (*ppos)
+               return 0;
+
+       cnt = sprintf(buffer, "do_not_recover=%d\n", do_not_recover);
+       cnt = min_t(int, count, cnt - *ppos);
+       *ppos += cnt;
+       return cnt;
+}
+
+static int
+qedi_gbl_ctx_show(struct seq_file *s, void *unused)
+{
+       struct qedi_fastpath *fp = NULL;
+       struct qed_sb_info *sb_info = NULL;
+       struct status_block *sb = NULL;
+       struct global_queue *que = NULL;
+       int id;
+       u16 prod_idx;
+       struct qedi_ctx *qedi = s->private;
+       unsigned long flags;
+
+       seq_puts(s, " DUMP CQ CONTEXT:\n");
+
+       for (id = 0; id < MIN_NUM_CPUS_MSIX(qedi); id++) {
+               spin_lock_irqsave(&qedi->hba_lock, flags);
+               seq_printf(s, "=========FAST CQ PATH [%d] ==========\n", id);
+               fp = &qedi->fp_array[id];
+               sb_info = fp->sb_info;
+               sb = sb_info->sb_virt;
+               prod_idx = (sb->pi_array[QEDI_PROTO_CQ_PROD_IDX] &
+                           STATUS_BLOCK_PROD_INDEX_MASK);
+               seq_printf(s, "SB PROD IDX: %d\n", prod_idx);
+               que = qedi->global_queues[fp->sb_id];
+               seq_printf(s, "DRV CONS IDX: %d\n", que->cq_cons_idx);
+               seq_printf(s, "CQ complete host memory: %d\n", fp->sb_id);
+               seq_puts(s, "=========== END ==================\n\n\n");
+               spin_unlock_irqrestore(&qedi->hba_lock, flags);
+       }
+       return 0;
+}
+
+static int
+qedi_dbg_gbl_ctx_open(struct inode *inode, struct file *file)
+{
+       struct qedi_dbg_ctx *qedi_dbg = inode->i_private;
+       struct qedi_ctx *qedi = container_of(qedi_dbg, struct qedi_ctx,
+                                            dbg_ctx);
+
+       return single_open(file, qedi_gbl_ctx_show, qedi);
+}
+
+static int
+qedi_io_trace_show(struct seq_file *s, void *unused)
+{
+       int id, idx = 0;
+       struct qedi_ctx *qedi = s->private;
+       struct qedi_io_log *io_log;
+       unsigned long flags;
+
+       seq_puts(s, " DUMP IO LOGS:\n");
+       spin_lock_irqsave(&qedi->io_trace_lock, flags);
+       idx = qedi->io_trace_idx;
+       for (id = 0; id < QEDI_IO_TRACE_SIZE; id++) {
+               io_log = &qedi->io_trace_buf[idx];
+               seq_printf(s, "iodir-%d:", io_log->direction);
+               seq_printf(s, "tid-0x%x:", io_log->task_id);
+               seq_printf(s, "cid-0x%x:", io_log->cid);
+               seq_printf(s, "lun-%d:", io_log->lun);
+               seq_printf(s, "op-0x%02x:", io_log->op);
+               seq_printf(s, "0x%02x%02x%02x%02x:", io_log->lba[0],
+                          io_log->lba[1], io_log->lba[2], io_log->lba[3]);
+               seq_printf(s, "buflen-%d:", io_log->bufflen);
+               seq_printf(s, "sgcnt-%d:", io_log->sg_count);
+               seq_printf(s, "res-0x%08x:", io_log->result);
+               seq_printf(s, "jif-%lu:", io_log->jiffies);
+               seq_printf(s, "blk_req_cpu-%d:", io_log->blk_req_cpu);
+               seq_printf(s, "req_cpu-%d:", io_log->req_cpu);
+               seq_printf(s, "intr_cpu-%d:", io_log->intr_cpu);
+               seq_printf(s, "blk_rsp_cpu-%d\n", io_log->blk_rsp_cpu);
+
+               idx++;
+               if (idx == QEDI_IO_TRACE_SIZE)
+                       idx = 0;
+       }
+       spin_unlock_irqrestore(&qedi->io_trace_lock, flags);
+       return 0;
+}
+
+static int
+qedi_dbg_io_trace_open(struct inode *inode, struct file *file)
+{
+       struct qedi_dbg_ctx *qedi_dbg = inode->i_private;
+       struct qedi_ctx *qedi = container_of(qedi_dbg, struct qedi_ctx,
+                                            dbg_ctx);
+
+       return single_open(file, qedi_io_trace_show, qedi);
+}
+
+const struct file_operations qedi_dbg_fops[] = {
+       qedi_dbg_fileops_seq(qedi, gbl_ctx),
+       qedi_dbg_fileops(qedi, do_not_recover),
+       qedi_dbg_fileops_seq(qedi, io_trace),
+       { NULL, NULL },
+};
diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
new file mode 100644 (file)
index 0000000..b1d3904
--- /dev/null
@@ -0,0 +1,2378 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#include <linux/blkdev.h>
+#include <scsi/scsi_tcq.h>
+#include <linux/delay.h>
+
+#include "qedi.h"
+#include "qedi_iscsi.h"
+#include "qedi_gbl.h"
+
+static int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn,
+                              struct iscsi_task *mtask);
+
+void qedi_iscsi_unmap_sg_list(struct qedi_cmd *cmd)
+{
+       struct scsi_cmnd *sc = cmd->scsi_cmd;
+
+       if (cmd->io_tbl.sge_valid && sc) {
+               cmd->io_tbl.sge_valid = 0;
+               scsi_dma_unmap(sc);
+       }
+}
+
+static void qedi_process_logout_resp(struct qedi_ctx *qedi,
+                                    union iscsi_cqe *cqe,
+                                    struct iscsi_task *task,
+                                    struct qedi_conn *qedi_conn)
+{
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_logout_rsp *resp_hdr;
+       struct iscsi_session *session = conn->session;
+       struct iscsi_logout_response_hdr *cqe_logout_response;
+       struct qedi_cmd *cmd;
+
+       cmd = (struct qedi_cmd *)task->dd_data;
+       cqe_logout_response = &cqe->cqe_common.iscsi_hdr.logout_response;
+       spin_lock(&session->back_lock);
+       resp_hdr = (struct iscsi_logout_rsp *)&qedi_conn->gen_pdu.resp_hdr;
+       memset(resp_hdr, 0, sizeof(struct iscsi_hdr));
+       resp_hdr->opcode = cqe_logout_response->opcode;
+       resp_hdr->flags = cqe_logout_response->flags;
+       resp_hdr->hlength = 0;
+
+       resp_hdr->itt = build_itt(cqe->cqe_solicited.itid, conn->session->age);
+       resp_hdr->statsn = cpu_to_be32(cqe_logout_response->stat_sn);
+       resp_hdr->exp_cmdsn = cpu_to_be32(cqe_logout_response->exp_cmd_sn);
+       resp_hdr->max_cmdsn = cpu_to_be32(cqe_logout_response->max_cmd_sn);
+
+       resp_hdr->t2wait = cpu_to_be32(cqe_logout_response->time2wait);
+       resp_hdr->t2retain = cpu_to_be32(cqe_logout_response->time2retain);
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
+                 "Freeing tid=0x%x for cid=0x%x\n",
+                 cmd->task_id, qedi_conn->iscsi_conn_id);
+
+       if (likely(cmd->io_cmd_in_list)) {
+               cmd->io_cmd_in_list = false;
+               list_del_init(&cmd->io_cmd);
+               qedi_conn->active_cmd_count--;
+       } else {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                         "Active cmd list node already deleted, tid=0x%x, cid=0x%x, io_cmd_node=%p\n",
+                         cmd->task_id, qedi_conn->iscsi_conn_id,
+                         &cmd->io_cmd);
+       }
+
+       cmd->state = RESPONSE_RECEIVED;
+       qedi_clear_task_idx(qedi, cmd->task_id);
+       __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr, NULL, 0);
+
+       spin_unlock(&session->back_lock);
+}
+
+static void qedi_process_text_resp(struct qedi_ctx *qedi,
+                                  union iscsi_cqe *cqe,
+                                  struct iscsi_task *task,
+                                  struct qedi_conn *qedi_conn)
+{
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_session *session = conn->session;
+       struct iscsi_task_context *task_ctx;
+       struct iscsi_text_rsp *resp_hdr_ptr;
+       struct iscsi_text_response_hdr *cqe_text_response;
+       struct qedi_cmd *cmd;
+       int pld_len;
+       u32 *tmp;
+
+       cmd = (struct qedi_cmd *)task->dd_data;
+       task_ctx = qedi_get_task_mem(&qedi->tasks, cmd->task_id);
+
+       cqe_text_response = &cqe->cqe_common.iscsi_hdr.text_response;
+       spin_lock(&session->back_lock);
+       resp_hdr_ptr =  (struct iscsi_text_rsp *)&qedi_conn->gen_pdu.resp_hdr;
+       memset(resp_hdr_ptr, 0, sizeof(struct iscsi_hdr));
+       resp_hdr_ptr->opcode = cqe_text_response->opcode;
+       resp_hdr_ptr->flags = cqe_text_response->flags;
+       resp_hdr_ptr->hlength = 0;
+
+       hton24(resp_hdr_ptr->dlength,
+              (cqe_text_response->hdr_second_dword &
+               ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_MASK));
+       tmp = (u32 *)resp_hdr_ptr->dlength;
+
+       resp_hdr_ptr->itt = build_itt(cqe->cqe_solicited.itid,
+                                     conn->session->age);
+       resp_hdr_ptr->ttt = cqe_text_response->ttt;
+       resp_hdr_ptr->statsn = cpu_to_be32(cqe_text_response->stat_sn);
+       resp_hdr_ptr->exp_cmdsn = cpu_to_be32(cqe_text_response->exp_cmd_sn);
+       resp_hdr_ptr->max_cmdsn = cpu_to_be32(cqe_text_response->max_cmd_sn);
+
+       pld_len = cqe_text_response->hdr_second_dword &
+                 ISCSI_TEXT_RESPONSE_HDR_DATA_SEG_LEN_MASK;
+       qedi_conn->gen_pdu.resp_wr_ptr = qedi_conn->gen_pdu.resp_buf + pld_len;
+
+       memset(task_ctx, '\0', sizeof(*task_ctx));
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
+                 "Freeing tid=0x%x for cid=0x%x\n",
+                 cmd->task_id, qedi_conn->iscsi_conn_id);
+
+       if (likely(cmd->io_cmd_in_list)) {
+               cmd->io_cmd_in_list = false;
+               list_del_init(&cmd->io_cmd);
+               qedi_conn->active_cmd_count--;
+       } else {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                         "Active cmd list node already deleted, tid=0x%x, cid=0x%x, io_cmd_node=%p\n",
+                         cmd->task_id, qedi_conn->iscsi_conn_id,
+                         &cmd->io_cmd);
+       }
+
+       cmd->state = RESPONSE_RECEIVED;
+       qedi_clear_task_idx(qedi, cmd->task_id);
+
+       __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr,
+                            qedi_conn->gen_pdu.resp_buf,
+                            (qedi_conn->gen_pdu.resp_wr_ptr -
+                             qedi_conn->gen_pdu.resp_buf));
+       spin_unlock(&session->back_lock);
+}
+
+static void qedi_tmf_resp_work(struct work_struct *work)
+{
+       struct qedi_cmd *qedi_cmd =
+                               container_of(work, struct qedi_cmd, tmf_work);
+       struct qedi_conn *qedi_conn = qedi_cmd->conn;
+       struct qedi_ctx *qedi = qedi_conn->qedi;
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_session *session = conn->session;
+       struct iscsi_tm_rsp *resp_hdr_ptr;
+       struct iscsi_cls_session *cls_sess;
+       int rval = 0;
+
+       set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags);
+       resp_hdr_ptr =  (struct iscsi_tm_rsp *)qedi_cmd->tmf_resp_buf;
+       cls_sess = iscsi_conn_to_session(qedi_conn->cls_conn);
+
+       iscsi_block_session(session->cls_session);
+       rval = qedi_cleanup_all_io(qedi, qedi_conn, qedi_cmd->task, true);
+       if (rval) {
+               clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags);
+               qedi_clear_task_idx(qedi, qedi_cmd->task_id);
+               iscsi_unblock_session(session->cls_session);
+               return;
+       }
+
+       iscsi_unblock_session(session->cls_session);
+       qedi_clear_task_idx(qedi, qedi_cmd->task_id);
+
+       spin_lock(&session->back_lock);
+       __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0);
+       spin_unlock(&session->back_lock);
+       kfree(resp_hdr_ptr);
+       clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags);
+}
+
+static void qedi_process_tmf_resp(struct qedi_ctx *qedi,
+                                 union iscsi_cqe *cqe,
+                                 struct iscsi_task *task,
+                                 struct qedi_conn *qedi_conn)
+
+{
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_session *session = conn->session;
+       struct iscsi_tmf_response_hdr *cqe_tmp_response;
+       struct iscsi_tm_rsp *resp_hdr_ptr;
+       struct iscsi_tm *tmf_hdr;
+       struct qedi_cmd *qedi_cmd = NULL;
+       u32 *tmp;
+
+       cqe_tmp_response = &cqe->cqe_common.iscsi_hdr.tmf_response;
+
+       qedi_cmd = task->dd_data;
+       qedi_cmd->tmf_resp_buf = kzalloc(sizeof(*resp_hdr_ptr), GFP_KERNEL);
+       if (!qedi_cmd->tmf_resp_buf) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Failed to allocate resp buf, cid=0x%x\n",
+                         qedi_conn->iscsi_conn_id);
+               return;
+       }
+
+       spin_lock(&session->back_lock);
+       resp_hdr_ptr =  (struct iscsi_tm_rsp *)qedi_cmd->tmf_resp_buf;
+       memset(resp_hdr_ptr, 0, sizeof(struct iscsi_tm_rsp));
+
+       /* Fill up the header */
+       resp_hdr_ptr->opcode = cqe_tmp_response->opcode;
+       resp_hdr_ptr->flags = cqe_tmp_response->hdr_flags;
+       resp_hdr_ptr->response = cqe_tmp_response->hdr_response;
+       resp_hdr_ptr->hlength = 0;
+
+       hton24(resp_hdr_ptr->dlength,
+              (cqe_tmp_response->hdr_second_dword &
+               ISCSI_TMF_RESPONSE_HDR_DATA_SEG_LEN_MASK));
+       tmp = (u32 *)resp_hdr_ptr->dlength;
+       resp_hdr_ptr->itt = build_itt(cqe->cqe_solicited.itid,
+                                     conn->session->age);
+       resp_hdr_ptr->statsn = cpu_to_be32(cqe_tmp_response->stat_sn);
+       resp_hdr_ptr->exp_cmdsn  = cpu_to_be32(cqe_tmp_response->exp_cmd_sn);
+       resp_hdr_ptr->max_cmdsn = cpu_to_be32(cqe_tmp_response->max_cmd_sn);
+
+       tmf_hdr = (struct iscsi_tm *)qedi_cmd->task->hdr;
+
+       if (likely(qedi_cmd->io_cmd_in_list)) {
+               qedi_cmd->io_cmd_in_list = false;
+               list_del_init(&qedi_cmd->io_cmd);
+               qedi_conn->active_cmd_count--;
+       }
+
+       if (((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+             ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) ||
+           ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+             ISCSI_TM_FUNC_TARGET_WARM_RESET) ||
+           ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+             ISCSI_TM_FUNC_TARGET_COLD_RESET)) {
+               INIT_WORK(&qedi_cmd->tmf_work, qedi_tmf_resp_work);
+               queue_work(qedi->tmf_thread, &qedi_cmd->tmf_work);
+               goto unblock_sess;
+       }
+
+       qedi_clear_task_idx(qedi, qedi_cmd->task_id);
+
+       __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0);
+       kfree(resp_hdr_ptr);
+
+unblock_sess:
+       spin_unlock(&session->back_lock);
+}
+
+static void qedi_process_login_resp(struct qedi_ctx *qedi,
+                                   union iscsi_cqe *cqe,
+                                   struct iscsi_task *task,
+                                   struct qedi_conn *qedi_conn)
+{
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_session *session = conn->session;
+       struct iscsi_task_context *task_ctx;
+       struct iscsi_login_rsp *resp_hdr_ptr;
+       struct iscsi_login_response_hdr *cqe_login_response;
+       struct qedi_cmd *cmd;
+       int pld_len;
+       u32 *tmp;
+
+       cmd = (struct qedi_cmd *)task->dd_data;
+
+       cqe_login_response = &cqe->cqe_common.iscsi_hdr.login_response;
+       task_ctx = qedi_get_task_mem(&qedi->tasks, cmd->task_id);
+
+       spin_lock(&session->back_lock);
+       resp_hdr_ptr =  (struct iscsi_login_rsp *)&qedi_conn->gen_pdu.resp_hdr;
+       memset(resp_hdr_ptr, 0, sizeof(struct iscsi_login_rsp));
+       resp_hdr_ptr->opcode = cqe_login_response->opcode;
+       resp_hdr_ptr->flags = cqe_login_response->flags_attr;
+       resp_hdr_ptr->hlength = 0;
+
+       hton24(resp_hdr_ptr->dlength,
+              (cqe_login_response->hdr_second_dword &
+               ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK));
+       tmp = (u32 *)resp_hdr_ptr->dlength;
+       resp_hdr_ptr->itt = build_itt(cqe->cqe_solicited.itid,
+                                     conn->session->age);
+       resp_hdr_ptr->tsih = cqe_login_response->tsih;
+       resp_hdr_ptr->statsn = cpu_to_be32(cqe_login_response->stat_sn);
+       resp_hdr_ptr->exp_cmdsn = cpu_to_be32(cqe_login_response->exp_cmd_sn);
+       resp_hdr_ptr->max_cmdsn = cpu_to_be32(cqe_login_response->max_cmd_sn);
+       resp_hdr_ptr->status_class = cqe_login_response->status_class;
+       resp_hdr_ptr->status_detail = cqe_login_response->status_detail;
+       pld_len = cqe_login_response->hdr_second_dword &
+                 ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK;
+       qedi_conn->gen_pdu.resp_wr_ptr = qedi_conn->gen_pdu.resp_buf + pld_len;
+
+       if (likely(cmd->io_cmd_in_list)) {
+               cmd->io_cmd_in_list = false;
+               list_del_init(&cmd->io_cmd);
+               qedi_conn->active_cmd_count--;
+       }
+
+       memset(task_ctx, '\0', sizeof(*task_ctx));
+
+       __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr,
+                            qedi_conn->gen_pdu.resp_buf,
+                            (qedi_conn->gen_pdu.resp_wr_ptr -
+                            qedi_conn->gen_pdu.resp_buf));
+
+       spin_unlock(&session->back_lock);
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
+                 "Freeing tid=0x%x for cid=0x%x\n",
+                 cmd->task_id, qedi_conn->iscsi_conn_id);
+       cmd->state = RESPONSE_RECEIVED;
+       qedi_clear_task_idx(qedi, cmd->task_id);
+}
+
+static void qedi_get_rq_bdq_buf(struct qedi_ctx *qedi,
+                               struct iscsi_cqe_unsolicited *cqe,
+                               char *ptr, int len)
+{
+       u16 idx = 0;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                 "pld_len [%d], bdq_prod_idx [%d], idx [%d]\n",
+                 len, qedi->bdq_prod_idx,
+                 (qedi->bdq_prod_idx % qedi->rq_num_entries));
+
+       /* Obtain buffer address from rqe_opaque */
+       idx = cqe->rqe_opaque.lo;
+       if ((idx < 0) || (idx > (QEDI_BDQ_NUM - 1))) {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                         "wrong idx %d returned by FW, dropping the unsolicited pkt\n",
+                         idx);
+               return;
+       }
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                 "rqe_opaque.lo [0x%p], rqe_opaque.hi [0x%p], idx [%d]\n",
+                 cqe->rqe_opaque.lo, cqe->rqe_opaque.hi, idx);
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                 "unsol_cqe_type = %d\n", cqe->unsol_cqe_type);
+       switch (cqe->unsol_cqe_type) {
+       case ISCSI_CQE_UNSOLICITED_SINGLE:
+       case ISCSI_CQE_UNSOLICITED_FIRST:
+               if (len)
+                       memcpy(ptr, (void *)qedi->bdq[idx].buf_addr, len);
+               break;
+       case ISCSI_CQE_UNSOLICITED_MIDDLE:
+       case ISCSI_CQE_UNSOLICITED_LAST:
+               break;
+       default:
+               break;
+       }
+}
+
+static void qedi_put_rq_bdq_buf(struct qedi_ctx *qedi,
+                               struct iscsi_cqe_unsolicited *cqe,
+                               int count)
+{
+       u16 tmp;
+       u16 idx = 0;
+       struct scsi_bd *pbl;
+
+       /* Obtain buffer address from rqe_opaque */
+       idx = cqe->rqe_opaque.lo;
+       if ((idx < 0) || (idx > (QEDI_BDQ_NUM - 1))) {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                         "wrong idx %d returned by FW, dropping the unsolicited pkt\n",
+                         idx);
+               return;
+       }
+
+       pbl = (struct scsi_bd *)qedi->bdq_pbl;
+       pbl += (qedi->bdq_prod_idx % qedi->rq_num_entries);
+       pbl->address.hi = cpu_to_le32(QEDI_U64_HI(qedi->bdq[idx].buf_dma));
+       pbl->address.lo = cpu_to_le32(QEDI_U64_LO(qedi->bdq[idx].buf_dma));
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                 "pbl [0x%p] pbl->address hi [0x%llx] lo [0x%llx] idx [%d]\n",
+                 pbl, pbl->address.hi, pbl->address.lo, idx);
+       pbl->opaque.hi = 0;
+       pbl->opaque.lo = cpu_to_le32(QEDI_U64_LO(idx));
+
+       /* Increment producer to let f/w know we've handled the frame */
+       qedi->bdq_prod_idx += count;
+
+       writew(qedi->bdq_prod_idx, qedi->bdq_primary_prod);
+       tmp = readw(qedi->bdq_primary_prod);
+
+       writew(qedi->bdq_prod_idx, qedi->bdq_secondary_prod);
+       tmp = readw(qedi->bdq_secondary_prod);
+}
+
+static void qedi_unsol_pdu_adjust_bdq(struct qedi_ctx *qedi,
+                                     struct iscsi_cqe_unsolicited *cqe,
+                                     u32 pdu_len, u32 num_bdqs,
+                                     char *bdq_data)
+{
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                 "num_bdqs [%d]\n", num_bdqs);
+
+       qedi_get_rq_bdq_buf(qedi, cqe, bdq_data, pdu_len);
+       qedi_put_rq_bdq_buf(qedi, cqe, (num_bdqs + 1));
+}
+
+static int qedi_process_nopin_mesg(struct qedi_ctx *qedi,
+                                  union iscsi_cqe *cqe,
+                                  struct iscsi_task *task,
+                                  struct qedi_conn *qedi_conn, u16 que_idx)
+{
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_session *session = conn->session;
+       struct iscsi_nop_in_hdr *cqe_nop_in;
+       struct iscsi_nopin *hdr;
+       struct qedi_cmd *cmd;
+       int tgt_async_nop = 0;
+       u32 lun[2];
+       u32 pdu_len, num_bdqs;
+       char bdq_data[QEDI_BDQ_BUF_SIZE];
+       unsigned long flags;
+
+       spin_lock_bh(&session->back_lock);
+       cqe_nop_in = &cqe->cqe_common.iscsi_hdr.nop_in;
+
+       pdu_len = cqe_nop_in->hdr_second_dword &
+                 ISCSI_NOP_IN_HDR_DATA_SEG_LEN_MASK;
+       num_bdqs = pdu_len / QEDI_BDQ_BUF_SIZE;
+
+       hdr = (struct iscsi_nopin *)&qedi_conn->gen_pdu.resp_hdr;
+       memset(hdr, 0, sizeof(struct iscsi_hdr));
+       hdr->opcode = cqe_nop_in->opcode;
+       hdr->max_cmdsn = cpu_to_be32(cqe_nop_in->max_cmd_sn);
+       hdr->exp_cmdsn = cpu_to_be32(cqe_nop_in->exp_cmd_sn);
+       hdr->statsn = cpu_to_be32(cqe_nop_in->stat_sn);
+       hdr->ttt = cpu_to_be32(cqe_nop_in->ttt);
+
+       if (cqe->cqe_common.cqe_type == ISCSI_CQE_TYPE_UNSOLICITED) {
+               spin_lock_irqsave(&qedi->hba_lock, flags);
+               qedi_unsol_pdu_adjust_bdq(qedi, &cqe->cqe_unsolicited,
+                                         pdu_len, num_bdqs, bdq_data);
+               hdr->itt = RESERVED_ITT;
+               tgt_async_nop = 1;
+               spin_unlock_irqrestore(&qedi->hba_lock, flags);
+               goto done;
+       }
+
+       /* Response to one of our nop-outs */
+       if (task) {
+               cmd = task->dd_data;
+               hdr->flags = ISCSI_FLAG_CMD_FINAL;
+               hdr->itt = build_itt(cqe->cqe_solicited.itid,
+                                    conn->session->age);
+               lun[0] = 0xffffffff;
+               lun[1] = 0xffffffff;
+               memcpy(&hdr->lun, lun, sizeof(struct scsi_lun));
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
+                         "Freeing tid=0x%x for cid=0x%x\n",
+                         cmd->task_id, qedi_conn->iscsi_conn_id);
+               cmd->state = RESPONSE_RECEIVED;
+               spin_lock(&qedi_conn->list_lock);
+               if (likely(cmd->io_cmd_in_list)) {
+                       cmd->io_cmd_in_list = false;
+                       list_del_init(&cmd->io_cmd);
+                       qedi_conn->active_cmd_count--;
+               }
+
+               spin_unlock(&qedi_conn->list_lock);
+               qedi_clear_task_idx(qedi, cmd->task_id);
+       }
+
+done:
+       __iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr, bdq_data, pdu_len);
+
+       spin_unlock_bh(&session->back_lock);
+       return tgt_async_nop;
+}
+
+static void qedi_process_async_mesg(struct qedi_ctx *qedi,
+                                   union iscsi_cqe *cqe,
+                                   struct iscsi_task *task,
+                                   struct qedi_conn *qedi_conn,
+                                   u16 que_idx)
+{
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_session *session = conn->session;
+       struct iscsi_async_msg_hdr *cqe_async_msg;
+       struct iscsi_async *resp_hdr;
+       u32 lun[2];
+       u32 pdu_len, num_bdqs;
+       char bdq_data[QEDI_BDQ_BUF_SIZE];
+       unsigned long flags;
+
+       spin_lock_bh(&session->back_lock);
+
+       cqe_async_msg = &cqe->cqe_common.iscsi_hdr.async_msg;
+       pdu_len = cqe_async_msg->hdr_second_dword &
+               ISCSI_ASYNC_MSG_HDR_DATA_SEG_LEN_MASK;
+       num_bdqs = pdu_len / QEDI_BDQ_BUF_SIZE;
+
+       if (cqe->cqe_common.cqe_type == ISCSI_CQE_TYPE_UNSOLICITED) {
+               spin_lock_irqsave(&qedi->hba_lock, flags);
+               qedi_unsol_pdu_adjust_bdq(qedi, &cqe->cqe_unsolicited,
+                                         pdu_len, num_bdqs, bdq_data);
+               spin_unlock_irqrestore(&qedi->hba_lock, flags);
+       }
+
+       resp_hdr = (struct iscsi_async *)&qedi_conn->gen_pdu.resp_hdr;
+       memset(resp_hdr, 0, sizeof(struct iscsi_hdr));
+       resp_hdr->opcode = cqe_async_msg->opcode;
+       resp_hdr->flags = 0x80;
+
+       lun[0] = cpu_to_be32(cqe_async_msg->lun.lo);
+       lun[1] = cpu_to_be32(cqe_async_msg->lun.hi);
+       memcpy(&resp_hdr->lun, lun, sizeof(struct scsi_lun));
+       resp_hdr->exp_cmdsn = cpu_to_be32(cqe_async_msg->exp_cmd_sn);
+       resp_hdr->max_cmdsn = cpu_to_be32(cqe_async_msg->max_cmd_sn);
+       resp_hdr->statsn = cpu_to_be32(cqe_async_msg->stat_sn);
+
+       resp_hdr->async_event = cqe_async_msg->async_event;
+       resp_hdr->async_vcode = cqe_async_msg->async_vcode;
+
+       resp_hdr->param1 = cpu_to_be16(cqe_async_msg->param1_rsrv);
+       resp_hdr->param2 = cpu_to_be16(cqe_async_msg->param2_rsrv);
+       resp_hdr->param3 = cpu_to_be16(cqe_async_msg->param3_rsrv);
+
+       __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr, bdq_data,
+                            pdu_len);
+
+       spin_unlock_bh(&session->back_lock);
+}
+
+static void qedi_process_reject_mesg(struct qedi_ctx *qedi,
+                                    union iscsi_cqe *cqe,
+                                    struct iscsi_task *task,
+                                    struct qedi_conn *qedi_conn,
+                                    uint16_t que_idx)
+{
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_session *session = conn->session;
+       struct iscsi_reject_hdr *cqe_reject;
+       struct iscsi_reject *hdr;
+       u32 pld_len, num_bdqs;
+       unsigned long flags;
+
+       spin_lock_bh(&session->back_lock);
+       cqe_reject = &cqe->cqe_common.iscsi_hdr.reject;
+       pld_len = cqe_reject->hdr_second_dword &
+                 ISCSI_REJECT_HDR_DATA_SEG_LEN_MASK;
+       num_bdqs = pld_len / QEDI_BDQ_BUF_SIZE;
+
+       if (cqe->cqe_common.cqe_type == ISCSI_CQE_TYPE_UNSOLICITED) {
+               spin_lock_irqsave(&qedi->hba_lock, flags);
+               qedi_unsol_pdu_adjust_bdq(qedi, &cqe->cqe_unsolicited,
+                                         pld_len, num_bdqs, conn->data);
+               spin_unlock_irqrestore(&qedi->hba_lock, flags);
+       }
+       hdr = (struct iscsi_reject *)&qedi_conn->gen_pdu.resp_hdr;
+       memset(hdr, 0, sizeof(struct iscsi_hdr));
+       hdr->opcode = cqe_reject->opcode;
+       hdr->reason = cqe_reject->hdr_reason;
+       hdr->flags = cqe_reject->hdr_flags;
+       hton24(hdr->dlength, (cqe_reject->hdr_second_dword &
+                             ISCSI_REJECT_HDR_DATA_SEG_LEN_MASK));
+       hdr->max_cmdsn = cpu_to_be32(cqe_reject->max_cmd_sn);
+       hdr->exp_cmdsn = cpu_to_be32(cqe_reject->exp_cmd_sn);
+       hdr->statsn = cpu_to_be32(cqe_reject->stat_sn);
+       hdr->ffffffff = cpu_to_be32(0xffffffff);
+
+       __iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr,
+                            conn->data, pld_len);
+       spin_unlock_bh(&session->back_lock);
+}
+
+static void qedi_scsi_completion(struct qedi_ctx *qedi,
+                                union iscsi_cqe *cqe,
+                                struct iscsi_task *task,
+                                struct iscsi_conn *conn)
+{
+       struct scsi_cmnd *sc_cmd;
+       struct qedi_cmd *cmd = task->dd_data;
+       struct iscsi_session *session = conn->session;
+       struct iscsi_scsi_rsp *hdr;
+       struct iscsi_data_in_hdr *cqe_data_in;
+       int datalen = 0;
+       struct qedi_conn *qedi_conn;
+       u32 iscsi_cid;
+       bool mark_cmd_node_deleted = false;
+       u8 cqe_err_bits = 0;
+
+       iscsi_cid  = cqe->cqe_common.conn_id;
+       qedi_conn = qedi->cid_que.conn_cid_tbl[iscsi_cid];
+
+       cqe_data_in = &cqe->cqe_common.iscsi_hdr.data_in;
+       cqe_err_bits =
+               cqe->cqe_common.error_bitmap.error_bits.cqe_error_status_bits;
+
+       spin_lock_bh(&session->back_lock);
+       /* get the scsi command */
+       sc_cmd = cmd->scsi_cmd;
+
+       if (!sc_cmd) {
+               QEDI_WARN(&qedi->dbg_ctx, "sc_cmd is NULL!\n");
+               goto error;
+       }
+
+       if (!sc_cmd->SCp.ptr) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "SCp.ptr is NULL, returned in another context.\n");
+               goto error;
+       }
+
+       if (!sc_cmd->request) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "sc_cmd->request is NULL, sc_cmd=%p.\n",
+                         sc_cmd);
+               goto error;
+       }
+
+       if (!sc_cmd->request->special) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "request->special is NULL so request not valid, sc_cmd=%p.\n",
+                         sc_cmd);
+               goto error;
+       }
+
+       if (!sc_cmd->request->q) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "request->q is NULL so request is not valid, sc_cmd=%p.\n",
+                         sc_cmd);
+               goto error;
+       }
+
+       qedi_iscsi_unmap_sg_list(cmd);
+
+       hdr = (struct iscsi_scsi_rsp *)task->hdr;
+       hdr->opcode = cqe_data_in->opcode;
+       hdr->max_cmdsn = cpu_to_be32(cqe_data_in->max_cmd_sn);
+       hdr->exp_cmdsn = cpu_to_be32(cqe_data_in->exp_cmd_sn);
+       hdr->itt = build_itt(cqe->cqe_solicited.itid, conn->session->age);
+       hdr->response = cqe_data_in->reserved1;
+       hdr->cmd_status = cqe_data_in->status_rsvd;
+       hdr->flags = cqe_data_in->flags;
+       hdr->residual_count = cpu_to_be32(cqe_data_in->residual_count);
+
+       if (hdr->cmd_status == SAM_STAT_CHECK_CONDITION) {
+               datalen = cqe_data_in->reserved2 &
+                         ISCSI_COMMON_HDR_DATA_SEG_LEN_MASK;
+               memcpy((char *)conn->data, (char *)cmd->sense_buffer, datalen);
+       }
+
+       /* If f/w reports data underrun err then set residual to IO transfer
+        * length, set Underrun flag and clear Overrun flag explicitly
+        */
+       if (unlikely(cqe_err_bits &&
+                    GET_FIELD(cqe_err_bits, CQE_ERROR_BITMAP_UNDER_RUN_ERR))) {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                         "Under flow itt=0x%x proto flags=0x%x tid=0x%x cid 0x%x fw resid 0x%x sc dlen 0x%x\n",
+                         hdr->itt, cqe_data_in->flags, cmd->task_id,
+                         qedi_conn->iscsi_conn_id, hdr->residual_count,
+                         scsi_bufflen(sc_cmd));
+               hdr->residual_count = cpu_to_be32(scsi_bufflen(sc_cmd));
+               hdr->flags |= ISCSI_FLAG_CMD_UNDERFLOW;
+               hdr->flags &= (~ISCSI_FLAG_CMD_OVERFLOW);
+       }
+
+       spin_lock(&qedi_conn->list_lock);
+       if (likely(cmd->io_cmd_in_list)) {
+               cmd->io_cmd_in_list = false;
+               list_del_init(&cmd->io_cmd);
+               qedi_conn->active_cmd_count--;
+               mark_cmd_node_deleted = true;
+       }
+       spin_unlock(&qedi_conn->list_lock);
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
+                 "Freeing tid=0x%x for cid=0x%x\n",
+                 cmd->task_id, qedi_conn->iscsi_conn_id);
+       cmd->state = RESPONSE_RECEIVED;
+       if (qedi_io_tracing)
+               qedi_trace_io(qedi, task, cmd->task_id, QEDI_IO_TRACE_RSP);
+
+       qedi_clear_task_idx(qedi, cmd->task_id);
+       __iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr,
+                            conn->data, datalen);
+error:
+       spin_unlock_bh(&session->back_lock);
+}
+
+static void qedi_mtask_completion(struct qedi_ctx *qedi,
+                                 union iscsi_cqe *cqe,
+                                 struct iscsi_task *task,
+                                 struct qedi_conn *conn, uint16_t que_idx)
+{
+       struct iscsi_conn *iscsi_conn;
+       u32 hdr_opcode;
+
+       hdr_opcode = cqe->cqe_common.iscsi_hdr.common.hdr_first_byte;
+       iscsi_conn = conn->cls_conn->dd_data;
+
+       switch (hdr_opcode) {
+       case ISCSI_OPCODE_SCSI_RESPONSE:
+       case ISCSI_OPCODE_DATA_IN:
+               qedi_scsi_completion(qedi, cqe, task, iscsi_conn);
+               break;
+       case ISCSI_OPCODE_LOGIN_RESPONSE:
+               qedi_process_login_resp(qedi, cqe, task, conn);
+               break;
+       case ISCSI_OPCODE_TMF_RESPONSE:
+               qedi_process_tmf_resp(qedi, cqe, task, conn);
+               break;
+       case ISCSI_OPCODE_TEXT_RESPONSE:
+               qedi_process_text_resp(qedi, cqe, task, conn);
+               break;
+       case ISCSI_OPCODE_LOGOUT_RESPONSE:
+               qedi_process_logout_resp(qedi, cqe, task, conn);
+               break;
+       case ISCSI_OPCODE_NOP_IN:
+               qedi_process_nopin_mesg(qedi, cqe, task, conn, que_idx);
+               break;
+       default:
+               QEDI_ERR(&qedi->dbg_ctx, "unknown opcode\n");
+       }
+}
+
+static void qedi_process_nopin_local_cmpl(struct qedi_ctx *qedi,
+                                         struct iscsi_cqe_solicited *cqe,
+                                         struct iscsi_task *task,
+                                         struct qedi_conn *qedi_conn)
+{
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_session *session = conn->session;
+       struct qedi_cmd *cmd = task->dd_data;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_UNSOL,
+                 "itid=0x%x, cmd task id=0x%x\n",
+                 cqe->itid, cmd->task_id);
+
+       cmd->state = RESPONSE_RECEIVED;
+       qedi_clear_task_idx(qedi, cmd->task_id);
+
+       spin_lock_bh(&session->back_lock);
+       __iscsi_put_task(task);
+       spin_unlock_bh(&session->back_lock);
+}
+
+static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi,
+                                         struct iscsi_cqe_solicited *cqe,
+                                         struct iscsi_task *task,
+                                         struct iscsi_conn *conn)
+{
+       struct qedi_work_map *work, *work_tmp;
+       u32 proto_itt = cqe->itid;
+       u32 ptmp_itt = 0;
+       itt_t protoitt = 0;
+       int found = 0;
+       struct qedi_cmd *qedi_cmd = NULL;
+       u32 rtid = 0;
+       u32 iscsi_cid;
+       struct qedi_conn *qedi_conn;
+       struct qedi_cmd *cmd_new, *dbg_cmd;
+       struct iscsi_task *mtask;
+       struct iscsi_tm *tmf_hdr = NULL;
+
+       iscsi_cid = cqe->conn_id;
+       qedi_conn = qedi->cid_que.conn_cid_tbl[iscsi_cid];
+
+       /* Based on this itt get the corresponding qedi_cmd */
+       spin_lock_bh(&qedi_conn->tmf_work_lock);
+       list_for_each_entry_safe(work, work_tmp, &qedi_conn->tmf_work_list,
+                                list) {
+               if (work->rtid == proto_itt) {
+                       /* We found the command */
+                       qedi_cmd = work->qedi_cmd;
+                       if (!qedi_cmd->list_tmf_work) {
+                               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                                         "TMF work not found, cqe->tid=0x%x, cid=0x%x\n",
+                                         proto_itt, qedi_conn->iscsi_conn_id);
+                               WARN_ON(1);
+                       }
+                       found = 1;
+                       mtask = qedi_cmd->task;
+                       tmf_hdr = (struct iscsi_tm *)mtask->hdr;
+                       rtid = work->rtid;
+
+                       list_del_init(&work->list);
+                       kfree(work);
+                       qedi_cmd->list_tmf_work = NULL;
+               }
+       }
+       spin_unlock_bh(&qedi_conn->tmf_work_lock);
+
+       if (found) {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                         "TMF work, cqe->tid=0x%x, tmf flags=0x%x, cid=0x%x\n",
+                         proto_itt, tmf_hdr->flags, qedi_conn->iscsi_conn_id);
+
+               if ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+                   ISCSI_TM_FUNC_ABORT_TASK) {
+                       spin_lock_bh(&conn->session->back_lock);
+
+                       protoitt = build_itt(get_itt(tmf_hdr->rtt),
+                                            conn->session->age);
+                       task = iscsi_itt_to_task(conn, protoitt);
+
+                       spin_unlock_bh(&conn->session->back_lock);
+
+                       if (!task) {
+                               QEDI_NOTICE(&qedi->dbg_ctx,
+                                           "IO task completed, tmf rtt=0x%x, cid=0x%x\n",
+                                           get_itt(tmf_hdr->rtt),
+                                           qedi_conn->iscsi_conn_id);
+                               return;
+                       }
+
+                       dbg_cmd = task->dd_data;
+
+                       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                                 "Abort tmf rtt=0x%x, i/o itt=0x%x, i/o tid=0x%x, cid=0x%x\n",
+                                 get_itt(tmf_hdr->rtt), get_itt(task->itt),
+                                 dbg_cmd->task_id, qedi_conn->iscsi_conn_id);
+
+                       if (qedi_cmd->state == CLEANUP_WAIT_FAILED)
+                               qedi_cmd->state = CLEANUP_RECV;
+
+                       qedi_clear_task_idx(qedi_conn->qedi, rtid);
+
+                       spin_lock(&qedi_conn->list_lock);
+                       list_del_init(&dbg_cmd->io_cmd);
+                       qedi_conn->active_cmd_count--;
+                       spin_unlock(&qedi_conn->list_lock);
+                       qedi_cmd->state = CLEANUP_RECV;
+                       wake_up_interruptible(&qedi_conn->wait_queue);
+               }
+       } else if (qedi_conn->cmd_cleanup_req > 0) {
+               spin_lock_bh(&conn->session->back_lock);
+               qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt);
+               protoitt = build_itt(ptmp_itt, conn->session->age);
+               task = iscsi_itt_to_task(conn, protoitt);
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                         "cleanup io itid=0x%x, protoitt=0x%x, cmd_cleanup_cmpl=%d, cid=0x%x\n",
+                         cqe->itid, protoitt, qedi_conn->cmd_cleanup_cmpl,
+                         qedi_conn->iscsi_conn_id);
+
+               spin_unlock_bh(&conn->session->back_lock);
+               if (!task) {
+                       QEDI_NOTICE(&qedi->dbg_ctx,
+                                   "task is null, itid=0x%x, cid=0x%x\n",
+                                   cqe->itid, qedi_conn->iscsi_conn_id);
+                       return;
+               }
+               qedi_conn->cmd_cleanup_cmpl++;
+               wake_up(&qedi_conn->wait_queue);
+               cmd_new = task->dd_data;
+
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
+                         "Freeing tid=0x%x for cid=0x%x\n",
+                         cqe->itid, qedi_conn->iscsi_conn_id);
+               qedi_clear_task_idx(qedi_conn->qedi, cqe->itid);
+
+       } else {
+               qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt);
+               protoitt = build_itt(ptmp_itt, conn->session->age);
+               task = iscsi_itt_to_task(conn, protoitt);
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x, task=%p\n",
+                        protoitt, cqe->itid, qedi_conn->iscsi_conn_id, task);
+               WARN_ON(1);
+       }
+}
+
+void qedi_fp_process_cqes(struct qedi_work *work)
+{
+       struct qedi_ctx *qedi = work->qedi;
+       union iscsi_cqe *cqe = &work->cqe;
+       struct iscsi_task *task = NULL;
+       struct iscsi_nopout *nopout_hdr;
+       struct qedi_conn *q_conn;
+       struct iscsi_conn *conn;
+       struct qedi_cmd *qedi_cmd;
+       u32 comp_type;
+       u32 iscsi_cid;
+       u32 hdr_opcode;
+       u16 que_idx = work->que_idx;
+       u8 cqe_err_bits = 0;
+
+       comp_type = cqe->cqe_common.cqe_type;
+       hdr_opcode = cqe->cqe_common.iscsi_hdr.common.hdr_first_byte;
+       cqe_err_bits =
+               cqe->cqe_common.error_bitmap.error_bits.cqe_error_status_bits;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                 "fw_cid=0x%x, cqe type=0x%x, opcode=0x%x\n",
+                 cqe->cqe_common.conn_id, comp_type, hdr_opcode);
+
+       if (comp_type >= MAX_ISCSI_CQES_TYPE) {
+               QEDI_WARN(&qedi->dbg_ctx, "Invalid CqE type\n");
+               return;
+       }
+
+       iscsi_cid  = cqe->cqe_common.conn_id;
+       q_conn = qedi->cid_que.conn_cid_tbl[iscsi_cid];
+       if (!q_conn) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "Session no longer exists for cid=0x%x!!\n",
+                         iscsi_cid);
+               return;
+       }
+
+       conn = q_conn->cls_conn->dd_data;
+
+       if (unlikely(cqe_err_bits &&
+                    GET_FIELD(cqe_err_bits,
+                              CQE_ERROR_BITMAP_DATA_DIGEST_ERR))) {
+               iscsi_conn_failure(conn, ISCSI_ERR_DATA_DGST);
+               return;
+       }
+
+       switch (comp_type) {
+       case ISCSI_CQE_TYPE_SOLICITED:
+       case ISCSI_CQE_TYPE_SOLICITED_WITH_SENSE:
+               qedi_cmd = container_of(work, struct qedi_cmd, cqe_work);
+               task = qedi_cmd->task;
+               if (!task) {
+                       QEDI_WARN(&qedi->dbg_ctx, "task is NULL\n");
+                       return;
+               }
+
+               /* Process NOPIN local completion */
+               nopout_hdr = (struct iscsi_nopout *)task->hdr;
+               if ((nopout_hdr->itt == RESERVED_ITT) &&
+                   (cqe->cqe_solicited.itid != (u16)RESERVED_ITT)) {
+                       qedi_process_nopin_local_cmpl(qedi, &cqe->cqe_solicited,
+                                                     task, q_conn);
+               } else {
+                       cqe->cqe_solicited.itid =
+                                              qedi_get_itt(cqe->cqe_solicited);
+                       /* Process other solicited responses */
+                       qedi_mtask_completion(qedi, cqe, task, q_conn, que_idx);
+               }
+               break;
+       case ISCSI_CQE_TYPE_UNSOLICITED:
+               switch (hdr_opcode) {
+               case ISCSI_OPCODE_NOP_IN:
+                       qedi_process_nopin_mesg(qedi, cqe, task, q_conn,
+                                               que_idx);
+                       break;
+               case ISCSI_OPCODE_ASYNC_MSG:
+                       qedi_process_async_mesg(qedi, cqe, task, q_conn,
+                                               que_idx);
+                       break;
+               case ISCSI_OPCODE_REJECT:
+                       qedi_process_reject_mesg(qedi, cqe, task, q_conn,
+                                                que_idx);
+                       break;
+               }
+               goto exit_fp_process;
+       case ISCSI_CQE_TYPE_DUMMY:
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, "Dummy CqE\n");
+               goto exit_fp_process;
+       case ISCSI_CQE_TYPE_TASK_CLEANUP:
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, "CleanUp CqE\n");
+               qedi_process_cmd_cleanup_resp(qedi, &cqe->cqe_solicited, task,
+                                             conn);
+               goto exit_fp_process;
+       default:
+               QEDI_ERR(&qedi->dbg_ctx, "Error cqe.\n");
+               break;
+       }
+
+exit_fp_process:
+       return;
+}
+
+static void qedi_add_to_sq(struct qedi_conn *qedi_conn, struct iscsi_task *task,
+                          u16 tid, uint16_t ptu_invalidate, int is_cleanup)
+{
+       struct iscsi_wqe *wqe;
+       struct iscsi_wqe_field *cont_field;
+       struct qedi_endpoint *ep;
+       struct scsi_cmnd *sc = task->sc;
+       struct iscsi_login_req *login_hdr;
+       struct qedi_cmd *cmd = task->dd_data;
+
+       login_hdr = (struct iscsi_login_req *)task->hdr;
+       ep = qedi_conn->ep;
+       wqe = &ep->sq[ep->sq_prod_idx];
+
+       memset(wqe, 0, sizeof(*wqe));
+
+       ep->sq_prod_idx++;
+       ep->fw_sq_prod_idx++;
+       if (ep->sq_prod_idx == QEDI_SQ_SIZE)
+               ep->sq_prod_idx = 0;
+
+       if (is_cleanup) {
+               SET_FIELD(wqe->flags, ISCSI_WQE_WQE_TYPE,
+                         ISCSI_WQE_TYPE_TASK_CLEANUP);
+               wqe->task_id = tid;
+               return;
+       }
+
+       if (ptu_invalidate) {
+               SET_FIELD(wqe->flags, ISCSI_WQE_PTU_INVALIDATE,
+                         ISCSI_WQE_SET_PTU_INVALIDATE);
+       }
+
+       cont_field = &wqe->cont_prevtid_union.cont_field;
+
+       switch (task->hdr->opcode & ISCSI_OPCODE_MASK) {
+       case ISCSI_OP_LOGIN:
+       case ISCSI_OP_TEXT:
+               SET_FIELD(wqe->flags, ISCSI_WQE_WQE_TYPE,
+                         ISCSI_WQE_TYPE_MIDDLE_PATH);
+               SET_FIELD(wqe->flags, ISCSI_WQE_NUM_FAST_SGES,
+                         1);
+               cont_field->contlen_cdbsize_field = ntoh24(login_hdr->dlength);
+               break;
+       case ISCSI_OP_LOGOUT:
+       case ISCSI_OP_NOOP_OUT:
+       case ISCSI_OP_SCSI_TMFUNC:
+                SET_FIELD(wqe->flags, ISCSI_WQE_WQE_TYPE,
+                          ISCSI_WQE_TYPE_NORMAL);
+               break;
+       default:
+               if (!sc)
+                       break;
+
+               SET_FIELD(wqe->flags, ISCSI_WQE_WQE_TYPE,
+                         ISCSI_WQE_TYPE_NORMAL);
+               cont_field->contlen_cdbsize_field =
+                               (sc->sc_data_direction == DMA_TO_DEVICE) ?
+                               scsi_bufflen(sc) : 0;
+               if (cmd->use_slowpath)
+                       SET_FIELD(wqe->flags, ISCSI_WQE_NUM_FAST_SGES, 0);
+               else
+                       SET_FIELD(wqe->flags, ISCSI_WQE_NUM_FAST_SGES,
+                                 (sc->sc_data_direction ==
+                                  DMA_TO_DEVICE) ?
+                                 min((u16)QEDI_FAST_SGE_COUNT,
+                                     (u16)cmd->io_tbl.sge_valid) : 0);
+               break;
+       }
+
+       wqe->task_id = tid;
+       /* Make sure SQ data is coherent */
+       wmb();
+}
+
+static void qedi_ring_doorbell(struct qedi_conn *qedi_conn)
+{
+       struct iscsi_db_data dbell = { 0 };
+
+       dbell.agg_flags = 0;
+
+       dbell.params |= DB_DEST_XCM << ISCSI_DB_DATA_DEST_SHIFT;
+       dbell.params |= DB_AGG_CMD_SET << ISCSI_DB_DATA_AGG_CMD_SHIFT;
+       dbell.params |=
+                  DQ_XCM_ISCSI_SQ_PROD_CMD << ISCSI_DB_DATA_AGG_VAL_SEL_SHIFT;
+
+       dbell.sq_prod = qedi_conn->ep->fw_sq_prod_idx;
+       writel(*(u32 *)&dbell, qedi_conn->ep->p_doorbell);
+
+       /* Make sure fw write idx is coherent, and include both memory barriers
+        * as a failsafe as for some architectures the call is the same but on
+        * others they are two different assembly operations.
+        */
+       wmb();
+       mmiowb();
+       QEDI_INFO(&qedi_conn->qedi->dbg_ctx, QEDI_LOG_MP_REQ,
+                 "prod_idx=0x%x, fw_prod_idx=0x%x, cid=0x%x\n",
+                 qedi_conn->ep->sq_prod_idx, qedi_conn->ep->fw_sq_prod_idx,
+                 qedi_conn->iscsi_conn_id);
+}
+
+int qedi_send_iscsi_login(struct qedi_conn *qedi_conn,
+                         struct iscsi_task *task)
+{
+       struct qedi_ctx *qedi = qedi_conn->qedi;
+       struct iscsi_task_context *fw_task_ctx;
+       struct iscsi_login_req *login_hdr;
+       struct iscsi_login_req_hdr *fw_login_req = NULL;
+       struct iscsi_cached_sge_ctx *cached_sge = NULL;
+       struct iscsi_sge *single_sge = NULL;
+       struct iscsi_sge *req_sge = NULL;
+       struct iscsi_sge *resp_sge = NULL;
+       struct qedi_cmd *qedi_cmd;
+       s16 ptu_invalidate = 0;
+       s16 tid = 0;
+
+       req_sge = (struct iscsi_sge *)qedi_conn->gen_pdu.req_bd_tbl;
+       resp_sge = (struct iscsi_sge *)qedi_conn->gen_pdu.resp_bd_tbl;
+       qedi_cmd = (struct qedi_cmd *)task->dd_data;
+       login_hdr = (struct iscsi_login_req *)task->hdr;
+
+       tid = qedi_get_task_idx(qedi);
+       if (tid == -1)
+               return -ENOMEM;
+
+       fw_task_ctx = qedi_get_task_mem(&qedi->tasks, tid);
+       memset(fw_task_ctx, 0, sizeof(struct iscsi_task_context));
+
+       qedi_cmd->task_id = tid;
+
+       /* Ystorm context */
+       fw_login_req = &fw_task_ctx->ystorm_st_context.pdu_hdr.login_req;
+       fw_login_req->opcode = login_hdr->opcode;
+       fw_login_req->version_min = login_hdr->min_version;
+       fw_login_req->version_max = login_hdr->max_version;
+       fw_login_req->flags_attr = login_hdr->flags;
+       fw_login_req->isid_tabc = *((u16 *)login_hdr->isid + 2);
+       fw_login_req->isid_d = *((u32 *)login_hdr->isid);
+       fw_login_req->tsih = login_hdr->tsih;
+       qedi_update_itt_map(qedi, tid, task->itt, qedi_cmd);
+       fw_login_req->itt = qedi_set_itt(tid, get_itt(task->itt));
+       fw_login_req->cid = qedi_conn->iscsi_conn_id;
+       fw_login_req->cmd_sn = be32_to_cpu(login_hdr->cmdsn);
+       fw_login_req->exp_stat_sn = be32_to_cpu(login_hdr->exp_statsn);
+       fw_login_req->exp_stat_sn = 0;
+
+       if (qedi->tid_reuse_count[tid] == QEDI_MAX_TASK_NUM) {
+               ptu_invalidate = 1;
+               qedi->tid_reuse_count[tid] = 0;
+       }
+
+       fw_task_ctx->ystorm_st_context.state.reuse_count =
+                                               qedi->tid_reuse_count[tid];
+       fw_task_ctx->mstorm_st_context.reuse_count =
+                                               qedi->tid_reuse_count[tid]++;
+       cached_sge =
+              &fw_task_ctx->ystorm_st_context.state.sgl_ctx_union.cached_sge;
+       cached_sge->sge.sge_len = req_sge->sge_len;
+       cached_sge->sge.sge_addr.lo = (u32)(qedi_conn->gen_pdu.req_dma_addr);
+       cached_sge->sge.sge_addr.hi =
+                            (u32)((u64)qedi_conn->gen_pdu.req_dma_addr >> 32);
+
+       /* Mstorm context */
+       single_sge = &fw_task_ctx->mstorm_st_context.sgl_union.single_sge;
+       fw_task_ctx->mstorm_st_context.task_type = 0x2;
+       fw_task_ctx->mstorm_ag_context.task_cid = (u16)qedi_conn->iscsi_conn_id;
+       single_sge->sge_addr.lo = resp_sge->sge_addr.lo;
+       single_sge->sge_addr.hi = resp_sge->sge_addr.hi;
+       single_sge->sge_len = resp_sge->sge_len;
+
+       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                 ISCSI_MFLAGS_SINGLE_SGE, 1);
+       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                 ISCSI_MFLAGS_SLOW_IO, 0);
+       fw_task_ctx->mstorm_st_context.sgl_size = 1;
+       fw_task_ctx->mstorm_st_context.rem_task_size = resp_sge->sge_len;
+
+       /* Ustorm context */
+       fw_task_ctx->ustorm_st_context.rem_rcv_len = resp_sge->sge_len;
+       fw_task_ctx->ustorm_st_context.exp_data_transfer_len =
+                                               ntoh24(login_hdr->dlength);
+       fw_task_ctx->ustorm_st_context.exp_data_sn = 0;
+       fw_task_ctx->ustorm_st_context.cq_rss_number = 0;
+       fw_task_ctx->ustorm_st_context.task_type = 0x2;
+       fw_task_ctx->ustorm_ag_context.icid = (u16)qedi_conn->iscsi_conn_id;
+       fw_task_ctx->ustorm_ag_context.exp_data_acked =
+                                                ntoh24(login_hdr->dlength);
+       SET_FIELD(fw_task_ctx->ustorm_ag_context.flags1,
+                 USTORM_ISCSI_TASK_AG_CTX_R2T2RECV, 1);
+       SET_FIELD(fw_task_ctx->ustorm_st_context.flags,
+                 USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP, 0);
+
+       spin_lock(&qedi_conn->list_lock);
+       list_add_tail(&qedi_cmd->io_cmd, &qedi_conn->active_cmd_list);
+       qedi_cmd->io_cmd_in_list = true;
+       qedi_conn->active_cmd_count++;
+       spin_unlock(&qedi_conn->list_lock);
+
+       qedi_add_to_sq(qedi_conn, task, tid, ptu_invalidate, false);
+       qedi_ring_doorbell(qedi_conn);
+       return 0;
+}
+
+int qedi_send_iscsi_logout(struct qedi_conn *qedi_conn,
+                          struct iscsi_task *task)
+{
+       struct qedi_ctx *qedi = qedi_conn->qedi;
+       struct iscsi_logout_req_hdr *fw_logout_req = NULL;
+       struct iscsi_task_context *fw_task_ctx = NULL;
+       struct iscsi_logout *logout_hdr = NULL;
+       struct qedi_cmd *qedi_cmd = NULL;
+       s16  tid = 0;
+       s16 ptu_invalidate = 0;
+
+       qedi_cmd = (struct qedi_cmd *)task->dd_data;
+       logout_hdr = (struct iscsi_logout *)task->hdr;
+
+       tid = qedi_get_task_idx(qedi);
+       if (tid == -1)
+               return -ENOMEM;
+
+       fw_task_ctx = qedi_get_task_mem(&qedi->tasks, tid);
+
+       memset(fw_task_ctx, 0, sizeof(struct iscsi_task_context));
+       qedi_cmd->task_id = tid;
+
+       /* Ystorm context */
+       fw_logout_req = &fw_task_ctx->ystorm_st_context.pdu_hdr.logout_req;
+       fw_logout_req->opcode = ISCSI_OPCODE_LOGOUT_REQUEST;
+       fw_logout_req->reason_code = 0x80 | logout_hdr->flags;
+       qedi_update_itt_map(qedi, tid, task->itt, qedi_cmd);
+       fw_logout_req->itt = qedi_set_itt(tid, get_itt(task->itt));
+       fw_logout_req->exp_stat_sn = be32_to_cpu(logout_hdr->exp_statsn);
+       fw_logout_req->cmd_sn = be32_to_cpu(logout_hdr->cmdsn);
+
+       if (qedi->tid_reuse_count[tid] == QEDI_MAX_TASK_NUM) {
+               ptu_invalidate = 1;
+               qedi->tid_reuse_count[tid] = 0;
+       }
+       fw_task_ctx->ystorm_st_context.state.reuse_count =
+                                                 qedi->tid_reuse_count[tid];
+       fw_task_ctx->mstorm_st_context.reuse_count =
+                                               qedi->tid_reuse_count[tid]++;
+       fw_logout_req->cid = qedi_conn->iscsi_conn_id;
+       fw_task_ctx->ystorm_st_context.state.buffer_offset[0] = 0;
+
+       /* Mstorm context */
+       fw_task_ctx->mstorm_st_context.task_type = ISCSI_TASK_TYPE_MIDPATH;
+       fw_task_ctx->mstorm_ag_context.task_cid = (u16)qedi_conn->iscsi_conn_id;
+
+       /* Ustorm context */
+       fw_task_ctx->ustorm_st_context.rem_rcv_len = 0;
+       fw_task_ctx->ustorm_st_context.exp_data_transfer_len = 0;
+       fw_task_ctx->ustorm_st_context.exp_data_sn = 0;
+       fw_task_ctx->ustorm_st_context.task_type =  ISCSI_TASK_TYPE_MIDPATH;
+       fw_task_ctx->ustorm_st_context.cq_rss_number = 0;
+
+       SET_FIELD(fw_task_ctx->ustorm_st_context.flags,
+                 USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP, 0);
+       SET_FIELD(fw_task_ctx->ustorm_st_context.reg1.reg1_map,
+                 ISCSI_REG1_NUM_FAST_SGES, 0);
+
+       fw_task_ctx->ustorm_ag_context.icid = (u16)qedi_conn->iscsi_conn_id;
+       SET_FIELD(fw_task_ctx->ustorm_ag_context.flags1,
+                 USTORM_ISCSI_TASK_AG_CTX_R2T2RECV, 1);
+
+       spin_lock(&qedi_conn->list_lock);
+       list_add_tail(&qedi_cmd->io_cmd, &qedi_conn->active_cmd_list);
+       qedi_cmd->io_cmd_in_list = true;
+       qedi_conn->active_cmd_count++;
+       spin_unlock(&qedi_conn->list_lock);
+
+       qedi_add_to_sq(qedi_conn, task, tid, ptu_invalidate, false);
+       qedi_ring_doorbell(qedi_conn);
+
+       return 0;
+}
+
+int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn,
+                       struct iscsi_task *task, bool in_recovery)
+{
+       int rval;
+       struct iscsi_task *ctask;
+       struct qedi_cmd *cmd, *cmd_tmp;
+       struct iscsi_tm *tmf_hdr;
+       unsigned int lun = 0;
+       bool lun_reset = false;
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_session *session = conn->session;
+
+       /* From recovery, task is NULL or from tmf resp valid task */
+       if (task) {
+               tmf_hdr = (struct iscsi_tm *)task->hdr;
+
+               if ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+                       ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) {
+                       lun_reset = true;
+                       lun = scsilun_to_int(&tmf_hdr->lun);
+               }
+       }
+
+       qedi_conn->cmd_cleanup_req = 0;
+       qedi_conn->cmd_cleanup_cmpl = 0;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                 "active_cmd_count=%d, cid=0x%x, in_recovery=%d, lun_reset=%d\n",
+                 qedi_conn->active_cmd_count, qedi_conn->iscsi_conn_id,
+                 in_recovery, lun_reset);
+
+       if (lun_reset)
+               spin_lock_bh(&session->back_lock);
+
+       spin_lock(&qedi_conn->list_lock);
+
+       list_for_each_entry_safe(cmd, cmd_tmp, &qedi_conn->active_cmd_list,
+                                io_cmd) {
+               ctask = cmd->task;
+               if (ctask == task)
+                       continue;
+
+               if (lun_reset) {
+                       if (cmd->scsi_cmd && cmd->scsi_cmd->device) {
+                               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                                         "tid=0x%x itt=0x%x scsi_cmd_ptr=%p device=%p task_state=%d cmd_state=0%x cid=0x%x\n",
+                                         cmd->task_id, get_itt(ctask->itt),
+                                         cmd->scsi_cmd, cmd->scsi_cmd->device,
+                                         ctask->state, cmd->state,
+                                         qedi_conn->iscsi_conn_id);
+                               if (cmd->scsi_cmd->device->lun != lun)
+                                       continue;
+                       }
+               }
+               qedi_conn->cmd_cleanup_req++;
+               qedi_iscsi_cleanup_task(ctask, true);
+
+               list_del_init(&cmd->io_cmd);
+               qedi_conn->active_cmd_count--;
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "Deleted active cmd list node io_cmd=%p, cid=0x%x\n",
+                         &cmd->io_cmd, qedi_conn->iscsi_conn_id);
+       }
+
+       spin_unlock(&qedi_conn->list_lock);
+
+       if (lun_reset)
+               spin_unlock_bh(&session->back_lock);
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                 "cmd_cleanup_req=%d, cid=0x%x\n",
+                 qedi_conn->cmd_cleanup_req,
+                 qedi_conn->iscsi_conn_id);
+
+       rval  = wait_event_interruptible_timeout(qedi_conn->wait_queue,
+                                                ((qedi_conn->cmd_cleanup_req ==
+                                                qedi_conn->cmd_cleanup_cmpl) ||
+                                                qedi_conn->ep),
+                                                5 * HZ);
+       if (rval) {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                         "i/o cmd_cleanup_req=%d, equal to cmd_cleanup_cmpl=%d, cid=0x%x\n",
+                         qedi_conn->cmd_cleanup_req,
+                         qedi_conn->cmd_cleanup_cmpl,
+                         qedi_conn->iscsi_conn_id);
+
+               return 0;
+       }
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                 "i/o cmd_cleanup_req=%d, not equal to cmd_cleanup_cmpl=%d, cid=0x%x\n",
+                 qedi_conn->cmd_cleanup_req,
+                 qedi_conn->cmd_cleanup_cmpl,
+                 qedi_conn->iscsi_conn_id);
+
+       iscsi_host_for_each_session(qedi->shost,
+                                   qedi_mark_device_missing);
+       qedi_ops->common->drain(qedi->cdev);
+
+       /* Enable IOs for all other sessions except current.*/
+       if (!wait_event_interruptible_timeout(qedi_conn->wait_queue,
+                                             (qedi_conn->cmd_cleanup_req ==
+                                              qedi_conn->cmd_cleanup_cmpl),
+                                             5 * HZ)) {
+               iscsi_host_for_each_session(qedi->shost,
+                                           qedi_mark_device_available);
+               return -1;
+       }
+
+       iscsi_host_for_each_session(qedi->shost,
+                                   qedi_mark_device_available);
+
+       return 0;
+}
+
+void qedi_clearsq(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn,
+                 struct iscsi_task *task)
+{
+       struct qedi_endpoint *qedi_ep;
+       int rval;
+
+       qedi_ep = qedi_conn->ep;
+       qedi_conn->cmd_cleanup_req = 0;
+       qedi_conn->cmd_cleanup_cmpl = 0;
+
+       if (!qedi_ep) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "Cannot proceed, ep already disconnected, cid=0x%x\n",
+                         qedi_conn->iscsi_conn_id);
+               return;
+       }
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                 "Clearing SQ for cid=0x%x, conn=%p, ep=%p\n",
+                 qedi_conn->iscsi_conn_id, qedi_conn, qedi_ep);
+
+       qedi_ops->clear_sq(qedi->cdev, qedi_ep->handle);
+
+       rval = qedi_cleanup_all_io(qedi, qedi_conn, task, true);
+       if (rval) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "fatal error, need hard reset, cid=0x%x\n",
+                        qedi_conn->iscsi_conn_id);
+               WARN_ON(1);
+       }
+}
+
+static int qedi_wait_for_cleanup_request(struct qedi_ctx *qedi,
+                                        struct qedi_conn *qedi_conn,
+                                        struct iscsi_task *task,
+                                        struct qedi_cmd *qedi_cmd,
+                                        struct qedi_work_map *list_work)
+{
+       struct qedi_cmd *cmd = (struct qedi_cmd *)task->dd_data;
+       int wait;
+
+       wait  = wait_event_interruptible_timeout(qedi_conn->wait_queue,
+                                                ((qedi_cmd->state ==
+                                                  CLEANUP_RECV) ||
+                                                ((qedi_cmd->type == TYPEIO) &&
+                                                 (cmd->state ==
+                                                  RESPONSE_RECEIVED))),
+                                                5 * HZ);
+       if (!wait) {
+               qedi_cmd->state = CLEANUP_WAIT_FAILED;
+
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                         "Cleanup timedout tid=0x%x, issue connection recovery, cid=0x%x\n",
+                         cmd->task_id, qedi_conn->iscsi_conn_id);
+
+               return -1;
+       }
+       return 0;
+}
+
+static void qedi_tmf_work(struct work_struct *work)
+{
+       struct qedi_cmd *qedi_cmd =
+               container_of(work, struct qedi_cmd, tmf_work);
+       struct qedi_conn *qedi_conn = qedi_cmd->conn;
+       struct qedi_ctx *qedi = qedi_conn->qedi;
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct iscsi_cls_session *cls_sess;
+       struct qedi_work_map *list_work = NULL;
+       struct iscsi_task *mtask;
+       struct qedi_cmd *cmd;
+       struct iscsi_task *ctask;
+       struct iscsi_tm *tmf_hdr;
+       s16 rval = 0;
+       s16 tid = 0;
+
+       mtask = qedi_cmd->task;
+       tmf_hdr = (struct iscsi_tm *)mtask->hdr;
+       cls_sess = iscsi_conn_to_session(qedi_conn->cls_conn);
+       set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags);
+
+       ctask = iscsi_itt_to_task(conn, tmf_hdr->rtt);
+       if (!ctask || !ctask->sc) {
+               QEDI_ERR(&qedi->dbg_ctx, "Task already completed\n");
+               goto abort_ret;
+       }
+
+       cmd = (struct qedi_cmd *)ctask->dd_data;
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                 "Abort tmf rtt=0x%x, cmd itt=0x%x, cmd tid=0x%x, cid=0x%x\n",
+                 get_itt(tmf_hdr->rtt), get_itt(ctask->itt), cmd->task_id,
+                 qedi_conn->iscsi_conn_id);
+
+       if (do_not_recover) {
+               QEDI_ERR(&qedi->dbg_ctx, "DONT SEND CLEANUP/ABORT %d\n",
+                        do_not_recover);
+               goto abort_ret;
+       }
+
+       list_work = kzalloc(sizeof(*list_work), GFP_ATOMIC);
+       if (!list_work) {
+               QEDI_ERR(&qedi->dbg_ctx, "Memory alloction failed\n");
+               goto abort_ret;
+       }
+
+       qedi_cmd->type = TYPEIO;
+       list_work->qedi_cmd = qedi_cmd;
+       list_work->rtid = cmd->task_id;
+       list_work->state = QEDI_WORK_SCHEDULED;
+       qedi_cmd->list_tmf_work = list_work;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                 "Queue tmf work=%p, list node=%p, cid=0x%x, tmf flags=0x%x\n",
+                 list_work->ptr_tmf_work, list_work, qedi_conn->iscsi_conn_id,
+                 tmf_hdr->flags);
+
+       spin_lock_bh(&qedi_conn->tmf_work_lock);
+       list_add_tail(&list_work->list, &qedi_conn->tmf_work_list);
+       spin_unlock_bh(&qedi_conn->tmf_work_lock);
+
+       qedi_iscsi_cleanup_task(ctask, false);
+
+       rval = qedi_wait_for_cleanup_request(qedi, qedi_conn, ctask, qedi_cmd,
+                                            list_work);
+       if (rval == -1) {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                         "FW cleanup got escalated, cid=0x%x\n",
+                         qedi_conn->iscsi_conn_id);
+               goto ldel_exit;
+       }
+
+       tid = qedi_get_task_idx(qedi);
+       if (tid == -1) {
+               QEDI_ERR(&qedi->dbg_ctx, "Invalid tid, cid=0x%x\n",
+                        qedi_conn->iscsi_conn_id);
+               goto ldel_exit;
+       }
+
+       qedi_cmd->task_id = tid;
+       qedi_send_iscsi_tmf(qedi_conn, qedi_cmd->task);
+
+abort_ret:
+       clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags);
+       return;
+
+ldel_exit:
+       spin_lock_bh(&qedi_conn->tmf_work_lock);
+       if (!qedi_cmd->list_tmf_work) {
+               list_del_init(&list_work->list);
+               qedi_cmd->list_tmf_work = NULL;
+               kfree(list_work);
+       }
+       spin_unlock_bh(&qedi_conn->tmf_work_lock);
+
+       spin_lock(&qedi_conn->list_lock);
+       list_del_init(&cmd->io_cmd);
+       qedi_conn->active_cmd_count--;
+       spin_unlock(&qedi_conn->list_lock);
+
+       clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags);
+}
+
+static int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn,
+                              struct iscsi_task *mtask)
+{
+       struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
+       struct qedi_ctx *qedi = qedi_conn->qedi;
+       struct iscsi_task_context *fw_task_ctx;
+       struct iscsi_tmf_request_hdr *fw_tmf_request;
+       struct iscsi_sge *single_sge;
+       struct qedi_cmd *qedi_cmd;
+       struct qedi_cmd *cmd;
+       struct iscsi_task *ctask;
+       struct iscsi_tm *tmf_hdr;
+       struct iscsi_sge *req_sge;
+       struct iscsi_sge *resp_sge;
+       u32 lun[2];
+       s16 tid = 0, ptu_invalidate = 0;
+
+       req_sge = (struct iscsi_sge *)qedi_conn->gen_pdu.req_bd_tbl;
+       resp_sge = (struct iscsi_sge *)qedi_conn->gen_pdu.resp_bd_tbl;
+       qedi_cmd = (struct qedi_cmd *)mtask->dd_data;
+       tmf_hdr = (struct iscsi_tm *)mtask->hdr;
+
+       tid = qedi_cmd->task_id;
+       qedi_update_itt_map(qedi, tid, mtask->itt, qedi_cmd);
+
+       fw_task_ctx = qedi_get_task_mem(&qedi->tasks, tid);
+       memset(fw_task_ctx, 0, sizeof(struct iscsi_task_context));
+
+       fw_tmf_request = &fw_task_ctx->ystorm_st_context.pdu_hdr.tmf_request;
+       fw_tmf_request->itt = qedi_set_itt(tid, get_itt(mtask->itt));
+       fw_tmf_request->cmd_sn = be32_to_cpu(tmf_hdr->cmdsn);
+
+       memcpy(lun, &tmf_hdr->lun, sizeof(struct scsi_lun));
+       fw_tmf_request->lun.lo = be32_to_cpu(lun[0]);
+       fw_tmf_request->lun.hi = be32_to_cpu(lun[1]);
+
+       if (qedi->tid_reuse_count[tid] == QEDI_MAX_TASK_NUM) {
+               ptu_invalidate = 1;
+               qedi->tid_reuse_count[tid] = 0;
+       }
+       fw_task_ctx->ystorm_st_context.state.reuse_count =
+                                               qedi->tid_reuse_count[tid];
+       fw_task_ctx->mstorm_st_context.reuse_count =
+                                               qedi->tid_reuse_count[tid]++;
+
+       if ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+            ISCSI_TM_FUNC_ABORT_TASK) {
+               ctask = iscsi_itt_to_task(conn, tmf_hdr->rtt);
+               if (!ctask || !ctask->sc) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Could not get reference task\n");
+                       return 0;
+               }
+               cmd = (struct qedi_cmd *)ctask->dd_data;
+               fw_tmf_request->rtt =
+                               qedi_set_itt(cmd->task_id,
+                                            get_itt(tmf_hdr->rtt));
+       } else {
+               fw_tmf_request->rtt = ISCSI_RESERVED_TAG;
+       }
+
+       fw_tmf_request->opcode = tmf_hdr->opcode;
+       fw_tmf_request->function = tmf_hdr->flags;
+       fw_tmf_request->hdr_second_dword = ntoh24(tmf_hdr->dlength);
+       fw_tmf_request->ref_cmd_sn = be32_to_cpu(tmf_hdr->refcmdsn);
+
+       single_sge = &fw_task_ctx->mstorm_st_context.sgl_union.single_sge;
+       fw_task_ctx->mstorm_st_context.task_type = ISCSI_TASK_TYPE_MIDPATH;
+       fw_task_ctx->mstorm_ag_context.task_cid = (u16)qedi_conn->iscsi_conn_id;
+       single_sge->sge_addr.lo = resp_sge->sge_addr.lo;
+       single_sge->sge_addr.hi = resp_sge->sge_addr.hi;
+       single_sge->sge_len = resp_sge->sge_len;
+
+       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                 ISCSI_MFLAGS_SINGLE_SGE, 1);
+       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                 ISCSI_MFLAGS_SLOW_IO, 0);
+       fw_task_ctx->mstorm_st_context.sgl_size = 1;
+       fw_task_ctx->mstorm_st_context.rem_task_size = resp_sge->sge_len;
+
+       /* Ustorm context */
+       fw_task_ctx->ustorm_st_context.rem_rcv_len = 0;
+       fw_task_ctx->ustorm_st_context.exp_data_transfer_len = 0;
+       fw_task_ctx->ustorm_st_context.exp_data_sn = 0;
+       fw_task_ctx->ustorm_st_context.task_type =  ISCSI_TASK_TYPE_MIDPATH;
+       fw_task_ctx->ustorm_st_context.cq_rss_number = 0;
+
+       SET_FIELD(fw_task_ctx->ustorm_st_context.flags,
+                 USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP, 0);
+       SET_FIELD(fw_task_ctx->ustorm_st_context.reg1.reg1_map,
+                 ISCSI_REG1_NUM_FAST_SGES, 0);
+
+       fw_task_ctx->ustorm_ag_context.icid = (u16)qedi_conn->iscsi_conn_id;
+       SET_FIELD(fw_task_ctx->ustorm_ag_context.flags1,
+                 USTORM_ISCSI_TASK_AG_CTX_R2T2RECV, 1);
+       fw_task_ctx->ustorm_st_context.lun.lo = be32_to_cpu(lun[0]);
+       fw_task_ctx->ustorm_st_context.lun.hi = be32_to_cpu(lun[1]);
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                 "Add TMF to SQ, tmf tid=0x%x, itt=0x%x, cid=0x%x\n",
+                 tid,  mtask->itt, qedi_conn->iscsi_conn_id);
+
+       spin_lock(&qedi_conn->list_lock);
+       list_add_tail(&qedi_cmd->io_cmd, &qedi_conn->active_cmd_list);
+       qedi_cmd->io_cmd_in_list = true;
+       qedi_conn->active_cmd_count++;
+       spin_unlock(&qedi_conn->list_lock);
+
+       qedi_add_to_sq(qedi_conn, mtask, tid, ptu_invalidate, false);
+       qedi_ring_doorbell(qedi_conn);
+       return 0;
+}
+
+int qedi_iscsi_abort_work(struct qedi_conn *qedi_conn,
+                         struct iscsi_task *mtask)
+{
+       struct qedi_ctx *qedi = qedi_conn->qedi;
+       struct iscsi_tm *tmf_hdr;
+       struct qedi_cmd *qedi_cmd = (struct qedi_cmd *)mtask->dd_data;
+       s16 tid = 0;
+
+       tmf_hdr = (struct iscsi_tm *)mtask->hdr;
+       qedi_cmd->task = mtask;
+
+       /* If abort task then schedule the work and return */
+       if ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+           ISCSI_TM_FUNC_ABORT_TASK) {
+               qedi_cmd->state = CLEANUP_WAIT;
+               INIT_WORK(&qedi_cmd->tmf_work, qedi_tmf_work);
+               queue_work(qedi->tmf_thread, &qedi_cmd->tmf_work);
+
+       } else if (((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+                   ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) ||
+                  ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+                   ISCSI_TM_FUNC_TARGET_WARM_RESET) ||
+                  ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) ==
+                   ISCSI_TM_FUNC_TARGET_COLD_RESET)) {
+               tid = qedi_get_task_idx(qedi);
+               if (tid == -1) {
+                       QEDI_ERR(&qedi->dbg_ctx, "Invalid tid, cid=0x%x\n",
+                                qedi_conn->iscsi_conn_id);
+                       return -1;
+               }
+               qedi_cmd->task_id = tid;
+
+               qedi_send_iscsi_tmf(qedi_conn, qedi_cmd->task);
+
+       } else {
+               QEDI_ERR(&qedi->dbg_ctx, "Invalid tmf, cid=0x%x\n",
+                        qedi_conn->iscsi_conn_id);
+               return -1;
+       }
+
+       return 0;
+}
+
+int qedi_send_iscsi_text(struct qedi_conn *qedi_conn,
+                        struct iscsi_task *task)
+{
+       struct qedi_ctx *qedi = qedi_conn->qedi;
+       struct iscsi_task_context *fw_task_ctx;
+       struct iscsi_text_request_hdr *fw_text_request;
+       struct iscsi_cached_sge_ctx *cached_sge;
+       struct iscsi_sge *single_sge;
+       struct qedi_cmd *qedi_cmd;
+       /* For 6.5 hdr iscsi_hdr */
+       struct iscsi_text *text_hdr;
+       struct iscsi_sge *req_sge;
+       struct iscsi_sge *resp_sge;
+       s16 ptu_invalidate = 0;
+       s16 tid = 0;
+
+       req_sge = (struct iscsi_sge *)qedi_conn->gen_pdu.req_bd_tbl;
+       resp_sge = (struct iscsi_sge *)qedi_conn->gen_pdu.resp_bd_tbl;
+       qedi_cmd = (struct qedi_cmd *)task->dd_data;
+       text_hdr = (struct iscsi_text *)task->hdr;
+
+       tid = qedi_get_task_idx(qedi);
+       if (tid == -1)
+               return -ENOMEM;
+
+       fw_task_ctx = qedi_get_task_mem(&qedi->tasks, tid);
+       memset(fw_task_ctx, 0, sizeof(struct iscsi_task_context));
+
+       qedi_cmd->task_id = tid;
+
+       /* Ystorm context */
+       fw_text_request =
+                       &fw_task_ctx->ystorm_st_context.pdu_hdr.text_request;
+       fw_text_request->opcode = text_hdr->opcode;
+       fw_text_request->flags_attr = text_hdr->flags;
+
+       qedi_update_itt_map(qedi, tid, task->itt, qedi_cmd);
+       fw_text_request->itt = qedi_set_itt(tid, get_itt(task->itt));
+       fw_text_request->ttt = text_hdr->ttt;
+       fw_text_request->cmd_sn = be32_to_cpu(text_hdr->cmdsn);
+       fw_text_request->exp_stat_sn = be32_to_cpu(text_hdr->exp_statsn);
+       fw_text_request->hdr_second_dword = ntoh24(text_hdr->dlength);
+
+       if (qedi->tid_reuse_count[tid] == QEDI_MAX_TASK_NUM) {
+               ptu_invalidate = 1;
+               qedi->tid_reuse_count[tid] = 0;
+       }
+       fw_task_ctx->ystorm_st_context.state.reuse_count =
+                                                    qedi->tid_reuse_count[tid];
+       fw_task_ctx->mstorm_st_context.reuse_count =
+                                                  qedi->tid_reuse_count[tid]++;
+
+       cached_sge =
+              &fw_task_ctx->ystorm_st_context.state.sgl_ctx_union.cached_sge;
+       cached_sge->sge.sge_len = req_sge->sge_len;
+       cached_sge->sge.sge_addr.lo = (u32)(qedi_conn->gen_pdu.req_dma_addr);
+       cached_sge->sge.sge_addr.hi =
+                             (u32)((u64)qedi_conn->gen_pdu.req_dma_addr >> 32);
+
+       /* Mstorm context */
+       single_sge = &fw_task_ctx->mstorm_st_context.sgl_union.single_sge;
+       fw_task_ctx->mstorm_st_context.task_type = 0x2;
+       fw_task_ctx->mstorm_ag_context.task_cid = (u16)qedi_conn->iscsi_conn_id;
+       single_sge->sge_addr.lo = resp_sge->sge_addr.lo;
+       single_sge->sge_addr.hi = resp_sge->sge_addr.hi;
+       single_sge->sge_len = resp_sge->sge_len;
+
+       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                 ISCSI_MFLAGS_SINGLE_SGE, 1);
+       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                 ISCSI_MFLAGS_SLOW_IO, 0);
+       fw_task_ctx->mstorm_st_context.sgl_size = 1;
+       fw_task_ctx->mstorm_st_context.rem_task_size = resp_sge->sge_len;
+
+       /* Ustorm context */
+       fw_task_ctx->ustorm_ag_context.exp_data_acked =
+                                                     ntoh24(text_hdr->dlength);
+       fw_task_ctx->ustorm_st_context.rem_rcv_len = resp_sge->sge_len;
+       fw_task_ctx->ustorm_st_context.exp_data_transfer_len =
+                                                     ntoh24(text_hdr->dlength);
+       fw_task_ctx->ustorm_st_context.exp_data_sn =
+                                             be32_to_cpu(text_hdr->exp_statsn);
+       fw_task_ctx->ustorm_st_context.cq_rss_number = 0;
+       fw_task_ctx->ustorm_st_context.task_type = 0x2;
+       fw_task_ctx->ustorm_ag_context.icid = (u16)qedi_conn->iscsi_conn_id;
+       SET_FIELD(fw_task_ctx->ustorm_ag_context.flags1,
+                 USTORM_ISCSI_TASK_AG_CTX_R2T2RECV, 1);
+
+       /*  Add command in active command list */
+       spin_lock(&qedi_conn->list_lock);
+       list_add_tail(&qedi_cmd->io_cmd, &qedi_conn->active_cmd_list);
+       qedi_cmd->io_cmd_in_list = true;
+       qedi_conn->active_cmd_count++;
+       spin_unlock(&qedi_conn->list_lock);
+
+       qedi_add_to_sq(qedi_conn, task, tid, ptu_invalidate, false);
+       qedi_ring_doorbell(qedi_conn);
+
+       return 0;
+}
+
+int qedi_send_iscsi_nopout(struct qedi_conn *qedi_conn,
+                          struct iscsi_task *task,
+                          char *datap, int data_len, int unsol)
+{
+       struct qedi_ctx *qedi = qedi_conn->qedi;
+       struct iscsi_task_context *fw_task_ctx;
+       struct iscsi_nop_out_hdr *fw_nop_out;
+       struct qedi_cmd *qedi_cmd;
+       /* For 6.5 hdr iscsi_hdr */
+       struct iscsi_nopout *nopout_hdr;
+       struct iscsi_cached_sge_ctx *cached_sge;
+       struct iscsi_sge *single_sge;
+       struct iscsi_sge *req_sge;
+       struct iscsi_sge *resp_sge;
+       u32 lun[2];
+       s16 ptu_invalidate = 0;
+       s16 tid = 0;
+
+       req_sge = (struct iscsi_sge *)qedi_conn->gen_pdu.req_bd_tbl;
+       resp_sge = (struct iscsi_sge *)qedi_conn->gen_pdu.resp_bd_tbl;
+       qedi_cmd = (struct qedi_cmd *)task->dd_data;
+       nopout_hdr = (struct iscsi_nopout *)task->hdr;
+
+       tid = qedi_get_task_idx(qedi);
+       if (tid == -1) {
+               QEDI_WARN(&qedi->dbg_ctx, "Invalid tid\n");
+               return -ENOMEM;
+       }
+
+       fw_task_ctx = qedi_get_task_mem(&qedi->tasks, tid);
+
+       memset(fw_task_ctx, 0, sizeof(struct iscsi_task_context));
+       qedi_cmd->task_id = tid;
+
+       /* Ystorm context */
+       fw_nop_out = &fw_task_ctx->ystorm_st_context.pdu_hdr.nop_out;
+       SET_FIELD(fw_nop_out->flags_attr, ISCSI_NOP_OUT_HDR_CONST1, 1);
+       SET_FIELD(fw_nop_out->flags_attr, ISCSI_NOP_OUT_HDR_RSRV, 0);
+
+       memcpy(lun, &nopout_hdr->lun, sizeof(struct scsi_lun));
+       fw_nop_out->lun.lo = be32_to_cpu(lun[0]);
+       fw_nop_out->lun.hi = be32_to_cpu(lun[1]);
+
+       qedi_update_itt_map(qedi, tid, task->itt, qedi_cmd);
+
+       if (nopout_hdr->ttt != ISCSI_TTT_ALL_ONES) {
+               fw_nop_out->itt = be32_to_cpu(nopout_hdr->itt);
+               fw_nop_out->ttt = be32_to_cpu(nopout_hdr->ttt);
+               fw_task_ctx->ystorm_st_context.state.buffer_offset[0] = 0;
+               fw_task_ctx->ystorm_st_context.state.local_comp = 1;
+               SET_FIELD(fw_task_ctx->ustorm_st_context.flags,
+                         USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP, 1);
+       } else {
+               fw_nop_out->itt = qedi_set_itt(tid, get_itt(task->itt));
+               fw_nop_out->ttt = ISCSI_TTT_ALL_ONES;
+               fw_task_ctx->ystorm_st_context.state.buffer_offset[0] = 0;
+
+               spin_lock(&qedi_conn->list_lock);
+               list_add_tail(&qedi_cmd->io_cmd, &qedi_conn->active_cmd_list);
+               qedi_cmd->io_cmd_in_list = true;
+               qedi_conn->active_cmd_count++;
+               spin_unlock(&qedi_conn->list_lock);
+       }
+
+       fw_nop_out->opcode = ISCSI_OPCODE_NOP_OUT;
+       fw_nop_out->cmd_sn = be32_to_cpu(nopout_hdr->cmdsn);
+       fw_nop_out->exp_stat_sn = be32_to_cpu(nopout_hdr->exp_statsn);
+
+       cached_sge =
+              &fw_task_ctx->ystorm_st_context.state.sgl_ctx_union.cached_sge;
+       cached_sge->sge.sge_len = req_sge->sge_len;
+       cached_sge->sge.sge_addr.lo = (u32)(qedi_conn->gen_pdu.req_dma_addr);
+       cached_sge->sge.sge_addr.hi =
+                       (u32)((u64)qedi_conn->gen_pdu.req_dma_addr >> 32);
+
+       /* Mstorm context */
+       fw_task_ctx->mstorm_st_context.task_type = ISCSI_TASK_TYPE_MIDPATH;
+       fw_task_ctx->mstorm_ag_context.task_cid = (u16)qedi_conn->iscsi_conn_id;
+
+       single_sge = &fw_task_ctx->mstorm_st_context.sgl_union.single_sge;
+       single_sge->sge_addr.lo = resp_sge->sge_addr.lo;
+       single_sge->sge_addr.hi = resp_sge->sge_addr.hi;
+       single_sge->sge_len = resp_sge->sge_len;
+       fw_task_ctx->mstorm_st_context.rem_task_size = resp_sge->sge_len;
+
+       if (qedi->tid_reuse_count[tid] == QEDI_MAX_TASK_NUM) {
+               ptu_invalidate = 1;
+               qedi->tid_reuse_count[tid] = 0;
+       }
+       fw_task_ctx->ystorm_st_context.state.reuse_count =
+                                               qedi->tid_reuse_count[tid];
+       fw_task_ctx->mstorm_st_context.reuse_count =
+                                               qedi->tid_reuse_count[tid]++;
+       /* Ustorm context */
+       fw_task_ctx->ustorm_st_context.rem_rcv_len = resp_sge->sge_len;
+       fw_task_ctx->ustorm_st_context.exp_data_transfer_len = data_len;
+       fw_task_ctx->ustorm_st_context.exp_data_sn = 0;
+       fw_task_ctx->ustorm_st_context.task_type =  ISCSI_TASK_TYPE_MIDPATH;
+       fw_task_ctx->ustorm_st_context.cq_rss_number = 0;
+
+       SET_FIELD(fw_task_ctx->ustorm_st_context.reg1.reg1_map,
+                 ISCSI_REG1_NUM_FAST_SGES, 0);
+
+       fw_task_ctx->ustorm_ag_context.icid = (u16)qedi_conn->iscsi_conn_id;
+       SET_FIELD(fw_task_ctx->ustorm_ag_context.flags1,
+                 USTORM_ISCSI_TASK_AG_CTX_R2T2RECV, 1);
+
+       fw_task_ctx->ustorm_st_context.lun.lo = be32_to_cpu(lun[0]);
+       fw_task_ctx->ustorm_st_context.lun.hi = be32_to_cpu(lun[1]);
+
+       qedi_add_to_sq(qedi_conn, task, tid, ptu_invalidate, false);
+       qedi_ring_doorbell(qedi_conn);
+       return 0;
+}
+
+static int qedi_split_bd(struct qedi_cmd *cmd, u64 addr, int sg_len,
+                        int bd_index)
+{
+       struct iscsi_sge *bd = cmd->io_tbl.sge_tbl;
+       int frag_size, sg_frags;
+
+       sg_frags = 0;
+
+       while (sg_len) {
+               if (addr % QEDI_PAGE_SIZE)
+                       frag_size =
+                                  (QEDI_PAGE_SIZE - (addr % QEDI_PAGE_SIZE));
+               else
+                       frag_size = (sg_len > QEDI_BD_SPLIT_SZ) ? 0 :
+                                   (sg_len % QEDI_BD_SPLIT_SZ);
+
+               if (frag_size == 0)
+                       frag_size = QEDI_BD_SPLIT_SZ;
+
+               bd[bd_index + sg_frags].sge_addr.lo = (addr & 0xffffffff);
+               bd[bd_index + sg_frags].sge_addr.hi = (addr >> 32);
+               bd[bd_index + sg_frags].sge_len = (u16)frag_size;
+               QEDI_INFO(&cmd->conn->qedi->dbg_ctx, QEDI_LOG_IO,
+                         "split sge %d: addr=%llx, len=%x",
+                         (bd_index + sg_frags), addr, frag_size);
+
+               addr += (u64)frag_size;
+               sg_frags++;
+               sg_len -= frag_size;
+       }
+       return sg_frags;
+}
+
+static int qedi_map_scsi_sg(struct qedi_ctx *qedi, struct qedi_cmd *cmd)
+{
+       struct scsi_cmnd *sc = cmd->scsi_cmd;
+       struct iscsi_sge *bd = cmd->io_tbl.sge_tbl;
+       struct scatterlist *sg;
+       int byte_count = 0;
+       int bd_count = 0;
+       int sg_count;
+       int sg_len;
+       int sg_frags;
+       u64 addr, end_addr;
+       int i;
+
+       WARN_ON(scsi_sg_count(sc) > QEDI_ISCSI_MAX_BDS_PER_CMD);
+
+       sg_count = dma_map_sg(&qedi->pdev->dev, scsi_sglist(sc),
+                             scsi_sg_count(sc), sc->sc_data_direction);
+
+       /*
+        * New condition to send single SGE as cached-SGL.
+        * Single SGE with length less than 64K.
+        */
+       sg = scsi_sglist(sc);
+       if ((sg_count == 1) && (sg_dma_len(sg) <= MAX_SGLEN_FOR_CACHESGL)) {
+               sg_len = sg_dma_len(sg);
+               addr = (u64)sg_dma_address(sg);
+
+               bd[bd_count].sge_addr.lo = (addr & 0xffffffff);
+               bd[bd_count].sge_addr.hi = (addr >> 32);
+               bd[bd_count].sge_len = (u16)sg_len;
+
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_IO,
+                         "single-cashed-sgl: bd_count:%d addr=%llx, len=%x",
+                         sg_count, addr, sg_len);
+
+               return ++bd_count;
+       }
+
+       scsi_for_each_sg(sc, sg, sg_count, i) {
+               sg_len = sg_dma_len(sg);
+               addr = (u64)sg_dma_address(sg);
+               end_addr = (addr + sg_len);
+
+               /*
+                * first sg elem in the 'list',
+                * check if end addr is page-aligned.
+                */
+               if ((i == 0) && (sg_count > 1) && (end_addr % QEDI_PAGE_SIZE))
+                       cmd->use_slowpath = true;
+
+               /*
+                * last sg elem in the 'list',
+                * check if start addr is page-aligned.
+                */
+               else if ((i == (sg_count - 1)) &&
+                        (sg_count > 1) && (addr % QEDI_PAGE_SIZE))
+                       cmd->use_slowpath = true;
+
+               /*
+                * middle sg elements in list,
+                * check if start and end addr is page-aligned
+                */
+               else if ((i != 0) && (i != (sg_count - 1)) &&
+                        ((addr % QEDI_PAGE_SIZE) ||
+                        (end_addr % QEDI_PAGE_SIZE)))
+                       cmd->use_slowpath = true;
+
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_IO, "sg[%d] size=0x%x",
+                         i, sg_len);
+
+               if (sg_len > QEDI_BD_SPLIT_SZ) {
+                       sg_frags = qedi_split_bd(cmd, addr, sg_len, bd_count);
+               } else {
+                       sg_frags = 1;
+                       bd[bd_count].sge_addr.lo = addr & 0xffffffff;
+                       bd[bd_count].sge_addr.hi = addr >> 32;
+                       bd[bd_count].sge_len = sg_len;
+               }
+               byte_count += sg_len;
+               bd_count += sg_frags;
+       }
+
+       if (byte_count != scsi_bufflen(sc))
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "byte_count = %d != scsi_bufflen = %d\n", byte_count,
+                        scsi_bufflen(sc));
+       else
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_IO, "byte_count = %d\n",
+                         byte_count);
+
+       WARN_ON(byte_count != scsi_bufflen(sc));
+
+       return bd_count;
+}
+
+static void qedi_iscsi_map_sg_list(struct qedi_cmd *cmd)
+{
+       int bd_count;
+       struct scsi_cmnd *sc = cmd->scsi_cmd;
+
+       if (scsi_sg_count(sc)) {
+               bd_count  = qedi_map_scsi_sg(cmd->conn->qedi, cmd);
+               if (bd_count == 0)
+                       return;
+       } else {
+               struct iscsi_sge *bd = cmd->io_tbl.sge_tbl;
+
+               bd[0].sge_addr.lo = 0;
+               bd[0].sge_addr.hi = 0;
+               bd[0].sge_len = 0;
+               bd_count = 0;
+       }
+       cmd->io_tbl.sge_valid = bd_count;
+}
+
+static void qedi_cpy_scsi_cdb(struct scsi_cmnd *sc, u32 *dstp)
+{
+       u32 dword;
+       int lpcnt;
+       u8 *srcp;
+
+       lpcnt = sc->cmd_len / sizeof(dword);
+       srcp = (u8 *)sc->cmnd;
+       while (lpcnt--) {
+               memcpy(&dword, (const void *)srcp, 4);
+               *dstp = cpu_to_be32(dword);
+               srcp += 4;
+               dstp++;
+       }
+       if (sc->cmd_len & 0x3) {
+               dword = (u32)srcp[0] | ((u32)srcp[1] << 8);
+               *dstp = cpu_to_be32(dword);
+       }
+}
+
+void qedi_trace_io(struct qedi_ctx *qedi, struct iscsi_task *task,
+                  u16 tid, int8_t direction)
+{
+       struct qedi_io_log *io_log;
+       struct iscsi_conn *conn = task->conn;
+       struct qedi_conn *qedi_conn = conn->dd_data;
+       struct scsi_cmnd *sc_cmd = task->sc;
+       unsigned long flags;
+       u8 op;
+
+       spin_lock_irqsave(&qedi->io_trace_lock, flags);
+
+       io_log = &qedi->io_trace_buf[qedi->io_trace_idx];
+       io_log->direction = direction;
+       io_log->task_id = tid;
+       io_log->cid = qedi_conn->iscsi_conn_id;
+       io_log->lun = sc_cmd->device->lun;
+       io_log->op = sc_cmd->cmnd[0];
+       op = sc_cmd->cmnd[0];
+       io_log->lba[0] = sc_cmd->cmnd[2];
+       io_log->lba[1] = sc_cmd->cmnd[3];
+       io_log->lba[2] = sc_cmd->cmnd[4];
+       io_log->lba[3] = sc_cmd->cmnd[5];
+       io_log->bufflen = scsi_bufflen(sc_cmd);
+       io_log->sg_count = scsi_sg_count(sc_cmd);
+       io_log->fast_sgs = qedi->fast_sgls;
+       io_log->cached_sgs = qedi->cached_sgls;
+       io_log->slow_sgs = qedi->slow_sgls;
+       io_log->cached_sge = qedi->use_cached_sge;
+       io_log->slow_sge = qedi->use_slow_sge;
+       io_log->fast_sge = qedi->use_fast_sge;
+       io_log->result = sc_cmd->result;
+       io_log->jiffies = jiffies;
+       io_log->blk_req_cpu = smp_processor_id();
+
+       if (direction == QEDI_IO_TRACE_REQ) {
+               /* For requests we only care about the submission CPU */
+               io_log->req_cpu = smp_processor_id() % qedi->num_queues;
+               io_log->intr_cpu = 0;
+               io_log->blk_rsp_cpu = 0;
+       } else if (direction == QEDI_IO_TRACE_RSP) {
+               io_log->req_cpu = smp_processor_id() % qedi->num_queues;
+               io_log->intr_cpu = qedi->intr_cpu;
+               io_log->blk_rsp_cpu = smp_processor_id();
+       }
+
+       qedi->io_trace_idx++;
+       if (qedi->io_trace_idx == QEDI_IO_TRACE_SIZE)
+               qedi->io_trace_idx = 0;
+
+       qedi->use_cached_sge = false;
+       qedi->use_slow_sge = false;
+       qedi->use_fast_sge = false;
+
+       spin_unlock_irqrestore(&qedi->io_trace_lock, flags);
+}
+
+int qedi_iscsi_send_ioreq(struct iscsi_task *task)
+{
+       struct iscsi_conn *conn = task->conn;
+       struct iscsi_session *session = conn->session;
+       struct Scsi_Host *shost = iscsi_session_to_shost(session->cls_session);
+       struct qedi_ctx *qedi = iscsi_host_priv(shost);
+       struct qedi_conn *qedi_conn = conn->dd_data;
+       struct qedi_cmd *cmd = task->dd_data;
+       struct scsi_cmnd *sc = task->sc;
+       struct iscsi_task_context *fw_task_ctx;
+       struct iscsi_cached_sge_ctx *cached_sge;
+       struct iscsi_phys_sgl_ctx *phys_sgl;
+       struct iscsi_virt_sgl_ctx *virt_sgl;
+       struct ystorm_iscsi_task_st_ctx *yst_cxt;
+       struct mstorm_iscsi_task_st_ctx *mst_cxt;
+       struct iscsi_sgl *sgl_struct;
+       struct iscsi_sge *single_sge;
+       struct iscsi_scsi_req *hdr = (struct iscsi_scsi_req *)task->hdr;
+       struct iscsi_sge *bd = cmd->io_tbl.sge_tbl;
+       enum iscsi_task_type task_type;
+       struct iscsi_cmd_hdr *fw_cmd;
+       u32 lun[2];
+       u32 exp_data;
+       u16 cq_idx = smp_processor_id() % qedi->num_queues;
+       s16 ptu_invalidate = 0;
+       s16 tid = 0;
+       u8 num_fast_sgs;
+
+       tid = qedi_get_task_idx(qedi);
+       if (tid == -1)
+               return -ENOMEM;
+
+       qedi_iscsi_map_sg_list(cmd);
+
+       int_to_scsilun(sc->device->lun, (struct scsi_lun *)lun);
+       fw_task_ctx = qedi_get_task_mem(&qedi->tasks, tid);
+
+       memset(fw_task_ctx, 0, sizeof(struct iscsi_task_context));
+       cmd->task_id = tid;
+
+       /* Ystorm context */
+       fw_cmd = &fw_task_ctx->ystorm_st_context.pdu_hdr.cmd;
+       SET_FIELD(fw_cmd->flags_attr, ISCSI_CMD_HDR_ATTR, ISCSI_ATTR_SIMPLE);
+
+       if (sc->sc_data_direction == DMA_TO_DEVICE) {
+               if (conn->session->initial_r2t_en) {
+                       exp_data = min((conn->session->imm_data_en *
+                                       conn->max_xmit_dlength),
+                                      conn->session->first_burst);
+                       exp_data = min(exp_data, scsi_bufflen(sc));
+                       fw_task_ctx->ustorm_ag_context.exp_data_acked =
+                                                         cpu_to_le32(exp_data);
+               } else {
+                       fw_task_ctx->ustorm_ag_context.exp_data_acked =
+                             min(conn->session->first_burst, scsi_bufflen(sc));
+               }
+
+               SET_FIELD(fw_cmd->flags_attr, ISCSI_CMD_HDR_WRITE, 1);
+               task_type = ISCSI_TASK_TYPE_INITIATOR_WRITE;
+       } else {
+               if (scsi_bufflen(sc))
+                       SET_FIELD(fw_cmd->flags_attr, ISCSI_CMD_HDR_READ, 1);
+               task_type = ISCSI_TASK_TYPE_INITIATOR_READ;
+       }
+
+       fw_cmd->lun.lo = be32_to_cpu(lun[0]);
+       fw_cmd->lun.hi = be32_to_cpu(lun[1]);
+
+       qedi_update_itt_map(qedi, tid, task->itt, cmd);
+       fw_cmd->itt = qedi_set_itt(tid, get_itt(task->itt));
+       fw_cmd->expected_transfer_length = scsi_bufflen(sc);
+       fw_cmd->cmd_sn = be32_to_cpu(hdr->cmdsn);
+       fw_cmd->opcode = hdr->opcode;
+       qedi_cpy_scsi_cdb(sc, (u32 *)fw_cmd->cdb);
+
+       /* Mstorm context */
+       fw_task_ctx->mstorm_st_context.sense_db.lo = (u32)cmd->sense_buffer_dma;
+       fw_task_ctx->mstorm_st_context.sense_db.hi =
+                                       (u32)((u64)cmd->sense_buffer_dma >> 32);
+       fw_task_ctx->mstorm_ag_context.task_cid = qedi_conn->iscsi_conn_id;
+       fw_task_ctx->mstorm_st_context.task_type = task_type;
+
+       if (qedi->tid_reuse_count[tid] == QEDI_MAX_TASK_NUM) {
+               ptu_invalidate = 1;
+               qedi->tid_reuse_count[tid] = 0;
+       }
+       fw_task_ctx->ystorm_st_context.state.reuse_count =
+                                                    qedi->tid_reuse_count[tid];
+       fw_task_ctx->mstorm_st_context.reuse_count =
+                                                  qedi->tid_reuse_count[tid]++;
+
+       /* Ustorm context */
+       fw_task_ctx->ustorm_st_context.rem_rcv_len = scsi_bufflen(sc);
+       fw_task_ctx->ustorm_st_context.exp_data_transfer_len = scsi_bufflen(sc);
+       fw_task_ctx->ustorm_st_context.exp_data_sn =
+                                                  be32_to_cpu(hdr->exp_statsn);
+       fw_task_ctx->ustorm_st_context.task_type = task_type;
+       fw_task_ctx->ustorm_st_context.cq_rss_number = cq_idx;
+       fw_task_ctx->ustorm_ag_context.icid = (u16)qedi_conn->iscsi_conn_id;
+
+       SET_FIELD(fw_task_ctx->ustorm_ag_context.flags1,
+                 USTORM_ISCSI_TASK_AG_CTX_R2T2RECV, 1);
+       SET_FIELD(fw_task_ctx->ustorm_st_context.flags,
+                 USTORM_ISCSI_TASK_ST_CTX_LOCAL_COMP, 0);
+
+       num_fast_sgs = (cmd->io_tbl.sge_valid ?
+                       min((u16)QEDI_FAST_SGE_COUNT,
+                           (u16)cmd->io_tbl.sge_valid) : 0);
+       SET_FIELD(fw_task_ctx->ustorm_st_context.reg1.reg1_map,
+                 ISCSI_REG1_NUM_FAST_SGES, num_fast_sgs);
+
+       fw_task_ctx->ustorm_st_context.lun.lo = be32_to_cpu(lun[0]);
+       fw_task_ctx->ustorm_st_context.lun.hi = be32_to_cpu(lun[1]);
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_IO, "Total sge count [%d]\n",
+                 cmd->io_tbl.sge_valid);
+
+       yst_cxt = &fw_task_ctx->ystorm_st_context;
+       mst_cxt = &fw_task_ctx->mstorm_st_context;
+       /* Tx path */
+       if (task_type == ISCSI_TASK_TYPE_INITIATOR_WRITE) {
+               /* not considering  superIO or FastIO */
+               if (cmd->io_tbl.sge_valid == 1) {
+                       cached_sge = &yst_cxt->state.sgl_ctx_union.cached_sge;
+                       cached_sge->sge.sge_addr.lo = bd[0].sge_addr.lo;
+                       cached_sge->sge.sge_addr.hi = bd[0].sge_addr.hi;
+                       cached_sge->sge.sge_len = bd[0].sge_len;
+                       qedi->cached_sgls++;
+               } else if ((cmd->io_tbl.sge_valid != 1) && cmd->use_slowpath) {
+                       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                                 ISCSI_MFLAGS_SLOW_IO, 1);
+                       SET_FIELD(fw_task_ctx->ustorm_st_context.reg1.reg1_map,
+                                 ISCSI_REG1_NUM_FAST_SGES, 0);
+                       phys_sgl = &yst_cxt->state.sgl_ctx_union.phys_sgl;
+                       phys_sgl->sgl_base.lo = (u32)(cmd->io_tbl.sge_tbl_dma);
+                       phys_sgl->sgl_base.hi =
+                                    (u32)((u64)cmd->io_tbl.sge_tbl_dma >> 32);
+                       phys_sgl->sgl_size = cmd->io_tbl.sge_valid;
+                       qedi->slow_sgls++;
+               } else if ((cmd->io_tbl.sge_valid != 1) && !cmd->use_slowpath) {
+                       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                                 ISCSI_MFLAGS_SLOW_IO, 0);
+                       SET_FIELD(fw_task_ctx->ustorm_st_context.reg1.reg1_map,
+                                 ISCSI_REG1_NUM_FAST_SGES,
+                                 min((u16)QEDI_FAST_SGE_COUNT,
+                                     (u16)cmd->io_tbl.sge_valid));
+                       virt_sgl = &yst_cxt->state.sgl_ctx_union.virt_sgl;
+                       virt_sgl->sgl_base.lo = (u32)(cmd->io_tbl.sge_tbl_dma);
+                       virt_sgl->sgl_base.hi =
+                                     (u32)((u64)cmd->io_tbl.sge_tbl_dma >> 32);
+                       virt_sgl->sgl_initial_offset =
+                                (u32)bd[0].sge_addr.lo & (QEDI_PAGE_SIZE - 1);
+                       qedi->fast_sgls++;
+               }
+               fw_task_ctx->mstorm_st_context.sgl_size = cmd->io_tbl.sge_valid;
+               fw_task_ctx->mstorm_st_context.rem_task_size = scsi_bufflen(sc);
+       } else {
+       /* Rx path */
+               if (cmd->io_tbl.sge_valid == 1) {
+                       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                                 ISCSI_MFLAGS_SLOW_IO, 0);
+                       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                                 ISCSI_MFLAGS_SINGLE_SGE, 1);
+                       single_sge = &mst_cxt->sgl_union.single_sge;
+                       single_sge->sge_addr.lo = bd[0].sge_addr.lo;
+                       single_sge->sge_addr.hi = bd[0].sge_addr.hi;
+                       single_sge->sge_len = bd[0].sge_len;
+                       qedi->cached_sgls++;
+               } else if ((cmd->io_tbl.sge_valid != 1) && cmd->use_slowpath) {
+                       sgl_struct = &mst_cxt->sgl_union.sgl_struct;
+                       sgl_struct->sgl_addr.lo =
+                                               (u32)(cmd->io_tbl.sge_tbl_dma);
+                       sgl_struct->sgl_addr.hi =
+                                    (u32)((u64)cmd->io_tbl.sge_tbl_dma >> 32);
+                       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                                 ISCSI_MFLAGS_SLOW_IO, 1);
+                       SET_FIELD(fw_task_ctx->ustorm_st_context.reg1.reg1_map,
+                                 ISCSI_REG1_NUM_FAST_SGES, 0);
+                       sgl_struct->updated_sge_size = 0;
+                       sgl_struct->updated_sge_offset = 0;
+                       qedi->slow_sgls++;
+               } else if ((cmd->io_tbl.sge_valid != 1) && !cmd->use_slowpath) {
+                       sgl_struct = &mst_cxt->sgl_union.sgl_struct;
+                       sgl_struct->sgl_addr.lo =
+                                               (u32)(cmd->io_tbl.sge_tbl_dma);
+                       sgl_struct->sgl_addr.hi =
+                                    (u32)((u64)cmd->io_tbl.sge_tbl_dma >> 32);
+                       sgl_struct->byte_offset =
+                               (u32)bd[0].sge_addr.lo & (QEDI_PAGE_SIZE - 1);
+                       SET_FIELD(fw_task_ctx->mstorm_st_context.flags.mflags,
+                                 ISCSI_MFLAGS_SLOW_IO, 0);
+                       SET_FIELD(fw_task_ctx->ustorm_st_context.reg1.reg1_map,
+                                 ISCSI_REG1_NUM_FAST_SGES, 0);
+                       sgl_struct->updated_sge_size = 0;
+                       sgl_struct->updated_sge_offset = 0;
+                       qedi->fast_sgls++;
+               }
+               fw_task_ctx->mstorm_st_context.sgl_size = cmd->io_tbl.sge_valid;
+               fw_task_ctx->mstorm_st_context.rem_task_size = scsi_bufflen(sc);
+       }
+
+       if (cmd->io_tbl.sge_valid == 1)
+               /* Singel-SGL */
+               qedi->use_cached_sge = true;
+       else {
+               if (cmd->use_slowpath)
+                       qedi->use_slow_sge = true;
+               else
+                       qedi->use_fast_sge = true;
+       }
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_IO,
+                 "%s: %s-SGL: num_sges=0x%x first-sge-lo=0x%x first-sge-hi=0x%x",
+                 (task_type == ISCSI_TASK_TYPE_INITIATOR_WRITE) ?
+                 "Write " : "Read ", (cmd->io_tbl.sge_valid == 1) ?
+                 "Single" : (cmd->use_slowpath ? "SLOW" : "FAST"),
+                 (u16)cmd->io_tbl.sge_valid, (u32)(cmd->io_tbl.sge_tbl_dma),
+                 (u32)((u64)cmd->io_tbl.sge_tbl_dma >> 32));
+
+       /*  Add command in active command list */
+       spin_lock(&qedi_conn->list_lock);
+       list_add_tail(&cmd->io_cmd, &qedi_conn->active_cmd_list);
+       cmd->io_cmd_in_list = true;
+       qedi_conn->active_cmd_count++;
+       spin_unlock(&qedi_conn->list_lock);
+
+       qedi_add_to_sq(qedi_conn, task, tid, ptu_invalidate, false);
+       qedi_ring_doorbell(qedi_conn);
+       if (qedi_io_tracing)
+               qedi_trace_io(qedi, task, tid, QEDI_IO_TRACE_REQ);
+
+       return 0;
+}
+
+int qedi_iscsi_cleanup_task(struct iscsi_task *task, bool mark_cmd_node_deleted)
+{
+       struct iscsi_conn *conn = task->conn;
+       struct qedi_conn *qedi_conn = conn->dd_data;
+       struct qedi_cmd *cmd = task->dd_data;
+       s16 ptu_invalidate = 0;
+
+       QEDI_INFO(&qedi_conn->qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
+                 "issue cleanup tid=0x%x itt=0x%x task_state=%d cmd_state=0%x cid=0x%x\n",
+                 cmd->task_id, get_itt(task->itt), task->state,
+                 cmd->state, qedi_conn->iscsi_conn_id);
+
+       qedi_add_to_sq(qedi_conn, task, cmd->task_id, ptu_invalidate, true);
+       qedi_ring_doorbell(qedi_conn);
+
+       return 0;
+}
diff --git a/drivers/scsi/qedi/qedi_gbl.h b/drivers/scsi/qedi/qedi_gbl.h
new file mode 100644 (file)
index 0000000..8e488de
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#ifndef _QEDI_GBL_H_
+#define _QEDI_GBL_H_
+
+#include "qedi_iscsi.h"
+
+extern uint qedi_io_tracing;
+extern int do_not_recover;
+extern struct scsi_host_template qedi_host_template;
+extern struct iscsi_transport qedi_iscsi_transport;
+extern const struct qed_iscsi_ops *qedi_ops;
+extern struct qedi_debugfs_ops qedi_debugfs_ops;
+extern const struct file_operations qedi_dbg_fops;
+extern struct device_attribute *qedi_shost_attrs[];
+
+int qedi_alloc_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep);
+void qedi_free_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep);
+
+int qedi_send_iscsi_login(struct qedi_conn *qedi_conn,
+                         struct iscsi_task *task);
+int qedi_send_iscsi_logout(struct qedi_conn *qedi_conn,
+                          struct iscsi_task *task);
+int qedi_iscsi_abort_work(struct qedi_conn *qedi_conn,
+                         struct iscsi_task *mtask);
+int qedi_send_iscsi_text(struct qedi_conn *qedi_conn,
+                        struct iscsi_task *task);
+int qedi_send_iscsi_nopout(struct qedi_conn *qedi_conn,
+                          struct iscsi_task *task,
+                          char *datap, int data_len, int unsol);
+int qedi_iscsi_send_ioreq(struct iscsi_task *task);
+int qedi_get_task_idx(struct qedi_ctx *qedi);
+void qedi_clear_task_idx(struct qedi_ctx *qedi, int idx);
+int qedi_iscsi_cleanup_task(struct iscsi_task *task,
+                           bool mark_cmd_node_deleted);
+void qedi_iscsi_unmap_sg_list(struct qedi_cmd *cmd);
+void qedi_update_itt_map(struct qedi_ctx *qedi, u32 tid, u32 proto_itt,
+                        struct qedi_cmd *qedi_cmd);
+void qedi_get_proto_itt(struct qedi_ctx *qedi, u32 tid, u32 *proto_itt);
+void qedi_get_task_tid(struct qedi_ctx *qedi, u32 itt, int16_t *tid);
+void qedi_process_iscsi_error(struct qedi_endpoint *ep,
+                             struct async_data *data);
+void qedi_start_conn_recovery(struct qedi_ctx *qedi,
+                             struct qedi_conn *qedi_conn);
+struct qedi_conn *qedi_get_conn_from_id(struct qedi_ctx *qedi, u32 iscsi_cid);
+void qedi_process_tcp_error(struct qedi_endpoint *ep, struct async_data *data);
+void qedi_mark_device_missing(struct iscsi_cls_session *cls_session);
+void qedi_mark_device_available(struct iscsi_cls_session *cls_session);
+void qedi_reset_host_mtu(struct qedi_ctx *qedi, u16 mtu);
+int qedi_recover_all_conns(struct qedi_ctx *qedi);
+void qedi_fp_process_cqes(struct qedi_work *work);
+int qedi_cleanup_all_io(struct qedi_ctx *qedi,
+                       struct qedi_conn *qedi_conn,
+                       struct iscsi_task *task, bool in_recovery);
+void qedi_trace_io(struct qedi_ctx *qedi, struct iscsi_task *task,
+                  u16 tid, int8_t direction);
+int qedi_alloc_id(struct qedi_portid_tbl *id_tbl, u16 id);
+u16 qedi_alloc_new_id(struct qedi_portid_tbl *id_tbl);
+void qedi_free_id(struct qedi_portid_tbl *id_tbl, u16 id);
+int qedi_create_sysfs_ctx_attr(struct qedi_ctx *qedi);
+void qedi_remove_sysfs_ctx_attr(struct qedi_ctx *qedi);
+void qedi_clearsq(struct qedi_ctx *qedi,
+                 struct qedi_conn *qedi_conn,
+                 struct iscsi_task *task);
+
+#endif
diff --git a/drivers/scsi/qedi/qedi_hsi.h b/drivers/scsi/qedi/qedi_hsi.h
new file mode 100644 (file)
index 0000000..8ca44c7
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+#ifndef __QEDI_HSI__
+#define __QEDI_HSI__
+/*
+ * Add include to common target
+ */
+#include <linux/qed/common_hsi.h>
+
+/*
+ * Add include to common storage target
+ */
+#include <linux/qed/storage_common.h>
+
+/*
+ * Add include to common TCP target
+ */
+#include <linux/qed/tcp_common.h>
+
+/*
+ * Add include to common iSCSI target for both eCore and protocol driver
+ */
+#include <linux/qed/iscsi_common.h>
+
+/*
+ * iSCSI CMDQ element
+ */
+struct iscsi_cmdqe {
+       __le16 conn_id;
+       u8 invalid_command;
+       u8 cmd_hdr_type;
+       __le32 reserved1[2];
+       __le32 cmd_payload[13];
+};
+
+/*
+ * iSCSI CMD header type
+ */
+enum iscsi_cmd_hdr_type {
+       ISCSI_CMD_HDR_TYPE_BHS_ONLY /* iSCSI BHS with no expected AHS */,
+       ISCSI_CMD_HDR_TYPE_BHS_W_AHS /* iSCSI BHS with expected AHS */,
+       ISCSI_CMD_HDR_TYPE_AHS /* iSCSI AHS */,
+       MAX_ISCSI_CMD_HDR_TYPE
+};
+
+#endif /* __QEDI_HSI__ */
diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c
new file mode 100644 (file)
index 0000000..d6a2054
--- /dev/null
@@ -0,0 +1,1624 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#include <linux/blkdev.h>
+#include <linux/etherdevice.h>
+#include <linux/if_ether.h>
+#include <linux/if_vlan.h>
+#include <scsi/scsi_tcq.h>
+
+#include "qedi.h"
+#include "qedi_iscsi.h"
+#include "qedi_gbl.h"
+
+int qedi_recover_all_conns(struct qedi_ctx *qedi)
+{
+       struct qedi_conn *qedi_conn;
+       int i;
+
+       for (i = 0; i < qedi->max_active_conns; i++) {
+               qedi_conn = qedi_get_conn_from_id(qedi, i);
+               if (!qedi_conn)
+                       continue;
+
+               qedi_start_conn_recovery(qedi, qedi_conn);
+       }
+
+       return SUCCESS;
+}
+
+static int qedi_eh_host_reset(struct scsi_cmnd *cmd)
+{
+       struct Scsi_Host *shost = cmd->device->host;
+       struct qedi_ctx *qedi;
+
+       qedi = iscsi_host_priv(shost);
+
+       return qedi_recover_all_conns(qedi);
+}
+
+struct scsi_host_template qedi_host_template = {
+       .module = THIS_MODULE,
+       .name = "QLogic QEDI 25/40/100Gb iSCSI Initiator Driver",
+       .proc_name = QEDI_MODULE_NAME,
+       .queuecommand = iscsi_queuecommand,
+       .eh_abort_handler = iscsi_eh_abort,
+       .eh_device_reset_handler = iscsi_eh_device_reset,
+       .eh_target_reset_handler = iscsi_eh_recover_target,
+       .eh_host_reset_handler = qedi_eh_host_reset,
+       .target_alloc = iscsi_target_alloc,
+       .change_queue_depth = scsi_change_queue_depth,
+       .can_queue = QEDI_MAX_ISCSI_TASK,
+       .this_id = -1,
+       .sg_tablesize = QEDI_ISCSI_MAX_BDS_PER_CMD,
+       .max_sectors = 0xffff,
+       .cmd_per_lun = 128,
+       .use_clustering = ENABLE_CLUSTERING,
+       .shost_attrs = qedi_shost_attrs,
+};
+
+static void qedi_conn_free_login_resources(struct qedi_ctx *qedi,
+                                          struct qedi_conn *qedi_conn)
+{
+       if (qedi_conn->gen_pdu.resp_bd_tbl) {
+               dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
+                                 qedi_conn->gen_pdu.resp_bd_tbl,
+                                 qedi_conn->gen_pdu.resp_bd_dma);
+               qedi_conn->gen_pdu.resp_bd_tbl = NULL;
+       }
+
+       if (qedi_conn->gen_pdu.req_bd_tbl) {
+               dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
+                                 qedi_conn->gen_pdu.req_bd_tbl,
+                                 qedi_conn->gen_pdu.req_bd_dma);
+               qedi_conn->gen_pdu.req_bd_tbl = NULL;
+       }
+
+       if (qedi_conn->gen_pdu.resp_buf) {
+               dma_free_coherent(&qedi->pdev->dev,
+                                 ISCSI_DEF_MAX_RECV_SEG_LEN,
+                                 qedi_conn->gen_pdu.resp_buf,
+                                 qedi_conn->gen_pdu.resp_dma_addr);
+               qedi_conn->gen_pdu.resp_buf = NULL;
+       }
+
+       if (qedi_conn->gen_pdu.req_buf) {
+               dma_free_coherent(&qedi->pdev->dev,
+                                 ISCSI_DEF_MAX_RECV_SEG_LEN,
+                                 qedi_conn->gen_pdu.req_buf,
+                                 qedi_conn->gen_pdu.req_dma_addr);
+               qedi_conn->gen_pdu.req_buf = NULL;
+       }
+}
+
+static int qedi_conn_alloc_login_resources(struct qedi_ctx *qedi,
+                                          struct qedi_conn *qedi_conn)
+{
+       qedi_conn->gen_pdu.req_buf =
+               dma_alloc_coherent(&qedi->pdev->dev,
+                                  ISCSI_DEF_MAX_RECV_SEG_LEN,
+                                  &qedi_conn->gen_pdu.req_dma_addr,
+                                  GFP_KERNEL);
+       if (!qedi_conn->gen_pdu.req_buf)
+               goto login_req_buf_failure;
+
+       qedi_conn->gen_pdu.req_buf_size = 0;
+       qedi_conn->gen_pdu.req_wr_ptr = qedi_conn->gen_pdu.req_buf;
+
+       qedi_conn->gen_pdu.resp_buf =
+               dma_alloc_coherent(&qedi->pdev->dev,
+                                  ISCSI_DEF_MAX_RECV_SEG_LEN,
+                                  &qedi_conn->gen_pdu.resp_dma_addr,
+                                  GFP_KERNEL);
+       if (!qedi_conn->gen_pdu.resp_buf)
+               goto login_resp_buf_failure;
+
+       qedi_conn->gen_pdu.resp_buf_size = ISCSI_DEF_MAX_RECV_SEG_LEN;
+       qedi_conn->gen_pdu.resp_wr_ptr = qedi_conn->gen_pdu.resp_buf;
+
+       qedi_conn->gen_pdu.req_bd_tbl =
+               dma_alloc_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
+                                  &qedi_conn->gen_pdu.req_bd_dma, GFP_KERNEL);
+       if (!qedi_conn->gen_pdu.req_bd_tbl)
+               goto login_req_bd_tbl_failure;
+
+       qedi_conn->gen_pdu.resp_bd_tbl =
+               dma_alloc_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
+                                  &qedi_conn->gen_pdu.resp_bd_dma,
+                                  GFP_KERNEL);
+       if (!qedi_conn->gen_pdu.resp_bd_tbl)
+               goto login_resp_bd_tbl_failure;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SESS,
+                 "Allocation successful, cid=0x%x\n",
+                 qedi_conn->iscsi_conn_id);
+       return 0;
+
+login_resp_bd_tbl_failure:
+       dma_free_coherent(&qedi->pdev->dev, QEDI_PAGE_SIZE,
+                         qedi_conn->gen_pdu.req_bd_tbl,
+                         qedi_conn->gen_pdu.req_bd_dma);
+       qedi_conn->gen_pdu.req_bd_tbl = NULL;
+
+login_req_bd_tbl_failure:
+       dma_free_coherent(&qedi->pdev->dev, ISCSI_DEF_MAX_RECV_SEG_LEN,
+                         qedi_conn->gen_pdu.resp_buf,
+                         qedi_conn->gen_pdu.resp_dma_addr);
+       qedi_conn->gen_pdu.resp_buf = NULL;
+login_resp_buf_failure:
+       dma_free_coherent(&qedi->pdev->dev, ISCSI_DEF_MAX_RECV_SEG_LEN,
+                         qedi_conn->gen_pdu.req_buf,
+                         qedi_conn->gen_pdu.req_dma_addr);
+       qedi_conn->gen_pdu.req_buf = NULL;
+login_req_buf_failure:
+       iscsi_conn_printk(KERN_ERR, qedi_conn->cls_conn->dd_data,
+                         "login resource alloc failed!!\n");
+       return -ENOMEM;
+}
+
+static void qedi_destroy_cmd_pool(struct qedi_ctx *qedi,
+                                 struct iscsi_session *session)
+{
+       int i;
+
+       for (i = 0; i < session->cmds_max; i++) {
+               struct iscsi_task *task = session->cmds[i];
+               struct qedi_cmd *cmd = task->dd_data;
+
+               if (cmd->io_tbl.sge_tbl)
+                       dma_free_coherent(&qedi->pdev->dev,
+                                         QEDI_ISCSI_MAX_BDS_PER_CMD *
+                                         sizeof(struct iscsi_sge),
+                                         cmd->io_tbl.sge_tbl,
+                                         cmd->io_tbl.sge_tbl_dma);
+
+               if (cmd->sense_buffer)
+                       dma_free_coherent(&qedi->pdev->dev,
+                                         SCSI_SENSE_BUFFERSIZE,
+                                         cmd->sense_buffer,
+                                         cmd->sense_buffer_dma);
+       }
+}
+
+static int qedi_alloc_sget(struct qedi_ctx *qedi, struct iscsi_session *session,
+                          struct qedi_cmd *cmd)
+{
+       struct qedi_io_bdt *io = &cmd->io_tbl;
+       struct iscsi_sge *sge;
+
+       io->sge_tbl = dma_alloc_coherent(&qedi->pdev->dev,
+                                        QEDI_ISCSI_MAX_BDS_PER_CMD *
+                                        sizeof(*sge),
+                                        &io->sge_tbl_dma, GFP_KERNEL);
+       if (!io->sge_tbl) {
+               iscsi_session_printk(KERN_ERR, session,
+                                    "Could not allocate BD table.\n");
+               return -ENOMEM;
+       }
+
+       io->sge_valid = 0;
+       return 0;
+}
+
+static int qedi_setup_cmd_pool(struct qedi_ctx *qedi,
+                              struct iscsi_session *session)
+{
+       int i;
+
+       for (i = 0; i < session->cmds_max; i++) {
+               struct iscsi_task *task = session->cmds[i];
+               struct qedi_cmd *cmd = task->dd_data;
+
+               task->hdr = &cmd->hdr;
+               task->hdr_max = sizeof(struct iscsi_hdr);
+
+               if (qedi_alloc_sget(qedi, session, cmd))
+                       goto free_sgets;
+
+               cmd->sense_buffer = dma_alloc_coherent(&qedi->pdev->dev,
+                                                      SCSI_SENSE_BUFFERSIZE,
+                                                      &cmd->sense_buffer_dma,
+                                                      GFP_KERNEL);
+               if (!cmd->sense_buffer)
+                       goto free_sgets;
+       }
+
+       return 0;
+
+free_sgets:
+       qedi_destroy_cmd_pool(qedi, session);
+       return -ENOMEM;
+}
+
+static struct iscsi_cls_session *
+qedi_session_create(struct iscsi_endpoint *ep, u16 cmds_max,
+                   u16 qdepth, uint32_t initial_cmdsn)
+{
+       struct Scsi_Host *shost;
+       struct iscsi_cls_session *cls_session;
+       struct qedi_ctx *qedi;
+       struct qedi_endpoint *qedi_ep;
+
+       if (!ep)
+               return NULL;
+
+       qedi_ep = ep->dd_data;
+       shost = qedi_ep->qedi->shost;
+       qedi = iscsi_host_priv(shost);
+
+       if (cmds_max > qedi->max_sqes)
+               cmds_max = qedi->max_sqes;
+       else if (cmds_max < QEDI_SQ_WQES_MIN)
+               cmds_max = QEDI_SQ_WQES_MIN;
+
+       cls_session = iscsi_session_setup(&qedi_iscsi_transport, shost,
+                                         cmds_max, 0, sizeof(struct qedi_cmd),
+                                         initial_cmdsn, ISCSI_MAX_TARGET);
+       if (!cls_session) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Failed to setup session for ep=%p\n", qedi_ep);
+               return NULL;
+       }
+
+       if (qedi_setup_cmd_pool(qedi, cls_session->dd_data)) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Failed to setup cmd pool for ep=%p\n", qedi_ep);
+               goto session_teardown;
+       }
+
+       return cls_session;
+
+session_teardown:
+       iscsi_session_teardown(cls_session);
+       return NULL;
+}
+
+static void qedi_session_destroy(struct iscsi_cls_session *cls_session)
+{
+       struct iscsi_session *session = cls_session->dd_data;
+       struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
+       struct qedi_ctx *qedi = iscsi_host_priv(shost);
+
+       qedi_destroy_cmd_pool(qedi, session);
+       iscsi_session_teardown(cls_session);
+}
+
+static struct iscsi_cls_conn *
+qedi_conn_create(struct iscsi_cls_session *cls_session, uint32_t cid)
+{
+       struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
+       struct qedi_ctx *qedi = iscsi_host_priv(shost);
+       struct iscsi_cls_conn *cls_conn;
+       struct qedi_conn *qedi_conn;
+       struct iscsi_conn *conn;
+
+       cls_conn = iscsi_conn_setup(cls_session, sizeof(*qedi_conn),
+                                   cid);
+       if (!cls_conn) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "conn_new: iscsi conn setup failed, cid=0x%x, cls_sess=%p!\n",
+                        cid, cls_session);
+               return NULL;
+       }
+
+       conn = cls_conn->dd_data;
+       qedi_conn = conn->dd_data;
+       qedi_conn->cls_conn = cls_conn;
+       qedi_conn->qedi = qedi;
+       qedi_conn->ep = NULL;
+       qedi_conn->active_cmd_count = 0;
+       INIT_LIST_HEAD(&qedi_conn->active_cmd_list);
+       spin_lock_init(&qedi_conn->list_lock);
+
+       if (qedi_conn_alloc_login_resources(qedi, qedi_conn)) {
+               iscsi_conn_printk(KERN_ALERT, conn,
+                                 "conn_new: login resc alloc failed, cid=0x%x, cls_sess=%p!!\n",
+                                  cid, cls_session);
+               goto free_conn;
+       }
+
+       return cls_conn;
+
+free_conn:
+       iscsi_conn_teardown(cls_conn);
+       return NULL;
+}
+
+void qedi_mark_device_missing(struct iscsi_cls_session *cls_session)
+{
+       iscsi_block_session(cls_session);
+}
+
+void qedi_mark_device_available(struct iscsi_cls_session *cls_session)
+{
+       iscsi_unblock_session(cls_session);
+}
+
+static int qedi_bind_conn_to_iscsi_cid(struct qedi_ctx *qedi,
+                                      struct qedi_conn *qedi_conn)
+{
+       u32 iscsi_cid = qedi_conn->iscsi_conn_id;
+
+       if (qedi->cid_que.conn_cid_tbl[iscsi_cid]) {
+               iscsi_conn_printk(KERN_ALERT, qedi_conn->cls_conn->dd_data,
+                                 "conn bind - entry #%d not free\n",
+                                 iscsi_cid);
+               return -EBUSY;
+       }
+
+       qedi->cid_que.conn_cid_tbl[iscsi_cid] = qedi_conn;
+       return 0;
+}
+
+struct qedi_conn *qedi_get_conn_from_id(struct qedi_ctx *qedi, u32 iscsi_cid)
+{
+       if (!qedi->cid_que.conn_cid_tbl) {
+               QEDI_ERR(&qedi->dbg_ctx, "missing conn<->cid table\n");
+               return NULL;
+
+       } else if (iscsi_cid >= qedi->max_active_conns) {
+               QEDI_ERR(&qedi->dbg_ctx, "wrong cid #%d\n", iscsi_cid);
+               return NULL;
+       }
+       return qedi->cid_que.conn_cid_tbl[iscsi_cid];
+}
+
+static int qedi_conn_bind(struct iscsi_cls_session *cls_session,
+                         struct iscsi_cls_conn *cls_conn,
+                         u64 transport_fd, int is_leading)
+{
+       struct iscsi_conn *conn = cls_conn->dd_data;
+       struct qedi_conn *qedi_conn = conn->dd_data;
+       struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
+       struct qedi_ctx *qedi = iscsi_host_priv(shost);
+       struct qedi_endpoint *qedi_ep;
+       struct iscsi_endpoint *ep;
+
+       ep = iscsi_lookup_endpoint(transport_fd);
+       if (!ep)
+               return -EINVAL;
+
+       qedi_ep = ep->dd_data;
+       if ((qedi_ep->state == EP_STATE_TCP_FIN_RCVD) ||
+           (qedi_ep->state == EP_STATE_TCP_RST_RCVD))
+               return -EINVAL;
+
+       if (iscsi_conn_bind(cls_session, cls_conn, is_leading))
+               return -EINVAL;
+
+       qedi_ep->conn = qedi_conn;
+       qedi_conn->ep = qedi_ep;
+       qedi_conn->iscsi_conn_id = qedi_ep->iscsi_cid;
+       qedi_conn->fw_cid = qedi_ep->fw_cid;
+       qedi_conn->cmd_cleanup_req = 0;
+       qedi_conn->cmd_cleanup_cmpl = 0;
+
+       if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn))
+               return -EINVAL;
+
+       spin_lock_init(&qedi_conn->tmf_work_lock);
+       INIT_LIST_HEAD(&qedi_conn->tmf_work_list);
+       init_waitqueue_head(&qedi_conn->wait_queue);
+       return 0;
+}
+
+static int qedi_iscsi_update_conn(struct qedi_ctx *qedi,
+                                 struct qedi_conn *qedi_conn)
+{
+       struct qed_iscsi_params_update *conn_info;
+       struct iscsi_cls_conn *cls_conn = qedi_conn->cls_conn;
+       struct iscsi_conn *conn = cls_conn->dd_data;
+       struct qedi_endpoint *qedi_ep;
+       int rval;
+
+       qedi_ep = qedi_conn->ep;
+
+       conn_info = kzalloc(sizeof(*conn_info), GFP_KERNEL);
+       if (!conn_info) {
+               QEDI_ERR(&qedi->dbg_ctx, "memory alloc failed\n");
+               return -ENOMEM;
+       }
+
+       conn_info->update_flag = 0;
+
+       if (conn->hdrdgst_en)
+               SET_FIELD(conn_info->update_flag,
+                         ISCSI_CONN_UPDATE_RAMROD_PARAMS_HD_EN, true);
+       if (conn->datadgst_en)
+               SET_FIELD(conn_info->update_flag,
+                         ISCSI_CONN_UPDATE_RAMROD_PARAMS_DD_EN, true);
+       if (conn->session->initial_r2t_en)
+               SET_FIELD(conn_info->update_flag,
+                         ISCSI_CONN_UPDATE_RAMROD_PARAMS_INITIAL_R2T,
+                         true);
+       if (conn->session->imm_data_en)
+               SET_FIELD(conn_info->update_flag,
+                         ISCSI_CONN_UPDATE_RAMROD_PARAMS_IMMEDIATE_DATA,
+                         true);
+
+       conn_info->max_seq_size = conn->session->max_burst;
+       conn_info->max_recv_pdu_length = conn->max_recv_dlength;
+       conn_info->max_send_pdu_length = conn->max_xmit_dlength;
+       conn_info->first_seq_length = conn->session->first_burst;
+       conn_info->exp_stat_sn = conn->exp_statsn;
+
+       rval = qedi_ops->update_conn(qedi->cdev, qedi_ep->handle,
+                                    conn_info);
+       if (rval) {
+               rval = -ENXIO;
+               QEDI_ERR(&qedi->dbg_ctx, "Could not update connection\n");
+               goto update_conn_err;
+       }
+
+       kfree(conn_info);
+       rval = 0;
+
+update_conn_err:
+       return rval;
+}
+
+static u16 qedi_calc_mss(u16 pmtu, u8 is_ipv6, u8 tcp_ts_en, u8 vlan_en)
+{
+       u16 mss = 0;
+       u16 hdrs = TCP_HDR_LEN;
+
+       if (is_ipv6)
+               hdrs += IPV6_HDR_LEN;
+       else
+               hdrs += IPV4_HDR_LEN;
+
+       if (vlan_en)
+               hdrs += VLAN_LEN;
+
+       mss = pmtu - hdrs;
+
+       if (tcp_ts_en)
+               mss -= TCP_OPTION_LEN;
+
+       if (!mss)
+               mss = DEF_MSS;
+
+       return mss;
+}
+
+static int qedi_iscsi_offload_conn(struct qedi_endpoint *qedi_ep)
+{
+       struct qedi_ctx *qedi = qedi_ep->qedi;
+       struct qed_iscsi_params_offload *conn_info;
+       int rval;
+       int i;
+
+       conn_info = kzalloc(sizeof(*conn_info), GFP_KERNEL);
+       if (!conn_info) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Failed to allocate memory ep=%p\n", qedi_ep);
+               return -ENOMEM;
+       }
+
+       ether_addr_copy(conn_info->src.mac, qedi_ep->src_mac);
+       ether_addr_copy(conn_info->dst.mac, qedi_ep->dst_mac);
+
+       conn_info->src.ip[0] = ntohl(qedi_ep->src_addr[0]);
+       conn_info->dst.ip[0] = ntohl(qedi_ep->dst_addr[0]);
+
+       if (qedi_ep->ip_type == TCP_IPV4) {
+               conn_info->ip_version = 0;
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                         "After ntohl: src_addr=%pI4, dst_addr=%pI4\n",
+                         qedi_ep->src_addr, qedi_ep->dst_addr);
+       } else {
+               for (i = 1; i < 4; i++) {
+                       conn_info->src.ip[i] = ntohl(qedi_ep->src_addr[i]);
+                       conn_info->dst.ip[i] = ntohl(qedi_ep->dst_addr[i]);
+               }
+
+               conn_info->ip_version = 1;
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                         "After ntohl: src_addr=%pI6, dst_addr=%pI6\n",
+                         qedi_ep->src_addr, qedi_ep->dst_addr);
+       }
+
+       conn_info->src.port = qedi_ep->src_port;
+       conn_info->dst.port = qedi_ep->dst_port;
+
+       conn_info->layer_code = ISCSI_SLOW_PATH_LAYER_CODE;
+       conn_info->sq_pbl_addr = qedi_ep->sq_pbl_dma;
+       conn_info->vlan_id = qedi_ep->vlan_id;
+
+       SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_TS_EN, 1);
+       SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_DA_EN, 1);
+       SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_DA_CNT_EN, 1);
+       SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_KA_EN, 1);
+
+       conn_info->default_cq = (qedi_ep->fw_cid % 8);
+
+       conn_info->ka_max_probe_cnt = DEF_KA_MAX_PROBE_COUNT;
+       conn_info->dup_ack_theshold = 3;
+       conn_info->rcv_wnd = 65535;
+       conn_info->cwnd = DEF_MAX_CWND;
+
+       conn_info->ss_thresh = 65535;
+       conn_info->srtt = 300;
+       conn_info->rtt_var = 150;
+       conn_info->flow_label = 0;
+       conn_info->ka_timeout = DEF_KA_TIMEOUT;
+       conn_info->ka_interval = DEF_KA_INTERVAL;
+       conn_info->max_rt_time = DEF_MAX_RT_TIME;
+       conn_info->ttl = DEF_TTL;
+       conn_info->tos_or_tc = DEF_TOS;
+       conn_info->remote_port = qedi_ep->dst_port;
+       conn_info->local_port = qedi_ep->src_port;
+
+       conn_info->mss = qedi_calc_mss(qedi_ep->pmtu,
+                                      (qedi_ep->ip_type == TCP_IPV6),
+                                      1, (qedi_ep->vlan_id != 0));
+
+       conn_info->rcv_wnd_scale = 4;
+       conn_info->ts_ticks_per_second = 1000;
+       conn_info->da_timeout_value = 200;
+       conn_info->ack_frequency = 2;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                 "Default cq index [%d], mss [%d]\n",
+                 conn_info->default_cq, conn_info->mss);
+
+       rval = qedi_ops->offload_conn(qedi->cdev, qedi_ep->handle, conn_info);
+       if (rval)
+               QEDI_ERR(&qedi->dbg_ctx, "offload_conn returned %d, ep=%p\n",
+                        rval, qedi_ep);
+
+       kfree(conn_info);
+       return rval;
+}
+
+static int qedi_conn_start(struct iscsi_cls_conn *cls_conn)
+{
+       struct iscsi_conn *conn = cls_conn->dd_data;
+       struct qedi_conn *qedi_conn = conn->dd_data;
+       struct qedi_ctx *qedi;
+       int rval;
+
+       qedi = qedi_conn->qedi;
+
+       rval = qedi_iscsi_update_conn(qedi, qedi_conn);
+       if (rval) {
+               iscsi_conn_printk(KERN_ALERT, conn,
+                                 "conn_start: FW oflload conn failed.\n");
+               rval = -EINVAL;
+               goto start_err;
+       }
+
+       clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags);
+       qedi_conn->abrt_conn = 0;
+
+       rval = iscsi_conn_start(cls_conn);
+       if (rval) {
+               iscsi_conn_printk(KERN_ALERT, conn,
+                                 "iscsi_conn_start: FW oflload conn failed!!\n");
+       }
+
+start_err:
+       return rval;
+}
+
+static void qedi_conn_destroy(struct iscsi_cls_conn *cls_conn)
+{
+       struct iscsi_conn *conn = cls_conn->dd_data;
+       struct qedi_conn *qedi_conn = conn->dd_data;
+       struct Scsi_Host *shost;
+       struct qedi_ctx *qedi;
+
+       shost = iscsi_session_to_shost(iscsi_conn_to_session(cls_conn));
+       qedi = iscsi_host_priv(shost);
+
+       qedi_conn_free_login_resources(qedi, qedi_conn);
+       iscsi_conn_teardown(cls_conn);
+}
+
+static int qedi_ep_get_param(struct iscsi_endpoint *ep,
+                            enum iscsi_param param, char *buf)
+{
+       struct qedi_endpoint *qedi_ep = ep->dd_data;
+       int len;
+
+       if (!qedi_ep)
+               return -ENOTCONN;
+
+       switch (param) {
+       case ISCSI_PARAM_CONN_PORT:
+               len = sprintf(buf, "%hu\n", qedi_ep->dst_port);
+               break;
+       case ISCSI_PARAM_CONN_ADDRESS:
+               if (qedi_ep->ip_type == TCP_IPV4)
+                       len = sprintf(buf, "%pI4\n", qedi_ep->dst_addr);
+               else
+                       len = sprintf(buf, "%pI6\n", qedi_ep->dst_addr);
+               break;
+       default:
+               return -ENOTCONN;
+       }
+
+       return len;
+}
+
+static int qedi_host_get_param(struct Scsi_Host *shost,
+                              enum iscsi_host_param param, char *buf)
+{
+       struct qedi_ctx *qedi;
+       int len;
+
+       qedi = iscsi_host_priv(shost);
+
+       switch (param) {
+       case ISCSI_HOST_PARAM_HWADDRESS:
+               len = sysfs_format_mac(buf, qedi->mac, 6);
+               break;
+       case ISCSI_HOST_PARAM_NETDEV_NAME:
+               len = sprintf(buf, "host%d\n", shost->host_no);
+               break;
+       case ISCSI_HOST_PARAM_IPADDRESS:
+               if (qedi->ip_type == TCP_IPV4)
+                       len = sprintf(buf, "%pI4\n", qedi->src_ip);
+               else
+                       len = sprintf(buf, "%pI6\n", qedi->src_ip);
+               break;
+       default:
+               return iscsi_host_get_param(shost, param, buf);
+       }
+
+       return len;
+}
+
+static void qedi_conn_get_stats(struct iscsi_cls_conn *cls_conn,
+                               struct iscsi_stats *stats)
+{
+       struct iscsi_conn *conn = cls_conn->dd_data;
+       struct qed_iscsi_stats iscsi_stats;
+       struct Scsi_Host *shost;
+       struct qedi_ctx *qedi;
+
+       shost = iscsi_session_to_shost(iscsi_conn_to_session(cls_conn));
+       qedi = iscsi_host_priv(shost);
+       qedi_ops->get_stats(qedi->cdev, &iscsi_stats);
+
+       conn->txdata_octets = iscsi_stats.iscsi_tx_bytes_cnt;
+       conn->rxdata_octets = iscsi_stats.iscsi_rx_bytes_cnt;
+       conn->dataout_pdus_cnt = (uint32_t)iscsi_stats.iscsi_tx_data_pdu_cnt;
+       conn->datain_pdus_cnt = (uint32_t)iscsi_stats.iscsi_rx_data_pdu_cnt;
+       conn->r2t_pdus_cnt = (uint32_t)iscsi_stats.iscsi_rx_r2t_pdu_cnt;
+
+       stats->txdata_octets = conn->txdata_octets;
+       stats->rxdata_octets = conn->rxdata_octets;
+       stats->scsicmd_pdus = conn->scsicmd_pdus_cnt;
+       stats->dataout_pdus = conn->dataout_pdus_cnt;
+       stats->scsirsp_pdus = conn->scsirsp_pdus_cnt;
+       stats->datain_pdus = conn->datain_pdus_cnt;
+       stats->r2t_pdus = conn->r2t_pdus_cnt;
+       stats->tmfcmd_pdus = conn->tmfcmd_pdus_cnt;
+       stats->tmfrsp_pdus = conn->tmfrsp_pdus_cnt;
+       stats->digest_err = 0;
+       stats->timeout_err = 0;
+       strcpy(stats->custom[0].desc, "eh_abort_cnt");
+       stats->custom[0].value = conn->eh_abort_cnt;
+       stats->custom_length = 1;
+}
+
+static void qedi_iscsi_prep_generic_pdu_bd(struct qedi_conn *qedi_conn)
+{
+       struct iscsi_sge *bd_tbl;
+
+       bd_tbl = (struct iscsi_sge *)qedi_conn->gen_pdu.req_bd_tbl;
+
+       bd_tbl->sge_addr.hi =
+               (u32)((u64)qedi_conn->gen_pdu.req_dma_addr >> 32);
+       bd_tbl->sge_addr.lo = (u32)qedi_conn->gen_pdu.req_dma_addr;
+       bd_tbl->sge_len = qedi_conn->gen_pdu.req_wr_ptr -
+                               qedi_conn->gen_pdu.req_buf;
+       bd_tbl->reserved0 = 0;
+       bd_tbl = (struct iscsi_sge  *)qedi_conn->gen_pdu.resp_bd_tbl;
+       bd_tbl->sge_addr.hi =
+                       (u32)((u64)qedi_conn->gen_pdu.resp_dma_addr >> 32);
+       bd_tbl->sge_addr.lo = (u32)qedi_conn->gen_pdu.resp_dma_addr;
+       bd_tbl->sge_len = ISCSI_DEF_MAX_RECV_SEG_LEN;
+       bd_tbl->reserved0 = 0;
+}
+
+static int qedi_iscsi_send_generic_request(struct iscsi_task *task)
+{
+       struct qedi_cmd *cmd = task->dd_data;
+       struct qedi_conn *qedi_conn = cmd->conn;
+       char *buf;
+       int data_len;
+       int rc = 0;
+
+       qedi_iscsi_prep_generic_pdu_bd(qedi_conn);
+       switch (task->hdr->opcode & ISCSI_OPCODE_MASK) {
+       case ISCSI_OP_LOGIN:
+               qedi_send_iscsi_login(qedi_conn, task);
+               break;
+       case ISCSI_OP_NOOP_OUT:
+               data_len = qedi_conn->gen_pdu.req_buf_size;
+               buf = qedi_conn->gen_pdu.req_buf;
+               if (data_len)
+                       rc = qedi_send_iscsi_nopout(qedi_conn, task,
+                                                   buf, data_len, 1);
+               else
+                       rc = qedi_send_iscsi_nopout(qedi_conn, task,
+                                                   NULL, 0, 1);
+               break;
+       case ISCSI_OP_LOGOUT:
+               rc = qedi_send_iscsi_logout(qedi_conn, task);
+               break;
+       case ISCSI_OP_SCSI_TMFUNC:
+               rc = qedi_iscsi_abort_work(qedi_conn, task);
+               break;
+       case ISCSI_OP_TEXT:
+               rc = qedi_send_iscsi_text(qedi_conn, task);
+               break;
+       default:
+               iscsi_conn_printk(KERN_ALERT, qedi_conn->cls_conn->dd_data,
+                                 "unsupported op 0x%x\n", task->hdr->opcode);
+       }
+
+       return rc;
+}
+
+static int qedi_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task)
+{
+       struct qedi_conn *qedi_conn = conn->dd_data;
+       struct qedi_cmd *cmd = task->dd_data;
+
+       memset(qedi_conn->gen_pdu.req_buf, 0, ISCSI_DEF_MAX_RECV_SEG_LEN);
+
+       qedi_conn->gen_pdu.req_buf_size = task->data_count;
+
+       if (task->data_count) {
+               memcpy(qedi_conn->gen_pdu.req_buf, task->data,
+                      task->data_count);
+               qedi_conn->gen_pdu.req_wr_ptr =
+                       qedi_conn->gen_pdu.req_buf + task->data_count;
+       }
+
+       cmd->conn = conn->dd_data;
+       cmd->scsi_cmd = NULL;
+       return qedi_iscsi_send_generic_request(task);
+}
+
+static int qedi_task_xmit(struct iscsi_task *task)
+{
+       struct iscsi_conn *conn = task->conn;
+       struct qedi_conn *qedi_conn = conn->dd_data;
+       struct qedi_cmd *cmd = task->dd_data;
+       struct scsi_cmnd *sc = task->sc;
+
+       cmd->state = 0;
+       cmd->task = NULL;
+       cmd->use_slowpath = false;
+       cmd->conn = qedi_conn;
+       cmd->task = task;
+       cmd->io_cmd_in_list = false;
+       INIT_LIST_HEAD(&cmd->io_cmd);
+
+       if (!sc)
+               return qedi_mtask_xmit(conn, task);
+
+       cmd->scsi_cmd = sc;
+       return qedi_iscsi_send_ioreq(task);
+}
+
+static struct iscsi_endpoint *
+qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
+               int non_blocking)
+{
+       struct qedi_ctx *qedi;
+       struct iscsi_endpoint *ep;
+       struct qedi_endpoint *qedi_ep;
+       struct sockaddr_in *addr;
+       struct sockaddr_in6 *addr6;
+       struct qed_dev *cdev  =  NULL;
+       struct qedi_uio_dev *udev = NULL;
+       struct iscsi_path path_req;
+       u32 msg_type = ISCSI_KEVENT_IF_DOWN;
+       u32 iscsi_cid = QEDI_CID_RESERVED;
+       u16 len = 0;
+       char *buf = NULL;
+       int ret;
+
+       if (!shost) {
+               ret = -ENXIO;
+               QEDI_ERR(NULL, "shost is NULL\n");
+               return ERR_PTR(ret);
+       }
+
+       if (do_not_recover) {
+               ret = -ENOMEM;
+               return ERR_PTR(ret);
+       }
+
+       qedi = iscsi_host_priv(shost);
+       cdev = qedi->cdev;
+       udev = qedi->udev;
+
+       if (test_bit(QEDI_IN_OFFLINE, &qedi->flags) ||
+           test_bit(QEDI_IN_RECOVERY, &qedi->flags)) {
+               ret = -ENOMEM;
+               return ERR_PTR(ret);
+       }
+
+       ep = iscsi_create_endpoint(sizeof(struct qedi_endpoint));
+       if (!ep) {
+               QEDI_ERR(&qedi->dbg_ctx, "endpoint create fail\n");
+               ret = -ENOMEM;
+               return ERR_PTR(ret);
+       }
+       qedi_ep = ep->dd_data;
+       memset(qedi_ep, 0, sizeof(struct qedi_endpoint));
+       qedi_ep->state = EP_STATE_IDLE;
+       qedi_ep->iscsi_cid = (u32)-1;
+       qedi_ep->qedi = qedi;
+
+       if (dst_addr->sa_family == AF_INET) {
+               addr = (struct sockaddr_in *)dst_addr;
+               memcpy(qedi_ep->dst_addr, &addr->sin_addr.s_addr,
+                      sizeof(struct in_addr));
+               qedi_ep->dst_port = ntohs(addr->sin_port);
+               qedi_ep->ip_type = TCP_IPV4;
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                         "dst_addr=%pI4, dst_port=%u\n",
+                         qedi_ep->dst_addr, qedi_ep->dst_port);
+       } else if (dst_addr->sa_family == AF_INET6) {
+               addr6 = (struct sockaddr_in6 *)dst_addr;
+               memcpy(qedi_ep->dst_addr, &addr6->sin6_addr,
+                      sizeof(struct in6_addr));
+               qedi_ep->dst_port = ntohs(addr6->sin6_port);
+               qedi_ep->ip_type = TCP_IPV6;
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                         "dst_addr=%pI6, dst_port=%u\n",
+                         qedi_ep->dst_addr, qedi_ep->dst_port);
+       } else {
+               QEDI_ERR(&qedi->dbg_ctx, "Invalid endpoint\n");
+       }
+
+       if (atomic_read(&qedi->link_state) != QEDI_LINK_UP) {
+               QEDI_WARN(&qedi->dbg_ctx, "qedi link down\n");
+               ret = -ENXIO;
+               goto ep_conn_exit;
+       }
+
+       ret = qedi_alloc_sq(qedi, qedi_ep);
+       if (ret)
+               goto ep_conn_exit;
+
+       ret = qedi_ops->acquire_conn(qedi->cdev, &qedi_ep->handle,
+                                    &qedi_ep->fw_cid, &qedi_ep->p_doorbell);
+
+       if (ret) {
+               QEDI_ERR(&qedi->dbg_ctx, "Could not acquire connection\n");
+               ret = -ENXIO;
+               goto ep_free_sq;
+       }
+
+       iscsi_cid = qedi_ep->handle;
+       qedi_ep->iscsi_cid = iscsi_cid;
+
+       init_waitqueue_head(&qedi_ep->ofld_wait);
+       init_waitqueue_head(&qedi_ep->tcp_ofld_wait);
+       qedi_ep->state = EP_STATE_OFLDCONN_START;
+       qedi->ep_tbl[iscsi_cid] = qedi_ep;
+
+       buf = (char *)&path_req;
+       len = sizeof(path_req);
+       memset(&path_req, 0, len);
+
+       msg_type = ISCSI_KEVENT_PATH_REQ;
+       path_req.handle = (u64)qedi_ep->iscsi_cid;
+       path_req.pmtu = qedi->ll2_mtu;
+       qedi_ep->pmtu = qedi->ll2_mtu;
+       if (qedi_ep->ip_type == TCP_IPV4) {
+               memcpy(&path_req.dst.v4_addr, &qedi_ep->dst_addr,
+                      sizeof(struct in_addr));
+               path_req.ip_addr_len = 4;
+       } else {
+               memcpy(&path_req.dst.v6_addr, &qedi_ep->dst_addr,
+                      sizeof(struct in6_addr));
+               path_req.ip_addr_len = 16;
+       }
+
+       ret = iscsi_offload_mesg(shost, &qedi_iscsi_transport, msg_type, buf,
+                                len);
+       if (ret) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "iscsi_offload_mesg() failed for cid=0x%x ret=%d\n",
+                        iscsi_cid, ret);
+               goto ep_rel_conn;
+       }
+
+       atomic_inc(&qedi->num_offloads);
+       return ep;
+
+ep_rel_conn:
+       qedi->ep_tbl[iscsi_cid] = NULL;
+       ret = qedi_ops->release_conn(qedi->cdev, qedi_ep->handle);
+       if (ret)
+               QEDI_WARN(&qedi->dbg_ctx, "release_conn returned %d\n",
+                         ret);
+ep_free_sq:
+       qedi_free_sq(qedi, qedi_ep);
+ep_conn_exit:
+       iscsi_destroy_endpoint(ep);
+       return ERR_PTR(ret);
+}
+
+static int qedi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
+{
+       struct qedi_endpoint *qedi_ep;
+       int ret = 0;
+
+       if (do_not_recover)
+               return 1;
+
+       qedi_ep = ep->dd_data;
+       if (qedi_ep->state == EP_STATE_IDLE ||
+           qedi_ep->state == EP_STATE_OFLDCONN_FAILED)
+               return -1;
+
+       if (qedi_ep->state == EP_STATE_OFLDCONN_COMPL)
+               ret = 1;
+
+       ret = wait_event_interruptible_timeout(qedi_ep->ofld_wait,
+                                              QEDI_OFLD_WAIT_STATE(qedi_ep),
+                                              msecs_to_jiffies(timeout_ms));
+
+       if (qedi_ep->state == EP_STATE_OFLDCONN_FAILED)
+               ret = -1;
+
+       if (ret > 0)
+               return 1;
+       else if (!ret)
+               return 0;
+       else
+               return ret;
+}
+
+static void qedi_cleanup_active_cmd_list(struct qedi_conn *qedi_conn)
+{
+       struct qedi_cmd *cmd, *cmd_tmp;
+
+       list_for_each_entry_safe(cmd, cmd_tmp, &qedi_conn->active_cmd_list,
+                                io_cmd) {
+               list_del_init(&cmd->io_cmd);
+               qedi_conn->active_cmd_count--;
+       }
+}
+
+static void qedi_ep_disconnect(struct iscsi_endpoint *ep)
+{
+       struct qedi_endpoint *qedi_ep;
+       struct qedi_conn *qedi_conn = NULL;
+       struct iscsi_conn *conn = NULL;
+       struct qedi_ctx *qedi;
+       int ret = 0;
+       int wait_delay = 20 * HZ;
+       int abrt_conn = 0;
+       int count = 10;
+
+       qedi_ep = ep->dd_data;
+       qedi = qedi_ep->qedi;
+
+       flush_work(&qedi_ep->offload_work);
+
+       if (qedi_ep->conn) {
+               qedi_conn = qedi_ep->conn;
+               conn = qedi_conn->cls_conn->dd_data;
+               iscsi_suspend_queue(conn);
+               abrt_conn = qedi_conn->abrt_conn;
+
+               while (count--) {
+                       if (!test_bit(QEDI_CONN_FW_CLEANUP,
+                                     &qedi_conn->flags)) {
+                               break;
+                       }
+                       msleep(1000);
+               }
+
+               if (test_bit(QEDI_IN_RECOVERY, &qedi->flags)) {
+                       if (do_not_recover) {
+                               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                                         "Do not recover cid=0x%x\n",
+                                         qedi_ep->iscsi_cid);
+                               goto ep_exit_recover;
+                       }
+                       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                                 "Reset recovery cid=0x%x, qedi_ep=%p, state=0x%x\n",
+                                 qedi_ep->iscsi_cid, qedi_ep, qedi_ep->state);
+                       qedi_cleanup_active_cmd_list(qedi_conn);
+                       goto ep_release_conn;
+               }
+       }
+
+       if (do_not_recover)
+               goto ep_exit_recover;
+
+       switch (qedi_ep->state) {
+       case EP_STATE_OFLDCONN_START:
+               goto ep_release_conn;
+       case EP_STATE_OFLDCONN_FAILED:
+                       break;
+       case EP_STATE_OFLDCONN_COMPL:
+               if (unlikely(!qedi_conn))
+                       break;
+
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                         "Active cmd count=%d, abrt_conn=%d, ep state=0x%x, cid=0x%x, qedi_conn=%p\n",
+                         qedi_conn->active_cmd_count, abrt_conn,
+                         qedi_ep->state,
+                         qedi_ep->iscsi_cid,
+                         qedi_ep->conn
+                         );
+
+               if (!qedi_conn->active_cmd_count)
+                       abrt_conn = 0;
+               else
+                       abrt_conn = 1;
+
+               if (abrt_conn)
+                       qedi_clearsq(qedi, qedi_conn, NULL);
+               break;
+       default:
+               break;
+       }
+
+       qedi_ep->state = EP_STATE_DISCONN_START;
+       ret = qedi_ops->destroy_conn(qedi->cdev, qedi_ep->handle, abrt_conn);
+       if (ret) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "destroy_conn failed returned %d\n", ret);
+       } else {
+               ret = wait_event_interruptible_timeout(
+                                       qedi_ep->tcp_ofld_wait,
+                                       (qedi_ep->state !=
+                                        EP_STATE_DISCONN_START),
+                                       wait_delay);
+               if ((ret <= 0) || (qedi_ep->state == EP_STATE_DISCONN_START)) {
+                       QEDI_WARN(&qedi->dbg_ctx,
+                                 "Destroy conn timedout or interrupted, ret=%d, delay=%d, cid=0x%x\n",
+                                 ret, wait_delay, qedi_ep->iscsi_cid);
+               }
+       }
+
+ep_release_conn:
+       ret = qedi_ops->release_conn(qedi->cdev, qedi_ep->handle);
+       if (ret)
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "release_conn returned %d, cid=0x%x\n",
+                         ret, qedi_ep->iscsi_cid);
+ep_exit_recover:
+       qedi_ep->state = EP_STATE_IDLE;
+       qedi->ep_tbl[qedi_ep->iscsi_cid] = NULL;
+       qedi->cid_que.conn_cid_tbl[qedi_ep->iscsi_cid] = NULL;
+       qedi_free_id(&qedi->lcl_port_tbl, qedi_ep->src_port);
+       qedi_free_sq(qedi, qedi_ep);
+
+       if (qedi_conn)
+               qedi_conn->ep = NULL;
+
+       qedi_ep->conn = NULL;
+       qedi_ep->qedi = NULL;
+       atomic_dec(&qedi->num_offloads);
+
+       iscsi_destroy_endpoint(ep);
+}
+
+static int qedi_data_avail(struct qedi_ctx *qedi, u16 vlanid)
+{
+       struct qed_dev *cdev = qedi->cdev;
+       struct qedi_uio_dev *udev;
+       struct qedi_uio_ctrl *uctrl;
+       struct sk_buff *skb;
+       u32 len;
+       int rc = 0;
+
+       udev = qedi->udev;
+       if (!udev) {
+               QEDI_ERR(&qedi->dbg_ctx, "udev is NULL.\n");
+               return -EINVAL;
+       }
+
+       uctrl = (struct qedi_uio_ctrl *)udev->uctrl;
+       if (!uctrl) {
+               QEDI_ERR(&qedi->dbg_ctx, "uctlr is NULL.\n");
+               return -EINVAL;
+       }
+
+       len = uctrl->host_tx_pkt_len;
+       if (!len) {
+               QEDI_ERR(&qedi->dbg_ctx, "Invalid len %u\n", len);
+               return -EINVAL;
+       }
+
+       skb = alloc_skb(len, GFP_ATOMIC);
+       if (!skb) {
+               QEDI_ERR(&qedi->dbg_ctx, "alloc_skb failed\n");
+               return -EINVAL;
+       }
+
+       skb_put(skb, len);
+       memcpy(skb->data, udev->tx_pkt, len);
+       skb->ip_summed = CHECKSUM_NONE;
+
+       if (vlanid)
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlanid);
+
+       rc = qedi_ops->ll2->start_xmit(cdev, skb);
+       if (rc) {
+               QEDI_ERR(&qedi->dbg_ctx, "ll2 start_xmit returned %d\n",
+                        rc);
+               kfree_skb(skb);
+       }
+
+       uctrl->host_tx_pkt_len = 0;
+       uctrl->hw_tx_cons++;
+
+       return rc;
+}
+
+static void qedi_offload_work(struct work_struct *work)
+{
+       struct qedi_endpoint *qedi_ep =
+               container_of(work, struct qedi_endpoint, offload_work);
+       struct qedi_ctx *qedi;
+       int wait_delay = 20 * HZ;
+       int ret;
+
+       qedi = qedi_ep->qedi;
+
+       ret = qedi_iscsi_offload_conn(qedi_ep);
+       if (ret) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "offload error: iscsi_cid=%u, qedi_ep=%p, ret=%d\n",
+                        qedi_ep->iscsi_cid, qedi_ep, ret);
+               qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
+               return;
+       }
+
+       ret = wait_event_interruptible_timeout(qedi_ep->tcp_ofld_wait,
+                                              (qedi_ep->state ==
+                                              EP_STATE_OFLDCONN_COMPL),
+                                              wait_delay);
+       if ((ret <= 0) || (qedi_ep->state != EP_STATE_OFLDCONN_COMPL)) {
+               qedi_ep->state = EP_STATE_OFLDCONN_FAILED;
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Offload conn TIMEOUT iscsi_cid=%u, qedi_ep=%p\n",
+                        qedi_ep->iscsi_cid, qedi_ep);
+       }
+}
+
+static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data)
+{
+       struct qedi_ctx *qedi;
+       struct qedi_endpoint *qedi_ep;
+       int ret = 0;
+       u32 iscsi_cid;
+       u16 port_id = 0;
+
+       if (!shost) {
+               ret = -ENXIO;
+               QEDI_ERR(NULL, "shost is NULL\n");
+               return ret;
+       }
+
+       if (strcmp(shost->hostt->proc_name, "qedi")) {
+               ret = -ENXIO;
+               QEDI_ERR(NULL, "shost %s is invalid\n",
+                        shost->hostt->proc_name);
+               return ret;
+       }
+
+       qedi = iscsi_host_priv(shost);
+       if (path_data->handle == QEDI_PATH_HANDLE) {
+               ret = qedi_data_avail(qedi, path_data->vlan_id);
+               goto set_path_exit;
+       }
+
+       iscsi_cid = (u32)path_data->handle;
+       qedi_ep = qedi->ep_tbl[iscsi_cid];
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                 "iscsi_cid=0x%x, qedi_ep=%p\n", iscsi_cid, qedi_ep);
+
+       if (!is_valid_ether_addr(&path_data->mac_addr[0])) {
+               QEDI_NOTICE(&qedi->dbg_ctx, "dst mac NOT VALID\n");
+               ret = -EIO;
+               goto set_path_exit;
+       }
+
+       ether_addr_copy(&qedi_ep->src_mac[0], &qedi->mac[0]);
+       ether_addr_copy(&qedi_ep->dst_mac[0], &path_data->mac_addr[0]);
+
+       qedi_ep->vlan_id = path_data->vlan_id;
+       if (path_data->pmtu < DEF_PATH_MTU) {
+               qedi_ep->pmtu = qedi->ll2_mtu;
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                         "MTU cannot be %u, using default MTU %u\n",
+                          path_data->pmtu, qedi_ep->pmtu);
+       }
+
+       if (path_data->pmtu != qedi->ll2_mtu) {
+               if (path_data->pmtu > JUMBO_MTU) {
+                       ret = -EINVAL;
+                       QEDI_ERR(NULL, "Invalid MTU %u\n", path_data->pmtu);
+                       goto set_path_exit;
+               }
+
+               qedi_reset_host_mtu(qedi, path_data->pmtu);
+               qedi_ep->pmtu = qedi->ll2_mtu;
+       }
+
+       port_id = qedi_ep->src_port;
+       if (port_id >= QEDI_LOCAL_PORT_MIN &&
+           port_id < QEDI_LOCAL_PORT_MAX) {
+               if (qedi_alloc_id(&qedi->lcl_port_tbl, port_id))
+                       port_id = 0;
+       } else {
+               port_id = 0;
+       }
+
+       if (!port_id) {
+               port_id = qedi_alloc_new_id(&qedi->lcl_port_tbl);
+               if (port_id == QEDI_LOCAL_PORT_INVALID) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Failed to allocate port id for iscsi_cid=0x%x\n",
+                                iscsi_cid);
+                       ret = -ENOMEM;
+                       goto set_path_exit;
+               }
+       }
+
+       qedi_ep->src_port = port_id;
+
+       if (qedi_ep->ip_type == TCP_IPV4) {
+               memcpy(&qedi_ep->src_addr[0], &path_data->src.v4_addr,
+                      sizeof(struct in_addr));
+               memcpy(&qedi->src_ip[0], &path_data->src.v4_addr,
+                      sizeof(struct in_addr));
+               qedi->ip_type = TCP_IPV4;
+
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                         "src addr:port=%pI4:%u, dst addr:port=%pI4:%u\n",
+                         qedi_ep->src_addr, qedi_ep->src_port,
+                         qedi_ep->dst_addr, qedi_ep->dst_port);
+       } else {
+               memcpy(&qedi_ep->src_addr[0], &path_data->src.v6_addr,
+                      sizeof(struct in6_addr));
+               memcpy(&qedi->src_ip[0], &path_data->src.v6_addr,
+                      sizeof(struct in6_addr));
+               qedi->ip_type = TCP_IPV6;
+
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                         "src addr:port=%pI6:%u, dst addr:port=%pI6:%u\n",
+                         qedi_ep->src_addr, qedi_ep->src_port,
+                         qedi_ep->dst_addr, qedi_ep->dst_port);
+       }
+
+       INIT_WORK(&qedi_ep->offload_work, qedi_offload_work);
+       queue_work(qedi->offload_thread, &qedi_ep->offload_work);
+
+       ret = 0;
+
+set_path_exit:
+       return ret;
+}
+
+static umode_t qedi_attr_is_visible(int param_type, int param)
+{
+       switch (param_type) {
+       case ISCSI_HOST_PARAM:
+               switch (param) {
+               case ISCSI_HOST_PARAM_NETDEV_NAME:
+               case ISCSI_HOST_PARAM_HWADDRESS:
+               case ISCSI_HOST_PARAM_IPADDRESS:
+                       return 0444;
+               default:
+                       return 0;
+               }
+       case ISCSI_PARAM:
+               switch (param) {
+               case ISCSI_PARAM_MAX_RECV_DLENGTH:
+               case ISCSI_PARAM_MAX_XMIT_DLENGTH:
+               case ISCSI_PARAM_HDRDGST_EN:
+               case ISCSI_PARAM_DATADGST_EN:
+               case ISCSI_PARAM_CONN_ADDRESS:
+               case ISCSI_PARAM_CONN_PORT:
+               case ISCSI_PARAM_EXP_STATSN:
+               case ISCSI_PARAM_PERSISTENT_ADDRESS:
+               case ISCSI_PARAM_PERSISTENT_PORT:
+               case ISCSI_PARAM_PING_TMO:
+               case ISCSI_PARAM_RECV_TMO:
+               case ISCSI_PARAM_INITIAL_R2T_EN:
+               case ISCSI_PARAM_MAX_R2T:
+               case ISCSI_PARAM_IMM_DATA_EN:
+               case ISCSI_PARAM_FIRST_BURST:
+               case ISCSI_PARAM_MAX_BURST:
+               case ISCSI_PARAM_PDU_INORDER_EN:
+               case ISCSI_PARAM_DATASEQ_INORDER_EN:
+               case ISCSI_PARAM_ERL:
+               case ISCSI_PARAM_TARGET_NAME:
+               case ISCSI_PARAM_TPGT:
+               case ISCSI_PARAM_USERNAME:
+               case ISCSI_PARAM_PASSWORD:
+               case ISCSI_PARAM_USERNAME_IN:
+               case ISCSI_PARAM_PASSWORD_IN:
+               case ISCSI_PARAM_FAST_ABORT:
+               case ISCSI_PARAM_ABORT_TMO:
+               case ISCSI_PARAM_LU_RESET_TMO:
+               case ISCSI_PARAM_TGT_RESET_TMO:
+               case ISCSI_PARAM_IFACE_NAME:
+               case ISCSI_PARAM_INITIATOR_NAME:
+               case ISCSI_PARAM_BOOT_ROOT:
+               case ISCSI_PARAM_BOOT_NIC:
+               case ISCSI_PARAM_BOOT_TARGET:
+                       return 0444;
+               default:
+                       return 0;
+               }
+       }
+
+       return 0;
+}
+
+static void qedi_cleanup_task(struct iscsi_task *task)
+{
+       if (!task->sc || task->state == ISCSI_TASK_PENDING) {
+               QEDI_INFO(NULL, QEDI_LOG_IO, "Returning ref_cnt=%d\n",
+                         atomic_read(&task->refcount));
+               return;
+       }
+
+       qedi_iscsi_unmap_sg_list(task->dd_data);
+}
+
+struct iscsi_transport qedi_iscsi_transport = {
+       .owner = THIS_MODULE,
+       .name = QEDI_MODULE_NAME,
+       .caps = CAP_RECOVERY_L0 | CAP_HDRDGST | CAP_MULTI_R2T | CAP_DATADGST |
+               CAP_DATA_PATH_OFFLOAD | CAP_TEXT_NEGO,
+       .create_session = qedi_session_create,
+       .destroy_session = qedi_session_destroy,
+       .create_conn = qedi_conn_create,
+       .bind_conn = qedi_conn_bind,
+       .start_conn = qedi_conn_start,
+       .stop_conn = iscsi_conn_stop,
+       .destroy_conn = qedi_conn_destroy,
+       .set_param = iscsi_set_param,
+       .get_ep_param = qedi_ep_get_param,
+       .get_conn_param = iscsi_conn_get_param,
+       .get_session_param = iscsi_session_get_param,
+       .get_host_param = qedi_host_get_param,
+       .send_pdu = iscsi_conn_send_pdu,
+       .get_stats = qedi_conn_get_stats,
+       .xmit_task = qedi_task_xmit,
+       .cleanup_task = qedi_cleanup_task,
+       .session_recovery_timedout = iscsi_session_recovery_timedout,
+       .ep_connect = qedi_ep_connect,
+       .ep_poll = qedi_ep_poll,
+       .ep_disconnect = qedi_ep_disconnect,
+       .set_path = qedi_set_path,
+       .attr_is_visible = qedi_attr_is_visible,
+};
+
+void qedi_start_conn_recovery(struct qedi_ctx *qedi,
+                             struct qedi_conn *qedi_conn)
+{
+       struct iscsi_cls_session *cls_sess;
+       struct iscsi_cls_conn *cls_conn;
+       struct iscsi_conn *conn;
+
+       cls_conn = qedi_conn->cls_conn;
+       conn = cls_conn->dd_data;
+       cls_sess = iscsi_conn_to_session(cls_conn);
+
+       if (iscsi_is_session_online(cls_sess)) {
+               qedi_conn->abrt_conn = 1;
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Failing connection, state=0x%x, cid=0x%x\n",
+                        conn->session->state, qedi_conn->iscsi_conn_id);
+               iscsi_conn_failure(qedi_conn->cls_conn->dd_data,
+                                  ISCSI_ERR_CONN_FAILED);
+       }
+}
+
+static const struct {
+       enum iscsi_error_types error_code;
+       char *err_string;
+} qedi_iscsi_error[] = {
+       { ISCSI_STATUS_NONE,
+         "tcp_error none"
+       },
+       { ISCSI_CONN_ERROR_TASK_CID_MISMATCH,
+         "task cid mismatch"
+       },
+       { ISCSI_CONN_ERROR_TASK_NOT_VALID,
+         "invalid task"
+       },
+       { ISCSI_CONN_ERROR_RQ_RING_IS_FULL,
+         "rq ring full"
+       },
+       { ISCSI_CONN_ERROR_CMDQ_RING_IS_FULL,
+         "cmdq ring full"
+       },
+       { ISCSI_CONN_ERROR_HQE_CACHING_FAILED,
+         "sge caching failed"
+       },
+       { ISCSI_CONN_ERROR_HEADER_DIGEST_ERROR,
+         "hdr digest error"
+       },
+       { ISCSI_CONN_ERROR_LOCAL_COMPLETION_ERROR,
+         "local cmpl error"
+       },
+       { ISCSI_CONN_ERROR_DATA_OVERRUN,
+         "invalid task"
+       },
+       { ISCSI_CONN_ERROR_OUT_OF_SGES_ERROR,
+         "out of sge error"
+       },
+       { ISCSI_CONN_ERROR_TCP_SEG_PROC_IP_OPTIONS_ERROR,
+         "tcp seg ip options error"
+       },
+       { ISCSI_CONN_ERROR_TCP_IP_FRAGMENT_ERROR,
+         "tcp ip fragment error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_AHS_LEN,
+         "AHS len protocol error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_ITT_OUT_OF_RANGE,
+         "itt out of range error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_EXCEEDS_PDU_SIZE,
+         "data seg more than pdu size"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE,
+         "invalid opcode"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_OPCODE_BEFORE_UPDATE,
+         "invalid opcode before update"
+       },
+       { ISCSI_CONN_ERROR_UNVALID_NOPIN_DSL,
+         "unexpected opcode"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_CARRIES_NO_DATA,
+         "r2t carries no data"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SN,
+         "data sn error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_IN_TTT,
+         "data TTT error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_TTT,
+         "r2t TTT error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_BUFFER_OFFSET,
+         "buffer offset error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_BUFFER_OFFSET_OOO,
+         "buffer offset ooo"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_R2T_SN,
+         "data seg len 0"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_0,
+         "data xer len error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_1,
+         "data xer len1 error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_2,
+         "data xer len2 error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_LUN,
+         "protocol lun error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_F_BIT_ZERO,
+         "f bit zero error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_EXP_STAT_SN,
+         "exp stat sn error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_DSL_NOT_ZERO,
+         "dsl not zero error"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_INVALID_DSL,
+         "invalid dsl"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_DATA_SEG_LEN_TOO_BIG,
+         "data seg len too big"
+       },
+       { ISCSI_CONN_ERROR_PROTOCOL_ERR_OUTSTANDING_R2T_COUNT,
+         "outstanding r2t count error"
+       },
+       { ISCSI_CONN_ERROR_SENSE_DATA_LENGTH,
+         "sense datalen error"
+       },
+};
+
+char *qedi_get_iscsi_error(enum iscsi_error_types err_code)
+{
+       int i;
+       char *msg = NULL;
+
+       for (i = 0; i < ARRAY_SIZE(qedi_iscsi_error); i++) {
+               if (qedi_iscsi_error[i].error_code == err_code) {
+                       msg = qedi_iscsi_error[i].err_string;
+                       break;
+               }
+       }
+       return msg;
+}
+
+void qedi_process_iscsi_error(struct qedi_endpoint *ep, struct async_data *data)
+{
+       struct qedi_conn *qedi_conn;
+       struct qedi_ctx *qedi;
+       char warn_notice[] = "iscsi_warning";
+       char error_notice[] = "iscsi_error";
+       char unknown_msg[] = "Unknown error";
+       char *message;
+       int need_recovery = 0;
+       u32 err_mask = 0;
+       char *msg;
+
+       if (!ep)
+               return;
+
+       qedi_conn = ep->conn;
+       if (!qedi_conn)
+               return;
+
+       qedi = ep->qedi;
+
+       QEDI_ERR(&qedi->dbg_ctx, "async event iscsi error:0x%x\n",
+                data->error_code);
+
+       if (err_mask) {
+               need_recovery = 0;
+               message = warn_notice;
+       } else {
+               need_recovery = 1;
+               message = error_notice;
+       }
+
+       msg = qedi_get_iscsi_error(data->error_code);
+       if (!msg) {
+               need_recovery = 0;
+               msg = unknown_msg;
+       }
+
+       iscsi_conn_printk(KERN_ALERT,
+                         qedi_conn->cls_conn->dd_data,
+                         "qedi: %s - %s\n", message, msg);
+
+       if (need_recovery)
+               qedi_start_conn_recovery(qedi_conn->qedi, qedi_conn);
+}
+
+void qedi_process_tcp_error(struct qedi_endpoint *ep, struct async_data *data)
+{
+       struct qedi_conn *qedi_conn;
+
+       if (!ep)
+               return;
+
+       qedi_conn = ep->conn;
+       if (!qedi_conn)
+               return;
+
+       QEDI_ERR(&ep->qedi->dbg_ctx, "async event TCP error:0x%x\n",
+                data->error_code);
+
+       qedi_start_conn_recovery(qedi_conn->qedi, qedi_conn);
+}
diff --git a/drivers/scsi/qedi/qedi_iscsi.h b/drivers/scsi/qedi/qedi_iscsi.h
new file mode 100644 (file)
index 0000000..d3c06bb
--- /dev/null
@@ -0,0 +1,232 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#ifndef _QEDI_ISCSI_H_
+#define _QEDI_ISCSI_H_
+
+#include <linux/socket.h>
+#include <linux/completion.h>
+#include "qedi.h"
+
+#define ISCSI_MAX_SESS_PER_HBA 4096
+
+#define DEF_KA_TIMEOUT         7200000
+#define DEF_KA_INTERVAL                10000
+#define DEF_KA_MAX_PROBE_COUNT 10
+#define DEF_TOS                        0
+#define DEF_TTL                        0xfe
+#define DEF_SND_SEQ_SCALE      0
+#define DEF_RCV_BUF            0xffff
+#define DEF_SND_BUF            0xffff
+#define DEF_SEED               0
+#define DEF_MAX_RT_TIME                8000
+#define DEF_MAX_DA_COUNT        2
+#define DEF_SWS_TIMER          1000
+#define DEF_MAX_CWND           2
+#define DEF_PATH_MTU           1500
+#define DEF_MSS                        1460
+#define DEF_LL2_MTU            1560
+#define JUMBO_MTU              9000
+
+#define MIN_MTU         576 /* rfc 793 */
+#define IPV4_HDR_LEN    20
+#define IPV6_HDR_LEN    40
+#define TCP_HDR_LEN     20
+#define TCP_OPTION_LEN  12
+#define VLAN_LEN         4
+
+enum {
+       EP_STATE_IDLE                   = 0x0,
+       EP_STATE_ACQRCONN_START         = 0x1,
+       EP_STATE_ACQRCONN_COMPL         = 0x2,
+       EP_STATE_OFLDCONN_START         = 0x4,
+       EP_STATE_OFLDCONN_COMPL         = 0x8,
+       EP_STATE_DISCONN_START          = 0x10,
+       EP_STATE_DISCONN_COMPL          = 0x20,
+       EP_STATE_CLEANUP_START          = 0x40,
+       EP_STATE_CLEANUP_CMPL           = 0x80,
+       EP_STATE_TCP_FIN_RCVD           = 0x100,
+       EP_STATE_TCP_RST_RCVD           = 0x200,
+       EP_STATE_LOGOUT_SENT            = 0x400,
+       EP_STATE_LOGOUT_RESP_RCVD       = 0x800,
+       EP_STATE_CLEANUP_FAILED         = 0x1000,
+       EP_STATE_OFLDCONN_FAILED        = 0x2000,
+       EP_STATE_CONNECT_FAILED         = 0x4000,
+       EP_STATE_DISCONN_TIMEDOUT       = 0x8000,
+};
+
+struct qedi_conn;
+
+struct qedi_endpoint {
+       struct qedi_ctx *qedi;
+       u32 dst_addr[4];
+       u32 src_addr[4];
+       u16 src_port;
+       u16 dst_port;
+       u16 vlan_id;
+       u16 pmtu;
+       u8 src_mac[ETH_ALEN];
+       u8 dst_mac[ETH_ALEN];
+       u8 ip_type;
+       int state;
+       wait_queue_head_t ofld_wait;
+       wait_queue_head_t tcp_ofld_wait;
+       u32 iscsi_cid;
+       /* identifier of the connection from qed */
+       u32 handle;
+       u32 fw_cid;
+       void __iomem *p_doorbell;
+
+       /* Send queue management */
+       struct iscsi_wqe *sq;
+       dma_addr_t sq_dma;
+
+       u16 sq_prod_idx;
+       u16 fw_sq_prod_idx;
+       u16 sq_con_idx;
+       u32 sq_mem_size;
+
+       void *sq_pbl;
+       dma_addr_t sq_pbl_dma;
+       u32 sq_pbl_size;
+       struct qedi_conn *conn;
+       struct work_struct offload_work;
+};
+
+#define QEDI_SQ_WQES_MIN       16
+
+struct qedi_io_bdt {
+       struct iscsi_sge *sge_tbl;
+       dma_addr_t sge_tbl_dma;
+       u16 sge_valid;
+};
+
+/**
+ * struct generic_pdu_resc - login pdu resource structure
+ *
+ * @req_buf:            driver buffer used to stage payload associated with
+ *                      the login request
+ * @req_dma_addr:       dma address for iscsi login request payload buffer
+ * @req_buf_size:       actual login request payload length
+ * @req_wr_ptr:         pointer into login request buffer when next data is
+ *                      to be written
+ * @resp_hdr:           iscsi header where iscsi login response header is to
+ *                      be recreated
+ * @resp_buf:           buffer to stage login response payload
+ * @resp_dma_addr:      login response payload buffer dma address
+ * @resp_buf_size:      login response paylod length
+ * @resp_wr_ptr:        pointer into login response buffer when next data is
+ *                      to be written
+ * @req_bd_tbl:         iscsi login request payload BD table
+ * @req_bd_dma:         login request BD table dma address
+ * @resp_bd_tbl:        iscsi login response payload BD table
+ * @resp_bd_dma:        login request BD table dma address
+ *
+ * following structure defines buffer info for generic pdus such as iSCSI Login,
+ *      Logout and NOP
+ */
+struct generic_pdu_resc {
+       char *req_buf;
+       dma_addr_t req_dma_addr;
+       u32 req_buf_size;
+       char *req_wr_ptr;
+       struct iscsi_hdr resp_hdr;
+       char *resp_buf;
+       dma_addr_t resp_dma_addr;
+       u32 resp_buf_size;
+       char *resp_wr_ptr;
+       char *req_bd_tbl;
+       dma_addr_t req_bd_dma;
+       char *resp_bd_tbl;
+       dma_addr_t resp_bd_dma;
+};
+
+struct qedi_conn {
+       struct iscsi_cls_conn *cls_conn;
+       struct qedi_ctx *qedi;
+       struct qedi_endpoint *ep;
+       struct list_head active_cmd_list;
+       spinlock_t list_lock;           /* internal conn lock */
+       u32 active_cmd_count;
+       u32 cmd_cleanup_req;
+       u32 cmd_cleanup_cmpl;
+
+       u32 iscsi_conn_id;
+       int itt;
+       int abrt_conn;
+#define QEDI_CID_RESERVED      0x5AFF
+       u32 fw_cid;
+       /*
+        * Buffer for login negotiation process
+        */
+       struct generic_pdu_resc gen_pdu;
+
+       struct list_head tmf_work_list;
+       wait_queue_head_t wait_queue;
+       spinlock_t tmf_work_lock;       /* tmf work lock */
+       unsigned long flags;
+#define QEDI_CONN_FW_CLEANUP   1
+};
+
+struct qedi_cmd {
+       struct list_head io_cmd;
+       bool io_cmd_in_list;
+       struct iscsi_hdr hdr;
+       struct qedi_conn *conn;
+       struct scsi_cmnd *scsi_cmd;
+       struct scatterlist *sg;
+       struct qedi_io_bdt io_tbl;
+       struct iscsi_task_context request;
+       unsigned char *sense_buffer;
+       dma_addr_t sense_buffer_dma;
+       u16 task_id;
+
+       /* field populated for tmf work queue */
+       struct iscsi_task *task;
+       struct work_struct tmf_work;
+       int state;
+#define CLEANUP_WAIT   1
+#define CLEANUP_RECV   2
+#define CLEANUP_WAIT_FAILED    3
+#define CLEANUP_NOT_REQUIRED   4
+#define LUN_RESET_RESPONSE_RECEIVED    5
+#define RESPONSE_RECEIVED      6
+
+       int type;
+#define TYPEIO         1
+#define TYPERESET      2
+
+       struct qedi_work_map *list_tmf_work;
+       /* slowpath management */
+       bool use_slowpath;
+
+       struct iscsi_tm_rsp *tmf_resp_buf;
+       struct qedi_work cqe_work;
+};
+
+struct qedi_work_map {
+       struct list_head list;
+       struct qedi_cmd *qedi_cmd;
+       int rtid;
+
+       int state;
+#define QEDI_WORK_QUEUED       1
+#define QEDI_WORK_SCHEDULED    2
+#define QEDI_WORK_EXIT         3
+
+       struct work_struct *ptr_tmf_work;
+};
+
+#define qedi_set_itt(task_id, itt) ((u32)(((task_id) & 0xffff) | ((itt) << 16)))
+#define qedi_get_itt(cqe) (cqe.iscsi_hdr.cmd.itt >> 16)
+
+#define QEDI_OFLD_WAIT_STATE(q) ((q)->state == EP_STATE_OFLDCONN_FAILED || \
+                               (q)->state == EP_STATE_OFLDCONN_COMPL)
+
+#endif /* _QEDI_ISCSI_H_ */
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
new file mode 100644 (file)
index 0000000..5eda21d
--- /dev/null
@@ -0,0 +1,2095 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/kernel.h>
+#include <linux/if_arp.h>
+#include <scsi/iscsi_if.h>
+#include <linux/inet.h>
+#include <net/arp.h>
+#include <linux/list.h>
+#include <linux/kthread.h>
+#include <linux/mm.h>
+#include <linux/if_vlan.h>
+#include <linux/cpu.h>
+
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_eh.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi.h>
+
+#include "qedi.h"
+#include "qedi_gbl.h"
+#include "qedi_iscsi.h"
+
+static uint qedi_fw_debug;
+module_param(qedi_fw_debug, uint, 0644);
+MODULE_PARM_DESC(qedi_fw_debug, " Firmware debug level 0(default) to 3");
+
+uint qedi_dbg_log = QEDI_LOG_WARN | QEDI_LOG_SCSI_TM;
+module_param(qedi_dbg_log, uint, 0644);
+MODULE_PARM_DESC(qedi_dbg_log, " Default debug level");
+
+uint qedi_io_tracing;
+module_param(qedi_io_tracing, uint, 0644);
+MODULE_PARM_DESC(qedi_io_tracing,
+                " Enable logging of SCSI requests/completions into trace buffer. (default off).");
+
+const struct qed_iscsi_ops *qedi_ops;
+static struct scsi_transport_template *qedi_scsi_transport;
+static struct pci_driver qedi_pci_driver;
+static DEFINE_PER_CPU(struct qedi_percpu_s, qedi_percpu);
+static LIST_HEAD(qedi_udev_list);
+/* Static function declaration */
+static int qedi_alloc_global_queues(struct qedi_ctx *qedi);
+static void qedi_free_global_queues(struct qedi_ctx *qedi);
+static struct qedi_cmd *qedi_get_cmd_from_tid(struct qedi_ctx *qedi, u32 tid);
+static void qedi_reset_uio_rings(struct qedi_uio_dev *udev);
+static void qedi_ll2_free_skbs(struct qedi_ctx *qedi);
+
+static int qedi_iscsi_event_cb(void *context, u8 fw_event_code, void *fw_handle)
+{
+       struct qedi_ctx *qedi;
+       struct qedi_endpoint *qedi_ep;
+       struct async_data *data;
+       int rval = 0;
+
+       if (!context || !fw_handle) {
+               QEDI_ERR(NULL, "Recv event with ctx NULL\n");
+               return -EINVAL;
+       }
+
+       qedi = (struct qedi_ctx *)context;
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                 "Recv Event %d fw_handle %p\n", fw_event_code, fw_handle);
+
+       data = (struct async_data *)fw_handle;
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                 "cid=0x%x tid=0x%x err-code=0x%x fw-dbg-param=0x%x\n",
+                  data->cid, data->itid, data->error_code,
+                  data->fw_debug_param);
+
+       qedi_ep = qedi->ep_tbl[data->cid];
+
+       if (!qedi_ep) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "Cannot process event, ep already disconnected, cid=0x%x\n",
+                          data->cid);
+               WARN_ON(1);
+               return -ENODEV;
+       }
+
+       switch (fw_event_code) {
+       case ISCSI_EVENT_TYPE_ASYN_CONNECT_COMPLETE:
+               if (qedi_ep->state == EP_STATE_OFLDCONN_START)
+                       qedi_ep->state = EP_STATE_OFLDCONN_COMPL;
+
+               wake_up_interruptible(&qedi_ep->tcp_ofld_wait);
+               break;
+       case ISCSI_EVENT_TYPE_ASYN_TERMINATE_DONE:
+               qedi_ep->state = EP_STATE_DISCONN_COMPL;
+               wake_up_interruptible(&qedi_ep->tcp_ofld_wait);
+               break;
+       case ISCSI_EVENT_TYPE_ISCSI_CONN_ERROR:
+               qedi_process_iscsi_error(qedi_ep, data);
+               break;
+       case ISCSI_EVENT_TYPE_ASYN_ABORT_RCVD:
+       case ISCSI_EVENT_TYPE_ASYN_SYN_RCVD:
+       case ISCSI_EVENT_TYPE_ASYN_MAX_RT_TIME:
+       case ISCSI_EVENT_TYPE_ASYN_MAX_RT_CNT:
+       case ISCSI_EVENT_TYPE_ASYN_MAX_KA_PROBES_CNT:
+       case ISCSI_EVENT_TYPE_ASYN_FIN_WAIT2:
+       case ISCSI_EVENT_TYPE_TCP_CONN_ERROR:
+               qedi_process_tcp_error(qedi_ep, data);
+               break;
+       default:
+               QEDI_ERR(&qedi->dbg_ctx, "Recv Unknown Event %u\n",
+                        fw_event_code);
+       }
+
+       return rval;
+}
+
+static int qedi_uio_open(struct uio_info *uinfo, struct inode *inode)
+{
+       struct qedi_uio_dev *udev = uinfo->priv;
+       struct qedi_ctx *qedi = udev->qedi;
+
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
+
+       if (udev->uio_dev != -1)
+               return -EBUSY;
+
+       rtnl_lock();
+       udev->uio_dev = iminor(inode);
+       qedi_reset_uio_rings(udev);
+       set_bit(UIO_DEV_OPENED, &qedi->flags);
+       rtnl_unlock();
+
+       return 0;
+}
+
+static int qedi_uio_close(struct uio_info *uinfo, struct inode *inode)
+{
+       struct qedi_uio_dev *udev = uinfo->priv;
+       struct qedi_ctx *qedi = udev->qedi;
+
+       udev->uio_dev = -1;
+       clear_bit(UIO_DEV_OPENED, &qedi->flags);
+       qedi_ll2_free_skbs(qedi);
+       return 0;
+}
+
+static void __qedi_free_uio_rings(struct qedi_uio_dev *udev)
+{
+       if (udev->ll2_ring) {
+               free_page((unsigned long)udev->ll2_ring);
+               udev->ll2_ring = NULL;
+       }
+
+       if (udev->ll2_buf) {
+               free_pages((unsigned long)udev->ll2_buf, 2);
+               udev->ll2_buf = NULL;
+       }
+}
+
+static void __qedi_free_uio(struct qedi_uio_dev *udev)
+{
+       uio_unregister_device(&udev->qedi_uinfo);
+
+       __qedi_free_uio_rings(udev);
+
+       pci_dev_put(udev->pdev);
+       kfree(udev->uctrl);
+       kfree(udev);
+}
+
+static void qedi_free_uio(struct qedi_uio_dev *udev)
+{
+       if (!udev)
+               return;
+
+       list_del_init(&udev->list);
+       __qedi_free_uio(udev);
+}
+
+static void qedi_reset_uio_rings(struct qedi_uio_dev *udev)
+{
+       struct qedi_ctx *qedi = NULL;
+       struct qedi_uio_ctrl *uctrl = NULL;
+
+       qedi = udev->qedi;
+       uctrl = udev->uctrl;
+
+       spin_lock_bh(&qedi->ll2_lock);
+       uctrl->host_rx_cons = 0;
+       uctrl->hw_rx_prod = 0;
+       uctrl->hw_rx_bd_prod = 0;
+       uctrl->host_rx_bd_cons = 0;
+
+       memset(udev->ll2_ring, 0, udev->ll2_ring_size);
+       memset(udev->ll2_buf, 0, udev->ll2_buf_size);
+       spin_unlock_bh(&qedi->ll2_lock);
+}
+
+static int __qedi_alloc_uio_rings(struct qedi_uio_dev *udev)
+{
+       int rc = 0;
+
+       if (udev->ll2_ring || udev->ll2_buf)
+               return rc;
+
+       /* Allocating memory for LL2 ring  */
+       udev->ll2_ring_size = QEDI_PAGE_SIZE;
+       udev->ll2_ring = (void *)get_zeroed_page(GFP_KERNEL | __GFP_COMP);
+       if (!udev->ll2_ring) {
+               rc = -ENOMEM;
+               goto exit_alloc_ring;
+       }
+
+       /* Allocating memory for Tx/Rx pkt buffer */
+       udev->ll2_buf_size = TX_RX_RING * LL2_SINGLE_BUF_SIZE;
+       udev->ll2_buf_size = QEDI_PAGE_ALIGN(udev->ll2_buf_size);
+       udev->ll2_buf = (void *)__get_free_pages(GFP_KERNEL | __GFP_COMP |
+                                                __GFP_ZERO, 2);
+       if (!udev->ll2_buf) {
+               rc = -ENOMEM;
+               goto exit_alloc_buf;
+       }
+       return rc;
+
+exit_alloc_buf:
+       free_page((unsigned long)udev->ll2_ring);
+       udev->ll2_ring = NULL;
+exit_alloc_ring:
+       return rc;
+}
+
+static int qedi_alloc_uio_rings(struct qedi_ctx *qedi)
+{
+       struct qedi_uio_dev *udev = NULL;
+       struct qedi_uio_ctrl *uctrl = NULL;
+       int rc = 0;
+
+       list_for_each_entry(udev, &qedi_udev_list, list) {
+               if (udev->pdev == qedi->pdev) {
+                       udev->qedi = qedi;
+                       if (__qedi_alloc_uio_rings(udev)) {
+                               udev->qedi = NULL;
+                               return -ENOMEM;
+                       }
+                       qedi->udev = udev;
+                       return 0;
+               }
+       }
+
+       udev = kzalloc(sizeof(*udev), GFP_KERNEL);
+       if (!udev) {
+               rc = -ENOMEM;
+               goto err_udev;
+       }
+
+       uctrl = kzalloc(sizeof(*uctrl), GFP_KERNEL);
+       if (!uctrl) {
+               rc = -ENOMEM;
+               goto err_uctrl;
+       }
+
+       udev->uio_dev = -1;
+
+       udev->qedi = qedi;
+       udev->pdev = qedi->pdev;
+       udev->uctrl = uctrl;
+
+       rc = __qedi_alloc_uio_rings(udev);
+       if (rc)
+               goto err_uio_rings;
+
+       list_add(&udev->list, &qedi_udev_list);
+
+       pci_dev_get(udev->pdev);
+       qedi->udev = udev;
+
+       udev->tx_pkt = udev->ll2_buf;
+       udev->rx_pkt = udev->ll2_buf + LL2_SINGLE_BUF_SIZE;
+       return 0;
+
+ err_uio_rings:
+       kfree(uctrl);
+ err_uctrl:
+       kfree(udev);
+ err_udev:
+       return -ENOMEM;
+}
+
+static int qedi_init_uio(struct qedi_ctx *qedi)
+{
+       struct qedi_uio_dev *udev = qedi->udev;
+       struct uio_info *uinfo;
+       int ret = 0;
+
+       if (!udev)
+               return -ENOMEM;
+
+       uinfo = &udev->qedi_uinfo;
+
+       uinfo->mem[0].addr = (unsigned long)udev->uctrl;
+       uinfo->mem[0].size = sizeof(struct qedi_uio_ctrl);
+       uinfo->mem[0].memtype = UIO_MEM_LOGICAL;
+
+       uinfo->mem[1].addr = (unsigned long)udev->ll2_ring;
+       uinfo->mem[1].size = udev->ll2_ring_size;
+       uinfo->mem[1].memtype = UIO_MEM_LOGICAL;
+
+       uinfo->mem[2].addr = (unsigned long)udev->ll2_buf;
+       uinfo->mem[2].size = udev->ll2_buf_size;
+       uinfo->mem[2].memtype = UIO_MEM_LOGICAL;
+
+       uinfo->name = "qedi_uio";
+       uinfo->version = QEDI_MODULE_VERSION;
+       uinfo->irq = UIO_IRQ_CUSTOM;
+
+       uinfo->open = qedi_uio_open;
+       uinfo->release = qedi_uio_close;
+
+       if (udev->uio_dev == -1) {
+               if (!uinfo->priv) {
+                       uinfo->priv = udev;
+
+                       ret = uio_register_device(&udev->pdev->dev, uinfo);
+                       if (ret) {
+                               QEDI_ERR(&qedi->dbg_ctx,
+                                        "UIO registration failed\n");
+                       }
+               }
+       }
+
+       return ret;
+}
+
+static int qedi_alloc_and_init_sb(struct qedi_ctx *qedi,
+                                 struct qed_sb_info *sb_info, u16 sb_id)
+{
+       struct status_block *sb_virt;
+       dma_addr_t sb_phys;
+       int ret;
+
+       sb_virt = dma_alloc_coherent(&qedi->pdev->dev,
+                                    sizeof(struct status_block), &sb_phys,
+                                    GFP_KERNEL);
+       if (!sb_virt) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Status block allocation failed for id = %d.\n",
+                         sb_id);
+               return -ENOMEM;
+       }
+
+       ret = qedi_ops->common->sb_init(qedi->cdev, sb_info, sb_virt, sb_phys,
+                                      sb_id, QED_SB_TYPE_STORAGE);
+       if (ret) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Status block initialization failed for id = %d.\n",
+                         sb_id);
+               return ret;
+       }
+
+       return 0;
+}
+
+static void qedi_free_sb(struct qedi_ctx *qedi)
+{
+       struct qed_sb_info *sb_info;
+       int id;
+
+       for (id = 0; id < MIN_NUM_CPUS_MSIX(qedi); id++) {
+               sb_info = &qedi->sb_array[id];
+               if (sb_info->sb_virt)
+                       dma_free_coherent(&qedi->pdev->dev,
+                                         sizeof(*sb_info->sb_virt),
+                                         (void *)sb_info->sb_virt,
+                                         sb_info->sb_phys);
+       }
+}
+
+static void qedi_free_fp(struct qedi_ctx *qedi)
+{
+       kfree(qedi->fp_array);
+       kfree(qedi->sb_array);
+}
+
+static void qedi_destroy_fp(struct qedi_ctx *qedi)
+{
+       qedi_free_sb(qedi);
+       qedi_free_fp(qedi);
+}
+
+static int qedi_alloc_fp(struct qedi_ctx *qedi)
+{
+       int ret = 0;
+
+       qedi->fp_array = kcalloc(MIN_NUM_CPUS_MSIX(qedi),
+                                sizeof(struct qedi_fastpath), GFP_KERNEL);
+       if (!qedi->fp_array) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "fastpath fp array allocation failed.\n");
+               return -ENOMEM;
+       }
+
+       qedi->sb_array = kcalloc(MIN_NUM_CPUS_MSIX(qedi),
+                                sizeof(struct qed_sb_info), GFP_KERNEL);
+       if (!qedi->sb_array) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "fastpath sb array allocation failed.\n");
+               ret = -ENOMEM;
+               goto free_fp;
+       }
+
+       return ret;
+
+free_fp:
+       qedi_free_fp(qedi);
+       return ret;
+}
+
+static void qedi_int_fp(struct qedi_ctx *qedi)
+{
+       struct qedi_fastpath *fp;
+       int id;
+
+       memset(qedi->fp_array, 0, MIN_NUM_CPUS_MSIX(qedi) *
+              sizeof(*qedi->fp_array));
+       memset(qedi->sb_array, 0, MIN_NUM_CPUS_MSIX(qedi) *
+              sizeof(*qedi->sb_array));
+
+       for (id = 0; id < MIN_NUM_CPUS_MSIX(qedi); id++) {
+               fp = &qedi->fp_array[id];
+               fp->sb_info = &qedi->sb_array[id];
+               fp->sb_id = id;
+               fp->qedi = qedi;
+               snprintf(fp->name, sizeof(fp->name), "%s-fp-%d",
+                        "qedi", id);
+
+               /* fp_array[i] ---- irq cookie
+                * So init data which is needed in int ctx
+                */
+       }
+}
+
+static int qedi_prepare_fp(struct qedi_ctx *qedi)
+{
+       struct qedi_fastpath *fp;
+       int id, ret = 0;
+
+       ret = qedi_alloc_fp(qedi);
+       if (ret)
+               goto err;
+
+       qedi_int_fp(qedi);
+
+       for (id = 0; id < MIN_NUM_CPUS_MSIX(qedi); id++) {
+               fp = &qedi->fp_array[id];
+               ret = qedi_alloc_and_init_sb(qedi, fp->sb_info, fp->sb_id);
+               if (ret) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "SB allocation and initialization failed.\n");
+                       ret = -EIO;
+                       goto err_init;
+               }
+       }
+
+       return 0;
+
+err_init:
+       qedi_free_sb(qedi);
+       qedi_free_fp(qedi);
+err:
+       return ret;
+}
+
+static int qedi_setup_cid_que(struct qedi_ctx *qedi)
+{
+       int i;
+
+       qedi->cid_que.cid_que_base = kmalloc_array(qedi->max_active_conns,
+                                                  sizeof(u32), GFP_KERNEL);
+       if (!qedi->cid_que.cid_que_base)
+               return -ENOMEM;
+
+       qedi->cid_que.conn_cid_tbl = kmalloc_array(qedi->max_active_conns,
+                                                  sizeof(struct qedi_conn *),
+                                                  GFP_KERNEL);
+       if (!qedi->cid_que.conn_cid_tbl) {
+               kfree(qedi->cid_que.cid_que_base);
+               qedi->cid_que.cid_que_base = NULL;
+               return -ENOMEM;
+       }
+
+       qedi->cid_que.cid_que = (u32 *)qedi->cid_que.cid_que_base;
+       qedi->cid_que.cid_q_prod_idx = 0;
+       qedi->cid_que.cid_q_cons_idx = 0;
+       qedi->cid_que.cid_q_max_idx = qedi->max_active_conns;
+       qedi->cid_que.cid_free_cnt = qedi->max_active_conns;
+
+       for (i = 0; i < qedi->max_active_conns; i++) {
+               qedi->cid_que.cid_que[i] = i;
+               qedi->cid_que.conn_cid_tbl[i] = NULL;
+       }
+
+       return 0;
+}
+
+static void qedi_release_cid_que(struct qedi_ctx *qedi)
+{
+       kfree(qedi->cid_que.cid_que_base);
+       qedi->cid_que.cid_que_base = NULL;
+
+       kfree(qedi->cid_que.conn_cid_tbl);
+       qedi->cid_que.conn_cid_tbl = NULL;
+}
+
+static int qedi_init_id_tbl(struct qedi_portid_tbl *id_tbl, u16 size,
+                           u16 start_id, u16 next)
+{
+       id_tbl->start = start_id;
+       id_tbl->max = size;
+       id_tbl->next = next;
+       spin_lock_init(&id_tbl->lock);
+       id_tbl->table = kzalloc(DIV_ROUND_UP(size, 32) * 4, GFP_KERNEL);
+       if (!id_tbl->table)
+               return -ENOMEM;
+
+       return 0;
+}
+
+static void qedi_free_id_tbl(struct qedi_portid_tbl *id_tbl)
+{
+       kfree(id_tbl->table);
+       id_tbl->table = NULL;
+}
+
+int qedi_alloc_id(struct qedi_portid_tbl *id_tbl, u16 id)
+{
+       int ret = -1;
+
+       id -= id_tbl->start;
+       if (id >= id_tbl->max)
+               return ret;
+
+       spin_lock(&id_tbl->lock);
+       if (!test_bit(id, id_tbl->table)) {
+               set_bit(id, id_tbl->table);
+               ret = 0;
+       }
+       spin_unlock(&id_tbl->lock);
+       return ret;
+}
+
+u16 qedi_alloc_new_id(struct qedi_portid_tbl *id_tbl)
+{
+       u16 id;
+
+       spin_lock(&id_tbl->lock);
+       id = find_next_zero_bit(id_tbl->table, id_tbl->max, id_tbl->next);
+       if (id >= id_tbl->max) {
+               id = QEDI_LOCAL_PORT_INVALID;
+               if (id_tbl->next != 0) {
+                       id = find_first_zero_bit(id_tbl->table, id_tbl->next);
+                       if (id >= id_tbl->next)
+                               id = QEDI_LOCAL_PORT_INVALID;
+               }
+       }
+
+       if (id < id_tbl->max) {
+               set_bit(id, id_tbl->table);
+               id_tbl->next = (id + 1) & (id_tbl->max - 1);
+               id += id_tbl->start;
+       }
+
+       spin_unlock(&id_tbl->lock);
+
+       return id;
+}
+
+void qedi_free_id(struct qedi_portid_tbl *id_tbl, u16 id)
+{
+       if (id == QEDI_LOCAL_PORT_INVALID)
+               return;
+
+       id -= id_tbl->start;
+       if (id >= id_tbl->max)
+               return;
+
+       clear_bit(id, id_tbl->table);
+}
+
+static void qedi_cm_free_mem(struct qedi_ctx *qedi)
+{
+       kfree(qedi->ep_tbl);
+       qedi->ep_tbl = NULL;
+       qedi_free_id_tbl(&qedi->lcl_port_tbl);
+}
+
+static int qedi_cm_alloc_mem(struct qedi_ctx *qedi)
+{
+       u16 port_id;
+
+       qedi->ep_tbl = kzalloc((qedi->max_active_conns *
+                               sizeof(struct qedi_endpoint *)), GFP_KERNEL);
+       if (!qedi->ep_tbl)
+               return -ENOMEM;
+       port_id = prandom_u32() % QEDI_LOCAL_PORT_RANGE;
+       if (qedi_init_id_tbl(&qedi->lcl_port_tbl, QEDI_LOCAL_PORT_RANGE,
+                            QEDI_LOCAL_PORT_MIN, port_id)) {
+               qedi_cm_free_mem(qedi);
+               return -ENOMEM;
+       }
+
+       return 0;
+}
+
+static struct qedi_ctx *qedi_host_alloc(struct pci_dev *pdev)
+{
+       struct Scsi_Host *shost;
+       struct qedi_ctx *qedi = NULL;
+
+       shost = iscsi_host_alloc(&qedi_host_template,
+                                sizeof(struct qedi_ctx), 0);
+       if (!shost) {
+               QEDI_ERR(NULL, "Could not allocate shost\n");
+               goto exit_setup_shost;
+       }
+
+       shost->max_id = QEDI_MAX_ISCSI_CONNS_PER_HBA;
+       shost->max_channel = 0;
+       shost->max_lun = ~0;
+       shost->max_cmd_len = 16;
+       shost->transportt = qedi_scsi_transport;
+
+       qedi = iscsi_host_priv(shost);
+       memset(qedi, 0, sizeof(*qedi));
+       qedi->shost = shost;
+       qedi->dbg_ctx.host_no = shost->host_no;
+       qedi->pdev = pdev;
+       qedi->dbg_ctx.pdev = pdev;
+       qedi->max_active_conns = ISCSI_MAX_SESS_PER_HBA;
+       qedi->max_sqes = QEDI_SQ_SIZE;
+
+       if (shost_use_blk_mq(shost))
+               shost->nr_hw_queues = MIN_NUM_CPUS_MSIX(qedi);
+
+       pci_set_drvdata(pdev, qedi);
+
+exit_setup_shost:
+       return qedi;
+}
+
+static int qedi_ll2_rx(void *cookie, struct sk_buff *skb, u32 arg1, u32 arg2)
+{
+       struct qedi_ctx *qedi = (struct qedi_ctx *)cookie;
+       struct qedi_uio_dev *udev;
+       struct qedi_uio_ctrl *uctrl;
+       struct skb_work_list *work;
+       u32 prod;
+
+       if (!qedi) {
+               QEDI_ERR(NULL, "qedi is NULL\n");
+               return -1;
+       }
+
+       if (!test_bit(UIO_DEV_OPENED, &qedi->flags)) {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_UIO,
+                         "UIO DEV is not opened\n");
+               kfree_skb(skb);
+               return 0;
+       }
+
+       udev = qedi->udev;
+       uctrl = udev->uctrl;
+
+       work = kzalloc(sizeof(*work), GFP_ATOMIC);
+       if (!work) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "Could not allocate work so dropping frame.\n");
+               kfree_skb(skb);
+               return 0;
+       }
+
+       INIT_LIST_HEAD(&work->list);
+       work->skb = skb;
+
+       if (skb_vlan_tag_present(skb))
+               work->vlan_id = skb_vlan_tag_get(skb);
+
+       if (work->vlan_id)
+               __vlan_insert_tag(work->skb, htons(ETH_P_8021Q), work->vlan_id);
+
+       spin_lock_bh(&qedi->ll2_lock);
+       list_add_tail(&work->list, &qedi->ll2_skb_list);
+
+       ++uctrl->hw_rx_prod_cnt;
+       prod = (uctrl->hw_rx_prod + 1) % RX_RING;
+       if (prod != uctrl->host_rx_cons) {
+               uctrl->hw_rx_prod = prod;
+               spin_unlock_bh(&qedi->ll2_lock);
+               wake_up_process(qedi->ll2_recv_thread);
+               return 0;
+       }
+
+       spin_unlock_bh(&qedi->ll2_lock);
+       return 0;
+}
+
+/* map this skb to iscsiuio mmaped region */
+static int qedi_ll2_process_skb(struct qedi_ctx *qedi, struct sk_buff *skb,
+                               u16 vlan_id)
+{
+       struct qedi_uio_dev *udev = NULL;
+       struct qedi_uio_ctrl *uctrl = NULL;
+       struct qedi_rx_bd rxbd;
+       struct qedi_rx_bd *p_rxbd;
+       u32 rx_bd_prod;
+       void *pkt;
+       int len = 0;
+
+       if (!qedi) {
+               QEDI_ERR(NULL, "qedi is NULL\n");
+               return -1;
+       }
+
+       udev = qedi->udev;
+       uctrl = udev->uctrl;
+       pkt = udev->rx_pkt + (uctrl->hw_rx_prod * LL2_SINGLE_BUF_SIZE);
+       len = min_t(u32, skb->len, (u32)LL2_SINGLE_BUF_SIZE);
+       memcpy(pkt, skb->data, len);
+
+       memset(&rxbd, 0, sizeof(rxbd));
+       rxbd.rx_pkt_index = uctrl->hw_rx_prod;
+       rxbd.rx_pkt_len = len;
+       rxbd.vlan_id = vlan_id;
+
+       uctrl->hw_rx_bd_prod = (uctrl->hw_rx_bd_prod + 1) % QEDI_NUM_RX_BD;
+       rx_bd_prod = uctrl->hw_rx_bd_prod;
+       p_rxbd = (struct qedi_rx_bd *)udev->ll2_ring;
+       p_rxbd += rx_bd_prod;
+
+       memcpy(p_rxbd, &rxbd, sizeof(rxbd));
+
+       /* notify the iscsiuio about new packet */
+       uio_event_notify(&udev->qedi_uinfo);
+
+       return 0;
+}
+
+static void qedi_ll2_free_skbs(struct qedi_ctx *qedi)
+{
+       struct skb_work_list *work, *work_tmp;
+
+       spin_lock_bh(&qedi->ll2_lock);
+       list_for_each_entry_safe(work, work_tmp, &qedi->ll2_skb_list, list) {
+               list_del(&work->list);
+               if (work->skb)
+                       kfree_skb(work->skb);
+               kfree(work);
+       }
+       spin_unlock_bh(&qedi->ll2_lock);
+}
+
+static int qedi_ll2_recv_thread(void *arg)
+{
+       struct qedi_ctx *qedi = (struct qedi_ctx *)arg;
+       struct skb_work_list *work, *work_tmp;
+
+       set_user_nice(current, -20);
+
+       while (!kthread_should_stop()) {
+               spin_lock_bh(&qedi->ll2_lock);
+               list_for_each_entry_safe(work, work_tmp, &qedi->ll2_skb_list,
+                                        list) {
+                       list_del(&work->list);
+                       qedi_ll2_process_skb(qedi, work->skb, work->vlan_id);
+                       kfree_skb(work->skb);
+                       kfree(work);
+               }
+               set_current_state(TASK_INTERRUPTIBLE);
+               spin_unlock_bh(&qedi->ll2_lock);
+               schedule();
+       }
+
+       __set_current_state(TASK_RUNNING);
+       return 0;
+}
+
+static int qedi_set_iscsi_pf_param(struct qedi_ctx *qedi)
+{
+       u8 num_sq_pages;
+       u32 log_page_size;
+       int rval = 0;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_DISC, "Min number of MSIX %d\n",
+                 MIN_NUM_CPUS_MSIX(qedi));
+
+       num_sq_pages = (MAX_OUSTANDING_TASKS_PER_CON * 8) / PAGE_SIZE;
+
+       qedi->num_queues = MIN_NUM_CPUS_MSIX(qedi);
+
+       memset(&qedi->pf_params.iscsi_pf_params, 0,
+              sizeof(qedi->pf_params.iscsi_pf_params));
+
+       qedi->p_cpuq = pci_alloc_consistent(qedi->pdev,
+                       qedi->num_queues * sizeof(struct qedi_glbl_q_params),
+                       &qedi->hw_p_cpuq);
+       if (!qedi->p_cpuq) {
+               QEDI_ERR(&qedi->dbg_ctx, "pci_alloc_consistent fail\n");
+               rval = -1;
+               goto err_alloc_mem;
+       }
+
+       rval = qedi_alloc_global_queues(qedi);
+       if (rval) {
+               QEDI_ERR(&qedi->dbg_ctx, "Global queue allocation failed.\n");
+               rval = -1;
+               goto err_alloc_mem;
+       }
+
+       qedi->pf_params.iscsi_pf_params.num_cons = QEDI_MAX_ISCSI_CONNS_PER_HBA;
+       qedi->pf_params.iscsi_pf_params.num_tasks = QEDI_MAX_ISCSI_TASK;
+       qedi->pf_params.iscsi_pf_params.half_way_close_timeout = 10;
+       qedi->pf_params.iscsi_pf_params.num_sq_pages_in_ring = num_sq_pages;
+       qedi->pf_params.iscsi_pf_params.num_r2tq_pages_in_ring = num_sq_pages;
+       qedi->pf_params.iscsi_pf_params.num_uhq_pages_in_ring = num_sq_pages;
+       qedi->pf_params.iscsi_pf_params.num_queues = qedi->num_queues;
+       qedi->pf_params.iscsi_pf_params.debug_mode = qedi_fw_debug;
+
+       for (log_page_size = 0 ; log_page_size < 32 ; log_page_size++) {
+               if ((1 << log_page_size) == PAGE_SIZE)
+                       break;
+       }
+       qedi->pf_params.iscsi_pf_params.log_page_size = log_page_size;
+
+       qedi->pf_params.iscsi_pf_params.glbl_q_params_addr =
+                                                          (u64)qedi->hw_p_cpuq;
+
+       /* RQ BDQ initializations.
+        * rq_num_entries: suggested value for Initiator is 16 (4KB RQ)
+        * rqe_log_size: 8 for 256B RQE
+        */
+       qedi->pf_params.iscsi_pf_params.rqe_log_size = 8;
+       /* BDQ address and size */
+       qedi->pf_params.iscsi_pf_params.bdq_pbl_base_addr[BDQ_ID_RQ] =
+                                                       qedi->bdq_pbl_list_dma;
+       qedi->pf_params.iscsi_pf_params.bdq_pbl_num_entries[BDQ_ID_RQ] =
+                                               qedi->bdq_pbl_list_num_entries;
+       qedi->pf_params.iscsi_pf_params.rq_buffer_size = QEDI_BDQ_BUF_SIZE;
+
+       /* cq_num_entries: num_tasks + rq_num_entries */
+       qedi->pf_params.iscsi_pf_params.cq_num_entries = 2048;
+
+       qedi->pf_params.iscsi_pf_params.gl_rq_pi = QEDI_PROTO_CQ_PROD_IDX;
+       qedi->pf_params.iscsi_pf_params.gl_cmd_pi = 1;
+       qedi->pf_params.iscsi_pf_params.ooo_enable = 1;
+
+err_alloc_mem:
+       return rval;
+}
+
+/* Free DMA coherent memory for array of queue pointers we pass to qed */
+static void qedi_free_iscsi_pf_param(struct qedi_ctx *qedi)
+{
+       size_t size = 0;
+
+       if (qedi->p_cpuq) {
+               size = qedi->num_queues * sizeof(struct qedi_glbl_q_params);
+               pci_free_consistent(qedi->pdev, size, qedi->p_cpuq,
+                                   qedi->hw_p_cpuq);
+       }
+
+       qedi_free_global_queues(qedi);
+
+       kfree(qedi->global_queues);
+}
+
+static void qedi_link_update(void *dev, struct qed_link_output *link)
+{
+       struct qedi_ctx *qedi = (struct qedi_ctx *)dev;
+
+       if (link->link_up) {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, "Link Up event.\n");
+               atomic_set(&qedi->link_state, QEDI_LINK_UP);
+       } else {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                         "Link Down event.\n");
+               atomic_set(&qedi->link_state, QEDI_LINK_DOWN);
+       }
+}
+
+static struct qed_iscsi_cb_ops qedi_cb_ops = {
+       {
+               .link_update =          qedi_link_update,
+       }
+};
+
+static int qedi_queue_cqe(struct qedi_ctx *qedi, union iscsi_cqe *cqe,
+                         u16 que_idx, struct qedi_percpu_s *p)
+{
+       struct qedi_work *qedi_work;
+       struct qedi_conn *q_conn;
+       struct iscsi_conn *conn;
+       struct qedi_cmd *qedi_cmd;
+       u32 iscsi_cid;
+       int rc = 0;
+
+       iscsi_cid  = cqe->cqe_common.conn_id;
+       q_conn = qedi->cid_que.conn_cid_tbl[iscsi_cid];
+       if (!q_conn) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "Session no longer exists for cid=0x%x!!\n",
+                         iscsi_cid);
+               return -1;
+       }
+       conn = q_conn->cls_conn->dd_data;
+
+       switch (cqe->cqe_common.cqe_type) {
+       case ISCSI_CQE_TYPE_SOLICITED:
+       case ISCSI_CQE_TYPE_SOLICITED_WITH_SENSE:
+               qedi_cmd = qedi_get_cmd_from_tid(qedi, cqe->cqe_solicited.itid);
+               if (!qedi_cmd) {
+                       rc = -1;
+                       break;
+               }
+               INIT_LIST_HEAD(&qedi_cmd->cqe_work.list);
+               qedi_cmd->cqe_work.qedi = qedi;
+               memcpy(&qedi_cmd->cqe_work.cqe, cqe, sizeof(union iscsi_cqe));
+               qedi_cmd->cqe_work.que_idx = que_idx;
+               qedi_cmd->cqe_work.is_solicited = true;
+               list_add_tail(&qedi_cmd->cqe_work.list, &p->work_list);
+               break;
+       case ISCSI_CQE_TYPE_UNSOLICITED:
+       case ISCSI_CQE_TYPE_DUMMY:
+       case ISCSI_CQE_TYPE_TASK_CLEANUP:
+               qedi_work = kzalloc(sizeof(*qedi_work), GFP_ATOMIC);
+               if (!qedi_work) {
+                       rc = -1;
+                       break;
+               }
+               INIT_LIST_HEAD(&qedi_work->list);
+               qedi_work->qedi = qedi;
+               memcpy(&qedi_work->cqe, cqe, sizeof(union iscsi_cqe));
+               qedi_work->que_idx = que_idx;
+               qedi_work->is_solicited = false;
+               list_add_tail(&qedi_work->list, &p->work_list);
+               break;
+       default:
+               rc = -1;
+               QEDI_ERR(&qedi->dbg_ctx, "FW Error cqe.\n");
+       }
+       return rc;
+}
+
+static bool qedi_process_completions(struct qedi_fastpath *fp)
+{
+       struct qedi_ctx *qedi = fp->qedi;
+       struct qed_sb_info *sb_info = fp->sb_info;
+       struct status_block *sb = sb_info->sb_virt;
+       struct qedi_percpu_s *p = NULL;
+       struct global_queue *que;
+       u16 prod_idx;
+       unsigned long flags;
+       union iscsi_cqe *cqe;
+       int cpu;
+       int ret;
+
+       /* Get the current firmware producer index */
+       prod_idx = sb->pi_array[QEDI_PROTO_CQ_PROD_IDX];
+
+       if (prod_idx >= QEDI_CQ_SIZE)
+               prod_idx = prod_idx % QEDI_CQ_SIZE;
+
+       que = qedi->global_queues[fp->sb_id];
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_IO,
+                 "Before: global queue=%p prod_idx=%d cons_idx=%d, sb_id=%d\n",
+                 que, prod_idx, que->cq_cons_idx, fp->sb_id);
+
+       qedi->intr_cpu = fp->sb_id;
+       cpu = smp_processor_id();
+       p = &per_cpu(qedi_percpu, cpu);
+
+       if (unlikely(!p->iothread))
+               WARN_ON(1);
+
+       spin_lock_irqsave(&p->p_work_lock, flags);
+       while (que->cq_cons_idx != prod_idx) {
+               cqe = &que->cq[que->cq_cons_idx];
+
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_IO,
+                         "cqe=%p prod_idx=%d cons_idx=%d.\n",
+                         cqe, prod_idx, que->cq_cons_idx);
+
+               ret = qedi_queue_cqe(qedi, cqe, fp->sb_id, p);
+               if (ret)
+                       continue;
+
+               que->cq_cons_idx++;
+               if (que->cq_cons_idx == QEDI_CQ_SIZE)
+                       que->cq_cons_idx = 0;
+       }
+       wake_up_process(p->iothread);
+       spin_unlock_irqrestore(&p->p_work_lock, flags);
+
+       return true;
+}
+
+static bool qedi_fp_has_work(struct qedi_fastpath *fp)
+{
+       struct qedi_ctx *qedi = fp->qedi;
+       struct global_queue *que;
+       struct qed_sb_info *sb_info = fp->sb_info;
+       struct status_block *sb = sb_info->sb_virt;
+       u16 prod_idx;
+
+       barrier();
+
+       /* Get the current firmware producer index */
+       prod_idx = sb->pi_array[QEDI_PROTO_CQ_PROD_IDX];
+
+       /* Get the pointer to the global CQ this completion is on */
+       que = qedi->global_queues[fp->sb_id];
+
+       /* prod idx wrap around uint16 */
+       if (prod_idx >= QEDI_CQ_SIZE)
+               prod_idx = prod_idx % QEDI_CQ_SIZE;
+
+       return (que->cq_cons_idx != prod_idx);
+}
+
+/* MSI-X fastpath handler code */
+static irqreturn_t qedi_msix_handler(int irq, void *dev_id)
+{
+       struct qedi_fastpath *fp = dev_id;
+       struct qedi_ctx *qedi = fp->qedi;
+       bool wake_io_thread = true;
+
+       qed_sb_ack(fp->sb_info, IGU_INT_DISABLE, 0);
+
+process_again:
+       wake_io_thread = qedi_process_completions(fp);
+       if (wake_io_thread) {
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_DISC,
+                         "process already running\n");
+       }
+
+       if (qedi_fp_has_work(fp) == 0)
+               qed_sb_update_sb_idx(fp->sb_info);
+
+       /* Check for more work */
+       rmb();
+
+       if (qedi_fp_has_work(fp) == 0)
+               qed_sb_ack(fp->sb_info, IGU_INT_ENABLE, 1);
+       else
+               goto process_again;
+
+       return IRQ_HANDLED;
+}
+
+/* simd handler for MSI/INTa */
+static void qedi_simd_int_handler(void *cookie)
+{
+       /* Cookie is qedi_ctx struct */
+       struct qedi_ctx *qedi = (struct qedi_ctx *)cookie;
+
+       QEDI_WARN(&qedi->dbg_ctx, "qedi=%p.\n", qedi);
+}
+
+#define QEDI_SIMD_HANDLER_NUM          0
+static void qedi_sync_free_irqs(struct qedi_ctx *qedi)
+{
+       int i;
+
+       if (qedi->int_info.msix_cnt) {
+               for (i = 0; i < qedi->int_info.used_cnt; i++) {
+                       synchronize_irq(qedi->int_info.msix[i].vector);
+                       irq_set_affinity_hint(qedi->int_info.msix[i].vector,
+                                             NULL);
+                       free_irq(qedi->int_info.msix[i].vector,
+                                &qedi->fp_array[i]);
+               }
+       } else {
+               qedi_ops->common->simd_handler_clean(qedi->cdev,
+                                                    QEDI_SIMD_HANDLER_NUM);
+       }
+
+       qedi->int_info.used_cnt = 0;
+       qedi_ops->common->set_fp_int(qedi->cdev, 0);
+}
+
+static int qedi_request_msix_irq(struct qedi_ctx *qedi)
+{
+       int i, rc, cpu;
+
+       cpu = cpumask_first(cpu_online_mask);
+       for (i = 0; i < MIN_NUM_CPUS_MSIX(qedi); i++) {
+               rc = request_irq(qedi->int_info.msix[i].vector,
+                                qedi_msix_handler, 0, "qedi",
+                                &qedi->fp_array[i]);
+
+               if (rc) {
+                       QEDI_WARN(&qedi->dbg_ctx, "request_irq failed.\n");
+                       qedi_sync_free_irqs(qedi);
+                       return rc;
+               }
+               qedi->int_info.used_cnt++;
+               rc = irq_set_affinity_hint(qedi->int_info.msix[i].vector,
+                                          get_cpu_mask(cpu));
+               cpu = cpumask_next(cpu, cpu_online_mask);
+       }
+
+       return 0;
+}
+
+static int qedi_setup_int(struct qedi_ctx *qedi)
+{
+       int rc = 0;
+
+       rc = qedi_ops->common->set_fp_int(qedi->cdev, num_online_cpus());
+       rc = qedi_ops->common->get_fp_int(qedi->cdev, &qedi->int_info);
+       if (rc)
+               goto exit_setup_int;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_DISC,
+                 "Number of msix_cnt = 0x%x num of cpus = 0x%x\n",
+                  qedi->int_info.msix_cnt, num_online_cpus());
+
+       if (qedi->int_info.msix_cnt) {
+               rc = qedi_request_msix_irq(qedi);
+               goto exit_setup_int;
+       } else {
+               qedi_ops->common->simd_handler_config(qedi->cdev, &qedi,
+                                                     QEDI_SIMD_HANDLER_NUM,
+                                                     qedi_simd_int_handler);
+               qedi->int_info.used_cnt = 1;
+       }
+
+exit_setup_int:
+       return rc;
+}
+
+static void qedi_free_bdq(struct qedi_ctx *qedi)
+{
+       int i;
+
+       if (qedi->bdq_pbl_list)
+               dma_free_coherent(&qedi->pdev->dev, PAGE_SIZE,
+                                 qedi->bdq_pbl_list, qedi->bdq_pbl_list_dma);
+
+       if (qedi->bdq_pbl)
+               dma_free_coherent(&qedi->pdev->dev, qedi->bdq_pbl_mem_size,
+                                 qedi->bdq_pbl, qedi->bdq_pbl_dma);
+
+       for (i = 0; i < QEDI_BDQ_NUM; i++) {
+               if (qedi->bdq[i].buf_addr) {
+                       dma_free_coherent(&qedi->pdev->dev, QEDI_BDQ_BUF_SIZE,
+                                         qedi->bdq[i].buf_addr,
+                                         qedi->bdq[i].buf_dma);
+               }
+       }
+}
+
+static void qedi_free_global_queues(struct qedi_ctx *qedi)
+{
+       int i;
+       struct global_queue **gl = qedi->global_queues;
+
+       for (i = 0; i < qedi->num_queues; i++) {
+               if (!gl[i])
+                       continue;
+
+               if (gl[i]->cq)
+                       dma_free_coherent(&qedi->pdev->dev, gl[i]->cq_mem_size,
+                                         gl[i]->cq, gl[i]->cq_dma);
+               if (gl[i]->cq_pbl)
+                       dma_free_coherent(&qedi->pdev->dev, gl[i]->cq_pbl_size,
+                                         gl[i]->cq_pbl, gl[i]->cq_pbl_dma);
+
+               kfree(gl[i]);
+       }
+       qedi_free_bdq(qedi);
+}
+
+static int qedi_alloc_bdq(struct qedi_ctx *qedi)
+{
+       int i;
+       struct scsi_bd *pbl;
+       u64 *list;
+       dma_addr_t page;
+
+       /* Alloc dma memory for BDQ buffers */
+       for (i = 0; i < QEDI_BDQ_NUM; i++) {
+               qedi->bdq[i].buf_addr =
+                               dma_alloc_coherent(&qedi->pdev->dev,
+                                                  QEDI_BDQ_BUF_SIZE,
+                                                  &qedi->bdq[i].buf_dma,
+                                                  GFP_KERNEL);
+               if (!qedi->bdq[i].buf_addr) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Could not allocate BDQ buffer %d.\n", i);
+                       return -ENOMEM;
+               }
+       }
+
+       /* Alloc dma memory for BDQ page buffer list */
+       qedi->bdq_pbl_mem_size = QEDI_BDQ_NUM * sizeof(struct scsi_bd);
+       qedi->bdq_pbl_mem_size = ALIGN(qedi->bdq_pbl_mem_size, PAGE_SIZE);
+       qedi->rq_num_entries = qedi->bdq_pbl_mem_size / sizeof(struct scsi_bd);
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN, "rq_num_entries = %d.\n",
+                 qedi->rq_num_entries);
+
+       qedi->bdq_pbl = dma_alloc_coherent(&qedi->pdev->dev,
+                                          qedi->bdq_pbl_mem_size,
+                                          &qedi->bdq_pbl_dma, GFP_KERNEL);
+       if (!qedi->bdq_pbl) {
+               QEDI_ERR(&qedi->dbg_ctx, "Could not allocate BDQ PBL.\n");
+               return -ENOMEM;
+       }
+
+       /*
+        * Populate BDQ PBL with physical and virtual address of individual
+        * BDQ buffers
+        */
+       pbl = (struct scsi_bd  *)qedi->bdq_pbl;
+       for (i = 0; i < QEDI_BDQ_NUM; i++) {
+               pbl->address.hi =
+                               cpu_to_le32(QEDI_U64_HI(qedi->bdq[i].buf_dma));
+               pbl->address.lo =
+                               cpu_to_le32(QEDI_U64_LO(qedi->bdq[i].buf_dma));
+               QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                         "pbl [0x%p] pbl->address hi [0x%llx] lo [0x%llx], idx [%d]\n",
+                         pbl, pbl->address.hi, pbl->address.lo, i);
+               pbl->opaque.hi = 0;
+               pbl->opaque.lo = cpu_to_le32(QEDI_U64_LO(i));
+               pbl++;
+       }
+
+       /* Allocate list of PBL pages */
+       qedi->bdq_pbl_list = dma_alloc_coherent(&qedi->pdev->dev,
+                                               PAGE_SIZE,
+                                               &qedi->bdq_pbl_list_dma,
+                                               GFP_KERNEL);
+       if (!qedi->bdq_pbl_list) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Could not allocate list of PBL pages.\n");
+               return -ENOMEM;
+       }
+       memset(qedi->bdq_pbl_list, 0, PAGE_SIZE);
+
+       /*
+        * Now populate PBL list with pages that contain pointers to the
+        * individual buffers.
+        */
+       qedi->bdq_pbl_list_num_entries = qedi->bdq_pbl_mem_size / PAGE_SIZE;
+       list = (u64 *)qedi->bdq_pbl_list;
+       page = qedi->bdq_pbl_list_dma;
+       for (i = 0; i < qedi->bdq_pbl_list_num_entries; i++) {
+               *list = qedi->bdq_pbl_dma;
+               list++;
+               page += PAGE_SIZE;
+       }
+
+       return 0;
+}
+
+static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
+{
+       u32 *list;
+       int i;
+       int status = 0, rc;
+       u32 *pbl;
+       dma_addr_t page;
+       int num_pages;
+
+       /*
+        * Number of global queues (CQ / RQ). This should
+        * be <= number of available MSIX vectors for the PF
+        */
+       if (!qedi->num_queues) {
+               QEDI_ERR(&qedi->dbg_ctx, "No MSI-X vectors available!\n");
+               return 1;
+       }
+
+       /* Make sure we allocated the PBL that will contain the physical
+        * addresses of our queues
+        */
+       if (!qedi->p_cpuq) {
+               status = 1;
+               goto mem_alloc_failure;
+       }
+
+       qedi->global_queues = kzalloc((sizeof(struct global_queue *) *
+                                      qedi->num_queues), GFP_KERNEL);
+       if (!qedi->global_queues) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Unable to allocate global queues array ptr memory\n");
+               return -ENOMEM;
+       }
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_DISC,
+                 "qedi->global_queues=%p.\n", qedi->global_queues);
+
+       /* Allocate DMA coherent buffers for BDQ */
+       rc = qedi_alloc_bdq(qedi);
+       if (rc)
+               goto mem_alloc_failure;
+
+       /* Allocate a CQ and an associated PBL for each MSI-X
+        * vector.
+        */
+       for (i = 0; i < qedi->num_queues; i++) {
+               qedi->global_queues[i] =
+                                       kzalloc(sizeof(*qedi->global_queues[0]),
+                                               GFP_KERNEL);
+               if (!qedi->global_queues[i]) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Unable to allocation global queue %d.\n", i);
+                       goto mem_alloc_failure;
+               }
+
+               qedi->global_queues[i]->cq_mem_size =
+                   (QEDI_CQ_SIZE + 8) * sizeof(union iscsi_cqe);
+               qedi->global_queues[i]->cq_mem_size =
+                   (qedi->global_queues[i]->cq_mem_size +
+                   (QEDI_PAGE_SIZE - 1));
+
+               qedi->global_queues[i]->cq_pbl_size =
+                   (qedi->global_queues[i]->cq_mem_size /
+                   QEDI_PAGE_SIZE) * sizeof(void *);
+               qedi->global_queues[i]->cq_pbl_size =
+                   (qedi->global_queues[i]->cq_pbl_size +
+                   (QEDI_PAGE_SIZE - 1));
+
+               qedi->global_queues[i]->cq =
+                   dma_alloc_coherent(&qedi->pdev->dev,
+                                      qedi->global_queues[i]->cq_mem_size,
+                                      &qedi->global_queues[i]->cq_dma,
+                                      GFP_KERNEL);
+
+               if (!qedi->global_queues[i]->cq) {
+                       QEDI_WARN(&qedi->dbg_ctx,
+                                 "Could not allocate cq.\n");
+                       status = -ENOMEM;
+                       goto mem_alloc_failure;
+               }
+               memset(qedi->global_queues[i]->cq, 0,
+                      qedi->global_queues[i]->cq_mem_size);
+
+               qedi->global_queues[i]->cq_pbl =
+                   dma_alloc_coherent(&qedi->pdev->dev,
+                                      qedi->global_queues[i]->cq_pbl_size,
+                                      &qedi->global_queues[i]->cq_pbl_dma,
+                                      GFP_KERNEL);
+
+               if (!qedi->global_queues[i]->cq_pbl) {
+                       QEDI_WARN(&qedi->dbg_ctx,
+                                 "Could not allocate cq PBL.\n");
+                       status = -ENOMEM;
+                       goto mem_alloc_failure;
+               }
+               memset(qedi->global_queues[i]->cq_pbl, 0,
+                      qedi->global_queues[i]->cq_pbl_size);
+
+               /* Create PBL */
+               num_pages = qedi->global_queues[i]->cq_mem_size /
+                   QEDI_PAGE_SIZE;
+               page = qedi->global_queues[i]->cq_dma;
+               pbl = (u32 *)qedi->global_queues[i]->cq_pbl;
+
+               while (num_pages--) {
+                       *pbl = (u32)page;
+                       pbl++;
+                       *pbl = (u32)((u64)page >> 32);
+                       pbl++;
+                       page += QEDI_PAGE_SIZE;
+               }
+       }
+
+       list = (u32 *)qedi->p_cpuq;
+
+       /*
+        * The list is built as follows: CQ#0 PBL pointer, RQ#0 PBL pointer,
+        * CQ#1 PBL pointer, RQ#1 PBL pointer, etc.  Each PBL pointer points
+        * to the physical address which contains an array of pointers to the
+        * physical addresses of the specific queue pages.
+        */
+       for (i = 0; i < qedi->num_queues; i++) {
+               *list = (u32)qedi->global_queues[i]->cq_pbl_dma;
+               list++;
+               *list = (u32)((u64)qedi->global_queues[i]->cq_pbl_dma >> 32);
+               list++;
+
+               *list = (u32)0;
+               list++;
+               *list = (u32)((u64)0 >> 32);
+               list++;
+       }
+
+       return 0;
+
+mem_alloc_failure:
+       qedi_free_global_queues(qedi);
+       return status;
+}
+
+int qedi_alloc_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep)
+{
+       int rval = 0;
+       u32 *pbl;
+       dma_addr_t page;
+       int num_pages;
+
+       if (!ep)
+               return -EIO;
+
+       /* Calculate appropriate queue and PBL sizes */
+       ep->sq_mem_size = QEDI_SQ_SIZE * sizeof(struct iscsi_wqe);
+       ep->sq_mem_size += QEDI_PAGE_SIZE - 1;
+
+       ep->sq_pbl_size = (ep->sq_mem_size / QEDI_PAGE_SIZE) * sizeof(void *);
+       ep->sq_pbl_size = ep->sq_pbl_size + QEDI_PAGE_SIZE;
+
+       ep->sq = dma_alloc_coherent(&qedi->pdev->dev, ep->sq_mem_size,
+                                   &ep->sq_dma, GFP_KERNEL);
+       if (!ep->sq) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "Could not allocate send queue.\n");
+               rval = -ENOMEM;
+               goto out;
+       }
+       memset(ep->sq, 0, ep->sq_mem_size);
+
+       ep->sq_pbl = dma_alloc_coherent(&qedi->pdev->dev, ep->sq_pbl_size,
+                                       &ep->sq_pbl_dma, GFP_KERNEL);
+       if (!ep->sq_pbl) {
+               QEDI_WARN(&qedi->dbg_ctx,
+                         "Could not allocate send queue PBL.\n");
+               rval = -ENOMEM;
+               goto out_free_sq;
+       }
+       memset(ep->sq_pbl, 0, ep->sq_pbl_size);
+
+       /* Create PBL */
+       num_pages = ep->sq_mem_size / QEDI_PAGE_SIZE;
+       page = ep->sq_dma;
+       pbl = (u32 *)ep->sq_pbl;
+
+       while (num_pages--) {
+               *pbl = (u32)page;
+               pbl++;
+               *pbl = (u32)((u64)page >> 32);
+               pbl++;
+               page += QEDI_PAGE_SIZE;
+       }
+
+       return rval;
+
+out_free_sq:
+       dma_free_coherent(&qedi->pdev->dev, ep->sq_mem_size, ep->sq,
+                         ep->sq_dma);
+out:
+       return rval;
+}
+
+void qedi_free_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep)
+{
+       if (ep->sq_pbl)
+               dma_free_coherent(&qedi->pdev->dev, ep->sq_pbl_size, ep->sq_pbl,
+                                 ep->sq_pbl_dma);
+       if (ep->sq)
+               dma_free_coherent(&qedi->pdev->dev, ep->sq_mem_size, ep->sq,
+                                 ep->sq_dma);
+}
+
+int qedi_get_task_idx(struct qedi_ctx *qedi)
+{
+       s16 tmp_idx;
+
+again:
+       tmp_idx = find_first_zero_bit(qedi->task_idx_map,
+                                     MAX_ISCSI_TASK_ENTRIES);
+
+       if (tmp_idx >= MAX_ISCSI_TASK_ENTRIES) {
+               QEDI_ERR(&qedi->dbg_ctx, "FW task context pool is full.\n");
+               tmp_idx = -1;
+               goto err_idx;
+       }
+
+       if (test_and_set_bit(tmp_idx, qedi->task_idx_map))
+               goto again;
+
+err_idx:
+       return tmp_idx;
+}
+
+void qedi_clear_task_idx(struct qedi_ctx *qedi, int idx)
+{
+       if (!test_and_clear_bit(idx, qedi->task_idx_map)) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "FW task context, already cleared, tid=0x%x\n", idx);
+               WARN_ON(1);
+       }
+}
+
+void qedi_update_itt_map(struct qedi_ctx *qedi, u32 tid, u32 proto_itt,
+                        struct qedi_cmd *cmd)
+{
+       qedi->itt_map[tid].itt = proto_itt;
+       qedi->itt_map[tid].p_cmd = cmd;
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                 "update itt map tid=0x%x, with proto itt=0x%x\n", tid,
+                 qedi->itt_map[tid].itt);
+}
+
+void qedi_get_task_tid(struct qedi_ctx *qedi, u32 itt, s16 *tid)
+{
+       u16 i;
+
+       for (i = 0; i < MAX_ISCSI_TASK_ENTRIES; i++) {
+               if (qedi->itt_map[i].itt == itt) {
+                       *tid = i;
+                       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                                 "Ref itt=0x%x, found at tid=0x%x\n",
+                                 itt, *tid);
+                       return;
+               }
+       }
+
+       WARN_ON(1);
+}
+
+void qedi_get_proto_itt(struct qedi_ctx *qedi, u32 tid, u32 *proto_itt)
+{
+       *proto_itt = qedi->itt_map[tid].itt;
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
+                 "Get itt map tid [0x%x with proto itt[0x%x]",
+                 tid, *proto_itt);
+}
+
+struct qedi_cmd *qedi_get_cmd_from_tid(struct qedi_ctx *qedi, u32 tid)
+{
+       struct qedi_cmd *cmd = NULL;
+
+       if (tid > MAX_ISCSI_TASK_ENTRIES)
+               return NULL;
+
+       cmd = qedi->itt_map[tid].p_cmd;
+       if (cmd->task_id != tid)
+               return NULL;
+
+       qedi->itt_map[tid].p_cmd = NULL;
+
+       return cmd;
+}
+
+static int qedi_alloc_itt(struct qedi_ctx *qedi)
+{
+       qedi->itt_map = kcalloc(MAX_ISCSI_TASK_ENTRIES,
+                               sizeof(struct qedi_itt_map), GFP_KERNEL);
+       if (!qedi->itt_map) {
+               QEDI_ERR(&qedi->dbg_ctx,
+                        "Unable to allocate itt map array memory\n");
+               return -ENOMEM;
+       }
+       return 0;
+}
+
+static void qedi_free_itt(struct qedi_ctx *qedi)
+{
+       kfree(qedi->itt_map);
+}
+
+static struct qed_ll2_cb_ops qedi_ll2_cb_ops = {
+       .rx_cb = qedi_ll2_rx,
+       .tx_cb = NULL,
+};
+
+static int qedi_percpu_io_thread(void *arg)
+{
+       struct qedi_percpu_s *p = arg;
+       struct qedi_work *work, *tmp;
+       unsigned long flags;
+       LIST_HEAD(work_list);
+
+       set_user_nice(current, -20);
+
+       while (!kthread_should_stop()) {
+               spin_lock_irqsave(&p->p_work_lock, flags);
+               while (!list_empty(&p->work_list)) {
+                       list_splice_init(&p->work_list, &work_list);
+                       spin_unlock_irqrestore(&p->p_work_lock, flags);
+
+                       list_for_each_entry_safe(work, tmp, &work_list, list) {
+                               list_del_init(&work->list);
+                               qedi_fp_process_cqes(work);
+                               if (!work->is_solicited)
+                                       kfree(work);
+                       }
+                       cond_resched();
+                       spin_lock_irqsave(&p->p_work_lock, flags);
+               }
+               set_current_state(TASK_INTERRUPTIBLE);
+               spin_unlock_irqrestore(&p->p_work_lock, flags);
+               schedule();
+       }
+       __set_current_state(TASK_RUNNING);
+
+       return 0;
+}
+
+static int qedi_cpu_online(unsigned int cpu)
+{
+       struct qedi_percpu_s *p = this_cpu_ptr(&qedi_percpu);
+       struct task_struct *thread;
+
+       thread = kthread_create_on_node(qedi_percpu_io_thread, (void *)p,
+                                       cpu_to_node(cpu),
+                                       "qedi_thread/%d", cpu);
+       if (IS_ERR(thread))
+               return PTR_ERR(thread);
+
+       kthread_bind(thread, cpu);
+       p->iothread = thread;
+       wake_up_process(thread);
+       return 0;
+}
+
+static int qedi_cpu_offline(unsigned int cpu)
+{
+       struct qedi_percpu_s *p = this_cpu_ptr(&qedi_percpu);
+       struct qedi_work *work, *tmp;
+       struct task_struct *thread;
+
+       spin_lock_bh(&p->p_work_lock);
+       thread = p->iothread;
+       p->iothread = NULL;
+
+       list_for_each_entry_safe(work, tmp, &p->work_list, list) {
+               list_del_init(&work->list);
+               qedi_fp_process_cqes(work);
+               if (!work->is_solicited)
+                       kfree(work);
+       }
+
+       spin_unlock_bh(&p->p_work_lock);
+       if (thread)
+               kthread_stop(thread);
+       return 0;
+}
+
+void qedi_reset_host_mtu(struct qedi_ctx *qedi, u16 mtu)
+{
+       struct qed_ll2_params params;
+
+       qedi_recover_all_conns(qedi);
+
+       qedi_ops->ll2->stop(qedi->cdev);
+       qedi_ll2_free_skbs(qedi);
+
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, "old MTU %u, new MTU %u\n",
+                 qedi->ll2_mtu, mtu);
+       memset(&params, 0, sizeof(params));
+       qedi->ll2_mtu = mtu;
+       params.mtu = qedi->ll2_mtu + IPV6_HDR_LEN + TCP_HDR_LEN;
+       params.drop_ttl0_packets = 0;
+       params.rx_vlan_stripping = 1;
+       ether_addr_copy(params.ll2_mac_address, qedi->dev_info.common.hw_mac);
+       qedi_ops->ll2->start(qedi->cdev, &params);
+}
+
+static void __qedi_remove(struct pci_dev *pdev, int mode)
+{
+       struct qedi_ctx *qedi = pci_get_drvdata(pdev);
+
+       if (qedi->tmf_thread) {
+               flush_workqueue(qedi->tmf_thread);
+               destroy_workqueue(qedi->tmf_thread);
+               qedi->tmf_thread = NULL;
+       }
+
+       if (qedi->offload_thread) {
+               flush_workqueue(qedi->offload_thread);
+               destroy_workqueue(qedi->offload_thread);
+               qedi->offload_thread = NULL;
+       }
+
+#ifdef CONFIG_DEBUG_FS
+       qedi_dbg_host_exit(&qedi->dbg_ctx);
+#endif
+       if (!test_bit(QEDI_IN_OFFLINE, &qedi->flags))
+               qedi_ops->common->set_power_state(qedi->cdev, PCI_D0);
+
+       qedi_sync_free_irqs(qedi);
+
+       if (!test_bit(QEDI_IN_OFFLINE, &qedi->flags)) {
+               qedi_ops->stop(qedi->cdev);
+               qedi_ops->ll2->stop(qedi->cdev);
+       }
+
+       if (mode == QEDI_MODE_NORMAL)
+               qedi_free_iscsi_pf_param(qedi);
+
+       if (!test_bit(QEDI_IN_OFFLINE, &qedi->flags)) {
+               qedi_ops->common->slowpath_stop(qedi->cdev);
+               qedi_ops->common->remove(qedi->cdev);
+       }
+
+       qedi_destroy_fp(qedi);
+
+       if (mode == QEDI_MODE_NORMAL) {
+               qedi_release_cid_que(qedi);
+               qedi_cm_free_mem(qedi);
+               qedi_free_uio(qedi->udev);
+               qedi_free_itt(qedi);
+
+               iscsi_host_remove(qedi->shost);
+               iscsi_host_free(qedi->shost);
+
+               if (qedi->ll2_recv_thread) {
+                       kthread_stop(qedi->ll2_recv_thread);
+                       qedi->ll2_recv_thread = NULL;
+               }
+               qedi_ll2_free_skbs(qedi);
+       }
+}
+
+static int __qedi_probe(struct pci_dev *pdev, int mode)
+{
+       struct qedi_ctx *qedi;
+       struct qed_ll2_params params;
+       u32 dp_module = 0;
+       u8 dp_level = 0;
+       bool is_vf = false;
+       char host_buf[16];
+       struct qed_link_params link_params;
+       struct qed_slowpath_params sp_params;
+       struct qed_probe_params qed_params;
+       void *task_start, *task_end;
+       int rc;
+       u16 tmp;
+
+       if (mode != QEDI_MODE_RECOVERY) {
+               qedi = qedi_host_alloc(pdev);
+               if (!qedi) {
+                       rc = -ENOMEM;
+                       goto exit_probe;
+               }
+       } else {
+               qedi = pci_get_drvdata(pdev);
+       }
+
+       memset(&qed_params, 0, sizeof(qed_params));
+       qed_params.protocol = QED_PROTOCOL_ISCSI;
+       qed_params.dp_module = dp_module;
+       qed_params.dp_level = dp_level;
+       qed_params.is_vf = is_vf;
+       qedi->cdev = qedi_ops->common->probe(pdev, &qed_params);
+       if (!qedi->cdev) {
+               rc = -ENODEV;
+               QEDI_ERR(&qedi->dbg_ctx, "Cannot initialize hardware\n");
+               goto free_host;
+       }
+
+       qedi->msix_count = MAX_NUM_MSIX_PF;
+       atomic_set(&qedi->link_state, QEDI_LINK_DOWN);
+
+       if (mode != QEDI_MODE_RECOVERY) {
+               rc = qedi_set_iscsi_pf_param(qedi);
+               if (rc) {
+                       rc = -ENOMEM;
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Set iSCSI pf param fail\n");
+                       goto free_host;
+               }
+       }
+
+       qedi_ops->common->update_pf_params(qedi->cdev, &qedi->pf_params);
+
+       rc = qedi_prepare_fp(qedi);
+       if (rc) {
+               QEDI_ERR(&qedi->dbg_ctx, "Cannot start slowpath.\n");
+               goto free_pf_params;
+       }
+
+       /* Start the Slowpath-process */
+       memset(&sp_params, 0, sizeof(struct qed_slowpath_params));
+       sp_params.int_mode = QED_INT_MODE_MSIX;
+       sp_params.drv_major = QEDI_DRIVER_MAJOR_VER;
+       sp_params.drv_minor = QEDI_DRIVER_MINOR_VER;
+       sp_params.drv_rev = QEDI_DRIVER_REV_VER;
+       sp_params.drv_eng = QEDI_DRIVER_ENG_VER;
+       strlcpy(sp_params.name, "qedi iSCSI", QED_DRV_VER_STR_SIZE);
+       rc = qedi_ops->common->slowpath_start(qedi->cdev, &sp_params);
+       if (rc) {
+               QEDI_ERR(&qedi->dbg_ctx, "Cannot start slowpath\n");
+               goto stop_hw;
+       }
+
+       /* update_pf_params needs to be called before and after slowpath
+        * start
+        */
+       qedi_ops->common->update_pf_params(qedi->cdev, &qedi->pf_params);
+
+       qedi_setup_int(qedi);
+       if (rc)
+               goto stop_iscsi_func;
+
+       qedi_ops->common->set_power_state(qedi->cdev, PCI_D0);
+
+       /* Learn information crucial for qedi to progress */
+       rc = qedi_ops->fill_dev_info(qedi->cdev, &qedi->dev_info);
+       if (rc)
+               goto stop_iscsi_func;
+
+       /* Record BDQ producer doorbell addresses */
+       qedi->bdq_primary_prod = qedi->dev_info.primary_dbq_rq_addr;
+       qedi->bdq_secondary_prod = qedi->dev_info.secondary_bdq_rq_addr;
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_DISC,
+                 "BDQ primary_prod=%p secondary_prod=%p.\n",
+                 qedi->bdq_primary_prod,
+                 qedi->bdq_secondary_prod);
+
+       /*
+        * We need to write the number of BDs in the BDQ we've preallocated so
+        * the f/w will do a prefetch and we'll get an unsolicited CQE when a
+        * packet arrives.
+        */
+       qedi->bdq_prod_idx = QEDI_BDQ_NUM;
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_DISC,
+                 "Writing %d to primary and secondary BDQ doorbell registers.\n",
+                 qedi->bdq_prod_idx);
+       writew(qedi->bdq_prod_idx, qedi->bdq_primary_prod);
+       tmp = readw(qedi->bdq_primary_prod);
+       writew(qedi->bdq_prod_idx, qedi->bdq_secondary_prod);
+       tmp = readw(qedi->bdq_secondary_prod);
+
+       ether_addr_copy(qedi->mac, qedi->dev_info.common.hw_mac);
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_DISC, "MAC address is %pM.\n",
+                 qedi->mac);
+
+       sprintf(host_buf, "host_%d", qedi->shost->host_no);
+       qedi_ops->common->set_id(qedi->cdev, host_buf, QEDI_MODULE_VERSION);
+
+       qedi_ops->register_ops(qedi->cdev, &qedi_cb_ops, qedi);
+
+       memset(&params, 0, sizeof(params));
+       params.mtu = DEF_PATH_MTU + IPV6_HDR_LEN + TCP_HDR_LEN;
+       qedi->ll2_mtu = DEF_PATH_MTU;
+       params.drop_ttl0_packets = 0;
+       params.rx_vlan_stripping = 1;
+       ether_addr_copy(params.ll2_mac_address, qedi->dev_info.common.hw_mac);
+
+       if (mode != QEDI_MODE_RECOVERY) {
+               /* set up rx path */
+               INIT_LIST_HEAD(&qedi->ll2_skb_list);
+               spin_lock_init(&qedi->ll2_lock);
+               /* start qedi context */
+               spin_lock_init(&qedi->hba_lock);
+               spin_lock_init(&qedi->task_idx_lock);
+       }
+       qedi_ops->ll2->register_cb_ops(qedi->cdev, &qedi_ll2_cb_ops, qedi);
+       qedi_ops->ll2->start(qedi->cdev, &params);
+
+       if (mode != QEDI_MODE_RECOVERY) {
+               qedi->ll2_recv_thread = kthread_run(qedi_ll2_recv_thread,
+                                                   (void *)qedi,
+                                                   "qedi_ll2_thread");
+       }
+
+       rc = qedi_ops->start(qedi->cdev, &qedi->tasks,
+                            qedi, qedi_iscsi_event_cb);
+       if (rc) {
+               rc = -ENODEV;
+               QEDI_ERR(&qedi->dbg_ctx, "Cannot start iSCSI function\n");
+               goto stop_slowpath;
+       }
+
+       task_start = qedi_get_task_mem(&qedi->tasks, 0);
+       task_end = qedi_get_task_mem(&qedi->tasks, MAX_TID_BLOCKS_ISCSI - 1);
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_DISC,
+                 "Task context start=%p, end=%p block_size=%u.\n",
+                  task_start, task_end, qedi->tasks.size);
+
+       memset(&link_params, 0, sizeof(link_params));
+       link_params.link_up = true;
+       rc = qedi_ops->common->set_link(qedi->cdev, &link_params);
+       if (rc) {
+               QEDI_WARN(&qedi->dbg_ctx, "Link set up failed.\n");
+               atomic_set(&qedi->link_state, QEDI_LINK_DOWN);
+       }
+
+#ifdef CONFIG_DEBUG_FS
+       qedi_dbg_host_init(&qedi->dbg_ctx, &qedi_debugfs_ops,
+                          &qedi_dbg_fops);
+#endif
+       QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
+                 "QLogic FastLinQ iSCSI Module qedi %s, FW %d.%d.%d.%d\n",
+                 QEDI_MODULE_VERSION, FW_MAJOR_VERSION, FW_MINOR_VERSION,
+                 FW_REVISION_VERSION, FW_ENGINEERING_VERSION);
+
+       if (mode == QEDI_MODE_NORMAL) {
+               if (iscsi_host_add(qedi->shost, &pdev->dev)) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Could not add iscsi host\n");
+                       rc = -ENOMEM;
+                       goto remove_host;
+               }
+
+               /* Allocate uio buffers */
+               rc = qedi_alloc_uio_rings(qedi);
+               if (rc) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "UIO alloc ring failed err=%d\n", rc);
+                       goto remove_host;
+               }
+
+               rc = qedi_init_uio(qedi);
+               if (rc) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "UIO init failed, err=%d\n", rc);
+                       goto free_uio;
+               }
+
+               /* host the array on iscsi_conn */
+               rc = qedi_setup_cid_que(qedi);
+               if (rc) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Could not setup cid que\n");
+                       goto free_uio;
+               }
+
+               rc = qedi_cm_alloc_mem(qedi);
+               if (rc) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Could not alloc cm memory\n");
+                       goto free_cid_que;
+               }
+
+               rc = qedi_alloc_itt(qedi);
+               if (rc) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Could not alloc itt memory\n");
+                       goto free_cid_que;
+               }
+
+               sprintf(host_buf, "host_%d", qedi->shost->host_no);
+               qedi->tmf_thread = create_singlethread_workqueue(host_buf);
+               if (!qedi->tmf_thread) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Unable to start tmf thread!\n");
+                       rc = -ENODEV;
+                       goto free_cid_que;
+               }
+
+               sprintf(host_buf, "qedi_ofld%d", qedi->shost->host_no);
+               qedi->offload_thread = create_workqueue(host_buf);
+               if (!qedi->offload_thread) {
+                       QEDI_ERR(&qedi->dbg_ctx,
+                                "Unable to start offload thread!\n");
+                       rc = -ENODEV;
+                       goto free_cid_que;
+               }
+
+               /* F/w needs 1st task context memory entry for performance */
+               set_bit(QEDI_RESERVE_TASK_ID, qedi->task_idx_map);
+               atomic_set(&qedi->num_offloads, 0);
+       }
+
+       return 0;
+
+free_cid_que:
+       qedi_release_cid_que(qedi);
+free_uio:
+       qedi_free_uio(qedi->udev);
+remove_host:
+#ifdef CONFIG_DEBUG_FS
+       qedi_dbg_host_exit(&qedi->dbg_ctx);
+#endif
+       iscsi_host_remove(qedi->shost);
+stop_iscsi_func:
+       qedi_ops->stop(qedi->cdev);
+stop_slowpath:
+       qedi_ops->common->slowpath_stop(qedi->cdev);
+stop_hw:
+       qedi_ops->common->remove(qedi->cdev);
+free_pf_params:
+       qedi_free_iscsi_pf_param(qedi);
+free_host:
+       iscsi_host_free(qedi->shost);
+exit_probe:
+       return rc;
+}
+
+static int qedi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+       return __qedi_probe(pdev, QEDI_MODE_NORMAL);
+}
+
+static void qedi_remove(struct pci_dev *pdev)
+{
+       __qedi_remove(pdev, QEDI_MODE_NORMAL);
+}
+
+static struct pci_device_id qedi_pci_tbl[] = {
+       { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, 0x165E) },
+       { 0 },
+};
+MODULE_DEVICE_TABLE(pci, qedi_pci_tbl);
+
+static enum cpuhp_state qedi_cpuhp_state;
+
+static struct pci_driver qedi_pci_driver = {
+       .name = QEDI_MODULE_NAME,
+       .id_table = qedi_pci_tbl,
+       .probe = qedi_probe,
+       .remove = qedi_remove,
+};
+
+static int __init qedi_init(void)
+{
+       struct qedi_percpu_s *p;
+       int cpu, rc = 0;
+
+       qedi_ops = qed_get_iscsi_ops();
+       if (!qedi_ops) {
+               QEDI_ERR(NULL, "Failed to get qed iSCSI operations\n");
+               return -EINVAL;
+       }
+
+#ifdef CONFIG_DEBUG_FS
+       qedi_dbg_init("qedi");
+#endif
+
+       qedi_scsi_transport = iscsi_register_transport(&qedi_iscsi_transport);
+       if (!qedi_scsi_transport) {
+               QEDI_ERR(NULL, "Could not register qedi transport");
+               rc = -ENOMEM;
+               goto exit_qedi_init_1;
+       }
+
+       for_each_possible_cpu(cpu) {
+               p = &per_cpu(qedi_percpu, cpu);
+               INIT_LIST_HEAD(&p->work_list);
+               spin_lock_init(&p->p_work_lock);
+               p->iothread = NULL;
+       }
+
+       rc = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "scsi/qedi:online",
+                              qedi_cpu_online, qedi_cpu_offline);
+       if (rc < 0)
+               goto exit_qedi_init_2;
+       qedi_cpuhp_state = rc;
+
+       rc = pci_register_driver(&qedi_pci_driver);
+       if (rc) {
+               QEDI_ERR(NULL, "Failed to register driver\n");
+               goto exit_qedi_hp;
+       }
+
+       return 0;
+
+exit_qedi_hp:
+       cpuhp_remove_state(qedi_cpuhp_state);
+exit_qedi_init_2:
+       iscsi_unregister_transport(&qedi_iscsi_transport);
+exit_qedi_init_1:
+#ifdef CONFIG_DEBUG_FS
+       qedi_dbg_exit();
+#endif
+       qed_put_iscsi_ops();
+       return rc;
+}
+
+static void __exit qedi_cleanup(void)
+{
+       pci_unregister_driver(&qedi_pci_driver);
+       cpuhp_remove_state(qedi_cpuhp_state);
+       iscsi_unregister_transport(&qedi_iscsi_transport);
+
+#ifdef CONFIG_DEBUG_FS
+       qedi_dbg_exit();
+#endif
+       qed_put_iscsi_ops();
+}
+
+MODULE_DESCRIPTION("QLogic FastLinQ 4xxxx iSCSI Module");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("QLogic Corporation");
+MODULE_VERSION(QEDI_MODULE_VERSION);
+module_init(qedi_init);
+module_exit(qedi_cleanup);
diff --git a/drivers/scsi/qedi/qedi_sysfs.c b/drivers/scsi/qedi/qedi_sysfs.c
new file mode 100644 (file)
index 0000000..b10c48b
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#include "qedi.h"
+#include "qedi_gbl.h"
+#include "qedi_iscsi.h"
+#include "qedi_dbg.h"
+
+static inline struct qedi_ctx *qedi_dev_to_hba(struct device *dev)
+{
+       struct Scsi_Host *shost = class_to_shost(dev);
+
+       return iscsi_host_priv(shost);
+}
+
+static ssize_t qedi_show_port_state(struct device *dev,
+                                   struct device_attribute *attr,
+                                   char *buf)
+{
+       struct qedi_ctx *qedi = qedi_dev_to_hba(dev);
+
+       if (atomic_read(&qedi->link_state) == QEDI_LINK_UP)
+               return sprintf(buf, "Online\n");
+       else
+               return sprintf(buf, "Linkdown\n");
+}
+
+static ssize_t qedi_show_speed(struct device *dev,
+                              struct device_attribute *attr, char *buf)
+{
+       struct qedi_ctx *qedi = qedi_dev_to_hba(dev);
+       struct qed_link_output if_link;
+
+       qedi_ops->common->get_link(qedi->cdev, &if_link);
+
+       return sprintf(buf, "%d Gbit\n", if_link.speed / 1000);
+}
+
+static DEVICE_ATTR(port_state, 0444, qedi_show_port_state, NULL);
+static DEVICE_ATTR(speed, 0444, qedi_show_speed, NULL);
+
+struct device_attribute *qedi_shost_attrs[] = {
+       &dev_attr_port_state,
+       &dev_attr_speed,
+       NULL
+};
diff --git a/drivers/scsi/qedi/qedi_version.h b/drivers/scsi/qedi/qedi_version.h
new file mode 100644 (file)
index 0000000..9543a1b
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * QLogic iSCSI Offload Driver
+ * Copyright (c) 2016 Cavium Inc.
+ *
+ * This software is available under the terms of the GNU General Public License
+ * (GPL) Version 2, available from the file COPYING in the main directory of
+ * this source tree.
+ */
+
+#define QEDI_MODULE_VERSION    "8.10.3.0"
+#define QEDI_DRIVER_MAJOR_VER          8
+#define QEDI_DRIVER_MINOR_VER          10
+#define QEDI_DRIVER_REV_VER            3
+#define QEDI_DRIVER_ENG_VER            0
index fe7469c901f76ac2d46006eeb208f3c9398d3ee1..47eb4d545d13c5f9b80149f162b04756108cd654 100644 (file)
@@ -1988,9 +1988,9 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
        scsi_qla_host_t *base_vha = shost_priv(fc_vport->shost);
        scsi_qla_host_t *vha = NULL;
        struct qla_hw_data *ha = base_vha->hw;
-       uint16_t options = 0;
        int     cnt;
        struct req_que *req = ha->req_q_map[0];
+       struct qla_qpair *qpair;
 
        ret = qla24xx_vport_create_req_sanity_check(fc_vport);
        if (ret) {
@@ -2075,15 +2075,9 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
        qlt_vport_create(vha, ha);
        qla24xx_vport_disable(fc_vport, disable);
 
-       if (ha->flags.cpu_affinity_enabled) {
-               req = ha->req_q_map[1];
-               ql_dbg(ql_dbg_multiq, vha, 0xc000,
-                   "Request queue %p attached with "
-                   "VP[%d], cpu affinity =%d\n",
-                   req, vha->vp_idx, ha->flags.cpu_affinity_enabled);
-               goto vport_queue;
-       } else if (ql2xmaxqueues == 1 || !ha->npiv_info)
+       if (!ql2xmqsupport || !ha->npiv_info)
                goto vport_queue;
+
        /* Create a request queue in QoS mode for the vport */
        for (cnt = 0; cnt < ha->nvram_npiv_size; cnt++) {
                if (memcmp(ha->npiv_info[cnt].port_name, vha->port_name, 8) == 0
@@ -2095,20 +2089,20 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
        }
 
        if (qos) {
-               ret = qla25xx_create_req_que(ha, options, vha->vp_idx, 0, 0,
-                       qos);
-               if (!ret)
+               qpair = qla2xxx_create_qpair(vha, qos, vha->vp_idx);
+               if (!qpair)
                        ql_log(ql_log_warn, vha, 0x7084,
-                           "Can't create request queue for VP[%d]\n",
+                           "Can't create qpair for VP[%d]\n",
                            vha->vp_idx);
                else {
                        ql_dbg(ql_dbg_multiq, vha, 0xc001,
-                           "Request Que:%d Q0s: %d) created for VP[%d]\n",
-                           ret, qos, vha->vp_idx);
+                           "Queue pair: %d Qos: %d) created for VP[%d]\n",
+                           qpair->id, qos, vha->vp_idx);
                        ql_dbg(ql_dbg_user, vha, 0x7085,
-                           "Request Que:%d Q0s: %d) created for VP[%d]\n",
-                           ret, qos, vha->vp_idx);
-                       req = ha->req_q_map[ret];
+                           "Queue Pair: %d Qos: %d) created for VP[%d]\n",
+                           qpair->id, qos, vha->vp_idx);
+                       req = qpair->req;
+                       vha->qpair = qpair;
                }
        }
 
@@ -2162,10 +2156,10 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
        clear_bit(vha->vp_idx, ha->vp_idx_map);
        mutex_unlock(&ha->vport_lock);
 
-       if (vha->req->id && !ha->flags.cpu_affinity_enabled) {
-               if (qla25xx_delete_req_que(vha, vha->req) != QLA_SUCCESS)
+       if (vha->qpair->vp_idx == vha->vp_idx) {
+               if (qla2xxx_delete_qpair(vha, vha->qpair) != QLA_SUCCESS)
                        ql_log(ql_log_warn, vha, 0x7087,
-                           "Queue delete failed.\n");
+                           "Queue Pair delete failed.\n");
        }
 
        ql_log(ql_log_info, vha, 0x7088, "VP[%d] deleted.\n", id);
index 45af34ddc43297d06c8c7cf44425a1a7cee4cc7f..21d9fb7fc88796cbaa09fbfa160b9b20c17e2015 100644 (file)
@@ -11,7 +11,7 @@
  * ----------------------------------------------------------------------
  * |             Level            |   Last Value Used  |     Holes     |
  * ----------------------------------------------------------------------
- * | Module Init and Probe        |       0x0191       | 0x0146         |
+ * | Module Init and Probe        |       0x0193       | 0x0146         |
  * |                              |                    | 0x015b-0x0160 |
  * |                              |                    | 0x016e                |
  * | Mailbox commands             |       0x1199       | 0x1193                |
@@ -58,7 +58,7 @@
  * |                              |                    | 0xb13a,0xb142  |
  * |                              |                    | 0xb13c-0xb140  |
  * |                              |                    | 0xb149                |
- * | MultiQ                       |       0xc00c       |               |
+ * | MultiQ                       |       0xc010       |               |
  * | Misc                         |       0xd301       | 0xd031-0xd0ff |
  * |                              |                    | 0xd101-0xd1fe |
  * |                              |                    | 0xd214-0xd2fe |
index 5236e3f2a06a432740316cb74e1dea708c5fc439..f7df01b76714e09dc919cbb9660b66bed603d6bc 100644 (file)
@@ -401,6 +401,7 @@ typedef struct srb {
        uint16_t type;
        char *name;
        int iocbs;
+       struct qla_qpair *qpair;
        union {
                struct srb_iocb iocb_cmd;
                struct bsg_job *bsg_job;
@@ -2719,6 +2720,7 @@ struct isp_operations {
 
        int (*get_flash_version) (struct scsi_qla_host *, void *);
        int (*start_scsi) (srb_t *);
+       int (*start_scsi_mq) (srb_t *);
        int (*abort_isp) (struct scsi_qla_host *);
        int (*iospace_config)(struct qla_hw_data*);
        int (*initialize_adapter)(struct scsi_qla_host *);
@@ -2730,8 +2732,10 @@ struct isp_operations {
 #define QLA_MSIX_FW_MODE(m)    (((m) & (BIT_7|BIT_8|BIT_9)) >> 7)
 #define QLA_MSIX_FW_MODE_1(m)  (QLA_MSIX_FW_MODE(m) == 1)
 
-#define QLA_MSIX_DEFAULT       0x00
-#define QLA_MSIX_RSP_Q         0x01
+#define QLA_MSIX_DEFAULT               0x00
+#define QLA_MSIX_RSP_Q                 0x01
+#define QLA_ATIO_VECTOR                0x02
+#define QLA_MSIX_QPAIR_MULTIQ_RSP_Q    0x03
 
 #define QLA_MIDX_DEFAULT       0
 #define QLA_MIDX_RSP_Q         1
@@ -2745,9 +2749,11 @@ struct scsi_qla_host;
 
 struct qla_msix_entry {
        int have_irq;
+       int in_use;
        uint32_t vector;
        uint16_t entry;
-       struct rsp_que *rsp;
+       char name[30];
+       void *handle;
        struct irq_affinity_notify irq_notify;
        int cpuid;
 };
@@ -2872,7 +2878,6 @@ struct rsp_que {
        struct qla_msix_entry *msix;
        struct req_que *req;
        srb_t *status_srb; /* status continuation entry */
-       struct work_struct q_work;
 
        dma_addr_t  dma_fx00;
        response_t *ring_fx00;
@@ -2909,6 +2914,37 @@ struct req_que {
        uint8_t req_pkt[REQUEST_ENTRY_SIZE];
 };
 
+/*Queue pair data structure */
+struct qla_qpair {
+       spinlock_t qp_lock;
+       atomic_t ref_count;
+       /* distill these fields down to 'online=0/1'
+        * ha->flags.eeh_busy
+        * ha->flags.pci_channel_io_perm_failure
+        * base_vha->loop_state
+        */
+       uint32_t online:1;
+       /* move vha->flags.difdix_supported here */
+       uint32_t difdix_supported:1;
+       uint32_t delete_in_progress:1;
+
+       uint16_t id;                    /* qp number used with FW */
+       uint16_t num_active_cmd;        /* cmds down at firmware */
+       cpumask_t cpu_mask; /* CPU mask for cpu affinity operation */
+       uint16_t vp_idx;                /* vport ID */
+
+       mempool_t *srb_mempool;
+
+       /* to do: New driver: move queues to here instead of pointers */
+       struct req_que *req;
+       struct rsp_que *rsp;
+       struct atio_que *atio;
+       struct qla_msix_entry *msix; /* point to &ha->msix_entries[x] */
+       struct qla_hw_data *hw;
+       struct work_struct q_work;
+       struct list_head qp_list_elem; /* vha->qp_list */
+};
+
 /* Place holder for FW buffer parameters */
 struct qlfc_fw {
        void *fw_buf;
@@ -3004,7 +3040,6 @@ struct qla_hw_data {
                uint32_t        chip_reset_done         :1;
                uint32_t        running_gold_fw         :1;
                uint32_t        eeh_busy                :1;
-               uint32_t        cpu_affinity_enabled    :1;
                uint32_t        disable_msix_handshake  :1;
                uint32_t        fcp_prio_enabled        :1;
                uint32_t        isp82xx_fw_hung:1;
@@ -3061,10 +3096,15 @@ struct qla_hw_data {
        uint8_t         mqenable;
        struct req_que **req_q_map;
        struct rsp_que **rsp_q_map;
+       struct qla_qpair **queue_pair_map;
        unsigned long req_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)];
        unsigned long rsp_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)];
+       unsigned long qpair_qid_map[(QLA_MAX_QUEUES / 8)
+               / sizeof(unsigned long)];
        uint8_t         max_req_queues;
        uint8_t         max_rsp_queues;
+       uint8_t         max_qpairs;
+       struct qla_qpair *base_qpair;
        struct qla_npiv_entry *npiv_info;
        uint16_t        nvram_npiv_size;
 
@@ -3328,6 +3368,7 @@ struct qla_hw_data {
 
        struct mutex vport_lock;        /* Virtual port synchronization */
        spinlock_t vport_slock; /* order is hardware_lock, then vport_slock */
+       struct mutex mq_lock;        /* multi-queue synchronization */
        struct completion mbx_cmd_comp; /* Serialize mbx access */
        struct completion mbx_intr_comp;  /* Used for completion notification */
        struct completion dcbx_comp;    /* For set port config notification */
@@ -3608,6 +3649,7 @@ typedef struct scsi_qla_host {
 
                uint32_t        fw_tgt_reported:1;
                uint32_t        bbcr_enable:1;
+               uint32_t        qpairs_available:1;
        } flags;
 
        atomic_t        loop_state;
@@ -3646,6 +3688,7 @@ typedef struct scsi_qla_host {
 #define FX00_TARGET_SCAN       24
 #define FX00_CRITEMP_RECOVERY  25
 #define FX00_HOST_INFO_RESEND  26
+#define QPAIR_ONLINE_CHECK_NEEDED      27
 
        unsigned long   pci_flags;
 #define PFLG_DISCONNECTED      0       /* PCI device removed */
@@ -3704,10 +3747,13 @@ typedef struct scsi_qla_host {
        /* List of pending PLOGI acks, protected by hw lock */
        struct list_head        plogi_ack_list;
 
+       struct list_head        qp_list;
+
        uint32_t        vp_abort_cnt;
 
        struct fc_vport *fc_vport;      /* holds fc_vport * for each vport */
        uint16_t        vp_idx;         /* vport ID */
+       struct qla_qpair *qpair;        /* base qpair */
 
        unsigned long           vp_flags;
 #define VP_IDX_ACQUIRED                0       /* bit no 0 */
@@ -3763,6 +3809,23 @@ struct qla_tgt_vp_map {
        scsi_qla_host_t *vha;
 };
 
+struct qla2_sgx {
+       dma_addr_t              dma_addr;       /* OUT */
+       uint32_t                dma_len;        /* OUT */
+
+       uint32_t                tot_bytes;      /* IN */
+       struct scatterlist      *cur_sg;        /* IN */
+
+       /* for book keeping, bzero on initial invocation */
+       uint32_t                bytes_consumed;
+       uint32_t                num_bytes;
+       uint32_t                tot_partial;
+
+       /* for debugging */
+       uint32_t                num_sg;
+       srb_t                   *sp;
+};
+
 /*
  * Macros to help code, maintain, etc.
  */
@@ -3775,21 +3838,34 @@ struct qla_tgt_vp_map {
                (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
                         test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))
 
-#define QLA_VHA_MARK_BUSY(__vha, __bail) do {               \
-       atomic_inc(&__vha->vref_count);                      \
-       mb();                                                \
-       if (__vha->flags.delete_progress) {                  \
-               atomic_dec(&__vha->vref_count);              \
-               __bail = 1;                                  \
-       } else {                                             \
-               __bail = 0;                                  \
-       }                                                    \
+#define QLA_VHA_MARK_BUSY(__vha, __bail) do {          \
+       atomic_inc(&__vha->vref_count);                 \
+       mb();                                           \
+       if (__vha->flags.delete_progress) {             \
+               atomic_dec(&__vha->vref_count);         \
+               __bail = 1;                             \
+       } else {                                        \
+               __bail = 0;                             \
+       }                                               \
 } while (0)
 
-#define QLA_VHA_MARK_NOT_BUSY(__vha) do {                   \
-       atomic_dec(&__vha->vref_count);                      \
+#define QLA_VHA_MARK_NOT_BUSY(__vha)                   \
+       atomic_dec(&__vha->vref_count);                 \
+
+#define QLA_QPAIR_MARK_BUSY(__qpair, __bail) do {      \
+       atomic_inc(&__qpair->ref_count);                \
+       mb();                                           \
+       if (__qpair->delete_in_progress) {              \
+               atomic_dec(&__qpair->ref_count);        \
+               __bail = 1;                             \
+       } else {                                        \
+              __bail = 0;                              \
+       }                                               \
 } while (0)
 
+#define QLA_QPAIR_MARK_NOT_BUSY(__qpair)               \
+       atomic_dec(&__qpair->ref_count);                \
+
 /*
  * qla2x00 local function return status codes
  */
index c51d9f3359e3286f272a15a8442c8b7a2fcc1a13..afa0116a163b12b5f8663a52bee5cc2ec846541d 100644 (file)
@@ -91,12 +91,17 @@ extern int
 qla2x00_alloc_outstanding_cmds(struct qla_hw_data *, struct req_que *);
 extern int qla2x00_init_rings(scsi_qla_host_t *);
 extern uint8_t qla27xx_find_valid_image(struct scsi_qla_host *);
+extern struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *,
+       int, int);
+extern int qla2xxx_delete_qpair(struct scsi_qla_host *, struct qla_qpair *);
 
 /*
  * Global Data in qla_os.c source file.
  */
 extern char qla2x00_version_str[];
 
+extern struct kmem_cache *srb_cachep;
+
 extern int ql2xlogintimeout;
 extern int qlport_down_retry;
 extern int ql2xplogiabsentdevice;
@@ -105,8 +110,7 @@ extern int ql2xfdmienable;
 extern int ql2xallocfwdump;
 extern int ql2xextended_error_logging;
 extern int ql2xiidmaenable;
-extern int ql2xmaxqueues;
-extern int ql2xmultique_tag;
+extern int ql2xmqsupport;
 extern int ql2xfwloadbin;
 extern int ql2xetsenable;
 extern int ql2xshiftctondsd;
@@ -172,6 +176,9 @@ extern int qla2x00_post_uevent_work(struct scsi_qla_host *, u32);
 
 extern int qla2x00_post_uevent_work(struct scsi_qla_host *, u32);
 extern void qla2x00_disable_board_on_pci_error(struct work_struct *);
+extern void qla2x00_sp_compl(void *, void *, int);
+extern void qla2xxx_qpair_sp_free_dma(void *, void *);
+extern void qla2xxx_qpair_sp_compl(void *, void *, int);
 
 /*
  * Global Functions in qla_mid.c source file.
@@ -220,6 +227,8 @@ extern uint16_t qla2x00_calc_iocbs_32(uint16_t);
 extern uint16_t qla2x00_calc_iocbs_64(uint16_t);
 extern void qla2x00_build_scsi_iocbs_32(srb_t *, cmd_entry_t *, uint16_t);
 extern void qla2x00_build_scsi_iocbs_64(srb_t *, cmd_entry_t *, uint16_t);
+extern void qla24xx_build_scsi_iocbs(srb_t *, struct cmd_type_7 *,
+       uint16_t, struct req_que *);
 extern int qla2x00_start_scsi(srb_t *sp);
 extern int qla24xx_start_scsi(srb_t *sp);
 int qla2x00_marker(struct scsi_qla_host *, struct req_que *, struct rsp_que *,
@@ -227,6 +236,7 @@ int qla2x00_marker(struct scsi_qla_host *, struct req_que *, struct rsp_que *,
 extern int qla2x00_start_sp(srb_t *);
 extern int qla24xx_dif_start_scsi(srb_t *);
 extern int qla2x00_start_bidir(srb_t *, struct scsi_qla_host *, uint32_t);
+extern int qla2xxx_dif_start_scsi_mq(srb_t *);
 extern unsigned long qla2x00_get_async_timeout(struct scsi_qla_host *);
 
 extern void *qla2x00_alloc_iocbs(scsi_qla_host_t *, srb_t *);
@@ -237,7 +247,10 @@ extern int qla24xx_walk_and_build_sglist(struct qla_hw_data *, srb_t *,
        uint32_t *, uint16_t, struct qla_tgt_cmd *);
 extern int qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *, srb_t *,
        uint32_t *, uint16_t, struct qla_tgt_cmd *);
-
+extern int qla24xx_get_one_block_sg(uint32_t, struct qla2_sgx *, uint32_t *);
+extern int qla24xx_configure_prot_mode(srb_t *, uint16_t *);
+extern int qla24xx_build_scsi_crc_2_iocbs(srb_t *,
+       struct cmd_type_crc_2 *, uint16_t, uint16_t, uint16_t);
 
 /*
  * Global Function Prototypes in qla_mbx.c source file.
@@ -468,6 +481,8 @@ qla2x00_get_sp_from_handle(scsi_qla_host_t *, const char *, struct req_que *,
 extern void
 qla2x00_process_completed_request(struct scsi_qla_host *, struct req_que *,
        uint32_t);
+extern irqreturn_t
+qla2xxx_msix_rsp_q(int irq, void *dev_id);
 
 /*
  * Global Function Prototypes in qla_sup.c source file.
@@ -603,15 +618,18 @@ extern int qla2x00_dfs_setup(scsi_qla_host_t *);
 extern int qla2x00_dfs_remove(scsi_qla_host_t *);
 
 /* Globa function prototypes for multi-q */
-extern int qla25xx_request_irq(struct rsp_que *);
+extern int qla25xx_request_irq(struct qla_hw_data *, struct qla_qpair *,
+       struct qla_msix_entry *, int);
 extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *);
 extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *);
 extern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t,
        uint16_t, int, uint8_t);
 extern int qla25xx_create_rsp_que(struct qla_hw_data *, uint16_t, uint8_t,
-       uint16_t, int);
+       uint16_t, struct qla_qpair *);
+
 extern void qla2x00_init_response_q_entries(struct rsp_que *);
 extern int qla25xx_delete_req_que(struct scsi_qla_host *, struct req_que *);
+extern int qla25xx_delete_rsp_que(struct scsi_qla_host *, struct rsp_que *);
 extern int qla25xx_delete_queues(struct scsi_qla_host *);
 extern uint16_t qla24xx_rd_req_reg(struct qla_hw_data *, uint16_t);
 extern uint16_t qla25xx_rd_req_reg(struct qla_hw_data *, uint16_t);
index 5b09296b46a3058f9c938990274d158b508af884..632d5f30386ab0ae529036c292f3c1c8e64162ca 100644 (file)
@@ -1769,8 +1769,7 @@ qla2x00_alloc_outstanding_cmds(struct qla_hw_data *ha, struct req_que *req)
        if (req->outstanding_cmds)
                return QLA_SUCCESS;
 
-       if (!IS_FWI2_CAPABLE(ha) || (ha->mqiobase &&
-           (ql2xmultique_tag || ql2xmaxqueues > 1)))
+       if (!IS_FWI2_CAPABLE(ha))
                req->num_outstanding_cmds = DEFAULT_OUTSTANDING_COMMANDS;
        else {
                if (ha->cur_fw_xcb_count <= ha->cur_fw_iocb_count)
@@ -4248,10 +4247,7 @@ qla2x00_loop_resync(scsi_qla_host_t *vha)
        struct req_que *req;
        struct rsp_que *rsp;
 
-       if (vha->hw->flags.cpu_affinity_enabled)
-               req = vha->hw->req_q_map[0];
-       else
-               req = vha->req;
+       req = vha->req;
        rsp = req->rsp;
 
        clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
@@ -6040,10 +6036,10 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha)
                return -EINVAL;
 
        rval = qla2x00_fw_ready(base_vha);
-       if (ha->flags.cpu_affinity_enabled)
-               req = ha->req_q_map[0];
+       if (vha->qpair)
+               req = vha->qpair->req;
        else
-               req = vha->req;
+               req = ha->req_q_map[0];
        rsp = req->rsp;
 
        if (rval == QLA_SUCCESS) {
@@ -6725,3 +6721,162 @@ qla24xx_update_all_fcp_prio(scsi_qla_host_t *vha)
 
        return ret;
 }
+
+struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos, int vp_idx)
+{
+       int rsp_id = 0;
+       int  req_id = 0;
+       int i;
+       struct qla_hw_data *ha = vha->hw;
+       uint16_t qpair_id = 0;
+       struct qla_qpair *qpair = NULL;
+       struct qla_msix_entry *msix;
+
+       if (!(ha->fw_attributes & BIT_6) || !ha->flags.msix_enabled) {
+               ql_log(ql_log_warn, vha, 0x00181,
+                   "FW/Driver is not multi-queue capable.\n");
+               return NULL;
+       }
+
+       if (ql2xmqsupport) {
+               qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL);
+               if (qpair == NULL) {
+                       ql_log(ql_log_warn, vha, 0x0182,
+                           "Failed to allocate memory for queue pair.\n");
+                       return NULL;
+               }
+               memset(qpair, 0, sizeof(struct qla_qpair));
+
+               qpair->hw = vha->hw;
+
+               /* Assign available que pair id */
+               mutex_lock(&ha->mq_lock);
+               qpair_id = find_first_zero_bit(ha->qpair_qid_map, ha->max_qpairs);
+               if (qpair_id >= ha->max_qpairs) {
+                       mutex_unlock(&ha->mq_lock);
+                       ql_log(ql_log_warn, vha, 0x0183,
+                           "No resources to create additional q pair.\n");
+                       goto fail_qid_map;
+               }
+               set_bit(qpair_id, ha->qpair_qid_map);
+               ha->queue_pair_map[qpair_id] = qpair;
+               qpair->id = qpair_id;
+               qpair->vp_idx = vp_idx;
+
+               for (i = 0; i < ha->msix_count; i++) {
+                       msix = &ha->msix_entries[i];
+                       if (msix->in_use)
+                               continue;
+                       qpair->msix = msix;
+                       ql_log(ql_dbg_multiq, vha, 0xc00f,
+                           "Vector %x selected for qpair\n", msix->vector);
+                       break;
+               }
+               if (!qpair->msix) {
+                       ql_log(ql_log_warn, vha, 0x0184,
+                           "Out of MSI-X vectors!.\n");
+                       goto fail_msix;
+               }
+
+               qpair->msix->in_use = 1;
+               list_add_tail(&qpair->qp_list_elem, &vha->qp_list);
+
+               mutex_unlock(&ha->mq_lock);
+
+               /* Create response queue first */
+               rsp_id = qla25xx_create_rsp_que(ha, 0, 0, 0, qpair);
+               if (!rsp_id) {
+                       ql_log(ql_log_warn, vha, 0x0185,
+                           "Failed to create response queue.\n");
+                       goto fail_rsp;
+               }
+
+               qpair->rsp = ha->rsp_q_map[rsp_id];
+
+               /* Create request queue */
+               req_id = qla25xx_create_req_que(ha, 0, vp_idx, 0, rsp_id, qos);
+               if (!req_id) {
+                       ql_log(ql_log_warn, vha, 0x0186,
+                           "Failed to create request queue.\n");
+                       goto fail_req;
+               }
+
+               qpair->req = ha->req_q_map[req_id];
+               qpair->rsp->req = qpair->req;
+
+               if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) {
+                       if (ha->fw_attributes & BIT_4)
+                               qpair->difdix_supported = 1;
+               }
+
+               qpair->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep);
+               if (!qpair->srb_mempool) {
+                       ql_log(ql_log_warn, vha, 0x0191,
+                           "Failed to create srb mempool for qpair %d\n",
+                           qpair->id);
+                       goto fail_mempool;
+               }
+
+               /* Mark as online */
+               qpair->online = 1;
+
+               if (!vha->flags.qpairs_available)
+                       vha->flags.qpairs_available = 1;
+
+               ql_dbg(ql_dbg_multiq, vha, 0xc00d,
+                   "Request/Response queue pair created, id %d\n",
+                   qpair->id);
+               ql_dbg(ql_dbg_init, vha, 0x0187,
+                   "Request/Response queue pair created, id %d\n",
+                   qpair->id);
+       }
+       return qpair;
+
+fail_mempool:
+fail_req:
+       qla25xx_delete_rsp_que(vha, qpair->rsp);
+fail_rsp:
+       mutex_lock(&ha->mq_lock);
+       qpair->msix->in_use = 0;
+       list_del(&qpair->qp_list_elem);
+       if (list_empty(&vha->qp_list))
+               vha->flags.qpairs_available = 0;
+fail_msix:
+       ha->queue_pair_map[qpair_id] = NULL;
+       clear_bit(qpair_id, ha->qpair_qid_map);
+       mutex_unlock(&ha->mq_lock);
+fail_qid_map:
+       kfree(qpair);
+       return NULL;
+}
+
+int qla2xxx_delete_qpair(struct scsi_qla_host *vha, struct qla_qpair *qpair)
+{
+       int ret;
+       struct qla_hw_data *ha = qpair->hw;
+
+       qpair->delete_in_progress = 1;
+       while (atomic_read(&qpair->ref_count))
+               msleep(500);
+
+       ret = qla25xx_delete_req_que(vha, qpair->req);
+       if (ret != QLA_SUCCESS)
+               goto fail;
+       ret = qla25xx_delete_rsp_que(vha, qpair->rsp);
+       if (ret != QLA_SUCCESS)
+               goto fail;
+
+       mutex_lock(&ha->mq_lock);
+       ha->queue_pair_map[qpair->id] = NULL;
+       clear_bit(qpair->id, ha->qpair_qid_map);
+       list_del(&qpair->qp_list_elem);
+       if (list_empty(&vha->qp_list))
+               vha->flags.qpairs_available = 0;
+       mempool_destroy(qpair->srb_mempool);
+       kfree(qpair);
+       mutex_unlock(&ha->mq_lock);
+
+       return QLA_SUCCESS;
+fail:
+       return ret;
+}
index edc48f3b8230cd60b9b3df25bbf87394f5ad6676..44e404583c86fca78d50be48c12129c2f89ad695 100644 (file)
@@ -215,6 +215,36 @@ qla2x00_reset_active(scsi_qla_host_t *vha)
            test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags);
 }
 
+static inline srb_t *
+qla2xxx_get_qpair_sp(struct qla_qpair *qpair, fc_port_t *fcport, gfp_t flag)
+{
+       srb_t *sp = NULL;
+       uint8_t bail;
+
+       QLA_QPAIR_MARK_BUSY(qpair, bail);
+       if (unlikely(bail))
+               return NULL;
+
+       sp = mempool_alloc(qpair->srb_mempool, flag);
+       if (!sp)
+               goto done;
+
+       memset(sp, 0, sizeof(*sp));
+       sp->fcport = fcport;
+       sp->iocbs = 1;
+done:
+       if (!sp)
+               QLA_QPAIR_MARK_NOT_BUSY(qpair);
+       return sp;
+}
+
+static inline void
+qla2xxx_rel_qpair_sp(struct qla_qpair *qpair, srb_t *sp)
+{
+       mempool_free(sp, qpair->srb_mempool);
+       QLA_QPAIR_MARK_NOT_BUSY(qpair);
+}
+
 static inline srb_t *
 qla2x00_get_sp(scsi_qla_host_t *vha, fc_port_t *fcport, gfp_t flag)
 {
index 221ad89078938d37227bd385f55a5a5b74675c0b..58e49a3e1de8bcc30b448a889ab8f4b0144fd982 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <scsi/scsi_tcq.h>
 
-static void qla25xx_set_que(srb_t *, struct rsp_que **);
 /**
  * qla2x00_get_cmd_direction() - Determine control_flag data direction.
  * @cmd: SCSI command
@@ -143,7 +142,7 @@ qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha, struct req_que *req)
        return (cont_pkt);
 }
 
-static inline int
+inline int
 qla24xx_configure_prot_mode(srb_t *sp, uint16_t *fw_prot_opts)
 {
        struct scsi_cmnd *cmd = GET_CMD_SP(sp);
@@ -693,10 +692,11 @@ qla24xx_calc_dsd_lists(uint16_t dsds)
  * @sp: SRB command to process
  * @cmd_pkt: Command type 3 IOCB
  * @tot_dsds: Total number of segments to transfer
+ * @req: pointer to request queue
  */
-static inline void
+inline void
 qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
-    uint16_t tot_dsds)
+       uint16_t tot_dsds, struct req_que *req)
 {
        uint16_t        avail_dsds;
        uint32_t        *cur_dsd;
@@ -745,7 +745,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
                         * Five DSDs are available in the Continuation
                         * Type 1 IOCB.
                         */
-                       cont_pkt = qla2x00_prep_cont_type1_iocb(vha, vha->req);
+                       cont_pkt = qla2x00_prep_cont_type1_iocb(vha, req);
                        cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
                        avail_dsds = 5;
                }
@@ -845,24 +845,7 @@ qla24xx_set_t10dif_tags(srb_t *sp, struct fw_dif_context *pkt,
        }
 }
 
-struct qla2_sgx {
-       dma_addr_t              dma_addr;       /* OUT */
-       uint32_t                dma_len;        /* OUT */
-
-       uint32_t                tot_bytes;      /* IN */
-       struct scatterlist      *cur_sg;        /* IN */
-
-       /* for book keeping, bzero on initial invocation */
-       uint32_t                bytes_consumed;
-       uint32_t                num_bytes;
-       uint32_t                tot_partial;
-
-       /* for debugging */
-       uint32_t                num_sg;
-       srb_t                   *sp;
-};
-
-static int
+int
 qla24xx_get_one_block_sg(uint32_t blk_sz, struct qla2_sgx *sgx,
        uint32_t *partial)
 {
@@ -1207,7 +1190,7 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp,
  * @cmd_pkt: Command type 3 IOCB
  * @tot_dsds: Total number of segments to transfer
  */
-static inline int
+inline int
 qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
     uint16_t tot_dsds, uint16_t tot_prot_dsds, uint16_t fw_prot_opts)
 {
@@ -1436,8 +1419,8 @@ qla24xx_start_scsi(srb_t *sp)
        struct qla_hw_data *ha = vha->hw;
 
        /* Setup device pointers. */
-       qla25xx_set_que(sp, &rsp);
        req = vha->req;
+       rsp = req->rsp;
 
        /* So we know we haven't pci_map'ed anything yet */
        tot_dsds = 0;
@@ -1523,12 +1506,10 @@ qla24xx_start_scsi(srb_t *sp)
        cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
 
        /* Build IOCB segments */
-       qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds);
+       qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds, req);
 
        /* Set total data segment count. */
        cmd_pkt->entry_count = (uint8_t)req_cnt;
-       /* Specify response queue number where completion should happen */
-       cmd_pkt->entry_status = (uint8_t) rsp->id;
        wmb();
        /* Adjust ring index. */
        req->ring_index++;
@@ -1597,9 +1578,8 @@ qla24xx_dif_start_scsi(srb_t *sp)
        }
 
        /* Setup device pointers. */
-
-       qla25xx_set_que(sp, &rsp);
        req = vha->req;
+       rsp = req->rsp;
 
        /* So we know we haven't pci_map'ed anything yet */
        tot_dsds = 0;
@@ -1764,18 +1744,365 @@ queuing_error:
        return QLA_FUNCTION_FAILED;
 }
 
-
-static void qla25xx_set_que(srb_t *sp, struct rsp_que **rsp)
+/**
+ * qla2xxx_start_scsi_mq() - Send a SCSI command to the ISP
+ * @sp: command to send to the ISP
+ *
+ * Returns non-zero if a failure occurred, else zero.
+ */
+static int
+qla2xxx_start_scsi_mq(srb_t *sp)
 {
+       int             nseg;
+       unsigned long   flags;
+       uint32_t        *clr_ptr;
+       uint32_t        index;
+       uint32_t        handle;
+       struct cmd_type_7 *cmd_pkt;
+       uint16_t        cnt;
+       uint16_t        req_cnt;
+       uint16_t        tot_dsds;
+       struct req_que *req = NULL;
+       struct rsp_que *rsp = NULL;
        struct scsi_cmnd *cmd = GET_CMD_SP(sp);
-       struct qla_hw_data *ha = sp->fcport->vha->hw;
-       int affinity = cmd->request->cpu;
+       struct scsi_qla_host *vha = sp->fcport->vha;
+       struct qla_hw_data *ha = vha->hw;
+       struct qla_qpair *qpair = sp->qpair;
+
+       /* Setup qpair pointers */
+       rsp = qpair->rsp;
+       req = qpair->req;
+
+       /* So we know we haven't pci_map'ed anything yet */
+       tot_dsds = 0;
+
+       /* Send marker if required */
+       if (vha->marker_needed != 0) {
+               if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL) !=
+                   QLA_SUCCESS)
+                       return QLA_FUNCTION_FAILED;
+               vha->marker_needed = 0;
+       }
+
+       /* Acquire qpair specific lock */
+       spin_lock_irqsave(&qpair->qp_lock, flags);
+
+       /* Check for room in outstanding command list. */
+       handle = req->current_outstanding_cmd;
+       for (index = 1; index < req->num_outstanding_cmds; index++) {
+               handle++;
+               if (handle == req->num_outstanding_cmds)
+                       handle = 1;
+               if (!req->outstanding_cmds[handle])
+                       break;
+       }
+       if (index == req->num_outstanding_cmds)
+               goto queuing_error;
+
+       /* Map the sg table so we have an accurate count of sg entries needed */
+       if (scsi_sg_count(cmd)) {
+               nseg = dma_map_sg(&ha->pdev->dev, scsi_sglist(cmd),
+                   scsi_sg_count(cmd), cmd->sc_data_direction);
+               if (unlikely(!nseg))
+                       goto queuing_error;
+       } else
+               nseg = 0;
+
+       tot_dsds = nseg;
+       req_cnt = qla24xx_calc_iocbs(vha, tot_dsds);
+       if (req->cnt < (req_cnt + 2)) {
+               cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr :
+                   RD_REG_DWORD_RELAXED(req->req_q_out);
+               if (req->ring_index < cnt)
+                       req->cnt = cnt - req->ring_index;
+               else
+                       req->cnt = req->length -
+                               (req->ring_index - cnt);
+               if (req->cnt < (req_cnt + 2))
+                       goto queuing_error;
+       }
+
+       /* Build command packet. */
+       req->current_outstanding_cmd = handle;
+       req->outstanding_cmds[handle] = sp;
+       sp->handle = handle;
+       cmd->host_scribble = (unsigned char *)(unsigned long)handle;
+       req->cnt -= req_cnt;
+
+       cmd_pkt = (struct cmd_type_7 *)req->ring_ptr;
+       cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
+
+       /* Zero out remaining portion of packet. */
+       /*    tagged queuing modifier -- default is TSK_SIMPLE (0). */
+       clr_ptr = (uint32_t *)cmd_pkt + 2;
+       memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
+       cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
+
+       /* Set NPORT-ID and LUN number*/
+       cmd_pkt->nport_handle = cpu_to_le16(sp->fcport->loop_id);
+       cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa;
+       cmd_pkt->port_id[1] = sp->fcport->d_id.b.area;
+       cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain;
+       cmd_pkt->vp_index = sp->fcport->vha->vp_idx;
+
+       int_to_scsilun(cmd->device->lun, &cmd_pkt->lun);
+       host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
+
+       cmd_pkt->task = TSK_SIMPLE;
+
+       /* Load SCSI command packet. */
+       memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len);
+       host_to_fcp_swap(cmd_pkt->fcp_cdb, sizeof(cmd_pkt->fcp_cdb));
+
+       cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
+
+       /* Build IOCB segments */
+       qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds, req);
+
+       /* Set total data segment count. */
+       cmd_pkt->entry_count = (uint8_t)req_cnt;
+       wmb();
+       /* Adjust ring index. */
+       req->ring_index++;
+       if (req->ring_index == req->length) {
+               req->ring_index = 0;
+               req->ring_ptr = req->ring;
+       } else
+               req->ring_ptr++;
+
+       sp->flags |= SRB_DMA_VALID;
+
+       /* Set chip new ring index. */
+       WRT_REG_DWORD(req->req_q_in, req->ring_index);
+
+       /* Manage unprocessed RIO/ZIO commands in response queue. */
+       if (vha->flags.process_response_queue &&
+               rsp->ring_ptr->signature != RESPONSE_PROCESSED)
+               qla24xx_process_response_queue(vha, rsp);
+
+       spin_unlock_irqrestore(&qpair->qp_lock, flags);
+       return QLA_SUCCESS;
+
+queuing_error:
+       if (tot_dsds)
+               scsi_dma_unmap(cmd);
+
+       spin_unlock_irqrestore(&qpair->qp_lock, flags);
+
+       return QLA_FUNCTION_FAILED;
+}
+
+
+/**
+ * qla2xxx_dif_start_scsi_mq() - Send a SCSI command to the ISP
+ * @sp: command to send to the ISP
+ *
+ * Returns non-zero if a failure occurred, else zero.
+ */
+int
+qla2xxx_dif_start_scsi_mq(srb_t *sp)
+{
+       int                     nseg;
+       unsigned long           flags;
+       uint32_t                *clr_ptr;
+       uint32_t                index;
+       uint32_t                handle;
+       uint16_t                cnt;
+       uint16_t                req_cnt = 0;
+       uint16_t                tot_dsds;
+       uint16_t                tot_prot_dsds;
+       uint16_t                fw_prot_opts = 0;
+       struct req_que          *req = NULL;
+       struct rsp_que          *rsp = NULL;
+       struct scsi_cmnd        *cmd = GET_CMD_SP(sp);
+       struct scsi_qla_host    *vha = sp->fcport->vha;
+       struct qla_hw_data      *ha = vha->hw;
+       struct cmd_type_crc_2   *cmd_pkt;
+       uint32_t                status = 0;
+       struct qla_qpair        *qpair = sp->qpair;
+
+#define QDSS_GOT_Q_SPACE       BIT_0
+
+       /* Check for host side state */
+       if (!qpair->online) {
+               cmd->result = DID_NO_CONNECT << 16;
+               return QLA_INTERFACE_ERROR;
+       }
+
+       if (!qpair->difdix_supported &&
+               scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) {
+               cmd->result = DID_NO_CONNECT << 16;
+               return QLA_INTERFACE_ERROR;
+       }
+
+       /* Only process protection or >16 cdb in this routine */
+       if (scsi_get_prot_op(cmd) == SCSI_PROT_NORMAL) {
+               if (cmd->cmd_len <= 16)
+                       return qla2xxx_start_scsi_mq(sp);
+       }
+
+       /* Setup qpair pointers */
+       rsp = qpair->rsp;
+       req = qpair->req;
+
+       /* So we know we haven't pci_map'ed anything yet */
+       tot_dsds = 0;
+
+       /* Send marker if required */
+       if (vha->marker_needed != 0) {
+               if (qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL) !=
+                   QLA_SUCCESS)
+                       return QLA_FUNCTION_FAILED;
+               vha->marker_needed = 0;
+       }
+
+       /* Acquire ring specific lock */
+       spin_lock_irqsave(&qpair->qp_lock, flags);
+
+       /* Check for room in outstanding command list. */
+       handle = req->current_outstanding_cmd;
+       for (index = 1; index < req->num_outstanding_cmds; index++) {
+               handle++;
+               if (handle == req->num_outstanding_cmds)
+                       handle = 1;
+               if (!req->outstanding_cmds[handle])
+                       break;
+       }
+
+       if (index == req->num_outstanding_cmds)
+               goto queuing_error;
+
+       /* Compute number of required data segments */
+       /* Map the sg table so we have an accurate count of sg entries needed */
+       if (scsi_sg_count(cmd)) {
+               nseg = dma_map_sg(&ha->pdev->dev, scsi_sglist(cmd),
+                   scsi_sg_count(cmd), cmd->sc_data_direction);
+               if (unlikely(!nseg))
+                       goto queuing_error;
+               else
+                       sp->flags |= SRB_DMA_VALID;
+
+               if ((scsi_get_prot_op(cmd) == SCSI_PROT_READ_INSERT) ||
+                   (scsi_get_prot_op(cmd) == SCSI_PROT_WRITE_STRIP)) {
+                       struct qla2_sgx sgx;
+                       uint32_t        partial;
+
+                       memset(&sgx, 0, sizeof(struct qla2_sgx));
+                       sgx.tot_bytes = scsi_bufflen(cmd);
+                       sgx.cur_sg = scsi_sglist(cmd);
+                       sgx.sp = sp;
+
+                       nseg = 0;
+                       while (qla24xx_get_one_block_sg(
+                           cmd->device->sector_size, &sgx, &partial))
+                               nseg++;
+               }
+       } else
+               nseg = 0;
+
+       /* number of required data segments */
+       tot_dsds = nseg;
+
+       /* Compute number of required protection segments */
+       if (qla24xx_configure_prot_mode(sp, &fw_prot_opts)) {
+               nseg = dma_map_sg(&ha->pdev->dev, scsi_prot_sglist(cmd),
+                   scsi_prot_sg_count(cmd), cmd->sc_data_direction);
+               if (unlikely(!nseg))
+                       goto queuing_error;
+               else
+                       sp->flags |= SRB_CRC_PROT_DMA_VALID;
+
+               if ((scsi_get_prot_op(cmd) == SCSI_PROT_READ_INSERT) ||
+                   (scsi_get_prot_op(cmd) == SCSI_PROT_WRITE_STRIP)) {
+                       nseg = scsi_bufflen(cmd) / cmd->device->sector_size;
+               }
+       } else {
+               nseg = 0;
+       }
+
+       req_cnt = 1;
+       /* Total Data and protection sg segment(s) */
+       tot_prot_dsds = nseg;
+       tot_dsds += nseg;
+       if (req->cnt < (req_cnt + 2)) {
+               cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr :
+                   RD_REG_DWORD_RELAXED(req->req_q_out);
+               if (req->ring_index < cnt)
+                       req->cnt = cnt - req->ring_index;
+               else
+                       req->cnt = req->length -
+                               (req->ring_index - cnt);
+               if (req->cnt < (req_cnt + 2))
+                       goto queuing_error;
+       }
+
+       status |= QDSS_GOT_Q_SPACE;
+
+       /* Build header part of command packet (excluding the OPCODE). */
+       req->current_outstanding_cmd = handle;
+       req->outstanding_cmds[handle] = sp;
+       sp->handle = handle;
+       cmd->host_scribble = (unsigned char *)(unsigned long)handle;
+       req->cnt -= req_cnt;
+
+       /* Fill-in common area */
+       cmd_pkt = (struct cmd_type_crc_2 *)req->ring_ptr;
+       cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
+
+       clr_ptr = (uint32_t *)cmd_pkt + 2;
+       memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
+
+       /* Set NPORT-ID and LUN number*/
+       cmd_pkt->nport_handle = cpu_to_le16(sp->fcport->loop_id);
+       cmd_pkt->port_id[0] = sp->fcport->d_id.b.al_pa;
+       cmd_pkt->port_id[1] = sp->fcport->d_id.b.area;
+       cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain;
 
-       if (ha->flags.cpu_affinity_enabled && affinity >= 0 &&
-               affinity < ha->max_rsp_queues - 1)
-               *rsp = ha->rsp_q_map[affinity + 1];
-        else
-               *rsp = ha->rsp_q_map[0];
+       int_to_scsilun(cmd->device->lun, &cmd_pkt->lun);
+       host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
+
+       /* Total Data and protection segment(s) */
+       cmd_pkt->dseg_count = cpu_to_le16(tot_dsds);
+
+       /* Build IOCB segments and adjust for data protection segments */
+       if (qla24xx_build_scsi_crc_2_iocbs(sp, (struct cmd_type_crc_2 *)
+           req->ring_ptr, tot_dsds, tot_prot_dsds, fw_prot_opts) !=
+               QLA_SUCCESS)
+               goto queuing_error;
+
+       cmd_pkt->entry_count = (uint8_t)req_cnt;
+       cmd_pkt->timeout = cpu_to_le16(0);
+       wmb();
+
+       /* Adjust ring index. */
+       req->ring_index++;
+       if (req->ring_index == req->length) {
+               req->ring_index = 0;
+               req->ring_ptr = req->ring;
+       } else
+               req->ring_ptr++;
+
+       /* Set chip new ring index. */
+       WRT_REG_DWORD(req->req_q_in, req->ring_index);
+
+       /* Manage unprocessed RIO/ZIO commands in response queue. */
+       if (vha->flags.process_response_queue &&
+           rsp->ring_ptr->signature != RESPONSE_PROCESSED)
+               qla24xx_process_response_queue(vha, rsp);
+
+       spin_unlock_irqrestore(&qpair->qp_lock, flags);
+
+       return QLA_SUCCESS;
+
+queuing_error:
+       if (status & QDSS_GOT_Q_SPACE) {
+               req->outstanding_cmds[handle] = NULL;
+               req->cnt += req_cnt;
+       }
+       /* Cleanup will be performed by the caller (queuecommand) */
+
+       spin_unlock_irqrestore(&qpair->qp_lock, flags);
+       return QLA_FUNCTION_FAILED;
 }
 
 /* Generic Control-SRB manipulation functions. */
@@ -2664,7 +2991,7 @@ sufficient_dsds:
                cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
 
                /* Build IOCB segments */
-               qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds);
+               qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds, req);
 
                /* Set total data segment count. */
                cmd_pkt->entry_count = (uint8_t)req_cnt;
index d8efddf6f312e9df82c81d2edeefa731a7c4cac8..5093ca9b02ec52c8e70674f88205941cc0967d9f 100644 (file)
@@ -2871,41 +2871,6 @@ out:
        return IRQ_HANDLED;
 }
 
-static irqreturn_t
-qla25xx_msix_rsp_q(int irq, void *dev_id)
-{
-       struct qla_hw_data *ha;
-       scsi_qla_host_t *vha;
-       struct rsp_que *rsp;
-       struct device_reg_24xx __iomem *reg;
-       unsigned long flags;
-       uint32_t hccr = 0;
-
-       rsp = (struct rsp_que *) dev_id;
-       if (!rsp) {
-               ql_log(ql_log_info, NULL, 0x505b,
-                   "%s: NULL response queue pointer.\n", __func__);
-               return IRQ_NONE;
-       }
-       ha = rsp->hw;
-       vha = pci_get_drvdata(ha->pdev);
-
-       /* Clear the interrupt, if enabled, for this response queue */
-       if (!ha->flags.disable_msix_handshake) {
-               reg = &ha->iobase->isp24;
-               spin_lock_irqsave(&ha->hardware_lock, flags);
-               WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
-               hccr = RD_REG_DWORD_RELAXED(&reg->hccr);
-               spin_unlock_irqrestore(&ha->hardware_lock, flags);
-       }
-       if (qla2x00_check_reg32_for_disconnect(vha, hccr))
-               goto out;
-       queue_work_on((int) (rsp->id - 1), ha->wq, &rsp->q_work);
-
-out:
-       return IRQ_HANDLED;
-}
-
 static irqreturn_t
 qla24xx_msix_default(int irq, void *dev_id)
 {
@@ -3002,6 +2967,35 @@ qla24xx_msix_default(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
+irqreturn_t
+qla2xxx_msix_rsp_q(int irq, void *dev_id)
+{
+       struct qla_hw_data *ha;
+       struct qla_qpair *qpair;
+       struct device_reg_24xx __iomem *reg;
+       unsigned long flags;
+
+       qpair = dev_id;
+       if (!qpair) {
+               ql_log(ql_log_info, NULL, 0x505b,
+                   "%s: NULL response queue pointer.\n", __func__);
+               return IRQ_NONE;
+       }
+       ha = qpair->hw;
+
+       /* Clear the interrupt, if enabled, for this response queue */
+       if (unlikely(!ha->flags.disable_msix_handshake)) {
+               reg = &ha->iobase->isp24;
+               spin_lock_irqsave(&ha->hardware_lock, flags);
+               WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
+               spin_unlock_irqrestore(&ha->hardware_lock, flags);
+       }
+
+       queue_work(ha->wq, &qpair->q_work);
+
+       return IRQ_HANDLED;
+}
+
 /* Interrupt handling helpers. */
 
 struct qla_init_msix_entry {
@@ -3009,69 +3003,28 @@ struct qla_init_msix_entry {
        irq_handler_t handler;
 };
 
-static struct qla_init_msix_entry msix_entries[3] = {
+static struct qla_init_msix_entry msix_entries[] = {
        { "qla2xxx (default)", qla24xx_msix_default },
        { "qla2xxx (rsp_q)", qla24xx_msix_rsp_q },
-       { "qla2xxx (multiq)", qla25xx_msix_rsp_q },
+       { "qla2xxx (atio_q)", qla83xx_msix_atio_q },
+       { "qla2xxx (qpair_multiq)", qla2xxx_msix_rsp_q },
 };
 
-static struct qla_init_msix_entry qla82xx_msix_entries[2] = {
+static struct qla_init_msix_entry qla82xx_msix_entries[] = {
        { "qla2xxx (default)", qla82xx_msix_default },
        { "qla2xxx (rsp_q)", qla82xx_msix_rsp_q },
 };
 
-static struct qla_init_msix_entry qla83xx_msix_entries[3] = {
-       { "qla2xxx (default)", qla24xx_msix_default },
-       { "qla2xxx (rsp_q)", qla24xx_msix_rsp_q },
-       { "qla2xxx (atio_q)", qla83xx_msix_atio_q },
-};
-
-static void
-qla24xx_disable_msix(struct qla_hw_data *ha)
-{
-       int i;
-       struct qla_msix_entry *qentry;
-       scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
-
-       for (i = 0; i < ha->msix_count; i++) {
-               qentry = &ha->msix_entries[i];
-               if (qentry->have_irq) {
-                       /* un-register irq cpu affinity notification */
-                       irq_set_affinity_notifier(qentry->vector, NULL);
-                       free_irq(qentry->vector, qentry->rsp);
-               }
-       }
-       pci_disable_msix(ha->pdev);
-       kfree(ha->msix_entries);
-       ha->msix_entries = NULL;
-       ha->flags.msix_enabled = 0;
-       ql_dbg(ql_dbg_init, vha, 0x0042,
-           "Disabled the MSI.\n");
-}
-
 static int
 qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
 {
 #define MIN_MSIX_COUNT 2
-#define ATIO_VECTOR    2
        int i, ret;
-       struct msix_entry *entries;
        struct qla_msix_entry *qentry;
        scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
-       entries = kzalloc(sizeof(struct msix_entry) * ha->msix_count,
-                       GFP_KERNEL);
-       if (!entries) {
-               ql_log(ql_log_warn, vha, 0x00bc,
-                   "Failed to allocate memory for msix_entry.\n");
-               return -ENOMEM;
-       }
-
-       for (i = 0; i < ha->msix_count; i++)
-               entries[i].entry = i;
-
-       ret = pci_enable_msix_range(ha->pdev,
-                                   entries, MIN_MSIX_COUNT, ha->msix_count);
+       ret = pci_alloc_irq_vectors(ha->pdev, MIN_MSIX_COUNT, ha->msix_count,
+                                   PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
        if (ret < 0) {
                ql_log(ql_log_fatal, vha, 0x00c7,
                    "MSI-X: Failed to enable support, "
@@ -3081,10 +3034,23 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
        } else if (ret < ha->msix_count) {
                ql_log(ql_log_warn, vha, 0x00c6,
                    "MSI-X: Failed to enable support "
-                   "-- %d/%d\n Retry with %d vectors.\n",
-                   ha->msix_count, ret, ret);
+                    "with %d vectors, using %d vectors.\n",
+                   ha->msix_count, ret);
                ha->msix_count = ret;
-               ha->max_rsp_queues = ha->msix_count - 1;
+               /* Recalculate queue values */
+               if (ha->mqiobase && ql2xmqsupport) {
+                       ha->max_req_queues = ha->msix_count - 1;
+
+                       /* ATIOQ needs 1 vector. That's 1 less QPair */
+                       if (QLA_TGT_MODE_ENABLED())
+                               ha->max_req_queues--;
+
+                       ha->max_rsp_queues = ha->max_req_queues;
+
+                       ha->max_qpairs = ha->max_req_queues - 1;
+                       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0190,
+                           "Adjusted Max no of queues pairs: %d.\n", ha->max_qpairs);
+               }
        }
        ha->msix_entries = kzalloc(sizeof(struct qla_msix_entry) *
                                ha->msix_count, GFP_KERNEL);
@@ -3098,20 +3064,23 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
 
        for (i = 0; i < ha->msix_count; i++) {
                qentry = &ha->msix_entries[i];
-               qentry->vector = entries[i].vector;
-               qentry->entry = entries[i].entry;
+               qentry->vector = pci_irq_vector(ha->pdev, i);
+               qentry->entry = i;
                qentry->have_irq = 0;
-               qentry->rsp = NULL;
+               qentry->in_use = 0;
+               qentry->handle = NULL;
                qentry->irq_notify.notify  = qla_irq_affinity_notify;
                qentry->irq_notify.release = qla_irq_affinity_release;
                qentry->cpuid = -1;
        }
 
        /* Enable MSI-X vectors for the base queue */
-       for (i = 0; i < 2; i++) {
+       for (i = 0; i < (QLA_MSIX_RSP_Q + 1); i++) {
                qentry = &ha->msix_entries[i];
-               qentry->rsp = rsp;
+               qentry->handle = rsp;
                rsp->msix = qentry;
+               scnprintf(qentry->name, sizeof(qentry->name),
+                   msix_entries[i].name);
                if (IS_P3P_TYPE(ha))
                        ret = request_irq(qentry->vector,
                                qla82xx_msix_entries[i].handler,
@@ -3123,6 +3092,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
                if (ret)
                        goto msix_register_fail;
                qentry->have_irq = 1;
+               qentry->in_use = 1;
 
                /* Register for CPU affinity notification. */
                irq_set_affinity_notifier(qentry->vector, &qentry->irq_notify);
@@ -3142,12 +3112,15 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
         * queue.
         */
        if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha)) {
-               qentry = &ha->msix_entries[ATIO_VECTOR];
-               qentry->rsp = rsp;
+               qentry = &ha->msix_entries[QLA_ATIO_VECTOR];
                rsp->msix = qentry;
+               qentry->handle = rsp;
+               scnprintf(qentry->name, sizeof(qentry->name),
+                   msix_entries[QLA_ATIO_VECTOR].name);
+               qentry->in_use = 1;
                ret = request_irq(qentry->vector,
-                       qla83xx_msix_entries[ATIO_VECTOR].handler,
-                       0, qla83xx_msix_entries[ATIO_VECTOR].name, rsp);
+                       msix_entries[QLA_ATIO_VECTOR].handler,
+                       0, msix_entries[QLA_ATIO_VECTOR].name, rsp);
                qentry->have_irq = 1;
        }
 
@@ -3156,7 +3129,7 @@ msix_register_fail:
                ql_log(ql_log_fatal, vha, 0x00cb,
                    "MSI-X: unable to register handler -- %x/%d.\n",
                    qentry->vector, ret);
-               qla24xx_disable_msix(ha);
+               qla2x00_free_irqs(vha);
                ha->mqenable = 0;
                goto msix_out;
        }
@@ -3164,11 +3137,13 @@ msix_register_fail:
        /* Enable MSI-X vector for response queue update for queue 0 */
        if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) {
                if (ha->msixbase && ha->mqiobase &&
-                   (ha->max_rsp_queues > 1 || ha->max_req_queues > 1))
+                   (ha->max_rsp_queues > 1 || ha->max_req_queues > 1 ||
+                    ql2xmqsupport))
                        ha->mqenable = 1;
        } else
-               if (ha->mqiobase
-                   && (ha->max_rsp_queues > 1 || ha->max_req_queues > 1))
+               if (ha->mqiobase &&
+                   (ha->max_rsp_queues > 1 || ha->max_req_queues > 1 ||
+                    ql2xmqsupport))
                        ha->mqenable = 1;
        ql_dbg(ql_dbg_multiq, vha, 0xc005,
            "mqiobase=%p, max_rsp_queues=%d, max_req_queues=%d.\n",
@@ -3178,7 +3153,6 @@ msix_register_fail:
            ha->mqiobase, ha->max_rsp_queues, ha->max_req_queues);
 
 msix_out:
-       kfree(entries);
        return ret;
 }
 
@@ -3231,7 +3205,7 @@ skip_msix:
            !IS_QLA27XX(ha))
                goto skip_msi;
 
-       ret = pci_enable_msi(ha->pdev);
+       ret = pci_alloc_irq_vectors(ha->pdev, 1, 1, PCI_IRQ_MSI);
        if (!ret) {
                ql_dbg(ql_dbg_init, vha, 0x0038,
                    "MSI: Enabled.\n");
@@ -3276,6 +3250,8 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
 {
        struct qla_hw_data *ha = vha->hw;
        struct rsp_que *rsp;
+       struct qla_msix_entry *qentry;
+       int i;
 
        /*
         * We need to check that ha->rsp_q_map is valid in case we are called
@@ -3285,25 +3261,36 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
                return;
        rsp = ha->rsp_q_map[0];
 
-       if (ha->flags.msix_enabled)
-               qla24xx_disable_msix(ha);
-       else if (ha->flags.msi_enabled) {
-               free_irq(ha->pdev->irq, rsp);
-               pci_disable_msi(ha->pdev);
-       } else
-               free_irq(ha->pdev->irq, rsp);
-}
+       if (ha->flags.msix_enabled) {
+               for (i = 0; i < ha->msix_count; i++) {
+                       qentry = &ha->msix_entries[i];
+                       if (qentry->have_irq) {
+                               irq_set_affinity_notifier(qentry->vector, NULL);
+                               free_irq(pci_irq_vector(ha->pdev, i), qentry->handle);
+                       }
+               }
+               kfree(ha->msix_entries);
+               ha->msix_entries = NULL;
+               ha->flags.msix_enabled = 0;
+               ql_dbg(ql_dbg_init, vha, 0x0042,
+                       "Disabled MSI-X.\n");
+       } else {
+               free_irq(pci_irq_vector(ha->pdev, 0), rsp);
+       }
 
+       pci_free_irq_vectors(ha->pdev);
+}
 
-int qla25xx_request_irq(struct rsp_que *rsp)
+int qla25xx_request_irq(struct qla_hw_data *ha, struct qla_qpair *qpair,
+       struct qla_msix_entry *msix, int vector_type)
 {
-       struct qla_hw_data *ha = rsp->hw;
-       struct qla_init_msix_entry *intr = &msix_entries[2];
-       struct qla_msix_entry *msix = rsp->msix;
+       struct qla_init_msix_entry *intr = &msix_entries[vector_type];
        scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
        int ret;
 
-       ret = request_irq(msix->vector, intr->handler, 0, intr->name, rsp);
+       scnprintf(msix->name, sizeof(msix->name),
+           "qla2xxx%lu_qpair%d", vha->host_no, qpair->id);
+       ret = request_irq(msix->vector, intr->handler, 0, msix->name, qpair);
        if (ret) {
                ql_log(ql_log_fatal, vha, 0x00e6,
                    "MSI-X: Unable to register handler -- %x/%d.\n",
@@ -3311,7 +3298,7 @@ int qla25xx_request_irq(struct rsp_que *rsp)
                return ret;
        }
        msix->have_irq = 1;
-       msix->rsp = rsp;
+       msix->handle = qpair;
        return ret;
 }
 
@@ -3324,11 +3311,12 @@ static void qla_irq_affinity_notify(struct irq_affinity_notify *notify,
                container_of(notify, struct qla_msix_entry, irq_notify);
        struct qla_hw_data *ha;
        struct scsi_qla_host *base_vha;
+       struct rsp_que *rsp = e->handle;
 
        /* user is recommended to set mask to just 1 cpu */
        e->cpuid = cpumask_first(mask);
 
-       ha = e->rsp->hw;
+       ha = rsp->hw;
        base_vha = pci_get_drvdata(ha->pdev);
 
        ql_dbg(ql_dbg_init, base_vha, 0xffff,
@@ -3352,9 +3340,10 @@ static void qla_irq_affinity_release(struct kref *ref)
                container_of(ref, struct irq_affinity_notify, kref);
        struct qla_msix_entry *e =
                container_of(notify, struct qla_msix_entry, irq_notify);
-       struct scsi_qla_host *base_vha = pci_get_drvdata(e->rsp->hw->pdev);
+       struct rsp_que *rsp = e->handle;
+       struct scsi_qla_host *base_vha = pci_get_drvdata(rsp->hw->pdev);
 
        ql_dbg(ql_dbg_init, base_vha, 0xffff,
-           "%s: host%ld: vector %d cpu %d \n", __func__,
+               "%s: host%ld: vector %d cpu %d\n", __func__,
            base_vha->host_no, e->vector, e->cpuid);
 }
index 23698c9986998a0a7279e6e256d4c377f6fceab9..2819ceb96041e5b97b234f115c9b35d4b4251ffe 100644 (file)
 #include <linux/delay.h>
 #include <linux/gfp.h>
 
+struct rom_cmd {
+       uint16_t cmd;
+} rom_cmds[] = {
+       { MBC_LOAD_RAM },
+       { MBC_EXECUTE_FIRMWARE },
+       { MBC_READ_RAM_WORD },
+       { MBC_MAILBOX_REGISTER_TEST },
+       { MBC_VERIFY_CHECKSUM },
+       { MBC_GET_FIRMWARE_VERSION },
+       { MBC_LOAD_RISC_RAM },
+       { MBC_DUMP_RISC_RAM },
+       { MBC_LOAD_RISC_RAM_EXTENDED },
+       { MBC_DUMP_RISC_RAM_EXTENDED },
+       { MBC_WRITE_RAM_WORD_EXTENDED },
+       { MBC_READ_RAM_EXTENDED },
+       { MBC_GET_RESOURCE_COUNTS },
+       { MBC_SET_FIRMWARE_OPTION },
+       { MBC_MID_INITIALIZE_FIRMWARE },
+       { MBC_GET_FIRMWARE_STATE },
+       { MBC_GET_MEM_OFFLOAD_CNTRL_STAT },
+       { MBC_GET_RETRY_COUNT },
+       { MBC_TRACE_CONTROL },
+};
+
+static int is_rom_cmd(uint16_t cmd)
+{
+       int i;
+       struct  rom_cmd *wc;
+
+       for (i = 0; i < ARRAY_SIZE(rom_cmds); i++) {
+               wc = rom_cmds + i;
+               if (wc->cmd == cmd)
+                       return 1;
+       }
+
+       return 0;
+}
 
 /*
  * qla2x00_mailbox_command
@@ -92,6 +129,17 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                return QLA_FUNCTION_TIMEOUT;
        }
 
+       /* check if ISP abort is active and return cmd with timeout */
+       if ((test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) ||
+           test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) ||
+           test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) &&
+           !is_rom_cmd(mcp->mb[0])) {
+               ql_log(ql_log_info, vha, 0x1005,
+                   "Cmd 0x%x aborted with timeout since ISP Abort is pending\n",
+                   mcp->mb[0]);
+               return QLA_FUNCTION_TIMEOUT;
+       }
+
        /*
         * Wait for active mailbox commands to finish by waiting at most tov
         * seconds. This is to serialize actual issuing of mailbox cmds during
@@ -178,6 +226,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                        WRT_REG_WORD(&reg->isp.hccr, HCCR_SET_HOST_INT);
                spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
+               wait_time = jiffies;
                if (!wait_for_completion_timeout(&ha->mbx_intr_comp,
                    mcp->tov * HZ)) {
                        ql_dbg(ql_dbg_mbx, vha, 0x117a,
@@ -186,6 +235,9 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
                        clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
                        spin_unlock_irqrestore(&ha->hardware_lock, flags);
                }
+               if (time_after(jiffies, wait_time + 5 * HZ))
+                       ql_log(ql_log_warn, vha, 0x1015, "cmd=0x%x, waited %d msecs\n",
+                           command, jiffies_to_msecs(jiffies - wait_time));
        } else {
                ql_dbg(ql_dbg_mbx, vha, 0x1011,
                    "Cmd=%x Polling Mode.\n", command);
@@ -1194,12 +1246,17 @@ qla2x00_abort_command(srb_t *sp)
        fc_port_t       *fcport = sp->fcport;
        scsi_qla_host_t *vha = fcport->vha;
        struct qla_hw_data *ha = vha->hw;
-       struct req_que *req = vha->req;
+       struct req_que *req;
        struct scsi_cmnd *cmd = GET_CMD_SP(sp);
 
        ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x103b,
            "Entered %s.\n", __func__);
 
+       if (vha->flags.qpairs_available && sp->qpair)
+               req = sp->qpair->req;
+       else
+               req = vha->req;
+
        spin_lock_irqsave(&ha->hardware_lock, flags);
        for (handle = 1; handle < req->num_outstanding_cmds; handle++) {
                if (req->outstanding_cmds[handle] == sp)
@@ -2152,10 +2209,10 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
        ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1061,
            "Entered %s.\n", __func__);
 
-       if (ha->flags.cpu_affinity_enabled)
-               req = ha->req_q_map[0];
+       if (vha->vp_idx && vha->qpair)
+               req = vha->qpair->req;
        else
-               req = vha->req;
+               req = ha->req_q_map[0];
 
        lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma);
        if (lg == NULL) {
@@ -2435,10 +2492,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
        }
        memset(lg, 0, sizeof(struct logio_entry_24xx));
 
-       if (ql2xmaxqueues > 1)
-               req = ha->req_q_map[0];
-       else
-               req = vha->req;
+       req = vha->req;
        lg->entry_type = LOGINOUT_PORT_IOCB_TYPE;
        lg->entry_count = 1;
        lg->handle = MAKE_HANDLE(req->id, lg->handle);
@@ -2904,6 +2958,9 @@ qla24xx_abort_command(srb_t *sp)
        ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x108c,
            "Entered %s.\n", __func__);
 
+       if (vha->flags.qpairs_available && sp->qpair)
+               req = sp->qpair->req;
+
        if (ql2xasynctmfenable)
                return qla24xx_async_abort_command(sp);
 
@@ -2984,6 +3041,7 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
        struct qla_hw_data *ha;
        struct req_que *req;
        struct rsp_que *rsp;
+       struct qla_qpair *qpair;
 
        vha = fcport->vha;
        ha = vha->hw;
@@ -2992,10 +3050,15 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
        ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1092,
            "Entered %s.\n", __func__);
 
-       if (ha->flags.cpu_affinity_enabled)
-               rsp = ha->rsp_q_map[tag + 1];
-       else
+       if (vha->vp_idx && vha->qpair) {
+               /* NPIV port */
+               qpair = vha->qpair;
+               rsp = qpair->rsp;
+               req = qpair->req;
+       } else {
                rsp = req->rsp;
+       }
+
        tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma);
        if (tsk == NULL) {
                ql_log(ql_log_warn, vha, 0x1093,
index cf7ba52bae665fa482b8535f92e5fcb1dbe25244..c6d6f0d912ff75ffaf9b9d810f81af735e39549b 100644 (file)
@@ -540,9 +540,10 @@ qla25xx_free_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
        uint16_t que_id = rsp->id;
 
        if (rsp->msix && rsp->msix->have_irq) {
-               free_irq(rsp->msix->vector, rsp);
+               free_irq(rsp->msix->vector, rsp->msix->handle);
                rsp->msix->have_irq = 0;
-               rsp->msix->rsp = NULL;
+               rsp->msix->in_use = 0;
+               rsp->msix->handle = NULL;
        }
        dma_free_coherent(&ha->pdev->dev, (rsp->length + 1) *
                sizeof(response_t), rsp->ring, rsp->dma);
@@ -573,7 +574,7 @@ qla25xx_delete_req_que(struct scsi_qla_host *vha, struct req_que *req)
        return ret;
 }
 
-static int
+int
 qla25xx_delete_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
 {
        int ret = -1;
@@ -596,34 +597,42 @@ qla25xx_delete_queues(struct scsi_qla_host *vha)
        struct req_que *req = NULL;
        struct rsp_que *rsp = NULL;
        struct qla_hw_data *ha = vha->hw;
+       struct qla_qpair *qpair, *tqpair;
 
-       /* Delete request queues */
-       for (cnt = 1; cnt < ha->max_req_queues; cnt++) {
-               req = ha->req_q_map[cnt];
-               if (req && test_bit(cnt, ha->req_qid_map)) {
-                       ret = qla25xx_delete_req_que(vha, req);
-                       if (ret != QLA_SUCCESS) {
-                               ql_log(ql_log_warn, vha, 0x00ea,
-                                   "Couldn't delete req que %d.\n",
-                                   req->id);
-                               return ret;
+       if (ql2xmqsupport) {
+               list_for_each_entry_safe(qpair, tqpair, &vha->qp_list,
+                   qp_list_elem)
+                       qla2xxx_delete_qpair(vha, qpair);
+       } else {
+               /* Delete request queues */
+               for (cnt = 1; cnt < ha->max_req_queues; cnt++) {
+                       req = ha->req_q_map[cnt];
+                       if (req && test_bit(cnt, ha->req_qid_map)) {
+                               ret = qla25xx_delete_req_que(vha, req);
+                               if (ret != QLA_SUCCESS) {
+                                       ql_log(ql_log_warn, vha, 0x00ea,
+                                           "Couldn't delete req que %d.\n",
+                                           req->id);
+                                       return ret;
+                               }
                        }
                }
-       }
 
-       /* Delete response queues */
-       for (cnt = 1; cnt < ha->max_rsp_queues; cnt++) {
-               rsp = ha->rsp_q_map[cnt];
-               if (rsp && test_bit(cnt, ha->rsp_qid_map)) {
-                       ret = qla25xx_delete_rsp_que(vha, rsp);
-                       if (ret != QLA_SUCCESS) {
-                               ql_log(ql_log_warn, vha, 0x00eb,
-                                   "Couldn't delete rsp que %d.\n",
-                                   rsp->id);
-                               return ret;
+               /* Delete response queues */
+               for (cnt = 1; cnt < ha->max_rsp_queues; cnt++) {
+                       rsp = ha->rsp_q_map[cnt];
+                       if (rsp && test_bit(cnt, ha->rsp_qid_map)) {
+                               ret = qla25xx_delete_rsp_que(vha, rsp);
+                               if (ret != QLA_SUCCESS) {
+                                       ql_log(ql_log_warn, vha, 0x00eb,
+                                           "Couldn't delete rsp que %d.\n",
+                                           rsp->id);
+                                       return ret;
+                               }
                        }
                }
        }
+
        return ret;
 }
 
@@ -659,10 +668,10 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
        if (ret != QLA_SUCCESS)
                goto que_failed;
 
-       mutex_lock(&ha->vport_lock);
+       mutex_lock(&ha->mq_lock);
        que_id = find_first_zero_bit(ha->req_qid_map, ha->max_req_queues);
        if (que_id >= ha->max_req_queues) {
-               mutex_unlock(&ha->vport_lock);
+               mutex_unlock(&ha->mq_lock);
                ql_log(ql_log_warn, base_vha, 0x00db,
                    "No resources to create additional request queue.\n");
                goto que_failed;
@@ -708,7 +717,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
        req->req_q_out = &reg->isp25mq.req_q_out;
        req->max_q_depth = ha->req_q_map[0]->max_q_depth;
        req->out_ptr = (void *)(req->ring + req->length);
-       mutex_unlock(&ha->vport_lock);
+       mutex_unlock(&ha->mq_lock);
        ql_dbg(ql_dbg_multiq, base_vha, 0xc004,
            "ring_ptr=%p ring_index=%d, "
            "cnt=%d id=%d max_q_depth=%d.\n",
@@ -724,9 +733,9 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
        if (ret != QLA_SUCCESS) {
                ql_log(ql_log_fatal, base_vha, 0x00df,
                    "%s failed.\n", __func__);
-               mutex_lock(&ha->vport_lock);
+               mutex_lock(&ha->mq_lock);
                clear_bit(que_id, ha->req_qid_map);
-               mutex_unlock(&ha->vport_lock);
+               mutex_unlock(&ha->mq_lock);
                goto que_failed;
        }
 
@@ -741,20 +750,20 @@ failed:
 static void qla_do_work(struct work_struct *work)
 {
        unsigned long flags;
-       struct rsp_que *rsp = container_of(work, struct rsp_que, q_work);
+       struct qla_qpair *qpair = container_of(work, struct qla_qpair, q_work);
        struct scsi_qla_host *vha;
-       struct qla_hw_data *ha = rsp->hw;
+       struct qla_hw_data *ha = qpair->hw;
 
-       spin_lock_irqsave(&rsp->hw->hardware_lock, flags);
+       spin_lock_irqsave(&qpair->qp_lock, flags);
        vha = pci_get_drvdata(ha->pdev);
-       qla24xx_process_response_queue(vha, rsp);
-       spin_unlock_irqrestore(&rsp->hw->hardware_lock, flags);
+       qla24xx_process_response_queue(vha, qpair->rsp);
+       spin_unlock_irqrestore(&qpair->qp_lock, flags);
 }
 
 /* create response queue */
 int
 qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
-       uint8_t vp_idx, uint16_t rid, int req)
+       uint8_t vp_idx, uint16_t rid, struct qla_qpair *qpair)
 {
        int ret = 0;
        struct rsp_que *rsp = NULL;
@@ -779,28 +788,24 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
                goto que_failed;
        }
 
-       mutex_lock(&ha->vport_lock);
+       mutex_lock(&ha->mq_lock);
        que_id = find_first_zero_bit(ha->rsp_qid_map, ha->max_rsp_queues);
        if (que_id >= ha->max_rsp_queues) {
-               mutex_unlock(&ha->vport_lock);
+               mutex_unlock(&ha->mq_lock);
                ql_log(ql_log_warn, base_vha, 0x00e2,
                    "No resources to create additional request queue.\n");
                goto que_failed;
        }
        set_bit(que_id, ha->rsp_qid_map);
 
-       if (ha->flags.msix_enabled)
-               rsp->msix = &ha->msix_entries[que_id + 1];
-       else
-               ql_log(ql_log_warn, base_vha, 0x00e3,
-                   "MSIX not enabled.\n");
+       rsp->msix = qpair->msix;
 
        ha->rsp_q_map[que_id] = rsp;
        rsp->rid = rid;
        rsp->vp_idx = vp_idx;
        rsp->hw = ha;
        ql_dbg(ql_dbg_init, base_vha, 0x00e4,
-           "queue_id=%d rid=%d vp_idx=%d hw=%p.\n",
+           "rsp queue_id=%d rid=%d vp_idx=%d hw=%p.\n",
            que_id, rsp->rid, rsp->vp_idx, rsp->hw);
        /* Use alternate PCI bus number */
        if (MSB(rsp->rid))
@@ -812,23 +817,27 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
        if (!IS_MSIX_NACK_CAPABLE(ha))
                options |= BIT_6;
 
+       /* Set option to indicate response queue creation */
+       options |= BIT_1;
+
        rsp->options = options;
        rsp->id = que_id;
        reg = ISP_QUE_REG(ha, que_id);
        rsp->rsp_q_in = &reg->isp25mq.rsp_q_in;
        rsp->rsp_q_out = &reg->isp25mq.rsp_q_out;
        rsp->in_ptr = (void *)(rsp->ring + rsp->length);
-       mutex_unlock(&ha->vport_lock);
+       mutex_unlock(&ha->mq_lock);
        ql_dbg(ql_dbg_multiq, base_vha, 0xc00b,
-           "options=%x id=%d rsp_q_in=%p rsp_q_out=%p",
+           "options=%x id=%d rsp_q_in=%p rsp_q_out=%p\n",
            rsp->options, rsp->id, rsp->rsp_q_in,
            rsp->rsp_q_out);
        ql_dbg(ql_dbg_init, base_vha, 0x00e5,
-           "options=%x id=%d rsp_q_in=%p rsp_q_out=%p",
+           "options=%x id=%d rsp_q_in=%p rsp_q_out=%p\n",
            rsp->options, rsp->id, rsp->rsp_q_in,
            rsp->rsp_q_out);
 
-       ret = qla25xx_request_irq(rsp);
+       ret = qla25xx_request_irq(ha, qpair, qpair->msix,
+           QLA_MSIX_QPAIR_MULTIQ_RSP_Q);
        if (ret)
                goto que_failed;
 
@@ -836,19 +845,16 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
        if (ret != QLA_SUCCESS) {
                ql_log(ql_log_fatal, base_vha, 0x00e7,
                    "%s failed.\n", __func__);
-               mutex_lock(&ha->vport_lock);
+               mutex_lock(&ha->mq_lock);
                clear_bit(que_id, ha->rsp_qid_map);
-               mutex_unlock(&ha->vport_lock);
+               mutex_unlock(&ha->mq_lock);
                goto que_failed;
        }
-       if (req >= 0)
-               rsp->req = ha->req_q_map[req];
-       else
-               rsp->req = NULL;
+       rsp->req = NULL;
 
        qla2x00_init_response_q_entries(rsp);
-       if (rsp->hw->wq)
-               INIT_WORK(&rsp->q_work, qla_do_work);
+       if (qpair->hw->wq)
+               INIT_WORK(&qpair->q_work, qla_do_work);
        return rsp->id;
 
 que_failed:
index 56d6142852a553ed9ad8011cb4c18a84e8656e0d..8521cfe302e9e3e72c7aaf1a4753ca75f953b972 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/mutex.h>
 #include <linux/kobject.h>
 #include <linux/slab.h>
+#include <linux/blk-mq-pci.h>
 #include <scsi/scsi_tcq.h>
 #include <scsi/scsicam.h>
 #include <scsi/scsi_transport.h>
@@ -30,7 +31,7 @@ static int apidev_major;
 /*
  * SRB allocation cache
  */
-static struct kmem_cache *srb_cachep;
+struct kmem_cache *srb_cachep;
 
 /*
  * CT6 CTX allocation cache
@@ -143,19 +144,12 @@ MODULE_PARM_DESC(ql2xiidmaenable,
                "Enables iIDMA settings "
                "Default is 1 - perform iIDMA. 0 - no iIDMA.");
 
-int ql2xmaxqueues = 1;
-module_param(ql2xmaxqueues, int, S_IRUGO);
-MODULE_PARM_DESC(ql2xmaxqueues,
-               "Enables MQ settings "
-               "Default is 1 for single queue. Set it to number "
-               "of queues in MQ mode.");
-
-int ql2xmultique_tag;
-module_param(ql2xmultique_tag, int, S_IRUGO);
-MODULE_PARM_DESC(ql2xmultique_tag,
-               "Enables CPU affinity settings for the driver "
-               "Default is 0 for no affinity of request and response IO. "
-               "Set it to 1 to turn on the cpu affinity.");
+int ql2xmqsupport = 1;
+module_param(ql2xmqsupport, int, S_IRUGO);
+MODULE_PARM_DESC(ql2xmqsupport,
+               "Enable on demand multiple queue pairs support "
+               "Default is 1 for supported. "
+               "Set it to 0 to turn off mq qpair support.");
 
 int ql2xfwloadbin;
 module_param(ql2xfwloadbin, int, S_IRUGO|S_IWUSR);
@@ -261,6 +255,7 @@ static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
 static void qla2x00_clear_drv_active(struct qla_hw_data *);
 static void qla2x00_free_device(scsi_qla_host_t *);
 static void qla83xx_disable_laser(scsi_qla_host_t *vha);
+static int qla2xxx_map_queues(struct Scsi_Host *shost);
 
 struct scsi_host_template qla2xxx_driver_template = {
        .module                 = THIS_MODULE,
@@ -280,6 +275,7 @@ struct scsi_host_template qla2xxx_driver_template = {
        .scan_finished          = qla2xxx_scan_finished,
        .scan_start             = qla2xxx_scan_start,
        .change_queue_depth     = scsi_change_queue_depth,
+       .map_queues             = qla2xxx_map_queues,
        .this_id                = -1,
        .cmd_per_lun            = 3,
        .use_clustering         = ENABLE_CLUSTERING,
@@ -339,6 +335,8 @@ static int qla2x00_mem_alloc(struct qla_hw_data *, uint16_t, uint16_t,
        struct req_que **, struct rsp_que **);
 static void qla2x00_free_fw_dump(struct qla_hw_data *);
 static void qla2x00_mem_free(struct qla_hw_data *);
+int qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,
+       struct qla_qpair *qpair);
 
 /* -------------------------------------------------------------------------- */
 static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
@@ -360,6 +358,25 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
                    "Unable to allocate memory for response queue ptrs.\n");
                goto fail_rsp_map;
        }
+
+       if (ql2xmqsupport && ha->max_qpairs) {
+               ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *),
+                       GFP_KERNEL);
+               if (!ha->queue_pair_map) {
+                       ql_log(ql_log_fatal, vha, 0x0180,
+                           "Unable to allocate memory for queue pair ptrs.\n");
+                       goto fail_qpair_map;
+               }
+               ha->base_qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL);
+               if (ha->base_qpair == NULL) {
+                       ql_log(ql_log_warn, vha, 0x0182,
+                           "Failed to allocate base queue pair memory.\n");
+                       goto fail_base_qpair;
+               }
+               ha->base_qpair->req = req;
+               ha->base_qpair->rsp = rsp;
+       }
+
        /*
         * Make sure we record at least the request and response queue zero in
         * case we need to free them if part of the probe fails.
@@ -370,6 +387,11 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
        set_bit(0, ha->req_qid_map);
        return 1;
 
+fail_base_qpair:
+       kfree(ha->queue_pair_map);
+fail_qpair_map:
+       kfree(ha->rsp_q_map);
+       ha->rsp_q_map = NULL;
 fail_rsp_map:
        kfree(ha->req_q_map);
        ha->req_q_map = NULL;
@@ -417,82 +439,43 @@ static void qla2x00_free_queues(struct qla_hw_data *ha)
        struct req_que *req;
        struct rsp_que *rsp;
        int cnt;
+       unsigned long flags;
 
+       spin_lock_irqsave(&ha->hardware_lock, flags);
        for (cnt = 0; cnt < ha->max_req_queues; cnt++) {
                if (!test_bit(cnt, ha->req_qid_map))
                        continue;
 
                req = ha->req_q_map[cnt];
+               clear_bit(cnt, ha->req_qid_map);
+               ha->req_q_map[cnt] = NULL;
+
+               spin_unlock_irqrestore(&ha->hardware_lock, flags);
                qla2x00_free_req_que(ha, req);
+               spin_lock_irqsave(&ha->hardware_lock, flags);
        }
+       spin_unlock_irqrestore(&ha->hardware_lock, flags);
+
        kfree(ha->req_q_map);
        ha->req_q_map = NULL;
 
+
+       spin_lock_irqsave(&ha->hardware_lock, flags);
        for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) {
                if (!test_bit(cnt, ha->rsp_qid_map))
                        continue;
 
                rsp = ha->rsp_q_map[cnt];
+               clear_bit(cnt, ha->req_qid_map);
+               ha->rsp_q_map[cnt] =  NULL;
+               spin_unlock_irqrestore(&ha->hardware_lock, flags);
                qla2x00_free_rsp_que(ha, rsp);
+               spin_lock_irqsave(&ha->hardware_lock, flags);
        }
-       kfree(ha->rsp_q_map);
-       ha->rsp_q_map = NULL;
-}
-
-static int qla25xx_setup_mode(struct scsi_qla_host *vha)
-{
-       uint16_t options = 0;
-       int ques, req, ret;
-       struct qla_hw_data *ha = vha->hw;
+       spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
-       if (!(ha->fw_attributes & BIT_6)) {
-               ql_log(ql_log_warn, vha, 0x00d8,
-                   "Firmware is not multi-queue capable.\n");
-               goto fail;
-       }
-       if (ql2xmultique_tag) {
-               /* create a request queue for IO */
-               options |= BIT_7;
-               req = qla25xx_create_req_que(ha, options, 0, 0, -1,
-                       QLA_DEFAULT_QUE_QOS);
-               if (!req) {
-                       ql_log(ql_log_warn, vha, 0x00e0,
-                           "Failed to create request queue.\n");
-                       goto fail;
-               }
-               ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1);
-               vha->req = ha->req_q_map[req];
-               options |= BIT_1;
-               for (ques = 1; ques < ha->max_rsp_queues; ques++) {
-                       ret = qla25xx_create_rsp_que(ha, options, 0, 0, req);
-                       if (!ret) {
-                               ql_log(ql_log_warn, vha, 0x00e8,
-                                   "Failed to create response queue.\n");
-                               goto fail2;
-                       }
-               }
-               ha->flags.cpu_affinity_enabled = 1;
-               ql_dbg(ql_dbg_multiq, vha, 0xc007,
-                   "CPU affinity mode enabled, "
-                   "no. of response queues:%d no. of request queues:%d.\n",
-                   ha->max_rsp_queues, ha->max_req_queues);
-               ql_dbg(ql_dbg_init, vha, 0x00e9,
-                   "CPU affinity mode enabled, "
-                   "no. of response queues:%d no. of request queues:%d.\n",
-                   ha->max_rsp_queues, ha->max_req_queues);
-       }
-       return 0;
-fail2:
-       qla25xx_delete_queues(vha);
-       destroy_workqueue(ha->wq);
-       ha->wq = NULL;
-       vha->req = ha->req_q_map[0];
-fail:
-       ha->mqenable = 0;
-       kfree(ha->req_q_map);
        kfree(ha->rsp_q_map);
-       ha->max_req_queues = ha->max_rsp_queues = 1;
-       return 1;
+       ha->rsp_q_map = NULL;
 }
 
 static char *
@@ -669,7 +652,7 @@ qla2x00_sp_free_dma(void *vha, void *ptr)
        qla2x00_rel_sp(sp->fcport->vha, sp);
 }
 
-static void
+void
 qla2x00_sp_compl(void *data, void *ptr, int res)
 {
        struct qla_hw_data *ha = (struct qla_hw_data *)data;
@@ -693,6 +676,75 @@ qla2x00_sp_compl(void *data, void *ptr, int res)
        cmd->scsi_done(cmd);
 }
 
+void
+qla2xxx_qpair_sp_free_dma(void *vha, void *ptr)
+{
+       srb_t *sp = (srb_t *)ptr;
+       struct scsi_cmnd *cmd = GET_CMD_SP(sp);
+       struct qla_hw_data *ha = sp->fcport->vha->hw;
+       void *ctx = GET_CMD_CTX_SP(sp);
+
+       if (sp->flags & SRB_DMA_VALID) {
+               scsi_dma_unmap(cmd);
+               sp->flags &= ~SRB_DMA_VALID;
+       }
+
+       if (sp->flags & SRB_CRC_PROT_DMA_VALID) {
+               dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd),
+                   scsi_prot_sg_count(cmd), cmd->sc_data_direction);
+               sp->flags &= ~SRB_CRC_PROT_DMA_VALID;
+       }
+
+       if (sp->flags & SRB_CRC_CTX_DSD_VALID) {
+               /* List assured to be having elements */
+               qla2x00_clean_dsd_pool(ha, sp, NULL);
+               sp->flags &= ~SRB_CRC_CTX_DSD_VALID;
+       }
+
+       if (sp->flags & SRB_CRC_CTX_DMA_VALID) {
+               dma_pool_free(ha->dl_dma_pool, ctx,
+                   ((struct crc_context *)ctx)->crc_ctx_dma);
+               sp->flags &= ~SRB_CRC_CTX_DMA_VALID;
+       }
+
+       if (sp->flags & SRB_FCP_CMND_DMA_VALID) {
+               struct ct6_dsd *ctx1 = (struct ct6_dsd *)ctx;
+
+               dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd,
+                   ctx1->fcp_cmnd_dma);
+               list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list);
+               ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt;
+               ha->gbl_dsd_avail += ctx1->dsd_use_cnt;
+               mempool_free(ctx1, ha->ctx_mempool);
+       }
+
+       CMD_SP(cmd) = NULL;
+       qla2xxx_rel_qpair_sp(sp->qpair, sp);
+}
+
+void
+qla2xxx_qpair_sp_compl(void *data, void *ptr, int res)
+{
+       srb_t *sp = (srb_t *)ptr;
+       struct scsi_cmnd *cmd = GET_CMD_SP(sp);
+
+       cmd->result = res;
+
+       if (atomic_read(&sp->ref_count) == 0) {
+               ql_dbg(ql_dbg_io, sp->fcport->vha, 0x3079,
+                   "SP reference-count to ZERO -- sp=%p cmd=%p.\n",
+                   sp, GET_CMD_SP(sp));
+               if (ql2xextended_error_logging & ql_dbg_io)
+                       WARN_ON(atomic_read(&sp->ref_count) == 0);
+               return;
+       }
+       if (!atomic_dec_and_test(&sp->ref_count))
+               return;
+
+       qla2xxx_qpair_sp_free_dma(sp->fcport->vha, sp);
+       cmd->scsi_done(cmd);
+}
+
 /* If we are SP1 here, we need to still take and release the host_lock as SP1
  * does not have the changes necessary to avoid taking host->host_lock.
  */
@@ -706,12 +758,28 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
        struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
        srb_t *sp;
        int rval;
+       struct qla_qpair *qpair = NULL;
+       uint32_t tag;
+       uint16_t hwq;
 
        if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) {
                cmd->result = DID_NO_CONNECT << 16;
                goto qc24_fail_command;
        }
 
+       if (ha->mqenable) {
+               if (shost_use_blk_mq(vha->host)) {
+                       tag = blk_mq_unique_tag(cmd->request);
+                       hwq = blk_mq_unique_tag_to_hwq(tag);
+                       qpair = ha->queue_pair_map[hwq];
+               } else if (vha->vp_idx && vha->qpair) {
+                       qpair = vha->qpair;
+               }
+
+               if (qpair)
+                       return qla2xxx_mqueuecommand(host, cmd, qpair);
+       }
+
        if (ha->flags.eeh_busy) {
                if (ha->flags.pci_channel_io_perm_failure) {
                        ql_dbg(ql_dbg_aer, vha, 0x9010,
@@ -808,6 +876,95 @@ qc24_fail_command:
        return 0;
 }
 
+/* For MQ supported I/O */
+int
+qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,
+    struct qla_qpair *qpair)
+{
+       scsi_qla_host_t *vha = shost_priv(host);
+       fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
+       struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device));
+       struct qla_hw_data *ha = vha->hw;
+       struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
+       srb_t *sp;
+       int rval;
+
+       rval = fc_remote_port_chkready(rport);
+       if (rval) {
+               cmd->result = rval;
+               ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3076,
+                   "fc_remote_port_chkready failed for cmd=%p, rval=0x%x.\n",
+                   cmd, rval);
+               goto qc24_fail_command;
+       }
+
+       if (!fcport) {
+               cmd->result = DID_NO_CONNECT << 16;
+               goto qc24_fail_command;
+       }
+
+       if (atomic_read(&fcport->state) != FCS_ONLINE) {
+               if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
+                       atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
+                       ql_dbg(ql_dbg_io, vha, 0x3077,
+                           "Returning DNC, fcport_state=%d loop_state=%d.\n",
+                           atomic_read(&fcport->state),
+                           atomic_read(&base_vha->loop_state));
+                       cmd->result = DID_NO_CONNECT << 16;
+                       goto qc24_fail_command;
+               }
+               goto qc24_target_busy;
+       }
+
+       /*
+        * Return target busy if we've received a non-zero retry_delay_timer
+        * in a FCP_RSP.
+        */
+       if (fcport->retry_delay_timestamp == 0) {
+               /* retry delay not set */
+       } else if (time_after(jiffies, fcport->retry_delay_timestamp))
+               fcport->retry_delay_timestamp = 0;
+       else
+               goto qc24_target_busy;
+
+       sp = qla2xxx_get_qpair_sp(qpair, fcport, GFP_ATOMIC);
+       if (!sp)
+               goto qc24_host_busy;
+
+       sp->u.scmd.cmd = cmd;
+       sp->type = SRB_SCSI_CMD;
+       atomic_set(&sp->ref_count, 1);
+       CMD_SP(cmd) = (void *)sp;
+       sp->free = qla2xxx_qpair_sp_free_dma;
+       sp->done = qla2xxx_qpair_sp_compl;
+       sp->qpair = qpair;
+
+       rval = ha->isp_ops->start_scsi_mq(sp);
+       if (rval != QLA_SUCCESS) {
+               ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3078,
+                   "Start scsi failed rval=%d for cmd=%p.\n", rval, cmd);
+               if (rval == QLA_INTERFACE_ERROR)
+                       goto qc24_fail_command;
+               goto qc24_host_busy_free_sp;
+       }
+
+       return 0;
+
+qc24_host_busy_free_sp:
+       qla2xxx_qpair_sp_free_dma(vha, sp);
+
+qc24_host_busy:
+       return SCSI_MLQUEUE_HOST_BUSY;
+
+qc24_target_busy:
+       return SCSI_MLQUEUE_TARGET_BUSY;
+
+qc24_fail_command:
+       cmd->scsi_done(cmd);
+
+       return 0;
+}
+
 /*
  * qla2x00_eh_wait_on_command
  *    Waits for the command to be returned by the Firmware for some
@@ -1601,7 +1758,6 @@ qla2x00_iospace_config(struct qla_hw_data *ha)
 {
        resource_size_t pio;
        uint16_t msix;
-       int cpus;
 
        if (pci_request_selected_regions(ha->pdev, ha->bars,
            QLA2XXX_DRIVER_NAME)) {
@@ -1658,9 +1814,7 @@ skip_pio:
 
        /* Determine queue resources */
        ha->max_req_queues = ha->max_rsp_queues = 1;
-       if ((ql2xmaxqueues <= 1 && !ql2xmultique_tag) ||
-               (ql2xmaxqueues > 1 && ql2xmultique_tag) ||
-               (!IS_QLA25XX(ha) && !IS_QLA81XX(ha)))
+       if (!ql2xmqsupport || (!IS_QLA25XX(ha) && !IS_QLA81XX(ha)))
                goto mqiobase_exit;
 
        ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3),
@@ -1670,26 +1824,18 @@ skip_pio:
                    "MQIO Base=%p.\n", ha->mqiobase);
                /* Read MSIX vector size of the board */
                pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix);
-               ha->msix_count = msix;
+               ha->msix_count = msix + 1;
                /* Max queues are bounded by available msix vectors */
-               /* queue 0 uses two msix vectors */
-               if (ql2xmultique_tag) {
-                       cpus = num_online_cpus();
-                       ha->max_rsp_queues = (ha->msix_count - 1 > cpus) ?
-                               (cpus + 1) : (ha->msix_count - 1);
-                       ha->max_req_queues = 2;
-               } else if (ql2xmaxqueues > 1) {
-                       ha->max_req_queues = ql2xmaxqueues > QLA_MQ_SIZE ?
-                           QLA_MQ_SIZE : ql2xmaxqueues;
-                       ql_dbg_pci(ql_dbg_multiq, ha->pdev, 0xc008,
-                           "QoS mode set, max no of request queues:%d.\n",
-                           ha->max_req_queues);
-                       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0019,
-                           "QoS mode set, max no of request queues:%d.\n",
-                           ha->max_req_queues);
-               }
+               /* MB interrupt uses 1 vector */
+               ha->max_req_queues = ha->msix_count - 1;
+               ha->max_rsp_queues = ha->max_req_queues;
+               /* Queue pairs is the max value minus the base queue pair */
+               ha->max_qpairs = ha->max_rsp_queues - 1;
+               ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0188,
+                   "Max no of queues pairs: %d.\n", ha->max_qpairs);
+
                ql_log_pci(ql_log_info, ha->pdev, 0x001a,
-                   "MSI-X vector count: %d.\n", msix);
+                   "MSI-X vector count: %d.\n", ha->msix_count);
        } else
                ql_log_pci(ql_log_info, ha->pdev, 0x001b,
                    "BAR 3 not enabled.\n");
@@ -1709,7 +1855,6 @@ static int
 qla83xx_iospace_config(struct qla_hw_data *ha)
 {
        uint16_t msix;
-       int cpus;
 
        if (pci_request_selected_regions(ha->pdev, ha->bars,
            QLA2XXX_DRIVER_NAME)) {
@@ -1761,32 +1906,36 @@ qla83xx_iospace_config(struct qla_hw_data *ha)
                /* Read MSIX vector size of the board */
                pci_read_config_word(ha->pdev,
                    QLA_83XX_PCI_MSIX_CONTROL, &msix);
-               ha->msix_count = msix;
-               /* Max queues are bounded by available msix vectors */
-               /* queue 0 uses two msix vectors */
-               if (ql2xmultique_tag) {
-                       cpus = num_online_cpus();
-                       ha->max_rsp_queues = (ha->msix_count - 1 > cpus) ?
-                               (cpus + 1) : (ha->msix_count - 1);
-                       ha->max_req_queues = 2;
-               } else if (ql2xmaxqueues > 1) {
-                       ha->max_req_queues = ql2xmaxqueues > QLA_MQ_SIZE ?
-                                               QLA_MQ_SIZE : ql2xmaxqueues;
-                       ql_dbg_pci(ql_dbg_multiq, ha->pdev, 0xc00c,
-                           "QoS mode set, max no of request queues:%d.\n",
-                           ha->max_req_queues);
-                       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b,
-                           "QoS mode set, max no of request queues:%d.\n",
-                           ha->max_req_queues);
+               ha->msix_count = msix + 1;
+               /*
+                * By default, driver uses at least two msix vectors
+                * (default & rspq)
+                */
+               if (ql2xmqsupport) {
+                       /* MB interrupt uses 1 vector */
+                       ha->max_req_queues = ha->msix_count - 1;
+                       ha->max_rsp_queues = ha->max_req_queues;
+
+                       /* ATIOQ needs 1 vector. That's 1 less QPair */
+                       if (QLA_TGT_MODE_ENABLED())
+                               ha->max_req_queues--;
+
+                       /* Queue pairs is the max value minus
+                        * the base queue pair */
+                       ha->max_qpairs = ha->max_req_queues - 1;
+                       ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0190,
+                           "Max no of queues pairs: %d.\n", ha->max_qpairs);
                }
                ql_log_pci(ql_log_info, ha->pdev, 0x011c,
-                   "MSI-X vector count: %d.\n", msix);
+                   "MSI-X vector count: %d.\n", ha->msix_count);
        } else
                ql_log_pci(ql_log_info, ha->pdev, 0x011e,
                    "BAR 1 not enabled.\n");
 
 mqiobase_exit:
        ha->msix_count = ha->max_rsp_queues + 1;
+       if (QLA_TGT_MODE_ENABLED())
+               ha->msix_count++;
 
        qlt_83xx_iospace_config(ha);
 
@@ -1831,6 +1980,7 @@ static struct isp_operations qla2100_isp_ops = {
        .write_optrom           = qla2x00_write_optrom_data,
        .get_flash_version      = qla2x00_get_flash_version,
        .start_scsi             = qla2x00_start_scsi,
+       .start_scsi_mq          = NULL,
        .abort_isp              = qla2x00_abort_isp,
        .iospace_config         = qla2x00_iospace_config,
        .initialize_adapter     = qla2x00_initialize_adapter,
@@ -1869,6 +2019,7 @@ static struct isp_operations qla2300_isp_ops = {
        .write_optrom           = qla2x00_write_optrom_data,
        .get_flash_version      = qla2x00_get_flash_version,
        .start_scsi             = qla2x00_start_scsi,
+       .start_scsi_mq          = NULL,
        .abort_isp              = qla2x00_abort_isp,
        .iospace_config         = qla2x00_iospace_config,
        .initialize_adapter     = qla2x00_initialize_adapter,
@@ -1907,6 +2058,7 @@ static struct isp_operations qla24xx_isp_ops = {
        .write_optrom           = qla24xx_write_optrom_data,
        .get_flash_version      = qla24xx_get_flash_version,
        .start_scsi             = qla24xx_start_scsi,
+       .start_scsi_mq          = NULL,
        .abort_isp              = qla2x00_abort_isp,
        .iospace_config         = qla2x00_iospace_config,
        .initialize_adapter     = qla2x00_initialize_adapter,
@@ -1945,6 +2097,7 @@ static struct isp_operations qla25xx_isp_ops = {
        .write_optrom           = qla24xx_write_optrom_data,
        .get_flash_version      = qla24xx_get_flash_version,
        .start_scsi             = qla24xx_dif_start_scsi,
+       .start_scsi_mq          = qla2xxx_dif_start_scsi_mq,
        .abort_isp              = qla2x00_abort_isp,
        .iospace_config         = qla2x00_iospace_config,
        .initialize_adapter     = qla2x00_initialize_adapter,
@@ -1983,6 +2136,7 @@ static struct isp_operations qla81xx_isp_ops = {
        .write_optrom           = qla24xx_write_optrom_data,
        .get_flash_version      = qla24xx_get_flash_version,
        .start_scsi             = qla24xx_dif_start_scsi,
+       .start_scsi_mq          = qla2xxx_dif_start_scsi_mq,
        .abort_isp              = qla2x00_abort_isp,
        .iospace_config         = qla2x00_iospace_config,
        .initialize_adapter     = qla2x00_initialize_adapter,
@@ -2021,6 +2175,7 @@ static struct isp_operations qla82xx_isp_ops = {
        .write_optrom           = qla82xx_write_optrom_data,
        .get_flash_version      = qla82xx_get_flash_version,
        .start_scsi             = qla82xx_start_scsi,
+       .start_scsi_mq          = NULL,
        .abort_isp              = qla82xx_abort_isp,
        .iospace_config         = qla82xx_iospace_config,
        .initialize_adapter     = qla2x00_initialize_adapter,
@@ -2059,6 +2214,7 @@ static struct isp_operations qla8044_isp_ops = {
        .write_optrom           = qla8044_write_optrom_data,
        .get_flash_version      = qla82xx_get_flash_version,
        .start_scsi             = qla82xx_start_scsi,
+       .start_scsi_mq          = NULL,
        .abort_isp              = qla8044_abort_isp,
        .iospace_config         = qla82xx_iospace_config,
        .initialize_adapter     = qla2x00_initialize_adapter,
@@ -2097,6 +2253,7 @@ static struct isp_operations qla83xx_isp_ops = {
        .write_optrom           = qla24xx_write_optrom_data,
        .get_flash_version      = qla24xx_get_flash_version,
        .start_scsi             = qla24xx_dif_start_scsi,
+       .start_scsi_mq          = qla2xxx_dif_start_scsi_mq,
        .abort_isp              = qla2x00_abort_isp,
        .iospace_config         = qla83xx_iospace_config,
        .initialize_adapter     = qla2x00_initialize_adapter,
@@ -2135,6 +2292,7 @@ static struct isp_operations qlafx00_isp_ops = {
        .write_optrom           = qla24xx_write_optrom_data,
        .get_flash_version      = qla24xx_get_flash_version,
        .start_scsi             = qlafx00_start_scsi,
+       .start_scsi_mq          = NULL,
        .abort_isp              = qlafx00_abort_isp,
        .iospace_config         = qlafx00_iospace_config,
        .initialize_adapter     = qlafx00_initialize_adapter,
@@ -2173,6 +2331,7 @@ static struct isp_operations qla27xx_isp_ops = {
        .write_optrom           = qla24xx_write_optrom_data,
        .get_flash_version      = qla24xx_get_flash_version,
        .start_scsi             = qla24xx_dif_start_scsi,
+       .start_scsi_mq          = qla2xxx_dif_start_scsi_mq,
        .abort_isp              = qla2x00_abort_isp,
        .iospace_config         = qla83xx_iospace_config,
        .initialize_adapter     = qla2x00_initialize_adapter,
@@ -2387,6 +2546,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        uint16_t req_length = 0, rsp_length = 0;
        struct req_que *req = NULL;
        struct rsp_que *rsp = NULL;
+       int i;
+
        bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO);
        sht = &qla2xxx_driver_template;
        if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 ||
@@ -2650,6 +2811,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
            "Found an ISP%04X irq %d iobase 0x%p.\n",
            pdev->device, pdev->irq, ha->iobase);
        mutex_init(&ha->vport_lock);
+       mutex_init(&ha->mq_lock);
        init_completion(&ha->mbx_cmd_comp);
        complete(&ha->mbx_cmd_comp);
        init_completion(&ha->mbx_intr_comp);
@@ -2737,7 +2899,11 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
            host->max_cmd_len, host->max_channel, host->max_lun,
            host->transportt, sht->vendor_id);
 
-que_init:
+       /* Set up the irqs */
+       ret = qla2x00_request_irqs(ha, rsp);
+       if (ret)
+               goto probe_init_failed;
+
        /* Alloc arrays of request and response ring ptrs */
        if (!qla2x00_alloc_queues(ha, req, rsp)) {
                ql_log(ql_log_fatal, base_vha, 0x003d,
@@ -2746,12 +2912,17 @@ que_init:
                goto probe_init_failed;
        }
 
-       qlt_probe_one_stage1(base_vha, ha);
+       if (ha->mqenable && shost_use_blk_mq(host)) {
+               /* number of hardware queues supported by blk/scsi-mq*/
+               host->nr_hw_queues = ha->max_qpairs;
 
-       /* Set up the irqs */
-       ret = qla2x00_request_irqs(ha, rsp);
-       if (ret)
-               goto probe_init_failed;
+               ql_dbg(ql_dbg_init, base_vha, 0x0192,
+                       "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues);
+       } else
+               ql_dbg(ql_dbg_init, base_vha, 0x0193,
+                       "blk/scsi-mq disabled.\n");
+
+       qlt_probe_one_stage1(base_vha, ha);
 
        pci_save_state(pdev);
 
@@ -2842,11 +3013,12 @@ que_init:
            host->can_queue, base_vha->req,
            base_vha->mgmt_svr_loop_id, host->sg_tablesize);
 
-       if (ha->mqenable) {
-               if (qla25xx_setup_mode(base_vha)) {
-                       ql_log(ql_log_warn, base_vha, 0x00ec,
-                           "Failed to create queues, falling back to single queue mode.\n");
-                       goto que_init;
+       if (ha->mqenable && qla_ini_mode_enabled(base_vha)) {
+               ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1);
+               /* Create start of day qpairs for Block MQ */
+               if (shost_use_blk_mq(host)) {
+                       for (i = 0; i < ha->max_qpairs; i++)
+                               qla2xxx_create_qpair(base_vha, 5, 0);
                }
        }
 
@@ -3115,13 +3287,6 @@ qla2x00_delete_all_vps(struct qla_hw_data *ha, scsi_qla_host_t *base_vha)
 static void
 qla2x00_destroy_deferred_work(struct qla_hw_data *ha)
 {
-       /* Flush the work queue and remove it */
-       if (ha->wq) {
-               flush_workqueue(ha->wq);
-               destroy_workqueue(ha->wq);
-               ha->wq = NULL;
-       }
-
        /* Cancel all work and destroy DPC workqueues */
        if (ha->dpc_lp_wq) {
                cancel_work_sync(&ha->idc_aen);
@@ -3317,9 +3482,17 @@ qla2x00_free_device(scsi_qla_host_t *vha)
                ha->isp_ops->disable_intrs(ha);
        }
 
+       qla2x00_free_fcports(vha);
+
        qla2x00_free_irqs(vha);
 
-       qla2x00_free_fcports(vha);
+       /* Flush the work queue and remove it */
+       if (ha->wq) {
+               flush_workqueue(ha->wq);
+               destroy_workqueue(ha->wq);
+               ha->wq = NULL;
+       }
+
 
        qla2x00_mem_free(ha);
 
@@ -4034,6 +4207,7 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht,
        INIT_LIST_HEAD(&vha->qla_sess_op_cmd_list);
        INIT_LIST_HEAD(&vha->logo_list);
        INIT_LIST_HEAD(&vha->plogi_ack_list);
+       INIT_LIST_HEAD(&vha->qp_list);
 
        spin_lock_init(&vha->work_lock);
        spin_lock_init(&vha->cmd_list_lock);
@@ -5038,8 +5212,8 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work)
 
        base_vha->flags.init_done = 0;
        qla25xx_delete_queues(base_vha);
-       qla2x00_free_irqs(base_vha);
        qla2x00_free_fcports(base_vha);
+       qla2x00_free_irqs(base_vha);
        qla2x00_mem_free(ha);
        qla82xx_md_free(base_vha);
        qla2x00_free_queues(ha);
@@ -5073,6 +5247,8 @@ qla2x00_do_dpc(void *data)
 {
        scsi_qla_host_t *base_vha;
        struct qla_hw_data *ha;
+       uint32_t online;
+       struct qla_qpair *qpair;
 
        ha = (struct qla_hw_data *)data;
        base_vha = pci_get_drvdata(ha->pdev);
@@ -5334,6 +5510,22 @@ intr_on_check:
                                ha->isp_ops->beacon_blink(base_vha);
                }
 
+               /* qpair online check */
+               if (test_and_clear_bit(QPAIR_ONLINE_CHECK_NEEDED,
+                   &base_vha->dpc_flags)) {
+                       if (ha->flags.eeh_busy ||
+                           ha->flags.pci_channel_io_perm_failure)
+                               online = 0;
+                       else
+                               online = 1;
+
+                       mutex_lock(&ha->mq_lock);
+                       list_for_each_entry(qpair, &base_vha->qp_list,
+                           qp_list_elem)
+                       qpair->online = online;
+                       mutex_unlock(&ha->mq_lock);
+               }
+
                if (!IS_QLAFX00(ha))
                        qla2x00_do_dpc_all_vps(base_vha);
 
@@ -5676,6 +5868,10 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
        switch (state) {
        case pci_channel_io_normal:
                ha->flags.eeh_busy = 0;
+               if (ql2xmqsupport) {
+                       set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags);
+                       qla2xxx_wake_dpc(vha);
+               }
                return PCI_ERS_RESULT_CAN_RECOVER;
        case pci_channel_io_frozen:
                ha->flags.eeh_busy = 1;
@@ -5689,10 +5885,18 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
                pci_disable_device(pdev);
                /* Return back all IOs */
                qla2x00_abort_all_cmds(vha, DID_RESET << 16);
+               if (ql2xmqsupport) {
+                       set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags);
+                       qla2xxx_wake_dpc(vha);
+               }
                return PCI_ERS_RESULT_NEED_RESET;
        case pci_channel_io_perm_failure:
                ha->flags.pci_channel_io_perm_failure = 1;
                qla2x00_abort_all_cmds(vha, DID_NO_CONNECT << 16);
+               if (ql2xmqsupport) {
+                       set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags);
+                       qla2xxx_wake_dpc(vha);
+               }
                return PCI_ERS_RESULT_DISCONNECT;
        }
        return PCI_ERS_RESULT_NEED_RESET;
@@ -5960,6 +6164,13 @@ qla83xx_disable_laser(scsi_qla_host_t *vha)
        qla83xx_wr_reg(vha, reg, data);
 }
 
+static int qla2xxx_map_queues(struct Scsi_Host *shost)
+{
+       scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata;
+
+       return blk_mq_pci_map_queues(&shost->tag_set, vha->hw->pdev);
+}
+
 static const struct pci_error_handlers qla2xxx_err_handler = {
        .error_detected = qla2xxx_pci_error_detected,
        .mmio_enabled = qla2xxx_pci_mmio_enabled,
index 9f6012b78e565e3225e3e1f9b8a6f23e7eeef103..b4336e0cd85f077d4ebe241501b525a8810b7380 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * NVRAM support routines
index cf04a364fd8b35f869c31e44491d237ae1b3bc6e..03051e12a0721ec0632ebca9f66538c295844479 100644 (file)
@@ -4085,7 +4085,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
                        jiffies_to_timespec(delta_jiff, &ts);
                        kt = ktime_set(ts.tv_sec, ts.tv_nsec);
                } else
-                       kt = ktime_set(0, sdebug_ndelay);
+                       kt = sdebug_ndelay;
                if (NULL == sd_dp) {
                        sd_dp = kzalloc(sizeof(*sd_dp), GFP_ATOMIC);
                        if (NULL == sd_dp)
index c4f7b56fa6f60d880fb5ce6b57e91a2c694bb30f..8b8c814df5c75dfa87bdbb3b2c74e3cac536199c 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/string.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
index 7a74b82e8973984510091d06dd3fdf201fc327a0..480a597b387755d7506fc75a10f77c9d295ed596 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/seq_file.h>
 #include <linux/mutex.h>
 #include <linux/gfp.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
index 07349270535d19002a39fa12f968f22c3ebd8cb1..82dfe07b1d47f7e1f8ae3517191f15d190168834 100644 (file)
@@ -1204,10 +1204,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
        struct request_queue *rq = sdev->request_queue;
        struct scsi_target *starget = sdev->sdev_target;
 
-       error = scsi_device_set_state(sdev, SDEV_RUNNING);
-       if (error)
-               return error;
-
        error = scsi_target_add(starget);
        if (error)
                return error;
index 1622e23138e0f430d77fe7db10c840941ef02aef..b1933041da39d414f9c6e127052ba8cbaa25e65e 100644 (file)
@@ -53,7 +53,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/pr.h>
 #include <linux/t10-pi.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 
 #include <scsi/scsi.h>
index 070332eb41f33de2c765bedc724f50f404af62a9..dbe5b4b95df0d9d317dbdc2261914e4d8771991f 100644 (file)
@@ -581,6 +581,9 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
        sg_io_hdr_t *hp;
        unsigned char cmnd[SG_MAX_CDB_SIZE];
 
+       if (unlikely(segment_eq(get_fs(), KERNEL_DS)))
+               return -EINVAL;
+
        if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
                return -ENXIO;
        SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
index bed2bbd6b92304cec9eabb73245224782da7fc21..94352e4df831be803c3ef6a76cf7f6177750f29c 100644 (file)
@@ -46,7 +46,7 @@
 #include <linux/mutex.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_dbg.h>
index 03054c0e7689bd0587e17c5a56d22212739d8c04..dfffdf63e44c922bcc172e7f9dec01651f6c800a 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_dbg.h>
index 605887d5ee57d3b0e2ae75247a64c0e7489cc0d3..5f35b863e1a709fa3354ca3bae923fb9aee24fae 100644 (file)
@@ -41,7 +41,7 @@ static const char *verstr = "20160209";
 #include <linux/delay.h>
 #include <linux/mutex.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/dma.h>
 
 #include <scsi/scsi.h>
index aa43bfea0d004270d79411c91f5ee5b413daba73..abe6173726614f627c085129f4e8aa9dc6ba1eda 100644 (file)
@@ -23,6 +23,7 @@
 #include "unipro.h"
 #include "ufs-qcom.h"
 #include "ufshci.h"
+#include "ufs_quirks.h"
 #define UFS_QCOM_DEFAULT_DBG_PRINT_EN  \
        (UFS_QCOM_DBG_PRINT_REGS_EN | UFS_QCOM_DBG_PRINT_TEST_BUS_EN)
 
@@ -1031,6 +1032,34 @@ out:
        return ret;
 }
 
+static int ufs_qcom_quirk_host_pa_saveconfigtime(struct ufs_hba *hba)
+{
+       int err;
+       u32 pa_vs_config_reg1;
+
+       err = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_VS_CONFIG_REG1),
+                            &pa_vs_config_reg1);
+       if (err)
+               goto out;
+
+       /* Allow extension of MSB bits of PA_SaveConfigTime attribute */
+       err = ufshcd_dme_set(hba, UIC_ARG_MIB(PA_VS_CONFIG_REG1),
+                           (pa_vs_config_reg1 | (1 << 12)));
+
+out:
+       return err;
+}
+
+static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)
+{
+       int err = 0;
+
+       if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME)
+               err = ufs_qcom_quirk_host_pa_saveconfigtime(hba);
+
+       return err;
+}
+
 static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba)
 {
        struct ufs_qcom_host *host = ufshcd_get_variant(hba);
@@ -1194,7 +1223,16 @@ static int ufs_qcom_init(struct ufs_hba *hba)
         */
        host->generic_phy = devm_phy_get(dev, "ufsphy");
 
-       if (IS_ERR(host->generic_phy)) {
+       if (host->generic_phy == ERR_PTR(-EPROBE_DEFER)) {
+               /*
+                * UFS driver might be probed before the phy driver does.
+                * In that case we would like to return EPROBE_DEFER code.
+                */
+               err = -EPROBE_DEFER;
+               dev_warn(dev, "%s: required phy device. hasn't probed yet. err = %d\n",
+                       __func__, err);
+               goto out_variant_clear;
+       } else if (IS_ERR(host->generic_phy)) {
                err = PTR_ERR(host->generic_phy);
                dev_err(dev, "%s: PHY get failed %d\n", __func__, err);
                goto out_variant_clear;
@@ -1432,7 +1470,8 @@ static void ufs_qcom_print_hw_debug_reg_all(struct ufs_hba *hba,
        reg = ufs_qcom_get_debug_reg_offset(host, UFS_UFS_DBG_RD_PRDT_RAM);
        print_fn(hba, reg, 64, "UFS_UFS_DBG_RD_PRDT_RAM ", priv);
 
-       ufshcd_writel(hba, (reg & ~UFS_BIT(17)), REG_UFS_CFG1);
+       /* clear bit 17 - UTP_DBG_RAMS_EN */
+       ufshcd_rmwl(hba, UFS_BIT(17), 0, REG_UFS_CFG1);
 
        reg = ufs_qcom_get_debug_reg_offset(host, UFS_DBG_RD_REG_UAWM);
        print_fn(hba, reg, 4, "UFS_DBG_RD_REG_UAWM ", priv);
@@ -1609,6 +1648,7 @@ static struct ufs_hba_variant_ops ufs_hba_qcom_vops = {
        .hce_enable_notify      = ufs_qcom_hce_enable_notify,
        .link_startup_notify    = ufs_qcom_link_startup_notify,
        .pwr_change_notify      = ufs_qcom_pwr_change_notify,
+       .apply_dev_quirks       = ufs_qcom_apply_dev_quirks,
        .suspend                = ufs_qcom_suspend,
        .resume                 = ufs_qcom_resume,
        .dbg_register_dump      = ufs_qcom_dump_dbg_regs,
index a19307a57ce248f5cb102c294408227b8ed603de..fe517cd7dac348b40b97c322e49e26976b7256cc 100644 (file)
@@ -142,6 +142,7 @@ enum ufs_qcom_phy_init_type {
         UFS_QCOM_DBG_PRINT_TEST_BUS_EN)
 
 /* QUniPro Vendor specific attributes */
+#define PA_VS_CONFIG_REG1      0x9000
 #define DME_VS_CORE_CLK_CTRL   0xD002
 /* bit and mask definitions for DME_VS_CORE_CLK_CTRL attribute */
 #define DME_VS_CORE_CLK_CTRL_CORE_CLK_DIV_EN_BIT               BIT(8)
index f7983058f3f716ed27505fbcef0d420eaf8a6163..08b799d4efcc68b99b7c43fa7af968dd3b543a2c 100644 (file)
@@ -134,29 +134,17 @@ struct ufs_dev_fix {
  */
 #define UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE     (1 << 7)
 
+/*
+ * The max. value PA_SaveConfigTime is 250 (10us) but this is not enough for
+ * some vendors.
+ * Gear switch from PWM to HS may fail even with this max. PA_SaveConfigTime.
+ * Gear switch can be issued by host controller as an error recovery and any
+ * software delay will not help on this case so we need to increase
+ * PA_SaveConfigTime to >32us as per vendor recommendation.
+ */
+#define UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME        (1 << 8)
 
 struct ufs_hba;
 void ufs_advertise_fixup_device(struct ufs_hba *hba);
 
-static struct ufs_dev_fix ufs_fixups[] = {
-       /* UFS cards deviations table */
-       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
-               UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
-       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ),
-       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
-               UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS),
-       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
-               UFS_DEVICE_NO_FASTAUTO),
-       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
-               UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE),
-       UFS_FIX(UFS_VENDOR_TOSHIBA, UFS_ANY_MODEL,
-               UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
-       UFS_FIX(UFS_VENDOR_TOSHIBA, "THGLF2G9C8KBADG",
-               UFS_DEVICE_QUIRK_PA_TACTIVATE),
-       UFS_FIX(UFS_VENDOR_TOSHIBA, "THGLF2G9D8KBADG",
-               UFS_DEVICE_QUIRK_PA_TACTIVATE),
-       UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ),
-
-       END_FIX
-};
 #endif /* UFS_QUIRKS_H_ */
index ef8548c3a423d213dd04537753190b48f820cb83..20e5e5fb048cddbb3df34e06723adfa083083835 100644 (file)
@@ -185,6 +185,30 @@ ufs_get_pm_lvl_to_link_pwr_state(enum ufs_pm_level lvl)
        return ufs_pm_lvl_states[lvl].link_state;
 }
 
+static struct ufs_dev_fix ufs_fixups[] = {
+       /* UFS cards deviations table */
+       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
+               UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
+       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ),
+       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
+               UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS),
+       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
+               UFS_DEVICE_NO_FASTAUTO),
+       UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
+               UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE),
+       UFS_FIX(UFS_VENDOR_TOSHIBA, UFS_ANY_MODEL,
+               UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
+       UFS_FIX(UFS_VENDOR_TOSHIBA, "THGLF2G9C8KBADG",
+               UFS_DEVICE_QUIRK_PA_TACTIVATE),
+       UFS_FIX(UFS_VENDOR_TOSHIBA, "THGLF2G9D8KBADG",
+               UFS_DEVICE_QUIRK_PA_TACTIVATE),
+       UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ),
+       UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL,
+               UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME),
+
+       END_FIX
+};
+
 static void ufshcd_tmc_handler(struct ufs_hba *hba);
 static void ufshcd_async_scan(void *data, async_cookie_t cookie);
 static int ufshcd_reset_and_restore(struct ufs_hba *hba);
@@ -288,10 +312,24 @@ int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask,
  */
 static inline u32 ufshcd_get_intr_mask(struct ufs_hba *hba)
 {
-       if (hba->ufs_version == UFSHCI_VERSION_10)
-               return INTERRUPT_MASK_ALL_VER_10;
-       else
-               return INTERRUPT_MASK_ALL_VER_11;
+       u32 intr_mask = 0;
+
+       switch (hba->ufs_version) {
+       case UFSHCI_VERSION_10:
+               intr_mask = INTERRUPT_MASK_ALL_VER_10;
+               break;
+       /* allow fall through */
+       case UFSHCI_VERSION_11:
+       case UFSHCI_VERSION_20:
+               intr_mask = INTERRUPT_MASK_ALL_VER_11;
+               break;
+       /* allow fall through */
+       case UFSHCI_VERSION_21:
+       default:
+               intr_mask = INTERRUPT_MASK_ALL_VER_21;
+       }
+
+       return intr_mask;
 }
 
 /**
@@ -892,7 +930,7 @@ static void ufshcd_clk_scaling_update_busy(struct ufs_hba *hba)
        if (!hba->outstanding_reqs && scaling->is_busy_started) {
                scaling->tot_busy_t += ktime_to_us(ktime_sub(ktime_get(),
                                        scaling->busy_start_t));
-               scaling->busy_start_t = ktime_set(0, 0);
+               scaling->busy_start_t = 0;
                scaling->is_busy_started = false;
        }
 }
@@ -5199,6 +5237,8 @@ static void ufshcd_tune_unipro_params(struct ufs_hba *hba)
 
        if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE)
                ufshcd_quirk_tune_host_pa_tactivate(hba);
+
+       ufshcd_vops_apply_dev_quirks(hba);
 }
 
 /**
@@ -6621,7 +6661,7 @@ start_window:
                scaling->busy_start_t = ktime_get();
                scaling->is_busy_started = true;
        } else {
-               scaling->busy_start_t = ktime_set(0, 0);
+               scaling->busy_start_t = 0;
                scaling->is_busy_started = false;
        }
        spin_unlock_irqrestore(hba->host->host_lock, flags);
@@ -6667,6 +6707,13 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
        /* Get UFS version supported by the controller */
        hba->ufs_version = ufshcd_get_ufs_version(hba);
 
+       if ((hba->ufs_version != UFSHCI_VERSION_10) &&
+           (hba->ufs_version != UFSHCI_VERSION_11) &&
+           (hba->ufs_version != UFSHCI_VERSION_20) &&
+           (hba->ufs_version != UFSHCI_VERSION_21))
+               dev_err(hba->dev, "invalid UFS version 0x%x\n",
+                       hba->ufs_version);
+
        /* Get Interrupt bit mask per version */
        hba->intr_mask = ufshcd_get_intr_mask(hba);
 
index 7d9ff22acfeaf78c29c1ed4e3d95144d2fa18d2c..08cd26ed238270a3f6bfb797137f4962bfe04312 100644 (file)
@@ -266,7 +266,7 @@ struct ufs_pwr_mode_info {
  * @setup_task_mgmt: called before any task management request is issued
  *                  to set some things
  * @hibern8_notify: called around hibern8 enter/exit
- *                 to configure some things
+ * @apply_dev_quirks: called to apply device specific quirks
  * @suspend: called during host controller PM callback
  * @resume: called during host controller PM callback
  * @dbg_register_dump: used to dump controller debug information
@@ -293,7 +293,8 @@ struct ufs_hba_variant_ops {
        void    (*setup_xfer_req)(struct ufs_hba *, int, bool);
        void    (*setup_task_mgmt)(struct ufs_hba *, int, u8);
        void    (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme,
-                                      enum ufs_notify_change_status);
+                                       enum ufs_notify_change_status);
+       int     (*apply_dev_quirks)(struct ufs_hba *);
        int     (*suspend)(struct ufs_hba *, enum ufs_pm_op);
        int     (*resume)(struct ufs_hba *, enum ufs_pm_op);
        void    (*dbg_register_dump)(struct ufs_hba *hba);
@@ -839,6 +840,13 @@ static inline void ufshcd_vops_hibern8_notify(struct ufs_hba *hba,
                return hba->vops->hibern8_notify(hba, cmd, status);
 }
 
+static inline int ufshcd_vops_apply_dev_quirks(struct ufs_hba *hba)
+{
+       if (hba->vops && hba->vops->apply_dev_quirks)
+               return hba->vops->apply_dev_quirks(hba);
+       return 0;
+}
+
 static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op)
 {
        if (hba->vops && hba->vops->suspend)
index 5d978867be57199beac282369eae799599a1ea9f..8c5190e2e1c928407e8aac111b67758fff9bc191 100644 (file)
@@ -72,6 +72,10 @@ enum {
        REG_UIC_COMMAND_ARG_1                   = 0x94,
        REG_UIC_COMMAND_ARG_2                   = 0x98,
        REG_UIC_COMMAND_ARG_3                   = 0x9C,
+       REG_UFS_CCAP                            = 0x100,
+       REG_UFS_CRYPTOCAP                       = 0x104,
+
+       UFSHCI_CRYPTO_REG_SPACE_SIZE            = 0x400,
 };
 
 /* Controller capability masks */
@@ -275,6 +279,9 @@ enum {
 
        /* Interrupt disable mask for UFSHCI v1.1 */
        INTERRUPT_MASK_ALL_VER_11       = 0x31FFF,
+
+       /* Interrupt disable mask for UFSHCI v2.1 */
+       INTERRUPT_MASK_ALL_VER_21       = 0x71FFF,
 };
 
 /*
index 6b9cf06e8df2b91824294b4bc9ee2e5870191ff4..427e2198bb9e85b8a11693fd7fb1495f2799aa7e 100644 (file)
@@ -967,48 +967,38 @@ cfs_cpt_table_create_pattern(char *pattern)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-static int
-cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
-{
-       unsigned int cpu = (unsigned long)hcpu;
-       bool warn;
-
-       switch (action) {
-       case CPU_DEAD:
-       case CPU_DEAD_FROZEN:
-       case CPU_ONLINE:
-       case CPU_ONLINE_FROZEN:
-               spin_lock(&cpt_data.cpt_lock);
-               cpt_data.cpt_version++;
-               spin_unlock(&cpt_data.cpt_lock);
-               /* Fall through */
-       default:
-               if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) {
-                       CDEBUG(D_INFO, "CPU changed [cpu %u action %lx]\n",
-                              cpu, action);
-                       break;
-               }
+static enum cpuhp_state lustre_cpu_online;
 
-               mutex_lock(&cpt_data.cpt_mutex);
-               /* if all HTs in a core are offline, it may break affinity */
-               cpumask_copy(cpt_data.cpt_cpumask,
-                            topology_sibling_cpumask(cpu));
-               warn = cpumask_any_and(cpt_data.cpt_cpumask,
-                                      cpu_online_mask) >= nr_cpu_ids;
-               mutex_unlock(&cpt_data.cpt_mutex);
-               CDEBUG(warn ? D_WARNING : D_INFO,
-                      "Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u action: %lx]\n",
-                      cpu, action);
-       }
+static void cfs_cpu_incr_cpt_version(void)
+{
+       spin_lock(&cpt_data.cpt_lock);
+       cpt_data.cpt_version++;
+       spin_unlock(&cpt_data.cpt_lock);
+}
 
-       return NOTIFY_OK;
+static int cfs_cpu_online(unsigned int cpu)
+{
+       cfs_cpu_incr_cpt_version();
+       return 0;
 }
 
-static struct notifier_block cfs_cpu_notifier = {
-       .notifier_call  = cfs_cpu_notify,
-       .priority       = 0
-};
+static int cfs_cpu_dead(unsigned int cpu)
+{
+       bool warn;
+
+       cfs_cpu_incr_cpt_version();
 
+       mutex_lock(&cpt_data.cpt_mutex);
+       /* if all HTs in a core are offline, it may break affinity */
+       cpumask_copy(cpt_data.cpt_cpumask, topology_sibling_cpumask(cpu));
+       warn = cpumask_any_and(cpt_data.cpt_cpumask,
+                              cpu_online_mask) >= nr_cpu_ids;
+       mutex_unlock(&cpt_data.cpt_mutex);
+       CDEBUG(warn ? D_WARNING : D_INFO,
+              "Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u]\n",
+              cpu);
+       return 0;
+}
 #endif
 
 void
@@ -1018,7 +1008,9 @@ cfs_cpu_fini(void)
                cfs_cpt_table_free(cfs_cpt_table);
 
 #ifdef CONFIG_HOTPLUG_CPU
-       unregister_hotcpu_notifier(&cfs_cpu_notifier);
+       if (lustre_cpu_online > 0)
+               cpuhp_remove_state_nocalls(lustre_cpu_online);
+       cpuhp_remove_state_nocalls(CPUHP_LUSTRE_CFS_DEAD);
 #endif
        if (cpt_data.cpt_cpumask)
                LIBCFS_FREE(cpt_data.cpt_cpumask, cpumask_size());
@@ -1027,6 +1019,8 @@ cfs_cpu_fini(void)
 int
 cfs_cpu_init(void)
 {
+       int ret = 0;
+
        LASSERT(!cfs_cpt_table);
 
        memset(&cpt_data, 0, sizeof(cpt_data));
@@ -1041,8 +1035,19 @@ cfs_cpu_init(void)
        mutex_init(&cpt_data.cpt_mutex);
 
 #ifdef CONFIG_HOTPLUG_CPU
-       register_hotcpu_notifier(&cfs_cpu_notifier);
+       ret = cpuhp_setup_state_nocalls(CPUHP_LUSTRE_CFS_DEAD,
+                                       "staging/lustre/cfe:dead", NULL,
+                                       cfs_cpu_dead);
+       if (ret < 0)
+               goto failed;
+       ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+                                       "staging/lustre/cfe:online",
+                                       cfs_cpu_online, NULL);
+       if (ret < 0)
+               goto failed;
+       lustre_cpu_online = ret;
 #endif
+       ret = -EINVAL;
 
        if (*cpu_pattern) {
                cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern);
@@ -1075,7 +1080,7 @@ cfs_cpu_init(void)
 
  failed:
        cfs_cpu_fini();
-       return -1;
+       return ret;
 }
 
 #endif
index 8130dfe897451268adcea02c420d3aa61c9809aa..4971aa54756a965ccc99edc63946fee11c13d3e9 100644 (file)
@@ -770,6 +770,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
                        /* Initialize the device private structure. */
                        struct octeon_ethernet *priv = netdev_priv(dev);
 
+                       SET_NETDEV_DEV(dev, &pdev->dev);
                        dev->netdev_ops = &cvm_oct_pow_netdev_ops;
                        priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
                        priv->port = CVMX_PIP_NUM_INPUT_PORTS;
@@ -816,6 +817,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
                        }
 
                        /* Initialize the device private structure. */
+                       SET_NETDEV_DEV(dev, &pdev->dev);
                        priv = netdev_priv(dev);
                        priv->netdev = dev;
                        priv->of_node = cvm_oct_node_for_port(pip, interface,
index dfbb974927f289095cccedb06d0d3db73dbfbdee..dea16bb8c46a35b14604472fdf84a795d8fe3b51 100644 (file)
@@ -127,7 +127,7 @@ static struct serial_state rs_table[1];
 
 #define NR_PORTS ARRAY_SIZE(rs_table)
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define serial_isroot()        (capable(CAP_SYS_ADMIN))
 
index ce864875330e4b0d89c7c6cb2e7207ddab37ff57..9b5c0fb216b58ac86b1f6fc3acca2e5f9aa53fe1 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/slab.h>
 #include <linux/serial_core.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "hvc_console.h"
 
index 3c4d7c2b4ade876a06a7bd5939638302178cf39f..7823d6d998cfd8ca70ab32eb2f51f43c34ef9f3c 100644 (file)
@@ -81,7 +81,7 @@
 #include <linux/tty_flip.h>
 #include <asm/hvconsole.h>
 #include <asm/hvcserver.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/vio.h>
 
 /*
index 96ce6bd1cc6f699260b5b9613487d352cab57c08..2e578d6433af95a0fe6f757b6cbdb7546d5a13d7 100644 (file)
@@ -46,7 +46,7 @@
 #include <asm/hvcall.h>
 #include <asm/hvconsole.h>
 #include <asm/prom.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/vio.h>
 #include <asm/param.h>
 #include <asm/hvsi.h>
index 60d37b225589c25a509591f3076af353a19c752f..4caf0c3b1f99569935a221ee92a383b3697aca58 100644 (file)
@@ -47,7 +47,7 @@
 #include <linux/ratelimit.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "moxa.h"
 
index 69294ae154be0f17ae0e56c39d6fa048077b3c9c..7b8f383fb090ca8836e0fbc58fff80c190cb516b 100644 (file)
@@ -43,7 +43,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "mxser.h"
 
index a7fa016f31ebff79260236e12163d3612549200f..eb278832f5ce52c880f76a8eb9baa5e9e68cf447 100644 (file)
 #include <linux/bitops.h>
 
 #include <asm/termios.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * Buffers for individual HDLC frames
index 345111467b85026ead297b67f27a70cbf67a867d..305b6490d40532e5f10beceac5410817783c016e 100644 (file)
@@ -65,7 +65,7 @@
 #include <linux/n_r3964.h>
 #include <linux/poll.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*#define DEBUG_QUEUE*/
 
index c60a8d5e40201c535ac70a7ccfae67b813a9b790..d83783cfbade63bfb945b2d1f7d3afdd0f9c7149 100644 (file)
@@ -53,7 +53,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "icom.h"
 
index d0847375ea64891e44de5aa44505e43aa62c6b86..9939c3d9912b3563d107e3cd4439212e291377c3 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/mutex.h>
 
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * This is used to lock changes in serial line configuration.
index 415885c56435c0450149277b1e66f959f0def47e..657eed82eeb372d96e5f480bae3eb7c92dee06fa 100644 (file)
 #define PUT_USER(error,value,addr) error = put_user(value,addr)
 #define COPY_TO_USER(error,dest,src,size) error = copy_to_user(dest,src,size) ? -EFAULT : 0
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define RCLRVALUE 0xffff
 
index 8267bcf2405ed5734af331a3437b8b8986303a1f..31885f20fc1583178f9d3108bce20009eca99cb8 100644 (file)
@@ -77,7 +77,7 @@
 #include <asm/irq.h>
 #include <asm/dma.h>
 #include <asm/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINK_GT_MODULE))
 #define SYNCLINK_GENERIC_HDLC 1
index d66620f7eaa3f1e94adcdf6310d730eed57d3d05..51e8846cd68fce28f0544c2f16424560dfaf787b 100644 (file)
@@ -79,7 +79,7 @@
 #define PUT_USER(error,value,addr) error = put_user(value,addr)
 #define COPY_TO_USER(error,dest,src,size) error = copy_to_user(dest,src,size) ? -EFAULT : 0
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static MGSL_PARAMS default_params = {
        MGSL_MODE_HDLC,                 /* unsigned long mode */
index bf36ac9aee41cdb7aa1172e65c55d5bd5e20beda..f27fc0f14c11f2a0858a50094f3bd0b6e47aae8d 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/compat.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #undef TTY_DEBUG_WAIT_UNTIL_SENT
 
index 71e81406ef714033290e73ba472dfbae19b75e46..1f6e17fc3fb041f91b4d06cbe6a64bf3aa206be4 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/tty.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/console.h>
 #include <linux/consolemap.h>
 #include <linux/vt_kern.h>
index 368ce1803e8f229e3cfc0be9ddd405d52b34e6f1..36e1b8c7680f1d8fc5a64ba16e2fc52a0a379b40 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/slab.h>
 #include <linux/types.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/kbd_kern.h>
 #include <linux/vt_kern.h>
index 14a2b5f11bcab9739ea6bc23c5bb4134f1b37f1c..56dcff6059d3db965343739eea731921994b6073 100644 (file)
@@ -39,7 +39,7 @@
 #include <linux/slab.h>
 #include <linux/notifier.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
 
index f62c598810ff4ca64ec2df66b769ea0b4e6541e0..a56edf2d58eb267570222a5d741760d3e118f137 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/timex.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/kbd_kern.h>
 #include <linux/vt_kern.h>
index 4dec9df8764b9abc3544b81e4e06da1d7aec5a8f..5a59da0dc98a1798c36bce8c9f5c754632eb121d 100644 (file)
@@ -64,7 +64,7 @@
 
 #include "usbatm.h"
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/crc32.h>
 #include <linux/errno.h>
 #include <linux/init.h>
index de8e22ec39024edf0cf7d5d04e5ab55547e2658e..93e24ce61a3ac6c3701ed117df2770287f63572a 100644 (file)
@@ -234,8 +234,8 @@ static void ci_otg_add_timer(struct ci_hdrc *ci, enum otg_fsm_timer t)
                                ktime_set(timer_sec, timer_nsec));
        ci->enabled_otg_timer_bits |= (1 << t);
        if ((ci->next_otg_timer == NUM_OTG_FSM_TIMERS) ||
-                       (ci->hr_timeouts[ci->next_otg_timer].tv64 >
-                                               ci->hr_timeouts[t].tv64)) {
+                       (ci->hr_timeouts[ci->next_otg_timer] >
+                                               ci->hr_timeouts[t])) {
                        ci->next_otg_timer = t;
                        hrtimer_start_range_ns(&ci->otg_fsm_hrtimer,
                                        ci->hr_timeouts[t], NSEC_PER_MSEC,
@@ -269,8 +269,8 @@ static void ci_otg_del_timer(struct ci_hdrc *ci, enum otg_fsm_timer t)
                        for_each_set_bit(cur_timer, &enabled_timer_bits,
                                                        NUM_OTG_FSM_TIMERS) {
                                if ((next_timer == NUM_OTG_FSM_TIMERS) ||
-                                       (ci->hr_timeouts[next_timer].tv64 <
-                                       ci->hr_timeouts[cur_timer].tv64))
+                                       (ci->hr_timeouts[next_timer] <
+                                        ci->hr_timeouts[cur_timer]))
                                        next_timer = cur_timer;
                        }
                }
@@ -397,14 +397,14 @@ static enum hrtimer_restart ci_otg_hrtimer_func(struct hrtimer *t)
 
        now = ktime_get();
        for_each_set_bit(cur_timer, &enabled_timer_bits, NUM_OTG_FSM_TIMERS) {
-               if (now.tv64 >= ci->hr_timeouts[cur_timer].tv64) {
+               if (now >= ci->hr_timeouts[cur_timer]) {
                        ci->enabled_otg_timer_bits &= ~(1 << cur_timer);
                        if (otg_timer_handlers[cur_timer])
                                ret = otg_timer_handlers[cur_timer](ci);
                } else {
                        if ((next_timer == NUM_OTG_FSM_TIMERS) ||
-                               (ci->hr_timeouts[cur_timer].tv64 <
-                                       ci->hr_timeouts[next_timer].tv64))
+                               (ci->hr_timeouts[cur_timer] <
+                                       ci->hr_timeouts[next_timer]))
                                next_timer = cur_timer;
                }
        }
index 0aa9e7d697a5df8a8d25194c377498ddce049d87..25dbd8c7aec73345d357c2a75ff0cde26c918217 100644 (file)
@@ -239,6 +239,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
        if (ifp->desc.bNumEndpoints >= num_ep)
                goto skip_to_next_endpoint_or_interface_descriptor;
 
+       /* Check for duplicate endpoint addresses */
+       for (i = 0; i < ifp->desc.bNumEndpoints; ++i) {
+               if (ifp->endpoint[i].desc.bEndpointAddress ==
+                   d->bEndpointAddress) {
+                       dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n",
+                           cfgno, inum, asnum, d->bEndpointAddress);
+                       goto skip_to_next_endpoint_or_interface_descriptor;
+               }
+       }
+
        endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
        ++ifp->desc.bNumEndpoints;
 
index 143454ea385b72ff51381ef014a71a08550798c5..a56c75e09786d5fa1e064a8e56e58e4095e4d716 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/random.h>
 #include <linux/pm_qos.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 #include "hub.h"
@@ -103,8 +103,7 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem);
 
 static void hub_release(struct kref *kref);
 static int usb_reset_and_verify_device(struct usb_device *udev);
-static void hub_usb3_port_prepare_disable(struct usb_hub *hub,
-                                         struct usb_port *port_dev);
+static int hub_port_disable(struct usb_hub *hub, int port1, int set_state);
 
 static inline char *portspeed(struct usb_hub *hub, int portstatus)
 {
@@ -902,34 +901,6 @@ static int hub_set_port_link_state(struct usb_hub *hub, int port1,
                        USB_PORT_FEAT_LINK_STATE);
 }
 
-/*
- * USB-3 does not have a similar link state as USB-2 that will avoid negotiating
- * a connection with a plugged-in cable but will signal the host when the cable
- * is unplugged. Disable remote wake and set link state to U3 for USB-3 devices
- */
-static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
-{
-       struct usb_port *port_dev = hub->ports[port1 - 1];
-       struct usb_device *hdev = hub->hdev;
-       int ret = 0;
-
-       if (!hub->error) {
-               if (hub_is_superspeed(hub->hdev)) {
-                       hub_usb3_port_prepare_disable(hub, port_dev);
-                       ret = hub_set_port_link_state(hub, port_dev->portnum,
-                                                     USB_SS_PORT_LS_U3);
-               } else {
-                       ret = usb_clear_port_feature(hdev, port1,
-                                       USB_PORT_FEAT_ENABLE);
-               }
-       }
-       if (port_dev->child && set_state)
-               usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED);
-       if (ret && ret != -ENODEV)
-               dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret);
-       return ret;
-}
-
 /*
  * Disable a port and mark a logical connect-change event, so that some
  * time later hub_wq will disconnect() any existing usb_device on the port
@@ -4162,6 +4133,34 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
 
 #endif /* CONFIG_PM */
 
+/*
+ * USB-3 does not have a similar link state as USB-2 that will avoid negotiating
+ * a connection with a plugged-in cable but will signal the host when the cable
+ * is unplugged. Disable remote wake and set link state to U3 for USB-3 devices
+ */
+static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
+{
+       struct usb_port *port_dev = hub->ports[port1 - 1];
+       struct usb_device *hdev = hub->hdev;
+       int ret = 0;
+
+       if (!hub->error) {
+               if (hub_is_superspeed(hub->hdev)) {
+                       hub_usb3_port_prepare_disable(hub, port_dev);
+                       ret = hub_set_port_link_state(hub, port_dev->portnum,
+                                                     USB_SS_PORT_LS_U3);
+               } else {
+                       ret = usb_clear_port_feature(hdev, port1,
+                                       USB_PORT_FEAT_ENABLE);
+               }
+       }
+       if (port_dev->child && set_state)
+               usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED);
+       if (ret && ret != -ENODEV)
+               dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret);
+       return ret;
+}
+
 
 /* USB 2.0 spec, 7.1.7.3 / fig 7-29:
  *
index b95930f20d906dfc02d4d6db7dbe954e475d11cc..c55db4aa54d677c77fb2a0c9bcff7d38ac7d1b9e 100644 (file)
@@ -3753,7 +3753,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,
                hs_ep->desc_list = dma_alloc_coherent(hsotg->dev,
                        MAX_DMA_DESC_NUM_GENERIC *
                        sizeof(struct dwc2_dma_desc),
-                       &hs_ep->desc_list_dma, GFP_KERNEL);
+                       &hs_ep->desc_list_dma, GFP_ATOMIC);
                if (!hs_ep->desc_list) {
                        ret = -ENOMEM;
                        goto error2;
index a786256535b6a77392018aa93f78f785daf8a1b2..11fe68a4627bd315c8e82dbd3398b2dfde9bde8c 100644 (file)
@@ -247,8 +247,6 @@ MODULE_DEVICE_TABLE(of, dwc2_of_match_table);
 static void dwc2_get_device_property(struct dwc2_hsotg *hsotg,
                                     char *property, u8 size, u64 *value)
 {
-       u8 val8;
-       u16 val16;
        u32 val32;
 
        switch (size) {
@@ -256,17 +254,7 @@ static void dwc2_get_device_property(struct dwc2_hsotg *hsotg,
                *value = device_property_read_bool(hsotg->dev, property);
                break;
        case 1:
-               if (device_property_read_u8(hsotg->dev, property, &val8))
-                       return;
-
-               *value = val8;
-               break;
        case 2:
-               if (device_property_read_u16(hsotg->dev, property, &val16))
-                       return;
-
-               *value = val16;
-               break;
        case 4:
                if (device_property_read_u32(hsotg->dev, property, &val32))
                        return;
@@ -1100,13 +1088,13 @@ static void dwc2_set_gadget_dma(struct dwc2_hsotg *hsotg)
        /* Buffer DMA */
        dwc2_set_param_bool(hsotg, &p->g_dma,
                            false, "gadget-dma",
-                           true, false,
+                           dma_capable, false,
                            dma_capable);
 
        /* DMA Descriptor */
        dwc2_set_param_bool(hsotg, &p->g_dma_desc, false,
                            "gadget-dma-desc",
-                           p->g_dma, false,
+                           !!hw->dma_desc_enable, false,
                            !!hw->dma_desc_enable);
 }
 
@@ -1130,8 +1118,14 @@ static void dwc2_set_parameters(struct dwc2_hsotg *hsotg,
 
                dwc2_set_param_bool(hsotg, &p->host_dma,
                                    false, "host-dma",
-                                   true, false,
+                                   dma_capable, false,
                                    dma_capable);
+               dwc2_set_param_host_rx_fifo_size(hsotg,
+                               params->host_rx_fifo_size);
+               dwc2_set_param_host_nperio_tx_fifo_size(hsotg,
+                               params->host_nperio_tx_fifo_size);
+               dwc2_set_param_host_perio_tx_fifo_size(hsotg,
+                               params->host_perio_tx_fifo_size);
        }
        dwc2_set_param_dma_desc_enable(hsotg, params->dma_desc_enable);
        dwc2_set_param_dma_desc_fs_enable(hsotg, params->dma_desc_fs_enable);
@@ -1140,12 +1134,6 @@ static void dwc2_set_parameters(struct dwc2_hsotg *hsotg,
                        params->host_support_fs_ls_low_power);
        dwc2_set_param_enable_dynamic_fifo(hsotg,
                        params->enable_dynamic_fifo);
-       dwc2_set_param_host_rx_fifo_size(hsotg,
-                       params->host_rx_fifo_size);
-       dwc2_set_param_host_nperio_tx_fifo_size(hsotg,
-                       params->host_nperio_tx_fifo_size);
-       dwc2_set_param_host_perio_tx_fifo_size(hsotg,
-                       params->host_perio_tx_fifo_size);
        dwc2_set_param_max_transfer_size(hsotg,
                        params->max_transfer_size);
        dwc2_set_param_max_packet_count(hsotg,
index de5a8570be04213cd3fd39c774662c9173907e34..14b760209680920e65e92fbbb75a14c3bd4a3b18 100644 (file)
@@ -45,9 +45,7 @@
 #define DWC3_XHCI_RESOURCES_NUM        2
 
 #define DWC3_SCRATCHBUF_SIZE   4096    /* each buffer is assumed to be 4KiB */
-#define DWC3_EVENT_SIZE                4       /* bytes */
-#define DWC3_EVENT_MAX_NUM     64      /* 2 events/endpoint */
-#define DWC3_EVENT_BUFFERS_SIZE        (DWC3_EVENT_SIZE * DWC3_EVENT_MAX_NUM)
+#define DWC3_EVENT_BUFFERS_SIZE        4096
 #define DWC3_EVENT_TYPE_MASK   0xfe
 
 #define DWC3_EVENT_TYPE_DEV    0
 #define DWC3_DCFG_SUPERSPEED_PLUS (5 << 0)  /* DWC_usb31 only */
 #define DWC3_DCFG_SUPERSPEED   (4 << 0)
 #define DWC3_DCFG_HIGHSPEED    (0 << 0)
-#define DWC3_DCFG_FULLSPEED2   (1 << 0)
+#define DWC3_DCFG_FULLSPEED    (1 << 0)
 #define DWC3_DCFG_LOWSPEED     (2 << 0)
-#define DWC3_DCFG_FULLSPEED1   (3 << 0)
 
 #define DWC3_DCFG_NUMP_SHIFT   17
 #define DWC3_DCFG_NUMP(n)      (((n) >> DWC3_DCFG_NUMP_SHIFT) & 0x1f)
 #define DWC3_DSTS_SUPERSPEED_PLUS      (5 << 0) /* DWC_usb31 only */
 #define DWC3_DSTS_SUPERSPEED           (4 << 0)
 #define DWC3_DSTS_HIGHSPEED            (0 << 0)
-#define DWC3_DSTS_FULLSPEED2           (1 << 0)
+#define DWC3_DSTS_FULLSPEED            (1 << 0)
 #define DWC3_DSTS_LOWSPEED             (2 << 0)
-#define DWC3_DSTS_FULLSPEED1           (3 << 0)
 
 /* Device Generic Command Register */
 #define DWC3_DGCMD_SET_LMP             0x01
index 29e80cc9b634aab72f59e73c71667dfef9f86a45..eb1b9cb3f9d1df29bb4c6d8fe2b8d4b3ebf7897b 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
+#include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/dwc3-omap.h>
@@ -510,7 +511,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
 
        /* check the DMA Status */
        reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG);
-
+       irq_set_status_flags(omap->irq, IRQ_NOAUTOEN);
        ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt,
                                        dwc3_omap_interrupt_thread, IRQF_SHARED,
                                        "dwc3-omap", omap);
@@ -531,7 +532,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
        }
 
        dwc3_omap_enable_irqs(omap);
-
+       enable_irq(omap->irq);
        return 0;
 
 err2:
@@ -552,6 +553,7 @@ static int dwc3_omap_remove(struct platform_device *pdev)
        extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
        extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
        dwc3_omap_disable_irqs(omap);
+       disable_irq(omap->irq);
        of_platform_depopulate(omap->dev);
        pm_runtime_put_sync(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
index 2b73339f286ba109d74e465aa55189bf84463398..cce0a220b6b0437f23102da3fa56f4f7373f9082 100644 (file)
@@ -38,6 +38,7 @@
 #define PCI_DEVICE_ID_INTEL_BXT_M              0x1aaa
 #define PCI_DEVICE_ID_INTEL_APL                        0x5aaa
 #define PCI_DEVICE_ID_INTEL_KBP                        0xa2b0
+#define PCI_DEVICE_ID_INTEL_GLK                        0x31aa
 
 #define PCI_INTEL_BXT_DSM_UUID         "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
 #define PCI_INTEL_BXT_FUNC_PMU_PWR     4
@@ -73,16 +74,6 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
 {
        struct platform_device          *dwc3 = dwc->dwc3;
        struct pci_dev                  *pdev = dwc->pci;
-       int                             ret;
-
-       struct property_entry sysdev_property[] = {
-               PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
-               { },
-       };
-
-       ret = platform_device_add_properties(dwc3, sysdev_property);
-       if (ret)
-               return ret;
 
        if (pdev->vendor == PCI_VENDOR_ID_AMD &&
            pdev->device == PCI_DEVICE_ID_AMD_NL_USB) {
@@ -105,6 +96,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
                        PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"),
                        PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"),
                        PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
+                       PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
                        { },
                };
 
@@ -115,7 +107,8 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
                int ret;
 
                struct property_entry properties[] = {
-                       PROPERTY_ENTRY_STRING("dr-mode", "peripheral"),
+                       PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
+                       PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
                        { }
                };
 
@@ -167,6 +160,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
                        PROPERTY_ENTRY_BOOL("snps,usb3_lpm_capable"),
                        PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
                        PROPERTY_ENTRY_BOOL("snps,dis_enblslpm_quirk"),
+                       PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
                        { },
                };
 
@@ -274,6 +268,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), },
        { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
        {  }    /* Terminating Entry */
 };
index 4878d187c7d4a4b3b3851c29624ff04bb32df020..9bb1f8526f3ed4d5413e008b2ec24b4565f3f619 100644 (file)
@@ -39,18 +39,13 @@ static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep);
 static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
                struct dwc3_ep *dep, struct dwc3_request *req);
 
-static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
-               u32 len, u32 type, bool chain)
+static void dwc3_ep0_prepare_one_trb(struct dwc3 *dwc, u8 epnum,
+               dma_addr_t buf_dma, u32 len, u32 type, bool chain)
 {
-       struct dwc3_gadget_ep_cmd_params params;
        struct dwc3_trb                 *trb;
        struct dwc3_ep                  *dep;
 
-       int                             ret;
-
        dep = dwc->eps[epnum];
-       if (dep->flags & DWC3_EP_BUSY)
-               return 0;
 
        trb = &dwc->ep0_trb[dep->trb_enqueue];
 
@@ -71,15 +66,23 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
                trb->ctrl |= (DWC3_TRB_CTRL_IOC
                                | DWC3_TRB_CTRL_LST);
 
-       if (chain)
+       trace_dwc3_prepare_trb(dep, trb);
+}
+
+static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum)
+{
+       struct dwc3_gadget_ep_cmd_params params;
+       struct dwc3_ep                  *dep;
+       int                             ret;
+
+       dep = dwc->eps[epnum];
+       if (dep->flags & DWC3_EP_BUSY)
                return 0;
 
        memset(&params, 0, sizeof(params));
        params.param0 = upper_32_bits(dwc->ep0_trb_addr);
        params.param1 = lower_32_bits(dwc->ep0_trb_addr);
 
-       trace_dwc3_prepare_trb(dep, trb);
-
        ret = dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_STARTTRANSFER, &params);
        if (ret < 0)
                return ret;
@@ -280,8 +283,9 @@ void dwc3_ep0_out_start(struct dwc3 *dwc)
 
        complete(&dwc->ep0_in_setup);
 
-       ret = dwc3_ep0_start_trans(dwc, 0, dwc->ctrl_req_addr, 8,
+       dwc3_ep0_prepare_one_trb(dwc, 0, dwc->ctrl_req_addr, 8,
                        DWC3_TRBCTL_CONTROL_SETUP, false);
+       ret = dwc3_ep0_start_trans(dwc, 0);
        WARN_ON(ret < 0);
 }
 
@@ -912,9 +916,9 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
 
                        dwc->ep0_next_event = DWC3_EP0_COMPLETE;
 
-                       ret = dwc3_ep0_start_trans(dwc, epnum,
-                                       dwc->ctrl_req_addr, 0,
-                                       DWC3_TRBCTL_CONTROL_DATA, false);
+                       dwc3_ep0_prepare_one_trb(dwc, epnum, dwc->ctrl_req_addr,
+                                       0, DWC3_TRBCTL_CONTROL_DATA, false);
+                       ret = dwc3_ep0_start_trans(dwc, epnum);
                        WARN_ON(ret < 0);
                }
        }
@@ -993,9 +997,10 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
        req->direction = !!dep->number;
 
        if (req->request.length == 0) {
-               ret = dwc3_ep0_start_trans(dwc, dep->number,
+               dwc3_ep0_prepare_one_trb(dwc, dep->number,
                                dwc->ctrl_req_addr, 0,
                                DWC3_TRBCTL_CONTROL_DATA, false);
+               ret = dwc3_ep0_start_trans(dwc, dep->number);
        } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket)
                        && (dep->number == 0)) {
                u32     transfer_size = 0;
@@ -1011,7 +1016,7 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
                if (req->request.length > DWC3_EP0_BOUNCE_SIZE) {
                        transfer_size = ALIGN(req->request.length - maxpacket,
                                              maxpacket);
-                       ret = dwc3_ep0_start_trans(dwc, dep->number,
+                       dwc3_ep0_prepare_one_trb(dwc, dep->number,
                                                   req->request.dma,
                                                   transfer_size,
                                                   DWC3_TRBCTL_CONTROL_DATA,
@@ -1023,18 +1028,20 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
 
                dwc->ep0_bounced = true;
 
-               ret = dwc3_ep0_start_trans(dwc, dep->number,
+               dwc3_ep0_prepare_one_trb(dwc, dep->number,
                                dwc->ep0_bounce_addr, transfer_size,
                                DWC3_TRBCTL_CONTROL_DATA, false);
+               ret = dwc3_ep0_start_trans(dwc, dep->number);
        } else {
                ret = usb_gadget_map_request_by_dev(dwc->sysdev,
                                &req->request, dep->number);
                if (ret)
                        return;
 
-               ret = dwc3_ep0_start_trans(dwc, dep->number, req->request.dma,
+               dwc3_ep0_prepare_one_trb(dwc, dep->number, req->request.dma,
                                req->request.length, DWC3_TRBCTL_CONTROL_DATA,
                                false);
+               ret = dwc3_ep0_start_trans(dwc, dep->number);
        }
 
        WARN_ON(ret < 0);
@@ -1048,8 +1055,9 @@ static int dwc3_ep0_start_control_status(struct dwc3_ep *dep)
        type = dwc->three_stage_setup ? DWC3_TRBCTL_CONTROL_STATUS3
                : DWC3_TRBCTL_CONTROL_STATUS2;
 
-       return dwc3_ep0_start_trans(dwc, dep->number,
+       dwc3_ep0_prepare_one_trb(dwc, dep->number,
                        dwc->ctrl_req_addr, 0, type, false);
+       return dwc3_ep0_start_trans(dwc, dep->number);
 }
 
 static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep)
index efddaf5d11d12639867ce8cb7c9a24ae2c7333c9..204c754cc647072d4caffbe06a4c1a8b869ca51a 100644 (file)
@@ -180,11 +180,11 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
        if (req->request.status == -EINPROGRESS)
                req->request.status = status;
 
-       if (dwc->ep0_bounced && dep->number == 0)
+       if (dwc->ep0_bounced && dep->number <= 1)
                dwc->ep0_bounced = false;
-       else
-               usb_gadget_unmap_request_by_dev(dwc->sysdev,
-                               &req->request, req->direction);
+
+       usb_gadget_unmap_request_by_dev(dwc->sysdev,
+                       &req->request, req->direction);
 
        trace_dwc3_gadget_giveback(req);
 
@@ -1720,7 +1720,7 @@ static int __dwc3_gadget_start(struct dwc3 *dwc)
                        reg |= DWC3_DCFG_LOWSPEED;
                        break;
                case USB_SPEED_FULL:
-                       reg |= DWC3_DCFG_FULLSPEED1;
+                       reg |= DWC3_DCFG_FULLSPEED;
                        break;
                case USB_SPEED_HIGH:
                        reg |= DWC3_DCFG_HIGHSPEED;
@@ -2232,9 +2232,14 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
 
        dep = dwc->eps[epnum];
 
-       if (!(dep->flags & DWC3_EP_ENABLED) &&
-           !(dep->flags & DWC3_EP_END_TRANSFER_PENDING))
-               return;
+       if (!(dep->flags & DWC3_EP_ENABLED)) {
+               if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING))
+                       return;
+
+               /* Handle only EPCMDCMPLT when EP disabled */
+               if (event->endpoint_event != DWC3_DEPEVT_EPCMDCMPLT)
+                       return;
+       }
 
        if (epnum == 0 || epnum == 1) {
                dwc3_ep0_interrupt(dwc, event);
@@ -2531,8 +2536,7 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
                dwc->gadget.ep0->maxpacket = 64;
                dwc->gadget.speed = USB_SPEED_HIGH;
                break;
-       case DWC3_DSTS_FULLSPEED2:
-       case DWC3_DSTS_FULLSPEED1:
+       case DWC3_DSTS_FULLSPEED:
                dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(64);
                dwc->gadget.ep0->maxpacket = 64;
                dwc->gadget.speed = USB_SPEED_FULL;
index 41ab61f9b6e0b24be1dd950afdae9f4f3a179d50..002822d98fda207505581ca75cb47373db81fb78 100644 (file)
@@ -1694,9 +1694,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
                value = min(w_length, (u16) 1);
                break;
 
-       /* function drivers must handle get/set altsetting; if there's
-        * no get() method, we know only altsetting zero works.
-        */
+       /* function drivers must handle get/set altsetting */
        case USB_REQ_SET_INTERFACE:
                if (ctrl->bRequestType != USB_RECIP_INTERFACE)
                        goto unknown;
@@ -1705,7 +1703,13 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
                f = cdev->config->interface[intf];
                if (!f)
                        break;
-               if (w_value && !f->set_alt)
+
+               /*
+                * If there's no get_alt() method, we know only altsetting zero
+                * works. There is no need to check if set_alt() is not NULL
+                * as we check this in usb_add_function().
+                */
+               if (w_value && !f->get_alt)
                        break;
                value = f->set_alt(f, w_index, w_value);
                if (value == USB_GADGET_DELAYED_STATUS) {
index aab3fc1dbb94c44f0287990e89aa98fc8bf3da3a..5e746adc8a2d5416b7e1bcbeb8c41559716599b4 100644 (file)
@@ -2091,8 +2091,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type,
 
        case FFS_STRING:
                /*
-                * Strings are indexed from 1 (0 is magic ;) reserved
-                * for languages list or some such)
+                * Strings are indexed from 1 (0 is reserved
+                * for languages list)
                 */
                if (*valuep > helper->ffs->strings_count)
                        helper->ffs->strings_count = *valuep;
@@ -2252,7 +2252,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type,
 
                if (len < sizeof(*d) ||
                    d->bFirstInterfaceNumber >= ffs->interfaces_count ||
-                   !d->Reserved1)
+                   d->Reserved1)
                        return -EINVAL;
                for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)
                        if (d->Reserved2[i])
@@ -3666,6 +3666,7 @@ static void ffs_closed(struct ffs_data *ffs)
 {
        struct ffs_dev *ffs_obj;
        struct f_fs_opts *opts;
+       struct config_item *ci;
 
        ENTER();
        ffs_dev_lock();
@@ -3689,8 +3690,11 @@ static void ffs_closed(struct ffs_data *ffs)
            || !atomic_read(&opts->func_inst.group.cg_item.ci_kref.refcount))
                goto done;
 
-       unregister_gadget_item(ffs_obj->opts->
-                              func_inst.group.cg_item.ci_parent->ci_parent);
+       ci = opts->func_inst.group.cg_item.ci_parent->ci_parent;
+       ffs_dev_unlock();
+
+       unregister_gadget_item(ci);
+       return;
 done:
        ffs_dev_unlock();
 }
index 3151d2a0fe594b516841ae8c653878ad45899e2e..5f8139b8e601808414407e88a94a53a60892ae55 100644 (file)
@@ -593,7 +593,7 @@ static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
                }
                status = usb_ep_enable(hidg->out_ep);
                if (status < 0) {
-                       ERROR(cdev, "Enable IN endpoint FAILED!\n");
+                       ERROR(cdev, "Enable OUT endpoint FAILED!\n");
                        goto fail;
                }
                hidg->out_ep->driver_data = hidg;
index e8008fa35e1e69c354ba35c510b1019e7a560c44..224717e63a5300970867a663cd030d8cd62068f6 100644 (file)
@@ -1113,8 +1113,7 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port,
                }
 
                /* Delay the timer. */
-               hrtimer_start(&ncm->task_timer,
-                             ktime_set(0, TX_TIMEOUT_NSECS),
+               hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS,
                              HRTIMER_MODE_REL);
 
                /* Add the datagram position entries */
index 10b2576f8b6a9fdd4dbd55847b600a1bf5a1154b..6bde4396927c997b686419cbc4fb15997b0e304f 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/uts.h>
 #include <linux/wait.h>
 #include <linux/compiler.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/poll.h>
@@ -1126,7 +1126,7 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
        /* data and/or status stage for control request */
        } else if (dev->state == STATE_DEV_SETUP) {
 
-               /* IN DATA+STATUS caller makes len <= wLength */
+               len = min_t(size_t, len, dev->setup_wLength);
                if (dev->setup_in) {
                        retval = setup_req (dev->gadget->ep0, dev->req, len);
                        if (retval == 0) {
@@ -1734,10 +1734,12 @@ static struct usb_gadget_driver gadgetfs_driver = {
  * such as configuration notifications.
  */
 
-static int is_valid_config (struct usb_config_descriptor *config)
+static int is_valid_config(struct usb_config_descriptor *config,
+               unsigned int total)
 {
        return config->bDescriptorType == USB_DT_CONFIG
                && config->bLength == USB_DT_CONFIG_SIZE
+               && total >= USB_DT_CONFIG_SIZE
                && config->bConfigurationValue != 0
                && (config->bmAttributes & USB_CONFIG_ATT_ONE) != 0
                && (config->bmAttributes & USB_CONFIG_ATT_WAKEUP) == 0;
@@ -1762,7 +1764,8 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
        }
        spin_unlock_irq(&dev->lock);
 
-       if (len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4))
+       if ((len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4)) ||
+           (len > PAGE_SIZE * 4))
                return -EINVAL;
 
        /* we might need to change message format someday */
@@ -1786,7 +1789,8 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
        /* full or low speed config */
        dev->config = (void *) kbuf;
        total = le16_to_cpu(dev->config->wTotalLength);
-       if (!is_valid_config (dev->config) || total >= length)
+       if (!is_valid_config(dev->config, total) ||
+                       total > length - USB_DT_DEVICE_SIZE)
                goto fail;
        kbuf += total;
        length -= total;
@@ -1795,10 +1799,13 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
        if (kbuf [1] == USB_DT_CONFIG) {
                dev->hs_config = (void *) kbuf;
                total = le16_to_cpu(dev->hs_config->wTotalLength);
-               if (!is_valid_config (dev->hs_config) || total >= length)
+               if (!is_valid_config(dev->hs_config, total) ||
+                               total > length - USB_DT_DEVICE_SIZE)
                        goto fail;
                kbuf += total;
                length -= total;
+       } else {
+               dev->hs_config = NULL;
        }
 
        /* could support multiple configs, using another encoding! */
@@ -1811,7 +1818,6 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
                        || dev->dev->bDescriptorType != USB_DT_DEVICE
                        || dev->dev->bNumConfigurations != 1)
                goto fail;
-       dev->dev->bNumConfigurations = 1;
        dev->dev->bcdUSB = cpu_to_le16 (0x0200);
 
        /* triggers gadgetfs_bind(); then we can enumerate. */
index 9483489080f66230370db44a2326a152a3f3eb47..0402177f93cdde2346586ff95b392256e17f84ce 100644 (file)
@@ -1317,7 +1317,11 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver)
                        if (!ret)
                                break;
                }
-               if (!ret && !udc->driver)
+               if (ret)
+                       ret = -ENODEV;
+               else if (udc->driver)
+                       ret = -EBUSY;
+               else
                        goto found;
        } else {
                list_for_each_entry(udc, &udc_list, list) {
index 02b14e91ae6c5a586417dec05d558dbe1cace35a..c60abe3a68f9cf48c21831d40bc32c4e9390b892 100644 (file)
@@ -330,7 +330,7 @@ static void nuke(struct dummy *dum, struct dummy_ep *ep)
 /* caller must hold lock */
 static void stop_activity(struct dummy *dum)
 {
-       struct dummy_ep *ep;
+       int i;
 
        /* prevent any more requests */
        dum->address = 0;
@@ -338,8 +338,8 @@ static void stop_activity(struct dummy *dum)
        /* The timer is left running so that outstanding URBs can fail */
 
        /* nuke any pending requests first, so driver i/o is quiesced */
-       list_for_each_entry(ep, &dum->gadget.ep_list, ep.ep_list)
-               nuke(dum, ep);
+       for (i = 0; i < DUMMY_ENDPOINTS; ++i)
+               nuke(dum, &dum->ep[i]);
 
        /* driver now does any non-usb quiescing necessary */
 }
index 69f50e6533a6ec68fa3cefeeb43842964dc227f7..3893b5bafd8725a00ec4b32335a83c53fcef33a9 100644 (file)
@@ -88,8 +88,7 @@ static void ehci_enable_event(struct ehci_hcd *ehci, unsigned event,
        ktime_t         *timeout = &ehci->hr_timeouts[event];
 
        if (resched)
-               *timeout = ktime_add(ktime_get(),
-                               ktime_set(0, event_delays_ns[event]));
+               *timeout = ktime_add(ktime_get(), event_delays_ns[event]);
        ehci->enabled_hrtimer_events |= (1 << event);
 
        /* Track only the lowest-numbered pending event */
@@ -425,7 +424,7 @@ static enum hrtimer_restart ehci_hrtimer_func(struct hrtimer *t)
         */
        now = ktime_get();
        for_each_set_bit(e, &events, EHCI_HRTIMER_NUM_EVENTS) {
-               if (now.tv64 >= ehci->hr_timeouts[e].tv64)
+               if (now >= ehci->hr_timeouts[e])
                        event_handlers[e](ehci);
                else
                        ehci_enable_event(ehci, e, false);
index 66efa9a6768776f91407dd3e91b7499560301ac2..9d0b0518290a1d596f7018216bc694d5bbc037b1 100644 (file)
@@ -1080,8 +1080,7 @@ static void fotg210_enable_event(struct fotg210_hcd *fotg210, unsigned event,
        ktime_t *timeout = &fotg210->hr_timeouts[event];
 
        if (resched)
-               *timeout = ktime_add(ktime_get(),
-                               ktime_set(0, event_delays_ns[event]));
+               *timeout = ktime_add(ktime_get(), event_delays_ns[event]);
        fotg210->enabled_hrtimer_events |= (1 << event);
 
        /* Track only the lowest-numbered pending event */
@@ -1381,7 +1380,7 @@ static enum hrtimer_restart fotg210_hrtimer_func(struct hrtimer *t)
         */
        now = ktime_get();
        for_each_set_bit(e, &events, FOTG210_HRTIMER_NUM_EVENTS) {
-               if (now.tv64 >= fotg210->hr_timeouts[e].tv64)
+               if (now >= fotg210->hr_timeouts[e])
                        event_handlers[e](fotg210);
                else
                        fotg210_enable_event(fotg210, e, false);
index be9e6383688111fe8d2c53d3e679758f36fd9873..414e3c376dbbd59587dc3398f4a90872a5aae19c 100644 (file)
@@ -43,7 +43,6 @@ struct at91_usbh_data {
        struct gpio_desc *overcurrent_pin[AT91_MAX_USBH_PORTS];
        u8 ports;                               /* number of ports on root hub */
        u8 overcurrent_supported;
-       u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
        u8 overcurrent_status[AT91_MAX_USBH_PORTS];
        u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
 };
@@ -266,8 +265,7 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int
        if (!valid_port(port))
                return;
 
-       gpiod_set_value(pdata->vbus_pin[port],
-                       pdata->vbus_pin_active_low[port] ^ enable);
+       gpiod_set_value(pdata->vbus_pin[port], enable);
 }
 
 static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
@@ -275,8 +273,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
        if (!valid_port(port))
                return -EINVAL;
 
-       return gpiod_get_value(pdata->vbus_pin[port]) ^
-              pdata->vbus_pin_active_low[port];
+       return gpiod_get_value(pdata->vbus_pin[port]);
 }
 
 /*
@@ -533,18 +530,17 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
                pdata->ports = ports;
 
        at91_for_each_port(i) {
-               pdata->vbus_pin[i] = devm_gpiod_get_optional(&pdev->dev,
-                                                            "atmel,vbus-gpio",
-                                                            GPIOD_IN);
+               if (i >= pdata->ports)
+                       break;
+
+               pdata->vbus_pin[i] =
+                       devm_gpiod_get_index_optional(&pdev->dev, "atmel,vbus",
+                                                     i, GPIOD_OUT_HIGH);
                if (IS_ERR(pdata->vbus_pin[i])) {
                        err = PTR_ERR(pdata->vbus_pin[i]);
                        dev_err(&pdev->dev, "unable to claim gpio \"vbus\": %d\n", err);
                        continue;
                }
-
-               pdata->vbus_pin_active_low[i] = gpiod_get_value(pdata->vbus_pin[i]);
-
-               ohci_at91_usb_set_power(pdata, i, 1);
        }
 
        at91_for_each_port(i) {
@@ -552,8 +548,8 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
                        break;
 
                pdata->overcurrent_pin[i] =
-                       devm_gpiod_get_optional(&pdev->dev,
-                                               "atmel,oc-gpio", GPIOD_IN);
+                       devm_gpiod_get_index_optional(&pdev->dev, "atmel,oc",
+                                                     i, GPIOD_IN);
                if (IS_ERR(pdata->overcurrent_pin[i])) {
                        err = PTR_ERR(pdata->overcurrent_pin[i]);
                        dev_err(&pdev->dev, "unable to claim gpio \"overcurrent\": %d\n", err);
index 5d3d914ab4fb441f78ab3e5fae799453fb2ec014..683098afa93ea150ad9888875b6e11ad2d5d33be 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/bitops.h>
 #include <linux/dmi.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 
index 321de2e0161b4a3ef825489ab59a96e6250b1cd9..8414ed2a02de98b08ccadbe375d75b93da59cd35 100644 (file)
@@ -979,6 +979,40 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id)
        xhci->devs[slot_id] = NULL;
 }
 
+/*
+ * Free a virt_device structure.
+ * If the virt_device added a tt_info (a hub) and has children pointing to
+ * that tt_info, then free the child first. Recursive.
+ * We can't rely on udev at this point to find child-parent relationships.
+ */
+void xhci_free_virt_devices_depth_first(struct xhci_hcd *xhci, int slot_id)
+{
+       struct xhci_virt_device *vdev;
+       struct list_head *tt_list_head;
+       struct xhci_tt_bw_info *tt_info, *next;
+       int i;
+
+       vdev = xhci->devs[slot_id];
+       if (!vdev)
+               return;
+
+       tt_list_head = &(xhci->rh_bw[vdev->real_port - 1].tts);
+       list_for_each_entry_safe(tt_info, next, tt_list_head, tt_list) {
+               /* is this a hub device that added a tt_info to the tts list */
+               if (tt_info->slot_id == slot_id) {
+                       /* are any devices using this tt_info? */
+                       for (i = 1; i < HCS_MAX_SLOTS(xhci->hcs_params1); i++) {
+                               vdev = xhci->devs[i];
+                               if (vdev && (vdev->tt_info == tt_info))
+                                       xhci_free_virt_devices_depth_first(
+                                               xhci, i);
+                       }
+               }
+       }
+       /* we are now at a leaf device */
+       xhci_free_virt_device(xhci, slot_id);
+}
+
 int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
                struct usb_device *udev, gfp_t flags)
 {
@@ -1795,7 +1829,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
        int size;
        int i, j, num_ports;
 
-       del_timer_sync(&xhci->cmd_timer);
+       cancel_delayed_work_sync(&xhci->cmd_timer);
 
        /* Free the Event Ring Segment Table and the actual Event Ring */
        size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
@@ -1828,8 +1862,8 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
                }
        }
 
-       for (i = 1; i < MAX_HC_SLOTS; ++i)
-               xhci_free_virt_device(xhci, i);
+       for (i = HCS_MAX_SLOTS(xhci->hcs_params1); i > 0; i--)
+               xhci_free_virt_devices_depth_first(xhci, i);
 
        dma_pool_destroy(xhci->segment_pool);
        xhci->segment_pool = NULL;
@@ -2342,9 +2376,9 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
 
        INIT_LIST_HEAD(&xhci->cmd_list);
 
-       /* init command timeout timer */
-       setup_timer(&xhci->cmd_timer, xhci_handle_command_timeout,
-                   (unsigned long)xhci);
+       /* init command timeout work */
+       INIT_DELAYED_WORK(&xhci->cmd_timer, xhci_handle_command_timeout);
+       init_completion(&xhci->cmd_ring_stop_completion);
 
        page_size = readl(&xhci->op_regs->page_size);
        xhci_dbg_trace(xhci, trace_xhci_dbg_init,
index 1094ebd2838ff95a5834f7a680e4a2c0aa13301c..bac961cd24ad62b649da486f62c519ab0b51661d 100644 (file)
@@ -579,8 +579,10 @@ static int xhci_mtk_probe(struct platform_device *pdev)
                goto disable_ldos;
 
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0)
+       if (irq < 0) {
+               ret = irq;
                goto disable_clk;
+       }
 
        /* Initialize dma_mask and coherent_dma_mask to 32-bits */
        ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
index e96ae80d107e94fd8db8c33cae52ff9153f14730..954abfd5014d281d537e11353cb6093b9b7a0bdd 100644 (file)
@@ -165,7 +165,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
                 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
                 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
                 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI ||
-                pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI)) {
+                pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI ||
+                pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) {
                xhci->quirks |= XHCI_PME_STUCK_QUIRK;
        }
        if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
index bdf6b13d9b6755a0504a15ba10fcfe1d06b5bc73..25f522b09dd9746938168e6f675464db9f2e6740 100644 (file)
@@ -279,23 +279,76 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci)
        readl(&xhci->dba->doorbell[0]);
 }
 
-static int xhci_abort_cmd_ring(struct xhci_hcd *xhci)
+static bool xhci_mod_cmd_timer(struct xhci_hcd *xhci, unsigned long delay)
+{
+       return mod_delayed_work(system_wq, &xhci->cmd_timer, delay);
+}
+
+static struct xhci_command *xhci_next_queued_cmd(struct xhci_hcd *xhci)
+{
+       return list_first_entry_or_null(&xhci->cmd_list, struct xhci_command,
+                                       cmd_list);
+}
+
+/*
+ * Turn all commands on command ring with status set to "aborted" to no-op trbs.
+ * If there are other commands waiting then restart the ring and kick the timer.
+ * This must be called with command ring stopped and xhci->lock held.
+ */
+static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
+                                        struct xhci_command *cur_cmd)
+{
+       struct xhci_command *i_cmd;
+       u32 cycle_state;
+
+       /* Turn all aborted commands in list to no-ops, then restart */
+       list_for_each_entry(i_cmd, &xhci->cmd_list, cmd_list) {
+
+               if (i_cmd->status != COMP_CMD_ABORT)
+                       continue;
+
+               i_cmd->status = COMP_CMD_STOP;
+
+               xhci_dbg(xhci, "Turn aborted command %p to no-op\n",
+                        i_cmd->command_trb);
+               /* get cycle state from the original cmd trb */
+               cycle_state = le32_to_cpu(
+                       i_cmd->command_trb->generic.field[3]) & TRB_CYCLE;
+               /* modify the command trb to no-op command */
+               i_cmd->command_trb->generic.field[0] = 0;
+               i_cmd->command_trb->generic.field[1] = 0;
+               i_cmd->command_trb->generic.field[2] = 0;
+               i_cmd->command_trb->generic.field[3] = cpu_to_le32(
+                       TRB_TYPE(TRB_CMD_NOOP) | cycle_state);
+
+               /*
+                * caller waiting for completion is called when command
+                *  completion event is received for these no-op commands
+                */
+       }
+
+       xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
+
+       /* ring command ring doorbell to restart the command ring */
+       if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) &&
+           !(xhci->xhc_state & XHCI_STATE_DYING)) {
+               xhci->current_cmd = cur_cmd;
+               xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
+               xhci_ring_cmd_db(xhci);
+       }
+}
+
+/* Must be called with xhci->lock held, releases and aquires lock back */
+static int xhci_abort_cmd_ring(struct xhci_hcd *xhci, unsigned long flags)
 {
        u64 temp_64;
        int ret;
 
        xhci_dbg(xhci, "Abort command ring\n");
 
-       temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
-       xhci->cmd_ring_state = CMD_RING_STATE_ABORTED;
+       reinit_completion(&xhci->cmd_ring_stop_completion);
 
-       /*
-        * Writing the CMD_RING_ABORT bit should cause a cmd completion event,
-        * however on some host hw the CMD_RING_RUNNING bit is correctly cleared
-        * but the completion event in never sent. Use the cmd timeout timer to
-        * handle those cases. Use twice the time to cover the bit polling retry
-        */
-       mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT));
+       temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
        xhci_write_64(xhci, temp_64 | CMD_RING_ABORT,
                        &xhci->op_regs->cmd_ring);
 
@@ -315,17 +368,30 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci)
                udelay(1000);
                ret = xhci_handshake(&xhci->op_regs->cmd_ring,
                                     CMD_RING_RUNNING, 0, 3 * 1000 * 1000);
-               if (ret == 0)
-                       return 0;
-
-               xhci_err(xhci, "Stopped the command ring failed, "
-                               "maybe the host is dead\n");
-               del_timer(&xhci->cmd_timer);
-               xhci->xhc_state |= XHCI_STATE_DYING;
-               xhci_halt(xhci);
-               return -ESHUTDOWN;
+               if (ret < 0) {
+                       xhci_err(xhci, "Stopped the command ring failed, "
+                                "maybe the host is dead\n");
+                       xhci->xhc_state |= XHCI_STATE_DYING;
+                       xhci_halt(xhci);
+                       return -ESHUTDOWN;
+               }
+       }
+       /*
+        * Writing the CMD_RING_ABORT bit should cause a cmd completion event,
+        * however on some host hw the CMD_RING_RUNNING bit is correctly cleared
+        * but the completion event in never sent. Wait 2 secs (arbitrary
+        * number) to handle those cases after negation of CMD_RING_RUNNING.
+        */
+       spin_unlock_irqrestore(&xhci->lock, flags);
+       ret = wait_for_completion_timeout(&xhci->cmd_ring_stop_completion,
+                                         msecs_to_jiffies(2000));
+       spin_lock_irqsave(&xhci->lock, flags);
+       if (!ret) {
+               xhci_dbg(xhci, "No stop event for abort, ring start fail?\n");
+               xhci_cleanup_command_queue(xhci);
+       } else {
+               xhci_handle_stopped_cmd_ring(xhci, xhci_next_queued_cmd(xhci));
        }
-
        return 0;
 }
 
@@ -1207,101 +1273,62 @@ void xhci_cleanup_command_queue(struct xhci_hcd *xhci)
                xhci_complete_del_and_free_cmd(cur_cmd, COMP_CMD_ABORT);
 }
 
-/*
- * Turn all commands on command ring with status set to "aborted" to no-op trbs.
- * If there are other commands waiting then restart the ring and kick the timer.
- * This must be called with command ring stopped and xhci->lock held.
- */
-static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
-                                        struct xhci_command *cur_cmd)
-{
-       struct xhci_command *i_cmd, *tmp_cmd;
-       u32 cycle_state;
-
-       /* Turn all aborted commands in list to no-ops, then restart */
-       list_for_each_entry_safe(i_cmd, tmp_cmd, &xhci->cmd_list,
-                                cmd_list) {
-
-               if (i_cmd->status != COMP_CMD_ABORT)
-                       continue;
-
-               i_cmd->status = COMP_CMD_STOP;
-
-               xhci_dbg(xhci, "Turn aborted command %p to no-op\n",
-                        i_cmd->command_trb);
-               /* get cycle state from the original cmd trb */
-               cycle_state = le32_to_cpu(
-                       i_cmd->command_trb->generic.field[3]) & TRB_CYCLE;
-               /* modify the command trb to no-op command */
-               i_cmd->command_trb->generic.field[0] = 0;
-               i_cmd->command_trb->generic.field[1] = 0;
-               i_cmd->command_trb->generic.field[2] = 0;
-               i_cmd->command_trb->generic.field[3] = cpu_to_le32(
-                       TRB_TYPE(TRB_CMD_NOOP) | cycle_state);
-
-               /*
-                * caller waiting for completion is called when command
-                *  completion event is received for these no-op commands
-                */
-       }
-
-       xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
-
-       /* ring command ring doorbell to restart the command ring */
-       if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) &&
-           !(xhci->xhc_state & XHCI_STATE_DYING)) {
-               xhci->current_cmd = cur_cmd;
-               mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT);
-               xhci_ring_cmd_db(xhci);
-       }
-       return;
-}
-
-
-void xhci_handle_command_timeout(unsigned long data)
+void xhci_handle_command_timeout(struct work_struct *work)
 {
        struct xhci_hcd *xhci;
        int ret;
        unsigned long flags;
        u64 hw_ring_state;
-       bool second_timeout = false;
-       xhci = (struct xhci_hcd *) data;
 
-       /* mark this command to be cancelled */
+       xhci = container_of(to_delayed_work(work), struct xhci_hcd, cmd_timer);
+
        spin_lock_irqsave(&xhci->lock, flags);
-       if (xhci->current_cmd) {
-               if (xhci->current_cmd->status == COMP_CMD_ABORT)
-                       second_timeout = true;
-               xhci->current_cmd->status = COMP_CMD_ABORT;
+
+       /*
+        * If timeout work is pending, or current_cmd is NULL, it means we
+        * raced with command completion. Command is handled so just return.
+        */
+       if (!xhci->current_cmd || delayed_work_pending(&xhci->cmd_timer)) {
+               spin_unlock_irqrestore(&xhci->lock, flags);
+               return;
        }
+       /* mark this command to be cancelled */
+       xhci->current_cmd->status = COMP_CMD_ABORT;
 
        /* Make sure command ring is running before aborting it */
        hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
        if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) &&
            (hw_ring_state & CMD_RING_RUNNING))  {
-               spin_unlock_irqrestore(&xhci->lock, flags);
+               /* Prevent new doorbell, and start command abort */
+               xhci->cmd_ring_state = CMD_RING_STATE_ABORTED;
                xhci_dbg(xhci, "Command timeout\n");
-               ret = xhci_abort_cmd_ring(xhci);
+               ret = xhci_abort_cmd_ring(xhci, flags);
                if (unlikely(ret == -ESHUTDOWN)) {
                        xhci_err(xhci, "Abort command ring failed\n");
                        xhci_cleanup_command_queue(xhci);
+                       spin_unlock_irqrestore(&xhci->lock, flags);
                        usb_hc_died(xhci_to_hcd(xhci)->primary_hcd);
                        xhci_dbg(xhci, "xHCI host controller is dead.\n");
+
+                       return;
                }
-               return;
+
+               goto time_out_completed;
        }
 
-       /* command ring failed to restart, or host removed. Bail out */
-       if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) {
-               spin_unlock_irqrestore(&xhci->lock, flags);
-               xhci_dbg(xhci, "command timed out twice, ring start fail?\n");
+       /* host removed. Bail out */
+       if (xhci->xhc_state & XHCI_STATE_REMOVING) {
+               xhci_dbg(xhci, "host removed, ring start fail?\n");
                xhci_cleanup_command_queue(xhci);
-               return;
+
+               goto time_out_completed;
        }
 
        /* command timeout on stopped ring, ring can't be aborted */
        xhci_dbg(xhci, "Command timeout on stopped ring\n");
        xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd);
+
+time_out_completed:
        spin_unlock_irqrestore(&xhci->lock, flags);
        return;
 }
@@ -1333,7 +1360,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
 
        cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list);
 
-       del_timer(&xhci->cmd_timer);
+       cancel_delayed_work(&xhci->cmd_timer);
 
        trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event);
 
@@ -1341,7 +1368,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
 
        /* If CMD ring stopped we own the trbs between enqueue and dequeue */
        if (cmd_comp_code == COMP_CMD_STOP) {
-               xhci_handle_stopped_cmd_ring(xhci, cmd);
+               complete_all(&xhci->cmd_ring_stop_completion);
                return;
        }
 
@@ -1359,8 +1386,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
         */
        if (cmd_comp_code == COMP_CMD_ABORT) {
                xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
-               if (cmd->status == COMP_CMD_ABORT)
+               if (cmd->status == COMP_CMD_ABORT) {
+                       if (xhci->current_cmd == cmd)
+                               xhci->current_cmd = NULL;
                        goto event_handled;
+               }
        }
 
        cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3]));
@@ -1421,7 +1451,9 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
        if (cmd->cmd_list.next != &xhci->cmd_list) {
                xhci->current_cmd = list_entry(cmd->cmd_list.next,
                                               struct xhci_command, cmd_list);
-               mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT);
+               xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
+       } else if (xhci->current_cmd == cmd) {
+               xhci->current_cmd = NULL;
        }
 
 event_handled:
@@ -1939,8 +1971,9 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
        struct xhci_ep_ctx *ep_ctx;
        u32 trb_comp_code;
        u32 remaining, requested;
-       bool on_data_stage;
+       u32 trb_type;
 
+       trb_type = TRB_FIELD_TO_TYPE(le32_to_cpu(ep_trb->generic.field[3]));
        slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags));
        xdev = xhci->devs[slot_id];
        ep_index = TRB_TO_EP_ID(le32_to_cpu(event->flags)) - 1;
@@ -1950,14 +1983,11 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
        requested = td->urb->transfer_buffer_length;
        remaining = EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
 
-       /* not setup (dequeue), or status stage means we are at data stage */
-       on_data_stage = (ep_trb != ep_ring->dequeue && ep_trb != td->last_trb);
-
        switch (trb_comp_code) {
        case COMP_SUCCESS:
-               if (ep_trb != td->last_trb) {
+               if (trb_type != TRB_STATUS) {
                        xhci_warn(xhci, "WARN: Success on ctrl %s TRB without IOC set?\n",
-                                 on_data_stage ? "data" : "setup");
+                                 (trb_type == TRB_DATA) ? "data" : "setup");
                        *status = -ESHUTDOWN;
                        break;
                }
@@ -1967,15 +1997,25 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
                *status = 0;
                break;
        case COMP_STOP_SHORT:
-               if (on_data_stage)
+               if (trb_type == TRB_DATA || trb_type == TRB_NORMAL)
                        td->urb->actual_length = remaining;
                else
                        xhci_warn(xhci, "WARN: Stopped Short Packet on ctrl setup or status TRB\n");
                goto finish_td;
        case COMP_STOP:
-               if (on_data_stage)
+               switch (trb_type) {
+               case TRB_SETUP:
+                       td->urb->actual_length = 0;
+                       goto finish_td;
+               case TRB_DATA:
+               case TRB_NORMAL:
                        td->urb->actual_length = requested - remaining;
-               goto finish_td;
+                       goto finish_td;
+               default:
+                       xhci_warn(xhci, "WARN: unexpected TRB Type %d\n",
+                                 trb_type);
+                       goto finish_td;
+               }
        case COMP_STOP_INVAL:
                goto finish_td;
        default:
@@ -1987,7 +2027,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
                /* else fall through */
        case COMP_STALL:
                /* Did we transfer part of the data (middle) phase? */
-               if (on_data_stage)
+               if (trb_type == TRB_DATA || trb_type == TRB_NORMAL)
                        td->urb->actual_length = requested - remaining;
                else if (!td->urb_length_set)
                        td->urb->actual_length = 0;
@@ -1995,14 +2035,15 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
        }
 
        /* stopped at setup stage, no data transferred */
-       if (ep_trb == ep_ring->dequeue)
+       if (trb_type == TRB_SETUP)
                goto finish_td;
 
        /*
         * if on data stage then update the actual_length of the URB and flag it
         * as set, so it won't be overwritten in the event for the last TRB.
         */
-       if (on_data_stage) {
+       if (trb_type == TRB_DATA ||
+               trb_type == TRB_NORMAL) {
                td->urb_length_set = true;
                td->urb->actual_length = requested - remaining;
                xhci_dbg(xhci, "Waiting for status stage event\n");
@@ -3790,9 +3831,9 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,
 
        /* if there are no other commands queued we start the timeout timer */
        if (xhci->cmd_list.next == &cmd->cmd_list &&
-           !timer_pending(&xhci->cmd_timer)) {
+           !delayed_work_pending(&xhci->cmd_timer)) {
                xhci->current_cmd = cmd;
-               mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT);
+               xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
        }
 
        queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3,
index 1cd56417cbec455b6db7605d3b3e20aa20a0998d..0c8deb9ed42def112efc8ad1aaf95526315c164f 100644 (file)
@@ -3787,8 +3787,10 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
 
        mutex_lock(&xhci->mutex);
 
-       if (xhci->xhc_state)    /* dying, removing or halted */
+       if (xhci->xhc_state) {  /* dying, removing or halted */
+               ret = -ESHUTDOWN;
                goto out;
+       }
 
        if (!udev->slot_id) {
                xhci_dbg_trace(xhci, trace_xhci_dbg_address,
index 8ccc11a974b8a62ee0afe18808babb0603071efa..2d7b6374b58d0c092528dff89e761716552735d2 100644 (file)
@@ -1568,7 +1568,8 @@ struct xhci_hcd {
 #define CMD_RING_STATE_STOPPED         (1 << 2)
        struct list_head        cmd_list;
        unsigned int            cmd_ring_reserved_trbs;
-       struct timer_list       cmd_timer;
+       struct delayed_work     cmd_timer;
+       struct completion       cmd_ring_stop_completion;
        struct xhci_command     *current_cmd;
        struct xhci_ring        *event_ring;
        struct xhci_erst        erst;
@@ -1934,7 +1935,7 @@ void xhci_queue_config_ep_quirk(struct xhci_hcd *xhci,
                unsigned int slot_id, unsigned int ep_index,
                struct xhci_dequeue_state *deq_state);
 void xhci_stop_endpoint_command_watchdog(unsigned long arg);
-void xhci_handle_command_timeout(unsigned long data);
+void xhci_handle_command_timeout(struct work_struct *work);
 
 void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id,
                unsigned int ep_index, unsigned int stream_id);
index 9a82f8308ad7fa131e30f88079163d06f62f5807..01a9373b7e18a16fa0b8bc35625fffbe0eefc15b 100644 (file)
@@ -48,7 +48,7 @@
 #include <linux/module.h>
 #include <linux/kref.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/usb.h>
 #include <linux/workqueue.h>
 #include <linux/platform_device.h>
index 2975e80b7a56f9bce341707012c174da09dc9d49..debc1fd74b0df2cb17817ec60254104e0fc72b2b 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/module.h>
 #include <linux/completion.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/usb.h>
 
 /* image constants */
index 9ca595632f171c2ac705c3c465769afe80c1e6f7..3bc5356832db777424111b74cefbcfe2e77ce4e4 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/input.h>
 #include <linux/usb.h>
 #include <linux/poll.h>
index c8fbe7b739a0bb110cdfbca9e82bc7238adf5e08..b10e26c74a9088b20f44b5ad376bebfe869d196b 100644 (file)
@@ -83,7 +83,7 @@
 #include <linux/module.h>
 #include <linux/completion.h>
 #include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/usb.h>
 #include <linux/poll.h>
 
index 1a874a1f3890eb6d385e767589df6d5ea9d65e5c..91c22276c03b55c2c78e0de55e8a2a9b618607ea 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/slab.h>
 #include <linux/time64.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "usb_mon.h"
 
index 5388a339cfb81ba76852fc2948a7ea14060c0089..5bdf73a574981506f3776b5f6a6ec966d846d937 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/export.h>
 #include <linux/usb.h>
 #include <linux/fs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "usb_mon.h"
 
index e59334b09c4126ac75077c8b5333222f5e66f4b8..db1a4abf2806132c31a5c47a02c43794805eb9b1 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/mutex.h>
 #include <linux/debugfs.h>
 #include <linux/scatterlist.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "usb_mon.h"
 
index 310238c6b5cd699bcd89ef101b926feba5d60a8c..8967980718170d5119d6331ed8395dfa2f4fa970 100644 (file)
@@ -469,6 +469,7 @@ static const struct musb_platform_ops bfin_ops = {
        .init           = bfin_musb_init,
        .exit           = bfin_musb_exit,
 
+       .fifo_offset    = bfin_fifo_offset,
        .readb          = bfin_readb,
        .writeb         = bfin_writeb,
        .readw          = bfin_readw,
index 9e226468a13eb07af0bf5a6407d81cd304436369..fca288bbc8009580ba96198ce1a2a49330074d20 100644 (file)
@@ -2050,6 +2050,7 @@ struct musb_pending_work {
        struct list_head node;
 };
 
+#ifdef CONFIG_PM
 /*
  * Called from musb_runtime_resume(), musb_resume(), and
  * musb_queue_resume_work(). Callers must take musb->lock.
@@ -2077,6 +2078,7 @@ static int musb_run_resume_work(struct musb *musb)
 
        return error;
 }
+#endif
 
 /*
  * Called to run work if device is active or else queue the work to happen
index a611e2f67bdc9e3233e4d6efde27d8ce18fe0a67..ade902ea1221e18543de05a5188c715d86af7398 100644 (file)
@@ -216,6 +216,7 @@ struct musb_platform_ops {
        void    (*pre_root_reset_end)(struct musb *musb);
        void    (*post_root_reset_end)(struct musb *musb);
        int     (*phy_callback)(enum musb_vbus_id_status status);
+       void    (*clear_ep_rxintr)(struct musb *musb, int epnum);
 };
 
 /*
@@ -626,6 +627,12 @@ static inline void musb_platform_post_root_reset_end(struct musb *musb)
                musb->ops->post_root_reset_end(musb);
 }
 
+static inline void musb_platform_clear_ep_rxintr(struct musb *musb, int epnum)
+{
+       if (musb->ops->clear_ep_rxintr)
+               musb->ops->clear_ep_rxintr(musb, epnum);
+}
+
 /*
  * gets the "dr_mode" property from DT and converts it into musb_mode
  * if the property is not found or not recognized returns MUSB_OTG
index d4d7c56b48c7edf70aba49d6c2b9aa04347acd7c..16363852c0346b28b6452e04eddedfc630635428 100644 (file)
@@ -197,8 +197,7 @@ static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer)
        if (!list_empty(&controller->early_tx_list) &&
            !hrtimer_is_queued(&controller->early_tx)) {
                ret = HRTIMER_RESTART;
-               hrtimer_forward_now(&controller->early_tx,
-                               ktime_set(0, 20 * NSEC_PER_USEC));
+               hrtimer_forward_now(&controller->early_tx, 20 * NSEC_PER_USEC);
        }
 
        spin_unlock_irqrestore(&musb->lock, flags);
@@ -280,9 +279,9 @@ static void cppi41_dma_callback(void *private_data)
                unsigned long usecs = cppi41_channel->total_len / 10;
 
                hrtimer_start_range_ns(&controller->early_tx,
-                               ktime_set(0, usecs * NSEC_PER_USEC),
-                               20 * NSEC_PER_USEC,
-                               HRTIMER_MODE_REL);
+                                      usecs * NSEC_PER_USEC,
+                                      20 * NSEC_PER_USEC,
+                                      HRTIMER_MODE_REL);
        }
 
 out:
index 9b22d946c089698e2083ab3457e0c5bda1f9bde2..4fef50e5c8c1295364aca0a28ba9cf8da005ac21 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "musb_core.h"
 #include "musb_debug.h"
index feae1561b9abb6924d2fe2fc6f1222dfac9d2be7..9f125e179acd444ca43c73a1a5d263b8e5c8893d 100644 (file)
@@ -267,6 +267,17 @@ static void otg_timer(unsigned long _musb)
        pm_runtime_put_autosuspend(dev);
 }
 
+void dsps_musb_clear_ep_rxintr(struct musb *musb, int epnum)
+{
+       u32 epintr;
+       struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent);
+       const struct dsps_musb_wrapper *wrp = glue->wrp;
+
+       /* musb->lock might already been held */
+       epintr = (1 << epnum) << wrp->rxep_shift;
+       musb_writel(musb->ctrl_base, wrp->epintr_status, epintr);
+}
+
 static irqreturn_t dsps_interrupt(int irq, void *hci)
 {
        struct musb  *musb = hci;
@@ -622,6 +633,7 @@ static struct musb_platform_ops dsps_ops = {
 
        .set_mode       = dsps_musb_set_mode,
        .recover        = dsps_musb_recover,
+       .clear_ep_rxintr = dsps_musb_clear_ep_rxintr,
 };
 
 static u64 musb_dmamask = DMA_BIT_MASK(32);
index f6cdbad00daceb5837a8cfcdec37438389aae800..ac3a4952abb4b290b019ac59fbddd7004b50d949 100644 (file)
@@ -2374,12 +2374,11 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
        int                     is_in = usb_pipein(urb->pipe);
        int                     status = 0;
        u16                     csr;
+       struct dma_channel      *dma = NULL;
 
        musb_ep_select(regs, hw_end);
 
        if (is_dma_capable()) {
-               struct dma_channel      *dma;
-
                dma = is_in ? ep->rx_channel : ep->tx_channel;
                if (dma) {
                        status = ep->musb->dma_controller->channel_abort(dma);
@@ -2395,10 +2394,9 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
                /* giveback saves bulk toggle */
                csr = musb_h_flush_rxfifo(ep, 0);
 
-               /* REVISIT we still get an irq; should likely clear the
-                * endpoint's irq status here to avoid bogus irqs.
-                * clearing that status is platform-specific...
-                */
+               /* clear the endpoint's irq status here to avoid bogus irqs */
+               if (is_dma_capable() && dma)
+                       musb_platform_clear_ep_rxintr(musb, ep->epnum);
        } else if (ep->epnum) {
                musb_h_tx_flush_fifo(ep);
                csr = musb_readw(epio, MUSB_TXCSR);
index f7b13fd252574f848e7984905cbaef4478c2e90a..a3dcbd55e43609b3140979d971a43426a1ce3db0 100644 (file)
@@ -157,5 +157,5 @@ struct musb_dma_controller {
        void __iomem                    *base;
        u8                              channel_count;
        u8                              used_channels;
-       u8                              irq;
+       int                             irq;
 };
index 5f17a3b9916d79ea28c82b04755e23d5680d4b2d..80260b08398b2e55833c65d21e0be70cc43ccf01 100644 (file)
@@ -50,6 +50,7 @@
 #define CYBERJACK_PRODUCT_ID   0x0100
 
 /* Function prototypes */
+static int cyberjack_attach(struct usb_serial *serial);
 static int cyberjack_port_probe(struct usb_serial_port *port);
 static int cyberjack_port_remove(struct usb_serial_port *port);
 static int  cyberjack_open(struct tty_struct *tty,
@@ -77,6 +78,7 @@ static struct usb_serial_driver cyberjack_device = {
        .description =          "Reiner SCT Cyberjack USB card reader",
        .id_table =             id_table,
        .num_ports =            1,
+       .attach =               cyberjack_attach,
        .port_probe =           cyberjack_port_probe,
        .port_remove =          cyberjack_port_remove,
        .open =                 cyberjack_open,
@@ -100,6 +102,14 @@ struct cyberjack_private {
        short           wrsent;         /* Data already sent */
 };
 
+static int cyberjack_attach(struct usb_serial *serial)
+{
+       if (serial->num_bulk_out < serial->num_ports)
+               return -ENODEV;
+
+       return 0;
+}
+
 static int cyberjack_port_probe(struct usb_serial_port *port)
 {
        struct cyberjack_private *priv;
index 8282a6a18fee83f6f1838b2f6f55b37a0ec4d409..22f23a429a95cb6a1cdeaca445a92035fd3e98e8 100644 (file)
@@ -1237,6 +1237,7 @@ static int f81534_attach(struct usb_serial *serial)
 static int f81534_port_probe(struct usb_serial_port *port)
 {
        struct f81534_port_private *port_priv;
+       int ret;
 
        port_priv = devm_kzalloc(&port->dev, sizeof(*port_priv), GFP_KERNEL);
        if (!port_priv)
@@ -1246,10 +1247,11 @@ static int f81534_port_probe(struct usb_serial_port *port)
        mutex_init(&port_priv->mcr_mutex);
 
        /* Assign logic-to-phy mapping */
-       port_priv->phy_num = f81534_logic_to_phy_port(port->serial, port);
-       if (port_priv->phy_num < 0 || port_priv->phy_num >= F81534_NUM_PORT)
-               return -ENODEV;
+       ret = f81534_logic_to_phy_port(port->serial, port);
+       if (ret < 0)
+               return ret;
 
+       port_priv->phy_num = ret;
        usb_set_serial_port_data(port, port_priv);
        dev_dbg(&port->dev, "%s: port_number: %d, phy_num: %d\n", __func__,
                        port->port_number, port_priv->phy_num);
index 97cabf803c2fa91a134c957dba74c4f77b97c712..b2f2e87aed945d7aceac24c99cf2f7c401beb5b2 100644 (file)
@@ -1043,6 +1043,7 @@ static int garmin_write_bulk(struct usb_serial_port *port,
                   "%s - usb_submit_urb(write bulk) failed with status = %d\n",
                                __func__, status);
                count = status;
+               kfree(buffer);
        }
 
        /* we are done with this urb, so let the host driver
index dcc0c58aaad5adaf89bdd535d4cd9699445de3ac..d50e5773483f5494be90ff42633cff70012079cc 100644 (file)
@@ -2751,6 +2751,11 @@ static int edge_startup(struct usb_serial *serial)
                                        EDGE_COMPATIBILITY_MASK1,
                                        EDGE_COMPATIBILITY_MASK2 };
 
+       if (serial->num_bulk_in < 1 || serial->num_interrupt_in < 1) {
+               dev_err(&serial->interface->dev, "missing endpoints\n");
+               return -ENODEV;
+       }
+
        dev = serial->dev;
 
        /* create our private serial structure */
index c339163698eb9960f8cc71735d8ed1cf24905e75..9a0db2965fbb45df5fd6b67f5eddb9d90969869c 100644 (file)
@@ -1499,8 +1499,7 @@ static int do_boot_mode(struct edgeport_serial *serial,
 
                dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__);
 
-               /* return an error on purpose */
-               return -ENODEV;
+               return 1;
        }
 
 stayinbootmode:
@@ -1508,7 +1507,7 @@ stayinbootmode:
        dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__);
        serial->product_info.TiMode = TI_MODE_BOOT;
 
-       return 0;
+       return 1;
 }
 
 static int ti_do_config(struct edgeport_port *port, int feature, int on)
@@ -2546,6 +2545,13 @@ static int edge_startup(struct usb_serial *serial)
        int status;
        u16 product_id;
 
+       /* Make sure we have the required endpoints when in download mode. */
+       if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) {
+               if (serial->num_bulk_in < serial->num_ports ||
+                               serial->num_bulk_out < serial->num_ports)
+                       return -ENODEV;
+       }
+
        /* create our private serial structure */
        edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
        if (!edge_serial)
@@ -2553,14 +2559,18 @@ static int edge_startup(struct usb_serial *serial)
 
        mutex_init(&edge_serial->es_lock);
        edge_serial->serial = serial;
+       INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work);
        usb_set_serial_data(serial, edge_serial);
 
        status = download_fw(edge_serial);
-       if (status) {
+       if (status < 0) {
                kfree(edge_serial);
                return status;
        }
 
+       if (status > 0)
+               return 1;       /* bind but do not register any ports */
+
        product_id = le16_to_cpu(
                        edge_serial->serial->dev->descriptor.idProduct);
 
@@ -2572,7 +2582,6 @@ static int edge_startup(struct usb_serial *serial)
                }
        }
 
-       INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work);
        edge_heartbeat_schedule(edge_serial);
 
        return 0;
@@ -2580,6 +2589,9 @@ static int edge_startup(struct usb_serial *serial)
 
 static void edge_disconnect(struct usb_serial *serial)
 {
+       struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
+
+       cancel_delayed_work_sync(&edge_serial->heartbeat_work);
 }
 
 static void edge_release(struct usb_serial *serial)
index 344b4eea4bd59c4da0590f538323f37b5ed74074..d57fb51992182afec68a28fce42a242a4cd46ff2 100644 (file)
@@ -68,6 +68,16 @@ struct iuu_private {
        u32 clk;
 };
 
+static int iuu_attach(struct usb_serial *serial)
+{
+       unsigned char num_ports = serial->num_ports;
+
+       if (serial->num_bulk_in < num_ports || serial->num_bulk_out < num_ports)
+               return -ENODEV;
+
+       return 0;
+}
+
 static int iuu_port_probe(struct usb_serial_port *port)
 {
        struct iuu_private *priv;
@@ -1196,6 +1206,7 @@ static struct usb_serial_driver iuu_device = {
        .tiocmset = iuu_tiocmset,
        .set_termios = iuu_set_termios,
        .init_termios = iuu_init_termios,
+       .attach = iuu_attach,
        .port_probe = iuu_port_probe,
        .port_remove = iuu_port_remove,
 };
index e49ad0c63ad8b54c61995965445054e34cda6869..83523fcf6fb9d6a75bfba7738362e1c8bbfa01c9 100644 (file)
@@ -699,6 +699,19 @@ MODULE_FIRMWARE("keyspan_pda/keyspan_pda.fw");
 MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw");
 #endif
 
+static int keyspan_pda_attach(struct usb_serial *serial)
+{
+       unsigned char num_ports = serial->num_ports;
+
+       if (serial->num_bulk_out < num_ports ||
+                       serial->num_interrupt_in < num_ports) {
+               dev_err(&serial->interface->dev, "missing endpoints\n");
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
 static int keyspan_pda_port_probe(struct usb_serial_port *port)
 {
 
@@ -776,6 +789,7 @@ static struct usb_serial_driver keyspan_pda_device = {
        .break_ctl =            keyspan_pda_break_ctl,
        .tiocmget =             keyspan_pda_tiocmget,
        .tiocmset =             keyspan_pda_tiocmset,
+       .attach =               keyspan_pda_attach,
        .port_probe =           keyspan_pda_port_probe,
        .port_remove =          keyspan_pda_port_remove,
 };
index 2363654cafc9b79de61a30bcc00b7f875c470b60..813035f51fe73a4e0de69ce76e6c3329ba4d376c 100644 (file)
@@ -51,6 +51,7 @@
 
 
 /* Function prototypes */
+static int kobil_attach(struct usb_serial *serial);
 static int kobil_port_probe(struct usb_serial_port *probe);
 static int kobil_port_remove(struct usb_serial_port *probe);
 static int  kobil_open(struct tty_struct *tty, struct usb_serial_port *port);
@@ -86,6 +87,7 @@ static struct usb_serial_driver kobil_device = {
        .description =          "KOBIL USB smart card terminal",
        .id_table =             id_table,
        .num_ports =            1,
+       .attach =               kobil_attach,
        .port_probe =           kobil_port_probe,
        .port_remove =          kobil_port_remove,
        .ioctl =                kobil_ioctl,
@@ -113,6 +115,16 @@ struct kobil_private {
 };
 
 
+static int kobil_attach(struct usb_serial *serial)
+{
+       if (serial->num_interrupt_out < serial->num_ports) {
+               dev_err(&serial->interface->dev, "missing interrupt-out endpoint\n");
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
 static int kobil_port_probe(struct usb_serial_port *port)
 {
        struct usb_serial *serial = port->serial;
index d52caa03679c6cbc5886316cb27d471d0c4b7bc4..91bc170b408a08a59c49786e2cb5753149ce2425 100644 (file)
@@ -65,8 +65,6 @@ struct moschip_port {
        struct urb              *write_urb_pool[NUM_URBS];
 };
 
-static struct usb_serial_driver moschip7720_2port_driver;
-
 #define USB_VENDOR_ID_MOSCHIP          0x9710
 #define MOSCHIP_DEVICE_ID_7720         0x7720
 #define MOSCHIP_DEVICE_ID_7715         0x7715
@@ -970,25 +968,6 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
                tty_port_tty_wakeup(&mos7720_port->port->port);
 }
 
-/*
- * mos77xx_probe
- *     this function installs the appropriate read interrupt endpoint callback
- *     depending on whether the device is a 7720 or 7715, thus avoiding costly
- *     run-time checks in the high-frequency callback routine itself.
- */
-static int mos77xx_probe(struct usb_serial *serial,
-                        const struct usb_device_id *id)
-{
-       if (id->idProduct == MOSCHIP_DEVICE_ID_7715)
-               moschip7720_2port_driver.read_int_callback =
-                       mos7715_interrupt_callback;
-       else
-               moschip7720_2port_driver.read_int_callback =
-                       mos7720_interrupt_callback;
-
-       return 0;
-}
-
 static int mos77xx_calc_num_ports(struct usb_serial *serial)
 {
        u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
@@ -1917,6 +1896,11 @@ static int mos7720_startup(struct usb_serial *serial)
        u16 product;
        int ret_val;
 
+       if (serial->num_bulk_in < 2 || serial->num_bulk_out < 2) {
+               dev_err(&serial->interface->dev, "missing bulk endpoints\n");
+               return -ENODEV;
+       }
+
        product = le16_to_cpu(serial->dev->descriptor.idProduct);
        dev = serial->dev;
 
@@ -1941,19 +1925,18 @@ static int mos7720_startup(struct usb_serial *serial)
                        tmp->interrupt_in_endpointAddress;
                serial->port[1]->interrupt_in_urb = NULL;
                serial->port[1]->interrupt_in_buffer = NULL;
+
+               if (serial->port[0]->interrupt_in_urb) {
+                       struct urb *urb = serial->port[0]->interrupt_in_urb;
+
+                       urb->complete = mos7715_interrupt_callback;
+               }
        }
 
        /* setting configuration feature to one */
        usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
                        (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000);
 
-       /* start the interrupt urb */
-       ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL);
-       if (ret_val)
-               dev_err(&dev->dev,
-                       "%s - Error %d submitting control urb\n",
-                       __func__, ret_val);
-
 #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT
        if (product == MOSCHIP_DEVICE_ID_7715) {
                ret_val = mos7715_parport_init(serial);
@@ -1961,6 +1944,13 @@ static int mos7720_startup(struct usb_serial *serial)
                        return ret_val;
        }
 #endif
+       /* start the interrupt urb */
+       ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL);
+       if (ret_val) {
+               dev_err(&dev->dev, "failed to submit interrupt urb: %d\n",
+                       ret_val);
+       }
+
        /* LSR For Port 1 */
        read_mos_reg(serial, 0, MOS7720_LSR, &data);
        dev_dbg(&dev->dev, "LSR:%x\n", data);
@@ -1970,6 +1960,8 @@ static int mos7720_startup(struct usb_serial *serial)
 
 static void mos7720_release(struct usb_serial *serial)
 {
+       usb_kill_urb(serial->port[0]->interrupt_in_urb);
+
 #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT
        /* close the parallel port */
 
@@ -2019,11 +2011,6 @@ static int mos7720_port_probe(struct usb_serial_port *port)
        if (!mos7720_port)
                return -ENOMEM;
 
-       /* Initialize all port interrupt end point to port 0 int endpoint.
-        * Our device has only one interrupt endpoint common to all ports.
-        */
-       port->interrupt_in_endpointAddress =
-               port->serial->port[0]->interrupt_in_endpointAddress;
        mos7720_port->port = port;
 
        usb_set_serial_port_data(port, mos7720_port);
@@ -2053,7 +2040,6 @@ static struct usb_serial_driver moschip7720_2port_driver = {
        .close                  = mos7720_close,
        .throttle               = mos7720_throttle,
        .unthrottle             = mos7720_unthrottle,
-       .probe                  = mos77xx_probe,
        .attach                 = mos7720_startup,
        .release                = mos7720_release,
        .port_probe             = mos7720_port_probe,
@@ -2067,7 +2053,7 @@ static struct usb_serial_driver moschip7720_2port_driver = {
        .chars_in_buffer        = mos7720_chars_in_buffer,
        .break_ctl              = mos7720_break,
        .read_bulk_callback     = mos7720_bulk_in_callback,
-       .read_int_callback      = NULL  /* dynamically assigned in probe() */
+       .read_int_callback      = mos7720_interrupt_callback,
 };
 
 static struct usb_serial_driver * const serial_drivers[] = {
index 9a220b8e810f161be985d9655ec6d9dee90147dc..ea27fb23967a13dd3e3c47d31fdaab52c38028eb 100644 (file)
@@ -214,7 +214,6 @@ MODULE_DEVICE_TABLE(usb, id_table);
 
 struct moschip_port {
        int port_num;           /*Actual port number in the device(1,2,etc) */
-       struct urb *write_urb;  /* write URB for this port */
        struct urb *read_urb;   /* read URB for this port */
        __u8 shadowLCR;         /* last LCR value received */
        __u8 shadowMCR;         /* last MCR value received */
@@ -1037,9 +1036,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
                                serial,
                                serial->port[0]->interrupt_in_urb->interval);
 
-                       /* start interrupt read for mos7840               *
-                        * will continue as long as mos7840 is connected  */
-
+                       /* start interrupt read for mos7840 */
                        response =
                            usb_submit_urb(serial->port[0]->interrupt_in_urb,
                                           GFP_KERNEL);
@@ -1186,7 +1183,6 @@ static void mos7840_close(struct usb_serial_port *port)
                }
        }
 
-       usb_kill_urb(mos7840_port->write_urb);
        usb_kill_urb(mos7840_port->read_urb);
        mos7840_port->read_urb_busy = false;
 
@@ -1199,12 +1195,6 @@ static void mos7840_close(struct usb_serial_port *port)
                }
        }
 
-       if (mos7840_port->write_urb) {
-               /* if this urb had a transfer buffer already (old tx) free it */
-               kfree(mos7840_port->write_urb->transfer_buffer);
-               usb_free_urb(mos7840_port->write_urb);
-       }
-
        Data = 0x0;
        mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data);
 
@@ -2113,6 +2103,17 @@ static int mos7840_calc_num_ports(struct usb_serial *serial)
        return mos7840_num_ports;
 }
 
+static int mos7840_attach(struct usb_serial *serial)
+{
+       if (serial->num_bulk_in < serial->num_ports ||
+                       serial->num_bulk_out < serial->num_ports) {
+               dev_err(&serial->interface->dev, "missing endpoints\n");
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
 static int mos7840_port_probe(struct usb_serial_port *port)
 {
        struct usb_serial *serial = port->serial;
@@ -2388,6 +2389,7 @@ static struct usb_serial_driver moschip7840_4port_device = {
        .tiocmset = mos7840_tiocmset,
        .tiocmiwait = usb_serial_generic_tiocmiwait,
        .get_icount = usb_serial_generic_get_icount,
+       .attach = mos7840_attach,
        .port_probe = mos7840_port_probe,
        .port_remove = mos7840_port_remove,
        .read_bulk_callback = mos7840_bulk_in_callback,
index f6c6900bccf01c87c88734b2a7417db9f0fade8d..a180b17d24323b074aee19e33bf0f497ad271d8a 100644 (file)
@@ -38,6 +38,7 @@ static int  omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
                                const unsigned char *buf, int count);
 static int  omninet_write_room(struct tty_struct *tty);
 static void omninet_disconnect(struct usb_serial *serial);
+static int omninet_attach(struct usb_serial *serial);
 static int omninet_port_probe(struct usb_serial_port *port);
 static int omninet_port_remove(struct usb_serial_port *port);
 
@@ -56,6 +57,7 @@ static struct usb_serial_driver zyxel_omninet_device = {
        .description =          "ZyXEL - omni.net lcd plus usb",
        .id_table =             id_table,
        .num_ports =            1,
+       .attach =               omninet_attach,
        .port_probe =           omninet_port_probe,
        .port_remove =          omninet_port_remove,
        .open =                 omninet_open,
@@ -104,6 +106,17 @@ struct omninet_data {
        __u8    od_outseq;      /* Sequence number for bulk_out URBs */
 };
 
+static int omninet_attach(struct usb_serial *serial)
+{
+       /* The second bulk-out endpoint is used for writing. */
+       if (serial->num_bulk_out < 2) {
+               dev_err(&serial->interface->dev, "missing endpoints\n");
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
 static int omninet_port_probe(struct usb_serial_port *port)
 {
        struct omninet_data *od;
index a4b88bc038b6d0a943b76457714e65a9449881b2..b8bf52bf7a944d5fddd6976f90a63db3cd6807e5 100644 (file)
@@ -134,6 +134,7 @@ static int oti6858_chars_in_buffer(struct tty_struct *tty);
 static int oti6858_tiocmget(struct tty_struct *tty);
 static int oti6858_tiocmset(struct tty_struct *tty,
                                unsigned int set, unsigned int clear);
+static int oti6858_attach(struct usb_serial *serial);
 static int oti6858_port_probe(struct usb_serial_port *port);
 static int oti6858_port_remove(struct usb_serial_port *port);
 
@@ -158,6 +159,7 @@ static struct usb_serial_driver oti6858_device = {
        .write_bulk_callback =  oti6858_write_bulk_callback,
        .write_room =           oti6858_write_room,
        .chars_in_buffer =      oti6858_chars_in_buffer,
+       .attach =               oti6858_attach,
        .port_probe =           oti6858_port_probe,
        .port_remove =          oti6858_port_remove,
 };
@@ -324,6 +326,20 @@ static void send_data(struct work_struct *work)
        usb_serial_port_softint(port);
 }
 
+static int oti6858_attach(struct usb_serial *serial)
+{
+       unsigned char num_ports = serial->num_ports;
+
+       if (serial->num_bulk_in < num_ports ||
+                       serial->num_bulk_out < num_ports ||
+                       serial->num_interrupt_in < num_ports) {
+               dev_err(&serial->interface->dev, "missing endpoints\n");
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
 static int oti6858_port_probe(struct usb_serial_port *port)
 {
        struct oti6858_private *priv;
index ae682e4eeaef575a23c90a8dda15407e862d42e1..46fca6b7584686744a9e79aae0bd78db08192813 100644 (file)
@@ -220,9 +220,17 @@ static int pl2303_probe(struct usb_serial *serial,
 static int pl2303_startup(struct usb_serial *serial)
 {
        struct pl2303_serial_private *spriv;
+       unsigned char num_ports = serial->num_ports;
        enum pl2303_type type = TYPE_01;
        unsigned char *buf;
 
+       if (serial->num_bulk_in < num_ports ||
+                       serial->num_bulk_out < num_ports ||
+                       serial->num_interrupt_in < num_ports) {
+               dev_err(&serial->interface->dev, "missing endpoints\n");
+               return -ENODEV;
+       }
+
        spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
        if (!spriv)
                return -ENOMEM;
index 659cb8606bd953a7585a013beeb3dc3989400a14..5709cc93b0837a0b73a8acec627caa05e27c9b64 100644 (file)
@@ -408,16 +408,12 @@ static void qt2_close(struct usb_serial_port *port)
 {
        struct usb_serial *serial;
        struct qt2_port_private *port_priv;
-       unsigned long flags;
        int i;
 
        serial = port->serial;
        port_priv = usb_get_serial_port_data(port);
 
-       spin_lock_irqsave(&port_priv->urb_lock, flags);
        usb_kill_urb(port_priv->write_urb);
-       port_priv->urb_in_use = false;
-       spin_unlock_irqrestore(&port_priv->urb_lock, flags);
 
        /* flush the port transmit buffer */
        i = usb_control_msg(serial->dev,
index ef0dbf0703c574eb62d1e2ce3be49e5186258aee..475e6c31b266b013ed4749b482c0477eda4a3904 100644 (file)
@@ -154,6 +154,19 @@ static int spcp8x5_probe(struct usb_serial *serial,
        return 0;
 }
 
+static int spcp8x5_attach(struct usb_serial *serial)
+{
+       unsigned char num_ports = serial->num_ports;
+
+       if (serial->num_bulk_in < num_ports ||
+                       serial->num_bulk_out < num_ports) {
+               dev_err(&serial->interface->dev, "missing endpoints\n");
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
 static int spcp8x5_port_probe(struct usb_serial_port *port)
 {
        const struct usb_device_id *id = usb_get_serial_data(port->serial);
@@ -477,6 +490,7 @@ static struct usb_serial_driver spcp8x5_device = {
        .tiocmget               = spcp8x5_tiocmget,
        .tiocmset               = spcp8x5_tiocmset,
        .probe                  = spcp8x5_probe,
+       .attach                 = spcp8x5_attach,
        .port_probe             = spcp8x5_port_probe,
        .port_remove            = spcp8x5_port_remove,
 };
index 8db9d071d9409a9f6e85ce6b23a1515f90f11157..64b85b8dedf33c9af7ea5faf68b7ea1a97335903 100644 (file)
@@ -579,6 +579,13 @@ static int ti_startup(struct usb_serial *serial)
                goto free_tdev;
        }
 
+       if (serial->num_bulk_in < serial->num_ports ||
+                       serial->num_bulk_out < serial->num_ports) {
+               dev_err(&serial->interface->dev, "missing endpoints\n");
+               status = -ENODEV;
+               goto free_tdev;
+       }
+
        return 0;
 
 free_tdev:
index af3c7eecff91d4a49fb1b49cdfce7b7d4c9b11fe..16cc18369111d039ffededa7559075a869638708 100644 (file)
@@ -2109,6 +2109,13 @@ UNUSUAL_DEV(  0x152d, 0x2566, 0x0114, 0x0114,
                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
                US_FL_BROKEN_FUA ),
 
+/* Reported-by George Cherian <george.cherian@cavium.com> */
+UNUSUAL_DEV(0x152d, 0x9561, 0x0000, 0x9999,
+               "JMicron",
+               "JMS56x",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_NO_REPORT_OPCODES),
+
 /*
  * Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI)
  * and Mac USB Dock USB-SCSI */
index be1ee89ee9172f4408eab231c9b1e6a52a253c88..36d75c367d2215c4761f72d40b6c34eaf54bec02 100644 (file)
@@ -27,6 +27,45 @@ static LIST_HEAD(parent_list);
 static DEFINE_MUTEX(parent_list_lock);
 static struct class_compat *mdev_bus_compat_class;
 
+static LIST_HEAD(mdev_list);
+static DEFINE_MUTEX(mdev_list_lock);
+
+struct device *mdev_parent_dev(struct mdev_device *mdev)
+{
+       return mdev->parent->dev;
+}
+EXPORT_SYMBOL(mdev_parent_dev);
+
+void *mdev_get_drvdata(struct mdev_device *mdev)
+{
+       return mdev->driver_data;
+}
+EXPORT_SYMBOL(mdev_get_drvdata);
+
+void mdev_set_drvdata(struct mdev_device *mdev, void *data)
+{
+       mdev->driver_data = data;
+}
+EXPORT_SYMBOL(mdev_set_drvdata);
+
+struct device *mdev_dev(struct mdev_device *mdev)
+{
+       return &mdev->dev;
+}
+EXPORT_SYMBOL(mdev_dev);
+
+struct mdev_device *mdev_from_dev(struct device *dev)
+{
+       return dev_is_mdev(dev) ? to_mdev_device(dev) : NULL;
+}
+EXPORT_SYMBOL(mdev_from_dev);
+
+uuid_le mdev_uuid(struct mdev_device *mdev)
+{
+       return mdev->uuid;
+}
+EXPORT_SYMBOL(mdev_uuid);
+
 static int _find_mdev_device(struct device *dev, void *data)
 {
        struct mdev_device *mdev;
@@ -42,7 +81,7 @@ static int _find_mdev_device(struct device *dev, void *data)
        return 0;
 }
 
-static bool mdev_device_exist(struct parent_device *parent, uuid_le uuid)
+static bool mdev_device_exist(struct mdev_parent *parent, uuid_le uuid)
 {
        struct device *dev;
 
@@ -56,9 +95,9 @@ static bool mdev_device_exist(struct parent_device *parent, uuid_le uuid)
 }
 
 /* Should be called holding parent_list_lock */
-static struct parent_device *__find_parent_device(struct device *dev)
+static struct mdev_parent *__find_parent_device(struct device *dev)
 {
-       struct parent_device *parent;
+       struct mdev_parent *parent;
 
        list_for_each_entry(parent, &parent_list, next) {
                if (parent->dev == dev)
@@ -69,8 +108,8 @@ static struct parent_device *__find_parent_device(struct device *dev)
 
 static void mdev_release_parent(struct kref *kref)
 {
-       struct parent_device *parent = container_of(kref, struct parent_device,
-                                                   ref);
+       struct mdev_parent *parent = container_of(kref, struct mdev_parent,
+                                                 ref);
        struct device *dev = parent->dev;
 
        kfree(parent);
@@ -78,7 +117,7 @@ static void mdev_release_parent(struct kref *kref)
 }
 
 static
-inline struct parent_device *mdev_get_parent(struct parent_device *parent)
+inline struct mdev_parent *mdev_get_parent(struct mdev_parent *parent)
 {
        if (parent)
                kref_get(&parent->ref);
@@ -86,7 +125,7 @@ inline struct parent_device *mdev_get_parent(struct parent_device *parent)
        return parent;
 }
 
-static inline void mdev_put_parent(struct parent_device *parent)
+static inline void mdev_put_parent(struct mdev_parent *parent)
 {
        if (parent)
                kref_put(&parent->ref, mdev_release_parent);
@@ -95,7 +134,7 @@ static inline void mdev_put_parent(struct parent_device *parent)
 static int mdev_device_create_ops(struct kobject *kobj,
                                  struct mdev_device *mdev)
 {
-       struct parent_device *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->parent;
        int ret;
 
        ret = parent->ops->create(kobj, mdev);
@@ -122,7 +161,7 @@ static int mdev_device_create_ops(struct kobject *kobj,
  */
 static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove)
 {
-       struct parent_device *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->parent;
        int ret;
 
        /*
@@ -153,10 +192,10 @@ static int mdev_device_remove_cb(struct device *dev, void *data)
  * Add device to list of registered parent devices.
  * Returns a negative value on error, otherwise 0.
  */
-int mdev_register_device(struct device *dev, const struct parent_ops *ops)
+int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)
 {
        int ret;
-       struct parent_device *parent;
+       struct mdev_parent *parent;
 
        /* check for mandatory ops */
        if (!ops || !ops->create || !ops->remove || !ops->supported_type_groups)
@@ -229,7 +268,7 @@ EXPORT_SYMBOL(mdev_register_device);
 
 void mdev_unregister_device(struct device *dev)
 {
-       struct parent_device *parent;
+       struct mdev_parent *parent;
        bool force_remove = true;
 
        mutex_lock(&parent_list_lock);
@@ -266,7 +305,7 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid)
 {
        int ret;
        struct mdev_device *mdev;
-       struct parent_device *parent;
+       struct mdev_parent *parent;
        struct mdev_type *type = to_mdev_type(kobj);
 
        parent = mdev_get_parent(type->parent);
@@ -316,6 +355,11 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid)
        dev_dbg(&mdev->dev, "MDEV: created\n");
 
        mutex_unlock(&parent->lock);
+
+       mutex_lock(&mdev_list_lock);
+       list_add(&mdev->next, &mdev_list);
+       mutex_unlock(&mdev_list_lock);
+
        return ret;
 
 create_failed:
@@ -329,12 +373,30 @@ create_err:
 
 int mdev_device_remove(struct device *dev, bool force_remove)
 {
-       struct mdev_device *mdev;
-       struct parent_device *parent;
+       struct mdev_device *mdev, *tmp;
+       struct mdev_parent *parent;
        struct mdev_type *type;
        int ret;
+       bool found = false;
 
        mdev = to_mdev_device(dev);
+
+       mutex_lock(&mdev_list_lock);
+       list_for_each_entry(tmp, &mdev_list, next) {
+               if (tmp == mdev) {
+                       found = true;
+                       break;
+               }
+       }
+
+       if (found)
+               list_del(&mdev->next);
+
+       mutex_unlock(&mdev_list_lock);
+
+       if (!found)
+               return -ENODEV;
+
        type = to_mdev_type(mdev->type_kobj);
        parent = mdev->parent;
        mutex_lock(&parent->lock);
@@ -342,6 +404,11 @@ int mdev_device_remove(struct device *dev, bool force_remove)
        ret = mdev_device_remove_ops(mdev, force_remove);
        if (ret) {
                mutex_unlock(&parent->lock);
+
+               mutex_lock(&mdev_list_lock);
+               list_add(&mdev->next, &mdev_list);
+               mutex_unlock(&mdev_list_lock);
+
                return ret;
        }
 
@@ -349,7 +416,8 @@ int mdev_device_remove(struct device *dev, bool force_remove)
        device_unregister(dev);
        mutex_unlock(&parent->lock);
        mdev_put_parent(parent);
-       return ret;
+
+       return 0;
 }
 
 static int __init mdev_init(void)
index d35097cbf3d755c027b7a98a8e6daed835754117..a9cefd70a7050a45d88b77dfd17efeffd5d3e95f 100644 (file)
 int  mdev_bus_register(void);
 void mdev_bus_unregister(void);
 
+struct mdev_parent {
+       struct device *dev;
+       const struct mdev_parent_ops *ops;
+       struct kref ref;
+       struct mutex lock;
+       struct list_head next;
+       struct kset *mdev_types_kset;
+       struct list_head type_list;
+};
+
+struct mdev_device {
+       struct device dev;
+       struct mdev_parent *parent;
+       uuid_le uuid;
+       void *driver_data;
+       struct kref ref;
+       struct list_head next;
+       struct kobject *type_kobj;
+};
+
+#define to_mdev_device(dev)    container_of(dev, struct mdev_device, dev)
+#define dev_is_mdev(d)         ((d)->bus == &mdev_bus_type)
+
 struct mdev_type {
        struct kobject kobj;
        struct kobject *devices_kobj;
-       struct parent_device *parent;
+       struct mdev_parent *parent;
        struct list_head next;
        struct attribute_group *group;
 };
@@ -29,8 +52,8 @@ struct mdev_type {
 #define to_mdev_type(_kobj)            \
        container_of(_kobj, struct mdev_type, kobj)
 
-int  parent_create_sysfs_files(struct parent_device *parent);
-void parent_remove_sysfs_files(struct parent_device *parent);
+int  parent_create_sysfs_files(struct mdev_parent *parent);
+void parent_remove_sysfs_files(struct mdev_parent *parent);
 
 int  mdev_create_sysfs_files(struct device *dev, struct mdev_type *type);
 void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type);
index 1a53deb2ee102b677f92d7388eb340a6e0204ffd..802df210929ba5d52924c102867cbe55ba365963 100644 (file)
@@ -92,7 +92,7 @@ static struct kobj_type mdev_type_ktype = {
        .release = mdev_type_release,
 };
 
-struct mdev_type *add_mdev_supported_type(struct parent_device *parent,
+struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent,
                                          struct attribute_group *group)
 {
        struct mdev_type *type;
@@ -158,7 +158,7 @@ static void remove_mdev_supported_type(struct mdev_type *type)
        kobject_put(&type->kobj);
 }
 
-static int add_mdev_supported_type_groups(struct parent_device *parent)
+static int add_mdev_supported_type_groups(struct mdev_parent *parent)
 {
        int i;
 
@@ -183,7 +183,7 @@ static int add_mdev_supported_type_groups(struct parent_device *parent)
 }
 
 /* mdev sysfs functions */
-void parent_remove_sysfs_files(struct parent_device *parent)
+void parent_remove_sysfs_files(struct mdev_parent *parent)
 {
        struct mdev_type *type, *tmp;
 
@@ -196,7 +196,7 @@ void parent_remove_sysfs_files(struct parent_device *parent)
        kset_unregister(parent->mdev_types_kset);
 }
 
-int parent_create_sysfs_files(struct parent_device *parent)
+int parent_create_sysfs_files(struct mdev_parent *parent)
 {
        int ret;
 
index ffc36758cb84c08ce1b2c4d516bd73b0c18d52d1..fa848a701b8b4ed921ae56248eac3ef0fdc7d5a3 100644 (file)
@@ -27,7 +27,7 @@
 static int vfio_mdev_open(void *device_data)
 {
        struct mdev_device *mdev = device_data;
-       struct parent_device *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->parent;
        int ret;
 
        if (unlikely(!parent->ops->open))
@@ -46,7 +46,7 @@ static int vfio_mdev_open(void *device_data)
 static void vfio_mdev_release(void *device_data)
 {
        struct mdev_device *mdev = device_data;
-       struct parent_device *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->parent;
 
        if (likely(parent->ops->release))
                parent->ops->release(mdev);
@@ -58,7 +58,7 @@ static long vfio_mdev_unlocked_ioctl(void *device_data,
                                     unsigned int cmd, unsigned long arg)
 {
        struct mdev_device *mdev = device_data;
-       struct parent_device *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->parent;
 
        if (unlikely(!parent->ops->ioctl))
                return -EINVAL;
@@ -70,7 +70,7 @@ static ssize_t vfio_mdev_read(void *device_data, char __user *buf,
                              size_t count, loff_t *ppos)
 {
        struct mdev_device *mdev = device_data;
-       struct parent_device *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->parent;
 
        if (unlikely(!parent->ops->read))
                return -EINVAL;
@@ -82,7 +82,7 @@ static ssize_t vfio_mdev_write(void *device_data, const char __user *buf,
                               size_t count, loff_t *ppos)
 {
        struct mdev_device *mdev = device_data;
-       struct parent_device *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->parent;
 
        if (unlikely(!parent->ops->write))
                return -EINVAL;
@@ -93,7 +93,7 @@ static ssize_t vfio_mdev_write(void *device_data, const char __user *buf,
 static int vfio_mdev_mmap(void *device_data, struct vm_area_struct *vma)
 {
        struct mdev_device *mdev = device_data;
-       struct parent_device *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->parent;
 
        if (unlikely(!parent->ops->mmap))
                return -EINVAL;
index dcd7c2a9961830b7fd1ff4155d5c302cd55fd809..324c52e3a1a47736a819826eea2d1974e47c7a87 100644 (file)
@@ -1142,6 +1142,10 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)
                        return ret;
 
                vdev->barmap[index] = pci_iomap(pdev, index, 0);
+               if (!vdev->barmap[index]) {
+                       pci_release_selected_regions(pdev, 1 << index);
+                       return -ENOMEM;
+               }
        }
 
        vma->vm_private_data = vdev;
index 5ffd1d9ad4bdf8111a35a9b6b0c217109d238ebf..357243d76f108fe184d2079736726e89a0ad0846 100644 (file)
@@ -193,7 +193,10 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf,
        if (!vdev->has_vga)
                return -EINVAL;
 
-       switch (pos) {
+       if (pos > 0xbfffful)
+               return -EINVAL;
+
+       switch ((u32)pos) {
        case 0xa0000 ... 0xbffff:
                count = min(count, (size_t)(0xc0000 - pos));
                iomem = ioremap_nocache(0xa0000, 0xbffff - 0xa0000 + 1);
index f3726ba12aa6ceccff8a0c96523aa683537be8f4..9266271a787a70b61325d1e92ae9a8d710465f0c 100644 (file)
@@ -268,28 +268,38 @@ static void vfio_lock_acct(struct task_struct *task, long npage)
 {
        struct vwork *vwork;
        struct mm_struct *mm;
+       bool is_current;
 
        if (!npage)
                return;
 
-       mm = get_task_mm(task);
+       is_current = (task->mm == current->mm);
+
+       mm = is_current ? task->mm : get_task_mm(task);
        if (!mm)
-               return; /* process exited or nothing to do */
+               return; /* process exited */
 
        if (down_write_trylock(&mm->mmap_sem)) {
                mm->locked_vm += npage;
                up_write(&mm->mmap_sem);
-               mmput(mm);
+               if (!is_current)
+                       mmput(mm);
                return;
        }
 
+       if (is_current) {
+               mm = get_task_mm(task);
+               if (!mm)
+                       return;
+       }
+
        /*
         * Couldn't get mmap_sem lock, so must setup to update
         * mm->locked_vm later. If locked_vm were atomic, we
         * wouldn't need this silliness
         */
        vwork = kmalloc(sizeof(struct vwork), GFP_KERNEL);
-       if (!vwork) {
+       if (WARN_ON(!vwork)) {
                mmput(mm);
                return;
        }
@@ -393,77 +403,71 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr,
 static long vfio_pin_pages_remote(struct vfio_dma *dma, unsigned long vaddr,
                                  long npage, unsigned long *pfn_base)
 {
-       unsigned long limit;
-       bool lock_cap = ns_capable(task_active_pid_ns(dma->task)->user_ns,
-                                  CAP_IPC_LOCK);
-       struct mm_struct *mm;
-       long ret, i = 0, lock_acct = 0;
+       unsigned long limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
+       bool lock_cap = capable(CAP_IPC_LOCK);
+       long ret, pinned = 0, lock_acct = 0;
        bool rsvd;
        dma_addr_t iova = vaddr - dma->vaddr + dma->iova;
 
-       mm = get_task_mm(dma->task);
-       if (!mm)
+       /* This code path is only user initiated */
+       if (!current->mm)
                return -ENODEV;
 
-       ret = vaddr_get_pfn(mm, vaddr, dma->prot, pfn_base);
+       ret = vaddr_get_pfn(current->mm, vaddr, dma->prot, pfn_base);
        if (ret)
-               goto pin_pg_remote_exit;
+               return ret;
 
+       pinned++;
        rsvd = is_invalid_reserved_pfn(*pfn_base);
-       limit = task_rlimit(dma->task, RLIMIT_MEMLOCK) >> PAGE_SHIFT;
 
        /*
         * Reserved pages aren't counted against the user, externally pinned
         * pages are already counted against the user.
         */
        if (!rsvd && !vfio_find_vpfn(dma, iova)) {
-               if (!lock_cap && mm->locked_vm + 1 > limit) {
+               if (!lock_cap && current->mm->locked_vm + 1 > limit) {
                        put_pfn(*pfn_base, dma->prot);
                        pr_warn("%s: RLIMIT_MEMLOCK (%ld) exceeded\n", __func__,
                                        limit << PAGE_SHIFT);
-                       ret = -ENOMEM;
-                       goto pin_pg_remote_exit;
+                       return -ENOMEM;
                }
                lock_acct++;
        }
 
-       i++;
-       if (likely(!disable_hugepages)) {
-               /* Lock all the consecutive pages from pfn_base */
-               for (vaddr += PAGE_SIZE, iova += PAGE_SIZE; i < npage;
-                    i++, vaddr += PAGE_SIZE, iova += PAGE_SIZE) {
-                       unsigned long pfn = 0;
+       if (unlikely(disable_hugepages))
+               goto out;
 
-                       ret = vaddr_get_pfn(mm, vaddr, dma->prot, &pfn);
-                       if (ret)
-                               break;
+       /* Lock all the consecutive pages from pfn_base */
+       for (vaddr += PAGE_SIZE, iova += PAGE_SIZE; pinned < npage;
+            pinned++, vaddr += PAGE_SIZE, iova += PAGE_SIZE) {
+               unsigned long pfn = 0;
 
-                       if (pfn != *pfn_base + i ||
-                           rsvd != is_invalid_reserved_pfn(pfn)) {
+               ret = vaddr_get_pfn(current->mm, vaddr, dma->prot, &pfn);
+               if (ret)
+                       break;
+
+               if (pfn != *pfn_base + pinned ||
+                   rsvd != is_invalid_reserved_pfn(pfn)) {
+                       put_pfn(pfn, dma->prot);
+                       break;
+               }
+
+               if (!rsvd && !vfio_find_vpfn(dma, iova)) {
+                       if (!lock_cap &&
+                           current->mm->locked_vm + lock_acct + 1 > limit) {
                                put_pfn(pfn, dma->prot);
+                               pr_warn("%s: RLIMIT_MEMLOCK (%ld) exceeded\n",
+                                       __func__, limit << PAGE_SHIFT);
                                break;
                        }
-
-                       if (!rsvd && !vfio_find_vpfn(dma, iova)) {
-                               if (!lock_cap &&
-                                   mm->locked_vm + lock_acct + 1 > limit) {
-                                       put_pfn(pfn, dma->prot);
-                                       pr_warn("%s: RLIMIT_MEMLOCK (%ld) "
-                                               "exceeded\n", __func__,
-                                               limit << PAGE_SHIFT);
-                                       break;
-                               }
-                               lock_acct++;
-                       }
+                       lock_acct++;
                }
        }
 
-       vfio_lock_acct(dma->task, lock_acct);
-       ret = i;
+out:
+       vfio_lock_acct(current, lock_acct);
 
-pin_pg_remote_exit:
-       mmput(mm);
-       return ret;
+       return pinned;
 }
 
 static long vfio_unpin_pages_remote(struct vfio_dma *dma, dma_addr_t iova,
@@ -473,10 +477,10 @@ static long vfio_unpin_pages_remote(struct vfio_dma *dma, dma_addr_t iova,
        long unlocked = 0, locked = 0;
        long i;
 
-       for (i = 0; i < npage; i++) {
+       for (i = 0; i < npage; i++, iova += PAGE_SIZE) {
                if (put_pfn(pfn++, dma->prot)) {
                        unlocked++;
-                       if (vfio_find_vpfn(dma, iova + (i << PAGE_SHIFT)))
+                       if (vfio_find_vpfn(dma, iova))
                                locked++;
                }
        }
index 1e11614322feca2fc699d1d6a2dc4ec6eb14ac74..42d02a206059b55b198c797d5c8816dbe7c0a872 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/slab.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/gio_device.h>
index 17f21cedff9b549c018ba62c620123d2958f6ce0..c0c6b88d383915fe6e5924bd49434f6a13170278 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/vmalloc.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fb.h>
 #include <linux/init.h>
 
index 2d3b691f3fc4885414ae9234950d8e9c798e5fe6..038ac6934fe9d7f865f9711f24fecadc27071b65 100644 (file)
@@ -308,6 +308,11 @@ static int cobalt_lcdfb_probe(struct platform_device *dev)
        info->screen_size = resource_size(res);
        info->screen_base = devm_ioremap(&dev->dev, res->start,
                                         info->screen_size);
+       if (!info->screen_base) {
+               framebuffer_release(info);
+               return -ENOMEM;
+       }
+
        info->fbops = &cobalt_lcd_fbops;
        info->fix = cobalt_lcdfb_fix;
        info->fix.smem_start = res->start;
index 9d68dc9ee7bf2a3e70f04298df0b295db8751fac..abe3e54d45064d6f929c96e369c0c7a3ca78fbb6 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/fb.h>
 
 #include <asm/machvec.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/hd64461.h>
index 9476d196f510c2c93e9275befc652bda0b7412f7..16f16f5e1a4bbc1e7d93d97d4b29b0f0356cb11a 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/dio.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static struct fb_info fb_info = {
        .fix = {
index 8778e01cebac642fe4a03a7d292c967d9e3eb13a..1c3c7ab26a959d7dd88f8da0d25f7bc9cecaed9d 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/platform_data/video-mx3fb.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define MX3FB_NAME             "mx3_sdc_fb"
 
index 7487f76f62750d3f3e7e59911ec6aef98c53cf7e..04ea330ccf5da2501d679fd929bad51cf90f58cf 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/setup.h>
 #include <asm/q40_master.h>
 #include <linux/fb.h>
index d0a4e2f79a5703c3b0ed1b968fcac40f43052968..d80bc8a3200fa9c8435bc0b606a4bae0f02728f1 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/console.h>
 #include <linux/io.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/div64.h>
 
 #ifdef CONFIG_PM
index 7df4228e25f05fa24c6275dce7c940b3f93c63f8..accfef71e984763ce83a380337199d0915b5c649 100644 (file)
@@ -67,7 +67,7 @@
 #include <linux/io.h>
 
 #include <asm/grfioctl.h>      /* for HP-UX compatibility */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "sticore.h"
 
index 10951c82f6ed61fa343ddfcf6f8ff64a65dab35c..d570e19a286494da5f3524d23ff7a3f2d0267cd9 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/vmalloc.h>
 #include <linux/module.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <video/w100fb.h>
 #include "w100fb.h"
 
index 3eb58cb51e5648f87f5d732e33cde8c6cd49569d..acb00b53a5207b46252e8f06c1860702f1ccfbe4 100644 (file)
@@ -72,16 +72,16 @@ config SOFT_WATCHDOG
          module will be called softdog.
 
 config DA9052_WATCHDOG
-        tristate "Dialog DA9052 Watchdog"
-        depends on PMIC_DA9052
-        select WATCHDOG_CORE
-        help
-          Support for the watchdog in the DA9052 PMIC. Watchdog trigger
-          cause system reset.
+       tristate "Dialog DA9052 Watchdog"
+       depends on PMIC_DA9052
+       select WATCHDOG_CORE
+       help
+         Support for the watchdog in the DA9052 PMIC. Watchdog trigger
+         cause system reset.
 
-          Say Y here to include support for the DA9052 watchdog.
-          Alternatively say M to compile the driver as a module,
-          which will be called da9052_wdt.
+         Say Y here to include support for the DA9052 watchdog.
+         Alternatively say M to compile the driver as a module,
+         which will be called da9052_wdt.
 
 config DA9055_WATCHDOG
        tristate "Dialog Semiconductor DA9055 Watchdog"
@@ -104,11 +104,11 @@ config DA9063_WATCHDOG
          This driver can be built as a module. The module name is da9063_wdt.
 
 config DA9062_WATCHDOG
-       tristate "Dialog DA9062 Watchdog"
+       tristate "Dialog DA9062/61 Watchdog"
        depends on MFD_DA9062
        select WATCHDOG_CORE
        help
-         Support for the watchdog in the DA9062 PMIC.
+         Support for the watchdog in the DA9062 and DA9061 PMICs.
 
          This driver can be built as a module. The module name is da9062_wdt.
 
@@ -1008,8 +1008,8 @@ config IT87_WDT
        tristate "IT87 Watchdog Timer"
        depends on X86
        ---help---
-         This is the driver for the hardware watchdog on the ITE IT8702,
-         IT8712, IT8716, IT8718, IT8720, IT8721, IT8726 and IT8728
+         This is the driver for the hardware watchdog on the ITE IT8620,
+         IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726 and IT8728
          Super I/O chips.
 
          If the driver does not work, then make sure that the game port in
@@ -1514,6 +1514,13 @@ config LANTIQ_WDT
        help
          Hardware driver for the Lantiq SoC Watchdog Timer.
 
+config LOONGSON1_WDT
+       tristate "Loongson1 SoC hardware watchdog"
+       depends on MACH_LOONGSON32
+       select WATCHDOG_CORE
+       help
+         Hardware driver for the Loongson1 SoC Watchdog Timer.
+
 config RALINK_WDT
        tristate "Ralink SoC watchdog"
        select WATCHDOG_CORE
@@ -1624,16 +1631,16 @@ config BOOKE_WDT_DEFAULT_TIMEOUT
          The value can be overridden by the wdt_period command-line parameter.
 
 config MEN_A21_WDT
-       tristate "MEN A21 VME CPU Carrier Board Watchdog Timer"
-       select WATCHDOG_CORE
-       depends on GPIOLIB || COMPILE_TEST
-       help
-        Watchdog driver for MEN A21 VMEbus CPU Carrier Boards.
+       tristate "MEN A21 VME CPU Carrier Board Watchdog Timer"
+       select WATCHDOG_CORE
+       depends on GPIOLIB || COMPILE_TEST
+       help
+         Watchdog driver for MEN A21 VMEbus CPU Carrier Boards.
 
-       The driver can also be built as a module. If so, the module will be
-       called mena21_wdt.
+         The driver can also be built as a module. If so, the module will be
+         called mena21_wdt.
 
-       If unsure select N here.
+         If unsure select N here.
 
 # PPC64 Architecture
 
index caa9f4aa492ad27e4d1a1c0711d19bfc1906a5c3..0c3d35e3c3341541fc4140797653611a1bed88a8 100644 (file)
@@ -163,6 +163,7 @@ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
 obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o
 octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
 obj-$(CONFIG_LANTIQ_WDT) += lantiq_wdt.o
+obj-$(CONFIG_LOONGSON1_WDT) += loongson1_wdt.o
 obj-$(CONFIG_RALINK_WDT) += rt2880_wdt.o
 obj-$(CONFIG_IMGPDC_WDT) += imgpdc_wdt.o
 obj-$(CONFIG_MT7621_WDT) += mt7621_wdt.o
index 4dddd8298a227d64862f2e92954a465f2e44b3f6..c32c45bd8b097889c8f322255fa63c8ed507d6ab 100644 (file)
@@ -55,6 +55,15 @@ struct bcm2835_wdt {
 static unsigned int heartbeat;
 static bool nowayout = WATCHDOG_NOWAYOUT;
 
+static bool bcm2835_wdt_is_running(struct bcm2835_wdt *wdt)
+{
+       uint32_t cur;
+
+       cur = readl(wdt->base + PM_RSTC);
+
+       return !!(cur & PM_RSTC_WRCFG_FULL_RESET);
+}
+
 static int bcm2835_wdt_start(struct watchdog_device *wdog)
 {
        struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
@@ -181,6 +190,17 @@ static int bcm2835_wdt_probe(struct platform_device *pdev)
        watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev);
        watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout);
        bcm2835_wdt_wdd.parent = &pdev->dev;
+       if (bcm2835_wdt_is_running(wdt)) {
+               /*
+                * The currently active timeout value (set by the
+                * bootloader) may be different from the module
+                * heartbeat parameter or the value in device
+                * tree. But we just need to set WDOG_HW_RUNNING,
+                * because then the framework will "immediately" ping
+                * the device, updating the timeout.
+                */
+               set_bit(WDOG_HW_RUNNING, &bcm2835_wdt_wdd.status);
+       }
        err = watchdog_register_device(&bcm2835_wdt_wdd);
        if (err) {
                dev_err(dev, "Failed to register watchdog device");
index e238df4d75a23fdbd54d7e242452d8a6f5c8d1fd..4814c00b32f6de8c47b6c112988ce3837ffe7f81 100644 (file)
@@ -216,6 +216,7 @@ static const struct of_device_id bcm7038_wdt_match[] = {
        { .compatible = "brcm,bcm7038-wdt" },
        {},
 };
+MODULE_DEVICE_TABLE(of, bcm7038_wdt_match);
 
 static struct platform_driver bcm7038_wdt_driver = {
        .probe          = bcm7038_wdt_probe,
index 71ee07950e630492a29f007cab84ddc04525cb69..3d43775548e59cda1966146897daa4b6d396b471 100644 (file)
@@ -538,12 +538,9 @@ static int cpwd_probe(struct platform_device *op)
        if (cpwd_device)
                return -EINVAL;
 
-       p = kzalloc(sizeof(*p), GFP_KERNEL);
-       err = -ENOMEM;
-       if (!p) {
-               pr_err("Unable to allocate struct cpwd\n");
-               goto out;
-       }
+       p = devm_kzalloc(&op->dev, sizeof(*p), GFP_KERNEL);
+       if (!p)
+               return -ENOMEM;
 
        p->irq = op->archdata.irqs[0];
 
@@ -553,12 +550,12 @@ static int cpwd_probe(struct platform_device *op)
                             4 * WD_TIMER_REGSZ, DRIVER_NAME);
        if (!p->regs) {
                pr_err("Unable to map registers\n");
-               goto out_free;
+               return -ENOMEM;
        }
 
        options = of_find_node_by_path("/options");
-       err = -ENODEV;
        if (!options) {
+               err = -ENODEV;
                pr_err("Unable to find /options node\n");
                goto out_iounmap;
        }
@@ -620,10 +617,7 @@ static int cpwd_probe(struct platform_device *op)
 
        platform_set_drvdata(op, p);
        cpwd_device = p;
-       err = 0;
-
-out:
-       return err;
+       return 0;
 
 out_unregister:
        for (i--; i >= 0; i--)
@@ -632,9 +626,7 @@ out_unregister:
 out_iounmap:
        of_iounmap(&op->resource[0], p->regs, 4 * WD_TIMER_REGSZ);
 
-out_free:
-       kfree(p);
-       goto out;
+       return err;
 }
 
 static int cpwd_remove(struct platform_device *op)
@@ -659,7 +651,6 @@ static int cpwd_remove(struct platform_device *op)
                free_irq(p->irq, p);
 
        of_iounmap(&op->resource[0], p->regs, 4 * WD_TIMER_REGSZ);
-       kfree(p);
 
        cpwd_device = NULL;
 
index 7386111220d58480c298f1612305410485eedc2f..a02cee6820a1593ede5ff6969c48451aa2727e8d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * da9062_wdt.c - WDT device driver for DA9062
+ * Watchdog device driver for DA9062 and DA9061 PMICs
  * Copyright (C) 2015  Dialog Semiconductor Ltd.
  *
  * This program is free software; you can redistribute it and/or
@@ -188,6 +188,13 @@ static const struct watchdog_ops da9062_watchdog_ops = {
        .set_timeout = da9062_wdt_set_timeout,
 };
 
+static const struct of_device_id da9062_compatible_id_table[] = {
+       { .compatible = "dlg,da9062-watchdog", },
+       { },
+};
+
+MODULE_DEVICE_TABLE(of, da9062_compatible_id_table);
+
 static int da9062_wdt_probe(struct platform_device *pdev)
 {
        int ret;
@@ -244,11 +251,12 @@ static struct platform_driver da9062_wdt_driver = {
        .remove = da9062_wdt_remove,
        .driver = {
                .name = "da9062-watchdog",
+               .of_match_table = da9062_compatible_id_table,
        },
 };
 module_platform_driver(da9062_wdt_driver);
 
 MODULE_AUTHOR("S Twiss <stwiss.opensource@diasemi.com>");
-MODULE_DESCRIPTION("WDT device driver for Dialog DA9062");
+MODULE_DESCRIPTION("WDT device driver for Dialog DA9062 and DA9061");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:da9062-watchdog");
index 17454ca653f42c6cc5154966f0da619094c8e594..0e731d797a2a3dc0adcd0074bc5beefe252bd8f2 100644 (file)
@@ -166,8 +166,12 @@ static int davinci_wdt_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        davinci_wdt->clk = devm_clk_get(dev, NULL);
-       if (WARN_ON(IS_ERR(davinci_wdt->clk)))
+
+       if (IS_ERR(davinci_wdt->clk)) {
+               if (PTR_ERR(davinci_wdt->clk) != -EPROBE_DEFER)
+                       dev_err(&pdev->dev, "failed to get clock node\n");
                return PTR_ERR(davinci_wdt->clk);
+       }
 
        clk_prepare_enable(davinci_wdt->clk);
 
index db36d12e2b52301da6300514d99e380db669da5d..a4b729259b122fe4c18a9f4fcd6080446e635c34 100644 (file)
@@ -43,6 +43,7 @@ static inline int wdt_command(int sub, u32 *in, int inlen)
 
 static int wdt_start(struct watchdog_device *wd)
 {
+       struct device *dev = watchdog_get_drvdata(wd);
        int ret, in_size;
        int timeout = wd->timeout;
        struct ipc_wd_start {
@@ -57,36 +58,32 @@ static int wdt_start(struct watchdog_device *wd)
        in_size = DIV_ROUND_UP(sizeof(ipc_wd_start), 4);
 
        ret = wdt_command(SCU_WATCHDOG_START, (u32 *)&ipc_wd_start, in_size);
-       if (ret) {
-               struct device *dev = watchdog_get_drvdata(wd);
+       if (ret)
                dev_crit(dev, "error starting watchdog: %d\n", ret);
-       }
 
        return ret;
 }
 
 static int wdt_ping(struct watchdog_device *wd)
 {
+       struct device *dev = watchdog_get_drvdata(wd);
        int ret;
 
        ret = wdt_command(SCU_WATCHDOG_KEEPALIVE, NULL, 0);
-       if (ret) {
-               struct device *dev = watchdog_get_drvdata(wd);
-               dev_crit(dev, "Error executing keepalive: 0x%x\n", ret);
-       }
+       if (ret)
+               dev_crit(dev, "Error executing keepalive: %d\n", ret);
 
        return ret;
 }
 
 static int wdt_stop(struct watchdog_device *wd)
 {
+       struct device *dev = watchdog_get_drvdata(wd);
        int ret;
 
        ret = wdt_command(SCU_WATCHDOG_STOP, NULL, 0);
-       if (ret) {
-               struct device *dev = watchdog_get_drvdata(wd);
-               dev_crit(dev, "Error stopping watchdog: 0x%x\n", ret);
-       }
+       if (ret)
+               dev_crit(dev, "Error stopping watchdog: %d\n", ret);
 
        return ret;
 }
@@ -151,6 +148,9 @@ static int mid_wdt_probe(struct platform_device *pdev)
                return ret;
        }
 
+       /* Make sure the watchdog is not running */
+       wdt_stop(wdt_dev);
+
        ret = watchdog_register_device(wdt_dev);
        if (ret) {
                dev_err(&pdev->dev, "error registering watchdog device\n");
index e54839b12650a52f22dffe2292ca2268fbef91d7..b9878c41598fa53e25d37264f5a2876948f69985 100644 (file)
@@ -12,7 +12,7 @@
  *                 http://www.ite.com.tw/
  *
  *     Support of the watchdog timers, which are available on
- *     IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726,
+ *     IT8620, IT8702, IT8712, IT8716, IT8718, IT8720, IT8721, IT8726,
  *     IT8728 and IT8783.
  *
  *     This program is free software; you can redistribute it and/or
@@ -78,6 +78,7 @@
 
 /* Chip Id numbers */
 #define NO_DEV_ID      0xffff
+#define IT8620_ID      0x8620
 #define IT8702_ID      0x8702
 #define IT8705_ID      0x8705
 #define IT8712_ID      0x8712
@@ -630,6 +631,7 @@ static int __init it87_wdt_init(void)
        case IT8726_ID:
                max_units = 65535;
                break;
+       case IT8620_ID:
        case IT8718_ID:
        case IT8720_ID:
        case IT8721_ID:
index c8d51ddb26d5d26acb3c14251a60cdeb21b0be2c..20627f22baf6a7004f74218b13152933d902b03b 100644 (file)
@@ -148,7 +148,7 @@ static const struct of_device_id jz4740_wdt_of_matches[] = {
        { .compatible = "ingenic,jz4740-watchdog", },
        { /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, jz4740_wdt_of_matches)
+MODULE_DEVICE_TABLE(of, jz4740_wdt_of_matches);
 #endif
 
 static int jz4740_wdt_probe(struct platform_device *pdev)
diff --git a/drivers/watchdog/loongson1_wdt.c b/drivers/watchdog/loongson1_wdt.c
new file mode 100644 (file)
index 0000000..3aee50c
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2016 Yang Ling <gnaygnil@gmail.com>
+ *
+ * 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.
+ */
+
+#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/watchdog.h>
+#include <loongson1.h>
+
+#define DEFAULT_HEARTBEAT      30
+
+static bool nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, bool, 0444);
+
+static unsigned int heartbeat;
+module_param(heartbeat, uint, 0444);
+
+struct ls1x_wdt_drvdata {
+       void __iomem *base;
+       struct clk *clk;
+       unsigned long clk_rate;
+       struct watchdog_device wdt;
+};
+
+static int ls1x_wdt_ping(struct watchdog_device *wdt_dev)
+{
+       struct ls1x_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev);
+
+       writel(0x1, drvdata->base + WDT_SET);
+
+       return 0;
+}
+
+static int ls1x_wdt_set_timeout(struct watchdog_device *wdt_dev,
+                               unsigned int timeout)
+{
+       struct ls1x_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev);
+       unsigned int max_hw_heartbeat = wdt_dev->max_hw_heartbeat_ms / 1000;
+       unsigned int counts;
+
+       wdt_dev->timeout = timeout;
+
+       counts = drvdata->clk_rate * min(timeout, max_hw_heartbeat);
+       writel(counts, drvdata->base + WDT_TIMER);
+
+       return 0;
+}
+
+static int ls1x_wdt_start(struct watchdog_device *wdt_dev)
+{
+       struct ls1x_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev);
+
+       writel(0x1, drvdata->base + WDT_EN);
+
+       return 0;
+}
+
+static int ls1x_wdt_stop(struct watchdog_device *wdt_dev)
+{
+       struct ls1x_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev);
+
+       writel(0x0, drvdata->base + WDT_EN);
+
+       return 0;
+}
+
+static const struct watchdog_info ls1x_wdt_info = {
+       .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
+       .identity = "Loongson1 Watchdog",
+};
+
+static const struct watchdog_ops ls1x_wdt_ops = {
+       .owner = THIS_MODULE,
+       .start = ls1x_wdt_start,
+       .stop = ls1x_wdt_stop,
+       .ping = ls1x_wdt_ping,
+       .set_timeout = ls1x_wdt_set_timeout,
+};
+
+static int ls1x_wdt_probe(struct platform_device *pdev)
+{
+       struct ls1x_wdt_drvdata *drvdata;
+       struct watchdog_device *ls1x_wdt;
+       unsigned long clk_rate;
+       struct resource *res;
+       int err;
+
+       drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
+       if (!drvdata)
+               return -ENOMEM;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       drvdata->base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(drvdata->base))
+               return PTR_ERR(drvdata->base);
+
+       drvdata->clk = devm_clk_get(&pdev->dev, pdev->name);
+       if (IS_ERR(drvdata->clk))
+               return PTR_ERR(drvdata->clk);
+
+       err = clk_prepare_enable(drvdata->clk);
+       if (err) {
+               dev_err(&pdev->dev, "clk enable failed\n");
+               return err;
+       }
+
+       clk_rate = clk_get_rate(drvdata->clk);
+       if (!clk_rate) {
+               err = -EINVAL;
+               goto err0;
+       }
+       drvdata->clk_rate = clk_rate;
+
+       ls1x_wdt = &drvdata->wdt;
+       ls1x_wdt->info = &ls1x_wdt_info;
+       ls1x_wdt->ops = &ls1x_wdt_ops;
+       ls1x_wdt->timeout = DEFAULT_HEARTBEAT;
+       ls1x_wdt->min_timeout = 1;
+       ls1x_wdt->max_hw_heartbeat_ms = U32_MAX / clk_rate * 1000;
+       ls1x_wdt->parent = &pdev->dev;
+
+       watchdog_init_timeout(ls1x_wdt, heartbeat, &pdev->dev);
+       watchdog_set_nowayout(ls1x_wdt, nowayout);
+       watchdog_set_drvdata(ls1x_wdt, drvdata);
+
+       err = watchdog_register_device(&drvdata->wdt);
+       if (err) {
+               dev_err(&pdev->dev, "failed to register watchdog device\n");
+               goto err0;
+       }
+
+       platform_set_drvdata(pdev, drvdata);
+
+       dev_info(&pdev->dev, "Loongson1 Watchdog driver registered\n");
+
+       return 0;
+err0:
+       clk_disable_unprepare(drvdata->clk);
+       return err;
+}
+
+static int ls1x_wdt_remove(struct platform_device *pdev)
+{
+       struct ls1x_wdt_drvdata *drvdata = platform_get_drvdata(pdev);
+
+       watchdog_unregister_device(&drvdata->wdt);
+       clk_disable_unprepare(drvdata->clk);
+
+       return 0;
+}
+
+static struct platform_driver ls1x_wdt_driver = {
+       .probe = ls1x_wdt_probe,
+       .remove = ls1x_wdt_remove,
+       .driver = {
+               .name = "ls1x-wdt",
+       },
+};
+
+module_platform_driver(ls1x_wdt_driver);
+
+MODULE_AUTHOR("Yang Ling <gnaygnil@gmail.com>");
+MODULE_DESCRIPTION("Loongson1 Watchdog Driver");
+MODULE_LICENSE("GPL");
index 48b84df2afda5fe8db8be6f423caab6660b9d911..68c41fa2be27bde7fdea632bdc72840b8de61fcf 100644 (file)
@@ -205,6 +205,7 @@ static struct platform_device_id max77620_wdt_devtype[] = {
        { .name = "max77620-watchdog", },
        { },
 };
+MODULE_DEVICE_TABLE(platform, max77620_wdt_devtype);
 
 static struct platform_driver max77620_wdt_driver = {
        .driver = {
index 79b35515904e069fcb0f296975fedb59386e45c5..b29c6fde7473ac78cfeed0790c07b761c27239c8 100644 (file)
@@ -389,6 +389,8 @@ static int mei_wdt_register(struct mei_wdt *wdt)
        wdt->wdd.max_timeout = MEI_WDT_MAX_TIMEOUT;
 
        watchdog_set_drvdata(&wdt->wdd, wdt);
+       watchdog_stop_on_reboot(&wdt->wdd);
+
        ret = watchdog_register_device(&wdt->wdd);
        if (ret) {
                dev_err(dev, "unable to register watchdog device = %d.\n", ret);
index 44d180a2c5e571f3cc3f3f0d36a7c47fcd617ddb..45d47664a00a1a05598f46b79fb0d4c99274e747 100644 (file)
@@ -264,7 +264,6 @@ static struct platform_driver meson_gxbb_wdt_driver = {
 
 module_platform_driver(meson_gxbb_wdt_driver);
 
-MODULE_ALIAS("platform:meson-gxbb-wdt");
 MODULE_AUTHOR("Neil Armstrong <narmstrong@baylibre.com>");
 MODULE_DESCRIPTION("Amlogic Meson GXBB Watchdog timer driver");
 MODULE_LICENSE("Dual BSD/GPL");
index 5f2273aac37d5df1115e516bf5b6544967b89353..366e5c7e650bfd4b3da3fddcebd9bc9ab86a23ac 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/timer.h>
-#include <linux/miscdevice.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/module.h>
index 529182d7d8a7964c721aeb7a486e2166ef7b1173..b5cdceb36cff785fa93d87390fea1aa8ae9cfb49 100644 (file)
@@ -56,7 +56,6 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/miscdevice.h>
 #include <linux/interrupt.h>
 #include <linux/watchdog.h>
 #include <linux/cpumask.h>
index 5796b5d1b3f2cbe135f8b3241ca2b497514a0061..4f47b5e9095662cfdb0ff928118fcbf17668d566 100644 (file)
@@ -209,7 +209,7 @@ static int qcom_wdt_probe(struct platform_device *pdev)
        wdt->wdd.parent = &pdev->dev;
        wdt->layout = regs;
 
-       if (readl(wdt->base + WDT_STS) & 1)
+       if (readl(wdt_addr(wdt, WDT_STS)) & 1)
                wdt->wdd.bootstatus = WDIOF_CARDRESET;
 
        /*
index 778acf80aacbf81042a3debc4ca1e90d58037f6c..85dd20e0572678581ffa03a8ff6b734773230d1e 100644 (file)
@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,
        xen_pfn_t *gpfns;
        xen_ulong_t *idxs;
        int *errs;
-       struct xen_add_to_physmap_range xatp;
 
        for (i = 0; i < count; i++) {
+               struct xen_add_to_physmap_range xatp = {
+                       .domid = DOMID_SELF,
+                       .space = XENMAPSPACE_dev_mmio
+               };
+
                r = &resources[i];
                nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE);
                if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0))
@@ -87,9 +91,7 @@ static int xen_map_device_mmio(const struct resource *resources,
                        idxs[j] = XEN_PFN_DOWN(r->start) + j;
                }
 
-               xatp.domid = DOMID_SELF;
                xatp.size = nr;
-               xatp.space = XENMAPSPACE_dev_mmio;
 
                set_xen_guest_handle(xatp.gpfns, gpfns);
                set_xen_guest_handle(xatp.idxs, idxs);
index 7ef27c6ed72fb397167aaf86384da4adf947d6e6..3c41470c7fc4f123b845bc611bb6ea1d48aabc92 100644 (file)
@@ -369,8 +369,7 @@ static void evtchn_fifo_resume(void)
                }
 
                ret = init_control_block(cpu, control_block);
-               if (ret < 0)
-                       BUG();
+               BUG_ON(ret < 0);
        }
 
        /*
@@ -445,7 +444,7 @@ int __init xen_evtchn_fifo_init(void)
        evtchn_ops = &evtchn_ops_fifo;
 
        cpuhp_setup_state_nocalls(CPUHP_XEN_EVTCHN_PREPARE,
-                                 "CPUHP_XEN_EVTCHN_PREPARE",
+                                 "xen/evtchn:prepare",
                                  xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead);
 out:
        put_cpu();
index e8c7f09d01be8a483df94db111faec580beb032a..6890897a6f30edab0c0d87926942463f9b481aa9 100644 (file)
@@ -125,7 +125,7 @@ static int add_evtchn(struct per_user_data *u, struct user_evtchn *evtchn)
        while (*new) {
                struct user_evtchn *this;
 
-               this = container_of(*new, struct user_evtchn, node);
+               this = rb_entry(*new, struct user_evtchn, node);
 
                parent = *new;
                if (this->port < evtchn->port)
@@ -157,7 +157,7 @@ static struct user_evtchn *find_evtchn(struct per_user_data *u, unsigned port)
        while (node) {
                struct user_evtchn *evtchn;
 
-               evtchn = container_of(node, struct user_evtchn, node);
+               evtchn = rb_entry(node, struct user_evtchn, node);
 
                if (evtchn->port < port)
                        node = node->rb_left;
index 478fb91e3df2b8a9f8c75d8538668465feb59462..f905d6eeb0482ee481cb24d9714bc6081a852d1e 100644 (file)
@@ -275,6 +275,10 @@ retry:
                rc = 0;
        } else
                rc = swiotlb_late_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs);
+
+       if (!rc)
+               swiotlb_set_max_segment(PAGE_SIZE);
+
        return rc;
 error:
        if (repeat--) {
@@ -392,7 +396,7 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
        if (dma_capable(dev, dev_addr, size) &&
            !range_straddles_page_boundary(phys, size) &&
                !xen_arch_need_swiotlb(dev, phys, dev_addr) &&
-               !swiotlb_force) {
+               (swiotlb_force != SWIOTLB_FORCE)) {
                /* we are not interested in the dma_addr returned by
                 * xen_dma_map_page, only in the potential cache flushes executed
                 * by the function. */
@@ -552,7 +556,7 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
                phys_addr_t paddr = sg_phys(sg);
                dma_addr_t dev_addr = xen_phys_to_bus(paddr);
 
-               if (swiotlb_force ||
+               if (swiotlb_force == SWIOTLB_FORCE ||
                    xen_arch_need_swiotlb(hwdev, paddr, dev_addr) ||
                    !dma_capable(hwdev, dev_addr, sg->length) ||
                    range_straddles_page_boundary(paddr, sg->length)) {
index e74f9c1fbd80a9fe4c6cfbba0176785b005c06fd..867a2e4252086531bcd682367838f4c4c169427d 100644 (file)
@@ -42,7 +42,6 @@ int xb_write(const void *data, unsigned len);
 int xb_read(void *data, unsigned len);
 int xb_data_to_read(void);
 int xb_wait_for_data_to_read(void);
-int xs_input_avail(void);
 extern struct xenstore_domain_interface *xen_store_interface;
 extern int xen_store_evtchn;
 extern enum xenstore_init xen_store_domain_type;
index 6c0ead4be784340019e69942a8d704ab088ea202..79130b31024754dc7560f60732545a8f28c103b1 100644 (file)
@@ -302,6 +302,29 @@ static void watch_fired(struct xenbus_watch *watch,
        mutex_unlock(&adap->dev_data->reply_mutex);
 }
 
+static int xenbus_command_reply(struct xenbus_file_priv *u,
+                               unsigned int msg_type, const char *reply)
+{
+       struct {
+               struct xsd_sockmsg hdr;
+               const char body[16];
+       } msg;
+       int rc;
+
+       msg.hdr = u->u.msg;
+       msg.hdr.type = msg_type;
+       msg.hdr.len = strlen(reply) + 1;
+       if (msg.hdr.len > sizeof(msg.body))
+               return -E2BIG;
+
+       mutex_lock(&u->reply_mutex);
+       rc = queue_reply(&u->read_buffers, &msg, sizeof(msg.hdr) + msg.hdr.len);
+       wake_up(&u->read_waitq);
+       mutex_unlock(&u->reply_mutex);
+
+       return rc;
+}
+
 static int xenbus_write_transaction(unsigned msg_type,
                                    struct xenbus_file_priv *u)
 {
@@ -316,12 +339,12 @@ static int xenbus_write_transaction(unsigned msg_type,
                        rc = -ENOMEM;
                        goto out;
                }
-       } else if (msg_type == XS_TRANSACTION_END) {
+       } else if (u->u.msg.tx_id != 0) {
                list_for_each_entry(trans, &u->transactions, list)
                        if (trans->handle.id == u->u.msg.tx_id)
                                break;
                if (&trans->list == &u->transactions)
-                       return -ESRCH;
+                       return xenbus_command_reply(u, XS_ERROR, "ENOENT");
        }
 
        reply = xenbus_dev_request_and_reply(&u->u.msg);
@@ -372,12 +395,12 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
        path = u->u.buffer + sizeof(u->u.msg);
        token = memchr(path, 0, u->u.msg.len);
        if (token == NULL) {
-               rc = -EILSEQ;
+               rc = xenbus_command_reply(u, XS_ERROR, "EINVAL");
                goto out;
        }
        token++;
        if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) {
-               rc = -EILSEQ;
+               rc = xenbus_command_reply(u, XS_ERROR, "EINVAL");
                goto out;
        }
 
@@ -411,23 +434,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
        }
 
        /* Success.  Synthesize a reply to say all is OK. */
-       {
-               struct {
-                       struct xsd_sockmsg hdr;
-                       char body[3];
-               } __packed reply = {
-                       {
-                               .type = msg_type,
-                               .len = sizeof(reply.body)
-                       },
-                       "OK"
-               };
-
-               mutex_lock(&u->reply_mutex);
-               rc = queue_reply(&u->read_buffers, &reply, sizeof(reply));
-               wake_up(&u->read_waitq);
-               mutex_unlock(&u->reply_mutex);
-       }
+       rc = xenbus_command_reply(u, msg_type, "OK");
 
 out:
        return rc;
index 6ac2579da0ebb1355450474204807701e47e2e08..05397305fccd16acddde83d3c18988b42349d52d 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/export.h>
 
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/amigahw.h>
 #include <asm/setup.h>
 
index d7b78d531e63f99f6e2a350e081c9836918b64b5..6a0f3fa85ef7c3390fa00d79c0b1773f41a68778 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/list.h>
 #include <linux/pagemap.h>
 #include <linux/utsname.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/idr.h>
 #include <linux/uio.h>
 #include <linux/slab.h>
index 2853b40953442c44be94c3795caea497606872e4..35efb9a31dd7b1033a93b44162276f7cac36f921 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/sched.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 static struct proc_dir_entry *proc_afs;
index 8edf253484af981c0e0f6a9a931a71f85d721918..4ab67e8cb776ac18fd12bfec2fa7816800f3f5fa 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -42,7 +42,7 @@
 #include <linux/mount.h>
 
 #include <asm/kmap_types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "internal.h"
 
@@ -1285,7 +1285,7 @@ static long read_events(struct kioctx *ctx, long min_nr, long nr,
                        struct io_event __user *event,
                        struct timespec __user *timeout)
 {
-       ktime_t until = { .tv64 = KTIME_MAX };
+       ktime_t until = KTIME_MAX;
        long ret = 0;
 
        if (timeout) {
@@ -1311,7 +1311,7 @@ static long read_events(struct kioctx *ctx, long min_nr, long nr,
         * the ringbuffer empty. So in practice we should be ok, but it's
         * something to be aware of when touching this code.
         */
-       if (until.tv64 == 0)
+       if (until == 0)
                aio_read_events(ctx, min_nr, nr, event, &ret);
        else
                wait_event_interruptible_hrtimeout(ctx->wait,
@@ -1367,6 +1367,39 @@ out:
        return ret;
 }
 
+#ifdef CONFIG_COMPAT
+COMPAT_SYSCALL_DEFINE2(io_setup, unsigned, nr_events, u32 __user *, ctx32p)
+{
+       struct kioctx *ioctx = NULL;
+       unsigned long ctx;
+       long ret;
+
+       ret = get_user(ctx, ctx32p);
+       if (unlikely(ret))
+               goto out;
+
+       ret = -EINVAL;
+       if (unlikely(ctx || nr_events == 0)) {
+               pr_debug("EINVAL: ctx %lu nr_events %u\n",
+                        ctx, nr_events);
+               goto out;
+       }
+
+       ioctx = ioctx_alloc(nr_events);
+       ret = PTR_ERR(ioctx);
+       if (!IS_ERR(ioctx)) {
+               /* truncating is ok because it's a user address */
+               ret = put_user((u32)ioctx->user_id, ctx32p);
+               if (ret)
+                       kill_ioctx(current->mm, ioctx, NULL);
+               percpu_ref_put(&ioctx->users);
+       }
+
+out:
+       return ret;
+}
+#endif
+
 /* sys_io_destroy:
  *     Destroy the aio_context specified.  May cancel any outstanding 
  *     AIOs and block on completion.  Will fail with -ENOSYS if not
@@ -1591,8 +1624,8 @@ out_put_req:
        return ret;
 }
 
-long do_io_submit(aio_context_t ctx_id, long nr,
-                 struct iocb __user *__user *iocbpp, bool compat)
+static long do_io_submit(aio_context_t ctx_id, long nr,
+                         struct iocb __user *__user *iocbpp, bool compat)
 {
        struct kioctx *ctx;
        long ret = 0;
@@ -1662,6 +1695,44 @@ SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr,
        return do_io_submit(ctx_id, nr, iocbpp, 0);
 }
 
+#ifdef CONFIG_COMPAT
+static inline long
+copy_iocb(long nr, u32 __user *ptr32, struct iocb __user * __user *ptr64)
+{
+       compat_uptr_t uptr;
+       int i;
+
+       for (i = 0; i < nr; ++i) {
+               if (get_user(uptr, ptr32 + i))
+                       return -EFAULT;
+               if (put_user(compat_ptr(uptr), ptr64 + i))
+                       return -EFAULT;
+       }
+       return 0;
+}
+
+#define MAX_AIO_SUBMITS        (PAGE_SIZE/sizeof(struct iocb *))
+
+COMPAT_SYSCALL_DEFINE3(io_submit, compat_aio_context_t, ctx_id,
+                      int, nr, u32 __user *, iocb)
+{
+       struct iocb __user * __user *iocb64;
+       long ret;
+
+       if (unlikely(nr < 0))
+               return -EINVAL;
+
+       if (nr > MAX_AIO_SUBMITS)
+               nr = MAX_AIO_SUBMITS;
+
+       iocb64 = compat_alloc_user_space(nr * sizeof(*iocb64));
+       ret = copy_iocb(nr, iocb, iocb64);
+       if (!ret)
+               ret = do_io_submit(ctx_id, nr, iocb64, 1);
+       return ret;
+}
+#endif
+
 /* lookup_kiocb
  *     Finds a given iocb for cancellation.
  */
@@ -1761,3 +1832,25 @@ SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
        }
        return ret;
 }
+
+#ifdef CONFIG_COMPAT
+COMPAT_SYSCALL_DEFINE5(io_getevents, compat_aio_context_t, ctx_id,
+                      compat_long_t, min_nr,
+                      compat_long_t, nr,
+                      struct io_event __user *, events,
+                      struct compat_timespec __user *, timeout)
+{
+       struct timespec t;
+       struct timespec __user *ut = NULL;
+
+       if (timeout) {
+               if (compat_get_timespec(&t, timeout))
+                       return -EFAULT;
+
+               ut = compat_alloc_user_space(sizeof(*ut));
+               if (copy_to_user(ut, &t, sizeof(t)))
+                       return -EFAULT;
+       }
+       return sys_io_getevents(ctx_id, min_nr, nr, events, ut);
+}
+#endif
index 80ef38c73e5a16af0f9443d94bec3aae700370df..3168ee4e77f4fe386d94e09a41cd2c1c98d76e39 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/magic.h>
 #include <linux/anon_inodes.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static struct vfsmount *anon_inode_mnt __read_mostly;
 static struct inode *anon_inode_inode;
index c6bad51d8ec7b56d8027c019a98a656596911110..b914cfb03820aa7780e629dc047287df1ea56b08 100644 (file)
@@ -129,6 +129,7 @@ static inline befs_inode_addr
 blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
 {
        befs_inode_addr iaddr;
+
        iaddr.allocation_group = blockno >> BEFS_SB(sb)->ag_shift;
        iaddr.start =
            blockno - (iaddr.allocation_group << BEFS_SB(sb)->ag_shift);
@@ -140,7 +141,7 @@ blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
 static inline unsigned int
 befs_iaddrs_per_block(struct super_block *sb)
 {
-       return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr);
+       return BEFS_SB(sb)->block_size / sizeof(befs_disk_inode_addr);
 }
 
 #include "endian.h"
index eb557d9dc8be973ae82c89feb274275202080059..69c9d8cde95563b58dd31c5a5a7e41e9f02fb3c1 100644 (file)
@@ -55,12 +55,12 @@ enum super_flags {
 };
 
 #define BEFS_BYTEORDER_NATIVE 0x42494745
-#define BEFS_BYTEORDER_NATIVE_LE (__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE)
-#define BEFS_BYTEORDER_NATIVE_BE (__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE)
+#define BEFS_BYTEORDER_NATIVE_LE ((__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE))
+#define BEFS_BYTEORDER_NATIVE_BE ((__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE))
 
 #define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1
-#define BEFS_SUPER_MAGIC1_LE (__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1)
-#define BEFS_SUPER_MAGIC1_BE (__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1)
+#define BEFS_SUPER_MAGIC1_LE ((__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1))
+#define BEFS_SUPER_MAGIC1_BE ((__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1))
 
 /*
  * Flags of inode
@@ -79,7 +79,7 @@ enum inode_flags {
        BEFS_INODE_WAS_WRITTEN = 0x00020000,
        BEFS_NO_TRANSACTION = 0x00040000,
 };
-/* 
+/*
  * On-Disk datastructures of BeFS
  */
 
@@ -139,7 +139,7 @@ typedef struct {
 
 } PACKED befs_super_block;
 
-/* 
+/*
  * Note: the indirect and dbl_indir block_runs may
  * be longer than one block!
  */
index 7e135ea73fddf65295a804502d7c3a57e906cffb..d509887c580ceedba9ab003cb390417aeab993e9 100644 (file)
@@ -12,8 +12,8 @@
  *
  * Dominic Giampaolo, author of "Practical File System
  * Design with the Be File System", for such a helpful book.
- * 
- * Marcus J. Ranum, author of the b+tree package in 
+ *
+ * Marcus J. Ranum, author of the b+tree package in
  * comp.sources.misc volume 10. This code is not copied from that
  * work, but it is partially based on it.
  *
  */
 
 /* Befs B+tree structure:
- * 
+ *
  * The first thing in the tree is the tree superblock. It tells you
  * all kinds of useful things about the tree, like where the rootnode
  * is located, and the size of the nodes (always 1024 with current version
  * of BeOS).
  *
  * The rest of the tree consists of a series of nodes. Nodes contain a header
- * (struct befs_btree_nodehead), the packed key data, an array of shorts 
+ * (struct befs_btree_nodehead), the packed key data, an array of shorts
  * containing the ending offsets for each of the keys, and an array of
- * befs_off_t values. In interior nodes, the keys are the ending keys for 
- * the childnode they point to, and the values are offsets into the 
- * datastream containing the tree. 
+ * befs_off_t values. In interior nodes, the keys are the ending keys for
+ * the childnode they point to, and the values are offsets into the
+ * datastream containing the tree.
  */
 
 /* Note:
- * 
- * The book states 2 confusing things about befs b+trees. First, 
+ *
+ * The book states 2 confusing things about befs b+trees. First,
  * it states that the overflow field of node headers is used by internal nodes
  * to point to another node that "effectively continues this one". Here is what
  * I believe that means. Each key in internal nodes points to another node that
- * contains key values less than itself. Inspection reveals that the last key 
- * in the internal node is not the last key in the index. Keys that are 
- * greater than the last key in the internal node go into the overflow node. 
+ * contains key values less than itself. Inspection reveals that the last key
+ * in the internal node is not the last key in the index. Keys that are
+ * greater than the last key in the internal node go into the overflow node.
  * I imagine there is a performance reason for this.
  *
- * Second, it states that the header of a btree node is sufficient to 
- * distinguish internal nodes from leaf nodes. Without saying exactly how. 
+ * Second, it states that the header of a btree node is sufficient to
+ * distinguish internal nodes from leaf nodes. Without saying exactly how.
  * After figuring out the first, it becomes obvious that internal nodes have
  * overflow nodes and leafnodes do not.
  */
 
-/* 
+/*
  * Currently, this code is only good for directory B+trees.
  * In order to be used for other BFS indexes, it needs to be extended to handle
  * duplicate keys and non-string keytypes (int32, int64, float, double).
@@ -237,8 +237,8 @@ befs_bt_read_node(struct super_block *sb, const befs_data_stream *ds,
  * with @key (usually the disk block number of an inode).
  *
  * On failure, returns BEFS_ERR or BEFS_BT_NOT_FOUND.
- * 
- * Algorithm: 
+ *
+ * Algorithm:
  *   Read the superblock and rootnode of the b+tree.
  *   Drill down through the interior nodes using befs_find_key().
  *   Once at the correct leaf node, use befs_find_key() again to get the
@@ -402,12 +402,12 @@ befs_find_key(struct super_block *sb, struct befs_btree_node *node,
  *
  * Here's how it works: Key_no is the index of the key/value pair to
  * return in keybuf/value.
- * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is 
+ * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is
  * the number of characters in the key (just a convenience).
  *
  * Algorithm:
  *   Get the first leafnode of the tree. See if the requested key is in that
- *   node. If not, follow the node->right link to the next leafnode. Repeat 
+ *   node. If not, follow the node->right link to the next leafnode. Repeat
  *   until the (key_no)th key is found or the tree is out of keys.
  */
 int
@@ -536,7 +536,7 @@ befs_btree_read(struct super_block *sb, const befs_data_stream *ds,
  * @node_off: Pointer to offset of current node within datastream. Modified
  *             by the function.
  *
- * Helper function for btree traverse. Moves the current position to the 
+ * Helper function for btree traverse. Moves the current position to the
  * start of the first leaf node.
  *
  * Also checks for an empty tree. If there are no keys, returns BEFS_BT_EMPTY.
@@ -592,10 +592,10 @@ befs_btree_seekleaf(struct super_block *sb, const befs_data_stream *ds,
 }
 
 /**
- * befs_leafnode - Determine if the btree node is a leaf node or an 
+ * befs_leafnode - Determine if the btree node is a leaf node or an
  * interior node
  * @node: Pointer to node structure to test
- * 
+ *
  * Return 1 if leaf, 0 if interior
  */
 static int
@@ -656,7 +656,7 @@ befs_bt_valarray(struct befs_btree_node *node)
  * @node: Pointer to the node structure to find the keydata array within
  *
  * Returns a pointer to the start of the keydata array
- * of the node pointed to by the node header 
+ * of the node pointed to by the node header
  */
 static char *
 befs_bt_keydata(struct befs_btree_node *node)
@@ -702,7 +702,7 @@ befs_bt_get_key(struct super_block *sb, struct befs_btree_node *node,
 
 /**
  * befs_compare_strings - compare two strings
- * @key1: pointer to the first key to be compared 
+ * @key1: pointer to the first key to be compared
  * @keylen1: length in bytes of key1
  * @key2: pointer to the second key to be compared
  * @keylen2: length in bytes of key2
index f2a8f637e9e07faf3faf7773737bdaea257ddf29..60c6c728e64e78168ad9c37d759948d6e82f596a 100644 (file)
@@ -1,13 +1,11 @@
 /*
  * btree.h
- * 
+ *
  */
 
-
 int befs_btree_find(struct super_block *sb, const befs_data_stream *ds,
-                   const char *key, befs_off_t * value);
+                   const char *key, befs_off_t *value);
 
 int befs_btree_read(struct super_block *sb, const befs_data_stream *ds,
                    loff_t key_no, size_t bufsize, char *keybuf,
-                   size_t * keysize, befs_off_t * value);
-
+                   size_t *keysize, befs_off_t *value);
index b4c7ba013c0d6e752296599d6b29597e5dd13512..720b3bc5c16a70bd664562bfe72abacffa8c7360 100644 (file)
@@ -84,13 +84,11 @@ befs_read_datastream(struct super_block *sb, const befs_data_stream *ds,
  *
  * Takes a file position and gives back a brun who's starting block
  * is block number fblock of the file.
- * 
+ *
  * Returns BEFS_OK or BEFS_ERR.
- * 
+ *
  * Calls specialized functions for each of the three possible
  * datastream regions.
- *
- * 2001-11-15 Will Dyson
  */
 int
 befs_fblock2brun(struct super_block *sb, const befs_data_stream *data,
@@ -120,7 +118,7 @@ befs_fblock2brun(struct super_block *sb, const befs_data_stream *data,
 
 /**
  * befs_read_lsmylink - read long symlink from datastream.
- * @sb: Filesystem superblock 
+ * @sb: Filesystem superblock
  * @ds: Datastream to read from
  * @buff: Buffer in which to place long symlink data
  * @len: Length of the long symlink in bytes
index 91ba8203d83f221278df23e8bb4ab5c3e9cb6d11..7ff9ff09ec6e70718b4b8bd398239922d1065f84 100644 (file)
@@ -5,10 +5,10 @@
 
 struct buffer_head *befs_read_datastream(struct super_block *sb,
                                         const befs_data_stream *ds,
-                                        befs_off_t pos, uint * off);
+                                        befs_off_t pos, uint *off);
 
 int befs_fblock2brun(struct super_block *sb, const befs_data_stream *data,
-                    befs_blocknr_t fblock, befs_block_run * run);
+                    befs_blocknr_t fblock, befs_block_run *run);
 
 size_t befs_read_lsymlink(struct super_block *sb, const befs_data_stream *data,
                          void *buff, befs_off_t len);
@@ -17,4 +17,3 @@ befs_blocknr_t befs_count_blocks(struct super_block *sb,
                          const befs_data_stream *ds);
 
 extern const befs_inode_addr BAD_IADDR;
-
index 85c13392e9e897dae2ee288f301c88c3067e8303..36656c86f50ec526d0a9f9c3b8ce76ec6098198a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  linux/fs/befs/debug.c
- * 
+ *
  * Copyright (C) 2001 Will Dyson (will_dyson at pobox.com)
  *
  * With help from the ntfs-tng driver by Anton Altparmakov
@@ -57,6 +57,7 @@ befs_debug(const struct super_block *sb, const char *fmt, ...)
 
        struct va_format vaf;
        va_list args;
+
        va_start(args, fmt);
        vaf.fmt = fmt;
        vaf.va = &args;
@@ -67,7 +68,7 @@ befs_debug(const struct super_block *sb, const char *fmt, ...)
 }
 
 void
-befs_dump_inode(const struct super_block *sb, befs_inode * inode)
+befs_dump_inode(const struct super_block *sb, befs_inode *inode)
 {
 #ifdef CONFIG_BEFS_DEBUG
 
@@ -151,7 +152,7 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode)
  */
 
 void
-befs_dump_super_block(const struct super_block *sb, befs_super_block * sup)
+befs_dump_super_block(const struct super_block *sb, befs_super_block *sup)
 {
 #ifdef CONFIG_BEFS_DEBUG
 
@@ -202,7 +203,7 @@ befs_dump_super_block(const struct super_block *sb, befs_super_block * sup)
 #if 0
 /* unused */
 void
-befs_dump_small_data(const struct super_block *sb, befs_small_data * sd)
+befs_dump_small_data(const struct super_block *sb, befs_small_data *sd)
 {
 }
 
@@ -221,7 +222,8 @@ befs_dump_run(const struct super_block *sb, befs_disk_block_run run)
 #endif  /*  0  */
 
 void
-befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * super)
+befs_dump_index_entry(const struct super_block *sb,
+                     befs_disk_btree_super *super)
 {
 #ifdef CONFIG_BEFS_DEBUG
 
@@ -242,7 +244,7 @@ befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * supe
 }
 
 void
-befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead * node)
+befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *node)
 {
 #ifdef CONFIG_BEFS_DEBUG
 
index fa4b718de597394cf4b50be1fb877937d8f5935d..5367a6470a69fb59c0db37e321ff9d9c343d5519 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * inode.c
- * 
+ *
  * Copyright (C) 2001 Will Dyson <will_dyson@pobox.com>
  */
 
 #include "inode.h"
 
 /*
      Validates the correctness of the befs inode
      Returns BEFS_OK if the inode should be used, otherwise
      returns BEFS_BAD_INODE
-*/
* Validates the correctness of the befs inode
* Returns BEFS_OK if the inode should be used, otherwise
* returns BEFS_BAD_INODE
+ */
 int
-befs_check_inode(struct super_block *sb, befs_inode * raw_inode,
+befs_check_inode(struct super_block *sb, befs_inode *raw_inode,
                 befs_blocknr_t inode)
 {
        u32 magic1 = fs32_to_cpu(sb, raw_inode->magic1);
index 9dc7fd9b7570d63321c86b3088e5a975f7e8c419..2219e412f49bee9255241464701290c6d006fa58 100644 (file)
@@ -1,8 +1,7 @@
 /*
  * inode.h
- * 
+ *
  */
 
-int befs_check_inode(struct super_block *sb, befs_inode * raw_inode,
+int befs_check_inode(struct super_block *sb, befs_inode *raw_inode,
                     befs_blocknr_t inode);
-
index b4a558126ee1724b0d3bd833f68a1c201833af33..227cb86e07fe3a99afc45c1790a87671641eb5af 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2001 Will Dyson <will_dyson@pobox.com
  *
- * Based on portions of file.c and inode.c 
+ * Based on portions of file.c and inode.c
  * by Makoto Kato (m_kato@ga2.so-net.ne.jp)
  *
  * Many thanks to Dominic Giampaolo, author of Practical File System
@@ -19,8 +19,7 @@
 /*
  * Converts befs notion of disk addr to a disk offset and uses
  * linux kernel function sb_bread() to get the buffer containing
- * the offset. -Will Dyson
- *
+ * the offset.
  */
 
 struct buffer_head *
@@ -55,7 +54,7 @@ befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr)
        befs_debug(sb, "<--- %s", __func__);
        return bh;
 
-      error:
+error:
        befs_debug(sb, "<--- %s ERROR", __func__);
        return NULL;
 }
index 78d7bc6e60dee4d51fb1ac6325cca8b3929bd9c2..9b3e1967cb313f100a7ae96d9559f4ae6cea902d 100644 (file)
@@ -4,4 +4,3 @@
 
 struct buffer_head *befs_bread_iaddr(struct super_block *sb,
                                     befs_inode_addr iaddr);
-
index 647a276eba5654593739aafa9a6984ca967d8adf..19407165f4aad9719ef5f339fabc31bb2c22ef9e 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/parser.h>
 #include <linux/namei.h>
 #include <linux/sched.h>
+#include <linux/exportfs.h>
 
 #include "befs.h"
 #include "btree.h"
@@ -37,7 +38,8 @@ static int befs_readdir(struct file *, struct dir_context *);
 static int befs_get_block(struct inode *, sector_t, struct buffer_head *, int);
 static int befs_readpage(struct file *file, struct page *page);
 static sector_t befs_bmap(struct address_space *mapping, sector_t block);
-static struct dentry *befs_lookup(struct inode *, struct dentry *, unsigned int);
+static struct dentry *befs_lookup(struct inode *, struct dentry *,
+                                 unsigned int);
 static struct inode *befs_iget(struct super_block *, unsigned long);
 static struct inode *befs_alloc_inode(struct super_block *sb);
 static void befs_destroy_inode(struct inode *inode);
@@ -51,6 +53,10 @@ static void befs_put_super(struct super_block *);
 static int befs_remount(struct super_block *, int *, char *);
 static int befs_statfs(struct dentry *, struct kstatfs *);
 static int parse_options(char *, struct befs_mount_options *);
+static struct dentry *befs_fh_to_dentry(struct super_block *sb,
+                               struct fid *fid, int fh_len, int fh_type);
+static struct dentry *befs_fh_to_parent(struct super_block *sb,
+                               struct fid *fid, int fh_len, int fh_type);
 
 static const struct super_operations befs_sops = {
        .alloc_inode    = befs_alloc_inode,     /* allocate a new inode */
@@ -83,9 +89,14 @@ static const struct address_space_operations befs_symlink_aops = {
        .readpage       = befs_symlink_readpage,
 };
 
-/* 
+static const struct export_operations befs_export_operations = {
+       .fh_to_dentry   = befs_fh_to_dentry,
+       .fh_to_parent   = befs_fh_to_parent,
+};
+
+/*
  * Called by generic_file_read() to read a page of data
- * 
+ *
  * In turn, simply calls a generic block read function and
  * passes it the address of befs_get_block, for mapping file
  * positions to disk blocks.
@@ -102,15 +113,13 @@ befs_bmap(struct address_space *mapping, sector_t block)
        return generic_block_bmap(mapping, block, befs_get_block);
 }
 
-/* 
- * Generic function to map a file position (block) to a 
+/*
+ * Generic function to map a file position (block) to a
  * disk offset (passed back in bh_result).
  *
  * Used by many higher level functions.
  *
  * Calls befs_fblock2brun() in datastream.c to do the real work.
- *
- * -WD 10-26-01
  */
 
 static int
@@ -269,15 +278,15 @@ befs_alloc_inode(struct super_block *sb)
        struct befs_inode_info *bi;
 
        bi = kmem_cache_alloc(befs_inode_cachep, GFP_KERNEL);
-        if (!bi)
-                return NULL;
-        return &bi->vfs_inode;
+       if (!bi)
+               return NULL;
+       return &bi->vfs_inode;
 }
 
 static void befs_i_callback(struct rcu_head *head)
 {
        struct inode *inode = container_of(head, struct inode, i_rcu);
-        kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
+       kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
 }
 
 static void befs_destroy_inode(struct inode *inode)
@@ -287,7 +296,7 @@ static void befs_destroy_inode(struct inode *inode)
 
 static void init_once(void *foo)
 {
-        struct befs_inode_info *bi = (struct befs_inode_info *) foo;
+       struct befs_inode_info *bi = (struct befs_inode_info *) foo;
 
        inode_init_once(&bi->vfs_inode);
 }
@@ -338,7 +347,7 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
        /*
         * set uid and gid.  But since current BeOS is single user OS, so
         * you can change by "uid" or "gid" options.
-        */   
+        */
 
        inode->i_uid = befs_sb->mount_opts.use_uid ?
                befs_sb->mount_opts.uid :
@@ -353,14 +362,14 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
         * BEFS's time is 64 bits, but current VFS is 32 bits...
         * BEFS don't have access time. Nor inode change time. VFS
         * doesn't have creation time.
-        * Also, the lower 16 bits of the last_modified_time and 
+        * Also, the lower 16 bits of the last_modified_time and
         * create_time are just a counter to help ensure uniqueness
         * for indexing purposes. (PFD, page 54)
         */
 
        inode->i_mtime.tv_sec =
            fs64_to_cpu(sb, raw_inode->last_modified_time) >> 16;
-       inode->i_mtime.tv_nsec = 0;   /* lower 16 bits are not a time */        
+       inode->i_mtime.tv_nsec = 0;   /* lower 16 bits are not a time */
        inode->i_ctime = inode->i_mtime;
        inode->i_atime = inode->i_mtime;
 
@@ -414,10 +423,10 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
        unlock_new_inode(inode);
        return inode;
 
-      unacquire_bh:
+unacquire_bh:
        brelse(bh);
 
-      unacquire_none:
+unacquire_none:
        iget_failed(inode);
        befs_debug(sb, "<--- %s - Bad inode", __func__);
        return ERR_PTR(-EIO);
@@ -442,7 +451,7 @@ befs_init_inodecache(void)
 }
 
 /* Called at fs teardown.
- * 
+ *
  * Taken from NFS implementation by Al Viro.
  */
 static void
@@ -491,13 +500,10 @@ fail:
 }
 
 /*
- * UTF-8 to NLS charset  convert routine
- * 
+ * UTF-8 to NLS charset convert routine
  *
- * Changed 8/10/01 by Will Dyson. Now use uni2char() / char2uni() rather than
- * the nls tables directly
+ * Uses uni2char() / char2uni() rather than the nls tables directly
  */
-
 static int
 befs_utf2nls(struct super_block *sb, const char *in,
             int in_len, char **out, int *out_len)
@@ -521,9 +527,8 @@ befs_utf2nls(struct super_block *sb, const char *in,
        }
 
        *out = result = kmalloc(maxlen, GFP_NOFS);
-       if (!*out) {
+       if (!*out)
                return -ENOMEM;
-       }
 
        for (i = o = 0; i < in_len; i += utflen, o += unilen) {
 
@@ -546,7 +551,7 @@ befs_utf2nls(struct super_block *sb, const char *in,
 
        return o;
 
-      conv_err:
+conv_err:
        befs_error(sb, "Name using character set %s contains a character that "
                   "cannot be converted to unicode.", nls->charset);
        befs_debug(sb, "<--- %s", __func__);
@@ -561,18 +566,18 @@ befs_utf2nls(struct super_block *sb, const char *in,
  * @in_len: Length of input string in bytes
  * @out: The output string in UTF-8 format
  * @out_len: Length of the output buffer
- * 
+ *
  * Converts input string @in, which is in the format of the loaded NLS map,
  * into a utf8 string.
- * 
+ *
  * The destination string @out is allocated by this function and the caller is
  * responsible for freeing it with kfree()
- * 
+ *
  * On return, *@out_len is the length of @out in bytes.
  *
  * On success, the return value is the number of utf8 characters written to
  * the output buffer @out.
- *  
+ *
  * On Failure, a negative number coresponding to the error code is returned.
  */
 
@@ -585,9 +590,11 @@ befs_nls2utf(struct super_block *sb, const char *in,
        wchar_t uni;
        int unilen, utflen;
        char *result;
-       /* There're nls characters that will translate to 3-chars-wide UTF-8
-        * characters, a additional byte is needed to save the final \0
-        * in special cases */
+       /*
+        * There are nls characters that will translate to 3-chars-wide UTF-8
+        * characters, an additional byte is needed to save the final \0
+        * in special cases
+        */
        int maxlen = (3 * in_len) + 1;
 
        befs_debug(sb, "---> %s\n", __func__);
@@ -624,14 +631,41 @@ befs_nls2utf(struct super_block *sb, const char *in,
 
        return i;
 
-      conv_err:
-       befs_error(sb, "Name using charecter set %s contains a charecter that "
+conv_err:
+       befs_error(sb, "Name using character set %s contains a character that "
                   "cannot be converted to unicode.", nls->charset);
        befs_debug(sb, "<--- %s", __func__);
        kfree(result);
        return -EILSEQ;
 }
 
+static struct inode *befs_nfs_get_inode(struct super_block *sb, uint64_t ino,
+                                        uint32_t generation)
+{
+       /* No need to handle i_generation */
+       return befs_iget(sb, ino);
+}
+
+/*
+ * Map a NFS file handle to a corresponding dentry
+ */
+static struct dentry *befs_fh_to_dentry(struct super_block *sb,
+                               struct fid *fid, int fh_len, int fh_type)
+{
+       return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
+                                   befs_nfs_get_inode);
+}
+
+/*
+ * Find the parent for a file specified by NFS handle
+ */
+static struct dentry *befs_fh_to_parent(struct super_block *sb,
+                               struct fid *fid, int fh_len, int fh_type)
+{
+       return generic_fh_to_parent(sb, fid, fh_len, fh_type,
+                                   befs_nfs_get_inode);
+}
+
 enum {
        Opt_uid, Opt_gid, Opt_charset, Opt_debug, Opt_err,
 };
@@ -666,6 +700,7 @@ parse_options(char *options, struct befs_mount_options *opts)
 
        while ((p = strsep(&options, ",")) != NULL) {
                int token;
+
                if (!*p)
                        continue;
 
@@ -721,7 +756,7 @@ parse_options(char *options, struct befs_mount_options *opts)
 }
 
 /* This function has the responsibiltiy of getting the
- * filesystem ready for unmounting. 
+ * filesystem ready for unmounting.
  * Basically, we free everything that we allocated in
  * befs_read_inode
  */
@@ -782,8 +817,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
         * Linux 2.4.10 and later refuse to read blocks smaller than
         * the logical block size for the device. But we also need to read at
         * least 1k to get the second 512 bytes of the volume.
-        * -WD 10-26-01
-        */ 
+        */
        blocksize = sb_min_blocksize(sb, 1024);
        if (!blocksize) {
                if (!silent)
@@ -791,7 +825,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
                goto unacquire_priv_sbp;
        }
 
-       if (!(bh = sb_bread(sb, sb_block))) {
+       bh = sb_bread(sb, sb_block);
+       if (!bh) {
                if (!silent)
                        befs_error(sb, "unable to read superblock");
                goto unacquire_priv_sbp;
@@ -816,7 +851,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 
        brelse(bh);
 
-       if( befs_sb->num_blocks > ~((sector_t)0) ) {
+       if (befs_sb->num_blocks > ~((sector_t)0)) {
                if (!silent)
                        befs_error(sb, "blocks count: %llu is larger than the host can use",
                                        befs_sb->num_blocks);
@@ -831,6 +866,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
        /* Set real blocksize of fs */
        sb_set_blocksize(sb, (ulong) befs_sb->block_size);
        sb->s_op = &befs_sops;
+       sb->s_export_op = &befs_export_operations;
        root = befs_iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir)));
        if (IS_ERR(root)) {
                ret = PTR_ERR(root);
@@ -861,16 +897,16 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
        }
 
        return 0;
-/*****************/
-      unacquire_bh:
+
+unacquire_bh:
        brelse(bh);
 
-      unacquire_priv_sbp:
+unacquire_priv_sbp:
        kfree(befs_sb->mount_opts.iocharset);
        kfree(sb->s_fs_info);
        sb->s_fs_info = NULL;
 
-      unacquire_none:
+unacquire_none:
        return ret;
 }
 
@@ -919,7 +955,7 @@ static struct file_system_type befs_fs_type = {
        .name           = "befs",
        .mount          = befs_mount,
        .kill_sb        = kill_block_super,
-       .fs_flags       = FS_REQUIRES_DEV,      
+       .fs_flags       = FS_REQUIRES_DEV,
 };
 MODULE_ALIAS_FS("befs");
 
@@ -956,9 +992,9 @@ exit_befs_fs(void)
 }
 
 /*
-Macros that typecheck the init and exit functions,
-ensures that they are called at init and cleanup,
-and eliminates warnings about unused functions.
-*/
+ * Macros that typecheck the init and exit functions,
+ * ensures that they are called at init and cleanup,
+ * and eliminates warnings about unused functions.
+ */
 module_init(init_befs_fs)
 module_exit(exit_befs_fs)
index dc4556376a2206ac43431bddb3815b60615bcb42..ec1df30a7e9ab859e25ca0ea384f0681fc24adcc 100644 (file)
@@ -2,7 +2,5 @@
  * super.h
  */
 
-int befs_load_sb(struct super_block *sb, befs_super_block * disk_sb);
-
+int befs_load_sb(struct super_block *sb, befs_super_block *disk_sb);
 int befs_check_sb(struct super_block *sb);
-
index 1e5c896f6b79f85de6395d085bff9045e372eda5..f2deec0a62f0c613349d6f7d94bd6077d2cceb96 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/vfs.h>
 #include <linux/writeback.h>
 #include <linux/uio.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "bfs.h"
 
 MODULE_AUTHOR("Tigran Aivazian <tigran@aivazian.fsnet.co.uk>");
index ae1b5404fced41881247e59073cb6fb6c31222a1..2a59139f520b96bcab261f9a7a9fb42e0f38220f 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/coredump.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/a.out-core.h>
 
index e6c1bd44380633046e3172662dd23db54f49326d..29a02daf08a97896c600e88317e646dbf3ab3c9b 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/coredump.h>
 #include <linux/sched.h>
 #include <linux/dax.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/param.h>
 #include <asm/page.h>
 
index 464a972e88c133a917493bd19a68e375c6dfd1d2..d2e36f82c35d3ac5d96e00b22392926bdd1990e9 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/coredump.h>
 #include <linux/dax.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/param.h>
 #include <asm/pgalloc.h>
 
index 7c4507224ed66b876b5bf01fd45a6d6da8106308..5db5d1340d69eccf475f0feac7f85665bd6aceb5 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/badblocks.h>
 #include <linux/task_io_accounting_ops.h>
 #include <linux/falloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 struct bdev_inode {
@@ -328,6 +328,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
        struct file *file = iocb->ki_filp;
        struct inode *inode = bdev_file_inode(file);
        struct block_device *bdev = I_BDEV(inode);
+       struct blk_plug plug;
        struct blkdev_dio *dio;
        struct bio *bio;
        bool is_read = (iov_iter_rw(iter) == READ);
@@ -353,6 +354,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
        dio->multi_bio = false;
        dio->should_dirty = is_read && (iter->type == ITER_IOVEC);
 
+       blk_start_plug(&plug);
        for (;;) {
                bio->bi_bdev = bdev;
                bio->bi_iter.bi_sector = pos >> 9;
@@ -394,6 +396,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
                submit_bio(bio);
                bio = bio_alloc(GFP_KERNEL, nr_pages);
        }
+       blk_finish_plug(&plug);
 
        if (!dio->is_sync)
                return -EIOCBQUEUED;
index d21771fcf7d345ab4299cb7fa25881ffcc61ef52..0e87401cf33535b03a1d2aa9da6e919d8a56a906 100644 (file)
@@ -1660,7 +1660,7 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len)
                        head = page_buffers(page);
                        bh = head;
                        do {
-                               if (!buffer_mapped(bh))
+                               if (!buffer_mapped(bh) || (bh->b_blocknr < block))
                                        goto next;
                                if (bh->b_blocknr >= block + len)
                                        break;
index 3d03e48a92139a4f67feeb072048ee5649006481..9727e1dcacd558a89e5fa0c206e82b6f0941a99c 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/ctype.h>
 #include <linux/module.h>
 #include <linux/proc_fs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "cifspdu.h"
 #include "cifsglob.h"
 #include "cifsproto.h"
index 5eb04129f93849c2727a517119bc484761160332..66bd7fa9b7a6f739f7f5fda0d0b6fe4c79192a47 100644 (file)
@@ -699,11 +699,15 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp)
 
        if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) {
                if (!ses->domainName) {
-                       rc = find_domain_name(ses, nls_cp);
-                       if (rc) {
-                               cifs_dbg(VFS, "error %d finding domain name\n",
-                                        rc);
-                               goto setup_ntlmv2_rsp_ret;
+                       if (ses->domainAuto) {
+                               rc = find_domain_name(ses, nls_cp);
+                               if (rc) {
+                                       cifs_dbg(VFS, "error %d finding domain name\n",
+                                                rc);
+                                       goto setup_ntlmv2_rsp_ret;
+                               }
+                       } else {
+                               ses->domainName = kstrdup("", GFP_KERNEL);
                        }
                }
        } else {
index e6efb9a8859892df6ded9d58334815439828d2ec..70f4e65fced233613746e33422cf6efa4e9b0ea0 100644 (file)
@@ -615,7 +615,7 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
                return dget(sb->s_root);
 
        full_path = cifs_build_path_to_root(vol, cifs_sb,
-                                           cifs_sb_master_tcon(cifs_sb));
+                               cifs_sb_master_tcon(cifs_sb), 0);
        if (full_path == NULL)
                return ERR_PTR(-ENOMEM);
 
index 1f17f6bd7a601c56e40a6393c25eaee892e40a0f..7ea8a3393936c87976208677d816258eb3a94465 100644 (file)
@@ -514,6 +514,7 @@ struct smb_vol {
        bool persistent:1;
        bool nopersistent:1;
        bool resilient:1; /* noresilient not required since not fored for CA */
+       bool domainauto:1;
        unsigned int rsize;
        unsigned int wsize;
        bool sockopt_tcp_nodelay:1;
@@ -525,6 +526,7 @@ struct smb_vol {
        struct sockaddr_storage srcaddr; /* allow binding to a local IP */
        struct nls_table *local_nls;
        unsigned int echo_interval; /* echo interval in secs */
+       __u64 snapshot_time; /* needed for timewarp tokens */
        unsigned int max_credits; /* smb3 max_credits 10 < credits < 60000 */
 };
 
@@ -646,6 +648,8 @@ struct TCP_Server_Info {
        unsigned int    max_read;
        unsigned int    max_write;
        __u8            preauth_hash[512];
+       struct delayed_work reconnect; /* reconnect workqueue job */
+       struct mutex reconnect_mutex; /* prevent simultaneous reconnects */
 #endif /* CONFIG_CIFS_SMB2 */
        unsigned long echo_interval;
 };
@@ -827,6 +831,7 @@ struct cifs_ses {
        enum securityEnum sectype; /* what security flavor was specified? */
        bool sign;              /* is signing required? */
        bool need_reconnect:1; /* connection reset, uid now invalid */
+       bool domainAuto:1;
 #ifdef CONFIG_CIFS_SMB2
        __u16 session_flags;
        __u8 smb3signingkey[SMB3_SIGN_KEY_SIZE];
@@ -849,6 +854,7 @@ cap_unix(struct cifs_ses *ses)
 struct cifs_tcon {
        struct list_head tcon_list;
        int tc_count;
+       struct list_head rlist; /* reconnect list */
        struct list_head openFileList;
        spinlock_t open_file_lock; /* protects list above */
        struct cifs_ses *ses;   /* pointer to session associated with */
@@ -922,6 +928,7 @@ struct cifs_tcon {
        bool broken_posix_open; /* e.g. Samba server versions < 3.3.2, 3.2.9 */
        bool broken_sparse_sup; /* if server or share does not support sparse */
        bool need_reconnect:1; /* connection reset, tid now invalid */
+       bool need_reopen_files:1; /* need to reopen tcon file handles */
        bool use_resilient:1; /* use resilient instead of durable handles */
        bool use_persistent:1; /* use persistent instead of durable handles */
 #ifdef CONFIG_CIFS_SMB2
@@ -932,6 +939,7 @@ struct cifs_tcon {
        __u32 maximal_access;
        __u32 vol_serial_number;
        __le64 vol_create_time;
+       __u64 snapshot_time; /* for timewarp tokens - timestamp of snapshot */
        __u32 ss_flags;         /* sector size flags */
        __u32 perf_sector_size; /* best sector size for perf */
        __u32 max_chunks;
index ced0e42ce460963104d89bb8b941b899ceb33dea..c7b3c841e6604d150e22d2ed40695c2cec3d3d99 100644 (file)
@@ -63,7 +63,8 @@ extern void exit_cifs_spnego(void);
 extern char *build_path_from_dentry(struct dentry *);
 extern char *cifs_build_path_to_root(struct smb_vol *vol,
                                     struct cifs_sb_info *cifs_sb,
-                                    struct cifs_tcon *tcon);
+                                    struct cifs_tcon *tcon,
+                                    int add_treename);
 extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
 extern char *cifs_compose_mount_options(const char *sb_mountdata,
                const char *fullpath, const struct dfs_info3_param *ref,
@@ -206,6 +207,9 @@ extern void cifs_add_pending_open_locked(struct cifs_fid *fid,
                                         struct tcon_link *tlink,
                                         struct cifs_pending_open *open);
 extern void cifs_del_pending_open(struct cifs_pending_open *open);
+extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
+                                int from_reconnect);
+extern void cifs_put_tcon(struct cifs_tcon *tcon);
 
 #if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
 extern void cifs_dfs_release_automount_timer(void);
index e3fed9249a04f09929e772c0f4c9b0955263b13b..b47261858e6ddde793182f1be7040083522867f1 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/pagemap.h>
 #include <linux/swap.h>
 #include <linux/task_io_accounting_ops.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "cifspdu.h"
 #include "cifsglob.h"
 #include "cifsacl.h"
index f7563c88c917d2174f2259b35191992752217247..35ae49ed1f76e499a19cbd940a28ba28872c8c4e 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/pagevec.h>
 #include <linux/freezer.h>
 #include <linux/namei.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>
 #include <linux/inet.h>
 #include <linux/module.h>
@@ -53,6 +53,9 @@
 #include "nterr.h"
 #include "rfc1002pdu.h"
 #include "fscache.h"
+#ifdef CONFIG_CIFS_SMB2
+#include "smb2proto.h"
+#endif
 
 #define CIFS_PORT 445
 #define RFC1001_PORT 139
@@ -89,6 +92,7 @@ enum {
        Opt_multiuser, Opt_sloppy, Opt_nosharesock,
        Opt_persistent, Opt_nopersistent,
        Opt_resilient, Opt_noresilient,
+       Opt_domainauto,
 
        /* Mount options which take numeric value */
        Opt_backupuid, Opt_backupgid, Opt_uid,
@@ -96,6 +100,7 @@ enum {
        Opt_dirmode, Opt_port,
        Opt_rsize, Opt_wsize, Opt_actimeo,
        Opt_echo_interval, Opt_max_credits,
+       Opt_snapshot,
 
        /* Mount options which take string value */
        Opt_user, Opt_pass, Opt_ip,
@@ -177,6 +182,7 @@ static const match_table_t cifs_mount_option_tokens = {
        { Opt_nopersistent, "nopersistenthandles"},
        { Opt_resilient, "resilienthandles"},
        { Opt_noresilient, "noresilienthandles"},
+       { Opt_domainauto, "domainauto"},
 
        { Opt_backupuid, "backupuid=%s" },
        { Opt_backupgid, "backupgid=%s" },
@@ -192,6 +198,7 @@ static const match_table_t cifs_mount_option_tokens = {
        { Opt_actimeo, "actimeo=%s" },
        { Opt_echo_interval, "echo_interval=%s" },
        { Opt_max_credits, "max_credits=%s" },
+       { Opt_snapshot, "snapshot=%s" },
 
        { Opt_blank_user, "user=" },
        { Opt_blank_user, "username=" },
@@ -1500,6 +1507,9 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
                case Opt_noresilient:
                        vol->resilient = false; /* already the default */
                        break;
+               case Opt_domainauto:
+                       vol->domainauto = true;
+                       break;
 
                /* Numeric Values */
                case Opt_backupuid:
@@ -1602,6 +1612,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
                        }
                        vol->echo_interval = option;
                        break;
+               case Opt_snapshot:
+                       if (get_option_ul(args, &option)) {
+                               cifs_dbg(VFS, "%s: Invalid snapshot time\n",
+                                        __func__);
+                               goto cifs_parse_mount_err;
+                       }
+                       vol->snapshot_time = option;
+                       break;
                case Opt_max_credits:
                        if (get_option_ul(args, &option) || (option < 20) ||
                            (option > 60000)) {
@@ -2101,8 +2119,8 @@ cifs_find_tcp_session(struct smb_vol *vol)
        return NULL;
 }
 
-static void
-cifs_put_tcp_session(struct TCP_Server_Info *server)
+void
+cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
 {
        struct task_struct *task;
 
@@ -2119,6 +2137,19 @@ cifs_put_tcp_session(struct TCP_Server_Info *server)
 
        cancel_delayed_work_sync(&server->echo);
 
+#ifdef CONFIG_CIFS_SMB2
+       if (from_reconnect)
+               /*
+                * Avoid deadlock here: reconnect work calls
+                * cifs_put_tcp_session() at its end. Need to be sure
+                * that reconnect work does nothing with server pointer after
+                * that step.
+                */
+               cancel_delayed_work(&server->reconnect);
+       else
+               cancel_delayed_work_sync(&server->reconnect);
+#endif
+
        spin_lock(&GlobalMid_Lock);
        server->tcpStatus = CifsExiting;
        spin_unlock(&GlobalMid_Lock);
@@ -2183,6 +2214,10 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
        INIT_LIST_HEAD(&tcp_ses->tcp_ses_list);
        INIT_LIST_HEAD(&tcp_ses->smb_ses_list);
        INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request);
+#ifdef CONFIG_CIFS_SMB2
+       INIT_DELAYED_WORK(&tcp_ses->reconnect, smb2_reconnect_server);
+       mutex_init(&tcp_ses->reconnect_mutex);
+#endif
        memcpy(&tcp_ses->srcaddr, &volume_info->srcaddr,
               sizeof(tcp_ses->srcaddr));
        memcpy(&tcp_ses->dstaddr, &volume_info->dstaddr,
@@ -2341,7 +2376,7 @@ cifs_put_smb_ses(struct cifs_ses *ses)
        spin_unlock(&cifs_tcp_ses_lock);
 
        sesInfoFree(ses);
-       cifs_put_tcp_session(server);
+       cifs_put_tcp_session(server, 0);
 }
 
 #ifdef CONFIG_KEYS
@@ -2515,7 +2550,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
                mutex_unlock(&ses->session_mutex);
 
                /* existing SMB ses has a server reference already */
-               cifs_put_tcp_session(server);
+               cifs_put_tcp_session(server, 0);
                free_xid(xid);
                return ses;
        }
@@ -2549,6 +2584,8 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
                if (!ses->domainName)
                        goto get_ses_fail;
        }
+       if (volume_info->domainauto)
+               ses->domainAuto = volume_info->domainauto;
        ses->cred_uid = volume_info->cred_uid;
        ses->linux_uid = volume_info->linux_uid;
 
@@ -2587,7 +2624,7 @@ static int match_tcon(struct cifs_tcon *tcon, const char *unc)
 }
 
 static struct cifs_tcon *
-cifs_find_tcon(struct cifs_ses *ses, const char *unc)
+cifs_find_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
 {
        struct list_head *tmp;
        struct cifs_tcon *tcon;
@@ -2595,8 +2632,14 @@ cifs_find_tcon(struct cifs_ses *ses, const char *unc)
        spin_lock(&cifs_tcp_ses_lock);
        list_for_each(tmp, &ses->tcon_list) {
                tcon = list_entry(tmp, struct cifs_tcon, tcon_list);
-               if (!match_tcon(tcon, unc))
+               if (!match_tcon(tcon, volume_info->UNC))
                        continue;
+
+#ifdef CONFIG_CIFS_SMB2
+               if (tcon->snapshot_time != volume_info->snapshot_time)
+                       continue;
+#endif /* CONFIG_CIFS_SMB2 */
+
                ++tcon->tc_count;
                spin_unlock(&cifs_tcp_ses_lock);
                return tcon;
@@ -2605,7 +2648,7 @@ cifs_find_tcon(struct cifs_ses *ses, const char *unc)
        return NULL;
 }
 
-static void
+void
 cifs_put_tcon(struct cifs_tcon *tcon)
 {
        unsigned int xid;
@@ -2637,7 +2680,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
        int rc, xid;
        struct cifs_tcon *tcon;
 
-       tcon = cifs_find_tcon(ses, volume_info->UNC);
+       tcon = cifs_find_tcon(ses, volume_info);
        if (tcon) {
                cifs_dbg(FYI, "Found match on UNC path\n");
                /* existing tcon already has a reference */
@@ -2658,6 +2701,22 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
                goto out_fail;
        }
 
+       if (volume_info->snapshot_time) {
+#ifdef CONFIG_CIFS_SMB2
+               if (ses->server->vals->protocol_id == 0) {
+                       cifs_dbg(VFS,
+                            "Use SMB2 or later for snapshot mount option\n");
+                       rc = -EOPNOTSUPP;
+                       goto out_fail;
+               } else
+                       tcon->snapshot_time = volume_info->snapshot_time;
+#else
+               cifs_dbg(VFS, "Snapshot mount option requires SMB2 support\n");
+               rc = -EOPNOTSUPP;
+               goto out_fail;
+#endif /* CONFIG_CIFS_SMB2 */
+       }
+
        tcon->ses = ses;
        if (volume_info->password) {
                tcon->password = kstrdup(volume_info->password, GFP_KERNEL);
@@ -3707,7 +3766,8 @@ remote_path_check:
                /*
                 * cifs_build_path_to_root works only when we have a valid tcon
                 */
-               full_path = cifs_build_path_to_root(volume_info, cifs_sb, tcon);
+               full_path = cifs_build_path_to_root(volume_info, cifs_sb, tcon,
+                                       tcon->Flags & SMB_SHARE_IS_IN_DFS);
                if (full_path == NULL) {
                        rc = -ENOMEM;
                        goto mount_fail_check;
@@ -3793,7 +3853,7 @@ mount_fail_check:
                else if (ses)
                        cifs_put_smb_ses(ses);
                else
-                       cifs_put_tcp_session(server);
+                       cifs_put_tcp_session(server, 0);
                bdi_destroy(&cifs_sb->bdi);
        }
 
@@ -4104,7 +4164,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
        ses = cifs_get_smb_ses(master_tcon->ses->server, vol_info);
        if (IS_ERR(ses)) {
                tcon = (struct cifs_tcon *)ses;
-               cifs_put_tcp_session(master_tcon->ses->server);
+               cifs_put_tcp_session(master_tcon->ses->server, 0);
                goto out;
        }
 
index 789ff1df2d8d5d1b6b923ee1f60428278a9d0319..2c227a99f369f08e8941652eb87dd685a6f66b61 100644 (file)
@@ -47,7 +47,7 @@ renew_parental_timestamps(struct dentry *direntry)
 
 char *
 cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
-                       struct cifs_tcon *tcon)
+                       struct cifs_tcon *tcon, int add_treename)
 {
        int pplen = vol->prepath ? strlen(vol->prepath) + 1 : 0;
        int dfsplen;
@@ -59,7 +59,7 @@ cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
                return full_path;
        }
 
-       if (tcon->Flags & SMB_SHARE_IS_IN_DFS)
+       if (add_treename)
                dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
        else
                dfsplen = 0;
index 7f5f6176c6f15caff307e078320122141c119ab9..18a1e1d6671fc0825b2f265280a96e065e6c6aae 100644 (file)
@@ -777,6 +777,11 @@ cifs_reopen_persistent_handles(struct cifs_tcon *tcon)
        struct list_head *tmp1;
        struct list_head tmp_list;
 
+       if (!tcon->use_persistent || !tcon->need_reopen_files)
+               return;
+
+       tcon->need_reopen_files = false;
+
        cifs_dbg(FYI, "Reopen persistent handles");
        INIT_LIST_HEAD(&tmp_list);
 
@@ -793,7 +798,8 @@ cifs_reopen_persistent_handles(struct cifs_tcon *tcon)
 
        list_for_each_safe(tmp, tmp1, &tmp_list) {
                open_file = list_entry(tmp, struct cifsFileInfo, rlist);
-               cifs_reopen_file(open_file, false /* do not flush */);
+               if (cifs_reopen_file(open_file, false /* do not flush */))
+                       tcon->need_reopen_files = true;
                list_del_init(&open_file->rlist);
                cifsFileInfo_put(open_file);
        }
index 9f51b81119f2b204361f25d86dcfd350a8917700..001528781b6b0f80552c33f3d8e93fb9cfc27b86 100644 (file)
@@ -189,7 +189,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
        xid = get_xid();
 
        cifs_sb = CIFS_SB(inode->i_sb);
-       cifs_dbg(VFS, "cifs ioctl 0x%x\n", command);
+       cifs_dbg(FYI, "cifs ioctl 0x%x\n", command);
        switch (command) {
                case FS_IOC_GETFLAGS:
                        if (pSMBFile == NULL)
index d031af8d3d4da8b1d57cdb79236529e416d850e3..c4d996f78e1c9a7d63bef0964d7ad127124d3167 100644 (file)
        (CIFS_MF_SYMLINK_LINK_OFFSET + CIFS_MF_SYMLINK_LINK_MAXLEN)
 
 #define CIFS_MF_SYMLINK_LEN_FORMAT "XSym\n%04u\n"
-#define CIFS_MF_SYMLINK_MD5_FORMAT \
-       "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n"
-#define CIFS_MF_SYMLINK_MD5_ARGS(md5_hash) \
-       md5_hash[0],  md5_hash[1],  md5_hash[2],  md5_hash[3], \
-       md5_hash[4],  md5_hash[5],  md5_hash[6],  md5_hash[7], \
-       md5_hash[8],  md5_hash[9],  md5_hash[10], md5_hash[11],\
-       md5_hash[12], md5_hash[13], md5_hash[14], md5_hash[15]
+#define CIFS_MF_SYMLINK_MD5_FORMAT "%16phN\n"
+#define CIFS_MF_SYMLINK_MD5_ARGS(md5_hash) md5_hash
 
 static int
 symlink_hash(unsigned int link_len, const char *link_str, u8 *md5_hash)
index f9e766f464beec408b628146c4e0d4e04010e0f2..b2aff0c6f22c528eb628a25247bad85b1d096a3c 100644 (file)
@@ -260,7 +260,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)
         * and check it for zero before using.
         */
        max_buf = tlink_tcon(cfile->tlink)->ses->server->maxBuf;
-       if (!max_buf) {
+       if (max_buf < sizeof(struct smb2_lock_element)) {
                free_xid(xid);
                return -EINVAL;
        }
index 5ca5ea4668a1482ef9643cd525ded6ebbaa7e326..87457227812c393fe1ee9e09bacd9f1c65d93f9e 100644 (file)
@@ -250,16 +250,19 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
        }
 
        cifs_mark_open_files_invalid(tcon);
+       if (tcon->use_persistent)
+               tcon->need_reopen_files = true;
 
        rc = SMB2_tcon(0, tcon->ses, tcon->treeName, tcon, nls_codepage);
        mutex_unlock(&tcon->ses->session_mutex);
 
-       if (tcon->use_persistent)
-               cifs_reopen_persistent_handles(tcon);
-
        cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc);
        if (rc)
                goto out;
+
+       if (smb2_command != SMB2_INTERNAL_CMD)
+               queue_delayed_work(cifsiod_wq, &server->reconnect, 0);
+
        atomic_inc(&tconInfoReconnectCount);
 out:
        /*
@@ -280,7 +283,7 @@ out:
        case SMB2_CHANGE_NOTIFY:
        case SMB2_QUERY_INFO:
        case SMB2_SET_INFO:
-               return -EAGAIN;
+               rc = -EAGAIN;
        }
        unload_nls(nls_codepage);
        return rc;
@@ -1972,6 +1975,55 @@ smb2_echo_callback(struct mid_q_entry *mid)
        add_credits(server, credits_received, CIFS_ECHO_OP);
 }
 
+void smb2_reconnect_server(struct work_struct *work)
+{
+       struct TCP_Server_Info *server = container_of(work,
+                                       struct TCP_Server_Info, reconnect.work);
+       struct cifs_ses *ses;
+       struct cifs_tcon *tcon, *tcon2;
+       struct list_head tmp_list;
+       int tcon_exist = false;
+
+       /* Prevent simultaneous reconnects that can corrupt tcon->rlist list */
+       mutex_lock(&server->reconnect_mutex);
+
+       INIT_LIST_HEAD(&tmp_list);
+       cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n");
+
+       spin_lock(&cifs_tcp_ses_lock);
+       list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
+               list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+                       if (tcon->need_reconnect || tcon->need_reopen_files) {
+                               tcon->tc_count++;
+                               list_add_tail(&tcon->rlist, &tmp_list);
+                               tcon_exist = true;
+                       }
+               }
+       }
+       /*
+        * Get the reference to server struct to be sure that the last call of
+        * cifs_put_tcon() in the loop below won't release the server pointer.
+        */
+       if (tcon_exist)
+               server->srv_count++;
+
+       spin_unlock(&cifs_tcp_ses_lock);
+
+       list_for_each_entry_safe(tcon, tcon2, &tmp_list, rlist) {
+               if (!smb2_reconnect(SMB2_INTERNAL_CMD, tcon))
+                       cifs_reopen_persistent_handles(tcon);
+               list_del_init(&tcon->rlist);
+               cifs_put_tcon(tcon);
+       }
+
+       cifs_dbg(FYI, "Reconnecting tcons finished\n");
+       mutex_unlock(&server->reconnect_mutex);
+
+       /* now we can safely release srv struct */
+       if (tcon_exist)
+               cifs_put_tcp_session(server, 1);
+}
+
 int
 SMB2_echo(struct TCP_Server_Info *server)
 {
@@ -1984,32 +2036,11 @@ SMB2_echo(struct TCP_Server_Info *server)
        cifs_dbg(FYI, "In echo request\n");
 
        if (server->tcpStatus == CifsNeedNegotiate) {
-               struct list_head *tmp, *tmp2;
-               struct cifs_ses *ses;
-               struct cifs_tcon *tcon;
-
-               cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n");
-               spin_lock(&cifs_tcp_ses_lock);
-               list_for_each(tmp, &server->smb_ses_list) {
-                       ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
-                       list_for_each(tmp2, &ses->tcon_list) {
-                               tcon = list_entry(tmp2, struct cifs_tcon,
-                                                 tcon_list);
-                               /* add check for persistent handle reconnect */
-                               if (tcon && tcon->need_reconnect) {
-                                       spin_unlock(&cifs_tcp_ses_lock);
-                                       rc = smb2_reconnect(SMB2_ECHO, tcon);
-                                       spin_lock(&cifs_tcp_ses_lock);
-                               }
-                       }
-               }
-               spin_unlock(&cifs_tcp_ses_lock);
+               /* No need to send echo on newly established connections */
+               queue_delayed_work(cifsiod_wq, &server->reconnect, 0);
+               return rc;
        }
 
-       /* if no session, renegotiate failed above */
-       if (server->tcpStatus == CifsNeedNegotiate)
-               return -EIO;
-
        rc = small_smb2_init(SMB2_ECHO, NULL, (void **)&req);
        if (rc)
                return rc;
index fd3709e8de33eddee8c66cca29cb6653921b020e..dc0d141f33e25730ea0242d2f946034e321cb1a4 100644 (file)
@@ -80,6 +80,8 @@
 #define SMB2_SET_INFO          cpu_to_le16(SMB2_SET_INFO_HE)
 #define SMB2_OPLOCK_BREAK      cpu_to_le16(SMB2_OPLOCK_BREAK_HE)
 
+#define SMB2_INTERNAL_CMD      cpu_to_le16(0xFFFF)
+
 #define NUMBER_OF_SMB2_COMMANDS        0x0013
 
 /* BB FIXME - analyze following length BB */
index eb2cde2f64ba7c818c5ea0db10dd8cb192d94c67..f2d511a6971b88c0019526bcd5b3938383f4f106 100644 (file)
@@ -96,6 +96,7 @@ extern int smb2_open_file(const unsigned int xid,
 extern int smb2_unlock_range(struct cifsFileInfo *cfile,
                             struct file_lock *flock, const unsigned int xid);
 extern int smb2_push_mandatory_locks(struct cifsFileInfo *cfile);
+extern void smb2_reconnect_server(struct work_struct *work);
 
 /*
  * SMB2 Worker functions - most of protocol specific implementation details
index 699b7868108f658a3262943c7763b13d59767a89..c12bffefa3c9b59b2290ecdb243ae308b08e7224 100644 (file)
@@ -23,7 +23,7 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <crypto/skcipher.h>
+#include <linux/crypto.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
@@ -69,46 +69,22 @@ str_to_key(unsigned char *str, unsigned char *key)
 static int
 smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
 {
-       int rc;
        unsigned char key2[8];
-       struct crypto_skcipher *tfm_des;
-       struct scatterlist sgin, sgout;
-       struct skcipher_request *req;
+       struct crypto_cipher *tfm_des;
 
        str_to_key(key, key2);
 
-       tfm_des = crypto_alloc_skcipher("ecb(des)", 0, CRYPTO_ALG_ASYNC);
+       tfm_des = crypto_alloc_cipher("des", 0, 0);
        if (IS_ERR(tfm_des)) {
-               rc = PTR_ERR(tfm_des);
-               cifs_dbg(VFS, "could not allocate des crypto API\n");
-               goto smbhash_err;
-       }
-
-       req = skcipher_request_alloc(tfm_des, GFP_KERNEL);
-       if (!req) {
-               rc = -ENOMEM;
                cifs_dbg(VFS, "could not allocate des crypto API\n");
-               goto smbhash_free_skcipher;
+               return PTR_ERR(tfm_des);
        }
 
-       crypto_skcipher_setkey(tfm_des, key2, 8);
-
-       sg_init_one(&sgin, in, 8);
-       sg_init_one(&sgout, out, 8);
+       crypto_cipher_setkey(tfm_des, key2, 8);
+       crypto_cipher_encrypt_one(tfm_des, out, in);
+       crypto_free_cipher(tfm_des);
 
-       skcipher_request_set_callback(req, 0, NULL, NULL);
-       skcipher_request_set_crypt(req, &sgin, &sgout, 8, NULL);
-
-       rc = crypto_skcipher_encrypt(req);
-       if (rc)
-               cifs_dbg(VFS, "could not encrypt crypt key rc: %d\n", rc);
-
-       skcipher_request_free(req);
-
-smbhash_free_skcipher:
-       crypto_free_skcipher(tfm_des);
-smbhash_err:
-       return rc;
+       return 0;
 }
 
 static int
index 5f02edc819af277cfd88a7897f37b34771278b36..fbb84c08e3cdfd9814b59aa098c6aae69ccd1c65 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/tcp.h>
 #include <linux/bvec.h>
 #include <linux/highmem.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>
 #include <linux/mempool.h>
 #include "cifspdu.h"
index 543b48c29ac3157eec076bf78b15190d3cd38316..e50a2114f4740859667ba20e230adb2ee6ce7f2b 100644 (file)
@@ -49,7 +49,7 @@
 #include <linux/pagemap.h>
 #include <linux/aio.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/ioctls.h>
 #include "internal.h"
@@ -487,45 +487,6 @@ COMPAT_SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd,
        return compat_sys_fcntl64(fd, cmd, arg);
 }
 
-COMPAT_SYSCALL_DEFINE2(io_setup, unsigned, nr_reqs, u32 __user *, ctx32p)
-{
-       long ret;
-       aio_context_t ctx64;
-
-       mm_segment_t oldfs = get_fs();
-       if (unlikely(get_user(ctx64, ctx32p)))
-               return -EFAULT;
-
-       set_fs(KERNEL_DS);
-       /* The __user pointer cast is valid because of the set_fs() */
-       ret = sys_io_setup(nr_reqs, (aio_context_t __user *) &ctx64);
-       set_fs(oldfs);
-       /* truncating is ok because it's a user address */
-       if (!ret)
-               ret = put_user((u32) ctx64, ctx32p);
-       return ret;
-}
-
-COMPAT_SYSCALL_DEFINE5(io_getevents, compat_aio_context_t, ctx_id,
-                      compat_long_t, min_nr,
-                      compat_long_t, nr,
-                      struct io_event __user *, events,
-                      struct compat_timespec __user *, timeout)
-{
-       struct timespec t;
-       struct timespec __user *ut = NULL;
-
-       if (timeout) {
-               if (compat_get_timespec(&t, timeout))
-                       return -EFAULT;
-
-               ut = compat_alloc_user_space(sizeof(*ut));
-               if (copy_to_user(ut, &t, sizeof(t)) )
-                       return -EFAULT;
-       } 
-       return sys_io_getevents(ctx_id, min_nr, nr, events, ut);
-}
-
 /* A write operation does a read from user space and vice versa */
 #define vrfy_dir(type) ((type) == READ ? VERIFY_WRITE : VERIFY_READ)
 
@@ -602,42 +563,6 @@ out:
        return ret;
 }
 
-static inline long
-copy_iocb(long nr, u32 __user *ptr32, struct iocb __user * __user *ptr64)
-{
-       compat_uptr_t uptr;
-       int i;
-
-       for (i = 0; i < nr; ++i) {
-               if (get_user(uptr, ptr32 + i))
-                       return -EFAULT;
-               if (put_user(compat_ptr(uptr), ptr64 + i))
-                       return -EFAULT;
-       }
-       return 0;
-}
-
-#define MAX_AIO_SUBMITS        (PAGE_SIZE/sizeof(struct iocb *))
-
-COMPAT_SYSCALL_DEFINE3(io_submit, compat_aio_context_t, ctx_id,
-                      int, nr, u32 __user *, iocb)
-{
-       struct iocb __user * __user *iocb64; 
-       long ret;
-
-       if (unlikely(nr < 0))
-               return -EINVAL;
-
-       if (nr > MAX_AIO_SUBMITS)
-               nr = MAX_AIO_SUBMITS;
-       
-       iocb64 = compat_alloc_user_space(nr * sizeof(*iocb64));
-       ret = copy_iocb(nr, iocb, iocb64);
-       if (!ret)
-               ret = do_io_submit(ctx_id, nr, iocb64, 1);
-       return ret;
-}
-
 struct compat_ncp_mount_data {
        compat_int_t version;
        compat_uint_t ncp_fd;
index f2d7402abe02a59c95c4ef3ee1e556f9eea638b2..11d087b2b28edd79bf03b367d45bfd49bd210352 100644 (file)
@@ -76,7 +76,7 @@
 #include <scsi/sg.h>
 #endif
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/ethtool.h>
 #include <linux/mii.h>
 #include <linux/if_bonding.h>
index 2c6312db85168050f6ee35d0e82465d994e7a1ea..39da1103d34153e6c14780a4ffb1882e221cf3d1 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/slab.h>
 #include <linux/mutex.h>
 #include <linux/vmalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/configfs.h>
 #include "configfs_internal.h"
index eb9c92c9b20f5de5e325d7a05e5d055d0816989e..e525b6017cdf863fd811425fb603070be40420b2 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/path.h>
 #include <linux/timekeeping.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/tlb.h>
 #include <asm/exec.h>
index 6eeea1dcba41c2fa75c479ce1a3fa16f7cd2e7a5..95cd4c3b06c326708a3315d3da86bdb9aafd5469 100644 (file)
@@ -248,7 +248,8 @@ retry:
                goto out;
 
        if (fscrypt_dummy_context_enabled(inode)) {
-               memset(raw_key, 0x42, FS_AES_256_XTS_KEY_SIZE);
+               memset(raw_key, 0x42, keysize/2);
+               memset(raw_key+keysize/2, 0x24, keysize - (keysize/2));
                goto got_key;
        }
 
index 6ed7c2eebeec53c7656054d05061dc83a23ef1c0..d6cd7ea4851da877b13c7af306fd07f8468a54f4 100644 (file)
@@ -179,6 +179,11 @@ int fscrypt_has_permitted_context(struct inode *parent, struct inode *child)
                BUG_ON(1);
        }
 
+       /* No restrictions on file types which are never encrypted */
+       if (!S_ISREG(child->i_mode) && !S_ISDIR(child->i_mode) &&
+           !S_ISLNK(child->i_mode))
+               return 1;
+
        /* no restrictions if the parent directory is not encrypted */
        if (!parent->i_sb->s_cop->is_encrypted(parent))
                return 1;
index a8732fbed381a45bbce44fcdf0731ccfdc1a09ba..5c74f60d0a5094dc0a27f27ae0acd41667414332 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -451,16 +451,37 @@ void dax_wake_mapping_entry_waiter(struct address_space *mapping,
                __wake_up(wq, TASK_NORMAL, wake_all ? 0 : 1, &key);
 }
 
+static int __dax_invalidate_mapping_entry(struct address_space *mapping,
+                                         pgoff_t index, bool trunc)
+{
+       int ret = 0;
+       void *entry;
+       struct radix_tree_root *page_tree = &mapping->page_tree;
+
+       spin_lock_irq(&mapping->tree_lock);
+       entry = get_unlocked_mapping_entry(mapping, index, NULL);
+       if (!entry || !radix_tree_exceptional_entry(entry))
+               goto out;
+       if (!trunc &&
+           (radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_DIRTY) ||
+            radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_TOWRITE)))
+               goto out;
+       radix_tree_delete(page_tree, index);
+       mapping->nrexceptional--;
+       ret = 1;
+out:
+       put_unlocked_mapping_entry(mapping, index, entry);
+       spin_unlock_irq(&mapping->tree_lock);
+       return ret;
+}
 /*
  * Delete exceptional DAX entry at @index from @mapping. Wait for radix tree
  * entry to get unlocked before deleting it.
  */
 int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index)
 {
-       void *entry;
+       int ret = __dax_invalidate_mapping_entry(mapping, index, true);
 
-       spin_lock_irq(&mapping->tree_lock);
-       entry = get_unlocked_mapping_entry(mapping, index, NULL);
        /*
         * This gets called from truncate / punch_hole path. As such, the caller
         * must hold locks protecting against concurrent modifications of the
@@ -468,16 +489,46 @@ int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index)
         * caller has seen exceptional entry for this index, we better find it
         * at that index as well...
         */
-       if (WARN_ON_ONCE(!entry || !radix_tree_exceptional_entry(entry))) {
-               spin_unlock_irq(&mapping->tree_lock);
-               return 0;
-       }
-       radix_tree_delete(&mapping->page_tree, index);
+       WARN_ON_ONCE(!ret);
+       return ret;
+}
+
+/*
+ * Invalidate exceptional DAX entry if easily possible. This handles DAX
+ * entries for invalidate_inode_pages() so we evict the entry only if we can
+ * do so without blocking.
+ */
+int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index)
+{
+       int ret = 0;
+       void *entry, **slot;
+       struct radix_tree_root *page_tree = &mapping->page_tree;
+
+       spin_lock_irq(&mapping->tree_lock);
+       entry = __radix_tree_lookup(page_tree, index, NULL, &slot);
+       if (!entry || !radix_tree_exceptional_entry(entry) ||
+           slot_locked(mapping, slot))
+               goto out;
+       if (radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_DIRTY) ||
+           radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_TOWRITE))
+               goto out;
+       radix_tree_delete(page_tree, index);
        mapping->nrexceptional--;
+       ret = 1;
+out:
        spin_unlock_irq(&mapping->tree_lock);
-       dax_wake_mapping_entry_waiter(mapping, index, entry, true);
+       if (ret)
+               dax_wake_mapping_entry_waiter(mapping, index, entry, true);
+       return ret;
+}
 
-       return 1;
+/*
+ * Invalidate exceptional DAX entry if it is clean.
+ */
+int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
+                                     pgoff_t index)
+{
+       return __dax_invalidate_mapping_entry(mapping, index, false);
 }
 
 /*
@@ -488,15 +539,16 @@ int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index)
  * otherwise it will simply fall out of the page cache under memory
  * pressure without ever having been dirtied.
  */
-static int dax_load_hole(struct address_space *mapping, void *entry,
+static int dax_load_hole(struct address_space *mapping, void **entry,
                         struct vm_fault *vmf)
 {
        struct page *page;
+       int ret;
 
        /* Hole page already exists? Return it...  */
-       if (!radix_tree_exceptional_entry(entry)) {
-               vmf->page = entry;
-               return VM_FAULT_LOCKED;
+       if (!radix_tree_exceptional_entry(*entry)) {
+               page = *entry;
+               goto out;
        }
 
        /* This will replace locked radix tree entry with a hole page */
@@ -504,8 +556,17 @@ static int dax_load_hole(struct address_space *mapping, void *entry,
                                   vmf->gfp_mask | __GFP_ZERO);
        if (!page)
                return VM_FAULT_OOM;
+ out:
        vmf->page = page;
-       return VM_FAULT_LOCKED;
+       ret = finish_fault(vmf);
+       vmf->page = NULL;
+       *entry = page;
+       if (!ret) {
+               /* Grab reference for PTE that is now referencing the page */
+               get_page(page);
+               return VM_FAULT_NOPAGE;
+       }
+       return ret;
 }
 
 static int copy_user_dax(struct block_device *bdev, sector_t sector, size_t size,
@@ -934,6 +995,17 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
        if (WARN_ON_ONCE(iomap->type != IOMAP_MAPPED))
                return -EIO;
 
+       /*
+        * Write can allocate block for an area which has a hole page mapped
+        * into page tables. We have to tear down these mappings so that data
+        * written by write(2) is visible in mmap.
+        */
+       if ((iomap->flags & IOMAP_F_NEW) && inode->i_mapping->nrpages) {
+               invalidate_inode_pages2_range(inode->i_mapping,
+                                             pos >> PAGE_SHIFT,
+                                             (end - 1) >> PAGE_SHIFT);
+       }
+
        while (pos < end) {
                unsigned offset = pos & (PAGE_SIZE - 1);
                struct blk_dax_ctl dax = { 0 };
@@ -992,23 +1064,6 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
        if (iov_iter_rw(iter) == WRITE)
                flags |= IOMAP_WRITE;
 
-       /*
-        * Yes, even DAX files can have page cache attached to them:  A zeroed
-        * page is inserted into the pagecache when we have to serve a write
-        * fault on a hole.  It should never be dirtied and can simply be
-        * dropped from the pagecache once we get real data for the page.
-        *
-        * XXX: This is racy against mmap, and there's nothing we can do about
-        * it. We'll eventually need to shift this down even further so that
-        * we can check if we allocated blocks over a hole first.
-        */
-       if (mapping->nrpages) {
-               ret = invalidate_inode_pages2_range(mapping,
-                               pos >> PAGE_SHIFT,
-                               (pos + iov_iter_count(iter) - 1) >> PAGE_SHIFT);
-               WARN_ON_ONCE(ret);
-       }
-
        while (iov_iter_count(iter)) {
                ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops,
                                iter, dax_iomap_actor);
@@ -1023,6 +1078,15 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
 }
 EXPORT_SYMBOL_GPL(dax_iomap_rw);
 
+static int dax_fault_return(int error)
+{
+       if (error == 0)
+               return VM_FAULT_NOPAGE;
+       if (error == -ENOMEM)
+               return VM_FAULT_OOM;
+       return VM_FAULT_SIGBUS;
+}
+
 /**
  * dax_iomap_fault - handle a page fault on a DAX file
  * @vma: The virtual memory area where the fault occurred
@@ -1055,12 +1119,6 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
        if (pos >= i_size_read(inode))
                return VM_FAULT_SIGBUS;
 
-       entry = grab_mapping_entry(mapping, vmf->pgoff, 0);
-       if (IS_ERR(entry)) {
-               error = PTR_ERR(entry);
-               goto out;
-       }
-
        if ((vmf->flags & FAULT_FLAG_WRITE) && !vmf->cow_page)
                flags |= IOMAP_WRITE;
 
@@ -1071,9 +1129,15 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
         */
        error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap);
        if (error)
-               goto unlock_entry;
+               return dax_fault_return(error);
        if (WARN_ON_ONCE(iomap.offset + iomap.length < pos + PAGE_SIZE)) {
-               error = -EIO;           /* fs corruption? */
+               vmf_ret = dax_fault_return(-EIO);       /* fs corruption? */
+               goto finish_iomap;
+       }
+
+       entry = grab_mapping_entry(mapping, vmf->pgoff, 0);
+       if (IS_ERR(entry)) {
+               vmf_ret = dax_fault_return(PTR_ERR(entry));
                goto finish_iomap;
        }
 
@@ -1096,13 +1160,13 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
                }
 
                if (error)
-                       goto finish_iomap;
+                       goto error_unlock_entry;
 
                __SetPageUptodate(vmf->cow_page);
                vmf_ret = finish_fault(vmf);
                if (!vmf_ret)
                        vmf_ret = VM_FAULT_DONE_COW;
-               goto finish_iomap;
+               goto unlock_entry;
        }
 
        switch (iomap.type) {
@@ -1114,12 +1178,15 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
                }
                error = dax_insert_mapping(mapping, iomap.bdev, sector,
                                PAGE_SIZE, &entry, vma, vmf);
+               /* -EBUSY is fine, somebody else faulted on the same PTE */
+               if (error == -EBUSY)
+                       error = 0;
                break;
        case IOMAP_UNWRITTEN:
        case IOMAP_HOLE:
                if (!(vmf->flags & FAULT_FLAG_WRITE)) {
-                       vmf_ret = dax_load_hole(mapping, entry, vmf);
-                       break;
+                       vmf_ret = dax_load_hole(mapping, &entry, vmf);
+                       goto unlock_entry;
                }
                /*FALLTHRU*/
        default:
@@ -1128,31 +1195,25 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
                break;
        }
 
+ error_unlock_entry:
+       vmf_ret = dax_fault_return(error) | major;
+ unlock_entry:
+       put_locked_mapping_entry(mapping, vmf->pgoff, entry);
  finish_iomap:
        if (ops->iomap_end) {
-               if (error || (vmf_ret & VM_FAULT_ERROR)) {
-                       /* keep previous error */
-                       ops->iomap_end(inode, pos, PAGE_SIZE, 0, flags,
-                                       &iomap);
-               } else {
-                       error = ops->iomap_end(inode, pos, PAGE_SIZE,
-                                       PAGE_SIZE, flags, &iomap);
-               }
-       }
- unlock_entry:
-       if (vmf_ret != VM_FAULT_LOCKED || error)
-               put_locked_mapping_entry(mapping, vmf->pgoff, entry);
- out:
-       if (error == -ENOMEM)
-               return VM_FAULT_OOM | major;
-       /* -EBUSY is fine, somebody else faulted on the same PTE */
-       if (error < 0 && error != -EBUSY)
-               return VM_FAULT_SIGBUS | major;
-       if (vmf_ret) {
-               WARN_ON_ONCE(error); /* -EBUSY from ops->iomap_end? */
-               return vmf_ret;
+               int copied = PAGE_SIZE;
+
+               if (vmf_ret & VM_FAULT_ERROR)
+                       copied = 0;
+               /*
+                * The fault is done by now and there's no way back (other
+                * thread may be already happily using PTE we have installed).
+                * Just ignore error from ->iomap_end since we cannot do much
+                * with it.
+                */
+               ops->iomap_end(inode, pos, PAGE_SIZE, copied, flags, &iomap);
        }
-       return VM_FAULT_NOPAGE | major;
+       return vmf_ret;
 }
 EXPORT_SYMBOL_GPL(dax_iomap_fault);
 
@@ -1276,16 +1337,6 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
        if ((pgoff | PG_PMD_COLOUR) > max_pgoff)
                goto fallback;
 
-       /*
-        * grab_mapping_entry() will make sure we get a 2M empty entry, a DAX
-        * PMD or a HZP entry.  If it can't (because a 4k page is already in
-        * the tree, for instance), it will return -EEXIST and we just fall
-        * back to 4k entries.
-        */
-       entry = grab_mapping_entry(mapping, pgoff, RADIX_DAX_PMD);
-       if (IS_ERR(entry))
-               goto fallback;
-
        /*
         * Note that we don't use iomap_apply here.  We aren't doing I/O, only
         * setting up a mapping, so really we're using iomap_begin() as a way
@@ -1294,10 +1345,21 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
        pos = (loff_t)pgoff << PAGE_SHIFT;
        error = ops->iomap_begin(inode, pos, PMD_SIZE, iomap_flags, &iomap);
        if (error)
-               goto unlock_entry;
+               goto fallback;
+
        if (iomap.offset + iomap.length < pos + PMD_SIZE)
                goto finish_iomap;
 
+       /*
+        * grab_mapping_entry() will make sure we get a 2M empty entry, a DAX
+        * PMD or a HZP entry.  If it can't (because a 4k page is already in
+        * the tree, for instance), it will return -EEXIST and we just fall
+        * back to 4k entries.
+        */
+       entry = grab_mapping_entry(mapping, pgoff, RADIX_DAX_PMD);
+       if (IS_ERR(entry))
+               goto finish_iomap;
+
        vmf.pgoff = pgoff;
        vmf.flags = flags;
        vmf.gfp_mask = mapping_gfp_mask(mapping) | __GFP_IO;
@@ -1310,7 +1372,7 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
        case IOMAP_UNWRITTEN:
        case IOMAP_HOLE:
                if (WARN_ON_ONCE(write))
-                       goto finish_iomap;
+                       goto unlock_entry;
                result = dax_pmd_load_hole(vma, pmd, &vmf, address, &iomap,
                                &entry);
                break;
@@ -1319,20 +1381,23 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
                break;
        }
 
+ unlock_entry:
+       put_locked_mapping_entry(mapping, pgoff, entry);
  finish_iomap:
        if (ops->iomap_end) {
-               if (result == VM_FAULT_FALLBACK) {
-                       ops->iomap_end(inode, pos, PMD_SIZE, 0, iomap_flags,
-                                       &iomap);
-               } else {
-                       error = ops->iomap_end(inode, pos, PMD_SIZE, PMD_SIZE,
-                                       iomap_flags, &iomap);
-                       if (error)
-                               result = VM_FAULT_FALLBACK;
-               }
+               int copied = PMD_SIZE;
+
+               if (result == VM_FAULT_FALLBACK)
+                       copied = 0;
+               /*
+                * The fault is done by now and there's no way back (other
+                * thread may be already happily using PMD we have installed).
+                * Just ignore error from ->iomap_end since we cannot do much
+                * with it.
+                */
+               ops->iomap_end(inode, pos, PMD_SIZE, copied, iomap_flags,
+                               &iomap);
        }
- unlock_entry:
-       put_locked_mapping_entry(mapping, pgoff, entry);
  fallback:
        if (result == VM_FAULT_FALLBACK) {
                split_huge_pmd(vma, pmd, address);
index 252378359a8f64eb69323dd88efa4747f20b488f..769903dbc19df53199b4aca2e79607145e179c98 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/export.h>
 #include <linux/mount.h>
 #include <linux/file.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/security.h>
 #include <linux/seqlock.h>
 #include <linux/swap.h>
index a26a701ef512e840d21b9bdd7024ff1574e4b3c6..0d0461cf2431234b90542ec78b509e86972d0ce3 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/mutex.h>
 #include <linux/path.h>
 #include <linux/compat.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* The dcookies are allocated from a kmem_cache and
  * hashed onto a small number of lists. None of the
index b670f5601fbb4f779ead4148a2d007f1026cf01f..748e8d59e61113b8491fd896d2439ac5853ea5d1 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/mutex.h>
 #include <linux/idr.h>
 #include <linux/ratelimit.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/dlm.h>
 #include "config.h"
index 35502d4046f573fac4909cceec1117ef033338e6..6df332296c661a688289da35e890f89696bfdccb 100644 (file)
@@ -1395,7 +1395,6 @@ static int nodeid_warned(int nodeid, int num_nodes, int *warned)
 void dlm_scan_waiters(struct dlm_ls *ls)
 {
        struct dlm_lkb *lkb;
-       ktime_t zero = ktime_set(0, 0);
        s64 us;
        s64 debug_maxus = 0;
        u32 debug_scanned = 0;
@@ -1409,7 +1408,7 @@ void dlm_scan_waiters(struct dlm_ls *ls)
        mutex_lock(&ls->ls_waiters_mutex);
 
        list_for_each_entry(lkb, &ls->ls_waiters, lkb_wait_reply) {
-               if (ktime_equal(lkb->lkb_wait_time, zero))
+               if (!lkb->lkb_wait_time)
                        continue;
 
                debug_scanned++;
@@ -1419,7 +1418,7 @@ void dlm_scan_waiters(struct dlm_ls *ls)
                if (us < dlm_config.ci_waitwarn_us)
                        continue;
 
-               lkb->lkb_wait_time = zero;
+               lkb->lkb_wait_time = 0;
 
                debug_expired++;
                if (us > debug_maxus)
index 5bbf9612140c544bffcf4ee3aad223d3aa823062..70f5d4f9a94570ec6c41ec8d855e05956002e0cc 100644 (file)
@@ -14,7 +14,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/fs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define EFS_VERSION "1.0a"
 
index 10db912189338096a3d37176b043145bca923da8..bcb68fcc844515c67e7efc83710dabdce361f8b9 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/mutex.h>
 #include <linux/anon_inodes.h>
 #include <linux/device.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/mman.h>
 #include <linux/atomic.h>
index 8112eacf10f3afe7243385e46e37625b4ea3d03e..e579466107335bf4b704863469a4162c8c335adb 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -19,7 +19,7 @@
  * current->executable is only used by the procfs.  This allows a dispatch
  * table to check for several different types  of binary formats.  We keep
  * trying until we recognize the file or we run out of supported binary
- * formats. 
+ * formats.
  */
 
 #include <linux/slab.h>
@@ -58,7 +58,7 @@
 #include <linux/compat.h>
 #include <linux/vmalloc.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/tlb.h>
 
@@ -1268,6 +1268,13 @@ int flush_old_exec(struct linux_binprm * bprm)
        flush_thread();
        current->personality &= ~bprm->per_clear;
 
+       /*
+        * We have to apply CLOEXEC before we change whether the process is
+        * dumpable (in setup_new_exec) to avoid a race with a process in userspace
+        * trying to access the should-be-closed file descriptors of a process
+        * undergoing exec(2).
+        */
+       do_close_on_exec(current->files);
        return 0;
 
 out:
@@ -1330,7 +1337,6 @@ void setup_new_exec(struct linux_binprm * bprm)
           group */
        current->self_exec_id++;
        flush_signal_handlers(current, 0);
-       do_close_on_exec(current->files);
 }
 EXPORT_SYMBOL(setup_new_exec);
 
index 0093ea2512a85809e16605088074a8335513e81c..f073bfca694b9982b8bc23e8f0e00be6bef075a7 100644 (file)
@@ -751,9 +751,8 @@ static int ext2_get_blocks(struct inode *inode,
                        mutex_unlock(&ei->truncate_mutex);
                        goto cleanup;
                }
-       } else {
-               *new = true;
        }
+       *new = true;
 
        ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
        mutex_unlock(&ei->truncate_mutex);
index 9d617423e93660344c1f8c12363f4b82284b08e3..191e02b28ce8ff0329646313a7e8445b36ef7b93 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/compat.h>
 #include <linux/mount.h>
 #include <asm/current.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
index 6cb042b53b5ba671b1027973d690d9aac9b78cc3..9e25a71fe1a27e584ab3754f0a70b26e94f9a44c 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/mount.h>
 #include <linux/log2.h>
 #include <linux/quotaops.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "ext2.h"
 #include "xattr.h"
 #include "acl.h"
index b1f8416923ab9384adc89d36c9d99fa3e21a7285..3e295d3350a9470b61a0bb4a8a1fffc30a451292 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/quotaops.h>
 #include <linux/string.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fiemap.h>
 #include <linux/backing-dev.h>
 #include "ext4_jbd2.h"
index b5f184493c57b0fd91cfc5f6c0633577ce770884..d663d3d7c81cb7fdff0f33f1903e9ed4d1f77f9a 100644 (file)
@@ -258,7 +258,6 @@ out:
 static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        int result;
-       handle_t *handle = NULL;
        struct inode *inode = file_inode(vma->vm_file);
        struct super_block *sb = inode->i_sb;
        bool write = vmf->flags & FAULT_FLAG_WRITE;
@@ -266,24 +265,12 @@ static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        if (write) {
                sb_start_pagefault(sb);
                file_update_time(vma->vm_file);
-               down_read(&EXT4_I(inode)->i_mmap_sem);
-               handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE,
-                                               EXT4_DATA_TRANS_BLOCKS(sb));
-       } else
-               down_read(&EXT4_I(inode)->i_mmap_sem);
-
-       if (IS_ERR(handle))
-               result = VM_FAULT_SIGBUS;
-       else
-               result = dax_iomap_fault(vma, vmf, &ext4_iomap_ops);
-
-       if (write) {
-               if (!IS_ERR(handle))
-                       ext4_journal_stop(handle);
-               up_read(&EXT4_I(inode)->i_mmap_sem);
+       }
+       down_read(&EXT4_I(inode)->i_mmap_sem);
+       result = dax_iomap_fault(vma, vmf, &ext4_iomap_ops);
+       up_read(&EXT4_I(inode)->i_mmap_sem);
+       if (write)
                sb_end_pagefault(sb);
-       } else
-               up_read(&EXT4_I(inode)->i_mmap_sem);
 
        return result;
 }
@@ -292,7 +279,6 @@ static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
                                                pmd_t *pmd, unsigned int flags)
 {
        int result;
-       handle_t *handle = NULL;
        struct inode *inode = file_inode(vma->vm_file);
        struct super_block *sb = inode->i_sb;
        bool write = flags & FAULT_FLAG_WRITE;
@@ -300,27 +286,13 @@ static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
        if (write) {
                sb_start_pagefault(sb);
                file_update_time(vma->vm_file);
-               down_read(&EXT4_I(inode)->i_mmap_sem);
-               handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE,
-                               ext4_chunk_trans_blocks(inode,
-                                                       PMD_SIZE / PAGE_SIZE));
-       } else
-               down_read(&EXT4_I(inode)->i_mmap_sem);
-
-       if (IS_ERR(handle))
-               result = VM_FAULT_SIGBUS;
-       else {
-               result = dax_iomap_pmd_fault(vma, addr, pmd, flags,
-                                            &ext4_iomap_ops);
        }
-
-       if (write) {
-               if (!IS_ERR(handle))
-                       ext4_journal_stop(handle);
-               up_read(&EXT4_I(inode)->i_mmap_sem);
+       down_read(&EXT4_I(inode)->i_mmap_sem);
+       result = dax_iomap_pmd_fault(vma, addr, pmd, flags,
+                                    &ext4_iomap_ops);
+       up_read(&EXT4_I(inode)->i_mmap_sem);
+       if (write)
                sb_end_pagefault(sb);
-       } else
-               up_read(&EXT4_I(inode)->i_mmap_sem);
 
        return result;
 }
index 49fd1371bfa2ef522ba6a4d3d190c624312bdfe2..d534399cf60785ed42cabe77b5ab41aefcb6ae9b 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/file.h>
 #include <linux/quotaops.h>
 #include <linux/uuid.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "ext4_jbd2.h"
 #include "ext4.h"
 
index 63a6b6332682b8865576b7554c63e23d3e2841ae..66845a08a87a42bc8a97c7fcab88644c19d6b0f9 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/log2.h>
 #include <linux/crc16.h>
 #include <linux/cleancache.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/kthread.h>
 #include <linux/freezer.h>
index 6e2771c210f63a177591bb0dd11e61bdc95bb6a2..e1c54f20325ca870af01d26e21d42dc0c94604a9 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <asm/poll.h>
 #include <asm/siginfo.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
 
index ca3c3dd017897936d114e0adb76ec120794f1cfc..5559168d5637310d2712eab97af1117a786cfba1 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/fs_struct.h>
 #include <linux/fsnotify.h>
 #include <linux/personality.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 #include "mount.h"
 
index c5618db110be454781d6c7b8a70f8284fa00a477..cac75547d35ccb163a6ce0e94c786c1fd150e5db 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * Handling of filesystem drivers list.
index e23ff70b34357b12f9990b7d92a1355f1de62a8e..016c11eaca7cdd687bbbf88fb8d979f4eddc6010 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/swap.h>
 #include <linux/crc32.h>
 #include <linux/writeback.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/dlm.h>
 #include <linux/dlm_plock.h>
 #include <linux/delay.h>
index 14cbf60167a7aed5532f5adaf848dd32c432c138..94f50cac91c617b03025d4d596d8d9d65d2c185b 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/list.h>
 #include <linux/wait.h>
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/seq_file.h>
 #include <linux/debugfs.h>
 #include <linux/kthread.h>
@@ -695,7 +695,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
        gl->gl_target = LM_ST_UNLOCKED;
        gl->gl_demote_state = LM_ST_EXCLUSIVE;
        gl->gl_ops = glops;
-       gl->gl_dstamp = ktime_set(0, 0);
+       gl->gl_dstamp = 0;
        preempt_disable();
        /* We use the global stats to estimate the initial per-glock stats */
        gl->gl_stats = this_cpu_ptr(sdp->sd_lkstats)->lkstats[glops->go_type];
index 6cd9f84967b8a8b89a446c4a6232c65627233be2..eb7724b8578a0409889a20953005c98e1544b559 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/crc32.h>
 #include <linux/fiemap.h>
 #include <linux/security.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "gfs2.h"
 #include "incore.h"
index c9ff1cf7d4f3ec9e4168d401ce595f9665c9e701..f8d30e41d1d33b966353290b77594bcb7c103834 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/buffer_head.h>
 #include <linux/module.h>
 #include <linux/kobject.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/genhd.h>
 
index aee4485ad8a9b4f75de1bb9fa356f582ff4a5e4c..763d659db91b4cf8de24c67311b16479bbe1dbb2 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/buffer_head.h>
 #include <linux/crc32.h>
 #include <linux/gfs2_ondisk.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "gfs2.h"
 #include "incore.h"
index a4a577088d19c32d31071cd60f518452750103ab..d87721aeb5755eedea44d5c46349e65037ea69e3 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/xattr.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/posix_acl_xattr.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "gfs2.h"
 #include "incore.h"
index 4cdec5a1934776fda13253c7aeae54b172744580..6d0783e2e2762d295b91e571015d90c98f4ec8d0 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/workqueue.h>
 
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "hfs.h"
 
index 99627f8a0a1829b1b8007d9523aee26775dd9329..0a156d84e67d63aaa75f57bd3741b59e4bf47748 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/fs.h>
 #include <linux/mount.h>
 #include <linux/sched.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "hfsplus_fs.h"
 
 /*
index 4fb7b10f3a05e0f3c0c0cbe11d3355c82b2a6e06..54de77e78775ed99356cae38eb16e4bd366551ab 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/migrate.h>
 #include <linux/uio.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static const struct super_operations hugetlbfs_ops;
 static const struct address_space_operations hugetlbfs_aops;
index 8ed971eeab44d60cba663859db69ab5a777ad13e..a097048ed1a3a0315a36c36befb13e78166a1db4 100644 (file)
@@ -47,7 +47,7 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/jbd2.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 
 #ifdef CONFIG_JBD2_DEBUG
index b6fd1ff29ddf91b6556ed9a61d06142484b610d5..fc89f94367842583d7dd9f9d8d93707e5bd1a50c 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/sched.h>
 #include <linux/blkdev.h>
 #include <asm/current.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "jfs_filsys.h"
 #include "jfs_debug.h"
index a37eb5f8cbc07ee40709d2bf68280f49946bf891..a7090760602538ebd1ec3649e8eea410b872398f 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/module.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "jfs_incore.h"
 #include "jfs_filsys.h"
 #include "jfs_debug.h"
index 85671f7f8518f566dcae6c2aa193e05f891b296c..2be7c9ce6663ad8614737878225b384ac1a62d16 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/exportfs.h>
 #include <linux/crc32.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/seq_file.h>
 #include <linux/blkdev.h>
 
index 6637aa60c1dac94cea638cc58b1b700bbb25b9c9..e973cd51f12632eff2c17929c85d1e8b2e955730 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/writeback.h>
 #include <linux/buffer_head.h> /* sync_mapping_buffers */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "internal.h"
 
index 22c5b4aa49611ac46cb50dbf4fc8ef25ec500b34..26811321d39b8d404046100ac3dcc4b5e04f5cc7 100644 (file)
 #define CREATE_TRACE_POINTS
 #include <trace/events/filelock.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define IS_POSIX(fl)   (fl->fl_flags & FL_POSIX)
 #define IS_FLOCK(fl)   (fl->fl_flags & FL_FLOCK)
index d9fc7617b9e48a9225f5a97a752ed3bd5db7b869..ad74877e1442c0c9ea5fca87b065e59090088b10 100644 (file)
@@ -37,7 +37,7 @@
 #include <linux/hash.h>
 #include <linux/bitops.h>
 #include <linux/init_task.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "internal.h"
 #include "mount.h"
index f7e28f8ea04d2a629ae7c5ead8b84ca71913cc8a..b5b1259e064f8d9661110ba1f1f73d1a0ff19d51 100644 (file)
@@ -96,10 +96,6 @@ static inline struct hlist_head *mp_hash(struct dentry *dentry)
        return &mountpoint_hashtable[tmp & mp_hash_mask];
 }
 
-/*
- * allocation is serialized by namespace_sem, but we need the spinlock to
- * serialize with freeing.
- */
 static int mnt_alloc_id(struct mount *mnt)
 {
        int res;
@@ -1034,6 +1030,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
                if (IS_MNT_SLAVE(old))
                        list_add(&mnt->mnt_slave, &old->mnt_slave);
                mnt->mnt_master = old->mnt_master;
+       } else {
+               CLEAR_MNT_SHARED(mnt);
        }
        if (flag & CL_MAKE_SHARED)
                set_mnt_shared(mnt);
@@ -1828,9 +1826,7 @@ struct vfsmount *clone_private_mount(const struct path *path)
        if (IS_MNT_UNBINDABLE(old_mnt))
                return ERR_PTR(-EINVAL);
 
-       down_read(&namespace_sem);
        new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
-       up_read(&namespace_sem);
        if (IS_ERR(new_mnt))
                return ERR_CAST(new_mnt);
 
index 6df2a38275741d8dd9f2c799d2fbbd0cc889519f..088f52484d6e2d3eb87812a3cd509c534c95c206 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/vmalloc.h>
 #include <linux/mm.h>
 #include <linux/namei.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 #include "ncp_fs.h"
index 83ca77231707184cea82475ff2f2199a25bf1919..76965e7722643ec63ced2e6071b0e7ec40561818 100644 (file)
@@ -8,7 +8,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/time.h>
 #include <linux/kernel.h>
index ba611bf1aff3bcfb3837257a86610431bf425d26..7eb89c23c8470b75046e266afb2e593b7786d1fc 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <linux/module.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 
 #include <linux/time.h>
index 0a3f9b594602341350afb79f27ba2cd8191468e8..4434e4977cf36ce09d35af63bd8129db17813aeb 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/vmalloc.h>
 #include <linux/sched.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "ncp_fs.h"
 
index 33b873b259a8dc6308de69d1075fa7a51ef8650b..39f57bef85318e343857e23452f60c478b804005 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/fcntl.h>
 #include <linux/memcontrol.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "ncp_fs.h"
 
index 17cfb743b5bf03925c2dd08e3e6f67e57b04a8a9..b4c87cfcee9504eea37089a5407900b47c355913 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/fcntl.h>
 #include <linux/pagemap.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
 #include <asm/string.h>
index 471bc3d1139ebf678b2dec63c65a71ba470ad4ff..f32f272ee501183af0d281d3143449734f4b4452 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/fcntl.h>
 #include <linux/stat.h>
 #include <linux/string.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/in.h>
 #include <linux/net.h>
 #include <linux/mm.h>
index 421b6f91e8ecadc3b8105d380f84de38687194e4..a6d26b46fc05af7895aaae8e69220ca3babcb5ec 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/errno.h>
 #include <linux/fs.h>
index be88bcdca692810ebea8fdd6b92f95053ebb22c3..aab32fc3d6a84965ea879854c942b12888548411 100644 (file)
@@ -52,7 +52,7 @@
 #include <linux/nfs_page.h>
 #include <linux/sunrpc/clnt.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 
 #include "internal.h"
index 157cb43ce9dbef4bd1c190ae54da4a3ec07e780e..26dbe8b0c10dbf00c0aca1f800c1f99eb87c5cc7 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/gfp.h>
 #include <linux/swap.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "delegation.h"
 #include "internal.h"
index 45962fe5098c6ff9e87a1a23158409841ad02033..0ca4af8cca5d89f9d0ecb4d164c5164a62585b4f 100644 (file)
@@ -619,12 +619,11 @@ nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror,
                            struct nfs4_ff_layoutstat *layoutstat,
                            ktime_t now)
 {
-       static const ktime_t notime = {0};
        s64 report_interval = FF_LAYOUTSTATS_REPORT_INTERVAL;
        struct nfs4_flexfile_layout *ffl = FF_LAYOUT_FROM_HDR(mirror->layout);
 
        nfs4_ff_start_busy_timer(&layoutstat->busy_timer, now);
-       if (ktime_equal(mirror->start_time, notime))
+       if (!mirror->start_time)
                mirror->start_time = now;
        if (mirror->report_interval != 0)
                report_interval = (s64)mirror->report_interval * 1000LL;
index a608ffd28accd68a9c0db14bb02da23a5067db78..391dafaf918273648784a00a81a8dc4a53e33cc9 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/namei.h>
 #include <linux/security.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "internal.h"
 
index 011e4f8c1e015d72f6ec7b485f27555200168457..5ca4d96b19421881c6b3b0fba493e605d6d70eeb 100644 (file)
@@ -39,7 +39,7 @@
 #include <linux/compat.h>
 #include <linux/freezer.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "nfs4_fs.h"
 #include "callback.h"
index ddce94ce8142dd5399d8797186730fee91d30292..6bca17883b9368865253103b2df3f26320430d2d 100644 (file)
@@ -55,7 +55,7 @@
 #include <linux/nsproxy.h>
 #include <linux/rcupdate.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "nfs4_fs.h"
 #include "callback.h"
index 6e761f3f4cbf0fb1c8de526813ca9b6dc72c8629..b00d53d13d47622f00343d8b599a8f182fb6854c 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/freezer.h>
 #include <linux/wait.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "delegation.h"
 #include "internal.h"
index c16bf5af6831e406611fbc3045cd9113a022a928..34c1c449fddf33d065a518b5f8455887ba2b6ccd 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/module.h>
 #include <linux/nsproxy.h>
 #include <linux/sunrpc/addr.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "state.h"
 #include "netns.h"
index 7a21abe7caf7623e8354dc56a1057d9469e22d39..26c6fdb4bf67cf1e3e3a843e8e816d7a76eae265 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/jhash.h>
 #include <linux/ima.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/exportfs.h>
 #include <linux/writeback.h>
 #include <linux/security.h>
index d3fea0bd89e2cbedcea630ba3e966963720f725a..6043306e8e21518daeb945ebf2569d19fe9edbbf 100644 (file)
@@ -510,18 +510,6 @@ void fsnotify_detach_group_marks(struct fsnotify_group *group)
        }
 }
 
-void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old)
-{
-       assert_spin_locked(&old->lock);
-       new->inode = old->inode;
-       new->mnt = old->mnt;
-       if (old->group)
-               fsnotify_get_group(old->group);
-       new->group = old->group;
-       new->mask = old->mask;
-       new->free_mark = old->free_mark;
-}
-
 /*
  * Nothing fancy, just initialize lists and locks and counters.
  */
index 99510d811a8c87bbaba51419a63816a7036ece89..358ed7e1195a5c3a113ca9d8ff1a99ca1ebf0c21 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/writeback.h>
 
 #include <asm/page.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "attrib.h"
 #include "bitmap.h"
index 96a155ab5059455e81687f5590912b9c1ee1b0c9..f6e871760f8d97265f4974c159dca7a7b6439b7f 100644 (file)
@@ -1250,7 +1250,7 @@ static int o2hb_thread(void *data)
 
                mlog(ML_HEARTBEAT,
                     "start = %lld, end = %lld, msec = %u, ret = %d\n",
-                    before_hb.tv64, after_hb.tv64, elapsed_msec, ret);
+                    before_hb, after_hb, elapsed_msec, ret);
 
                if (!kthread_should_stop() &&
                    elapsed_msec < reg->hr_timeout_ms) {
index dfe162f5fd4cf3ef23098187ea7bd9823f4b0527..d331c2386b94f167269a8187bdc16396370ed985 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/string.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "masklog.h"
 
index 8abab16b4602b0348e8307ddb28623c43251f887..d4b5c81f0445992294dc33b523ab21025940ea76 100644 (file)
@@ -62,7 +62,7 @@
 #include <linux/export.h>
 #include <net/tcp.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "heartbeat.h"
 #include "tcp.h"
index 1079fae5aa12dfb00f2d256bf2a5233ba489a7f6..9ab9e1892b5fc1ff88f1103d8391c337eca2607a 100644 (file)
@@ -45,7 +45,7 @@
 #include <linux/backing-dev.h>
 #include <linux/poll.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "stackglue.h"
 #include "userdlm.h"
index d171d2c53f7f8928762acb9731d202063328967b..f8933cb53d682aaf4c7e22efb75a43d4c1c688ac 100644 (file)
@@ -4834,7 +4834,7 @@ int ocfs2_reflink_remap_range(struct file *file_in,
 
        ret = vfs_clone_file_prep_inodes(inode_in, pos_in, inode_out, pos_out,
                        &len, is_dedupe);
-       if (ret || len == 0)
+       if (ret <= 0)
                goto out_unlock;
 
        /* Lock out changes to the allocation maps and remap. */
index c9e828ec3c8eeda53bea21071e83396fa1ce48a9..dae9eb7c441e377d99e4d9e0b87347a09ef00995 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/slab.h>
 #include <linux/reboot.h>
 #include <linux/sched.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "stackglue.h"
 
index d3ed8171e8e09291b44524e6de943bc3e71c91e3..9921f70bc5ca07dab62d19ff9fded8d4a60ae9f0 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -19,7 +19,7 @@
 #include <linux/mount.h>
 #include <linux/fcntl.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fs.h>
 #include <linux/personality.h>
 #include <linux/pagemap.h>
index c003a667ed1a626dddd9c831f355f783902c55d5..13215f26e321902fde7cd0143763146f93df82ab 100644 (file)
@@ -16,7 +16,7 @@
 #include <asm/openprom.h>
 #include <asm/oplib.h>
 #include <asm/prom.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static DEFINE_MUTEX(op_mutex);
 
index 8e0d9f26dfadc4b5849a9f46a933a89ea2aa49ca..73b84baf58f8751393a3adda7cd288fbd044d252 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -23,7 +23,7 @@
 #include <linux/fcntl.h>
 #include <linux/memcontrol.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ioctls.h>
 
 #include "internal.h"
index 234a9ac49958ed978f67aad68d81fb75cf5717ce..06a793f4ae38739c3bb70b3c5a35d5adf6b8e3c1 100644 (file)
@@ -67,49 +67,47 @@ int get_dominating_id(struct mount *mnt, const struct path *root)
 
 static int do_make_slave(struct mount *mnt)
 {
-       struct mount *peer_mnt = mnt, *master = mnt->mnt_master;
-       struct mount *slave_mnt;
+       struct mount *master, *slave_mnt;
 
-       /*
-        * slave 'mnt' to a peer mount that has the
-        * same root dentry. If none is available then
-        * slave it to anything that is available.
-        */
-       while ((peer_mnt = next_peer(peer_mnt)) != mnt &&
-              peer_mnt->mnt.mnt_root != mnt->mnt.mnt_root) ;
-
-       if (peer_mnt == mnt) {
-               peer_mnt = next_peer(mnt);
-               if (peer_mnt == mnt)
-                       peer_mnt = NULL;
-       }
-       if (mnt->mnt_group_id && IS_MNT_SHARED(mnt) &&
-           list_empty(&mnt->mnt_share))
-               mnt_release_group_id(mnt);
-
-       list_del_init(&mnt->mnt_share);
-       mnt->mnt_group_id = 0;
-
-       if (peer_mnt)
-               master = peer_mnt;
-
-       if (master) {
-               list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
-                       slave_mnt->mnt_master = master;
-               list_move(&mnt->mnt_slave, &master->mnt_slave_list);
-               list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
-               INIT_LIST_HEAD(&mnt->mnt_slave_list);
+       if (list_empty(&mnt->mnt_share)) {
+               if (IS_MNT_SHARED(mnt)) {
+                       mnt_release_group_id(mnt);
+                       CLEAR_MNT_SHARED(mnt);
+               }
+               master = mnt->mnt_master;
+               if (!master) {
+                       struct list_head *p = &mnt->mnt_slave_list;
+                       while (!list_empty(p)) {
+                               slave_mnt = list_first_entry(p,
+                                               struct mount, mnt_slave);
+                               list_del_init(&slave_mnt->mnt_slave);
+                               slave_mnt->mnt_master = NULL;
+                       }
+                       return 0;
+               }
        } else {
-               struct list_head *p = &mnt->mnt_slave_list;
-               while (!list_empty(p)) {
-                        slave_mnt = list_first_entry(p,
-                                       struct mount, mnt_slave);
-                       list_del_init(&slave_mnt->mnt_slave);
-                       slave_mnt->mnt_master = NULL;
+               struct mount *m;
+               /*
+                * slave 'mnt' to a peer mount that has the
+                * same root dentry. If none is available then
+                * slave it to anything that is available.
+                */
+               for (m = master = next_peer(mnt); m != mnt; m = next_peer(m)) {
+                       if (m->mnt.mnt_root == mnt->mnt.mnt_root) {
+                               master = m;
+                               break;
+                       }
                }
+               list_del_init(&mnt->mnt_share);
+               mnt->mnt_group_id = 0;
+               CLEAR_MNT_SHARED(mnt);
        }
+       list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
+               slave_mnt->mnt_master = master;
+       list_move(&mnt->mnt_slave, &master->mnt_slave_list);
+       list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
+       INIT_LIST_HEAD(&mnt->mnt_slave_list);
        mnt->mnt_master = master;
-       CLEAR_MNT_SHARED(mnt);
        return 0;
 }
 
index 5ea8363628700cd7beece9dcea6480ada64d775a..8e7e61b28f31c037961c081d09a7be5f818013ef 100644 (file)
@@ -47,7 +47,7 @@
  *  Overall revision about smaps.
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/errno.h>
 #include <linux/time.h>
index 7eb3cefcf2a397c74af0ae958c13aa41f52ce7bd..f6a01f09f79d51457dae4226c9882bf60076c588 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/bitops.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "internal.h"
 
index 873300164dc6b1413da81a6e4d6d56d2a4e2843d..842a5ff5b85c5d58e99b0d7bfb714d0ac4dc0d5f 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/mount.h>
 #include <linux/magic.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "internal.h"
 
index 5c89a07e3d7f540b48757b907557e5f5df300ff2..0b80ad87b4d6699076317eae8b08eda14fa74c96 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/bootmem.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <linux/list.h>
 #include <linux/ioport.h>
index 05f8dcdb086e4a2fd44e7077fbc6f98b8d9608a2..f9387bb7631b032a32dfe6472260c350165a52f3 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/fs.h>
 #include <linux/syslog.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 
 extern wait_queue_head_t log_wait;
index f8595e8b5cd067e474d1ca2c9a20d60fd0ec903d..75634379f82ee05f5e0675cfea2938b53b667b46 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/seq_file.h>
 #include <linux/hugetlb.h>
 #include <linux/vmalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/tlb.h>
 #include <asm/div64.h>
index 3ecd445e830dc6138916c5db984e05da9e91807c..a2066e6dee9058ac41b3c51cfcad83f0796e0598 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/mmu_notifier.h>
 #include <linux/page_idle.h>
 #include <linux/kernel-page-flags.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 #define KPMSIZE sizeof(u64)
index 7ae6b1da7cabcf44eebfe5e1566b29b8fb9d01d7..ffd72a6c6e0446972c6ae86cb1722482c40b2504 100644 (file)
@@ -8,7 +8,7 @@
  *  proc net directory handling functions
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/errno.h>
 #include <linux/time.h>
index 15f327bed8c6fea9ccdba944b3540524b6c6d065..901bd06f437d8607eb81fe06df0eb3a875455bb4 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright 1997, Theodore Ts'o
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/errno.h>
index 4bd0373576b5362a51051ec581a454095b76e140..1988440b20496386303daec0190546261131a3b0 100644 (file)
@@ -6,7 +6,7 @@
  *  proc root directory handling functions
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/errno.h>
 #include <linux/time.h>
index 958f32545064c00e7fd9bd2e56986cb4b0f51480..8f96a49178d0d48ae220a029aa9c6f25c6bedab6 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/shmem_fs.h>
 
 #include <asm/elf.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/tlbflush.h>
 #include "internal.h"
 
index 8ab782d8b33ddc7f4ac9e2fec72230ca0d4a060b..5105b1599981e176908eb3ebc79d2352f43b9c96 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/list.h>
 #include <linux/vmalloc.h>
 #include <linux/pagemap.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include "internal.h"
 
index 2bcbf4e77982a7933906d0a60ee75464b2dc72c3..2ef7ce75c0629baf3dbdd7c9e513e80fa2fd52eb 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 static int ramfs_nommu_setattr(struct dentry *, struct iattr *);
index 8621c039b5365c9e422019ea33ca5848e454ed13..26e45863e49955facdc63e3c635afef0a6bbdab6 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/parser.h>
 #include <linux/magic.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 #define RAMFS_DEFAULT_MODE     0755
index da6de12b5c46d4a56e15e892f527153682ff6e30..5816d4c4cab09c22274c2cdc40f4176f16426f0a 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/fs.h>
 #include "internal.h"
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 
 typedef ssize_t (*io_fn_t)(struct file *, char __user *, size_t, loff_t *);
@@ -1669,6 +1669,9 @@ static int clone_verify_area(struct file *file, loff_t pos, u64 len, bool write)
  * Check that the two inodes are eligible for cloning, the ranges make
  * sense, and then flush all dirty data.  Caller must ensure that the
  * inodes have been locked against any other modifications.
+ *
+ * Returns: 0 for "nothing to clone", 1 for "something to clone", or
+ * the usual negative error code.
  */
 int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
                               struct inode *inode_out, loff_t pos_out,
@@ -1695,17 +1698,15 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
 
        /* Are we going all the way to the end? */
        isize = i_size_read(inode_in);
-       if (isize == 0) {
-               *len = 0;
+       if (isize == 0)
                return 0;
-       }
 
        /* Zero length dedupe exits immediately; reflink goes to EOF. */
        if (*len == 0) {
-               if (is_dedupe) {
-                       *len = 0;
+               if (is_dedupe || pos_in == isize)
                        return 0;
-               }
+               if (pos_in > isize)
+                       return -EINVAL;
                *len = isize - pos_in;
        }
 
@@ -1769,7 +1770,7 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
                        return -EBADE;
        }
 
-       return 0;
+       return 1;
 }
 EXPORT_SYMBOL(vfs_clone_file_prep_inodes);
 
@@ -1955,6 +1956,9 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
                goto out;
        ret = 0;
 
+       if (off + len > i_size_read(src))
+               return -EINVAL;
+
        /* pre-format output fields to sane values */
        for (i = 0; i < count; i++) {
                same->info[i].bytes_deduped = 0ULL;
index 9d0212c374d6db316dcafcd278e5b511a1eec6d2..0e8a7f355f7a1916218a9bd4d874e3ed771c6fc1 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/syscalls.h>
 #include <linux/unistd.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 int iterate_dir(struct file *file, struct dir_context *ctx)
 {
index 3d4f85defeab043998a6b6b4e03264386481e601..305c0daf5d678b094162a7e4c4e5374acdee1067 100644 (file)
@@ -31,7 +31,7 @@
 #include <net/busy_poll.h>
 #include <linux/vmalloc.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 /*
index 368bfb92b115c0e99ce4c654f6fdecb6ec5a2763..ca69fb99e41a8872d6d204d8fd8cffe7f08b3336 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/printk.h>
 #include <linux/string_helpers.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 
 static void seq_set_overflow(struct seq_file *m)
@@ -190,6 +190,13 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
         */
        m->version = file->f_version;
 
+       /*
+        * if request is to read from zero offset, reset iterator to first
+        * record as it might have been already advanced by previous requests
+        */
+       if (*ppos == 0)
+               m->index = 0;
+
        /* Don't assume *ppos is where we left it */
        if (unlikely(*ppos != m->read_pos)) {
                while ((err = traverse(m, *ppos)) == -EAGAIN)
index 0b210c3ead5c3d60b9fe9035a56d3c79519da563..a268b7f27adf62fc8ffd5fddd0d7012d35bc5295 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -15,7 +15,7 @@
 #include <linux/syscalls.h>
 #include <linux/pagemap.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 
 void generic_fillattr(struct inode *inode, struct kstat *stat)
index 9ae4abb4110b84ef286facc88e66be9d954a021d..c173cc196175b4e4f72a6553b0faba67cdead250 100644 (file)
@@ -55,7 +55,7 @@ static inline bool isalarm(struct timerfd_ctx *ctx)
 /*
  * This gets called when the timer event triggers. We set the "expired"
  * flag, but we do not re-arm the timer (in case it's necessary,
- * tintv.tv64 != 0) until the timer is accessed.
+ * tintv != 0) until the timer is accessed.
  */
 static void timerfd_triggered(struct timerfd_ctx *ctx)
 {
@@ -93,7 +93,7 @@ static enum alarmtimer_restart timerfd_alarmproc(struct alarm *alarm,
  */
 void timerfd_clock_was_set(void)
 {
-       ktime_t moffs = ktime_mono_to_real((ktime_t){ .tv64 = 0 });
+       ktime_t moffs = ktime_mono_to_real(0);
        struct timerfd_ctx *ctx;
        unsigned long flags;
 
@@ -102,8 +102,8 @@ void timerfd_clock_was_set(void)
                if (!ctx->might_cancel)
                        continue;
                spin_lock_irqsave(&ctx->wqh.lock, flags);
-               if (ctx->moffs.tv64 != moffs.tv64) {
-                       ctx->moffs.tv64 = KTIME_MAX;
+               if (ctx->moffs != moffs) {
+                       ctx->moffs = KTIME_MAX;
                        ctx->ticks++;
                        wake_up_locked(&ctx->wqh);
                }
@@ -124,9 +124,9 @@ static void timerfd_remove_cancel(struct timerfd_ctx *ctx)
 
 static bool timerfd_canceled(struct timerfd_ctx *ctx)
 {
-       if (!ctx->might_cancel || ctx->moffs.tv64 != KTIME_MAX)
+       if (!ctx->might_cancel || ctx->moffs != KTIME_MAX)
                return false;
-       ctx->moffs = ktime_mono_to_real((ktime_t){ .tv64 = 0 });
+       ctx->moffs = ktime_mono_to_real(0);
        return true;
 }
 
@@ -155,7 +155,7 @@ static ktime_t timerfd_get_remaining(struct timerfd_ctx *ctx)
        else
                remaining = hrtimer_expires_remaining_adjusted(&ctx->t.tmr);
 
-       return remaining.tv64 < 0 ? ktime_set(0, 0): remaining;
+       return remaining < 0 ? 0: remaining;
 }
 
 static int timerfd_setup(struct timerfd_ctx *ctx, int flags,
@@ -184,7 +184,7 @@ static int timerfd_setup(struct timerfd_ctx *ctx, int flags,
                ctx->t.tmr.function = timerfd_tmrproc;
        }
 
-       if (texp.tv64 != 0) {
+       if (texp != 0) {
                if (isalarm(ctx)) {
                        if (flags & TFD_TIMER_ABSTIME)
                                alarm_start(&ctx->t.alarm, texp);
@@ -261,9 +261,9 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
        if (ctx->ticks) {
                ticks = ctx->ticks;
 
-               if (ctx->expired && ctx->tintv.tv64) {
+               if (ctx->expired && ctx->tintv) {
                        /*
-                        * If tintv.tv64 != 0, this is a periodic timer that
+                        * If tintv != 0, this is a periodic timer that
                         * needs to be re-armed. We avoid doing it in the timer
                         * callback to avoid DoS attacks specifying a very
                         * short timer period.
@@ -410,7 +410,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
        else
                hrtimer_init(&ctx->t.tmr, clockid, HRTIMER_MODE_ABS);
 
-       ctx->moffs = ktime_mono_to_real((ktime_t){ .tv64 = 0 });
+       ctx->moffs = ktime_mono_to_real(0);
 
        ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx,
                               O_RDWR | (flags & TFD_SHARED_FCNTL_FLAGS));
@@ -469,7 +469,7 @@ static int do_timerfd_settime(int ufd, int flags,
         * We do not update "ticks" and "expired" since the timer will be
         * re-programmed again in the following timerfd_setup() call.
         */
-       if (ctx->expired && ctx->tintv.tv64) {
+       if (ctx->expired && ctx->tintv) {
                if (isalarm(ctx))
                        alarm_forward_now(&ctx->t.alarm, ctx->tintv);
                else
@@ -499,7 +499,7 @@ static int do_timerfd_gettime(int ufd, struct itimerspec *t)
        ctx = f.file->private_data;
 
        spin_lock_irq(&ctx->wqh.lock);
-       if (ctx->expired && ctx->tintv.tv64) {
+       if (ctx->expired && ctx->tintv) {
                ctx->expired = 0;
 
                if (isalarm(ctx)) {
index 45ceb94e89e42a362d633a35d2861e2808910e1a..7e41aee7b69a660914e7cb26765714746929a306 100644 (file)
@@ -25,7 +25,7 @@
  *        David S. Miller (davem@caip.rutgers.edu), 1995
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/errno.h>
 #include <linux/fs.h>
@@ -1191,7 +1191,7 @@ out:
        return err;
 }
 
-void ufs_truncate_blocks(struct inode *inode)
+static void ufs_truncate_blocks(struct inode *inode)
 {
        if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
              S_ISLNK(inode->i_mode)))
index f04ab232d08d452e5dfe9d0f32b1a8f9022072bd..131b2b77c8185403dc3cdf0393e8e0c915f3a850 100644 (file)
@@ -71,7 +71,7 @@
 
 #include <stdarg.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/errno.h>
 #include <linux/fs.h>
index 5fdb505e307c5bf754a09a0ba06274169e45a31b..32b15b3f6629023e55c34474bae0fa942a8df6ea 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/stat.h>
 #include <linux/utime.h>
 #include <linux/syscalls.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 
 #ifdef __ARCH_WANT_SYS_UTIME
index 2d13b4e62faec1cd0e3ff8d5966e767821867a2c..7e3317cf4045523a7d0b17f102d51775808a8950 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/vmalloc.h>
 #include <linux/posix_acl_xattr.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static const char *
 strcmp_prefix(const char *a, const char *a_prefix)
index e5ebc37704608a336dd8690d55f06389cd0173bd..d346d42c54d1590250040f0b36c05367287e7bf5 100644 (file)
@@ -256,6 +256,9 @@ xfs_ag_resv_init(
                        goto out;
        }
 
+       ASSERT(xfs_perag_resv(pag, XFS_AG_RESV_METADATA)->ar_reserved +
+              xfs_perag_resv(pag, XFS_AG_RESV_AGFL)->ar_reserved <=
+              pag->pagf_freeblks + pag->pagf_flcount);
 out:
        return error;
 }
index 6fb2215f8ff77bf0342e5f61dd6d060987e13d77..50add5272807e95374c3043819205f68c5ec55fa 100644 (file)
@@ -409,13 +409,14 @@ xfs_refcountbt_calc_size(
  */
 xfs_extlen_t
 xfs_refcountbt_max_size(
-       struct xfs_mount        *mp)
+       struct xfs_mount        *mp,
+       xfs_agblock_t           agblocks)
 {
        /* Bail out if we're uninitialized, which can happen in mkfs. */
        if (mp->m_refc_mxr[0] == 0)
                return 0;
 
-       return xfs_refcountbt_calc_size(mp, mp->m_sb.sb_agblocks);
+       return xfs_refcountbt_calc_size(mp, agblocks);
 }
 
 /*
@@ -430,22 +431,24 @@ xfs_refcountbt_calc_reserves(
 {
        struct xfs_buf          *agbp;
        struct xfs_agf          *agf;
+       xfs_agblock_t           agblocks;
        xfs_extlen_t            tree_len;
        int                     error;
 
        if (!xfs_sb_version_hasreflink(&mp->m_sb))
                return 0;
 
-       *ask += xfs_refcountbt_max_size(mp);
 
        error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
        if (error)
                return error;
 
        agf = XFS_BUF_TO_AGF(agbp);
+       agblocks = be32_to_cpu(agf->agf_length);
        tree_len = be32_to_cpu(agf->agf_refcount_blocks);
        xfs_buf_relse(agbp);
 
+       *ask += xfs_refcountbt_max_size(mp, agblocks);
        *used += tree_len;
 
        return error;
index 3be7768bd51a1c0ebd8c2ccc6e930a730bd39b54..9db008b955b7ed68bb62d8654073da0302668171 100644 (file)
@@ -66,7 +66,8 @@ extern void xfs_refcountbt_compute_maxlevels(struct xfs_mount *mp);
 
 extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp,
                unsigned long long len);
-extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp);
+extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp,
+               xfs_agblock_t agblocks);
 
 extern int xfs_refcountbt_calc_reserves(struct xfs_mount *mp,
                xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
index de25771764bac313ec514a882d6069de1063e5cc..74e5a54bc428fa27d485d88e871fdd77f8494252 100644 (file)
@@ -550,13 +550,14 @@ xfs_rmapbt_calc_size(
  */
 xfs_extlen_t
 xfs_rmapbt_max_size(
-       struct xfs_mount        *mp)
+       struct xfs_mount        *mp,
+       xfs_agblock_t           agblocks)
 {
        /* Bail out if we're uninitialized, which can happen in mkfs. */
        if (mp->m_rmap_mxr[0] == 0)
                return 0;
 
-       return xfs_rmapbt_calc_size(mp, mp->m_sb.sb_agblocks);
+       return xfs_rmapbt_calc_size(mp, agblocks);
 }
 
 /*
@@ -571,25 +572,24 @@ xfs_rmapbt_calc_reserves(
 {
        struct xfs_buf          *agbp;
        struct xfs_agf          *agf;
-       xfs_extlen_t            pool_len;
+       xfs_agblock_t           agblocks;
        xfs_extlen_t            tree_len;
        int                     error;
 
        if (!xfs_sb_version_hasrmapbt(&mp->m_sb))
                return 0;
 
-       /* Reserve 1% of the AG or enough for 1 block per record. */
-       pool_len = max(mp->m_sb.sb_agblocks / 100, xfs_rmapbt_max_size(mp));
-       *ask += pool_len;
-
        error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
        if (error)
                return error;
 
        agf = XFS_BUF_TO_AGF(agbp);
+       agblocks = be32_to_cpu(agf->agf_length);
        tree_len = be32_to_cpu(agf->agf_rmap_blocks);
        xfs_buf_relse(agbp);
 
+       /* Reserve 1% of the AG or enough for 1 block per record. */
+       *ask += max(agblocks / 100, xfs_rmapbt_max_size(mp, agblocks));
        *used += tree_len;
 
        return error;
index 2a9ac472fb15a2408ca6d58addc6a5d439b61fe9..19c08e93304954d62c1c1dcdf35a36a49f38ee71 100644 (file)
@@ -60,7 +60,8 @@ extern void xfs_rmapbt_compute_maxlevels(struct xfs_mount *mp);
 
 extern xfs_extlen_t xfs_rmapbt_calc_size(struct xfs_mount *mp,
                unsigned long long len);
-extern xfs_extlen_t xfs_rmapbt_max_size(struct xfs_mount *mp);
+extern xfs_extlen_t xfs_rmapbt_max_size(struct xfs_mount *mp,
+               xfs_agblock_t agblocks);
 
 extern int xfs_rmapbt_calc_reserves(struct xfs_mount *mp,
                xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
index 93d12fa2670d53bf8b6bf23c51325d48467b8ab2..242e8091296daff7a029b4233d53db8241ecbcd7 100644 (file)
@@ -631,6 +631,20 @@ xfs_growfs_data_private(
        xfs_set_low_space_thresholds(mp);
        mp->m_alloc_set_aside = xfs_alloc_set_aside(mp);
 
+       /*
+        * If we expanded the last AG, free the per-AG reservation
+        * so we can reinitialize it with the new size.
+        */
+       if (new) {
+               struct xfs_perag        *pag;
+
+               pag = xfs_perag_get(mp, agno);
+               error = xfs_ag_resv_free(pag);
+               xfs_perag_put(pag);
+               if (error)
+                       goto out;
+       }
+
        /* Reserve AG metadata blocks. */
        error = xfs_fs_reserve_ag_blocks(mp);
        if (error && error != -ENOSPC)
index ff4d6311c7f4b4912e5bc1c6bdcead81ab855d81..70ca4f608321b9ac9d8123bc2ddc5f216929211c 100644 (file)
@@ -1597,7 +1597,8 @@ xfs_inode_free_cowblocks(
         * If the mapping is dirty or under writeback we cannot touch the
         * CoW fork.  Leave it alone if we're in the midst of a directio.
         */
-       if (mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY) ||
+       if ((VFS_I(ip)->i_state & I_DIRTY_PAGES) ||
+           mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY) ||
            mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_WRITEBACK) ||
            atomic_read(&VFS_I(ip)->i_dio_count))
                return 0;
index 321f57721b922034008f81994a317ad79d2cc845..7c49938c5aed417cf0a83b08526d32fea1190fad 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/ioctl.h>
 #include <linux/mount.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_format.h"
index a415f822f2c1c15ce751fb44b9ab3c7bef1840e6..e467218c0098323d41e55caf4a660862d39463a8 100644 (file)
@@ -83,7 +83,7 @@ typedef __u32                 xfs_nlink_t;
 #include <asm/page.h>
 #include <asm/div64.h>
 #include <asm/param.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
 
index fe86a668a57e70419e7fc6e5f126c0aa97cecb96..6e4c7446c3d4561f85d86686d5b4a40bc4cd0ce6 100644 (file)
@@ -526,13 +526,14 @@ xfs_cui_recover(
        xfs_refcount_finish_one_cleanup(tp, rcur, error);
        error = xfs_defer_finish(&tp, &dfops, NULL);
        if (error)
-               goto abort_error;
+               goto abort_defer;
        set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags);
        error = xfs_trans_commit(tp);
        return error;
 
 abort_error:
        xfs_refcount_finish_one_cleanup(tp, rcur, error);
+abort_defer:
        xfs_defer_cancel(&dfops);
        xfs_trans_cancel(tp);
        return error;
index aca2d4bd4303b07b41a86d0bbe1e43bb4fe88308..07593a362cd03d0fdae120122d6d1c5aba8d809b 100644 (file)
@@ -1161,7 +1161,7 @@ xfs_reflink_remap_range(
 
        ret = vfs_clone_file_prep_inodes(inode_in, pos_in, inode_out, pos_out,
                        &len, is_dedupe);
-       if (ret || len == 0)
+       if (ret <= 0)
                goto out_unlock;
 
        trace_xfs_reflink_remap_range(src, pos_in, len, dest, pos_out);
index 276d3023d60f8201b635ae1f0c2ccbf26aac74fd..de6195e3891096316e51fd4efcd49ff091024a4a 100644 (file)
@@ -396,7 +396,7 @@ max_retries_show(
        int             retries;
        struct xfs_error_cfg *cfg = to_error_cfg(kobject);
 
-       if (cfg->retry_timeout == XFS_ERR_RETRY_FOREVER)
+       if (cfg->max_retries == XFS_ERR_RETRY_FOREVER)
                retries = -1;
        else
                retries = cfg->max_retries;
@@ -422,7 +422,7 @@ max_retries_store(
                return -EINVAL;
 
        if (val == -1)
-               cfg->retry_timeout = XFS_ERR_RETRY_FOREVER;
+               cfg->max_retries = XFS_ERR_RETRY_FOREVER;
        else
                cfg->max_retries = val;
        return count;
index df13637e4017342ac427894ec5c342123b77339e..939869c772b17a07a9776e323e1a253dba1f92d2 100644 (file)
@@ -1,7 +1,13 @@
 #include <linux/bitops.h>
+#undef __memset
 extern void *__memset(void *, int, __kernel_size_t);
+#undef __memcpy
 extern void *__memcpy(void *, const void *, __kernel_size_t);
+#undef __memmove
 extern void *__memmove(void *, const void *, __kernel_size_t);
+#undef memset
 extern void *memset(void *, int, __kernel_size_t);
+#undef memcpy
 extern void *memcpy(void *, const void *, __kernel_size_t);
+#undef memmove
 extern void *memmove(void *, const void *, __kernel_size_t);
index 0a769feb22b07fb1bd3d4b9475c69144dc8d7d98..157bbf6f451048cd60686f35175cefd86e3864e5 100644 (file)
@@ -4,7 +4,7 @@
 #ifndef _ASM_GENERIC_TERMIOS_BASE_H
 #define _ASM_GENERIC_TERMIOS_BASE_H
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifndef __ARCH_TERMIO_GETPUT
 
index 4fa6fe0fc2a27993da0ec3c962c888b52a2c25ad..8c13a16b074ee0c7c96efe464b1b654f9b2898b9 100644 (file)
@@ -2,7 +2,7 @@
 #define _ASM_GENERIC_TERMIOS_H
 
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <uapi/asm-generic/termios.h>
 
 /*     intr=^C         quit=^\         erase=del       kill=^U
index a9cfd33c7b1a4d912f3bcd242b8ecc32e167c127..192016e2b5183c7a22fd13fd21372de5862f44d8 100644 (file)
@@ -61,7 +61,7 @@
 
 #include <asm/mman.h>
 #include <asm/pgalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <uapi/drm/drm.h>
 #include <uapi/drm/drm_mode.h>
diff --git a/include/dt-bindings/mfd/tps65217.h b/include/dt-bindings/mfd/tps65217.h
deleted file mode 100644 (file)
index cafb9e6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This header provides macros for TI TPS65217 DT bindings.
- *
- * Copyright (C) 2016 Texas Instruments
- *
- * 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
- * published by the Free Software Foundation.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __DT_BINDINGS_TPS65217_H__
-#define __DT_BINDINGS_TPS65217_H__
-
-#define TPS65217_IRQ_USB       0
-#define TPS65217_IRQ_AC                1
-#define TPS65217_IRQ_PB                2
-
-#endif
index dda39d8fa189b50d897c7c59bbba5b1f8bdab649..b717ed9d2b755255cfafa76553b3823449f594c2 100644 (file)
 
 struct arch_timer_kvm {
        /* Virtual offset */
-       cycle_t                 cntvoff;
+       u64                     cntvoff;
 };
 
 struct arch_timer_cpu {
        /* Registers: control register, timer value */
        u32                             cntv_ctl;       /* Saved/restored */
-       cycle_t                         cntv_cval;      /* Saved/restored */
+       u64                             cntv_cval;      /* Saved/restored */
 
        /*
         * Anything that is not used directly from assembly code goes
index 9eb42dbc5582ace99283629f0905861ac820c7d5..fdd0a343f45527ee2b5d4a787ad5388a6ce4e47a 100644 (file)
@@ -14,14 +14,9 @@ typedef int (kiocb_cancel_fn)(struct kiocb *);
 /* prototypes */
 #ifdef CONFIG_AIO
 extern void exit_aio(struct mm_struct *mm);
-extern long do_io_submit(aio_context_t ctx_id, long nr,
-                        struct iocb __user *__user *iocbpp, bool compat);
 void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
 #else
 static inline void exit_aio(struct mm_struct *mm) { }
-static inline long do_io_submit(aio_context_t ctx_id, long nr,
-                               struct iocb __user * __user *iocbpp,
-                               bool compat) { return 0; }
 static inline void kiocb_set_cancel_fn(struct kiocb *req,
                                       kiocb_cancel_fn *cancel) { }
 #endif /* CONFIG_AIO */
index 65602d395a52a0b83aaeab8c42384f1a775afc44..e315d04a2fd91ceb94948949d3affd8e12d25748 100644 (file)
@@ -75,8 +75,8 @@ struct module;
  * structure.
  */
 struct clocksource {
-       cycle_t (*read)(struct clocksource *cs);
-       cycle_t mask;
+       u64 (*read)(struct clocksource *cs);
+       u64 mask;
        u32 mult;
        u32 shift;
        u64 max_idle_ns;
@@ -98,8 +98,8 @@ struct clocksource {
 #ifdef CONFIG_CLOCKSOURCE_WATCHDOG
        /* Watchdog related data, used by the framework */
        struct list_head wd_list;
-       cycle_t cs_last;
-       cycle_t wd_last;
+       u64 cs_last;
+       u64 wd_last;
 #endif
        struct module *owner;
 };
@@ -117,7 +117,7 @@ struct clocksource {
 #define CLOCK_SOURCE_RESELECT                  0x100
 
 /* simplify initialization of mask field */
-#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
+#define CLOCKSOURCE_MASK(bits) (u64)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
 
 static inline u32 clocksource_freq2mult(u32 freq, u32 shift_constant, u64 from)
 {
@@ -176,7 +176,7 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
  *
  * XXX - This could use some mult_lxl_ll() asm optimization
  */
-static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
+static inline s64 clocksource_cyc2ns(u64 cycles, u32 mult, u32 shift)
 {
        return ((u64) cycles * mult) >> shift;
 }
@@ -236,13 +236,13 @@ static inline void __clocksource_update_freq_khz(struct clocksource *cs, u32 khz
 
 extern int timekeeping_notify(struct clocksource *clock);
 
-extern cycle_t clocksource_mmio_readl_up(struct clocksource *);
-extern cycle_t clocksource_mmio_readl_down(struct clocksource *);
-extern cycle_t clocksource_mmio_readw_up(struct clocksource *);
-extern cycle_t clocksource_mmio_readw_down(struct clocksource *);
+extern u64 clocksource_mmio_readl_up(struct clocksource *);
+extern u64 clocksource_mmio_readl_down(struct clocksource *);
+extern u64 clocksource_mmio_readw_up(struct clocksource *);
+extern u64 clocksource_mmio_readw_down(struct clocksource *);
 
 extern int clocksource_mmio_init(void __iomem *, const char *,
-       unsigned long, int, unsigned, cycle_t (*)(struct clocksource *));
+       unsigned long, int, unsigned, u64 (*)(struct clocksource *));
 
 extern int clocksource_i8253_init(void);
 
index 09807c2ce3287940151a674255acbf33238b7dc8..21f9c74496e75e33e300624256e9c69f22f439f3 100644 (file)
@@ -57,9 +57,6 @@ struct notifier_block;
 
 #define CPU_ONLINE             0x0002 /* CPU (unsigned)v is up */
 #define CPU_UP_PREPARE         0x0003 /* CPU (unsigned)v coming up */
-#define CPU_UP_CANCELED                0x0004 /* CPU (unsigned)v NOT coming up */
-#define CPU_DOWN_PREPARE       0x0005 /* CPU (unsigned)v going down */
-#define CPU_DOWN_FAILED                0x0006 /* CPU (unsigned)v NOT going down */
 #define CPU_DEAD               0x0007 /* CPU (unsigned)v dead */
 #define CPU_POST_DEAD          0x0009 /* CPU (unsigned)v dead, cpu_hotplug
                                        * lock is dropped */
@@ -80,80 +77,14 @@ struct notifier_block;
 
 #ifdef CONFIG_SMP
 extern bool cpuhp_tasks_frozen;
-/* Need to know about CPUs going up/down? */
-#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
-#define cpu_notifier(fn, pri) {                                        \
-       static struct notifier_block fn##_nb =                  \
-               { .notifier_call = fn, .priority = pri };       \
-       register_cpu_notifier(&fn##_nb);                        \
-}
-
-#define __cpu_notifier(fn, pri) {                              \
-       static struct notifier_block fn##_nb =                  \
-               { .notifier_call = fn, .priority = pri };       \
-       __register_cpu_notifier(&fn##_nb);                      \
-}
-
-extern int register_cpu_notifier(struct notifier_block *nb);
-extern int __register_cpu_notifier(struct notifier_block *nb);
-extern void unregister_cpu_notifier(struct notifier_block *nb);
-extern void __unregister_cpu_notifier(struct notifier_block *nb);
-
-#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
-#define cpu_notifier(fn, pri)  do { (void)(fn); } while (0)
-#define __cpu_notifier(fn, pri)        do { (void)(fn); } while (0)
-
-static inline int register_cpu_notifier(struct notifier_block *nb)
-{
-       return 0;
-}
-
-static inline int __register_cpu_notifier(struct notifier_block *nb)
-{
-       return 0;
-}
-
-static inline void unregister_cpu_notifier(struct notifier_block *nb)
-{
-}
-
-static inline void __unregister_cpu_notifier(struct notifier_block *nb)
-{
-}
-#endif
-
 int cpu_up(unsigned int cpu);
 void notify_cpu_starting(unsigned int cpu);
 extern void cpu_maps_update_begin(void);
 extern void cpu_maps_update_done(void);
 
-#define cpu_notifier_register_begin    cpu_maps_update_begin
-#define cpu_notifier_register_done     cpu_maps_update_done
-
 #else  /* CONFIG_SMP */
 #define cpuhp_tasks_frozen     0
 
-#define cpu_notifier(fn, pri)  do { (void)(fn); } while (0)
-#define __cpu_notifier(fn, pri)        do { (void)(fn); } while (0)
-
-static inline int register_cpu_notifier(struct notifier_block *nb)
-{
-       return 0;
-}
-
-static inline int __register_cpu_notifier(struct notifier_block *nb)
-{
-       return 0;
-}
-
-static inline void unregister_cpu_notifier(struct notifier_block *nb)
-{
-}
-
-static inline void __unregister_cpu_notifier(struct notifier_block *nb)
-{
-}
-
 static inline void cpu_maps_update_begin(void)
 {
 }
@@ -162,14 +93,6 @@ static inline void cpu_maps_update_done(void)
 {
 }
 
-static inline void cpu_notifier_register_begin(void)
-{
-}
-
-static inline void cpu_notifier_register_done(void)
-{
-}
-
 #endif /* CONFIG_SMP */
 extern struct bus_type cpu_subsys;
 
@@ -182,12 +105,6 @@ extern void get_online_cpus(void);
 extern void put_online_cpus(void);
 extern void cpu_hotplug_disable(void);
 extern void cpu_hotplug_enable(void);
-#define hotcpu_notifier(fn, pri)       cpu_notifier(fn, pri)
-#define __hotcpu_notifier(fn, pri)     __cpu_notifier(fn, pri)
-#define register_hotcpu_notifier(nb)   register_cpu_notifier(nb)
-#define __register_hotcpu_notifier(nb) __register_cpu_notifier(nb)
-#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
-#define __unregister_hotcpu_notifier(nb)       __unregister_cpu_notifier(nb)
 void clear_tasks_mm_cpumask(int cpu);
 int cpu_down(unsigned int cpu);
 
@@ -199,13 +116,6 @@ static inline void cpu_hotplug_done(void) {}
 #define put_online_cpus()      do { } while (0)
 #define cpu_hotplug_disable()  do { } while (0)
 #define cpu_hotplug_enable()   do { } while (0)
-#define hotcpu_notifier(fn, pri)       do { (void)(fn); } while (0)
-#define __hotcpu_notifier(fn, pri)     do { (void)(fn); } while (0)
-/* These aren't inline functions due to a GCC bug. */
-#define register_hotcpu_notifier(nb)   ({ (void)(nb); 0; })
-#define __register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
-#define unregister_hotcpu_notifier(nb) ({ (void)(nb); })
-#define __unregister_hotcpu_notifier(nb)       ({ (void)(nb); })
 #endif         /* CONFIG_HOTPLUG_CPU */
 
 #ifdef CONFIG_PM_SLEEP_SMP
index 2ab7bf53d529acf95fbdf7ddbc338b0dae6b5755..20bfefbe75941627c25c30621d4d9b09606c720c 100644 (file)
@@ -41,6 +41,9 @@ enum cpuhp_state {
        CPUHP_NET_DEV_DEAD,
        CPUHP_PCI_XGENE_DEAD,
        CPUHP_IOMMU_INTEL_DEAD,
+       CPUHP_LUSTRE_CFS_DEAD,
+       CPUHP_SCSI_BNX2FC_DEAD,
+       CPUHP_SCSI_BNX2I_DEAD,
        CPUHP_WORKQUEUE_PREP,
        CPUHP_POWER_NUMA_PREPARE,
        CPUHP_HRTIMERS_PREPARE,
@@ -56,7 +59,6 @@ enum cpuhp_state {
        CPUHP_POWERPC_MMU_CTX_PREPARE,
        CPUHP_XEN_PREPARE,
        CPUHP_XEN_EVTCHN_PREPARE,
-       CPUHP_NOTIFY_PREPARE,
        CPUHP_ARM_SHMOBILE_SCU_PREPARE,
        CPUHP_SH_SH3X_PREPARE,
        CPUHP_BLK_MQ_PREPARE,
@@ -71,7 +73,6 @@ enum cpuhp_state {
        CPUHP_KVM_PPC_BOOK3S_PREPARE,
        CPUHP_ZCOMP_PREPARE,
        CPUHP_TIMERS_DEAD,
-       CPUHP_NOTF_ERR_INJ_PREPARE,
        CPUHP_MIPS_SOC_PREPARE,
        CPUHP_BRINGUP_CPU,
        CPUHP_AP_IDLE_DEAD,
@@ -79,10 +80,8 @@ enum cpuhp_state {
        CPUHP_AP_SCHED_STARTING,
        CPUHP_AP_RCUTREE_DYING,
        CPUHP_AP_IRQ_GIC_STARTING,
-       CPUHP_AP_IRQ_GICV3_STARTING,
        CPUHP_AP_IRQ_HIP04_STARTING,
        CPUHP_AP_IRQ_ARMADA_XP_STARTING,
-       CPUHP_AP_IRQ_ARMADA_CASC_STARTING,
        CPUHP_AP_IRQ_BCM2836_STARTING,
        CPUHP_AP_ARM_MVEBU_COHERENCY,
        CPUHP_AP_PERF_X86_UNCORE_STARTING,
@@ -118,7 +117,6 @@ enum cpuhp_state {
        CPUHP_AP_DUMMY_TIMER_STARTING,
        CPUHP_AP_ARM_XEN_STARTING,
        CPUHP_AP_ARM_CORESIGHT_STARTING,
-       CPUHP_AP_ARM_CORESIGHT4_STARTING,
        CPUHP_AP_ARM64_ISNDEP_STARTING,
        CPUHP_AP_SMPCFD_DYING,
        CPUHP_AP_X86_TBOOT_DYING,
@@ -142,7 +140,6 @@ enum cpuhp_state {
        CPUHP_AP_PERF_ARM_L2X0_ONLINE,
        CPUHP_AP_WORKQUEUE_ONLINE,
        CPUHP_AP_RCUTREE_ONLINE,
-       CPUHP_AP_NOTIFY_ONLINE,
        CPUHP_AP_ONLINE_DYN,
        CPUHP_AP_ONLINE_DYN_END         = CPUHP_AP_ONLINE_DYN + 30,
        CPUHP_AP_X86_HPET_ONLINE,
index f97bcfe794724d4fb757297851fe218268d0c86b..24ad711739955e573aefea713852b2f49a8fed85 100644 (file)
@@ -41,6 +41,9 @@ ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
 int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
                        struct iomap_ops *ops);
 int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
+int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index);
+int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
+                                     pgoff_t index);
 void dax_wake_mapping_entry_waiter(struct address_space *mapping,
                pgoff_t index, void *entry, bool wake_all);
 
index 1f79b20918b1eed2b9b1598cf8a6ccf545b23952..4334106f44c3272c3c8622934c626a8147b136ff 100644 (file)
@@ -50,6 +50,6 @@ dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base,
                        unsigned long freq);
 void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs);
 void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
-cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
+u64 dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
 
 #endif /* __DW_APB_TIMER_H__ */
index 70231425379751021b57326eec85e70d881d3f42..a0934e6c9babf8436a18b28f4dea285894e5dca5 100644 (file)
@@ -610,7 +610,6 @@ bool bpf_helper_changes_pkt_data(void *func);
 struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
                                       const struct bpf_insn *patch, u32 len);
 void bpf_warn_invalid_xdp_action(u32 act);
-void bpf_warn_invalid_xdp_buffer(void);
 
 #ifdef CONFIG_BPF_JIT
 extern int bpf_jit_enable;
index 0cf34d6cc253853c459e60908aa06128b4a8cf45..487246546ebebb63da20fde2eb12bd9a2914040c 100644 (file)
@@ -323,8 +323,6 @@ extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(str
 extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode);
 /* find (and take a reference) to a mark associated with group and vfsmount */
 extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt);
-/* copy the values from old into new */
-extern void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old);
 /* set the ignored_mask of a mark */
 extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask);
 /* set the mask of a mark (might pin the object into memory */
index 6435f46d6e1319b71f52050144f3e871986196df..7c5b694864cd9a52d3c5cd4496e834c4e8c5e7aa 100644 (file)
@@ -1,14 +1,14 @@
 #ifndef _LINUX_FUTEX_H
 #define _LINUX_FUTEX_H
 
+#include <linux/ktime.h>
 #include <uapi/linux/futex.h>
 
 struct inode;
 struct mm_struct;
 struct task_struct;
-union ktime;
 
-long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout,
+long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
              u32 __user *uaddr2, u32 val2, u32 val3);
 
 extern int
index e0341af6950e2116a43b3b0281f57fea8099c06f..76f39754e7b0299df616bc3cb909f9a35fce9ea1 100644 (file)
@@ -146,15 +146,6 @@ enum {
        DISK_EVENT_EJECT_REQUEST                = 1 << 1, /* eject requested */
 };
 
-#define BLK_SCSI_MAX_CMDS      (256)
-#define BLK_SCSI_CMD_PER_LONG  (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
-
-struct blk_scsi_cmd_filter {
-       unsigned long read_ok[BLK_SCSI_CMD_PER_LONG];
-       unsigned long write_ok[BLK_SCSI_CMD_PER_LONG];
-       struct kobject kobj;
-};
-
 struct disk_part_tbl {
        struct rcu_head rcu_head;
        int len;
index 5e00f80b1535e6b7487c1fbcd0949fad42bfea2e..cdab81ba29f899934794f1e7924f3dbb6d469d5f 100644 (file)
@@ -228,8 +228,8 @@ static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t t
 
 static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64)
 {
-       timer->node.expires.tv64 = tv64;
-       timer->_softexpires.tv64 = tv64;
+       timer->node.expires = tv64;
+       timer->_softexpires = tv64;
 }
 
 static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time)
@@ -256,11 +256,11 @@ static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer)
 
 static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer)
 {
-       return timer->node.expires.tv64;
+       return timer->node.expires;
 }
 static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer)
 {
-       return timer->_softexpires.tv64;
+       return timer->_softexpires;
 }
 
 static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer)
@@ -297,7 +297,7 @@ extern void hrtimer_peek_ahead_timers(void);
  * this resolution values.
  */
 # define HIGH_RES_NSEC         1
-# define KTIME_HIGH_RES                (ktime_t) { .tv64 = HIGH_RES_NSEC }
+# define KTIME_HIGH_RES                (HIGH_RES_NSEC)
 # define MONOTONIC_RES_NSEC    HIGH_RES_NSEC
 # define KTIME_MONOTONIC_RES   KTIME_HIGH_RES
 
@@ -333,7 +333,7 @@ __hrtimer_expires_remaining_adjusted(const struct hrtimer *timer, ktime_t now)
         * hrtimer_start_range_ns() to prevent short timeouts.
         */
        if (IS_ENABLED(CONFIG_TIME_LOW_RES) && timer->is_rel)
-               rem.tv64 -= hrtimer_resolution;
+               rem -= hrtimer_resolution;
        return rem;
 }
 
index 228bd44efa4c6efecd3af2e3ec16be8bd02d3d1b..497f2b3a5a62c8da6f87107de16519b176cc9f1f 100644 (file)
@@ -115,6 +115,16 @@ struct st_sensor_bdu {
        u8 mask;
 };
 
+/**
+ * struct st_sensor_das - ST sensor device data alignment selection
+ * @addr: address of the register.
+ * @mask: mask to write the das flag for left alignment.
+ */
+struct st_sensor_das {
+       u8 addr;
+       u8 mask;
+};
+
 /**
  * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt
  * @addr: address of the register.
@@ -185,6 +195,7 @@ struct st_sensor_transfer_function {
  * @enable_axis: Enable one or more axis of the sensor.
  * @fs: Full scale register and full scale list available.
  * @bdu: Block data update register.
+ * @das: Data Alignment Selection register.
  * @drdy_irq: Data ready register of the sensor.
  * @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read.
  * @bootime: samples to discard when sensor passing from power-down to power-up.
@@ -200,6 +211,7 @@ struct st_sensor_settings {
        struct st_sensor_axis enable_axis;
        struct st_sensor_fullscale fs;
        struct st_sensor_bdu bdu;
+       struct st_sensor_das das;
        struct st_sensor_data_ready_irq drdy_irq;
        bool multi_read_bit;
        unsigned int bootime;
index 81f930b0bca97daf7a05ca5b94c70f77a4fd3b2a..7b49c71c968ba0935a5482afb71055107563542b 100644 (file)
@@ -259,11 +259,11 @@ extern void gic_init(unsigned long gic_base_addr,
        unsigned long gic_addrspace_size, unsigned int cpu_vec,
        unsigned int irqbase);
 extern void gic_clocksource_init(unsigned int);
-extern cycle_t gic_read_count(void);
+extern u64 gic_read_count(void);
 extern unsigned int gic_get_count_width(void);
-extern cycle_t gic_read_compare(void);
-extern void gic_write_compare(cycle_t cnt);
-extern void gic_write_cpu_compare(cycle_t cnt, int cpu);
+extern u64 gic_read_compare(void);
+extern void gic_write_compare(u64 cnt);
+extern void gic_write_cpu_compare(u64 cnt, int cpu);
 extern void gic_start_count(void);
 extern void gic_stop_count(void);
 extern int gic_get_c0_compare_int(void);
index 0fc6ff276221025b4d625674023df67e72589b42..8d80fdc686473abb6b4748a39d52effbe7fe0d99 100644 (file)
@@ -500,6 +500,6 @@ typedef struct {
  *
  */
 extern int register_isdn(isdn_if*);
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #endif /* __ISDNIF_H__ */
index 0fb7ffb1775f117d1ebefd4315d4ca99b03be546..0c8bd45c820615eeaa3d50370f598c7f567ce51d 100644 (file)
 #include <linux/time.h>
 #include <linux/jiffies.h>
 
-/*
- * ktime_t:
- *
- * A single 64-bit variable is used to store the hrtimers
- * internal representation of time values in scalar nanoseconds. The
- * design plays out best on 64-bit CPUs, where most conversions are
- * NOPs and most arithmetic ktime_t operations are plain arithmetic
- * operations.
- *
- */
-union ktime {
-       s64     tv64;
-};
-
-typedef union ktime ktime_t;           /* Kill this */
+/* Nanosecond scalar representation for kernel time values */
+typedef s64    ktime_t;
 
 /**
  * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
@@ -50,39 +37,34 @@ typedef union ktime ktime_t;                /* Kill this */
 static inline ktime_t ktime_set(const s64 secs, const unsigned long nsecs)
 {
        if (unlikely(secs >= KTIME_SEC_MAX))
-               return (ktime_t){ .tv64 = KTIME_MAX };
+               return KTIME_MAX;
 
-       return (ktime_t) { .tv64 = secs * NSEC_PER_SEC + (s64)nsecs };
+       return secs * NSEC_PER_SEC + (s64)nsecs;
 }
 
 /* Subtract two ktime_t variables. rem = lhs -rhs: */
-#define ktime_sub(lhs, rhs) \
-               ({ (ktime_t){ .tv64 = (lhs).tv64 - (rhs).tv64 }; })
+#define ktime_sub(lhs, rhs)    ((lhs) - (rhs))
 
 /* Add two ktime_t variables. res = lhs + rhs: */
-#define ktime_add(lhs, rhs) \
-               ({ (ktime_t){ .tv64 = (lhs).tv64 + (rhs).tv64 }; })
+#define ktime_add(lhs, rhs)    ((lhs) + (rhs))
 
 /*
  * Same as ktime_add(), but avoids undefined behaviour on overflow; however,
  * this means that you must check the result for overflow yourself.
  */
-#define ktime_add_unsafe(lhs, rhs) \
-               ({ (ktime_t){ .tv64 = (u64) (lhs).tv64 + (rhs).tv64 }; })
+#define ktime_add_unsafe(lhs, rhs)     ((u64) (lhs) + (rhs))
 
 /*
  * Add a ktime_t variable and a scalar nanosecond value.
  * res = kt + nsval:
  */
-#define ktime_add_ns(kt, nsval) \
-               ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
+#define ktime_add_ns(kt, nsval)                ((kt) + (nsval))
 
 /*
  * Subtract a scalar nanosecod from a ktime_t variable
  * res = kt - nsval:
  */
-#define ktime_sub_ns(kt, nsval) \
-               ({ (ktime_t){ .tv64 = (kt).tv64 - (nsval) }; })
+#define ktime_sub_ns(kt, nsval)                ((kt) - (nsval))
 
 /* convert a timespec to ktime_t format: */
 static inline ktime_t timespec_to_ktime(struct timespec ts)
@@ -103,31 +85,16 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
 }
 
 /* Map the ktime_t to timespec conversion to ns_to_timespec function */
-#define ktime_to_timespec(kt)          ns_to_timespec((kt).tv64)
+#define ktime_to_timespec(kt)          ns_to_timespec((kt))
 
 /* Map the ktime_t to timespec conversion to ns_to_timespec function */
-#define ktime_to_timespec64(kt)                ns_to_timespec64((kt).tv64)
+#define ktime_to_timespec64(kt)                ns_to_timespec64((kt))
 
 /* Map the ktime_t to timeval conversion to ns_to_timeval function */
-#define ktime_to_timeval(kt)           ns_to_timeval((kt).tv64)
+#define ktime_to_timeval(kt)           ns_to_timeval((kt))
 
 /* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
-#define ktime_to_ns(kt)                        ((kt).tv64)
-
-
-/**
- * ktime_equal - Compares two ktime_t variables to see if they are equal
- * @cmp1:      comparable1
- * @cmp2:      comparable2
- *
- * Compare two ktime_t variables.
- *
- * Return: 1 if equal.
- */
-static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
-{
-       return cmp1.tv64 == cmp2.tv64;
-}
+#define ktime_to_ns(kt)                        (kt)
 
 /**
  * ktime_compare - Compares two ktime_t variables for less, greater or equal
@@ -141,9 +108,9 @@ static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
  */
 static inline int ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
 {
-       if (cmp1.tv64 < cmp2.tv64)
+       if (cmp1 < cmp2)
                return -1;
-       if (cmp1.tv64 > cmp2.tv64)
+       if (cmp1 > cmp2)
                return 1;
        return 0;
 }
@@ -182,7 +149,7 @@ static inline s64 ktime_divns(const ktime_t kt, s64 div)
         */
        BUG_ON(div < 0);
        if (__builtin_constant_p(div) && !(div >> 32)) {
-               s64 ns = kt.tv64;
+               s64 ns = kt;
                u64 tmp = ns < 0 ? -ns : ns;
 
                do_div(tmp, div);
@@ -199,7 +166,7 @@ static inline s64 ktime_divns(const ktime_t kt, s64 div)
         * so catch them on 64bit as well.
         */
        WARN_ON(div < 0);
-       return kt.tv64 / div;
+       return kt / div;
 }
 #endif
 
@@ -256,7 +223,7 @@ extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
 static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
                                                       struct timespec *ts)
 {
-       if (kt.tv64) {
+       if (kt) {
                *ts = ktime_to_timespec(kt);
                return true;
        } else {
@@ -275,7 +242,7 @@ static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
 static inline __must_check bool ktime_to_timespec64_cond(const ktime_t kt,
                                                       struct timespec64 *ts)
 {
-       if (kt.tv64) {
+       if (kt) {
                *ts = ktime_to_timespec64(kt);
                return true;
        } else {
@@ -290,20 +257,16 @@ static inline __must_check bool ktime_to_timespec64_cond(const ktime_t kt,
  * this resolution values.
  */
 #define LOW_RES_NSEC           TICK_NSEC
-#define KTIME_LOW_RES          (ktime_t){ .tv64 = LOW_RES_NSEC }
+#define KTIME_LOW_RES          (LOW_RES_NSEC)
 
 static inline ktime_t ns_to_ktime(u64 ns)
 {
-       static const ktime_t ktime_zero = { .tv64 = 0 };
-
-       return ktime_add_ns(ktime_zero, ns);
+       return ns;
 }
 
 static inline ktime_t ms_to_ktime(u64 ms)
 {
-       static const ktime_t ktime_zero = { .tv64 = 0 };
-
-       return ktime_add_ms(ktime_zero, ms);
+       return ms * NSEC_PER_MSEC;
 }
 
 # include <linux/timekeeping.h>
index ec819e9a115af492a8e57d2fe67384accb925436..b6e048e1045f99868642b920a005d2382e6dc316 100644 (file)
 #ifndef MDEV_H
 #define MDEV_H
 
-/* Parent device */
-struct parent_device {
-       struct device           *dev;
-       const struct parent_ops *ops;
-
-       /* internal */
-       struct kref             ref;
-       struct mutex            lock;
-       struct list_head        next;
-       struct kset             *mdev_types_kset;
-       struct list_head        type_list;
-};
-
-/* Mediated device */
-struct mdev_device {
-       struct device           dev;
-       struct parent_device    *parent;
-       uuid_le                 uuid;
-       void                    *driver_data;
-
-       /* internal */
-       struct kref             ref;
-       struct list_head        next;
-       struct kobject          *type_kobj;
-};
+struct mdev_device;
 
 /**
- * struct parent_ops - Structure to be registered for each parent device to
+ * struct mdev_parent_ops - Structure to be registered for each parent device to
  * register the device to mdev module.
  *
  * @owner:             The module owner.
@@ -86,10 +62,9 @@ struct mdev_device {
  *                     @mdev: mediated device structure
  *                     @vma: vma structure
  * Parent device that support mediated device should be registered with mdev
- * module with parent_ops structure.
+ * module with mdev_parent_ops structure.
  **/
-
-struct parent_ops {
+struct mdev_parent_ops {
        struct module   *owner;
        const struct attribute_group **dev_attr_groups;
        const struct attribute_group **mdev_attr_groups;
@@ -103,7 +78,7 @@ struct parent_ops {
                        size_t count, loff_t *ppos);
        ssize_t (*write)(struct mdev_device *mdev, const char __user *buf,
                         size_t count, loff_t *ppos);
-       ssize_t (*ioctl)(struct mdev_device *mdev, unsigned int cmd,
+       long    (*ioctl)(struct mdev_device *mdev, unsigned int cmd,
                         unsigned long arg);
        int     (*mmap)(struct mdev_device *mdev, struct vm_area_struct *vma);
 };
@@ -142,27 +117,22 @@ struct mdev_driver {
 };
 
 #define to_mdev_driver(drv)    container_of(drv, struct mdev_driver, driver)
-#define to_mdev_device(dev)    container_of(dev, struct mdev_device, dev)
-
-static inline void *mdev_get_drvdata(struct mdev_device *mdev)
-{
-       return mdev->driver_data;
-}
 
-static inline void mdev_set_drvdata(struct mdev_device *mdev, void *data)
-{
-       mdev->driver_data = data;
-}
+extern void *mdev_get_drvdata(struct mdev_device *mdev);
+extern void mdev_set_drvdata(struct mdev_device *mdev, void *data);
+extern uuid_le mdev_uuid(struct mdev_device *mdev);
 
 extern struct bus_type mdev_bus_type;
 
-#define dev_is_mdev(d) ((d)->bus == &mdev_bus_type)
-
 extern int  mdev_register_device(struct device *dev,
-                                const struct parent_ops *ops);
+                                const struct mdev_parent_ops *ops);
 extern void mdev_unregister_device(struct device *dev);
 
 extern int  mdev_register_driver(struct mdev_driver *drv, struct module *owner);
 extern void mdev_unregister_driver(struct mdev_driver *drv);
 
+extern struct device *mdev_parent_dev(struct mdev_device *mdev);
+extern struct device *mdev_dev(struct mdev_device *mdev);
+extern struct mdev_device *mdev_from_dev(struct device *dev);
+
 #endif /* MDEV_H */
index c9f379689dd068beadbdb828fe8f09b521b28f12..6533c16e27ad7fb03926286ec94055d26b26f615 100644 (file)
@@ -1384,6 +1384,8 @@ int set_phv_bit(struct mlx4_dev *dev, u8 port, int new_val);
 int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv);
 int mlx4_get_is_vlan_offload_disabled(struct mlx4_dev *dev, u8 port,
                                      bool *vlan_offload_disabled);
+void mlx4_handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
+                                      struct _rule_hw *eth_header);
 int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
 int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
 int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
@@ -1460,7 +1462,7 @@ int mlx4_get_roce_gid_from_slave(struct mlx4_dev *dev, int port, int slave_id,
 int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn,
                                      u32 max_range_qpn);
 
-cycle_t mlx4_read_clock(struct mlx4_dev *dev);
+u64 mlx4_read_clock(struct mlx4_dev *dev);
 
 struct mlx4_active_ports {
        DECLARE_BITMAP(ports, MLX4_MAX_PORTS);
index 9f489365b3d39c2400fd2fd19099ca98803396d7..52b437431c6a642b04d33da532cfcd722c69fa0f 100644 (file)
@@ -1071,11 +1071,6 @@ enum {
        MLX5_INFINIBAND_PORT_COUNTERS_GROUP   = 0x20,
 };
 
-enum {
-       MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP       = 0x0,
-       MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP = 0x2,
-};
-
 static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz)
 {
        if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE)
index 0ae55361e674be4c08ffa33c3c69573eee7bf99b..735b36335f297e8babe3f1d2089acd11a735bc43 100644 (file)
@@ -123,7 +123,6 @@ enum {
        MLX5_REG_HOST_ENDIANNESS = 0x7004,
        MLX5_REG_MCIA            = 0x9014,
        MLX5_REG_MLCR            = 0x902b,
-       MLX5_REG_MPCNT           = 0x9051,
 };
 
 enum mlx5_dcbx_oper_mode {
index 57bec544e20a81070d999fc59253d0774a4c6c3b..a852e9db6f0d5ec809cfc0e5245d1ee3fff7c36b 100644 (file)
@@ -1757,80 +1757,6 @@ struct mlx5_ifc_eth_802_3_cntrs_grp_data_layout_bits {
        u8         reserved_at_4c0[0x300];
 };
 
-struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits {
-       u8         life_time_counter_high[0x20];
-
-       u8         life_time_counter_low[0x20];
-
-       u8         rx_errors[0x20];
-
-       u8         tx_errors[0x20];
-
-       u8         l0_to_recovery_eieos[0x20];
-
-       u8         l0_to_recovery_ts[0x20];
-
-       u8         l0_to_recovery_framing[0x20];
-
-       u8         l0_to_recovery_retrain[0x20];
-
-       u8         crc_error_dllp[0x20];
-
-       u8         crc_error_tlp[0x20];
-
-       u8         reserved_at_140[0x680];
-};
-
-struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits {
-       u8         life_time_counter_high[0x20];
-
-       u8         life_time_counter_low[0x20];
-
-       u8         time_to_boot_image_start[0x20];
-
-       u8         time_to_link_image[0x20];
-
-       u8         calibration_time[0x20];
-
-       u8         time_to_first_perst[0x20];
-
-       u8         time_to_detect_state[0x20];
-
-       u8         time_to_l0[0x20];
-
-       u8         time_to_crs_en[0x20];
-
-       u8         time_to_plastic_image_start[0x20];
-
-       u8         time_to_iron_image_start[0x20];
-
-       u8         perst_handler[0x20];
-
-       u8         times_in_l1[0x20];
-
-       u8         times_in_l23[0x20];
-
-       u8         dl_down[0x20];
-
-       u8         config_cycle1usec[0x20];
-
-       u8         config_cycle2to7usec[0x20];
-
-       u8         config_cycle_8to15usec[0x20];
-
-       u8         config_cycle_16_to_63usec[0x20];
-
-       u8         config_cycle_64usec[0x20];
-
-       u8         correctable_err_msg_sent[0x20];
-
-       u8         non_fatal_err_msg_sent[0x20];
-
-       u8         fatal_err_msg_sent[0x20];
-
-       u8         reserved_at_2e0[0x4e0];
-};
-
 struct mlx5_ifc_cmd_inter_comp_event_bits {
        u8         command_completion_vector[0x20];
 
@@ -2995,12 +2921,6 @@ union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits {
        u8         reserved_at_0[0x7c0];
 };
 
-union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits {
-       struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits pcie_perf_cntrs_grp_data_layout;
-       struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits pcie_tas_cntrs_grp_data_layout;
-       u8         reserved_at_0[0x7c0];
-};
-
 union mlx5_ifc_event_auto_bits {
        struct mlx5_ifc_comp_event_bits comp_event;
        struct mlx5_ifc_dct_events_bits dct_events;
@@ -7320,18 +7240,6 @@ struct mlx5_ifc_ppcnt_reg_bits {
        union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set;
 };
 
-struct mlx5_ifc_mpcnt_reg_bits {
-       u8         reserved_at_0[0x8];
-       u8         pcie_index[0x8];
-       u8         reserved_at_10[0xa];
-       u8         grp[0x6];
-
-       u8         clr[0x1];
-       u8         reserved_at_21[0x1f];
-
-       union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits counter_set;
-};
-
 struct mlx5_ifc_ppad_reg_bits {
        u8         reserved_at_0[0x3];
        u8         single_mac[0x1];
@@ -7937,7 +7845,6 @@ union mlx5_ifc_ports_control_registers_document_bits {
        struct mlx5_ifc_pmtu_reg_bits pmtu_reg;
        struct mlx5_ifc_ppad_reg_bits ppad_reg;
        struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg;
-       struct mlx5_ifc_mpcnt_reg_bits mpcnt_reg;
        struct mlx5_ifc_pplm_reg_bits pplm_reg;
        struct mlx5_ifc_pplr_reg_bits pplr_reg;
        struct mlx5_ifc_ppsc_reg_bits ppsc_reg;
index 4424784ac37495b38d735f7d86fd6b574b2fa16f..fe6b4036664a9a7c82fe4a22be93288928eceac1 100644 (file)
@@ -1758,6 +1758,8 @@ static inline spinlock_t *pmd_lock(struct mm_struct *mm, pmd_t *pmd)
        return ptl;
 }
 
+extern void __init pagecache_init(void);
+
 extern void free_area_init(unsigned long * zones_size);
 extern void free_area_init_node(int nid, unsigned long * zones_size,
                unsigned long zone_start_pfn, unsigned long *zholes_size);
index 50a7dbe88cf344478f109a94bb81a83c8ef335c9..de87ceac110e2f883a28144764340857106e0855 100644 (file)
@@ -968,6 +968,9 @@ static inline int ntb_peer_spad_addr(struct ntb_dev *ntb, int idx,
  */
 static inline u32 ntb_peer_spad_read(struct ntb_dev *ntb, int idx)
 {
+       if (!ntb->ops->peer_spad_read)
+               return 0;
+
        return ntb->ops->peer_spad_read(ntb, idx);
 }
 
index 74e4dda912384e3ec15df7c3c15449795cda634e..6b5818d6de322f8b5898e082ab4b3936042beb5a 100644 (file)
@@ -79,6 +79,7 @@ enum pageflags {
        PG_dirty,
        PG_lru,
        PG_active,
+       PG_waiters,             /* Page has waiters, check its waitqueue. Must be bit #7 and in the same byte as "PG_locked" */
        PG_slab,
        PG_owner_priv_1,        /* Owner use. If pagecache, fs may use*/
        PG_arch_1,
@@ -87,7 +88,6 @@ enum pageflags {
        PG_private_2,           /* If pagecache, has fs aux data */
        PG_writeback,           /* Page is under writeback */
        PG_head,                /* A head page */
-       PG_swapcache,           /* Swap page: swp_entry_t in private */
        PG_mappedtodisk,        /* Has blocks allocated on-disk */
        PG_reclaim,             /* To be reclaimed asap */
        PG_swapbacked,          /* Page is backed by RAM/swap */
@@ -110,6 +110,9 @@ enum pageflags {
        /* Filesystems */
        PG_checked = PG_owner_priv_1,
 
+       /* SwapBacked */
+       PG_swapcache = PG_owner_priv_1, /* Swap page: swp_entry_t in private */
+
        /* Two page bits are conscripted by FS-Cache to maintain local caching
         * state.  These bits are set on pages belonging to the netfs's inodes
         * when those inodes are being locally cached.
@@ -167,6 +170,9 @@ static __always_inline int PageCompound(struct page *page)
  *     for compound page all operations related to the page flag applied to
  *     head page.
  *
+ * PF_ONLY_HEAD:
+ *     for compound page, callers only ever operate on the head page.
+ *
  * PF_NO_TAIL:
  *     modifications of the page flag must be done on small or head pages,
  *     checks can be done on tail pages too.
@@ -176,6 +182,9 @@ static __always_inline int PageCompound(struct page *page)
  */
 #define PF_ANY(page, enforce)  page
 #define PF_HEAD(page, enforce) compound_head(page)
+#define PF_ONLY_HEAD(page, enforce) ({                                 \
+               VM_BUG_ON_PGFLAGS(PageTail(page), page);                \
+               page;})
 #define PF_NO_TAIL(page, enforce) ({                                   \
                VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page);     \
                compound_head(page);})
@@ -253,6 +262,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; }
        TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname)
 
 __PAGEFLAG(Locked, locked, PF_NO_TAIL)
+PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD)
 PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, PF_NO_COMPOUND)
 PAGEFLAG(Referenced, referenced, PF_HEAD)
        TESTCLEARFLAG(Referenced, referenced, PF_HEAD)
@@ -314,7 +324,13 @@ PAGEFLAG_FALSE(HighMem)
 #endif
 
 #ifdef CONFIG_SWAP
-PAGEFLAG(SwapCache, swapcache, PF_NO_COMPOUND)
+static __always_inline int PageSwapCache(struct page *page)
+{
+       return PageSwapBacked(page) && test_bit(PG_swapcache, &page->flags);
+
+}
+SETPAGEFLAG(SwapCache, swapcache, PF_NO_COMPOUND)
+CLEARPAGEFLAG(SwapCache, swapcache, PF_NO_COMPOUND)
 #else
 PAGEFLAG_FALSE(SwapCache)
 #endif
@@ -701,12 +717,12 @@ static inline void ClearPageSlabPfmemalloc(struct page *page)
  * Flags checked when a page is freed.  Pages being freed should not have
  * these flags set.  It they are, there is a problem.
  */
-#define PAGE_FLAGS_CHECK_AT_FREE \
-       (1UL << PG_lru   | 1UL << PG_locked    | \
-        1UL << PG_private | 1UL << PG_private_2 | \
-        1UL << PG_writeback | 1UL << PG_reserved | \
-        1UL << PG_slab  | 1UL << PG_swapcache | 1UL << PG_active | \
-        1UL << PG_unevictable | __PG_MLOCKED)
+#define PAGE_FLAGS_CHECK_AT_FREE                               \
+       (1UL << PG_lru          | 1UL << PG_locked      |       \
+        1UL << PG_private      | 1UL << PG_private_2   |       \
+        1UL << PG_writeback    | 1UL << PG_reserved    |       \
+        1UL << PG_slab         | 1UL << PG_active      |       \
+        1UL << PG_unevictable  | __PG_MLOCKED)
 
 /*
  * Flags checked when a page is prepped for return by the page allocator.
@@ -735,6 +751,7 @@ static inline int page_has_private(struct page *page)
 
 #undef PF_ANY
 #undef PF_HEAD
+#undef PF_ONLY_HEAD
 #undef PF_NO_TAIL
 #undef PF_NO_COMPOUND
 #endif /* !__GENERATING_BOUNDS_H */
index 7dbe9148b2f8a661257d0aa620cf1f61fa7d5f57..324c8dbad1e13d049a7fed3e9ccac1210c4c5ed8 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/list.h>
 #include <linux/highmem.h>
 #include <linux/compiler.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/gfp.h>
 #include <linux/bitops.h>
 #include <linux/hardirq.h> /* for in_interrupt() */
@@ -486,22 +486,14 @@ static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,
  * and for filesystems which need to wait on PG_private.
  */
 extern void wait_on_page_bit(struct page *page, int bit_nr);
-
 extern int wait_on_page_bit_killable(struct page *page, int bit_nr);
-extern int wait_on_page_bit_killable_timeout(struct page *page,
-                                            int bit_nr, unsigned long timeout);
-
-static inline int wait_on_page_locked_killable(struct page *page)
-{
-       if (!PageLocked(page))
-               return 0;
-       return wait_on_page_bit_killable(compound_head(page), PG_locked);
-}
+extern void wake_up_page_bit(struct page *page, int bit_nr);
 
-extern wait_queue_head_t *page_waitqueue(struct page *page);
 static inline void wake_up_page(struct page *page, int bit)
 {
-       __wake_up_bit(page_waitqueue(page), &page->flags, bit);
+       if (!PageWaiters(page))
+               return;
+       wake_up_page_bit(page, bit);
 }
 
 /* 
@@ -517,6 +509,13 @@ static inline void wait_on_page_locked(struct page *page)
                wait_on_page_bit(compound_head(page), PG_locked);
 }
 
+static inline int wait_on_page_locked_killable(struct page *page)
+{
+       if (!PageLocked(page))
+               return 0;
+       return wait_on_page_bit_killable(compound_head(page), PG_locked);
+}
+
 /* 
  * Wait for a page to complete writeback
  */
index 37b057b63b465afa0edf3e372cb561d7670a3089..a46d6755035e3c086bea24a1bad5a37e5bd0f8b6 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/string.h>
 #include <linux/fs.h>
 #include <linux/sysctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <uapi/linux/poll.h>
 
 extern struct ctl_table epoll_table[]; /* for sysctl */
index 5dea8f6440e44f8d7345289847deaa9e9434e136..52bda854593b4a9eae9bad2d9990f9dd166ed609 100644 (file)
@@ -306,7 +306,9 @@ void radix_tree_iter_replace(struct radix_tree_root *,
 void radix_tree_replace_slot(struct radix_tree_root *root,
                             void **slot, void *item);
 void __radix_tree_delete_node(struct radix_tree_root *root,
-                             struct radix_tree_node *node);
+                             struct radix_tree_node *node,
+                             radix_tree_update_node_t update_node,
+                             void *private);
 void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *);
 void *radix_tree_delete(struct radix_tree_root *, unsigned long);
 void radix_tree_clear_tags(struct radix_tree_root *root,
index ac7fa34db8a7183b0b68176f8d6748346c288207..b53c0cfd417e3bec1c5cfab76787901bafa5884c 100644 (file)
@@ -3227,7 +3227,7 @@ static inline ktime_t net_timedelta(ktime_t t)
 
 static inline ktime_t net_invalid_timestamp(void)
 {
-       return ktime_set(0, 0);
+       return 0;
 }
 
 struct sk_buff *skb_clone_sk(struct sk_buff *skb);
index 183f37c8a5e164ad5864ac433dd69093bac5bad7..4ee479f2f355b1fa2658b1c2aabbdfc376125651 100644 (file)
@@ -9,7 +9,13 @@ struct device;
 struct page;
 struct scatterlist;
 
-extern int swiotlb_force;
+enum swiotlb_force {
+       SWIOTLB_NORMAL,         /* Default - depending on HW DMA mask etc. */
+       SWIOTLB_FORCE,          /* swiotlb=force */
+       SWIOTLB_NO_FORCE,       /* swiotlb=noforce */
+};
+
+extern enum swiotlb_force swiotlb_force;
 
 /*
  * Maximum allowable number of contiguous slabs to map,
@@ -108,11 +114,14 @@ swiotlb_dma_supported(struct device *hwdev, u64 mask);
 
 #ifdef CONFIG_SWIOTLB
 extern void __init swiotlb_free(void);
+unsigned int swiotlb_max_segment(void);
 #else
 static inline void swiotlb_free(void) { }
+static inline unsigned int swiotlb_max_segment(void) { return 0; }
 #endif
 
 extern void swiotlb_print_info(void);
 extern int is_swiotlb_buffer(phys_addr_t paddr);
+extern void swiotlb_set_max_segment(unsigned int);
 
 #endif /* __LINUX_SWIOTLB_H */
index 62be0786d6d0c6274017ff0e0cb3c002d6092f86..a04fea19676f30e07282231b6c14b4ce9ab40f1d 100644 (file)
@@ -127,9 +127,7 @@ static inline void tick_nohz_idle_exit(void) { }
 
 static inline ktime_t tick_nohz_get_sleep_length(void)
 {
-       ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
-
-       return len;
+       return NSEC_PER_SEC / HZ;
 }
 static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
 static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
index 4382035a75bbcdc65d8099a9b3d2d384e31815ff..2496ad4cfc99d14ca609bd1c9c123f9de6d3b2e0 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/types.h>
 
 /* simplify initialization of mask field */
-#define CYCLECOUNTER_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
+#define CYCLECOUNTER_MASK(bits) (u64)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
 
 /**
  * struct cyclecounter - hardware abstraction for a free running counter
@@ -37,8 +37,8 @@
  * @shift:             cycle to nanosecond divisor (power of two)
  */
 struct cyclecounter {
-       cycle_t (*read)(const struct cyclecounter *cc);
-       cycle_t mask;
+       u64 (*read)(const struct cyclecounter *cc);
+       u64 mask;
        u32 mult;
        u32 shift;
 };
@@ -63,7 +63,7 @@ struct cyclecounter {
  */
 struct timecounter {
        const struct cyclecounter *cc;
-       cycle_t cycle_last;
+       u64 cycle_last;
        u64 nsec;
        u64 mask;
        u64 frac;
@@ -77,7 +77,7 @@ struct timecounter {
  * @frac:      pointer to storage for the fractional nanoseconds.
  */
 static inline u64 cyclecounter_cyc2ns(const struct cyclecounter *cc,
-                                     cycle_t cycles, u64 mask, u64 *frac)
+                                     u64 cycles, u64 mask, u64 *frac)
 {
        u64 ns = (u64) cycles;
 
@@ -134,6 +134,6 @@ extern u64 timecounter_read(struct timecounter *tc);
  * in the past.
  */
 extern u64 timecounter_cyc2time(struct timecounter *tc,
-                               cycle_t cycle_tstamp);
+                               u64 cycle_tstamp);
 
 #endif
index e88005459035e760cb2c3cf1dc8966a958191ef6..110f4532188c7b6c50cf1ce4dcd5dc525beae9a1 100644 (file)
@@ -29,9 +29,9 @@
  */
 struct tk_read_base {
        struct clocksource      *clock;
-       cycle_t                 (*read)(struct clocksource *cs);
-       cycle_t                 mask;
-       cycle_t                 cycle_last;
+       u64                     (*read)(struct clocksource *cs);
+       u64                     mask;
+       u64                     cycle_last;
        u32                     mult;
        u32                     shift;
        u64                     xtime_nsec;
@@ -97,7 +97,7 @@ struct timekeeper {
        struct timespec64       raw_time;
 
        /* The following members are for timekeeping internal use */
-       cycle_t                 cycle_interval;
+       u64                     cycle_interval;
        u64                     xtime_interval;
        s64                     xtime_remainder;
        u32                     raw_interval;
@@ -136,7 +136,7 @@ extern void update_vsyscall_tz(void);
 
 extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm,
                                struct clocksource *c, u32 mult,
-                               cycle_t cycle_last);
+                               u64 cycle_last);
 extern void update_vsyscall_tz(void);
 
 #else
index 361f8bf1429dfe28e63ad32d12561fab51c9e959..d2e804e15c3e46059b3401bed5dedfec3bd5dc2a 100644 (file)
@@ -293,7 +293,7 @@ extern void ktime_get_raw_and_real_ts64(struct timespec64 *ts_raw,
  * @cs_was_changed_seq:        The sequence number of clocksource change events
  */
 struct system_time_snapshot {
-       cycle_t         cycles;
+       u64             cycles;
        ktime_t         real;
        ktime_t         raw;
        unsigned int    clock_was_set_seq;
@@ -321,7 +321,7 @@ struct system_device_crosststamp {
  *     timekeeping code to verify comparibility of two cycle values
  */
 struct system_counterval_t {
-       cycle_t                 cycles;
+       u64                     cycles;
        struct clocksource      *cs;
 };
 
index d501ad3ba2478c6ef23e01c3449bb129c5b181aa..1e7bd24848fcb54cae26bdd10597f6ea80afd46f 100644 (file)
@@ -228,8 +228,5 @@ struct callback_head {
 typedef void (*rcu_callback_t)(struct rcu_head *head);
 typedef void (*call_rcu_func_t)(struct rcu_head *head, rcu_callback_t func);
 
-/* clocksource cycle base type */
-typedef u64 cycle_t;
-
 #endif /*  __ASSEMBLY__ */
 #endif /* _LINUX_TYPES_H */
index 2408e8d5c05ccbfc50713416f0473a478fa26bc4..1421132e90861be2112fdc22d511395ab933ae50 100644 (file)
@@ -510,7 +510,7 @@ do {                                                                        \
        hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC,              \
                              HRTIMER_MODE_REL);                        \
        hrtimer_init_sleeper(&__t, current);                            \
-       if ((timeout).tv64 != KTIME_MAX)                                \
+       if ((timeout) != KTIME_MAX)                             \
                hrtimer_start_range_ns(&__t.timer, timeout,             \
                                       current->timer_slack_ns,         \
                                       HRTIMER_MODE_REL);               \
index c78f9f0920b51b61bc8d954438e02eca5b4a6513..5527d910ba3d12ee622cd23bd5aa8f62f2926043 100644 (file)
@@ -375,7 +375,6 @@ void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
 unsigned long wb_calc_thresh(struct bdi_writeback *wb, unsigned long thresh);
 
 void wb_update_bandwidth(struct bdi_writeback *wb, unsigned long start_time);
-void page_writeback_init(void);
 void balance_dirty_pages_ratelimited(struct address_space *mapping);
 bool wb_over_bg_thresh(struct bdi_writeback *wb);
 
index 5c30891e84e514518d82f82bff3c9e7d006ab723..35d0fabd2782618603bcd051c34750db53b9742f 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/errno.h>
 #include <asm/types.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/checksum.h>
 
 #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
index f0cf5a1b777e4d4c37c0b927f5c9ee7bfd78fd64..0378e88f6fd3d6076f0393d67343cdb92643dbb4 100644 (file)
@@ -110,6 +110,7 @@ struct netns_ipv4 {
        int sysctl_tcp_orphan_retries;
        int sysctl_tcp_fin_timeout;
        unsigned int sysctl_tcp_notsent_lowat;
+       int sysctl_tcp_tw_reuse;
 
        int sysctl_igmp_max_memberships;
        int sysctl_igmp_max_msf;
index 76e0b5f922c6c475e7f47a73d072282dfec53149..208e718e16b96766a231752e5393d36b2ff76a32 100644 (file)
@@ -207,7 +207,7 @@ static inline void red_set_parms(struct red_parms *p,
 
 static inline int red_is_idling(const struct red_vars *v)
 {
-       return v->qidlestart.tv64 != 0;
+       return v->qidlestart != 0;
 }
 
 static inline void red_start_of_idle_period(struct red_vars *v)
@@ -217,7 +217,7 @@ static inline void red_start_of_idle_period(struct red_vars *v)
 
 static inline void red_end_of_idle_period(struct red_vars *v)
 {
-       v->qidlestart.tv64 = 0;
+       v->qidlestart = 0;
 }
 
 static inline void red_restart(struct red_vars *v)
index f0dcaebebddb0215b5496a6e2cce4df2c3ad246a..d8833a86cd7e48192f4c3b5d984ac76aee3b7516 100644 (file)
@@ -69,7 +69,7 @@
 #include <net/ip6_route.h>
 #endif
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/page.h>
 #include <net/sock.h>
 #include <net/snmp.h>
index 282d065e286b7e2a49a6170343fe71309780e952..f0e867f58722f344494c98cbdbe49d7ec875099a 100644 (file)
@@ -2193,8 +2193,8 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
         */
        if (sock_flag(sk, SOCK_RCVTSTAMP) ||
            (sk->sk_tsflags & SOF_TIMESTAMPING_RX_SOFTWARE) ||
-           (kt.tv64 && sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) ||
-           (hwtstamps->hwtstamp.tv64 &&
+           (kt && sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) ||
+           (hwtstamps->hwtstamp &&
             (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE)))
                __sock_recv_timestamp(msg, sk, skb);
        else
index 207147b4c6b2a126af103e715d99c8914b290d48..6061963cca98ed84ef09f788ee0ebdc3867a07c8 100644 (file)
@@ -252,7 +252,6 @@ extern int sysctl_tcp_wmem[3];
 extern int sysctl_tcp_rmem[3];
 extern int sysctl_tcp_app_win;
 extern int sysctl_tcp_adv_win_scale;
-extern int sysctl_tcp_tw_reuse;
 extern int sysctl_tcp_frto;
 extern int sysctl_tcp_low_latency;
 extern int sysctl_tcp_nometrics_save;
index 931a47ba45718ad5c329b1085c7fac5319e7448f..1beab5532035dc2126405384d44457f183de2a90 100644 (file)
@@ -205,10 +205,12 @@ static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr,
 
        dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if);
        if (dev) {
-               ip4 = (struct in_device *)dev->ip_ptr;
-               if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address)
+               ip4 = in_dev_get(dev);
+               if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) {
                        ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address,
                                               (struct in6_addr *)gid);
+                       in_dev_put(ip4);
+               }
                dev_put(dev);
        }
 }
index 8029d2a51f14548109ad12b28d57f4836764dda3..958a24d8fae794547c486b5b025f3815c96f82e7 100644 (file)
@@ -59,7 +59,7 @@
 #include <linux/if_link.h>
 #include <linux/atomic.h>
 #include <linux/mmu_notifier.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 extern struct workqueue_struct *ib_wq;
 extern struct workqueue_struct *ib_comp_wq;
index a1c108c16c9cf995fd5dd48a81e2b1569af60773..ae4f358dd8e924831088bb05bceeb12c06b2d61c 100644 (file)
@@ -31,7 +31,7 @@ TRACE_EVENT(alarmtimer_suspend,
        ),
 
        TP_fast_assign(
-               __entry->expires = expires.tv64;
+               __entry->expires = expires;
                __entry->alarm_type = flag;
        ),
 
@@ -57,8 +57,8 @@ DECLARE_EVENT_CLASS(alarm_class,
        TP_fast_assign(
                __entry->alarm = alarm;
                __entry->alarm_type = alarm->type;
-               __entry->expires = alarm->node.expires.tv64;
-               __entry->now = now.tv64;
+               __entry->expires = alarm->node.expires;
+               __entry->now = now;
        ),
 
        TP_printk("alarmtimer:%p type:%s expires:%llu now:%llu",
index 5a81ab48a2fb2921328e098c388e77d58a765147..9e687ca9a307b1344889186e46dd5e62a85f614f 100644 (file)
@@ -81,6 +81,7 @@
 
 #define __def_pageflag_names                                           \
        {1UL << PG_locked,              "locked"        },              \
+       {1UL << PG_waiters,             "waiters"       },              \
        {1UL << PG_error,               "error"         },              \
        {1UL << PG_referenced,          "referenced"    },              \
        {1UL << PG_uptodate,            "uptodate"      },              \
@@ -95,7 +96,6 @@
        {1UL << PG_private_2,           "private_2"     },              \
        {1UL << PG_writeback,           "writeback"     },              \
        {1UL << PG_head,                "head"          },              \
-       {1UL << PG_swapcache,           "swapcache"     },              \
        {1UL << PG_mappedtodisk,        "mappedtodisk"  },              \
        {1UL << PG_reclaim,             "reclaim"       },              \
        {1UL << PG_swapbacked,          "swapbacked"    },              \
index 7ea4c5e7c4487a963acfc75c027514a6cb360169..288c0c54a2b4ace63a94549c136fe255e2982089 100644 (file)
@@ -11,16 +11,16 @@ TRACE_EVENT(swiotlb_bounced,
        TP_PROTO(struct device *dev,
                 dma_addr_t dev_addr,
                 size_t size,
-                int swiotlb_force),
+                enum swiotlb_force swiotlb_force),
 
        TP_ARGS(dev, dev_addr, size, swiotlb_force),
 
        TP_STRUCT__entry(
-               __string(       dev_name,       dev_name(dev)   )
-               __field(        u64,    dma_mask                )
-               __field(        dma_addr_t,     dev_addr        )
-               __field(        size_t, size                    )
-               __field(        int,    swiotlb_force           )
+               __string(       dev_name,       dev_name(dev)           )
+               __field(        u64,    dma_mask                        )
+               __field(        dma_addr_t,     dev_addr                )
+               __field(        size_t, size                            )
+               __field(        enum swiotlb_force,     swiotlb_force   )
        ),
 
        TP_fast_assign(
@@ -37,7 +37,10 @@ TRACE_EVENT(swiotlb_bounced,
                __entry->dma_mask,
                (unsigned long long)__entry->dev_addr,
                __entry->size,
-               __entry->swiotlb_force ? "swiotlb_force" : "" )
+               __print_symbolic(__entry->swiotlb_force,
+                       { SWIOTLB_NORMAL,       "NORMAL" },
+                       { SWIOTLB_FORCE,        "FORCE" },
+                       { SWIOTLB_NO_FORCE,     "NO_FORCE" }))
 );
 
 #endif /*  _TRACE_SWIOTLB_H */
index 28c5da6fdfac762e64f3d7ae26edcc9adbefe9ab..1448637616d648475d5ccd28945df6fce617bca0 100644 (file)
@@ -177,16 +177,14 @@ TRACE_EVENT(hrtimer_start,
        TP_fast_assign(
                __entry->hrtimer        = hrtimer;
                __entry->function       = hrtimer->function;
-               __entry->expires        = hrtimer_get_expires(hrtimer).tv64;
-               __entry->softexpires    = hrtimer_get_softexpires(hrtimer).tv64;
+               __entry->expires        = hrtimer_get_expires(hrtimer);
+               __entry->softexpires    = hrtimer_get_softexpires(hrtimer);
        ),
 
        TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu",
                  __entry->hrtimer, __entry->function,
-                 (unsigned long long)ktime_to_ns((ktime_t) {
-                                 .tv64 = __entry->expires }),
-                 (unsigned long long)ktime_to_ns((ktime_t) {
-                                 .tv64 = __entry->softexpires }))
+                 (unsigned long long) __entry->expires,
+                 (unsigned long long) __entry->softexpires)
 );
 
 /**
@@ -211,13 +209,13 @@ TRACE_EVENT(hrtimer_expire_entry,
 
        TP_fast_assign(
                __entry->hrtimer        = hrtimer;
-               __entry->now            = now->tv64;
+               __entry->now            = *now;
                __entry->function       = hrtimer->function;
        ),
 
        TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function,
-                 (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now }))
- );
+                 (unsigned long long) __entry->now)
+);
 
 DECLARE_EVENT_CLASS(hrtimer_class,
 
index acc63697a0cc415357792e922396a9ef296bb01f..b2a31a55a61237e65e4939a9d2722e136cc73ca0 100644 (file)
@@ -93,6 +93,7 @@ struct usb_ext_prop_desc {
  * |   0 | magic     | LE32         | FUNCTIONFS_DESCRIPTORS_MAGIC_V2      |
  * |   4 | length    | LE32         | length of the whole data chunk       |
  * |   8 | flags     | LE32         | combination of functionfs_flags      |
+ * |     | eventfd   | LE32         | eventfd file descriptor              |
  * |     | fs_count  | LE32         | number of full-speed descriptors     |
  * |     | hs_count  | LE32         | number of high-speed descriptors     |
  * |     | ss_count  | LE32         | number of super-speed descriptors    |
index 11f83be1fa7997bb2a38e01f9d4a69f21f37bf93..53d4ce942a887fada9db485771c830f36df54679 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/mm.h>
 
 #include <asm/pgtable.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
index c81c9fa21bc770896c737fd408ef372e37d79c1f..b0c9d6facef9a5aced55d1443b40029a660011e8 100644 (file)
@@ -647,9 +647,8 @@ asmlinkage __visible void __init start_kernel(void)
        security_init();
        dbg_late_init();
        vfs_caches_init();
+       pagecache_init();
        signals_init();
-       /* rootfs populating might need page-writeback */
-       page_writeback_init();
        proc_root_init();
        nsfs_init();
        cpuset_init();
index 8b1dde96a0faa1bda645f0e03388f0a47f565bdc..7b44195da81bb25a080b165402b74cf8c7f59bcc 100644 (file)
@@ -231,9 +231,11 @@ static void untag_chunk(struct node *p)
        if (size)
                new = alloc_chunk(size);
 
+       mutex_lock(&entry->group->mark_mutex);
        spin_lock(&entry->lock);
        if (chunk->dead || !entry->inode) {
                spin_unlock(&entry->lock);
+               mutex_unlock(&entry->group->mark_mutex);
                if (new)
                        free_chunk(new);
                goto out;
@@ -251,6 +253,7 @@ static void untag_chunk(struct node *p)
                list_del_rcu(&chunk->hash);
                spin_unlock(&hash_lock);
                spin_unlock(&entry->lock);
+               mutex_unlock(&entry->group->mark_mutex);
                fsnotify_destroy_mark(entry, audit_tree_group);
                goto out;
        }
@@ -258,8 +261,8 @@ static void untag_chunk(struct node *p)
        if (!new)
                goto Fallback;
 
-       fsnotify_duplicate_mark(&new->mark, entry);
-       if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.inode, NULL, 1)) {
+       if (fsnotify_add_mark_locked(&new->mark, entry->group, entry->inode,
+                                    NULL, 1)) {
                fsnotify_put_mark(&new->mark);
                goto Fallback;
        }
@@ -293,6 +296,7 @@ static void untag_chunk(struct node *p)
                owner->root = new;
        spin_unlock(&hash_lock);
        spin_unlock(&entry->lock);
+       mutex_unlock(&entry->group->mark_mutex);
        fsnotify_destroy_mark(entry, audit_tree_group);
        fsnotify_put_mark(&new->mark);  /* drop initial reference */
        goto out;
@@ -309,6 +313,7 @@ Fallback:
        put_tree(owner);
        spin_unlock(&hash_lock);
        spin_unlock(&entry->lock);
+       mutex_unlock(&entry->group->mark_mutex);
 out:
        fsnotify_put_mark(entry);
        spin_lock(&hash_lock);
@@ -386,18 +391,21 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
 
        chunk_entry = &chunk->mark;
 
+       mutex_lock(&old_entry->group->mark_mutex);
        spin_lock(&old_entry->lock);
        if (!old_entry->inode) {
                /* old_entry is being shot, lets just lie */
                spin_unlock(&old_entry->lock);
+               mutex_unlock(&old_entry->group->mark_mutex);
                fsnotify_put_mark(old_entry);
                free_chunk(chunk);
                return -ENOENT;
        }
 
-       fsnotify_duplicate_mark(chunk_entry, old_entry);
-       if (fsnotify_add_mark(chunk_entry, chunk_entry->group, chunk_entry->inode, NULL, 1)) {
+       if (fsnotify_add_mark_locked(chunk_entry, old_entry->group,
+                                    old_entry->inode, NULL, 1)) {
                spin_unlock(&old_entry->lock);
+               mutex_unlock(&old_entry->group->mark_mutex);
                fsnotify_put_mark(chunk_entry);
                fsnotify_put_mark(old_entry);
                return -ENOSPC;
@@ -413,6 +421,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
                chunk->dead = 1;
                spin_unlock(&chunk_entry->lock);
                spin_unlock(&old_entry->lock);
+               mutex_unlock(&old_entry->group->mark_mutex);
 
                fsnotify_destroy_mark(chunk_entry, audit_tree_group);
 
@@ -445,6 +454,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
        spin_unlock(&hash_lock);
        spin_unlock(&chunk_entry->lock);
        spin_unlock(&old_entry->lock);
+       mutex_unlock(&old_entry->group->mark_mutex);
        fsnotify_destroy_mark(old_entry, audit_tree_group);
        fsnotify_put_mark(chunk_entry); /* drop initial reference */
        fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */
index 4984e1f552ebfb97fa460b527b35c67ebd0f324d..a98e814f216f9c54f878bcfca32e4747be357c07 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/syscalls.h>
 #include <linux/pid_namespace.h>
 #include <linux/user_namespace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * Leveraged for setting/resetting capabilities
index b3a047f208a7a8f7ec6c4ebb39d965383958ab76..19aec5d981081d26914c14f5db2e76646c399888 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/ptrace.h>
 #include <linux/gfp.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static int compat_get_timex(struct timex *txc, struct compat_timex __user *utp)
 {
index c18b1f1ae515a73cf0fe404d413ddcc4bc8f847d..2df132b20217120e12a2df26a96a12cf566db916 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /**************************************************/
 /* the actual current config file                 */
index 5339aca811d2289690198119206eaa42d959452f..f75c4d031eeb2152c75182466dbf5ec97e93c008 100644 (file)
@@ -183,23 +183,16 @@ EXPORT_SYMBOL_GPL(cpuhp_tasks_frozen);
 /*
  * The following two APIs (cpu_maps_update_begin/done) must be used when
  * attempting to serialize the updates to cpu_online_mask & cpu_present_mask.
- * The APIs cpu_notifier_register_begin/done() must be used to protect CPU
- * hotplug callback (un)registration performed using __register_cpu_notifier()
- * or __unregister_cpu_notifier().
  */
 void cpu_maps_update_begin(void)
 {
        mutex_lock(&cpu_add_remove_lock);
 }
-EXPORT_SYMBOL(cpu_notifier_register_begin);
 
 void cpu_maps_update_done(void)
 {
        mutex_unlock(&cpu_add_remove_lock);
 }
-EXPORT_SYMBOL(cpu_notifier_register_done);
-
-static RAW_NOTIFIER_HEAD(cpu_chain);
 
 /* If set, cpu_up and cpu_down will return -EBUSY and do nothing.
  * Should always be manipulated under cpu_add_remove_lock
@@ -349,66 +342,7 @@ void cpu_hotplug_enable(void)
 EXPORT_SYMBOL_GPL(cpu_hotplug_enable);
 #endif /* CONFIG_HOTPLUG_CPU */
 
-/* Need to know about CPUs going up/down? */
-int register_cpu_notifier(struct notifier_block *nb)
-{
-       int ret;
-       cpu_maps_update_begin();
-       ret = raw_notifier_chain_register(&cpu_chain, nb);
-       cpu_maps_update_done();
-       return ret;
-}
-
-int __register_cpu_notifier(struct notifier_block *nb)
-{
-       return raw_notifier_chain_register(&cpu_chain, nb);
-}
-
-static int __cpu_notify(unsigned long val, unsigned int cpu, int nr_to_call,
-                       int *nr_calls)
-{
-       unsigned long mod = cpuhp_tasks_frozen ? CPU_TASKS_FROZEN : 0;
-       void *hcpu = (void *)(long)cpu;
-
-       int ret;
-
-       ret = __raw_notifier_call_chain(&cpu_chain, val | mod, hcpu, nr_to_call,
-                                       nr_calls);
-
-       return notifier_to_errno(ret);
-}
-
-static int cpu_notify(unsigned long val, unsigned int cpu)
-{
-       return __cpu_notify(val, cpu, -1, NULL);
-}
-
-static void cpu_notify_nofail(unsigned long val, unsigned int cpu)
-{
-       BUG_ON(cpu_notify(val, cpu));
-}
-
 /* Notifier wrappers for transitioning to state machine */
-static int notify_prepare(unsigned int cpu)
-{
-       int nr_calls = 0;
-       int ret;
-
-       ret = __cpu_notify(CPU_UP_PREPARE, cpu, -1, &nr_calls);
-       if (ret) {
-               nr_calls--;
-               printk(KERN_WARNING "%s: attempt to bring up CPU %u failed\n",
-                               __func__, cpu);
-               __cpu_notify(CPU_UP_CANCELED, cpu, nr_calls, NULL);
-       }
-       return ret;
-}
-
-static int notify_online(unsigned int cpu)
-{
-       cpu_notify(CPU_ONLINE, cpu);
-       return 0;
-}
 
 static int bringup_wait_for_ap(unsigned int cpu)
 {
@@ -433,10 +367,8 @@ static int bringup_cpu(unsigned int cpu)
        /* Arch-specific enabling code. */
        ret = __cpu_up(cpu, idle);
        irq_unlock_sparse();
-       if (ret) {
-               cpu_notify(CPU_UP_CANCELED, cpu);
+       if (ret)
                return ret;
-       }
        ret = bringup_wait_for_ap(cpu);
        BUG_ON(!cpu_online(cpu));
        return ret;
@@ -565,11 +497,6 @@ static void cpuhp_thread_fun(unsigned int cpu)
                BUG_ON(st->state < CPUHP_AP_ONLINE_IDLE);
 
                undo_cpu_down(cpu, st);
-               /*
-                * This is a momentary workaround to keep the notifier users
-                * happy. Will go away once we got rid of the notifiers.
-                */
-               cpu_notify_nofail(CPU_DOWN_FAILED, cpu);
                st->rollback = false;
        } else {
                /* Cannot happen .... */
@@ -659,22 +586,6 @@ void __init cpuhp_threads_init(void)
        kthread_unpark(this_cpu_read(cpuhp_state.thread));
 }
 
-EXPORT_SYMBOL(register_cpu_notifier);
-EXPORT_SYMBOL(__register_cpu_notifier);
-void unregister_cpu_notifier(struct notifier_block *nb)
-{
-       cpu_maps_update_begin();
-       raw_notifier_chain_unregister(&cpu_chain, nb);
-       cpu_maps_update_done();
-}
-EXPORT_SYMBOL(unregister_cpu_notifier);
-
-void __unregister_cpu_notifier(struct notifier_block *nb)
-{
-       raw_notifier_chain_unregister(&cpu_chain, nb);
-}
-EXPORT_SYMBOL(__unregister_cpu_notifier);
-
 #ifdef CONFIG_HOTPLUG_CPU
 /**
  * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU
@@ -741,20 +652,6 @@ static inline void check_for_tasks(int dead_cpu)
        read_unlock(&tasklist_lock);
 }
 
-static int notify_down_prepare(unsigned int cpu)
-{
-       int err, nr_calls = 0;
-
-       err = __cpu_notify(CPU_DOWN_PREPARE, cpu, -1, &nr_calls);
-       if (err) {
-               nr_calls--;
-               __cpu_notify(CPU_DOWN_FAILED, cpu, nr_calls, NULL);
-               pr_warn("%s: attempt to take down CPU %u failed\n",
-                               __func__, cpu);
-       }
-       return err;
-}
-
 /* Take this CPU down. */
 static int take_cpu_down(void *_param)
 {
@@ -833,13 +730,6 @@ static int takedown_cpu(unsigned int cpu)
        return 0;
 }
 
-static int notify_dead(unsigned int cpu)
-{
-       cpu_notify_nofail(CPU_DEAD, cpu);
-       check_for_tasks(cpu);
-       return 0;
-}
-
 static void cpuhp_complete_idle_dead(void *arg)
 {
        struct cpuhp_cpu_state *st = arg;
@@ -863,9 +753,7 @@ void cpuhp_report_idle_dead(void)
 }
 
 #else
-#define notify_down_prepare    NULL
 #define takedown_cpu           NULL
-#define notify_dead            NULL
 #endif
 
 #ifdef CONFIG_HOTPLUG_CPU
@@ -924,9 +812,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
        hasdied = prev_state != st->state && st->state == CPUHP_OFFLINE;
 out:
        cpu_hotplug_done();
-       /* This post dead nonsense must die */
-       if (!ret && hasdied)
-               cpu_notify_nofail(CPU_POST_DEAD, cpu);
        return ret;
 }
 
@@ -1291,17 +1176,6 @@ static struct cpuhp_step cpuhp_bp_states[] = {
                .startup.single         = rcutree_prepare_cpu,
                .teardown.single        = rcutree_dead_cpu,
        },
-       /*
-        * Preparatory and dead notifiers. Will be replaced once the notifiers
-        * are converted to states.
-        */
-       [CPUHP_NOTIFY_PREPARE] = {
-               .name                   = "notify:prepare",
-               .startup.single         = notify_prepare,
-               .teardown.single        = notify_dead,
-               .skip_onerr             = true,
-               .cant_stop              = true,
-       },
        /*
         * On the tear-down path, timers_dead_cpu() must be invoked
         * before blk_mq_queue_reinit_notify() from notify_dead(),
@@ -1391,17 +1265,6 @@ static struct cpuhp_step cpuhp_ap_states[] = {
                .startup.single         = rcutree_online_cpu,
                .teardown.single        = rcutree_offline_cpu,
        },
-
-       /*
-        * Online/down_prepare notifiers. Will be removed once the notifiers
-        * are converted to states.
-        */
-       [CPUHP_AP_NOTIFY_ONLINE] = {
-               .name                   = "notify:online",
-               .startup.single         = notify_online,
-               .teardown.single        = notify_down_prepare,
-               .skip_onerr             = true,
-       },
 #endif
        /*
         * The dynamically registered state space is here
@@ -1432,23 +1295,53 @@ static int cpuhp_cb_check(enum cpuhp_state state)
        return 0;
 }
 
-static void cpuhp_store_callbacks(enum cpuhp_state state,
-                                 const char *name,
-                                 int (*startup)(unsigned int cpu),
-                                 int (*teardown)(unsigned int cpu),
-                                 bool multi_instance)
+/*
+ * Returns a free for dynamic slot assignment of the Online state. The states
+ * are protected by the cpuhp_slot_states mutex and an empty slot is identified
+ * by having no name assigned.
+ */
+static int cpuhp_reserve_state(enum cpuhp_state state)
+{
+       enum cpuhp_state i;
+
+       for (i = CPUHP_AP_ONLINE_DYN; i <= CPUHP_AP_ONLINE_DYN_END; i++) {
+               if (!cpuhp_ap_states[i].name)
+                       return i;
+       }
+       WARN(1, "No more dynamic states available for CPU hotplug\n");
+       return -ENOSPC;
+}
+
+static int cpuhp_store_callbacks(enum cpuhp_state state, const char *name,
+                                int (*startup)(unsigned int cpu),
+                                int (*teardown)(unsigned int cpu),
+                                bool multi_instance)
 {
        /* (Un)Install the callbacks for further cpu hotplug operations */
        struct cpuhp_step *sp;
+       int ret = 0;
 
        mutex_lock(&cpuhp_state_mutex);
+
+       if (state == CPUHP_AP_ONLINE_DYN) {
+               ret = cpuhp_reserve_state(state);
+               if (ret < 0)
+                       goto out;
+               state = ret;
+       }
        sp = cpuhp_get_step(state);
+       if (name && sp->name) {
+               ret = -EBUSY;
+               goto out;
+       }
        sp->startup.single = startup;
        sp->teardown.single = teardown;
        sp->name = name;
        sp->multi_instance = multi_instance;
        INIT_HLIST_HEAD(&sp->list);
+out:
        mutex_unlock(&cpuhp_state_mutex);
+       return ret;
 }
 
 static void *cpuhp_get_teardown_cb(enum cpuhp_state state)
@@ -1509,29 +1402,6 @@ static void cpuhp_rollback_install(int failedcpu, enum cpuhp_state state,
        }
 }
 
-/*
- * Returns a free for dynamic slot assignment of the Online state. The states
- * are protected by the cpuhp_slot_states mutex and an empty slot is identified
- * by having no name assigned.
- */
-static int cpuhp_reserve_state(enum cpuhp_state state)
-{
-       enum cpuhp_state i;
-
-       mutex_lock(&cpuhp_state_mutex);
-       for (i = CPUHP_AP_ONLINE_DYN; i <= CPUHP_AP_ONLINE_DYN_END; i++) {
-               if (cpuhp_ap_states[i].name)
-                       continue;
-
-               cpuhp_ap_states[i].name = "Reserved";
-               mutex_unlock(&cpuhp_state_mutex);
-               return i;
-       }
-       mutex_unlock(&cpuhp_state_mutex);
-       WARN(1, "No more dynamic states available for CPU hotplug\n");
-       return -ENOSPC;
-}
-
 int __cpuhp_state_add_instance(enum cpuhp_state state, struct hlist_node *node,
                               bool invoke)
 {
@@ -1580,11 +1450,13 @@ EXPORT_SYMBOL_GPL(__cpuhp_state_add_instance);
 
 /**
  * __cpuhp_setup_state - Setup the callbacks for an hotplug machine state
- * @state:     The state to setup
- * @invoke:    If true, the startup function is invoked for cpus where
- *             cpu state >= @state
- * @startup:   startup callback function
- * @teardown:  teardown callback function
+ * @state:             The state to setup
+ * @invoke:            If true, the startup function is invoked for cpus where
+ *                     cpu state >= @state
+ * @startup:           startup callback function
+ * @teardown:          teardown callback function
+ * @multi_instance:    State is set up for multiple instances which get
+ *                     added afterwards.
  *
  * Returns:
  *   On success:
@@ -1599,25 +1471,23 @@ int __cpuhp_setup_state(enum cpuhp_state state,
                        bool multi_instance)
 {
        int cpu, ret = 0;
-       int dyn_state = 0;
+       bool dynstate;
 
        if (cpuhp_cb_check(state) || !name)
                return -EINVAL;
 
        get_online_cpus();
 
-       /* currently assignments for the ONLINE state are possible */
-       if (state == CPUHP_AP_ONLINE_DYN) {
-               dyn_state = 1;
-               ret = cpuhp_reserve_state(state);
-               if (ret < 0)
-                       goto out;
+       ret = cpuhp_store_callbacks(state, name, startup, teardown,
+                                   multi_instance);
+
+       dynstate = state == CPUHP_AP_ONLINE_DYN;
+       if (ret > 0 && dynstate) {
                state = ret;
+               ret = 0;
        }
 
-       cpuhp_store_callbacks(state, name, startup, teardown, multi_instance);
-
-       if (!invoke || !startup)
+       if (ret || !invoke || !startup)
                goto out;
 
        /*
@@ -1641,7 +1511,11 @@ int __cpuhp_setup_state(enum cpuhp_state state,
        }
 out:
        put_online_cpus();
-       if (!ret && dyn_state)
+       /*
+        * If the requested state is CPUHP_AP_ONLINE_DYN, return the
+        * dynamically allocated state in case of success.
+        */
+       if (!ret && dynstate)
                return state;
        return ret;
 }
index 29f815d2ef7e3cfdffe03dd3d9adc409749c61fc..b3088886cd375b71fe1ead5395e41076f137392c 100644 (file)
@@ -55,7 +55,7 @@
 #include <linux/backing-dev.h>
 #include <linux/sort.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 #include <linux/mutex.h>
 #include <linux/cgroup.h>
index 215871bda3a20150e88e001f364ecfa9ae052e64..d416f3baf3924d8093cf275fb1d290bf9d3564e4 100644 (file)
@@ -1194,7 +1194,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
        /* Reserve the 1st slot for get_trampoline_vaddr() */
        set_bit(0, area->bitmap);
        atomic_set(&area->slot_count, 1);
-       copy_to_page(area->pages[0], 0, &insn, UPROBE_SWBP_INSN_SIZE);
+       arch_uprobe_copy_ixol(area->pages[0], 0, &insn, UPROBE_SWBP_INSN_SIZE);
 
        if (!xol_add_vma(mm, area))
                return area;
index aacff8e2aec0b4f9cb41703722e3ba9435c73082..8f14b866f9f616adcf13f2fde5c5652fb113cb42 100644 (file)
@@ -56,7 +56,7 @@
 #include <linux/kcov.h>
 #include <linux/random.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
index e820ccee984673e77b23b09ff42a0db254aba762..e3beec4a2339ee1c013698beb4c9ca126d1e2121 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/init.h>
 
 #include <asm/sections.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * mutex protecting text section modification (dynamic code patching).
index 869b8ccc00bf9068585d80c04e2e30c86b833410..11c5c8ab827c4be8ef8cb09072de2364d90aff6c 100644 (file)
@@ -79,7 +79,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
index 9246d9f593d16c11cdfbb8630286b5f6d5f9e1fa..0842c8ca534b6c7760b254163d88f58cb1229b12 100644 (file)
@@ -2459,7 +2459,7 @@ retry:
        restart->fn = futex_wait_restart;
        restart->futex.uaddr = uaddr;
        restart->futex.val = val;
-       restart->futex.time = abs_time->tv64;
+       restart->futex.time = *abs_time;
        restart->futex.bitset = bitset;
        restart->futex.flags = flags | FLAGS_HAS_TIMEOUT;
 
@@ -2480,7 +2480,7 @@ static long futex_wait_restart(struct restart_block *restart)
        ktime_t t, *tp = NULL;
 
        if (restart->futex.flags & FLAGS_HAS_TIMEOUT) {
-               t.tv64 = restart->futex.time;
+               t = restart->futex.time;
                tp = &t;
        }
        restart->fn = do_no_restart_syscall;
index 4ae3232e7a28a507d5ba316d9603c4275012a7ad..3f409968e4666e7d9252d0b7602253dfc853fc75 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/ptrace.h>
 #include <linux/syscalls.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 /*
index 2fcadd66a8fd7cba19e264c6542ec8940a248a73..8dd7a61b7115e8808408cd2cb911d224a9528297 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/syscalls.h>
 #include <linux/user_namespace.h>
 #include <linux/vmalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 struct group_info *groups_alloc(int gidsetsize)
 {
index 0277d1216f80ae1adeed84a686ed34c9b2931fc2..d45c96073afbaf09f6734065ac438fadcc131f69 100644 (file)
@@ -39,7 +39,7 @@
 #include <linux/rwsem.h>
 #include <linux/ptrace.h>
 #include <linux/async.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <trace/events/module.h>
 
index d63095472ea98dfbe9932246032597f630886a0f..43460104f119d070841ba1af1a51536dc8017f61 100644 (file)
@@ -52,7 +52,7 @@
 #include <asm/sections.h>
 #include <asm/cacheflush.h>
 #include <asm/errno.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define KPROBE_HASH_BITS 6
 #define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS)
index a0f61effad25cf0fa2d1dd27557dccd4a3f3ffc5..6d1fcc786081a0cddb66cb2537cae22e1121b685 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/debug_locks.h>
 #include <linux/vmalloc.h>
 #include <linux/sort.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/div64.h>
 
 #include "lockdep_internals.h"
index f7482db0f84316b24940305b006e701fed9cdc4f..5088784c0cf9e97c166b7dc06afed9d1c7709d2e 100644 (file)
@@ -46,7 +46,7 @@
 #include <linux/string.h>
 #include <linux/mutex.h>
 #include <linux/rculist.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/mmu_context.h>
 #include <linux/license.h>
index 4f0f0604f1c4f581f635284f65665adc34fccf3e..2d8e2b227db84598f1523fa8fdadca5ccd7e9f44 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/compiler.h>
 #include <linux/ktime.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
index 35310b627388864b3125bce827e96d1a072c15b3..22df9f7ff672425f1200c421eceff5a41c220ff2 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/cpu.h>
 #include <linux/freezer.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "power.h"
 
index e2cdd87e7a632d191d1ffc7c17dc16219d983c7d..8b2696420abb5de7347429f52d9a3d46d4dbcd24 100644 (file)
@@ -46,7 +46,7 @@
 #include <linux/ctype.h>
 #include <linux/uio.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/sections.h>
 
 #define CREATE_TRACE_POINTS
index 2dbccf2d806c66d76a59a208cb6a000819bf5db4..f67ce0aa6bc449bc9efd60a2d61904f3216c1071 100644 (file)
@@ -408,7 +408,7 @@ void profile_tick(int type)
 #ifdef CONFIG_PROC_FS
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static int prof_cpu_mask_proc_show(struct seq_file *m, void *v)
 {
index 966556ebdbb3fd68c272c8bc1cbffde252d4de45..c56fb57f2991ef4f2a68395c534b32d3053ae208 100644 (file)
@@ -1456,7 +1456,7 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)
                 * yield - it could be a while.
                 */
                if (unlikely(queued)) {
-                       ktime_t to = ktime_set(0, NSEC_PER_SEC/HZ);
+                       ktime_t to = NSEC_PER_SEC / HZ;
 
                        set_current_state(TASK_UNINTERRUPTIBLE);
                        schedule_hrtimeout(&to, HRTIMER_MODE_REL);
index ae60996fedffcf9e79ab208d650af7d155cff694..ff046b73ff2d309ce00fbd3bd8949a8f6f5fd297 100644 (file)
@@ -39,7 +39,7 @@
 #include <trace/events/signal.h>
 
 #include <asm/param.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/siginfo.h>
 #include <asm/cacheflush.h>
@@ -587,7 +587,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
                        struct hrtimer *tmr = &tsk->signal->real_timer;
 
                        if (!hrtimer_is_queued(tmr) &&
-                           tsk->signal->it_real_incr.tv64 != 0) {
+                           tsk->signal->it_real_incr != 0) {
                                hrtimer_forward(tmr, tmr->base->get_time(),
                                                tsk->signal->it_real_incr);
                                hrtimer_restart(tmr);
@@ -2766,7 +2766,7 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
 int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
                    const struct timespec *ts)
 {
-       ktime_t *to = NULL, timeout = { .tv64 = KTIME_MAX };
+       ktime_t *to = NULL, timeout = KTIME_MAX;
        struct task_struct *tsk = current;
        sigset_t mask = *which;
        int sig, ret = 0;
@@ -2786,7 +2786,7 @@ int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
 
        spin_lock_irq(&tsk->sighand->siglock);
        sig = dequeue_signal(tsk, &mask, info);
-       if (!sig && timeout.tv64) {
+       if (!sig && timeout) {
                /*
                 * None ready, temporarily unblock those we're interested
                 * while we are sleeping in so that we'll be awakened when
index 9758892a2d09e54d7cfc52c8530bdab0cbc253d6..842914ef7de4b58a09c1b545d4cf804cb075983a 100644 (file)
@@ -57,7 +57,7 @@
 /* Move somewhere else to avoid recompiling? */
 #include <generated/utsrelease.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/io.h>
 #include <asm/unistd.h>
 
index 635482e60ca39f93e706f51dbccf7a19dfefe284..8acef8576ce9b211ea3ede4ccf63220466b40e22 100644 (file)
@@ -150,6 +150,9 @@ cond_syscall(sys_io_destroy);
 cond_syscall(sys_io_submit);
 cond_syscall(sys_io_cancel);
 cond_syscall(sys_io_getevents);
+cond_syscall(compat_sys_io_setup);
+cond_syscall(compat_sys_io_submit);
+cond_syscall(compat_sys_io_getevents);
 cond_syscall(sys_sysfs);
 cond_syscall(sys_syslog);
 cond_syscall(sys_process_vm_readv);
index 1a292ebcbbb6aade7d2ac340cd51c92fb282ccac..8dbaec0e4f7f079b87f50ea67c82341304387783 100644 (file)
@@ -67,7 +67,7 @@
 #include <linux/bpf.h>
 #include <linux/mount.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/processor.h>
 
 #ifdef CONFIG_X86
index 3921cf7fea8e1fe7c656a7afbaae4f83b50e3a76..e6dc9a538efa21163186e7292a6c312b6a7bc82a 100644 (file)
@@ -234,7 +234,7 @@ static int alarmtimer_suspend(struct device *dev)
        min = freezer_delta;
        expires = freezer_expires;
        type = freezer_alarmtype;
-       freezer_delta = ktime_set(0, 0);
+       freezer_delta = 0;
        spin_unlock_irqrestore(&freezer_delta_lock, flags);
 
        rtc = alarmtimer_get_rtcdev();
@@ -254,13 +254,13 @@ static int alarmtimer_suspend(struct device *dev)
                if (!next)
                        continue;
                delta = ktime_sub(next->expires, base->gettime());
-               if (!min.tv64 || (delta.tv64 < min.tv64)) {
+               if (!min || (delta < min)) {
                        expires = next->expires;
                        min = delta;
                        type = i;
                }
        }
-       if (min.tv64 == 0)
+       if (min == 0)
                return 0;
 
        if (ktime_to_ns(min) < 2 * NSEC_PER_SEC) {
@@ -277,7 +277,7 @@ static int alarmtimer_suspend(struct device *dev)
        now = ktime_add(now, min);
 
        /* Set alarm, if in the past reject suspend briefly to handle */
-       ret = rtc_timer_start(rtc, &rtctimer, now, ktime_set(0, 0));
+       ret = rtc_timer_start(rtc, &rtctimer, now, 0);
        if (ret < 0)
                __pm_wakeup_event(ws, MSEC_PER_SEC);
        return ret;
@@ -328,7 +328,7 @@ static void alarmtimer_freezerset(ktime_t absexp, enum alarmtimer_type type)
        delta = ktime_sub(absexp, base->gettime());
 
        spin_lock_irqsave(&freezer_delta_lock, flags);
-       if (!freezer_delta.tv64 || (delta.tv64 < freezer_delta.tv64)) {
+       if (!freezer_delta || (delta < freezer_delta)) {
                freezer_delta = delta;
                freezer_expires = absexp;
                freezer_alarmtype = type;
@@ -453,10 +453,10 @@ u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval)
 
        delta = ktime_sub(now, alarm->node.expires);
 
-       if (delta.tv64 < 0)
+       if (delta < 0)
                return 0;
 
-       if (unlikely(delta.tv64 >= interval.tv64)) {
+       if (unlikely(delta >= interval)) {
                s64 incr = ktime_to_ns(interval);
 
                overrun = ktime_divns(delta, incr);
@@ -464,7 +464,7 @@ u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval)
                alarm->node.expires = ktime_add_ns(alarm->node.expires,
                                                        incr*overrun);
 
-               if (alarm->node.expires.tv64 > now.tv64)
+               if (alarm->node.expires > now)
                        return overrun;
                /*
                 * This (and the ktime_add() below) is the
@@ -522,7 +522,7 @@ static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm,
        }
 
        /* Re-add periodic timers */
-       if (ptr->it.alarm.interval.tv64) {
+       if (ptr->it.alarm.interval) {
                ptr->it_overrun += alarm_forward(alarm, now,
                                                ptr->it.alarm.interval);
                result = ALARMTIMER_RESTART;
@@ -730,7 +730,7 @@ static int update_rmtp(ktime_t exp, enum  alarmtimer_type type,
 
        rem = ktime_sub(exp, alarm_bases[type].gettime());
 
-       if (rem.tv64 <= 0)
+       if (rem <= 0)
                return 0;
        rmt = ktime_to_timespec(rem);
 
@@ -755,7 +755,7 @@ static long __sched alarm_timer_nsleep_restart(struct restart_block *restart)
        struct alarm alarm;
        int ret = 0;
 
-       exp.tv64 = restart->nanosleep.expires;
+       exp = restart->nanosleep.expires;
        alarm_init(&alarm, type, alarmtimer_nsleep_wakeup);
 
        if (alarmtimer_do_nsleep(&alarm, exp))
@@ -835,7 +835,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
        restart = &current->restart_block;
        restart->fn = alarm_timer_nsleep_restart;
        restart->nanosleep.clockid = type;
-       restart->nanosleep.expires = exp.tv64;
+       restart->nanosleep.expires = exp;
        restart->nanosleep.rmtp = rmtp;
        ret = -ERESTART_RESTARTBLOCK;
 
index 2c5bc77c0bb004fa5b9bd5e9ca60f60b40ba1b4f..97ac0951f164a386ca7199195607a1af90ed14ea 100644 (file)
@@ -179,7 +179,7 @@ void clockevents_switch_state(struct clock_event_device *dev,
 void clockevents_shutdown(struct clock_event_device *dev)
 {
        clockevents_switch_state(dev, CLOCK_EVT_STATE_SHUTDOWN);
-       dev->next_event.tv64 = KTIME_MAX;
+       dev->next_event = KTIME_MAX;
 }
 
 /**
@@ -213,7 +213,7 @@ static int clockevents_increase_min_delta(struct clock_event_device *dev)
        if (dev->min_delta_ns >= MIN_DELTA_LIMIT) {
                printk_deferred(KERN_WARNING
                                "CE: Reprogramming failure. Giving up\n");
-               dev->next_event.tv64 = KTIME_MAX;
+               dev->next_event = KTIME_MAX;
                return -ETIME;
        }
 
@@ -310,7 +310,7 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,
        int64_t delta;
        int rc;
 
-       if (unlikely(expires.tv64 < 0)) {
+       if (unlikely(expires < 0)) {
                WARN_ON_ONCE(1);
                return -ETIME;
        }
index 150242ccfcd201a14e633357589d4c4f3327207e..665985b0a89afe88486fed0e2571771bdd4d94b5 100644 (file)
@@ -170,7 +170,7 @@ void clocksource_mark_unstable(struct clocksource *cs)
 static void clocksource_watchdog(unsigned long data)
 {
        struct clocksource *cs;
-       cycle_t csnow, wdnow, cslast, wdlast, delta;
+       u64 csnow, wdnow, cslast, wdlast, delta;
        int64_t wd_nsec, cs_nsec;
        int next_cpu, reset_pending;
 
index 08be5c99d26b02d4fb87438fc7519697034a81ec..c6ecedd3b8393d4b3f4fc3b5cce41ebbffd375cd 100644 (file)
@@ -50,7 +50,7 @@
 #include <linux/timer.h>
 #include <linux/freezer.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <trace/events/timer.h>
 
@@ -171,7 +171,7 @@ hrtimer_check_target(struct hrtimer *timer, struct hrtimer_clock_base *new_base)
                return 0;
 
        expires = ktime_sub(hrtimer_get_expires(timer), new_base->offset);
-       return expires.tv64 <= new_base->cpu_base->expires_next.tv64;
+       return expires <= new_base->cpu_base->expires_next;
 #else
        return 0;
 #endif
@@ -313,7 +313,7 @@ ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs)
         * We use KTIME_SEC_MAX here, the maximum timeout which we can
         * return to user space in a timespec:
         */
-       if (res.tv64 < 0 || res.tv64 < lhs.tv64 || res.tv64 < rhs.tv64)
+       if (res < 0 || res < lhs || res < rhs)
                res = ktime_set(KTIME_SEC_MAX, 0);
 
        return res;
@@ -465,8 +465,8 @@ static inline void hrtimer_update_next_timer(struct hrtimer_cpu_base *cpu_base,
 static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
 {
        struct hrtimer_clock_base *base = cpu_base->clock_base;
-       ktime_t expires, expires_next = { .tv64 = KTIME_MAX };
        unsigned int active = cpu_base->active_bases;
+       ktime_t expires, expires_next = KTIME_MAX;
 
        hrtimer_update_next_timer(cpu_base, NULL);
        for (; active; base++, active >>= 1) {
@@ -479,7 +479,7 @@ static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
                next = timerqueue_getnext(&base->active);
                timer = container_of(next, struct hrtimer, node);
                expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
-               if (expires.tv64 < expires_next.tv64) {
+               if (expires < expires_next) {
                        expires_next = expires;
                        hrtimer_update_next_timer(cpu_base, timer);
                }
@@ -489,8 +489,8 @@ static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
         * the clock bases so the result might be negative. Fix it up
         * to prevent a false positive in clockevents_program_event().
         */
-       if (expires_next.tv64 < 0)
-               expires_next.tv64 = 0;
+       if (expires_next < 0)
+               expires_next = 0;
        return expires_next;
 }
 #endif
@@ -561,10 +561,10 @@ hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal)
 
        expires_next = __hrtimer_get_next_event(cpu_base);
 
-       if (skip_equal && expires_next.tv64 == cpu_base->expires_next.tv64)
+       if (skip_equal && expires_next == cpu_base->expires_next)
                return;
 
-       cpu_base->expires_next.tv64 = expires_next.tv64;
+       cpu_base->expires_next = expires_next;
 
        /*
         * If a hang was detected in the last timer interrupt then we
@@ -622,10 +622,10 @@ static void hrtimer_reprogram(struct hrtimer *timer,
         * CLOCK_REALTIME timer might be requested with an absolute
         * expiry time which is less than base->offset. Set it to 0.
         */
-       if (expires.tv64 < 0)
-               expires.tv64 = 0;
+       if (expires < 0)
+               expires = 0;
 
-       if (expires.tv64 >= cpu_base->expires_next.tv64)
+       if (expires >= cpu_base->expires_next)
                return;
 
        /* Update the pointer to the next expiring timer */
@@ -653,7 +653,7 @@ static void hrtimer_reprogram(struct hrtimer *timer,
  */
 static inline void hrtimer_init_hres(struct hrtimer_cpu_base *base)
 {
-       base->expires_next.tv64 = KTIME_MAX;
+       base->expires_next = KTIME_MAX;
        base->hres_active = 0;
 }
 
@@ -827,21 +827,21 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
 
        delta = ktime_sub(now, hrtimer_get_expires(timer));
 
-       if (delta.tv64 < 0)
+       if (delta < 0)
                return 0;
 
        if (WARN_ON(timer->state & HRTIMER_STATE_ENQUEUED))
                return 0;
 
-       if (interval.tv64 < hrtimer_resolution)
-               interval.tv64 = hrtimer_resolution;
+       if (interval < hrtimer_resolution)
+               interval = hrtimer_resolution;
 
-       if (unlikely(delta.tv64 >= interval.tv64)) {
+       if (unlikely(delta >= interval)) {
                s64 incr = ktime_to_ns(interval);
 
                orun = ktime_divns(delta, incr);
                hrtimer_add_expires_ns(timer, incr * orun);
-               if (hrtimer_get_expires_tv64(timer) > now.tv64)
+               if (hrtimer_get_expires_tv64(timer) > now)
                        return orun;
                /*
                 * This (and the ktime_add() below) is the
@@ -955,7 +955,7 @@ static inline ktime_t hrtimer_update_lowres(struct hrtimer *timer, ktime_t tim,
         */
        timer->is_rel = mode & HRTIMER_MODE_REL;
        if (timer->is_rel)
-               tim = ktime_add_safe(tim, ktime_set(0, hrtimer_resolution));
+               tim = ktime_add_safe(tim, hrtimer_resolution);
 #endif
        return tim;
 }
@@ -1104,7 +1104,7 @@ u64 hrtimer_get_next_event(void)
        raw_spin_lock_irqsave(&cpu_base->lock, flags);
 
        if (!__hrtimer_hres_active(cpu_base))
-               expires = __hrtimer_get_next_event(cpu_base).tv64;
+               expires = __hrtimer_get_next_event(cpu_base);
 
        raw_spin_unlock_irqrestore(&cpu_base->lock, flags);
 
@@ -1296,7 +1296,7 @@ static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now)
                         * are right-of a not yet expired timer, because that
                         * timer will have to trigger a wakeup anyway.
                         */
-                       if (basenow.tv64 < hrtimer_get_softexpires_tv64(timer))
+                       if (basenow < hrtimer_get_softexpires_tv64(timer))
                                break;
 
                        __run_hrtimer(cpu_base, base, timer, &basenow);
@@ -1318,7 +1318,7 @@ void hrtimer_interrupt(struct clock_event_device *dev)
 
        BUG_ON(!cpu_base->hres_active);
        cpu_base->nr_events++;
-       dev->next_event.tv64 = KTIME_MAX;
+       dev->next_event = KTIME_MAX;
 
        raw_spin_lock(&cpu_base->lock);
        entry_time = now = hrtimer_update_base(cpu_base);
@@ -1331,7 +1331,7 @@ retry:
         * timers which run their callback and need to be requeued on
         * this CPU.
         */
-       cpu_base->expires_next.tv64 = KTIME_MAX;
+       cpu_base->expires_next = KTIME_MAX;
 
        __hrtimer_run_queues(cpu_base, now);
 
@@ -1379,13 +1379,13 @@ retry:
        cpu_base->hang_detected = 1;
        raw_spin_unlock(&cpu_base->lock);
        delta = ktime_sub(now, entry_time);
-       if ((unsigned int)delta.tv64 > cpu_base->max_hang_time)
-               cpu_base->max_hang_time = (unsigned int) delta.tv64;
+       if ((unsigned int)delta > cpu_base->max_hang_time)
+               cpu_base->max_hang_time = (unsigned int) delta;
        /*
         * Limit it to a sensible value as we enforce a longer
         * delay. Give the CPU at least 100ms to catch up.
         */
-       if (delta.tv64 > 100 * NSEC_PER_MSEC)
+       if (delta > 100 * NSEC_PER_MSEC)
                expires_next = ktime_add_ns(now, 100 * NSEC_PER_MSEC);
        else
                expires_next = ktime_add(now, delta);
@@ -1495,7 +1495,7 @@ static int update_rmtp(struct hrtimer *timer, struct timespec __user *rmtp)
        ktime_t rem;
 
        rem = hrtimer_expires_remaining(timer);
-       if (rem.tv64 <= 0)
+       if (rem <= 0)
                return 0;
        rmt = ktime_to_timespec(rem);
 
@@ -1693,7 +1693,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta,
         * Optimize when a zero timeout value is given. It does not
         * matter whether this is an absolute or a relative time.
         */
-       if (expires && !expires->tv64) {
+       if (expires && *expires == 0) {
                __set_current_state(TASK_RUNNING);
                return 0;
        }
index 2b9f45bc955d1bf0963e1899647bcc2d53f8da03..8c89143f9ebf19fb96ac47b9c22be08fbafdc583 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/hrtimer.h>
 #include <trace/events/timer.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /**
  * itimer_get_remtime - get remaining time for the timer
@@ -34,10 +34,10 @@ static struct timeval itimer_get_remtime(struct hrtimer *timer)
         * then we return 0 - which is correct.
         */
        if (hrtimer_active(timer)) {
-               if (rem.tv64 <= 0)
-                       rem.tv64 = NSEC_PER_USEC;
+               if (rem <= 0)
+                       rem = NSEC_PER_USEC;
        } else
-               rem.tv64 = 0;
+               rem = 0;
 
        return ktime_to_timeval(rem);
 }
@@ -216,12 +216,12 @@ again:
                        goto again;
                }
                expires = timeval_to_ktime(value->it_value);
-               if (expires.tv64 != 0) {
+               if (expires != 0) {
                        tsk->signal->it_real_incr =
                                timeval_to_ktime(value->it_interval);
                        hrtimer_start(timer, expires, HRTIMER_MODE_REL);
                } else
-                       tsk->signal->it_real_incr.tv64 = 0;
+                       tsk->signal->it_real_incr = 0;
 
                trace_itimer_state(ITIMER_REAL, value, 0);
                spin_unlock_irq(&tsk->sighand->siglock);
index 555e21f7b966c789f48ee4aa5fece85cc7db6768..a4a0e478e44d16208d4333248995bbac610fc75b 100644 (file)
@@ -59,9 +59,9 @@
 #define JIFFIES_SHIFT  8
 #endif
 
-static cycle_t jiffies_read(struct clocksource *cs)
+static u64 jiffies_read(struct clocksource *cs)
 {
-       return (cycle_t) jiffies;
+       return (u64) jiffies;
 }
 
 static struct clocksource clocksource_jiffies = {
index 6df8927c58a5bbedcab9efceac7c21985bec0bf0..edf19cc5314043590b988c9b3081c82a9fa60f01 100644 (file)
@@ -381,7 +381,7 @@ ktime_t ntp_get_next_leap(void)
 
        if ((time_state == TIME_INS) && (time_status & STA_INS))
                return ktime_set(ntp_next_leap_sec, 0);
-       ret.tv64 = KTIME_MAX;
+       ret = KTIME_MAX;
        return ret;
 }
 
index f246763c99478cb11181cdb6f67ccf75ddd17d5e..e9e8c10f0d9abc351ce78025c3719a98b64c9e53 100644 (file)
@@ -6,7 +6,7 @@
 #include <linux/posix-timers.h>
 #include <linux/errno.h>
 #include <linux/math64.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/kernel_stat.h>
 #include <trace/events/timer.h>
 #include <linux/tick.h>
index f2826c35e9185f60586f06dff53f51ca3324c659..1e6623d7675019ae9c1dcc3dc273c03d761d5931 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/time.h>
 #include <linux/mutex.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/list.h>
 #include <linux/init.h>
 #include <linux/compiler.h>
@@ -359,7 +359,7 @@ static void schedule_next_timer(struct k_itimer *timr)
 {
        struct hrtimer *timer = &timr->it.real.timer;
 
-       if (timr->it.real.interval.tv64 == 0)
+       if (timr->it.real.interval == 0)
                return;
 
        timr->it_overrun += (unsigned int) hrtimer_forward(timer,
@@ -449,7 +449,7 @@ static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
        timr = container_of(timer, struct k_itimer, it.real.timer);
        spin_lock_irqsave(&timr->it_lock, flags);
 
-       if (timr->it.real.interval.tv64 != 0)
+       if (timr->it.real.interval != 0)
                si_private = ++timr->it_requeue_pending;
 
        if (posix_timer_event(timr, si_private)) {
@@ -458,7 +458,7 @@ static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
                 * we will not get a call back to restart it AND
                 * it should be restarted.
                 */
-               if (timr->it.real.interval.tv64 != 0) {
+               if (timr->it.real.interval != 0) {
                        ktime_t now = hrtimer_cb_get_time(timer);
 
                        /*
@@ -485,9 +485,9 @@ static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
                         */
 #ifdef CONFIG_HIGH_RES_TIMERS
                        {
-                               ktime_t kj = ktime_set(0, NSEC_PER_SEC / HZ);
+                               ktime_t kj = NSEC_PER_SEC / HZ;
 
-                               if (timr->it.real.interval.tv64 < kj.tv64)
+                               if (timr->it.real.interval < kj)
                                        now = ktime_add(now, kj);
                        }
 #endif
@@ -743,7 +743,7 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
        iv = timr->it.real.interval;
 
        /* interval timer ? */
-       if (iv.tv64)
+       if (iv)
                cur_setting->it_interval = ktime_to_timespec(iv);
        else if (!hrtimer_active(timer) &&
                 (timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE)
@@ -756,13 +756,13 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
         * timer move the expiry time forward by intervals, so
         * expiry is > now.
         */
-       if (iv.tv64 && (timr->it_requeue_pending & REQUEUE_PENDING ||
-           (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE))
+       if (iv && (timr->it_requeue_pending & REQUEUE_PENDING ||
+                  (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE))
                timr->it_overrun += (unsigned int) hrtimer_forward(timer, now, iv);
 
        remaining = __hrtimer_expires_remaining_adjusted(timer, now);
        /* Return 0 only, when the timer is expired and not pending */
-       if (remaining.tv64 <= 0) {
+       if (remaining <= 0) {
                /*
                 * A single shot SIGEV_NONE timer must return 0, when
                 * it is expired !
@@ -839,7 +839,7 @@ common_timer_set(struct k_itimer *timr, int flags,
                common_timer_get(timr, old_setting);
 
        /* disable the timer */
-       timr->it.real.interval.tv64 = 0;
+       timr->it.real.interval = 0;
        /*
         * careful here.  If smp we could be in the "fire" routine which will
         * be spinning as we hold the lock.  But this is ONLY an SMP issue.
@@ -924,7 +924,7 @@ retry:
 
 static int common_timer_del(struct k_itimer *timer)
 {
-       timer->it.real.interval.tv64 = 0;
+       timer->it.real.interval = 0;
 
        if (hrtimer_try_to_cancel(&timer->it.real.timer) < 0)
                return TIMER_RETRY;
index 690b797f522e38945ec021cfabe799568448cd7a..a7bb8f33ae0703b2d0ebd1e65954f433c85dbde2 100644 (file)
@@ -97,7 +97,7 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)
        ce_broadcast_hrtimer.event_handler(&ce_broadcast_hrtimer);
 
        if (clockevent_state_oneshot(&ce_broadcast_hrtimer))
-               if (ce_broadcast_hrtimer.next_event.tv64 != KTIME_MAX)
+               if (ce_broadcast_hrtimer.next_event != KTIME_MAX)
                        return HRTIMER_RESTART;
 
        return HRTIMER_NORESTART;
index d2a20e83ebaed372ddb68d00bd8f44a50989b804..3109204c87cca83704d10326f8b179671577f3d6 100644 (file)
@@ -604,14 +604,14 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
        bool bc_local;
 
        raw_spin_lock(&tick_broadcast_lock);
-       dev->next_event.tv64 = KTIME_MAX;
-       next_event.tv64 = KTIME_MAX;
+       dev->next_event = KTIME_MAX;
+       next_event = KTIME_MAX;
        cpumask_clear(tmpmask);
        now = ktime_get();
        /* Find all expired events */
        for_each_cpu(cpu, tick_broadcast_oneshot_mask) {
                td = &per_cpu(tick_cpu_device, cpu);
-               if (td->evtdev->next_event.tv64 <= now.tv64) {
+               if (td->evtdev->next_event <= now) {
                        cpumask_set_cpu(cpu, tmpmask);
                        /*
                         * Mark the remote cpu in the pending mask, so
@@ -619,8 +619,8 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
                         * timer in tick_broadcast_oneshot_control().
                         */
                        cpumask_set_cpu(cpu, tick_broadcast_pending_mask);
-               } else if (td->evtdev->next_event.tv64 < next_event.tv64) {
-                       next_event.tv64 = td->evtdev->next_event.tv64;
+               } else if (td->evtdev->next_event < next_event) {
+                       next_event = td->evtdev->next_event;
                        next_cpu = cpu;
                }
        }
@@ -657,7 +657,7 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
         * - There are pending events on sleeping CPUs which were not
         * in the event mask
         */
-       if (next_event.tv64 != KTIME_MAX)
+       if (next_event != KTIME_MAX)
                tick_broadcast_set_event(dev, next_cpu, next_event);
 
        raw_spin_unlock(&tick_broadcast_lock);
@@ -672,7 +672,7 @@ static int broadcast_needs_cpu(struct clock_event_device *bc, int cpu)
 {
        if (!(bc->features & CLOCK_EVT_FEAT_HRTIMER))
                return 0;
-       if (bc->next_event.tv64 == KTIME_MAX)
+       if (bc->next_event == KTIME_MAX)
                return 0;
        return bc->bound_on == cpu ? -EBUSY : 0;
 }
@@ -688,7 +688,7 @@ static void broadcast_shutdown_local(struct clock_event_device *bc,
        if (bc->features & CLOCK_EVT_FEAT_HRTIMER) {
                if (broadcast_needs_cpu(bc, smp_processor_id()))
                        return;
-               if (dev->next_event.tv64 < bc->next_event.tv64)
+               if (dev->next_event < bc->next_event)
                        return;
        }
        clockevents_switch_state(dev, CLOCK_EVT_STATE_SHUTDOWN);
@@ -754,7 +754,7 @@ int __tick_broadcast_oneshot_control(enum tick_broadcast_state state)
                         */
                        if (cpumask_test_cpu(cpu, tick_broadcast_force_mask)) {
                                ret = -EBUSY;
-                       } else if (dev->next_event.tv64 < bc->next_event.tv64) {
+                       } else if (dev->next_event < bc->next_event) {
                                tick_broadcast_set_event(bc, cpu, dev->next_event);
                                /*
                                 * In case of hrtimer broadcasts the
@@ -789,7 +789,7 @@ int __tick_broadcast_oneshot_control(enum tick_broadcast_state state)
                        /*
                         * Bail out if there is no next event.
                         */
-                       if (dev->next_event.tv64 == KTIME_MAX)
+                       if (dev->next_event == KTIME_MAX)
                                goto out;
                        /*
                         * If the pending bit is not set, then we are
@@ -824,7 +824,7 @@ int __tick_broadcast_oneshot_control(enum tick_broadcast_state state)
                         * nohz fixups.
                         */
                        now = ktime_get();
-                       if (dev->next_event.tv64 <= now.tv64) {
+                       if (dev->next_event <= now) {
                                cpumask_set_cpu(cpu, tick_broadcast_force_mask);
                                goto out;
                        }
@@ -897,7 +897,7 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
                                                       tick_next_period);
                        tick_broadcast_set_event(bc, cpu, tick_next_period);
                } else
-                       bc->next_event.tv64 = KTIME_MAX;
+                       bc->next_event = KTIME_MAX;
        } else {
                /*
                 * The first cpu which switches to oneshot mode sets
index 4fcd99e12aa01ce3ce0fa24fb219d644a68417a3..49edc1c4f3e645894f839c40489ab81594a02398 100644 (file)
@@ -178,8 +178,8 @@ static void tick_setup_device(struct tick_device *td,
                              struct clock_event_device *newdev, int cpu,
                              const struct cpumask *cpumask)
 {
-       ktime_t next_event;
        void (*handler)(struct clock_event_device *) = NULL;
+       ktime_t next_event = 0;
 
        /*
         * First device setup ?
@@ -195,7 +195,7 @@ static void tick_setup_device(struct tick_device *td,
                        else
                                tick_do_timer_cpu = TICK_DO_TIMER_NONE;
                        tick_next_period = ktime_get();
-                       tick_period = ktime_set(0, NSEC_PER_SEC / HZ);
+                       tick_period = NSEC_PER_SEC / HZ;
                }
 
                /*
index b51344652330a2b12ebb4e72875515a791a8270f..6b009c2076718f284b455ea2b6c084b208a57e53 100644 (file)
@@ -28,7 +28,7 @@ int tick_program_event(ktime_t expires, int force)
 {
        struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev);
 
-       if (unlikely(expires.tv64 == KTIME_MAX)) {
+       if (unlikely(expires == KTIME_MAX)) {
                /*
                 * We don't need the clock event device any more, stop it.
                 */
index 71496a20e67015d9cd3d57da393c97384c048bba..2c115fdab39765f4ecbeaade9fa74008e711d08a 100644 (file)
@@ -58,21 +58,21 @@ static void tick_do_update_jiffies64(ktime_t now)
         * Do a quick check without holding jiffies_lock:
         */
        delta = ktime_sub(now, last_jiffies_update);
-       if (delta.tv64 < tick_period.tv64)
+       if (delta < tick_period)
                return;
 
        /* Reevaluate with jiffies_lock held */
        write_seqlock(&jiffies_lock);
 
        delta = ktime_sub(now, last_jiffies_update);
-       if (delta.tv64 >= tick_period.tv64) {
+       if (delta >= tick_period) {
 
                delta = ktime_sub(delta, tick_period);
                last_jiffies_update = ktime_add(last_jiffies_update,
                                                tick_period);
 
                /* Slow path for long timeouts */
-               if (unlikely(delta.tv64 >= tick_period.tv64)) {
+               if (unlikely(delta >= tick_period)) {
                        s64 incr = ktime_to_ns(tick_period);
 
                        ticks = ktime_divns(delta, incr);
@@ -101,7 +101,7 @@ static ktime_t tick_init_jiffy_update(void)
 
        write_seqlock(&jiffies_lock);
        /* Did we start the jiffies update yet ? */
-       if (last_jiffies_update.tv64 == 0)
+       if (last_jiffies_update == 0)
                last_jiffies_update = tick_next_period;
        period = last_jiffies_update;
        write_sequnlock(&jiffies_lock);
@@ -669,7 +669,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
        /* Read jiffies and the time when jiffies were updated last */
        do {
                seq = read_seqbegin(&jiffies_lock);
-               basemono = last_jiffies_update.tv64;
+               basemono = last_jiffies_update;
                basejiff = jiffies;
        } while (read_seqretry(&jiffies_lock, seq));
        ts->last_jiffies = basejiff;
@@ -697,7 +697,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
         */
        delta = next_tick - basemono;
        if (delta <= (u64)TICK_NSEC) {
-               tick.tv64 = 0;
+               tick = 0;
 
                /*
                 * Tell the timer code that the base is not idle, i.e. undo
@@ -764,10 +764,10 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
                expires = KTIME_MAX;
 
        expires = min_t(u64, expires, next_tick);
-       tick.tv64 = expires;
+       tick = expires;
 
        /* Skip reprogram of event if its not changed */
-       if (ts->tick_stopped && (expires == dev->next_event.tv64))
+       if (ts->tick_stopped && (expires == dev->next_event))
                goto out;
 
        /*
@@ -864,7 +864,7 @@ static bool can_stop_idle_tick(int cpu, struct tick_sched *ts)
        }
 
        if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE)) {
-               ts->sleep_length = (ktime_t) { .tv64 = NSEC_PER_SEC/HZ };
+               ts->sleep_length = NSEC_PER_SEC / HZ;
                return false;
        }
 
@@ -914,7 +914,7 @@ static void __tick_nohz_idle_enter(struct tick_sched *ts)
                ts->idle_calls++;
 
                expires = tick_nohz_stop_sched_tick(ts, now, cpu);
-               if (expires.tv64 > 0LL) {
+               if (expires > 0LL) {
                        ts->idle_sleeps++;
                        ts->idle_expires = expires;
                }
@@ -1051,7 +1051,7 @@ static void tick_nohz_handler(struct clock_event_device *dev)
        struct pt_regs *regs = get_irq_regs();
        ktime_t now = ktime_get();
 
-       dev->next_event.tv64 = KTIME_MAX;
+       dev->next_event = KTIME_MAX;
 
        tick_sched_do_timer(now);
        tick_sched_handle(ts, regs);
index bd62fb8e8e77f691959859b8ffa1c2af4ab670dc..a3a9a8a029dc73bc0d1df540d7b2919071573bee 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/math64.h>
 #include <linux/ptrace.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 
 #include <generated/timeconst.h>
index 4687b3104baec19d578bf7d6aa3c06322dbea9f9..8afd78932bdf145d5609ed12494c72b924c351cd 100644 (file)
@@ -43,7 +43,7 @@ EXPORT_SYMBOL_GPL(timecounter_init);
  */
 static u64 timecounter_read_delta(struct timecounter *tc)
 {
-       cycle_t cycle_now, cycle_delta;
+       u64 cycle_now, cycle_delta;
        u64 ns_offset;
 
        /* read cycle counter: */
@@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(timecounter_read);
  * time previous to the time stored in the cycle counter.
  */
 static u64 cc_cyc2ns_backwards(const struct cyclecounter *cc,
-                              cycle_t cycles, u64 mask, u64 frac)
+                              u64 cycles, u64 mask, u64 frac)
 {
        u64 ns = (u64) cycles;
 
@@ -90,7 +90,7 @@ static u64 cc_cyc2ns_backwards(const struct cyclecounter *cc,
 }
 
 u64 timecounter_cyc2time(struct timecounter *tc,
-                        cycle_t cycle_tstamp)
+                        u64 cycle_tstamp)
 {
        u64 delta = (cycle_tstamp - tc->cycle_last) & tc->cc->mask;
        u64 nsec = tc->nsec, frac = tc->frac;
index da233cdf89b0447efe2bce0a4a53ce87f87acb8c..db087d7e106d25f8c542f3252443d260d5618169 100644 (file)
@@ -104,7 +104,7 @@ static void tk_set_wall_to_mono(struct timekeeper *tk, struct timespec64 wtm)
         */
        set_normalized_timespec64(&tmp, -tk->wall_to_monotonic.tv_sec,
                                        -tk->wall_to_monotonic.tv_nsec);
-       WARN_ON_ONCE(tk->offs_real.tv64 != timespec64_to_ktime(tmp).tv64);
+       WARN_ON_ONCE(tk->offs_real != timespec64_to_ktime(tmp));
        tk->wall_to_monotonic = wtm;
        set_normalized_timespec64(&tmp, -wtm.tv_sec, -wtm.tv_nsec);
        tk->offs_real = timespec64_to_ktime(tmp);
@@ -119,10 +119,10 @@ static inline void tk_update_sleep_time(struct timekeeper *tk, ktime_t delta)
 #ifdef CONFIG_DEBUG_TIMEKEEPING
 #define WARNING_FREQ (HZ*300) /* 5 minute rate-limiting */
 
-static void timekeeping_check_update(struct timekeeper *tk, cycle_t offset)
+static void timekeeping_check_update(struct timekeeper *tk, u64 offset)
 {
 
-       cycle_t max_cycles = tk->tkr_mono.clock->max_cycles;
+       u64 max_cycles = tk->tkr_mono.clock->max_cycles;
        const char *name = tk->tkr_mono.clock->name;
 
        if (offset > max_cycles) {
@@ -158,10 +158,10 @@ static void timekeeping_check_update(struct timekeeper *tk, cycle_t offset)
        }
 }
 
-static inline cycle_t timekeeping_get_delta(struct tk_read_base *tkr)
+static inline u64 timekeeping_get_delta(struct tk_read_base *tkr)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
-       cycle_t now, last, mask, max, delta;
+       u64 now, last, mask, max, delta;
        unsigned int seq;
 
        /*
@@ -199,12 +199,12 @@ static inline cycle_t timekeeping_get_delta(struct tk_read_base *tkr)
        return delta;
 }
 #else
-static inline void timekeeping_check_update(struct timekeeper *tk, cycle_t offset)
+static inline void timekeeping_check_update(struct timekeeper *tk, u64 offset)
 {
 }
-static inline cycle_t timekeeping_get_delta(struct tk_read_base *tkr)
+static inline u64 timekeeping_get_delta(struct tk_read_base *tkr)
 {
-       cycle_t cycle_now, delta;
+       u64 cycle_now, delta;
 
        /* read clocksource */
        cycle_now = tkr->read(tkr->clock);
@@ -229,7 +229,7 @@ static inline cycle_t timekeeping_get_delta(struct tk_read_base *tkr)
  */
 static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
 {
-       cycle_t interval;
+       u64 interval;
        u64 tmp, ntpinterval;
        struct clocksource *old_clock;
 
@@ -254,7 +254,7 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
        if (tmp == 0)
                tmp = 1;
 
-       interval = (cycle_t) tmp;
+       interval = (u64) tmp;
        tk->cycle_interval = interval;
 
        /* Go back from cycles -> shifted ns */
@@ -298,8 +298,7 @@ u32 (*arch_gettimeoffset)(void) = default_arch_gettimeoffset;
 static inline u32 arch_gettimeoffset(void) { return 0; }
 #endif
 
-static inline u64 timekeeping_delta_to_ns(struct tk_read_base *tkr,
-                                         cycle_t delta)
+static inline u64 timekeeping_delta_to_ns(struct tk_read_base *tkr, u64 delta)
 {
        u64 nsec;
 
@@ -312,16 +311,15 @@ static inline u64 timekeeping_delta_to_ns(struct tk_read_base *tkr,
 
 static inline u64 timekeeping_get_ns(struct tk_read_base *tkr)
 {
-       cycle_t delta;
+       u64 delta;
 
        delta = timekeeping_get_delta(tkr);
        return timekeeping_delta_to_ns(tkr, delta);
 }
 
-static inline u64 timekeeping_cycles_to_ns(struct tk_read_base *tkr,
-                                          cycle_t cycles)
+static inline u64 timekeeping_cycles_to_ns(struct tk_read_base *tkr, u64 cycles)
 {
-       cycle_t delta;
+       u64 delta;
 
        /* calculate the delta since the last update_wall_time */
        delta = clocksource_delta(cycles, tkr->cycle_last, tkr->mask);
@@ -454,9 +452,9 @@ u64 notrace ktime_get_boot_fast_ns(void)
 EXPORT_SYMBOL_GPL(ktime_get_boot_fast_ns);
 
 /* Suspend-time cycles value for halted fast timekeeper. */
-static cycle_t cycles_at_suspend;
+static u64 cycles_at_suspend;
 
-static cycle_t dummy_clock_read(struct clocksource *cs)
+static u64 dummy_clock_read(struct clocksource *cs)
 {
        return cycles_at_suspend;
 }
@@ -573,7 +571,7 @@ EXPORT_SYMBOL_GPL(pvclock_gtod_unregister_notifier);
 static inline void tk_update_leap_state(struct timekeeper *tk)
 {
        tk->next_leap_ktime = ntp_get_next_leap();
-       if (tk->next_leap_ktime.tv64 != KTIME_MAX)
+       if (tk->next_leap_ktime != KTIME_MAX)
                /* Convert to monotonic time */
                tk->next_leap_ktime = ktime_sub(tk->next_leap_ktime, tk->offs_real);
 }
@@ -650,7 +648,7 @@ static void timekeeping_update(struct timekeeper *tk, unsigned int action)
 static void timekeeping_forward_now(struct timekeeper *tk)
 {
        struct clocksource *clock = tk->tkr_mono.clock;
-       cycle_t cycle_now, delta;
+       u64 cycle_now, delta;
        u64 nsec;
 
        cycle_now = tk->tkr_mono.read(clock);
@@ -923,7 +921,7 @@ void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot)
        ktime_t base_real;
        u64 nsec_raw;
        u64 nsec_real;
-       cycle_t now;
+       u64 now;
 
        WARN_ON_ONCE(timekeeping_suspended);
 
@@ -982,8 +980,8 @@ static int scale64_check_overflow(u64 mult, u64 div, u64 *base)
  * interval is partial_history_cycles.
  */
 static int adjust_historical_crosststamp(struct system_time_snapshot *history,
-                                        cycle_t partial_history_cycles,
-                                        cycle_t total_history_cycles,
+                                        u64 partial_history_cycles,
+                                        u64 total_history_cycles,
                                         bool discontinuity,
                                         struct system_device_crosststamp *ts)
 {
@@ -1047,7 +1045,7 @@ static int adjust_historical_crosststamp(struct system_time_snapshot *history,
 /*
  * cycle_between - true if test occurs chronologically between before and after
  */
-static bool cycle_between(cycle_t before, cycle_t test, cycle_t after)
+static bool cycle_between(u64 before, u64 test, u64 after)
 {
        if (test > before && test < after)
                return true;
@@ -1077,7 +1075,7 @@ int get_device_system_crosststamp(int (*get_time_fn)
 {
        struct system_counterval_t system_counterval;
        struct timekeeper *tk = &tk_core.timekeeper;
-       cycle_t cycles, now, interval_start;
+       u64 cycles, now, interval_start;
        unsigned int clock_was_set_seq = 0;
        ktime_t base_real, base_raw;
        u64 nsec_real, nsec_raw;
@@ -1138,7 +1136,7 @@ int get_device_system_crosststamp(int (*get_time_fn)
         * current interval
         */
        if (do_interp) {
-               cycle_t partial_history_cycles, total_history_cycles;
+               u64 partial_history_cycles, total_history_cycles;
                bool discontinuity;
 
                /*
@@ -1644,7 +1642,7 @@ void timekeeping_resume(void)
        struct clocksource *clock = tk->tkr_mono.clock;
        unsigned long flags;
        struct timespec64 ts_new, ts_delta;
-       cycle_t cycle_now;
+       u64 cycle_now;
 
        sleeptime_injected = false;
        read_persistent_clock64(&ts_new);
@@ -2010,11 +2008,10 @@ static inline unsigned int accumulate_nsecs_to_secs(struct timekeeper *tk)
  *
  * Returns the unconsumed cycles.
  */
-static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t offset,
-                                               u32 shift,
-                                               unsigned int *clock_set)
+static u64 logarithmic_accumulation(struct timekeeper *tk, u64 offset,
+                                   u32 shift, unsigned int *clock_set)
 {
-       cycle_t interval = tk->cycle_interval << shift;
+       u64 interval = tk->cycle_interval << shift;
        u64 raw_nsecs;
 
        /* If the offset is smaller than a shifted interval, do nothing */
@@ -2055,7 +2052,7 @@ void update_wall_time(void)
 {
        struct timekeeper *real_tk = &tk_core.timekeeper;
        struct timekeeper *tk = &shadow_timekeeper;
-       cycle_t offset;
+       u64 offset;
        int shift = 0, maxshift;
        unsigned int clock_set = 0;
        unsigned long flags;
@@ -2253,7 +2250,7 @@ ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real,
                }
 
                /* Handle leapsecond insertion adjustments */
-               if (unlikely(base.tv64 >= tk->next_leap_ktime.tv64))
+               if (unlikely(base >= tk->next_leap_ktime))
                        *offs_real = ktime_sub(tk->offs_real, ktime_set(1, 0));
 
        } while (read_seqcount_retry(&tk_core.seq, seq));
index 5be76270ec4a8f155574aabe2812f9edefb80aec..9a18f121f3990b3a635c350506ada940e0c7f922 100644 (file)
@@ -13,9 +13,9 @@ extern void tk_debug_account_sleep_time(struct timespec64 *t);
 #endif
 
 #ifdef CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE
-static inline cycle_t clocksource_delta(cycle_t now, cycle_t last, cycle_t mask)
+static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
 {
-       cycle_t ret = (now - last) & mask;
+       u64 ret = (now - last) & mask;
 
        /*
         * Prevent time going backwards by checking the MSB of mask in
@@ -24,7 +24,7 @@ static inline cycle_t clocksource_delta(cycle_t now, cycle_t last, cycle_t mask)
        return ret & ~(mask >> 1) ? 0 : ret;
 }
 #else
-static inline cycle_t clocksource_delta(cycle_t now, cycle_t last, cycle_t mask)
+static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
 {
        return (now - last) & mask;
 }
index ea4fbf8477a9903015ebbc9b83fed0d0c8892804..ec33a6933eaed5938b95e381c2eeabb8d02dd195 100644 (file)
@@ -43,7 +43,7 @@
 #include <linux/slab.h>
 #include <linux/compat.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/div64.h>
 #include <asm/timex.h>
index ba7d8b288bb37250ce9e9c0e5f562b45832c4ca9..afe6cd1944fc5df3e4755f961719889bf0d72532 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/seq_file.h>
 #include <linux/kallsyms.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "tick-internal.h"
 
index 087204c733ebb39c881c2b58b6937ad4ffe3d756..afddded947dfe4123e13ed8ea8d8d216218859e7 100644 (file)
@@ -43,7 +43,7 @@
 #include <linux/seq_file.h>
 #include <linux/kallsyms.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * This is our basic unit of interest: a timer expiry event identified
index 1f0f547c54da2fee935a89316e6e2e74df7e6f34..eb230f06ba4123a1dc75dafb508789f6cd7afd25 100644 (file)
@@ -2847,7 +2847,7 @@ static void ftrace_shutdown_sysctl(void)
        }
 }
 
-static cycle_t         ftrace_update_time;
+static u64             ftrace_update_time;
 unsigned long          ftrace_update_tot_cnt;
 
 static inline int ops_traces_mod(struct ftrace_ops *ops)
@@ -2894,7 +2894,7 @@ static int ftrace_update_code(struct module *mod, struct ftrace_page *new_pgs)
 {
        struct ftrace_page *pg;
        struct dyn_ftrace *p;
-       cycle_t start, stop;
+       u64 start, stop;
        unsigned long update_cnt = 0;
        unsigned long rec_flags = 0;
        int i;
index 66f829c47bec77c0dbfc1b9d45c92f303e21e5b3..d7449783987a2bee7dea147e02530f36ff23dfba 100644 (file)
@@ -236,7 +236,7 @@ static int __init set_tracepoint_printk(char *str)
 }
 __setup("tp_printk", set_tracepoint_printk);
 
-unsigned long long ns2usecs(cycle_t nsec)
+unsigned long long ns2usecs(u64 nsec)
 {
        nsec += 500;
        do_div(nsec, 1000);
@@ -573,7 +573,7 @@ int trace_pid_write(struct trace_pid_list *filtered_pids,
        return read;
 }
 
-static cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu)
+static u64 buffer_ftrace_now(struct trace_buffer *buf, int cpu)
 {
        u64 ts;
 
@@ -587,7 +587,7 @@ static cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu)
        return ts;
 }
 
-cycle_t ftrace_now(int cpu)
+u64 ftrace_now(int cpu)
 {
        return buffer_ftrace_now(&global_trace.trace_buffer, cpu);
 }
index c2234494f40c1c95e83414d1d50417cb5db2a416..1ea51ab53edf372924692e78c692f52302280bc1 100644 (file)
@@ -159,7 +159,7 @@ struct trace_array_cpu {
        unsigned long           policy;
        unsigned long           rt_priority;
        unsigned long           skipped_entries;
-       cycle_t                 preempt_timestamp;
+       u64                     preempt_timestamp;
        pid_t                   pid;
        kuid_t                  uid;
        char                    comm[TASK_COMM_LEN];
@@ -177,7 +177,7 @@ struct trace_buffer {
        struct trace_array              *tr;
        struct ring_buffer              *buffer;
        struct trace_array_cpu __percpu *data;
-       cycle_t                         time_start;
+       u64                             time_start;
        int                             cpu;
 };
 
@@ -689,7 +689,7 @@ static inline void __trace_stack(struct trace_array *tr, unsigned long flags,
 }
 #endif /* CONFIG_STACKTRACE */
 
-extern cycle_t ftrace_now(int cpu);
+extern u64 ftrace_now(int cpu);
 
 extern void trace_find_cmdline(int pid, char comm[]);
 extern void trace_event_follow_fork(struct trace_array *tr, bool enable);
@@ -736,7 +736,7 @@ extern int trace_selftest_startup_branch(struct tracer *trace,
 #endif /* CONFIG_FTRACE_STARTUP_TEST */
 
 extern void *head_page(struct trace_array_cpu *data);
-extern unsigned long long ns2usecs(cycle_t nsec);
+extern unsigned long long ns2usecs(u64 nsec);
 extern int
 trace_vbprintk(unsigned long ip, const char *fmt, va_list args);
 extern int
index 86654d7e1afe26737cf68f2bfdd80f50cc73f9fd..7758bc0617cb15d8731defbc67912b5eb46246c2 100644 (file)
@@ -298,7 +298,7 @@ static void irqsoff_print_header(struct seq_file *s)
 /*
  * Should this new latency be reported/recorded?
  */
-static bool report_latency(struct trace_array *tr, cycle_t delta)
+static bool report_latency(struct trace_array *tr, u64 delta)
 {
        if (tracing_thresh) {
                if (delta < tracing_thresh)
@@ -316,7 +316,7 @@ check_critical_timing(struct trace_array *tr,
                      unsigned long parent_ip,
                      int cpu)
 {
-       cycle_t T0, T1, delta;
+       u64 T0, T1, delta;
        unsigned long flags;
        int pc;
 
index 5d0bb025bb21313dd15546f714a9fa4b1e3bc4e0..ddec53b6764617e8fe431d93bf9f970a5015b4be 100644 (file)
@@ -358,7 +358,7 @@ static void wakeup_print_header(struct seq_file *s)
 /*
  * Should this new latency be reported/recorded?
  */
-static bool report_latency(struct trace_array *tr, cycle_t delta)
+static bool report_latency(struct trace_array *tr, u64 delta)
 {
        if (tracing_thresh) {
                if (delta < tracing_thresh)
@@ -440,7 +440,7 @@ probe_wakeup_sched_switch(void *ignore, bool preempt,
                          struct task_struct *prev, struct task_struct *next)
 {
        struct trace_array_cpu *data;
-       cycle_t T0, T1, delta;
+       u64 T0, T1, delta;
        unsigned long flags;
        long disabled;
        int cpu;
index cc40793464e3ca1959c9960a3cdbc3180d4c468b..71645ae9303a522c04c0eb307eb2dfa8c2fa0f4f 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group)
 {
index cb66a46488401b6a99091b489df029c3035a79dd..b06848a104e6940e128e63a5d3c8c7fb39ffaf8b 100644 (file)
@@ -1538,30 +1538,6 @@ config NOTIFIER_ERROR_INJECTION
 
          Say N if unsure.
 
-config CPU_NOTIFIER_ERROR_INJECT
-       tristate "CPU notifier error injection module"
-       depends on HOTPLUG_CPU && NOTIFIER_ERROR_INJECTION
-       help
-         This option provides a kernel module that can be used to test
-         the error handling of the cpu notifiers by injecting artificial
-         errors to CPU notifier chain callbacks.  It is controlled through
-         debugfs interface under /sys/kernel/debug/notifier-error-inject/cpu
-
-         If the notifier call chain should be failed with some events
-         notified, write the error code to "actions/<notifier event>/error".
-
-         Example: Inject CPU offline error (-1 == -EPERM)
-
-         # cd /sys/kernel/debug/notifier-error-inject/cpu
-         # echo -1 > actions/CPU_DOWN_PREPARE/error
-         # echo 0 > /sys/devices/system/cpu/cpu1/online
-         bash: echo: write error: Operation not permitted
-
-         To compile this code as a module, choose M here: the module will
-         be called cpu-notifier-error-inject.
-
-         If unsure, say N.
-
 config PM_NOTIFIER_ERROR_INJECT
        tristate "PM notifier error injection module"
        depends on PM && NOTIFIER_ERROR_INJECTION
index 50144a3aeebdb8dfcadca9ec735a1b9012fc518d..bc4073a8cd08da8377053c54a09e61f753a3fc7b 100644 (file)
@@ -128,7 +128,6 @@ obj-$(CONFIG_SWIOTLB) += swiotlb.o
 obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o iommu-common.o
 obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o
 obj-$(CONFIG_NOTIFIER_ERROR_INJECTION) += notifier-error-inject.o
-obj-$(CONFIG_CPU_NOTIFIER_ERROR_INJECT) += cpu-notifier-error-inject.o
 obj-$(CONFIG_PM_NOTIFIER_ERROR_INJECT) += pm-notifier-error-inject.o
 obj-$(CONFIG_NETDEV_NOTIFIER_ERROR_INJECT) += netdev-notifier-error-inject.o
 obj-$(CONFIG_MEMORY_NOTIFIER_ERROR_INJECT) += memory-notifier-error-inject.o
diff --git a/lib/cpu-notifier-error-inject.c b/lib/cpu-notifier-error-inject.c
deleted file mode 100644 (file)
index 0e2c9a1..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/cpu.h>
-
-#include "notifier-error-inject.h"
-
-static int priority;
-module_param(priority, int, 0);
-MODULE_PARM_DESC(priority, "specify cpu notifier priority");
-
-#define UP_PREPARE 0
-#define UP_PREPARE_FROZEN 0
-#define DOWN_PREPARE 0
-#define DOWN_PREPARE_FROZEN 0
-
-static struct notifier_err_inject cpu_notifier_err_inject = {
-       .actions = {
-               { NOTIFIER_ERR_INJECT_ACTION(UP_PREPARE) },
-               { NOTIFIER_ERR_INJECT_ACTION(UP_PREPARE_FROZEN) },
-               { NOTIFIER_ERR_INJECT_ACTION(DOWN_PREPARE) },
-               { NOTIFIER_ERR_INJECT_ACTION(DOWN_PREPARE_FROZEN) },
-               {}
-       }
-};
-
-static int notf_err_handle(struct notifier_err_inject_action *action)
-{
-       int ret;
-
-       ret = action->error;
-       if (ret)
-               pr_info("Injecting error (%d) to %s\n", ret, action->name);
-       return ret;
-}
-
-static int notf_err_inj_up_prepare(unsigned int cpu)
-{
-       if (!cpuhp_tasks_frozen)
-               return notf_err_handle(&cpu_notifier_err_inject.actions[0]);
-       else
-               return notf_err_handle(&cpu_notifier_err_inject.actions[1]);
-}
-
-static int notf_err_inj_dead(unsigned int cpu)
-{
-       if (!cpuhp_tasks_frozen)
-               return notf_err_handle(&cpu_notifier_err_inject.actions[2]);
-       else
-               return notf_err_handle(&cpu_notifier_err_inject.actions[3]);
-}
-
-static struct dentry *dir;
-
-static int err_inject_init(void)
-{
-       int err;
-
-       dir = notifier_err_inject_init("cpu", notifier_err_inject_dir,
-                                       &cpu_notifier_err_inject, priority);
-       if (IS_ERR(dir))
-               return PTR_ERR(dir);
-
-       err = cpuhp_setup_state_nocalls(CPUHP_NOTF_ERR_INJ_PREPARE,
-                                       "cpu-err-notif:prepare",
-                                       notf_err_inj_up_prepare,
-                                       notf_err_inj_dead);
-       if (err)
-               debugfs_remove_recursive(dir);
-
-       return err;
-}
-
-static void err_inject_exit(void)
-{
-       cpuhp_remove_state_nocalls(CPUHP_NOTF_ERR_INJ_PREPARE);
-       debugfs_remove_recursive(dir);
-}
-
-module_init(err_inject_init);
-module_exit(err_inject_exit);
-
-MODULE_DESCRIPTION("CPU notifier error injection module");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Akinobu Mita <akinobu.mita@gmail.com>");
index 0be02ad561e9e346c01a65434873f9960472047a..62968daa66a94b357b7e4df651aa12fd611c4ae1 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/sort.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifndef ARCH_HAS_RELATIVE_EXTABLE
 #define ex_to_insn(x)  ((x)->insn)
index 228892dabba6f5579478988b84ef007fa04bd661..25f57230380104f419257ea43c1cd3d2e31d7e65 100644 (file)
 }
 
 #define iterate_all_kinds(i, n, v, I, B, K) {                  \
-       size_t skip = i->iov_offset;                            \
-       if (unlikely(i->type & ITER_BVEC)) {                    \
-               struct bio_vec v;                               \
-               struct bvec_iter __bi;                          \
-               iterate_bvec(i, n, v, __bi, skip, (B))          \
-       } else if (unlikely(i->type & ITER_KVEC)) {             \
-               const struct kvec *kvec;                        \
-               struct kvec v;                                  \
-               iterate_kvec(i, n, v, kvec, skip, (K))          \
-       } else {                                                \
-               const struct iovec *iov;                        \
-               struct iovec v;                                 \
-               iterate_iovec(i, n, v, iov, skip, (I))          \
+       if (likely(n)) {                                        \
+               size_t skip = i->iov_offset;                    \
+               if (unlikely(i->type & ITER_BVEC)) {            \
+                       struct bio_vec v;                       \
+                       struct bvec_iter __bi;                  \
+                       iterate_bvec(i, n, v, __bi, skip, (B))  \
+               } else if (unlikely(i->type & ITER_KVEC)) {     \
+                       const struct kvec *kvec;                \
+                       struct kvec v;                          \
+                       iterate_kvec(i, n, v, kvec, skip, (K))  \
+               } else {                                        \
+                       const struct iovec *iov;                \
+                       struct iovec v;                         \
+                       iterate_iovec(i, n, v, iov, skip, (I))  \
+               }                                               \
        }                                                       \
 }
 
@@ -576,7 +578,7 @@ bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i)
                WARN_ON(1);
                return false;
        }
-       if (unlikely(i->count < bytes))                         \
+       if (unlikely(i->count < bytes))
                return false;
 
        iterate_all_kinds(i, bytes, v, ({
@@ -620,7 +622,7 @@ bool copy_from_iter_full_nocache(void *addr, size_t bytes, struct iov_iter *i)
                WARN_ON(1);
                return false;
        }
-       if (unlikely(i->count < bytes))                         \
+       if (unlikely(i->count < bytes))
                return false;
        iterate_all_kinds(i, bytes, v, ({
                if (__copy_from_user_nocache((to += v.iov_len) - v.iov_len,
@@ -837,11 +839,8 @@ unsigned long iov_iter_alignment(const struct iov_iter *i)
        unsigned long res = 0;
        size_t size = i->count;
 
-       if (!size)
-               return 0;
-
        if (unlikely(i->type & ITER_PIPE)) {
-               if (i->iov_offset && allocated(&i->pipe->bufs[i->idx]))
+               if (size && i->iov_offset && allocated(&i->pipe->bufs[i->idx]))
                        return size | i->iov_offset;
                return size;
        }
@@ -856,10 +855,8 @@ EXPORT_SYMBOL(iov_iter_alignment);
 
 unsigned long iov_iter_gap_alignment(const struct iov_iter *i)
 {
-        unsigned long res = 0;
+       unsigned long res = 0;
        size_t size = i->count;
-       if (!size)
-               return 0;
 
        if (unlikely(i->type & ITER_PIPE)) {
                WARN_ON(1);
@@ -874,7 +871,7 @@ unsigned long iov_iter_gap_alignment(const struct iov_iter *i)
                (res |= (!res ? 0 : (unsigned long)v.iov_base) |
                        (size != v.iov_len ? size : 0))
                );
-               return res;
+       return res;
 }
 EXPORT_SYMBOL(iov_iter_gap_alignment);
 
@@ -908,6 +905,9 @@ static ssize_t pipe_get_pages(struct iov_iter *i,
        size_t capacity;
        int idx;
 
+       if (!maxsize)
+               return 0;
+
        if (!sanity(i))
                return -EFAULT;
 
@@ -926,9 +926,6 @@ ssize_t iov_iter_get_pages(struct iov_iter *i,
        if (maxsize > i->count)
                maxsize = i->count;
 
-       if (!maxsize)
-               return 0;
-
        if (unlikely(i->type & ITER_PIPE))
                return pipe_get_pages(i, pages, maxsize, maxpages, start);
        iterate_all_kinds(i, maxsize, v, ({
@@ -975,6 +972,9 @@ static ssize_t pipe_get_pages_alloc(struct iov_iter *i,
        int idx;
        int npages;
 
+       if (!maxsize)
+               return 0;
+
        if (!sanity(i))
                return -EFAULT;
 
@@ -1006,9 +1006,6 @@ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i,
        if (maxsize > i->count)
                maxsize = i->count;
 
-       if (!maxsize)
-               return 0;
-
        if (unlikely(i->type & ITER_PIPE))
                return pipe_get_pages_alloc(i, pages, maxsize, start);
        iterate_all_kinds(i, maxsize, v, ({
index b8e2080c1a47a24a14c9618cd0dac5e4da0c0c67..bf85e05ce85815a0fb36ab26f9e5642dd455ae1a 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/math64.h>
 #include <linux/export.h>
 #include <linux/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "kstrtox.h"
 
 const char *_parse_integer_fixup_radix(const char *s, unsigned int *base)
index 6f382e07de77e2f543389c57e52f48a1f5d026ad..0b92d605fb69cc805a96c8333dab36174f755e22 100644 (file)
@@ -640,6 +640,7 @@ static inline void radix_tree_shrink(struct radix_tree_root *root,
                                update_node(node, private);
                }
 
+               WARN_ON_ONCE(!list_empty(&node->private_list));
                radix_tree_node_free(node);
        }
 }
@@ -666,6 +667,7 @@ static void delete_node(struct radix_tree_root *root,
                        root->rnode = NULL;
                }
 
+               WARN_ON_ONCE(!list_empty(&node->private_list));
                radix_tree_node_free(node);
 
                node = parent;
@@ -767,6 +769,7 @@ static void radix_tree_free_nodes(struct radix_tree_node *node)
                        struct radix_tree_node *old = child;
                        offset = child->offset + 1;
                        child = child->parent;
+                       WARN_ON_ONCE(!list_empty(&node->private_list));
                        radix_tree_node_free(old);
                        if (old == entry_to_node(node))
                                return;
@@ -1824,15 +1827,19 @@ EXPORT_SYMBOL(radix_tree_gang_lookup_tag_slot);
  *     __radix_tree_delete_node    -    try to free node after clearing a slot
  *     @root:          radix tree root
  *     @node:          node containing @index
+ *     @update_node:   callback for changing leaf nodes
+ *     @private:       private data to pass to @update_node
  *
  *     After clearing the slot at @index in @node from radix tree
  *     rooted at @root, call this function to attempt freeing the
  *     node and shrinking the tree.
  */
 void __radix_tree_delete_node(struct radix_tree_root *root,
-                             struct radix_tree_node *node)
+                             struct radix_tree_node *node,
+                             radix_tree_update_node_t update_node,
+                             void *private)
 {
-       delete_node(root, node, NULL, NULL);
+       delete_node(root, node, update_node, private);
 }
 
 /**
index cb1b54ee8527241de289ab66f34f9a0a1efa761f..975b8fc4f1e1143dcdd295731cf1fc18cf0561fe 100644 (file)
@@ -53,7 +53,7 @@
  */
 #define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT)
 
-int swiotlb_force;
+enum swiotlb_force swiotlb_force;
 
 /*
  * Used to do a quick range check in swiotlb_tbl_unmap_single and
@@ -82,6 +82,12 @@ static phys_addr_t io_tlb_overflow_buffer;
 static unsigned int *io_tlb_list;
 static unsigned int io_tlb_index;
 
+/*
+ * Max segment that we can provide which (if pages are contingous) will
+ * not be bounced (unless SWIOTLB_FORCE is set).
+ */
+unsigned int max_segment;
+
 /*
  * We need to save away the original address corresponding to a mapped entry
  * for the sync operations.
@@ -106,8 +112,12 @@ setup_io_tlb_npages(char *str)
        }
        if (*str == ',')
                ++str;
-       if (!strcmp(str, "force"))
-               swiotlb_force = 1;
+       if (!strcmp(str, "force")) {
+               swiotlb_force = SWIOTLB_FORCE;
+       } else if (!strcmp(str, "noforce")) {
+               swiotlb_force = SWIOTLB_NO_FORCE;
+               io_tlb_nslabs = 1;
+       }
 
        return 0;
 }
@@ -120,6 +130,20 @@ unsigned long swiotlb_nr_tbl(void)
 }
 EXPORT_SYMBOL_GPL(swiotlb_nr_tbl);
 
+unsigned int swiotlb_max_segment(void)
+{
+       return max_segment;
+}
+EXPORT_SYMBOL_GPL(swiotlb_max_segment);
+
+void swiotlb_set_max_segment(unsigned int val)
+{
+       if (swiotlb_force == SWIOTLB_FORCE)
+               max_segment = 1;
+       else
+               max_segment = rounddown(val, PAGE_SIZE);
+}
+
 /* default to 64MB */
 #define IO_TLB_DEFAULT_SIZE (64UL<<20)
 unsigned long swiotlb_size_or_default(void)
@@ -201,6 +225,7 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
        if (verbose)
                swiotlb_print_info();
 
+       swiotlb_set_max_segment(io_tlb_nslabs << IO_TLB_SHIFT);
        return 0;
 }
 
@@ -279,6 +304,7 @@ swiotlb_late_init_with_default_size(size_t default_size)
        rc = swiotlb_late_init_with_tbl(vstart, io_tlb_nslabs);
        if (rc)
                free_pages((unsigned long)vstart, order);
+
        return rc;
 }
 
@@ -333,6 +359,8 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs)
 
        late_alloc = 1;
 
+       swiotlb_set_max_segment(io_tlb_nslabs << IO_TLB_SHIFT);
+
        return 0;
 
 cleanup4:
@@ -347,6 +375,7 @@ cleanup2:
        io_tlb_end = 0;
        io_tlb_start = 0;
        io_tlb_nslabs = 0;
+       max_segment = 0;
        return -ENOMEM;
 }
 
@@ -375,6 +404,7 @@ void __init swiotlb_free(void)
                                   PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
        }
        io_tlb_nslabs = 0;
+       max_segment = 0;
 }
 
 int is_swiotlb_buffer(phys_addr_t paddr)
@@ -543,8 +573,15 @@ static phys_addr_t
 map_single(struct device *hwdev, phys_addr_t phys, size_t size,
           enum dma_data_direction dir, unsigned long attrs)
 {
-       dma_addr_t start_dma_addr = phys_to_dma(hwdev, io_tlb_start);
+       dma_addr_t start_dma_addr;
 
+       if (swiotlb_force == SWIOTLB_NO_FORCE) {
+               dev_warn_ratelimited(hwdev, "Cannot do DMA to address %pa\n",
+                                    &phys);
+               return SWIOTLB_MAP_ERROR;
+       }
+
+       start_dma_addr = phys_to_dma(hwdev, io_tlb_start);
        return swiotlb_tbl_map_single(hwdev, start_dma_addr, phys, size,
                                      dir, attrs);
 }
@@ -721,6 +758,9 @@ static void
 swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,
             int do_panic)
 {
+       if (swiotlb_force == SWIOTLB_NO_FORCE)
+               return;
+
        /*
         * Ran out of IOMMU space for this operation. This is very bad.
         * Unfortunately the drivers cannot handle this operation properly.
@@ -763,7 +803,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
         * we can safely return the device addr and not worry about bounce
         * buffering it.
         */
-       if (dma_capable(dev, dev_addr, size) && !swiotlb_force)
+       if (dma_capable(dev, dev_addr, size) && swiotlb_force != SWIOTLB_FORCE)
                return dev_addr;
 
        trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
@@ -904,7 +944,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
                phys_addr_t paddr = sg_phys(sg);
                dma_addr_t dev_addr = phys_to_dma(hwdev, paddr);
 
-               if (swiotlb_force ||
+               if (swiotlb_force == SWIOTLB_FORCE ||
                    !dma_capable(hwdev, dev_addr, sg->length)) {
                        phys_addr_t map = map_single(hwdev, sg_phys(sg),
                                                     sg->length, dir, attrs);
index 782ae8ca2c06f2b3439b10592cef6a43c31223cd..adc6ee0a51267ab6691c6244cddbd5da69c059f9 100644 (file)
@@ -48,7 +48,7 @@ bool timerqueue_add(struct timerqueue_head *head, struct timerqueue_node *node)
        while (*p) {
                parent = *p;
                ptr = rb_entry(parent, struct timerqueue_node, node);
-               if (node->expires.tv64 < ptr->expires.tv64)
+               if (node->expires < ptr->expires)
                        p = &(*p)->rb_left;
                else
                        p = &(*p)->rb_right;
@@ -56,7 +56,7 @@ bool timerqueue_add(struct timerqueue_head *head, struct timerqueue_node *node)
        rb_link_node(&node->node, parent, p);
        rb_insert_color(&node->node, &head->head);
 
-       if (!head->next || node->expires.tv64 < head->next->expires.tv64) {
+       if (!head->next || node->expires < head->next->expires) {
                head->next = node;
                return true;
        }
index 32be3c8f3a112d2fd7b3be42b327d727bf240507..d0e4d1002059360e50254ae2c87dc8f7a87a2dff 100644 (file)
@@ -739,45 +739,159 @@ EXPORT_SYMBOL(__page_cache_alloc);
  * at a cost of "thundering herd" phenomena during rare hash
  * collisions.
  */
-wait_queue_head_t *page_waitqueue(struct page *page)
+#define PAGE_WAIT_TABLE_BITS 8
+#define PAGE_WAIT_TABLE_SIZE (1 << PAGE_WAIT_TABLE_BITS)
+static wait_queue_head_t page_wait_table[PAGE_WAIT_TABLE_SIZE] __cacheline_aligned;
+
+static wait_queue_head_t *page_waitqueue(struct page *page)
 {
-       return bit_waitqueue(page, 0);
+       return &page_wait_table[hash_ptr(page, PAGE_WAIT_TABLE_BITS)];
 }
-EXPORT_SYMBOL(page_waitqueue);
 
-void wait_on_page_bit(struct page *page, int bit_nr)
+void __init pagecache_init(void)
 {
-       DEFINE_WAIT_BIT(wait, &page->flags, bit_nr);
+       int i;
+
+       for (i = 0; i < PAGE_WAIT_TABLE_SIZE; i++)
+               init_waitqueue_head(&page_wait_table[i]);
 
-       if (test_bit(bit_nr, &page->flags))
-               __wait_on_bit(page_waitqueue(page), &wait, bit_wait_io,
-                                                       TASK_UNINTERRUPTIBLE);
+       page_writeback_init();
 }
-EXPORT_SYMBOL(wait_on_page_bit);
 
-int wait_on_page_bit_killable(struct page *page, int bit_nr)
+struct wait_page_key {
+       struct page *page;
+       int bit_nr;
+       int page_match;
+};
+
+struct wait_page_queue {
+       struct page *page;
+       int bit_nr;
+       wait_queue_t wait;
+};
+
+static int wake_page_function(wait_queue_t *wait, unsigned mode, int sync, void *arg)
 {
-       DEFINE_WAIT_BIT(wait, &page->flags, bit_nr);
+       struct wait_page_key *key = arg;
+       struct wait_page_queue *wait_page
+               = container_of(wait, struct wait_page_queue, wait);
+
+       if (wait_page->page != key->page)
+              return 0;
+       key->page_match = 1;
 
-       if (!test_bit(bit_nr, &page->flags))
+       if (wait_page->bit_nr != key->bit_nr)
+               return 0;
+       if (test_bit(key->bit_nr, &key->page->flags))
                return 0;
 
-       return __wait_on_bit(page_waitqueue(page), &wait,
-                            bit_wait_io, TASK_KILLABLE);
+       return autoremove_wake_function(wait, mode, sync, key);
 }
 
-int wait_on_page_bit_killable_timeout(struct page *page,
-                                      int bit_nr, unsigned long timeout)
+void wake_up_page_bit(struct page *page, int bit_nr)
 {
-       DEFINE_WAIT_BIT(wait, &page->flags, bit_nr);
+       wait_queue_head_t *q = page_waitqueue(page);
+       struct wait_page_key key;
+       unsigned long flags;
 
-       wait.key.timeout = jiffies + timeout;
-       if (!test_bit(bit_nr, &page->flags))
-               return 0;
-       return __wait_on_bit(page_waitqueue(page), &wait,
-                            bit_wait_io_timeout, TASK_KILLABLE);
+       key.page = page;
+       key.bit_nr = bit_nr;
+       key.page_match = 0;
+
+       spin_lock_irqsave(&q->lock, flags);
+       __wake_up_locked_key(q, TASK_NORMAL, &key);
+       /*
+        * It is possible for other pages to have collided on the waitqueue
+        * hash, so in that case check for a page match. That prevents a long-
+        * term waiter
+        *
+        * It is still possible to miss a case here, when we woke page waiters
+        * and removed them from the waitqueue, but there are still other
+        * page waiters.
+        */
+       if (!waitqueue_active(q) || !key.page_match) {
+               ClearPageWaiters(page);
+               /*
+                * It's possible to miss clearing Waiters here, when we woke
+                * our page waiters, but the hashed waitqueue has waiters for
+                * other pages on it.
+                *
+                * That's okay, it's a rare case. The next waker will clear it.
+                */
+       }
+       spin_unlock_irqrestore(&q->lock, flags);
+}
+EXPORT_SYMBOL(wake_up_page_bit);
+
+static inline int wait_on_page_bit_common(wait_queue_head_t *q,
+               struct page *page, int bit_nr, int state, bool lock)
+{
+       struct wait_page_queue wait_page;
+       wait_queue_t *wait = &wait_page.wait;
+       int ret = 0;
+
+       init_wait(wait);
+       wait->func = wake_page_function;
+       wait_page.page = page;
+       wait_page.bit_nr = bit_nr;
+
+       for (;;) {
+               spin_lock_irq(&q->lock);
+
+               if (likely(list_empty(&wait->task_list))) {
+                       if (lock)
+                               __add_wait_queue_tail_exclusive(q, wait);
+                       else
+                               __add_wait_queue(q, wait);
+                       SetPageWaiters(page);
+               }
+
+               set_current_state(state);
+
+               spin_unlock_irq(&q->lock);
+
+               if (likely(test_bit(bit_nr, &page->flags))) {
+                       io_schedule();
+                       if (unlikely(signal_pending_state(state, current))) {
+                               ret = -EINTR;
+                               break;
+                       }
+               }
+
+               if (lock) {
+                       if (!test_and_set_bit_lock(bit_nr, &page->flags))
+                               break;
+               } else {
+                       if (!test_bit(bit_nr, &page->flags))
+                               break;
+               }
+       }
+
+       finish_wait(q, wait);
+
+       /*
+        * A signal could leave PageWaiters set. Clearing it here if
+        * !waitqueue_active would be possible (by open-coding finish_wait),
+        * but still fail to catch it in the case of wait hash collision. We
+        * already can fail to clear wait hash collision cases, so don't
+        * bother with signals either.
+        */
+
+       return ret;
+}
+
+void wait_on_page_bit(struct page *page, int bit_nr)
+{
+       wait_queue_head_t *q = page_waitqueue(page);
+       wait_on_page_bit_common(q, page, bit_nr, TASK_UNINTERRUPTIBLE, false);
+}
+EXPORT_SYMBOL(wait_on_page_bit);
+
+int wait_on_page_bit_killable(struct page *page, int bit_nr)
+{
+       wait_queue_head_t *q = page_waitqueue(page);
+       return wait_on_page_bit_common(q, page, bit_nr, TASK_KILLABLE, false);
 }
-EXPORT_SYMBOL_GPL(wait_on_page_bit_killable_timeout);
 
 /**
  * add_page_wait_queue - Add an arbitrary waiter to a page's wait queue
@@ -793,10 +907,34 @@ void add_page_wait_queue(struct page *page, wait_queue_t *waiter)
 
        spin_lock_irqsave(&q->lock, flags);
        __add_wait_queue(q, waiter);
+       SetPageWaiters(page);
        spin_unlock_irqrestore(&q->lock, flags);
 }
 EXPORT_SYMBOL_GPL(add_page_wait_queue);
 
+#ifndef clear_bit_unlock_is_negative_byte
+
+/*
+ * PG_waiters is the high bit in the same byte as PG_lock.
+ *
+ * On x86 (and on many other architectures), we can clear PG_lock and
+ * test the sign bit at the same time. But if the architecture does
+ * not support that special operation, we just do this all by hand
+ * instead.
+ *
+ * The read of PG_waiters has to be after (or concurrently with) PG_locked
+ * being cleared, but a memory barrier should be unneccssary since it is
+ * in the same byte as PG_locked.
+ */
+static inline bool clear_bit_unlock_is_negative_byte(long nr, volatile void *mem)
+{
+       clear_bit_unlock(nr, mem);
+       /* smp_mb__after_atomic(); */
+       return test_bit(PG_waiters, mem);
+}
+
+#endif
+
 /**
  * unlock_page - unlock a locked page
  * @page: the page
@@ -806,16 +944,19 @@ EXPORT_SYMBOL_GPL(add_page_wait_queue);
  * mechanism between PageLocked pages and PageWriteback pages is shared.
  * But that's OK - sleepers in wait_on_page_writeback() just go back to sleep.
  *
- * The mb is necessary to enforce ordering between the clear_bit and the read
- * of the waitqueue (to avoid SMP races with a parallel wait_on_page_locked()).
+ * Note that this depends on PG_waiters being the sign bit in the byte
+ * that contains PG_locked - thus the BUILD_BUG_ON(). That allows us to
+ * clear the PG_locked bit and test PG_waiters at the same time fairly
+ * portably (architectures that do LL/SC can test any bit, while x86 can
+ * test the sign bit).
  */
 void unlock_page(struct page *page)
 {
+       BUILD_BUG_ON(PG_waiters != 7);
        page = compound_head(page);
        VM_BUG_ON_PAGE(!PageLocked(page), page);
-       clear_bit_unlock(PG_locked, &page->flags);
-       smp_mb__after_atomic();
-       wake_up_page(page, PG_locked);
+       if (clear_bit_unlock_is_negative_byte(PG_locked, &page->flags))
+               wake_up_page_bit(page, PG_locked);
 }
 EXPORT_SYMBOL(unlock_page);
 
@@ -874,23 +1015,19 @@ EXPORT_SYMBOL_GPL(page_endio);
  * __lock_page - get a lock on the page, assuming we need to sleep to get it
  * @page: the page to lock
  */
-void __lock_page(struct page *page)
+void __lock_page(struct page *__page)
 {
-       struct page *page_head = compound_head(page);
-       DEFINE_WAIT_BIT(wait, &page_head->flags, PG_locked);
-
-       __wait_on_bit_lock(page_waitqueue(page_head), &wait, bit_wait_io,
-                                                       TASK_UNINTERRUPTIBLE);
+       struct page *page = compound_head(__page);
+       wait_queue_head_t *q = page_waitqueue(page);
+       wait_on_page_bit_common(q, page, PG_locked, TASK_UNINTERRUPTIBLE, true);
 }
 EXPORT_SYMBOL(__lock_page);
 
-int __lock_page_killable(struct page *page)
+int __lock_page_killable(struct page *__page)
 {
-       struct page *page_head = compound_head(page);
-       DEFINE_WAIT_BIT(wait, &page_head->flags, PG_locked);
-
-       return __wait_on_bit_lock(page_waitqueue(page_head), &wait,
-                                       bit_wait_io, TASK_KILLABLE);
+       struct page *page = compound_head(__page);
+       wait_queue_head_t *q = page_waitqueue(page);
+       return wait_on_page_bit_common(q, page, PG_locked, TASK_KILLABLE, true);
 }
 EXPORT_SYMBOL_GPL(__lock_page_killable);
 
index 44d68895a9b9b29deefbed2be37e52eb94ba9f33..7aa2ea0a8623c2bac9bb4d29889ad163b58a4195 100644 (file)
@@ -36,6 +36,8 @@
 /* Do not use these with a slab allocator */
 #define GFP_SLAB_BUG_MASK (__GFP_DMA32|__GFP_HIGHMEM|~__GFP_BITS_MASK)
 
+void page_writeback_init(void);
+
 int do_swap_page(struct vm_fault *vmf);
 
 void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
index 175ec51c346dc8050eb8c646dfbdf6a9e50224a2..4048897e7b01a6e5e82333c0852629eded927ff3 100644 (file)
@@ -68,7 +68,7 @@
 #include <net/ip.h>
 #include "slab.h"
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <trace/events/vmscan.h>
 
index 19e796d36a629147dd36217ecab34934300dc660..f283c7e0a2a302c617c03a3aebf60e262b94a895 100644 (file)
@@ -764,12 +764,11 @@ static int me_huge_page(struct page *p, unsigned long pfn)
  */
 
 #define dirty          (1UL << PG_dirty)
-#define sc             (1UL << PG_swapcache)
+#define sc             ((1UL << PG_swapcache) | (1UL << PG_swapbacked))
 #define unevict                (1UL << PG_unevictable)
 #define mlock          (1UL << PG_mlocked)
 #define writeback      (1UL << PG_writeback)
 #define lru            (1UL << PG_lru)
-#define swapbacked     (1UL << PG_swapbacked)
 #define head           (1UL << PG_head)
 #define slab           (1UL << PG_slab)
 #define reserved       (1UL << PG_reserved)
@@ -819,7 +818,6 @@ static struct page_state {
 #undef mlock
 #undef writeback
 #undef lru
-#undef swapbacked
 #undef head
 #undef slab
 #undef reserved
index 455c3e628d52caf9b9a065cb846c17c0cc9cc79f..9f2c15cdb32c6327c0d2e8992c5c269ba573f698 100644 (file)
@@ -68,7 +68,7 @@
 #include <asm/io.h>
 #include <asm/mmu_context.h>
 #include <asm/pgalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
 #include <asm/pgtable.h>
@@ -3008,13 +3008,6 @@ static int do_set_pmd(struct vm_fault *vmf, struct page *page)
        ret = 0;
        count_vm_event(THP_FILE_MAPPED);
 out:
-       /*
-        * If we are going to fallback to pte mapping, do a
-        * withdraw with pmd lock held.
-        */
-       if (arch_needs_pgtable_deposit() && ret == VM_FAULT_FALLBACK)
-               vmf->prealloc_pte = pgtable_trans_huge_withdraw(vma->vm_mm,
-                                                               vmf->pmd);
        spin_unlock(vmf->ptl);
        return ret;
 }
@@ -3055,20 +3048,18 @@ int alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,
 
                ret = do_set_pmd(vmf, page);
                if (ret != VM_FAULT_FALLBACK)
-                       goto fault_handled;
+                       return ret;
        }
 
        if (!vmf->pte) {
                ret = pte_alloc_one_map(vmf);
                if (ret)
-                       goto fault_handled;
+                       return ret;
        }
 
        /* Re-check under ptl */
-       if (unlikely(!pte_none(*vmf->pte))) {
-               ret = VM_FAULT_NOPAGE;
-               goto fault_handled;
-       }
+       if (unlikely(!pte_none(*vmf->pte)))
+               return VM_FAULT_NOPAGE;
 
        flush_icache_page(vma, page);
        entry = mk_pte(page, vma->vm_page_prot);
@@ -3088,15 +3079,8 @@ int alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,
 
        /* no need to invalidate: a not-present page won't be cached */
        update_mmu_cache(vma, vmf->address, vmf->pte);
-       ret = 0;
 
-fault_handled:
-       /* preallocated pagetable is unused: free it */
-       if (vmf->prealloc_pte) {
-               pte_free(vmf->vma->vm_mm, vmf->prealloc_pte);
-               vmf->prealloc_pte = 0;
-       }
-       return ret;
+       return 0;
 }
 
 
@@ -3360,15 +3344,24 @@ static int do_shared_fault(struct vm_fault *vmf)
 static int do_fault(struct vm_fault *vmf)
 {
        struct vm_area_struct *vma = vmf->vma;
+       int ret;
 
        /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */
        if (!vma->vm_ops->fault)
-               return VM_FAULT_SIGBUS;
-       if (!(vmf->flags & FAULT_FLAG_WRITE))
-               return do_read_fault(vmf);
-       if (!(vma->vm_flags & VM_SHARED))
-               return do_cow_fault(vmf);
-       return do_shared_fault(vmf);
+               ret = VM_FAULT_SIGBUS;
+       else if (!(vmf->flags & FAULT_FLAG_WRITE))
+               ret = do_read_fault(vmf);
+       else if (!(vma->vm_flags & VM_SHARED))
+               ret = do_cow_fault(vmf);
+       else
+               ret = do_shared_fault(vmf);
+
+       /* preallocated pagetable is unused: free it */
+       if (vmf->prealloc_pte) {
+               pte_free(vma->vm_mm, vmf->prealloc_pte);
+               vmf->prealloc_pte = 0;
+       }
+       return ret;
 }
 
 static int numa_migrate_prep(struct page *page, struct vm_area_struct *vma,
index 6d3639e1f254734ae62b13a04fb78c2153f1c7ba..2e346645eb80d6bb8f97761c30aed6a512017e59 100644 (file)
@@ -96,7 +96,7 @@
 #include <linux/printk.h>
 
 #include <asm/tlbflush.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "internal.h"
 
index 0ed24b1fa77b89cd49738390cda724c5e74008f8..87f4d0f818194ea68cd323b1bcf84dd430b826a3 100644 (file)
@@ -466,13 +466,15 @@ int migrate_page_move_mapping(struct address_space *mapping,
         */
        newpage->index = page->index;
        newpage->mapping = page->mapping;
-       if (PageSwapBacked(page))
-               __SetPageSwapBacked(newpage);
-
        get_page(newpage);      /* add cache reference */
-       if (PageSwapCache(page)) {
-               SetPageSwapCache(newpage);
-               set_page_private(newpage, page_private(page));
+       if (PageSwapBacked(page)) {
+               __SetPageSwapBacked(newpage);
+               if (PageSwapCache(page)) {
+                       SetPageSwapCache(newpage);
+                       set_page_private(newpage, page_private(page));
+               }
+       } else {
+               VM_BUG_ON_PAGE(PageSwapCache(page), page);
        }
 
        /* Move dirty while page refs frozen and newpage not yet exposed */
index bfb866435478b33dada2231b5f64553f7208c75e..ddb872da3f5b065e11937ed5b236643731d24a3c 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/swapops.h>
 #include <linux/hugetlb.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 
 static int mincore_hugetlb(pte_t *pte, unsigned long hmask, unsigned long addr,
index 1af87c14183d0873343347b2e01cf6d78a856072..dc4291dcc99b8f245fe38aeb52bb5aa5fbe3243d 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -45,7 +45,7 @@
 #include <linux/moduleparam.h>
 #include <linux/pkeys.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/tlb.h>
 #include <asm/mmu_context.h>
index cc2459c57f6080f8776cbc81c844137337bb775e..f9c07f54dd62d928187985554695c3c1117c75a7 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/perf_event.h>
 #include <linux/pkeys.h>
 #include <linux/ksm.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
 #include <asm/mmu_context.h>
index 210d7ec2843c28763299964f5e77254916951f31..24f9f5f391459201f8c07c74f3afb931f716791b 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/audit.h>
 #include <linux/printk.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
 #include <asm/mmu_context.h>
index b1b20dc63265029e0f5e77221d8a2d851032992f..bb53285a1d99666676e85697330f1a052f7c3cc0 100644 (file)
@@ -71,7 +71,7 @@ static struct vfsmount *shm_mnt;
 #include <linux/fcntl.h>
 #include <uapi/linux/memfd.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 
 #include "internal.h"
index 4dcf852e1e6d8f2e9f0eeca9ee39f620ea972957..844baedd24292f0803ddadb2a2be03a754ec150b 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -69,6 +69,7 @@ static void __page_cache_release(struct page *page)
                del_page_from_lru_list(page, lruvec, page_off_lru(page));
                spin_unlock_irqrestore(zone_lru_lock(zone), flags);
        }
+       __ClearPageWaiters(page);
        mem_cgroup_uncharge(page);
 }
 
@@ -784,6 +785,7 @@ void release_pages(struct page **pages, int nr, bool cold)
 
                /* Clear Active bit in case of parallel mark_page_accessed */
                __ClearPageActive(page);
+               __ClearPageWaiters(page);
 
                list_add(&page->lru, &pages_to_free);
        }
index fd97f1dbce290f39e1d0d0367006df954f20e8f1..dd7b24e083c5b1f76851eb0b5e3359dde92d910e 100644 (file)
 #include <linux/rmap.h>
 #include "internal.h"
 
-static void clear_exceptional_entry(struct address_space *mapping,
-                                   pgoff_t index, void *entry)
+static void clear_shadow_entry(struct address_space *mapping, pgoff_t index,
+                              void *entry)
 {
        struct radix_tree_node *node;
        void **slot;
 
-       /* Handled by shmem itself */
-       if (shmem_mapping(mapping))
-               return;
-
-       if (dax_mapping(mapping)) {
-               dax_delete_mapping_entry(mapping, index);
-               return;
-       }
        spin_lock_irq(&mapping->tree_lock);
        /*
         * Regular page slots are stabilized by the page lock even
@@ -55,6 +47,56 @@ unlock:
        spin_unlock_irq(&mapping->tree_lock);
 }
 
+/*
+ * Unconditionally remove exceptional entry. Usually called from truncate path.
+ */
+static void truncate_exceptional_entry(struct address_space *mapping,
+                                      pgoff_t index, void *entry)
+{
+       /* Handled by shmem itself */
+       if (shmem_mapping(mapping))
+               return;
+
+       if (dax_mapping(mapping)) {
+               dax_delete_mapping_entry(mapping, index);
+               return;
+       }
+       clear_shadow_entry(mapping, index, entry);
+}
+
+/*
+ * Invalidate exceptional entry if easily possible. This handles exceptional
+ * entries for invalidate_inode_pages() so for DAX it evicts only unlocked and
+ * clean entries.
+ */
+static int invalidate_exceptional_entry(struct address_space *mapping,
+                                       pgoff_t index, void *entry)
+{
+       /* Handled by shmem itself */
+       if (shmem_mapping(mapping))
+               return 1;
+       if (dax_mapping(mapping))
+               return dax_invalidate_mapping_entry(mapping, index);
+       clear_shadow_entry(mapping, index, entry);
+       return 1;
+}
+
+/*
+ * Invalidate exceptional entry if clean. This handles exceptional entries for
+ * invalidate_inode_pages2() so for DAX it evicts only clean entries.
+ */
+static int invalidate_exceptional_entry2(struct address_space *mapping,
+                                        pgoff_t index, void *entry)
+{
+       /* Handled by shmem itself */
+       if (shmem_mapping(mapping))
+               return 1;
+       if (dax_mapping(mapping))
+               return dax_invalidate_mapping_entry_sync(mapping, index);
+       clear_shadow_entry(mapping, index, entry);
+       return 1;
+}
+
 /**
  * do_invalidatepage - invalidate part or all of a page
  * @page: the page which is affected
@@ -262,7 +304,8 @@ void truncate_inode_pages_range(struct address_space *mapping,
                                break;
 
                        if (radix_tree_exceptional_entry(page)) {
-                               clear_exceptional_entry(mapping, index, page);
+                               truncate_exceptional_entry(mapping, index,
+                                                          page);
                                continue;
                        }
 
@@ -351,7 +394,8 @@ void truncate_inode_pages_range(struct address_space *mapping,
                        }
 
                        if (radix_tree_exceptional_entry(page)) {
-                               clear_exceptional_entry(mapping, index, page);
+                               truncate_exceptional_entry(mapping, index,
+                                                          page);
                                continue;
                        }
 
@@ -470,7 +514,8 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping,
                                break;
 
                        if (radix_tree_exceptional_entry(page)) {
-                               clear_exceptional_entry(mapping, index, page);
+                               invalidate_exceptional_entry(mapping, index,
+                                                            page);
                                continue;
                        }
 
@@ -592,7 +637,9 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
                                break;
 
                        if (radix_tree_exceptional_entry(page)) {
-                               clear_exceptional_entry(mapping, index, page);
+                               if (!invalidate_exceptional_entry2(mapping,
+                                                                  index, page))
+                                       ret = -EBUSY;
                                continue;
                        }
 
index 1a41553db866f543719c019e36dc2c71c4b3b984..3cb2164f40993818cdf141e3414e89c2a734ec90 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -13,7 +13,7 @@
 #include <linux/vmalloc.h>
 
 #include <asm/sections.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "internal.h"
 
index a5584384eabc1faf00352d9773ced1c31a09b984..3ca82d44edd344a2800b8029f5d6e1d27d8d528b 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/llist.h>
 #include <linux/bitops.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/tlbflush.h>
 #include <asm/shmparam.h>
 
index 241fa5d6b3b2fe155ed0f458b9d188a926a51e80..abb58ffa3c64cb330d7e3d7aca7897aab0fea6a4 100644 (file)
@@ -473,7 +473,8 @@ static enum lru_status shadow_lru_isolate(struct list_head *item,
        if (WARN_ON_ONCE(node->exceptional))
                goto out_invalid;
        inc_node_state(page_pgdat(virt_to_page(node)), WORKINGSET_NODERECLAIM);
-       __radix_tree_delete_node(&mapping->page_tree, node);
+       __radix_tree_delete_node(&mapping->page_tree, node,
+                                workingset_update_node, mapping);
 
 out_invalid:
        spin_unlock(&mapping->tree_lock);
index 7b9219022418b2e5a4686b9504f42e32cd091128..1bb496ea997e2b43a35c060ca5ce727514afdd63 100644 (file)
@@ -10,7 +10,7 @@
  *             v 1.0 03/22/99
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
index 5e4427beab2bc2917aaaa004042d4ee1141a3457..4460606e9c36f1a3a219c6104177521a347fa2b0 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/errno.h>
 #include <net/arp.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * Create the HIPPI MAC header for an arbitrary protocol layer
index 691f0ad7067d167dfac7e8746b43c4b83fe47754..467069b73ce1b89e5a7b72904a878ef1f3412c67 100644 (file)
@@ -34,7 +34,7 @@
 #include <net/rtnetlink.h>
 #include <net/net_namespace.h>
 #include <net/netns/generic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/if_vlan.h>
 #include "vlan.h"
index 019557d0a11d2434ff7186da5504917717bf7d2b..09cfe87f0a44d64dbbdb9209d8eb358efa68f887 100644 (file)
@@ -1059,7 +1059,9 @@ static void __exit lane_module_cleanup(void)
 {
        int i;
 
+#ifdef CONFIG_PROC_FS
        remove_proc_entry("lec", atm_proc_root);
+#endif
 
        deregister_atm_ioctl(&lane_ioctl_ops);
 
index 2fdebabbfacd14690abaca3c57dfcddf944466a1..90fcf5fc2e0ac8df1a1eb6a2e6b62d26874cf053 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/if_arp.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/termios.h>     /* For TIOCINQ/OUTQ */
 #include <linux/mm.h>
index e7c9b0ea17a170b19ee91cc2a9ba1c7c06eb20de..ac2542b7be889955725c3329ad2493e9d6434a74 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 3d106767b272522dc8ea86dad471dda247b95d96..9a3a301e1e2f0e1dce8f716750c652d031877cb0 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/if_arp.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 9bd31e88aeca9b71aa9dda70105b7df9391bb988..891596e7427835b37c752018b1627ca34e7538f9 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/skbuff.h>
 #include <net/sock.h>
 #include <net/tcp_states.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index e05bd57b5afdfae6a92fdae63833c32c94bb9cec..28827e81ba2b42eee62f6411cc742b6752d6306a 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 5237dff6941d81e3b2cd98c47013746c58798e77..5fb2104b7304aa2a70f47c62124033fb3a33dae9 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 7f16e8a931b2fa149e45dbb2b07d7f47a988af53..8c07c28569e47566f5c3cb21abcef4f0d47eae9c 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index bb5a0e4e98d9df09ec535a20ea73253817fe64db..860752639b1a63947d28e2e94705fd7f6a357381 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/skbuff.h>
 #include <net/sock.h>
 #include <net/tcp_states.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 2fa3be96510161190365ff59b48ec8a293037853..183b1c583d561f7a925de423eb5ea9fef7e025b3 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/if_arp.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/termios.h>     /* For TIOCINQ/OUTQ */
 #include <linux/mm.h>
index 8ddd41baa81c57e62a51fc7147d04de91c7e4e7e..b11a5f466fcce742dda24e1edc6f40a038ffcf4e 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index d39097737e387af8096e34a2ae7d1f610524e292..e1fda27cb27cd785f2334dabe469437df0a45454 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/skbuff.h>
 #include <linux/spinlock.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 3fbf8f7b2cf46a394b5d5321a38880d3b6df4bc4..8632b86e843e330976a4d8129393eee081ccd8fd 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/skbuff.h>
 #include <net/sock.h>
 #include <net/tcp_states.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 8b66a41e538f272213092b5fe0faf7d404db9854..94bd06396a43a274b5347b7a90330faa6fb03268 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 2c0d6ef66f9d581d31b88ecf0875f78b90728a36..30bbc675261d80b9aa4708619aca7ba1afcabdfd 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/skbuff.h>
 #include <net/sock.h>
 #include <net/tcp_states.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 655a7d4c96e1e26b7390b8c783cebb2a31ca4ca8..4855d18a8511072b499043d1160ad1ff4b2f9f3e 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/skbuff.h>
 #include <net/sock.h>
 #include <net/tcp_states.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index c3cffa79bafb92aefdba18a63b59fa3b29b30a86..23a6f38a80bfa4c9f2cfd19239eb7c5d12ba114c 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 4ad2fb7bcd352029ca6df39c4c6e104551230761..0403b0def7e6f08e91865a9f91aeb47089b53ddc 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/if_arp.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index bca5ead3e97324a895d48aba64b321ede593caa2..ed3b3192fb00f575d9d52671ead28de03806002e 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/list.h>
 #include <linux/netfilter_bridge.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "br_private.h"
 
 #define COMMON_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | \
index d99b2009771a61df50d185b4e1d46ce6a3c40f94..da8157c57eb15d83471862260bbc364a76a537a0 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/slab.h>
 #include <linux/times.h>
 #include <net/net_namespace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "br_private.h"
 
 static int get_bridge_ifindices(struct net *net, int *indices, int num)
index b12501a77f18f6df4f22572ea8885a929d458e0b..8ca6a929bf1255cb432fd4bd59d34345d62e09c4 100644 (file)
@@ -40,7 +40,7 @@
 #include <net/netfilter/br_netfilter.h>
 #include <net/netns/generic.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "br_private.h"
 #ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
index 5989661c659f52e0ee352e8af8aba876e83290b4..96c072e71ea2eb7bc904b100914dc098707eb4d1 100644 (file)
@@ -38,7 +38,7 @@
 #include <net/route.h>
 #include <net/netfilter/br_netfilter.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "br_private.h"
 #ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
index 1ab6014cf0f8ec7c0fd58aca63438e009a22cb93..537e3d506fc237f673af53a50109fea6935872ff 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/smp.h>
 #include <linux/cpumask.h>
 #include <linux/audit.h>
index 436a7537e6a9d3ef065ec572568c42fd13331b5e..21ac75390e3d64f795faad074b515d34ce0bbfa3 100644 (file)
@@ -199,11 +199,11 @@ static int bcm_proc_show(struct seq_file *m, void *v)
 
                seq_printf(m, "%c ", (op->flags & RX_CHECK_DLC) ? 'd' : ' ');
 
-               if (op->kt_ival1.tv64)
+               if (op->kt_ival1)
                        seq_printf(m, "timeo=%lld ",
                                   (long long)ktime_to_us(op->kt_ival1));
 
-               if (op->kt_ival2.tv64)
+               if (op->kt_ival2)
                        seq_printf(m, "thr=%lld ",
                                   (long long)ktime_to_us(op->kt_ival2));
 
@@ -226,11 +226,11 @@ static int bcm_proc_show(struct seq_file *m, void *v)
                else
                        seq_printf(m, "[%u] ", op->nframes);
 
-               if (op->kt_ival1.tv64)
+               if (op->kt_ival1)
                        seq_printf(m, "t1=%lld ",
                                   (long long)ktime_to_us(op->kt_ival1));
 
-               if (op->kt_ival2.tv64)
+               if (op->kt_ival2)
                        seq_printf(m, "t2=%lld ",
                                   (long long)ktime_to_us(op->kt_ival2));
 
@@ -365,11 +365,11 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
 
 static void bcm_tx_start_timer(struct bcm_op *op)
 {
-       if (op->kt_ival1.tv64 && op->count)
+       if (op->kt_ival1 && op->count)
                hrtimer_start(&op->timer,
                              ktime_add(ktime_get(), op->kt_ival1),
                              HRTIMER_MODE_ABS);
-       else if (op->kt_ival2.tv64)
+       else if (op->kt_ival2)
                hrtimer_start(&op->timer,
                              ktime_add(ktime_get(), op->kt_ival2),
                              HRTIMER_MODE_ABS);
@@ -380,7 +380,7 @@ static void bcm_tx_timeout_tsklet(unsigned long data)
        struct bcm_op *op = (struct bcm_op *)data;
        struct bcm_msg_head msg_head;
 
-       if (op->kt_ival1.tv64 && (op->count > 0)) {
+       if (op->kt_ival1 && (op->count > 0)) {
 
                op->count--;
                if (!op->count && (op->flags & TX_COUNTEVT)) {
@@ -398,7 +398,7 @@ static void bcm_tx_timeout_tsklet(unsigned long data)
                }
                bcm_can_tx(op);
 
-       } else if (op->kt_ival2.tv64)
+       } else if (op->kt_ival2)
                bcm_can_tx(op);
 
        bcm_tx_start_timer(op);
@@ -459,7 +459,7 @@ static void bcm_rx_update_and_send(struct bcm_op *op,
        lastdata->flags |= (RX_RECV|RX_THR);
 
        /* throttling mode inactive ? */
-       if (!op->kt_ival2.tv64) {
+       if (!op->kt_ival2) {
                /* send RX_CHANGED to the user immediately */
                bcm_rx_changed(op, lastdata);
                return;
@@ -470,7 +470,7 @@ static void bcm_rx_update_and_send(struct bcm_op *op,
                return;
 
        /* first reception with enabled throttling mode */
-       if (!op->kt_lastmsg.tv64)
+       if (!op->kt_lastmsg)
                goto rx_changed_settime;
 
        /* got a second frame inside a potential throttle period? */
@@ -537,7 +537,7 @@ static void bcm_rx_starttimer(struct bcm_op *op)
        if (op->flags & RX_NO_AUTOTIMER)
                return;
 
-       if (op->kt_ival1.tv64)
+       if (op->kt_ival1)
                hrtimer_start(&op->timer, op->kt_ival1, HRTIMER_MODE_REL);
 }
 
@@ -643,7 +643,7 @@ static enum hrtimer_restart bcm_rx_thr_handler(struct hrtimer *hrtimer)
                return HRTIMER_RESTART;
        } else {
                /* rearm throttle handling */
-               op->kt_lastmsg = ktime_set(0, 0);
+               op->kt_lastmsg = 0;
                return HRTIMER_NORESTART;
        }
 }
@@ -1005,7 +1005,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
                op->kt_ival2 = bcm_timeval_to_ktime(msg_head->ival2);
 
                /* disable an active timer due to zero values? */
-               if (!op->kt_ival1.tv64 && !op->kt_ival2.tv64)
+               if (!op->kt_ival1 && !op->kt_ival2)
                        hrtimer_cancel(&op->timer);
        }
 
@@ -1189,19 +1189,19 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
                        op->kt_ival2 = bcm_timeval_to_ktime(msg_head->ival2);
 
                        /* disable an active timer due to zero value? */
-                       if (!op->kt_ival1.tv64)
+                       if (!op->kt_ival1)
                                hrtimer_cancel(&op->timer);
 
                        /*
                         * In any case cancel the throttle timer, flush
                         * potentially blocked msgs and reset throttle handling
                         */
-                       op->kt_lastmsg = ktime_set(0, 0);
+                       op->kt_lastmsg = 0;
                        hrtimer_cancel(&op->thrtimer);
                        bcm_rx_thr_flush(op, 1);
                }
 
-               if ((op->flags & STARTTIMER) && op->kt_ival1.tv64)
+               if ((op->flags & STARTTIMER) && op->kt_ival1)
                        hrtimer_start(&op->timer, op->kt_ival1,
                                      HRTIMER_MODE_REL);
        }
index 455168718c2efb4fa6b9e396e945a3824437c65d..a54ab0c821048ab2034bf32cef3c1f35e0dc82a5 100644 (file)
@@ -429,7 +429,7 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data)
 
        /* clear the skb timestamp if not configured the other way */
        if (!(gwj->flags & CGW_FLAGS_CAN_SRC_TSTAMP))
-               nskb->tstamp.tv64 = 0;
+               nskb->tstamp = 0;
 
        /* send to netdevice */
        if (can_send(nskb, gwj->flags & CGW_FLAGS_CAN_ECHO))
index 1cd2ec046164a659d7e4ad1b1acc24eceb780a6e..96c544b05b15e3287cff8905b4b6007af69322af 100644 (file)
@@ -28,7 +28,7 @@
 #include <net/sock.h>
 #include <net/ip.h>
 #include <net/ipv6.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <net/compat.h>
 
 int get_compat_msghdr(struct msghdr *kmsg,
index 9482037a5c8c64aec79e42c65bd2691bdd9450a3..662bea5871656f190a61e35b3c5cd21c2f132441 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
 #include <linux/errno.h>
index 6372117f653f108e1670797168e286bb8755e970..8db5a0b4b52061afe9cd44dead33cc69523d15df 100644 (file)
@@ -72,7 +72,7 @@
  *                                     - netif_rx() feedback
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/capability.h>
 #include <linux/cpu.h>
@@ -1731,14 +1731,14 @@ EXPORT_SYMBOL(net_disable_timestamp);
 
 static inline void net_timestamp_set(struct sk_buff *skb)
 {
-       skb->tstamp.tv64 = 0;
+       skb->tstamp = 0;
        if (static_key_false(&netstamp_needed))
                __net_timestamp(skb);
 }
 
 #define net_timestamp_check(COND, SKB)                 \
        if (static_key_false(&netstamp_needed)) {               \
-               if ((COND) && !(SKB)->tstamp.tv64)      \
+               if ((COND) && !(SKB)->tstamp)   \
                        __net_timestamp(SKB);           \
        }                                               \
 
index 8e0c0635ee975e1c71a126677f63ff220f7f0c44..fb55327dcfeabdaf3eeecc3a8d176ae215612649 100644 (file)
@@ -75,6 +75,7 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
        struct nlattr *nla;
        struct sk_buff *skb;
        unsigned long flags;
+       void *msg_header;
 
        al = sizeof(struct net_dm_alert_msg);
        al += dm_hit_limit * sizeof(struct net_dm_drop_point);
@@ -82,21 +83,41 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
 
        skb = genlmsg_new(al, GFP_KERNEL);
 
-       if (skb) {
-               genlmsg_put(skb, 0, 0, &net_drop_monitor_family,
-                               0, NET_DM_CMD_ALERT);
-               nla = nla_reserve(skb, NLA_UNSPEC,
-                                 sizeof(struct net_dm_alert_msg));
-               msg = nla_data(nla);
-               memset(msg, 0, al);
-       } else {
-               mod_timer(&data->send_timer, jiffies + HZ / 10);
+       if (!skb)
+               goto err;
+
+       msg_header = genlmsg_put(skb, 0, 0, &net_drop_monitor_family,
+                                0, NET_DM_CMD_ALERT);
+       if (!msg_header) {
+               nlmsg_free(skb);
+               skb = NULL;
+               goto err;
+       }
+       nla = nla_reserve(skb, NLA_UNSPEC,
+                         sizeof(struct net_dm_alert_msg));
+       if (!nla) {
+               nlmsg_free(skb);
+               skb = NULL;
+               goto err;
        }
+       msg = nla_data(nla);
+       memset(msg, 0, al);
+       goto out;
 
+err:
+       mod_timer(&data->send_timer, jiffies + HZ / 10);
+out:
        spin_lock_irqsave(&data->lock, flags);
        swap(data->skb, skb);
        spin_unlock_irqrestore(&data->lock, flags);
 
+       if (skb) {
+               struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
+               struct genlmsghdr *gnlh = (struct genlmsghdr *)nlmsg_data(nlh);
+
+               genlmsg_end(skb, genlmsg_data(gnlh));
+       }
+
        return skb;
 }
 
index 7190bd648154e61d19f652dba5fbd861a72f6c36..1969b3f118c1d6e30b3edccd7c85a6caa520af5c 100644 (file)
@@ -40,7 +40,7 @@
 #include <net/flow_dissector.h>
 #include <linux/errno.h>
 #include <linux/timer.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 #include <linux/filter.h>
 #include <linux/ratelimit.h>
@@ -2972,12 +2972,6 @@ void bpf_warn_invalid_xdp_action(u32 act)
 }
 EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
 
-void bpf_warn_invalid_xdp_buffer(void)
-{
-       WARN_ONCE(1, "Illegal XDP buffer encountered, expect throughput degradation\n");
-}
-EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_buffer);
-
 static u32 sk_filter_convert_ctx_access(enum bpf_access_type type, int dst_reg,
                                        int src_reg, int ctx_off,
                                        struct bpf_insn *insn_buf,
index d6447dc1037151495d88064938dfb4e255377416..fe4e1531976c3a36127b6ad4af33f24534af4c52 100644 (file)
@@ -468,8 +468,9 @@ ip_proto_again:
                        if (hdr->flags & GRE_ACK)
                                offset += sizeof(((struct pptp_gre_header *)0)->ack);
 
-                       ppp_hdr = skb_header_pointer(skb, nhoff + offset,
-                                                    sizeof(_ppp_hdr), _ppp_hdr);
+                       ppp_hdr = __skb_header_pointer(skb, nhoff + offset,
+                                                    sizeof(_ppp_hdr),
+                                                    data, hlen, _ppp_hdr);
                        if (!ppp_hdr)
                                goto out_bad;
 
index 101b5d0e2142e6a813f6b524a59945379f02bcb3..0385dece1f6fe5e26df1ce5f40956a79a2eebbf4 100644 (file)
@@ -14,7 +14,7 @@
  *              names to make it usable in general net subsystem.
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/module.h>
 #include <linux/types.h>
index 782dd866366554e53dda3e6c69c807ec90bd0e08..7bb12e07ffef4273e156893cc150ea5c9d79e8bd 100644 (file)
@@ -100,6 +100,7 @@ static void neigh_cleanup_and_release(struct neighbour *neigh)
                neigh->parms->neigh_cleanup(neigh);
 
        __neigh_notify(neigh, RTM_DELNEIGH, 0);
+       call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
        neigh_release(neigh);
 }
 
index c482491a63d847df6496f0d2d5a472a958bcaf53..75e3ea7bda08f39e07d515768b56678842e74c40 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/pci.h>
 #include <linux/etherdevice.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/inet.h>
 #include <linux/netdevice.h>
@@ -3898,6 +3898,9 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh)
        u32 filter_mask;
        int err;
 
+       if (nlmsg_len(nlh) < sizeof(*ifsm))
+               return -EINVAL;
+
        ifsm = nlmsg_data(nlh);
        if (ifsm->ifindex > 0)
                dev = __dev_get_by_index(net, ifsm->ifindex);
@@ -3947,6 +3950,9 @@ static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb)
 
        cb->seq = net->dev_base_seq;
 
+       if (nlmsg_len(cb->nlh) < sizeof(*ifsm))
+               return -EINVAL;
+
        ifsm = nlmsg_data(cb->nlh);
        filter_mask = ifsm->filter_mask;
        if (!filter_mask)
index 2696aefdc148887138d46f98dc0a678ce2699512..d8820438ba374be7e723512635b40695853e4807 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/nsproxy.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/protocol.h>
 #include <linux/skbuff.h>
index 65a74e13c45bb879859b6c03771e4a266688063e..5a03730fbc1a84376985d4d68d8b80d8f38b0985 100644 (file)
@@ -72,7 +72,7 @@
 #include <net/ip6_checksum.h>
 #include <net/xfrm.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <trace/events/skb.h>
 #include <linux/highmem.h>
 #include <linux/capability.h>
@@ -4368,7 +4368,7 @@ EXPORT_SYMBOL(skb_try_coalesce);
  */
 void skb_scrub_packet(struct sk_buff *skb, bool xnet)
 {
-       skb->tstamp.tv64 = 0;
+       skb->tstamp = 0;
        skb->pkt_type = PACKET_HOST;
        skb->skb_iif = 0;
        skb->ignore_df = 0;
index 9fa46b956bdc877a68618b092e0a0d64cb67cf7e..f560e0826009851e79a1f8a8b90f4ded3cfc382d 100644 (file)
 #include <linux/memcontrol.h>
 #include <linux/prefetch.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/netdevice.h>
 #include <net/protocol.h>
index cf5622b9ccc44f065a2ac6ebafe707767f5fd633..6592d7bbed394086a8ba8efcb370fb1d75db4449 100644 (file)
@@ -31,7 +31,7 @@
 #include <net/net_ratelimit.h>
 
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 DEFINE_RATELIMIT_STATE(net_ratelimit_state, 5 * HZ, 10);
 /*
index 41f803e35da3bafd93a5d0853ee2e034995ad9c5..8fdd9f492b0ea2201db70cfe83ebe1f3384c7b04 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/notifier.h>
 #include <linux/slab.h>
 #include <linux/jiffies.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <net/net_namespace.h>
 #include <net/neighbour.h>
 #include <net/dst.h>
index a796fc7cbc3542972eaa19bbc3d3dc07a428ff1c..7af0ba6157a108578182eda3ec75ec7bd0c27859 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/timer.h>
 #include <linux/spinlock.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <net/neighbour.h>
 #include <net/dst.h>
 #include <net/flow.h>
index 1540b506e3e0b4f1fa094d2c928d22d20c4dbf3a..2326754807563aa8f9cf9ebb36f1f8d1c3c998b0 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/timer.h>
 #include <linux/spinlock.h>
 #include <linux/atomic.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/route.h> /* RTF_xxx */
 #include <net/neighbour.h>
 #include <net/netlink.h>
index 5325b541c526d9d5e92b7481302dde6ce5e7d65c..6c7da6c29bf0d4cfe8fadbb005853bcb18523204 100644 (file)
@@ -22,7 +22,7 @@
 #include <net/dst.h>
 #include <net/flow.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/dn.h>
 #include <net/dn_dev.h>
index 1830e6f0e9cc5533d01e70e2297abb208c961bd0..f75069883f2b517b2121707ef753d52ab3da5d26 100644 (file)
@@ -90,7 +90,7 @@
 #include <linux/random.h>
 #include <linux/slab.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/inet.h>
 #include <linux/igmp.h>
index 062a67ca9a212f6e8a966e5419c4a11867e601d9..4cd2ee8857d2c72d7b67ee37ca36bf5442169581 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/capability.h>
 #include <linux/module.h>
index dbad5a1c161aac81152bfbfb6dd6c53cd946dc02..eae0332b0e8c1f861ce629ed9ce3ddc45802a6b8 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/capability.h>
 #include <linux/types.h>
@@ -85,7 +85,7 @@ struct fib_table *fib_new_table(struct net *net, u32 id)
        if (tb)
                return tb;
 
-       if (id == RT_TABLE_LOCAL)
+       if (id == RT_TABLE_LOCAL && !net->ipv4.fib_has_custom_rules)
                alias = fib_new_table(net, RT_TABLE_MAIN);
 
        tb = fib_trie_table(id, alias);
index c1bc1e92de0ec97fe5061e1587da43919b81568e..7a5b4c7d9a87b18051a94aa2e16e6b85c8d85aa6 100644 (file)
@@ -13,7 +13,7 @@
  *             2 of the License, or (at your option) any later version.
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
index 1b0e7d1f52172b178b4b87e38b62af94f024d967..2919d1a10cfdd83f4c68ee12ee6ba29ce8dcb989 100644 (file)
@@ -50,7 +50,7 @@
 
 #define VERSION "0.409"
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
index f79d7a8ab1c673df50bd81ce595988df4871c05e..0777ea9492238944575b6d302ae16fb220b4f24d 100644 (file)
@@ -91,7 +91,7 @@
 #include <linux/errno.h>
 #include <linux/timer.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <net/checksum.h>
 #include <net/xfrm.h>
 #include <net/inet_common.h>
index 15db786d50ed28c7d31855a9582ab111752b3641..5b15459955f84cfc26dd2b12f129b1ee4014e62b 100644 (file)
@@ -72,7 +72,7 @@
 
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/jiffies.h>
@@ -219,9 +219,14 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay)
 static void igmp_gq_start_timer(struct in_device *in_dev)
 {
        int tv = prandom_u32() % in_dev->mr_maxdelay;
+       unsigned long exp = jiffies + tv + 2;
+
+       if (in_dev->mr_gq_running &&
+           time_after_eq(exp, (in_dev->mr_gq_timer).expires))
+               return;
 
        in_dev->mr_gq_running = 1;
-       if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2))
+       if (!mod_timer(&in_dev->mr_gq_timer, exp))
                in_dev_hold(in_dev);
 }
 
index 78fd620483353293220c971d3c8f11e9fe4a8c28..c9c1cb635d9afd0c5ccdec4402aa2aac29cc889a 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/in.h>
index 4d158ff1def1a8fae218b268c7e66224eed95adf..93157f2f4758e581579a623e3c6cb04dfdedb037 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/types.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unaligned.h>
 #include <linux/skbuff.h>
 #include <linux/ip.h>
index 618ab5079816edf2d449cf7d17c7a954185bc6ad..fac275c4810865a5b9b9ca1ac9fc826b8482aa9f 100644 (file)
@@ -42,7 +42,7 @@
  *             Hirokazu Takahashi:     sendfile() on UDP works now.
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
index 8b13881ed0644c3c32e87718752f8613023c72eb..53ae0c6315ad03e46f93ae68cb930fff5848edcd 100644 (file)
@@ -44,7 +44,7 @@
 #include <net/ip_fib.h>
 
 #include <linux/errqueue.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  *     SOL_IP control messages.
@@ -148,7 +148,7 @@ static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb)
        const struct iphdr *iph = ip_hdr(skb);
        __be16 *ports = (__be16 *)skb_transport_header(skb);
 
-       if (skb_transport_offset(skb) + 4 > skb->len)
+       if (skb_transport_offset(skb) + 4 > (int)skb->len)
                return;
 
        /* All current transport protocols have the port numbers in the
@@ -1225,8 +1225,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
                 * which has interface index (iif) as the first member of the
                 * underlying inet{6}_skb_parm struct. This code then overlays
                 * PKTINFO_SKB_CB and in_pktinfo also has iif as the first
-                * element so the iif is picked up from the prior IPCB
+                * element so the iif is picked up from the prior IPCB. If iif
+                * is the loopback interface, then return the sending interface
+                * (e.g., process binds socket to eth0 for Tx which is
+                * redirected to loopback in the rtable/dst).
                 */
+               if (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)
+                       pktinfo->ipi_ifindex = inet_iif(skb);
+
                pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);
        } else {
                pktinfo->ipi_ifindex = 0;
index 071a785c65eb7ab5eef6294888e253ef39f45c45..fd9f34bbd7408a0e9b0342ec6512c69cc30edc39 100644 (file)
@@ -61,7 +61,7 @@
 #include <net/ipconfig.h>
 #include <net/route.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <net/checksum.h>
 #include <asm/processor.h>
 
index 79489f017854e917df49f9eda569add649f1fd32..00d4229b6954262e556f7a8fd9c072638d49a8d6 100644 (file)
@@ -96,7 +96,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/in.h>
index 665505d86b1242e7b202c459d6c21b58937b09f8..efc1e76d49770994f065c1bbad1ef8f93fa99bc7 100644 (file)
@@ -26,7 +26,7 @@
  *
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/types.h>
 #include <linux/capability.h>
 #include <linux/errno.h>
index 1258a9ab62efeafe09a89bfb2a353cb7408d78e3..a467e1236c43ed1f3ecaa55524eb59722f1682e8 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/err.h>
 #include <net/compat.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_arp/arp_tables.h>
index 308b456723f0d926514464a050cb9fbb46916ed3..91656a1d8fbd5b15b306383fe733751fef10f27c 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/icmp.h>
 #include <net/ip.h>
 #include <net/compat.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/mutex.h>
 #include <linux/proc_fs.h>
 #include <linux/err.h>
index 2300fae11b22ea2beab67cdc4fbc6fe1b36222f5..4e49e5cb001ccd6824104af273bcbc40fc864ef7 100644 (file)
@@ -41,7 +41,7 @@
 #include <linux/atomic.h>
 #include <asm/byteorder.h>
 #include <asm/current.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ioctls.h>
 #include <linux/stddef.h>
 #include <linux/slab.h>
index fa5c037227cb2a503c88b0990932a888ca2e8957..0fcac8e7a2b2fb9fdb9f74bdcadf32bd177ceb39 100644 (file)
@@ -65,7 +65,7 @@
 #define pr_fmt(fmt) "IPv4: " fmt
 
 #include <linux/module.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -798,6 +798,7 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf
        struct rtable *rt;
        struct flowi4 fl4;
        const struct iphdr *iph = (const struct iphdr *) skb->data;
+       struct net *net = dev_net(skb->dev);
        int oif = skb->dev->ifindex;
        u8 tos = RT_TOS(iph->tos);
        u8 prot = iph->protocol;
@@ -805,7 +806,7 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf
 
        rt = (struct rtable *) dst;
 
-       __build_flow_key(sock_net(sk), &fl4, sk, iph, oif, tos, prot, mark, 0);
+       __build_flow_key(net, &fl4, sk, iph, oif, tos, prot, mark, 0);
        __ip_do_redirect(rt, skb, &fl4, true);
 }
 
@@ -1913,7 +1914,8 @@ local_input:
                }
        }
 
-       rth = rt_dst_alloc(net->loopback_dev, flags | RTCF_LOCAL, res.type,
+       rth = rt_dst_alloc(l3mdev_master_dev_rcu(dev) ? : net->loopback_dev,
+                          flags | RTCF_LOCAL, res.type,
                           IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache);
        if (!rth)
                goto e_nobufs;
index 80bc36b25de21d5e6b1c3e6f6001258b38656d41..22cbd61079b5a9d2661583b7d96eea46eddb685d 100644 (file)
@@ -432,13 +432,6 @@ static struct ctl_table ipv4_table[] = {
                .extra1         = &tcp_adv_win_scale_min,
                .extra2         = &tcp_adv_win_scale_max,
        },
-       {
-               .procname       = "tcp_tw_reuse",
-               .data           = &sysctl_tcp_tw_reuse,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec
-       },
        {
                .procname       = "tcp_frto",
                .data           = &sysctl_tcp_frto,
@@ -960,6 +953,13 @@ static struct ctl_table ipv4_net_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec,
        },
+       {
+               .procname       = "tcp_tw_reuse",
+               .data           = &init_net.ipv4.sysctl_tcp_tw_reuse,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec
+       },
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
        {
                .procname       = "fib_multipath_use_neigh",
index 1ef3165114ba37c17b3b6cc036543b9951c72b59..4a044964da6670829e5c47fef52d2cd76360b59f 100644 (file)
 #include <net/ip.h>
 #include <net/sock.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ioctls.h>
 #include <net/busy_poll.h>
 
index 30d81f533ada5708a61155b589e3835d9af4128d..fe9da4fb96bf967ab27f5179fc5a9ac3576cc693 100644 (file)
@@ -84,7 +84,6 @@
 #include <crypto/hash.h>
 #include <linux/scatterlist.h>
 
-int sysctl_tcp_tw_reuse __read_mostly;
 int sysctl_tcp_low_latency __read_mostly;
 
 #ifdef CONFIG_TCP_MD5SIG
@@ -120,7 +119,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
           and use initial timestamp retrieved from peer table.
         */
        if (tcptw->tw_ts_recent_stamp &&
-           (!twp || (sysctl_tcp_tw_reuse &&
+           (!twp || (sock_net(sk)->ipv4.sysctl_tcp_tw_reuse &&
                             get_seconds() - tcptw->tw_ts_recent_stamp > 1))) {
                tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2;
                if (tp->write_seq == 0)
@@ -2456,6 +2455,7 @@ static int __net_init tcp_sk_init(struct net *net)
        net->ipv4.sysctl_tcp_orphan_retries = 0;
        net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT;
        net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX;
+       net->ipv4.sysctl_tcp_tw_reuse = 0;
 
        return 0;
 fail:
index b45101f3d2bd2e0f0077305a061add4f7ea0de27..1d5331a1b1dc2677316148ba9852c191e7ed0fd4 100644 (file)
@@ -769,6 +769,7 @@ static void tcp_tasklet_func(unsigned long data)
                list_del(&tp->tsq_node);
 
                sk = (struct sock *)tp;
+               smp_mb__before_atomic();
                clear_bit(TSQ_QUEUED, &sk->sk_tsq_flags);
 
                if (!sk->sk_lock.owned &&
@@ -1037,7 +1038,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
        skb_shinfo(skb)->gso_size = tcp_skb_mss(skb);
 
        /* Our usage of tstamp should remain private */
-       skb->tstamp.tv64 = 0;
+       skb->tstamp = 0;
 
        /* Cleanup our debris for IP stacks */
        memset(skb->cb, 0, max(sizeof(struct inet_skb_parm),
@@ -3202,7 +3203,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
 #endif
 
        /* Do not fool tcpdump (if any), clean our debris */
-       skb->tstamp.tv64 = 0;
+       skb->tstamp = 0;
        return skb;
 }
 EXPORT_SYMBOL(tcp_make_synack);
index 9ca279b130d51f6feaa97785b1c90677581080a5..1307a7c2e5445d37d1d1c4f5fbfd5bf7c29040d7 100644 (file)
@@ -79,7 +79,7 @@
 
 #define pr_fmt(fmt) "UDP: " fmt
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ioctls.h>
 #include <linux/bootmem.h>
 #include <linux/highmem.h>
index 237e654ba717ea642ef14dc7502834ada55a1854..aa42123bc301f9c3877db49a05e6379c715aa384 100644 (file)
@@ -63,7 +63,7 @@
 #include <net/calipso.h>
 #include <net/seg6.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/mroute6.h>
 
 #include "ip6_offload.h"
index 0489e19258adeb86e456c167c77702d8b6efee84..a3eaafd8710091c0484a5c608862d13808d612b3 100644 (file)
@@ -33,7 +33,7 @@
 #include <net/dsfield.h>
 
 #include <linux/errqueue.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static bool ipv6_mapped_addr_any(const struct in6_addr *a)
 {
@@ -701,7 +701,7 @@ void ip6_datagram_recv_specific_ctl(struct sock *sk, struct msghdr *msg,
                struct sockaddr_in6 sin6;
                __be16 *ports = (__be16 *) skb_transport_header(skb);
 
-               if (skb_transport_offset(skb) + 4 <= skb->len) {
+               if (skb_transport_offset(skb) + 4 <= (int)skb->len) {
                        /* All current transport protocols have the port numbers in the
                         * first four bytes of the transport header and this function is
                         * written with this assumption in mind.
index 926818c331e524b4d24da321a076b634a7191f2c..e4198502fd98ce55c1ab6d4d9767b8506b2cf707 100644 (file)
@@ -232,7 +232,7 @@ static bool ipv6_dest_hao(struct sk_buff *skb, int optoff)
        ipv6h->saddr = hao->addr;
        hao->addr = tmp_addr;
 
-       if (skb->tstamp.tv64 == 0)
+       if (skb->tstamp == 0)
                __net_timestamp(skb);
 
        return true;
index 17fa28f7a0ffe85f489ab5000b7936c1330922de..3036f665e6c87f700a7e8fde5518d649413f9940 100644 (file)
@@ -70,7 +70,7 @@
 #include <net/dsfield.h>
 #include <net/l3mdev.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  *     The ICMP socket(s). This is the most convenient way to flow control
index b912f0dbaf724f63d60f2d06dae57eba334c96fa..8081bafe441b83f60f414114bfdc3529d6ea0a09 100644 (file)
@@ -29,7 +29,7 @@
 #include <net/rawv6.h>
 #include <net/transp_v6.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #define FL_MIN_LINGER  6       /* Minimal linger. It is set to 6sec specified
                                   in old IPv6 RFC. Well, it was reasonable value.
index 70d0de4041972ceaeb4656fa4bdef884a5403b10..38122d04fadc646c27a5ccdf0eef5eb6d7923a27 100644 (file)
@@ -1373,7 +1373,7 @@ emsgsize:
         */
 
        cork->length += length;
-       if (((length > mtu) ||
+       if ((((length + fragheaderlen) > mtu) ||
             (skb && skb_is_gso(skb))) &&
            (sk->sk_protocol == IPPROTO_UDP) &&
            (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
index 8b186b56183af5ba2fc77f1a0b4f2b69d62e3669..36d2921809428eb520256dffb39393ed023b7ec7 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/hash.h>
 #include <linux/etherdevice.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/atomic.h>
 
 #include <net/icmp.h>
index 52101b37ad6e48c65dae320f44c1ad6ce0ac098c..604d8953c775966872969a9a5d828d1d9d99067a 100644 (file)
@@ -16,7 +16,7 @@
  *
  */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
index 3ba5303735605077fedc3515163286234b51f141..ee97c44e2aa0074df4bf22790aaf759e3a1390b6 100644 (file)
@@ -54,7 +54,7 @@
 #include <net/compat.h>
 #include <net/seg6.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 struct ip6_ra_chain *ip6_ra_chain;
 DEFINE_RWLOCK(ip6_ra_lock);
index 60c79a08e14a592006aabe8ac120afc32e81347d..64f0f7be9e5e267e9dc303c6b726d9b680e762a6 100644 (file)
@@ -191,7 +191,7 @@ static inline int mip6_report_rl_allow(ktime_t stamp,
        int allow = 0;
 
        spin_lock_bh(&mip6_report_rl.lock);
-       if (!ktime_equal(mip6_report_rl.stamp, stamp) ||
+       if (mip6_report_rl.stamp != stamp ||
            mip6_report_rl.iif != iif ||
            !ipv6_addr_equal(&mip6_report_rl.src, src) ||
            !ipv6_addr_equal(&mip6_report_rl.dst, dst)) {
index d56d8ac09a94db9684d1e0a87a6334ce452b4e54..25a022d41a7035f5350339b17c3cf68517496f85 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/icmpv6.h>
 #include <net/ipv6.h>
 #include <net/compat.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/mutex.h>
 #include <linux/proc_fs.h>
 #include <linux/err.h>
index 291ebc260e70ef7fbb4310d22ed0c915a372d0b5..ea89073c824747f185beb7da0f4aab6b74832149 100644 (file)
@@ -591,7 +591,11 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
        }
 
        offset += skb_transport_offset(skb);
-       BUG_ON(skb_copy_bits(skb, offset, &csum, 2));
+       err = skb_copy_bits(skb, offset, &csum, 2);
+       if (err < 0) {
+               ip6_flush_pending_frames(sk);
+               goto out;
+       }
 
        /* in case cksum was not initialized */
        if (unlikely(csum))
index 890acace01d0a642517b1536598e4482b20a4456..8417c41d8ec8398a72c56f9b37b16d94702cbbf3 100644 (file)
@@ -64,7 +64,7 @@
 #include <net/l3mdev.h>
 #include <trace/events/fib6.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
index 0355231162b85e58c2ccf01af598c1e94cf629c8..fad992ad4bc83e8fa0dbdae194a4f8b54e28efa2 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/if_arp.h>
 #include <linux/icmp.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/init.h>
 #include <linux/netfilter_ipv4.h>
 #include <linux/if_ether.h>
index 649efc26a2527db2e7b6a814a56523dffcb9c0d9..4d5c4eee4b3f506cf030bb9bce20c5b94086e011 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/addrconf.h>
 #include <net/ndisc.h>
index 48d0dc89b58de8aae5f128145634070a77d7c281..8a9219ff2e77e0205de652974a44c5e4ba33b2c0 100644 (file)
@@ -56,7 +56,7 @@
 #include <net/tcp_states.h>
 #include <net/net_namespace.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /* Configuration Variables */
 static unsigned char ipxcfg_max_hops = 16;
@@ -1809,7 +1809,7 @@ static int ipx_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
        rc = skb_copy_datagram_msg(skb, sizeof(struct ipxhdr), msg, copied);
        if (rc)
                goto out_free;
-       if (skb->tstamp.tv64)
+       if (skb->tstamp)
                sk->sk_stamp = skb->tstamp;
 
        if (sipx) {
index 391c3cbd2eed7556960f70af684cd6e58cbabf78..ab254041dab7f60f4395ffb98a41a4646f17a0f5 100644 (file)
@@ -52,7 +52,7 @@
 #include <linux/poll.h>
 
 #include <asm/ioctls.h>                /* TIOCOUTQ, TIOCINQ */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/sock.h>
 #include <net/tcp_states.h>
index 873c4b707d6a5baa8e420fb8c321235697004312..817b1b186aff78de33e9156024b5f2cd26da16a6 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/interrupt.h>
 #include <linux/device.h>              /* for MODULE_ALIAS_CHARDEV_MAJOR */
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/irda/irda.h>
 #include <net/irda/irmod.h>
index 8f5678cb62635cc5c76bba711091929d6054939e..f18070118d05508325a1ac470041208ff75cd93a 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/tty.h>
 #include <linux/serial.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/irda/irda.h>
 #include <net/irda/irmod.h>
index 856736656a304d57e1cb1f1976c8046f698ff519..890b90d055d5a26e81700db46b18f0115101dfdd 100644 (file)
@@ -43,7 +43,7 @@
 #include <linux/export.h>
 
 #include <asm/ioctls.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/dma.h>
 #include <asm/io.h>
 
index c69f0f38f5669de49c7db9ac038a7b8dbe8ff664..9d451f8ed47af2cb5ff3fd0a096439d6960886b1 100644 (file)
 #include <linux/capability.h>
 #include <linux/ctype.h>       /* isspace() */
 #include <linux/string.h>      /* skip_spaces() */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/init.h>
 
 #include <linux/ppp_defs.h>
index 8938b6ba57a037b6f95f9dcfd2461d7c3951cdfb..3d73278b86ca34bfbd774dc8f52e490169445e1b 100644 (file)
@@ -47,7 +47,8 @@ static inline struct l2tp_ip_sock *l2tp_ip_sk(const struct sock *sk)
        return (struct l2tp_ip_sock *)sk;
 }
 
-static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id)
+static struct sock *__l2tp_ip_bind_lookup(const struct net *net, __be32 laddr,
+                                         __be32 raddr, int dif, u32 tunnel_id)
 {
        struct sock *sk;
 
@@ -61,6 +62,7 @@ static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif
                if ((l2tp->conn_id == tunnel_id) &&
                    net_eq(sock_net(sk), net) &&
                    !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
+                   (!inet->inet_daddr || !raddr || inet->inet_daddr == raddr) &&
                    (!sk->sk_bound_dev_if || !dif ||
                     sk->sk_bound_dev_if == dif))
                        goto found;
@@ -71,15 +73,6 @@ found:
        return sk;
 }
 
-static inline struct sock *l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id)
-{
-       struct sock *sk = __l2tp_ip_bind_lookup(net, laddr, dif, tunnel_id);
-       if (sk)
-               sock_hold(sk);
-
-       return sk;
-}
-
 /* When processing receive frames, there are two cases to
  * consider. Data frames consist of a non-zero session-id and an
  * optional cookie. Control frames consist of a regular L2TP header
@@ -183,8 +176,8 @@ pass_up:
                struct iphdr *iph = (struct iphdr *) skb_network_header(skb);
 
                read_lock_bh(&l2tp_ip_lock);
-               sk = __l2tp_ip_bind_lookup(net, iph->daddr, inet_iif(skb),
-                                          tunnel_id);
+               sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr,
+                                          inet_iif(skb), tunnel_id);
                if (!sk) {
                        read_unlock_bh(&l2tp_ip_lock);
                        goto discard;
@@ -280,7 +273,7 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
                inet->inet_saddr = 0;  /* Use device */
 
        write_lock_bh(&l2tp_ip_lock);
-       if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr,
+       if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, 0,
                                  sk->sk_bound_dev_if, addr->l2tp_conn_id)) {
                write_unlock_bh(&l2tp_ip_lock);
                ret = -EADDRINUSE;
index f092ac441fdda5cdaf294005d28d586c216d2f26..331ccf5a7bad80e011997e071489d7775b0c68c6 100644 (file)
@@ -59,12 +59,14 @@ static inline struct l2tp_ip6_sock *l2tp_ip6_sk(const struct sock *sk)
 
 static struct sock *__l2tp_ip6_bind_lookup(struct net *net,
                                           struct in6_addr *laddr,
+                                          const struct in6_addr *raddr,
                                           int dif, u32 tunnel_id)
 {
        struct sock *sk;
 
        sk_for_each_bound(sk, &l2tp_ip6_bind_table) {
-               const struct in6_addr *addr = inet6_rcv_saddr(sk);
+               const struct in6_addr *sk_laddr = inet6_rcv_saddr(sk);
+               const struct in6_addr *sk_raddr = &sk->sk_v6_daddr;
                struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk);
 
                if (l2tp == NULL)
@@ -72,7 +74,8 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net,
 
                if ((l2tp->conn_id == tunnel_id) &&
                    net_eq(sock_net(sk), net) &&
-                   (!addr || ipv6_addr_equal(addr, laddr)) &&
+                   (!sk_laddr || ipv6_addr_any(sk_laddr) || ipv6_addr_equal(sk_laddr, laddr)) &&
+                   (!raddr || ipv6_addr_any(sk_raddr) || ipv6_addr_equal(sk_raddr, raddr)) &&
                    (!sk->sk_bound_dev_if || !dif ||
                     sk->sk_bound_dev_if == dif))
                        goto found;
@@ -83,17 +86,6 @@ found:
        return sk;
 }
 
-static inline struct sock *l2tp_ip6_bind_lookup(struct net *net,
-                                               struct in6_addr *laddr,
-                                               int dif, u32 tunnel_id)
-{
-       struct sock *sk = __l2tp_ip6_bind_lookup(net, laddr, dif, tunnel_id);
-       if (sk)
-               sock_hold(sk);
-
-       return sk;
-}
-
 /* When processing receive frames, there are two cases to
  * consider. Data frames consist of a non-zero session-id and an
  * optional cookie. Control frames consist of a regular L2TP header
@@ -197,8 +189,8 @@ pass_up:
                struct ipv6hdr *iph = ipv6_hdr(skb);
 
                read_lock_bh(&l2tp_ip6_lock);
-               sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, inet6_iif(skb),
-                                           tunnel_id);
+               sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, &iph->saddr,
+                                           inet6_iif(skb), tunnel_id);
                if (!sk) {
                        read_unlock_bh(&l2tp_ip6_lock);
                        goto discard;
@@ -330,7 +322,7 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
        rcu_read_unlock();
 
        write_lock_bh(&l2tp_ip6_lock);
-       if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, bound_dev_if,
+       if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, NULL, bound_dev_if,
                                   addr->l2tp_conn_id)) {
                write_unlock_bh(&l2tp_ip6_lock);
                err = -EADDRINUSE;
index fc60d9d738b57b94bdbae1b5d20ec24295b87190..b50b64ac8815600fa66c0fd81b63a3594a2cfa82 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/skbuff.h>
 #include <linux/slab.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 182470847fcf739e5906cbbc3be44f97fe4a5f8f..d5d2110eb717361f54416a5854d9b5fed7deaf4e 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/skbuff.h>
 #include <linux/slab.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 482c94d9d958a6c32885626c6ed86ec59e2c9c79..eda726e22f64548f8613a2156b218af294d019a7 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/skbuff.h>
 #include <linux/slab.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 3c1914df641f28d9a7298b30e6a2f14b50ed9092..75efde3e616c70cbdb7c6860cb08108011e2fb0e 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/skbuff.h>
 #include <linux/slab.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 355cc3b6fa4d3e4040bf9fb1578fc43c6c4f7b52..1a5535bc3b8d889ef237232f8e8ea00f373a3865 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/inet.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 2c21b7039136fe467845df5494432b58a6a226fc..0d8b716e509edca48fbc65ceaf06e6b7d6a2c189 100644 (file)
@@ -3287,7 +3287,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
        int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
        int hw_headroom = sdata->local->hw.extra_tx_headroom;
        struct ethhdr eth;
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_tx_info *info;
        struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
        struct ieee80211_tx_data tx;
        ieee80211_tx_result r;
@@ -3351,6 +3351,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
        memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN);
        memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN);
 
+       info = IEEE80211_SKB_CB(skb);
        memset(info, 0, sizeof(*info));
        info->band = fast_tx->band;
        info->control.vif = &sdata->vif;
index f9fd0957ab67f256d10e80563bb68ce88334f911..7c03fb0ea34cb8b5d46cb68779fa24d6dc276bc7 100644 (file)
@@ -80,11 +80,11 @@ void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
 
                if (skb->len > max_sifs_size)
                        hrtimer_start(&local->ifs_timer,
-                                     ktime_set(0, hw->phy->lifs_period * NSEC_PER_USEC),
+                                     hw->phy->lifs_period * NSEC_PER_USEC,
                                      HRTIMER_MODE_REL);
                else
                        hrtimer_start(&local->ifs_timer,
-                                     ktime_set(0, hw->phy->sifs_period * NSEC_PER_USEC),
+                                     hw->phy->sifs_period * NSEC_PER_USEC,
                                      HRTIMER_MODE_REL);
        } else {
                ieee802154_wake_queue(hw);
index 3d02b0c1354766c60e08a42fe66926b80dd2680f..55e0169caa4ce2fe81f0c9f1199c2be84c986b58 100644 (file)
@@ -48,7 +48,7 @@
 #include <net/sock.h>
 #include <net/genetlink.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <net/ip_vs.h>
 
index 6a0bbfa8e7020d8f2f004e6659141731dbf3342f..3a073cd9fcf49ed9cfd228a420cc2de928ca4459 100644 (file)
@@ -783,7 +783,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
        /* set conntrack timestamp, if enabled. */
        tstamp = nf_conn_tstamp_find(ct);
        if (tstamp) {
-               if (skb->tstamp.tv64 == 0)
+               if (skb->tstamp == 0)
                        __net_timestamp(skb);
 
                tstamp->start = ktime_to_ns(skb->tstamp);
index 2278d9ab723bf1c3a2b199db6fc9519e9c59e1be..a09fa9fd8f3d98b2f3dd8479b861db4e71b37cf5 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/sockios.h>
 #include <linux/net.h>
 #include <linux/skbuff.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <net/sock.h>
 #include <linux/init.h>
 
index 200922bb20366a644e649ec99c736d0d77fda142..08247bf7d7b836828c8151ed07f438e05973c2c0 100644 (file)
@@ -538,7 +538,7 @@ __build_packet_message(struct nfnl_log_net *log,
                        goto nla_put_failure;
        }
 
-       if (skb->tstamp.tv64) {
+       if (skb->tstamp) {
                struct nfulnl_msg_packet_timestamp ts;
                struct timespec64 kts = ktime_to_timespec64(skb->tstamp);
                ts.sec = cpu_to_be64(kts.tv_sec);
index be7627b8040057c4b06b5961e7cae4c0c5b10d66..3ee0b8a000a41ec901faeb239e752a126428dc4d 100644 (file)
@@ -384,7 +384,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
                + nla_total_size(sizeof(u_int32_t))     /* skbinfo */
                + nla_total_size(sizeof(u_int32_t));    /* cap_len */
 
-       if (entskb->tstamp.tv64)
+       if (entskb->tstamp)
                size += nla_total_size(sizeof(struct nfqnl_msg_packet_timestamp));
 
        size += nfqnl_get_bridge_size(entry);
@@ -555,7 +555,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
        if (nfqnl_put_bridge(entry, skb) < 0)
                goto nla_put_failure;
 
-       if (entskb->tstamp.tv64) {
+       if (entskb->tstamp) {
                struct nfqnl_msg_packet_timestamp ts;
                struct timespec64 kts = ktime_to_timespec64(entskb->tstamp);
 
index 0ae55a36f492902ef19753c336160b453ef0cd34..1b01eec1fbda5368e31a8b3917286d8b05a4604c 100644 (file)
@@ -168,7 +168,7 @@ time_mt(const struct sk_buff *skb, struct xt_action_param *par)
         * may happen that the same packet matches both rules if
         * it arrived at the right moment before 13:00.
         */
-       if (skb->tstamp.tv64 == 0)
+       if (skb->tstamp == 0)
                __net_timestamp((struct sk_buff *)skb);
 
        stamp = ktime_to_ns(skb->tstamp);
index 801d474de75b4742121987efb7940433ea3045c0..161b628ab2b08bf4321dbe617022c4c50486534d 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/net.h>
 #include <linux/fs.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/rtnetlink.h>
index 2d4c4d3911c02ce91de79ac4c9ad4923d4bc2329..9c62b6325f7adc92420b605cf4cdc3b26da437fc 100644 (file)
@@ -606,7 +606,6 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
        rcu_assign_pointer(flow->sf_acts, acts);
        packet->priority = flow->key.phy.priority;
        packet->mark = flow->key.phy.skb_mark;
-       packet->protocol = flow->key.eth.type;
 
        rcu_read_lock();
        dp = get_dp_rcu(net, ovs_header->dp_ifindex);
index 08aa926cd5cfe5f6b3f47f3dc4df5c970a6ba2a7..2c0a00f7f1b7d195b98f70e6ec0235b650a63311 100644 (file)
@@ -312,7 +312,8 @@ static bool icmp6hdr_ok(struct sk_buff *skb)
  * Returns 0 if it encounters a non-vlan or incomplete packet.
  * Returns 1 after successfully parsing vlan tag.
  */
-static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh)
+static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh,
+                         bool untag_vlan)
 {
        struct vlan_head *vh = (struct vlan_head *)skb->data;
 
@@ -330,7 +331,20 @@ static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh)
        key_vh->tci = vh->tci | htons(VLAN_TAG_PRESENT);
        key_vh->tpid = vh->tpid;
 
-       __skb_pull(skb, sizeof(struct vlan_head));
+       if (unlikely(untag_vlan)) {
+               int offset = skb->data - skb_mac_header(skb);
+               u16 tci;
+               int err;
+
+               __skb_push(skb, offset);
+               err = __skb_vlan_pop(skb, &tci);
+               __skb_pull(skb, offset);
+               if (err)
+                       return err;
+               __vlan_hwaccel_put_tag(skb, key_vh->tpid, tci);
+       } else {
+               __skb_pull(skb, sizeof(struct vlan_head));
+       }
        return 1;
 }
 
@@ -351,13 +365,13 @@ static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key)
                key->eth.vlan.tpid = skb->vlan_proto;
        } else {
                /* Parse outer vlan tag in the non-accelerated case. */
-               res = parse_vlan_tag(skb, &key->eth.vlan);
+               res = parse_vlan_tag(skb, &key->eth.vlan, true);
                if (res <= 0)
                        return res;
        }
 
        /* Parse inner vlan tag. */
-       res = parse_vlan_tag(skb, &key->eth.cvlan);
+       res = parse_vlan_tag(skb, &key->eth.cvlan, false);
        if (res <= 0)
                return res;
 
@@ -800,29 +814,15 @@ int ovs_flow_key_extract_userspace(struct net *net, const struct nlattr *attr,
        if (err)
                return err;
 
-       if (ovs_key_mac_proto(key) == MAC_PROTO_NONE) {
-               /* key_extract assumes that skb->protocol is set-up for
-                * layer 3 packets which is the case for other callers,
-                * in particular packets recieved from the network stack.
-                * Here the correct value can be set from the metadata
-                * extracted above.
-                */
-               skb->protocol = key->eth.type;
-       } else {
-               struct ethhdr *eth;
-
-               skb_reset_mac_header(skb);
-               eth = eth_hdr(skb);
-
-               /* Normally, setting the skb 'protocol' field would be
-                * handled by a call to eth_type_trans(), but it assumes
-                * there's a sending device, which we may not have.
-                */
-               if (eth_proto_is_802_3(eth->h_proto))
-                       skb->protocol = eth->h_proto;
-               else
-                       skb->protocol = htons(ETH_P_802_2);
-       }
+       /* key_extract assumes that skb->protocol is set-up for
+        * layer 3 packets which is the case for other callers,
+        * in particular packets received from the network stack.
+        * Here the correct value can be set from the metadata
+        * extracted above.
+        * For L2 packet key eth type would be zero. skb protocol
+        * would be set to correct value later during key-extact.
+        */
 
+       skb->protocol = key->eth.type;
        return key_extract(skb, key);
 }
index 49cd0c70a13ac666445c6e15f2bd88fc1532df38..b9e1a13b4ba36a0bc7edf6a8c2c116c7d48c970c 100644 (file)
@@ -73,7 +73,7 @@
 #include <net/sock.h>
 #include <linux/errno.h>
 #include <linux/timer.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ioctls.h>
 #include <asm/page.h>
 #include <asm/cacheflush.h>
index 129d357d27229f4f819c2e104c913cd04be4a28e..9ad301c46b888f0c49709ba9e7718258d72f7949 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/if_arp.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/termios.h>
 #include <linux/mm.h>
index 0fc76d845103888b326fbb85f30edfe8f15bbb2e..452bbb38d9432b5139be52b7a0b8b8d261135e93 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/skbuff.h>
 #include <net/sock.h>
 #include <net/tcp_states.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/termios.h>     /* For TIOCINQ/OUTQ */
 #include <linux/mm.h>
index 7af712526f01eaa9ed77f33ff6030a2fe7253713..e3a58e02119877d237f9aa18c5f9d9fdfb44d0c9 100644 (file)
@@ -134,8 +134,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
                        saddr = nla_get_in6_addr(tb[TCA_TUNNEL_KEY_ENC_IPV6_SRC]);
                        daddr = nla_get_in6_addr(tb[TCA_TUNNEL_KEY_ENC_IPV6_DST]);
 
-                       metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, 0,
-                                                     dst_port, TUNNEL_KEY,
+                       metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, dst_port,
+                                                     0, TUNNEL_KEY,
                                                      key_id, 0);
                }
 
index 3fbba79a4ef0521604df48275fb7dae8a8b7099e..1ecdf809b5fa8913d56bb4194ac193274d4d625a 100644 (file)
@@ -148,13 +148,15 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
        unsigned long cl;
        unsigned long fh;
        int err;
-       int tp_created = 0;
+       int tp_created;
 
        if ((n->nlmsg_type != RTM_GETTFILTER) &&
            !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
                return -EPERM;
 
 replay:
+       tp_created = 0;
+
        err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL);
        if (err < 0)
                return err;
index 35ac28d0720cb89310cea548bed003957bb10a46..970db7a41684aa2a494b97663f91ca932308de05 100644 (file)
@@ -153,10 +153,14 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 
                switch (ip_tunnel_info_af(info)) {
                case AF_INET:
+                       skb_key.enc_control.addr_type =
+                               FLOW_DISSECTOR_KEY_IPV4_ADDRS;
                        skb_key.enc_ipv4.src = key->u.ipv4.src;
                        skb_key.enc_ipv4.dst = key->u.ipv4.dst;
                        break;
                case AF_INET6:
+                       skb_key.enc_control.addr_type =
+                               FLOW_DISSECTOR_KEY_IPV6_ADDRS;
                        skb_key.enc_ipv6.src = key->u.ipv6.src;
                        skb_key.enc_ipv6.dst = key->u.ipv6.dst;
                        break;
@@ -442,32 +446,32 @@ static void fl_set_key_flag(u32 flower_key, u32 flower_mask,
        }
 }
 
-static void fl_set_key_flags(struct nlattr **tb,
-                            u32 *flags_key, u32 *flags_mask)
+static int fl_set_key_flags(struct nlattr **tb,
+                           u32 *flags_key, u32 *flags_mask)
 {
        u32 key, mask;
 
-       if (!tb[TCA_FLOWER_KEY_FLAGS])
-               return;
+       /* mask is mandatory for flags */
+       if (!tb[TCA_FLOWER_KEY_FLAGS_MASK])
+               return -EINVAL;
 
        key = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS]));
-
-       if (!tb[TCA_FLOWER_KEY_FLAGS_MASK])
-               mask = ~0;
-       else
-               mask = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS_MASK]));
+       mask = be32_to_cpu(nla_get_u32(tb[TCA_FLOWER_KEY_FLAGS_MASK]));
 
        *flags_key  = 0;
        *flags_mask = 0;
 
        fl_set_key_flag(key, mask, flags_key, flags_mask,
                        TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT, FLOW_DIS_IS_FRAGMENT);
+
+       return 0;
 }
 
 static int fl_set_key(struct net *net, struct nlattr **tb,
                      struct fl_flow_key *key, struct fl_flow_key *mask)
 {
        __be16 ethertype;
+       int ret = 0;
 #ifdef CONFIG_NET_CLS_IND
        if (tb[TCA_FLOWER_INDEV]) {
                int err = tcf_change_indev(net, tb[TCA_FLOWER_INDEV]);
@@ -614,9 +618,10 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
                       &mask->enc_tp.dst, TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK,
                       sizeof(key->enc_tp.dst));
 
-       fl_set_key_flags(tb, &key->control.flags, &mask->control.flags);
+       if (tb[TCA_FLOWER_KEY_FLAGS])
+               ret = fl_set_key_flags(tb, &key->control.flags, &mask->control.flags);
 
-       return 0;
+       return ret;
 }
 
 static bool fl_mask_eq(struct fl_flow_mask *mask1,
index 9ffe1c220b02848032474fa7b9b2c2f09d40b110..f1207582cbf3005f08af70275d6c1b217f60f26a 100644 (file)
@@ -509,7 +509,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer)
        if (delay) {
                ktime_t time;
 
-               time = ktime_set(0, 0);
+               time = 0;
                time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay));
                hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS_PINNED);
        }
index b7e4097bfdab22dc0f43b314aadf3c001cc3b24f..bcfadfdea8e0928ba6f9615e919c5411dfd948d3 100644 (file)
@@ -627,7 +627,7 @@ deliver:
                         * from the network (tstamp will be updated).
                         */
                        if (G_TC_FROM(skb->tc_verd) & AT_INGRESS)
-                               skb->tstamp.tv64 = 0;
+                               skb->tstamp = 0;
 #endif
 
                        if (q->qdisc) {
index 68428e1f71810fbe65b7f86c750c3ad61f0266ec..d3cc30c25c41091c2bf18022506dff4145d29944 100644 (file)
@@ -1471,7 +1471,7 @@ void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len)
         * threshold.  The idea is to recover slowly, but up
         * to the initial advertised window.
         */
-       if (asoc->rwnd_press && asoc->rwnd >= asoc->rwnd_press) {
+       if (asoc->rwnd_press) {
                int change = min(asoc->pathmtu, asoc->rwnd_press);
                asoc->rwnd += change;
                asoc->rwnd_press -= change;
@@ -1539,7 +1539,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)
                        asoc->rwnd = 0;
                }
        } else {
-               asoc->rwnd_over = len - asoc->rwnd;
+               asoc->rwnd_over += len - asoc->rwnd;
                asoc->rwnd = 0;
        }
 
index 176af3080a2b8f8ffc56b55f3ccb13a169e195fe..5ed8e79bf102e1c2a9ef1955aee6dba01869545e 100644 (file)
@@ -71,7 +71,7 @@
 #include <net/inet_ecn.h>
 #include <net/sctp/sctp.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
                                         union sctp_addr *s2);
index ce54dce13ddb2cba959bca080b06f9285f2fe16d..a1652ab63918940be605eaf002b5506f5e4e6673 100644 (file)
@@ -72,7 +72,7 @@ static struct sctp_transport *sctp_transport_init(struct net *net,
         */
        peer->rto = msecs_to_jiffies(net->sctp.rto_initial);
 
-       peer->last_time_heard = ktime_set(0, 0);
+       peer->last_time_heard = 0;
        peer->last_time_ecne_reduced = jiffies;
 
        peer->param_flags = SPP_HB_DISABLE |
index dc01d7be2fdad6f444358eef3711c548af6c369c..a8c2307590b87ce5774f275fcbc1397f095d4c27 100644 (file)
@@ -90,7 +90,7 @@
 #include <linux/slab.h>
 #include <linux/xattr.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/unistd.h>
 
 #include <net/compat.h>
@@ -537,7 +537,7 @@ int sockfs_setattr(struct dentry *dentry, struct iattr *iattr)
 {
        int err = simple_setattr(dentry, iattr);
 
-       if (!err) {
+       if (!err && (iattr->ia_valid & ATTR_UID)) {
                struct socket *sock = SOCKET_I(d_inode(dentry));
 
                sock->sk->sk_uid = iattr->ia_uid;
@@ -668,7 +668,7 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
 
        /* Race occurred between timestamp enabling and packet
           receiving.  Fill in the current time for now. */
-       if (need_software_tstamp && skb->tstamp.tv64 == 0)
+       if (need_software_tstamp && skb->tstamp == 0)
                __net_timestamp(skb);
 
        if (need_software_tstamp) {
index 16cea00c959b65e43cc52c1a2d6712ff970cf682..cdeb1d81483350549fc558c0331ee2aa45a5c9c2 100644 (file)
@@ -50,7 +50,7 @@
 #include <linux/workqueue.h>
 #include <linux/sunrpc/rpc_pipe_fs.h>
 #include <linux/sunrpc/gss_api.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/hashtable.h>
 
 #include "../netns.h"
index 8aabe12201f8a069f788b2828735a98fc81c39ef..8147e8d56eb214667a9d27a946bacde32637653d 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/module.h>
 #include <linux/ctype.h>
 #include <linux/string_helpers.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/poll.h>
 #include <linux/seq_file.h>
 #include <linux/proc_fs.h>
index 135ec2c11b3bff23732bd1850cdd65a5ca5d5ab6..de066acdb34e322fd0ffa78da3e65d380c2f4fc2 100644 (file)
@@ -42,7 +42,7 @@
 #include <net/udp.h>
 #include <net/tcp.h>
 #include <net/tcp_states.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/ioctls.h>
 #include <trace/events/skb.h>
 
@@ -574,7 +574,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
        }
        len = svc_addr_len(svc_addr(rqstp));
        rqstp->rq_addrlen = len;
-       if (skb->tstamp.tv64 == 0) {
+       if (skb->tstamp == 0) {
                skb->tstamp = ktime_get_real();
                /* Don't enable netstamp, sunrpc doesn't
                   need that much accuracy */
index c88d9bc06f5c6cc32f8e2e55751038429d4720f2..8c3936403fea40826f6bd24200cbaf095c947ff0 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/sysctl.h>
 #include <linux/module.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/sunrpc/types.h>
 #include <linux/sunrpc/sched.h>
 #include <linux/sunrpc/stats.h>
index 333c5dae0072aa3f7a517ec3f345a4a1f60ca5ad..800caaa699a1669f6efe228e51974e6e2bd19e60 100644 (file)
@@ -441,15 +441,19 @@ static void __tipc_shutdown(struct socket *sock, int error)
        while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) {
                if (TIPC_SKB_CB(skb)->bytes_read) {
                        kfree_skb(skb);
-               } else {
-                       if (!tipc_sk_type_connectionless(sk) &&
-                           sk->sk_state != TIPC_DISCONNECTING) {
-                               tipc_set_sk_state(sk, TIPC_DISCONNECTING);
-                               tipc_node_remove_conn(net, dnode, tsk->portid);
-                       }
-                       tipc_sk_respond(sk, skb, error);
+                       continue;
+               }
+               if (!tipc_sk_type_connectionless(sk) &&
+                   sk->sk_state != TIPC_DISCONNECTING) {
+                       tipc_set_sk_state(sk, TIPC_DISCONNECTING);
+                       tipc_node_remove_conn(net, dnode, tsk->portid);
                }
+               tipc_sk_respond(sk, skb, error);
        }
+
+       if (tipc_sk_type_connectionless(sk))
+               return;
+
        if (sk->sk_state != TIPC_DISCONNECTING) {
                skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE,
                                      TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode,
@@ -457,10 +461,8 @@ static void __tipc_shutdown(struct socket *sock, int error)
                                      tsk->portid, error);
                if (skb)
                        tipc_node_xmit_skb(net, skb, dnode, tsk->portid);
-               if (!tipc_sk_type_connectionless(sk)) {
-                       tipc_node_remove_conn(net, dnode, tsk->portid);
-                       tipc_set_sk_state(sk, TIPC_DISCONNECTING);
-               }
+               tipc_node_remove_conn(net, dnode, tsk->portid);
+               tipc_set_sk_state(sk, TIPC_DISCONNECTING);
        }
 }
 
index 310882fb698e83c854ebe0b93795399fd262245c..127656ebe7be47af8ebb8ea288340177fd068049 100644 (file)
 #include <linux/in.h>
 #include <linux/fs.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <net/net_namespace.h>
index f83b74d3e2acf733864b6a9ddd0f6b7cd41fa4ef..079c883aa96e5a608fbee7edab8b0ef65519ce18 100644 (file)
@@ -51,7 +51,7 @@
 #include <linux/slab.h>
 #include <net/sock.h>
 #include <net/tcp_states.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/fcntl.h>
 #include <linux/termios.h>     /* For TIOCINQ/OUTQ */
 #include <linux/notifier.h>
index fd5ffb25873f35c981ec5b245d0670338dbcda12..bcaa180d6a3f6228b5006a30089a0aca4d82c63d 100644 (file)
@@ -29,7 +29,7 @@
 #include <linux/slab.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/init.h>
 #include <net/x25.h>
 
index 45cb7c699b65ba4e1c928e94c1a65d8ee7a8ef96..64e3c82eedf6bbe0e6817d008fd661bdef8cca91 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/module.h>
 #include <linux/cache.h>
 #include <linux/audit.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/ktime.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
@@ -1404,7 +1404,7 @@ int xfrm_state_check_expire(struct xfrm_state *x)
        if (x->curlft.bytes >= x->lft.hard_byte_limit ||
            x->curlft.packets >= x->lft.hard_packet_limit) {
                x->km.state = XFRM_STATE_EXPIRED;
-               tasklet_hrtimer_start(&x->mtimer, ktime_set(0, 0), HRTIMER_MODE_REL);
+               tasklet_hrtimer_start(&x->mtimer, 0, HRTIMER_MODE_REL);
                return -EINVAL;
        }
 
index 671a1d0333f0d2c828c757944016cbe48836ec72..9705c279494b248b759155d671cfbc778fa25058 100644 (file)
@@ -27,7 +27,7 @@
 #include <net/xfrm.h>
 #include <net/netlink.h>
 #include <net/ah.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #if IS_ENABLED(CONFIG_IPV6)
 #include <linux/in6.h>
 #endif
index a6d2a43bbf2e290368410a6338abefecfa114f54..b124f62ed6cb30b0e89a2d698dc6a346b65e6b62 100644 (file)
@@ -105,4 +105,11 @@ config SAMPLE_BLACKFIN_GPTIMERS
        help
          Build samples of blackfin gptimers sample module.
 
+config SAMPLE_VFIO_MDEV_MTTY
+       tristate "Build VFIO mtty example mediated device sample code -- loadable modules only"
+       depends on VFIO_MDEV_DEVICE && m
+       help
+         Build a virtual tty sample driver for use as a VFIO
+         mediated device
+
 endif # SAMPLES
index e17d66d77f099c48f88bdc8518ca34c45b39cf29..86a137e451d978bec15778e13766648b6cfb3f18 100644 (file)
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_SAMPLES)  += kobject/ kprobes/ trace_events/ livepatch/ \
                           hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \
-                          configfs/ connector/ v4l/ trace_printk/ blackfin/
+                          configfs/ connector/ v4l/ trace_printk/ blackfin/ \
+                          vfio-mdev/
index 13315ff1193c1c9a7ea4ce675f9c19c8ea08cef0..09e9d535bd7487d81574cf8572a41b6e697566fd 100644 (file)
@@ -35,40 +35,43 @@ hostprogs-y += tc_l2_redirect
 hostprogs-y += lwt_len_hist
 hostprogs-y += xdp_tx_iptunnel
 
-test_lru_dist-objs := test_lru_dist.o libbpf.o
-sock_example-objs := sock_example.o libbpf.o
-fds_example-objs := bpf_load.o libbpf.o fds_example.o
-sockex1-objs := bpf_load.o libbpf.o sockex1_user.o
-sockex2-objs := bpf_load.o libbpf.o sockex2_user.o
-sockex3-objs := bpf_load.o libbpf.o sockex3_user.o
-tracex1-objs := bpf_load.o libbpf.o tracex1_user.o
-tracex2-objs := bpf_load.o libbpf.o tracex2_user.o
-tracex3-objs := bpf_load.o libbpf.o tracex3_user.o
-tracex4-objs := bpf_load.o libbpf.o tracex4_user.o
-tracex5-objs := bpf_load.o libbpf.o tracex5_user.o
-tracex6-objs := bpf_load.o libbpf.o tracex6_user.o
-test_probe_write_user-objs := bpf_load.o libbpf.o test_probe_write_user_user.o
-trace_output-objs := bpf_load.o libbpf.o trace_output_user.o
-lathist-objs := bpf_load.o libbpf.o lathist_user.o
-offwaketime-objs := bpf_load.o libbpf.o offwaketime_user.o
-spintest-objs := bpf_load.o libbpf.o spintest_user.o
-map_perf_test-objs := bpf_load.o libbpf.o map_perf_test_user.o
-test_overhead-objs := bpf_load.o libbpf.o test_overhead_user.o
-test_cgrp2_array_pin-objs := libbpf.o test_cgrp2_array_pin.o
-test_cgrp2_attach-objs := libbpf.o test_cgrp2_attach.o
-test_cgrp2_attach2-objs := libbpf.o test_cgrp2_attach2.o cgroup_helpers.o
-test_cgrp2_sock-objs := libbpf.o test_cgrp2_sock.o
-test_cgrp2_sock2-objs := bpf_load.o libbpf.o test_cgrp2_sock2.o
-xdp1-objs := bpf_load.o libbpf.o xdp1_user.o
+# Libbpf dependencies
+LIBBPF := ../../tools/lib/bpf/bpf.o
+
+test_lru_dist-objs := test_lru_dist.o $(LIBBPF)
+sock_example-objs := sock_example.o $(LIBBPF)
+fds_example-objs := bpf_load.o $(LIBBPF) fds_example.o
+sockex1-objs := bpf_load.o $(LIBBPF) sockex1_user.o
+sockex2-objs := bpf_load.o $(LIBBPF) sockex2_user.o
+sockex3-objs := bpf_load.o $(LIBBPF) sockex3_user.o
+tracex1-objs := bpf_load.o $(LIBBPF) tracex1_user.o
+tracex2-objs := bpf_load.o $(LIBBPF) tracex2_user.o
+tracex3-objs := bpf_load.o $(LIBBPF) tracex3_user.o
+tracex4-objs := bpf_load.o $(LIBBPF) tracex4_user.o
+tracex5-objs := bpf_load.o $(LIBBPF) tracex5_user.o
+tracex6-objs := bpf_load.o $(LIBBPF) tracex6_user.o
+test_probe_write_user-objs := bpf_load.o $(LIBBPF) test_probe_write_user_user.o
+trace_output-objs := bpf_load.o $(LIBBPF) trace_output_user.o
+lathist-objs := bpf_load.o $(LIBBPF) lathist_user.o
+offwaketime-objs := bpf_load.o $(LIBBPF) offwaketime_user.o
+spintest-objs := bpf_load.o $(LIBBPF) spintest_user.o
+map_perf_test-objs := bpf_load.o $(LIBBPF) map_perf_test_user.o
+test_overhead-objs := bpf_load.o $(LIBBPF) test_overhead_user.o
+test_cgrp2_array_pin-objs := $(LIBBPF) test_cgrp2_array_pin.o
+test_cgrp2_attach-objs := $(LIBBPF) test_cgrp2_attach.o
+test_cgrp2_attach2-objs := $(LIBBPF) test_cgrp2_attach2.o cgroup_helpers.o
+test_cgrp2_sock-objs := $(LIBBPF) test_cgrp2_sock.o
+test_cgrp2_sock2-objs := bpf_load.o $(LIBBPF) test_cgrp2_sock2.o
+xdp1-objs := bpf_load.o $(LIBBPF) xdp1_user.o
 # reuse xdp1 source intentionally
-xdp2-objs := bpf_load.o libbpf.o xdp1_user.o
-test_current_task_under_cgroup-objs := bpf_load.o libbpf.o cgroup_helpers.o \
+xdp2-objs := bpf_load.o $(LIBBPF) xdp1_user.o
+test_current_task_under_cgroup-objs := bpf_load.o $(LIBBPF) cgroup_helpers.o \
                                       test_current_task_under_cgroup_user.o
-trace_event-objs := bpf_load.o libbpf.o trace_event_user.o
-sampleip-objs := bpf_load.o libbpf.o sampleip_user.o
-tc_l2_redirect-objs := bpf_load.o libbpf.o tc_l2_redirect_user.o
-lwt_len_hist-objs := bpf_load.o libbpf.o lwt_len_hist_user.o
-xdp_tx_iptunnel-objs := bpf_load.o libbpf.o xdp_tx_iptunnel_user.o
+trace_event-objs := bpf_load.o $(LIBBPF) trace_event_user.o
+sampleip-objs := bpf_load.o $(LIBBPF) sampleip_user.o
+tc_l2_redirect-objs := bpf_load.o $(LIBBPF) tc_l2_redirect_user.o
+lwt_len_hist-objs := bpf_load.o $(LIBBPF) lwt_len_hist_user.o
+xdp_tx_iptunnel-objs := bpf_load.o $(LIBBPF) xdp_tx_iptunnel_user.o
 
 # Tell kbuild to always build the programs
 always := $(hostprogs-y)
@@ -104,7 +107,10 @@ always += lwt_len_hist_kern.o
 always += xdp_tx_iptunnel_kern.o
 
 HOSTCFLAGS += -I$(objtree)/usr/include
+HOSTCFLAGS += -I$(srctree)/tools/lib/
 HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/
+HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include
+HOSTCFLAGS += -I$(srctree)/tools/perf
 
 HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable
 HOSTLOADLIBES_fds_example += -lelf
index a43eae3f05518765a7a7a8b38410753d2ef494d0..79f9a58f1872714ce6dd1047cb9d1dbd8842ad60 100644 (file)
@@ -1,8 +1,8 @@
 eBPF sample programs
 ====================
 
-This directory contains a mini eBPF library, test stubs, verifier
-test-suite and examples for using eBPF.
+This directory contains a test stubs, verifier test-suite and examples
+for using eBPF. The examples use libbpf from tools/lib/bpf.
 
 Build dependencies
 ==================
index e30b6de94f2ee393afc1f9feb23d0a461a46a7da..396e204888b34f342bd8f01afc4e0d1a3d52f823 100644 (file)
 #include <poll.h>
 #include <ctype.h>
 #include "libbpf.h"
-#include "bpf_helpers.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 #define DEBUGFS "/sys/kernel/debug/tracing/"
 
 static char license[128];
 static int kern_version;
 static bool processed_sec[128];
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
 int map_fd[MAX_MAPS];
 int prog_fd[MAX_PROGS];
 int event_fd[MAX_PROGS];
 int prog_cnt;
 int prog_array_fd = -1;
 
+struct bpf_map_def {
+       unsigned int type;
+       unsigned int key_size;
+       unsigned int value_size;
+       unsigned int max_entries;
+       unsigned int map_flags;
+};
+
 static int populate_prog_array(const char *event, int prog_fd)
 {
        int ind = atoi(event), err;
 
-       err = bpf_update_elem(prog_array_fd, &ind, &prog_fd, BPF_ANY);
+       err = bpf_map_update_elem(prog_array_fd, &ind, &prog_fd, BPF_ANY);
        if (err < 0) {
                printf("failed to store prog_fd in prog_array\n");
                return -1;
@@ -58,6 +67,7 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size)
        bool is_perf_event = strncmp(event, "perf_event", 10) == 0;
        bool is_cgroup_skb = strncmp(event, "cgroup/skb", 10) == 0;
        bool is_cgroup_sk = strncmp(event, "cgroup/sock", 11) == 0;
+       size_t insns_cnt = size / sizeof(struct bpf_insn);
        enum bpf_prog_type prog_type;
        char buf[256];
        int fd, efd, err, id;
@@ -87,9 +97,10 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size)
                return -1;
        }
 
-       fd = bpf_prog_load(prog_type, prog, size, license, kern_version);
+       fd = bpf_load_program(prog_type, prog, insns_cnt, license, kern_version,
+                             bpf_log_buf, BPF_LOG_BUF_SIZE);
        if (fd < 0) {
-               printf("bpf_prog_load() err=%d\n%s", errno, bpf_log_buf);
+               printf("bpf_load_program() err=%d\n%s", errno, bpf_log_buf);
                return -1;
        }
 
@@ -169,7 +180,7 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size)
        id = atoi(buf);
        attr.config = id;
 
-       efd = perf_event_open(&attr, -1/*pid*/, 0/*cpu*/, -1/*group_fd*/, 0);
+       efd = sys_perf_event_open(&attr, -1/*pid*/, 0/*cpu*/, -1/*group_fd*/, 0);
        if (efd < 0) {
                printf("event %d fd %d err %s\n", id, efd, strerror(errno));
                return -1;
index fb46a421ab411fefe2c23ed36af4cbfee27a3807..c827827299b3b77831650e762376b061b6c93021 100644 (file)
@@ -1,12 +1,15 @@
 #ifndef __BPF_LOAD_H
 #define __BPF_LOAD_H
 
+#include "libbpf.h"
+
 #define MAX_MAPS 32
 #define MAX_PROGS 32
 
 extern int map_fd[MAX_MAPS];
 extern int prog_fd[MAX_PROGS];
 extern int event_fd[MAX_PROGS];
+extern char bpf_log_buf[BPF_LOG_BUF_SIZE];
 extern int prog_cnt;
 
 /* parses elf file compiled by llvm .c->.o
index 625e797be6ef897f929adebffe9dcbf71cd59e03..e29bd52ff9e85c6dd6a2996bd213567e51e0328e 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "bpf_load.h"
 #include "libbpf.h"
+#include "sock_example.h"
 
 #define BPF_F_PIN      (1 << 0)
 #define BPF_F_GET      (1 << 1)
@@ -49,17 +50,19 @@ static int bpf_map_create(void)
 
 static int bpf_prog_create(const char *object)
 {
-       static const struct bpf_insn insns[] = {
+       static struct bpf_insn insns[] = {
                BPF_MOV64_IMM(BPF_REG_0, 1),
                BPF_EXIT_INSN(),
        };
+       size_t insns_cnt = sizeof(insns) / sizeof(struct bpf_insn);
 
        if (object) {
                assert(!load_bpf_file((char *)object));
                return prog_fd[0];
        } else {
-               return bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER,
-                                    insns, sizeof(insns), "GPL", 0);
+               return bpf_load_program(BPF_PROG_TYPE_SOCKET_FILTER,
+                                       insns, insns_cnt, "GPL", 0,
+                                       bpf_log_buf, BPF_LOG_BUF_SIZE);
        }
 }
 
@@ -83,12 +86,12 @@ static int bpf_do_map(const char *file, uint32_t flags, uint32_t key,
        }
 
        if ((flags & BPF_F_KEY_VAL) == BPF_F_KEY_VAL) {
-               ret = bpf_update_elem(fd, &key, &value, 0);
+               ret = bpf_map_update_elem(fd, &key, &value, 0);
                printf("bpf: fd:%d u->(%u:%u) ret:(%d,%s)\n", fd, key, value,
                       ret, strerror(errno));
                assert(ret == 0);
        } else if (flags & BPF_F_KEY) {
-               ret = bpf_lookup_elem(fd, &key, &value);
+               ret = bpf_map_lookup_elem(fd, &key, &value);
                printf("bpf: fd:%d l->(%u):%u ret:(%d,%s)\n", fd, key, value,
                       ret, strerror(errno));
                assert(ret == 0);
index 65da8c1576de00a555fcb7056907c6d4939cbd58..6477bad5b4e2b9e6ae8fe7558b18cd95f86197b5 100644 (file)
@@ -73,7 +73,7 @@ static void get_data(int fd)
        for (c = 0; c < MAX_CPU; c++) {
                for (i = 0; i < MAX_ENTRIES; i++) {
                        key = c * MAX_ENTRIES + i;
-                       bpf_lookup_elem(fd, &key, &value);
+                       bpf_map_lookup_elem(fd, &key, &value);
 
                        cpu_hist[c].data[i] = value;
                        if (value > cpu_hist[c].max)
diff --git a/samples/bpf/libbpf.c b/samples/bpf/libbpf.c
deleted file mode 100644 (file)
index 9ce707b..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/* eBPF mini library */
-#include <stdlib.h>
-#include <stdio.h>
-#include <linux/unistd.h>
-#include <unistd.h>
-#include <string.h>
-#include <linux/netlink.h>
-#include <linux/bpf.h>
-#include <errno.h>
-#include <net/ethernet.h>
-#include <net/if.h>
-#include <linux/if_packet.h>
-#include <arpa/inet.h>
-#include "libbpf.h"
-
-static __u64 ptr_to_u64(void *ptr)
-{
-       return (__u64) (unsigned long) ptr;
-}
-
-int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
-                  int max_entries, int map_flags)
-{
-       union bpf_attr attr = {
-               .map_type = map_type,
-               .key_size = key_size,
-               .value_size = value_size,
-               .max_entries = max_entries,
-               .map_flags = map_flags,
-       };
-
-       return syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr));
-}
-
-int bpf_update_elem(int fd, void *key, void *value, unsigned long long flags)
-{
-       union bpf_attr attr = {
-               .map_fd = fd,
-               .key = ptr_to_u64(key),
-               .value = ptr_to_u64(value),
-               .flags = flags,
-       };
-
-       return syscall(__NR_bpf, BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr));
-}
-
-int bpf_lookup_elem(int fd, void *key, void *value)
-{
-       union bpf_attr attr = {
-               .map_fd = fd,
-               .key = ptr_to_u64(key),
-               .value = ptr_to_u64(value),
-       };
-
-       return syscall(__NR_bpf, BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr));
-}
-
-int bpf_delete_elem(int fd, void *key)
-{
-       union bpf_attr attr = {
-               .map_fd = fd,
-               .key = ptr_to_u64(key),
-       };
-
-       return syscall(__NR_bpf, BPF_MAP_DELETE_ELEM, &attr, sizeof(attr));
-}
-
-int bpf_get_next_key(int fd, void *key, void *next_key)
-{
-       union bpf_attr attr = {
-               .map_fd = fd,
-               .key = ptr_to_u64(key),
-               .next_key = ptr_to_u64(next_key),
-       };
-
-       return syscall(__NR_bpf, BPF_MAP_GET_NEXT_KEY, &attr, sizeof(attr));
-}
-
-#define ROUND_UP(x, n) (((x) + (n) - 1u) & ~((n) - 1u))
-
-char bpf_log_buf[LOG_BUF_SIZE];
-
-int bpf_prog_load(enum bpf_prog_type prog_type,
-                 const struct bpf_insn *insns, int prog_len,
-                 const char *license, int kern_version)
-{
-       union bpf_attr attr = {
-               .prog_type = prog_type,
-               .insns = ptr_to_u64((void *) insns),
-               .insn_cnt = prog_len / sizeof(struct bpf_insn),
-               .license = ptr_to_u64((void *) license),
-               .log_buf = ptr_to_u64(bpf_log_buf),
-               .log_size = LOG_BUF_SIZE,
-               .log_level = 1,
-       };
-
-       /* assign one field outside of struct init to make sure any
-        * padding is zero initialized
-        */
-       attr.kern_version = kern_version;
-
-       bpf_log_buf[0] = 0;
-
-       return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr));
-}
-
-int bpf_prog_attach(int prog_fd, int target_fd, enum bpf_attach_type type)
-{
-       union bpf_attr attr = {
-               .target_fd = target_fd,
-               .attach_bpf_fd = prog_fd,
-               .attach_type = type,
-       };
-
-       return syscall(__NR_bpf, BPF_PROG_ATTACH, &attr, sizeof(attr));
-}
-
-int bpf_prog_detach(int target_fd, enum bpf_attach_type type)
-{
-       union bpf_attr attr = {
-               .target_fd = target_fd,
-               .attach_type = type,
-       };
-
-       return syscall(__NR_bpf, BPF_PROG_DETACH, &attr, sizeof(attr));
-}
-
-int bpf_obj_pin(int fd, const char *pathname)
-{
-       union bpf_attr attr = {
-               .pathname       = ptr_to_u64((void *)pathname),
-               .bpf_fd         = fd,
-       };
-
-       return syscall(__NR_bpf, BPF_OBJ_PIN, &attr, sizeof(attr));
-}
-
-int bpf_obj_get(const char *pathname)
-{
-       union bpf_attr attr = {
-               .pathname       = ptr_to_u64((void *)pathname),
-       };
-
-       return syscall(__NR_bpf, BPF_OBJ_GET, &attr, sizeof(attr));
-}
-
-int open_raw_sock(const char *name)
-{
-       struct sockaddr_ll sll;
-       int sock;
-
-       sock = socket(PF_PACKET, SOCK_RAW | SOCK_NONBLOCK | SOCK_CLOEXEC, htons(ETH_P_ALL));
-       if (sock < 0) {
-               printf("cannot create raw socket\n");
-               return -1;
-       }
-
-       memset(&sll, 0, sizeof(sll));
-       sll.sll_family = AF_PACKET;
-       sll.sll_ifindex = if_nametoindex(name);
-       sll.sll_protocol = htons(ETH_P_ALL);
-       if (bind(sock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
-               printf("bind to %s: %s\n", name, strerror(errno));
-               close(sock);
-               return -1;
-       }
-
-       return sock;
-}
-
-int perf_event_open(struct perf_event_attr *attr, int pid, int cpu,
-                   int group_fd, unsigned long flags)
-{
-       return syscall(__NR_perf_event_open, attr, pid, cpu,
-                      group_fd, flags);
-}
index 94a901d86fc2ea4867a3993f87380e9894d3b1f5..3705fba453a005fb32f5dfb51dd5763f5f364ccf 100644 (file)
@@ -2,27 +2,9 @@
 #ifndef __LIBBPF_H
 #define __LIBBPF_H
 
-struct bpf_insn;
-
-int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
-                  int max_entries, int map_flags);
-int bpf_update_elem(int fd, void *key, void *value, unsigned long long flags);
-int bpf_lookup_elem(int fd, void *key, void *value);
-int bpf_delete_elem(int fd, void *key);
-int bpf_get_next_key(int fd, void *key, void *next_key);
-
-int bpf_prog_load(enum bpf_prog_type prog_type,
-                 const struct bpf_insn *insns, int insn_len,
-                 const char *license, int kern_version);
-
-int bpf_prog_attach(int prog_fd, int attachable_fd, enum bpf_attach_type type);
-int bpf_prog_detach(int attachable_fd, enum bpf_attach_type type);
+#include <bpf/bpf.h>
 
-int bpf_obj_pin(int fd, const char *pathname);
-int bpf_obj_get(const char *pathname);
-
-#define LOG_BUF_SIZE (256 * 1024)
-extern char bpf_log_buf[LOG_BUF_SIZE];
+struct bpf_insn;
 
 /* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
 
@@ -203,10 +185,4 @@ extern char bpf_log_buf[LOG_BUF_SIZE];
                .off   = 0,                                     \
                .imm   = 0 })
 
-/* create RAW socket and bind to interface 'name' */
-int open_raw_sock(const char *name);
-
-struct perf_event_attr;
-int perf_event_open(struct perf_event_attr *attr, int pid, int cpu,
-                   int group_fd, unsigned long flags);
 #endif
index 05d783fc5dafbc50393b796b8e0968bc293f5b07..ec8f3bbcbef3dc871177b55cac6f27e54dfaff6f 100644 (file)
@@ -14,6 +14,8 @@
 #define MAX_INDEX 64
 #define MAX_STARS 38
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static void stars(char *str, long val, long max, int width)
 {
        int i;
@@ -41,13 +43,13 @@ int main(int argc, char **argv)
                return -1;
        }
 
-       while (bpf_get_next_key(map_fd, &key, &next_key) == 0) {
+       while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) {
                if (next_key >= MAX_INDEX) {
                        fprintf(stderr, "Key %lu out of bounds\n", next_key);
                        continue;
                }
 
-               bpf_lookup_elem(map_fd, &next_key, values);
+               bpf_map_lookup_elem(map_fd, &next_key, values);
 
                sum = 0;
                for (i = 0; i < nr_cpus; i++)
index 6f002a9c24faa38a81ba9b233519b6370478a2b0..9cce2a66bd664c40668b3c8ca0dd12bd148bb21b 100644 (file)
@@ -49,14 +49,14 @@ static void print_stack(struct key_t *key, __u64 count)
        int i;
 
        printf("%s;", key->target);
-       if (bpf_lookup_elem(map_fd[3], &key->tret, ip) != 0) {
+       if (bpf_map_lookup_elem(map_fd[3], &key->tret, ip) != 0) {
                printf("---;");
        } else {
                for (i = PERF_MAX_STACK_DEPTH - 1; i >= 0; i--)
                        print_ksym(ip[i]);
        }
        printf("-;");
-       if (bpf_lookup_elem(map_fd[3], &key->wret, ip) != 0) {
+       if (bpf_map_lookup_elem(map_fd[3], &key->wret, ip) != 0) {
                printf("---;");
        } else {
                for (i = 0; i < PERF_MAX_STACK_DEPTH; i++)
@@ -77,8 +77,8 @@ static void print_stacks(int fd)
        struct key_t key = {}, next_key;
        __u64 value;
 
-       while (bpf_get_next_key(fd, &key, &next_key) == 0) {
-               bpf_lookup_elem(fd, &next_key, &value);
+       while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
+               bpf_map_lookup_elem(fd, &next_key, &value);
                print_stack(&next_key, value);
                key = next_key;
        }
index 260a6bdd6413ecf2e24b434ce5c30ca137d37ca2..be59d7dcbdde3664c573a78d6d27adee03234a16 100644 (file)
@@ -21,6 +21,7 @@
 #include <sys/ioctl.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 #define DEFAULT_FREQ   99
 #define DEFAULT_SECS   5
@@ -49,7 +50,7 @@ static int sampling_start(int *pmu_fd, int freq)
        };
 
        for (i = 0; i < nr_cpus; i++) {
-               pmu_fd[i] = perf_event_open(&pe_sample_attr, -1 /* pid */, i,
+               pmu_fd[i] = sys_perf_event_open(&pe_sample_attr, -1 /* pid */, i,
                                            -1 /* group_fd */, 0 /* flags */);
                if (pmu_fd[i] < 0) {
                        fprintf(stderr, "ERROR: Initializing perf sampling\n");
@@ -95,8 +96,8 @@ static void print_ip_map(int fd)
 
        /* fetch IPs and counts */
        key = 0, i = 0;
-       while (bpf_get_next_key(fd, &key, &next_key) == 0) {
-               bpf_lookup_elem(fd, &next_key, &value);
+       while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
+               bpf_map_lookup_elem(fd, &next_key, &value);
                counts[i].ip = next_key;
                counts[i++].count = value;
                key = next_key;
index 28b60baa9fa82b4fbb0db4526aeddec65459bf96..6fc6e193ef1b12ecbb13f5c7729552306632708b 100644 (file)
@@ -27,6 +27,9 @@
 #include <linux/ip.h>
 #include <stddef.h>
 #include "libbpf.h"
+#include "sock_example.h"
+
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
 
 static int test_sock(void)
 {
@@ -54,9 +57,10 @@ static int test_sock(void)
                BPF_MOV64_IMM(BPF_REG_0, 0), /* r0 = 0 */
                BPF_EXIT_INSN(),
        };
+       size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn);
 
-       prog_fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, prog, sizeof(prog),
-                               "GPL", 0);
+       prog_fd = bpf_load_program(BPF_PROG_TYPE_SOCKET_FILTER, prog, insns_cnt,
+                                  "GPL", 0, bpf_log_buf, BPF_LOG_BUF_SIZE);
        if (prog_fd < 0) {
                printf("failed to load prog '%s'\n", strerror(errno));
                goto cleanup;
@@ -72,13 +76,13 @@ static int test_sock(void)
 
        for (i = 0; i < 10; i++) {
                key = IPPROTO_TCP;
-               assert(bpf_lookup_elem(map_fd, &key, &tcp_cnt) == 0);
+               assert(bpf_map_lookup_elem(map_fd, &key, &tcp_cnt) == 0);
 
                key = IPPROTO_UDP;
-               assert(bpf_lookup_elem(map_fd, &key, &udp_cnt) == 0);
+               assert(bpf_map_lookup_elem(map_fd, &key, &udp_cnt) == 0);
 
                key = IPPROTO_ICMP;
-               assert(bpf_lookup_elem(map_fd, &key, &icmp_cnt) == 0);
+               assert(bpf_map_lookup_elem(map_fd, &key, &icmp_cnt) == 0);
 
                printf("TCP %lld UDP %lld ICMP %lld packets\n",
                       tcp_cnt, udp_cnt, icmp_cnt);
diff --git a/samples/bpf/sock_example.h b/samples/bpf/sock_example.h
new file mode 100644 (file)
index 0000000..09f7fe7
--- /dev/null
@@ -0,0 +1,35 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <linux/unistd.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <linux/if_packet.h>
+#include <arpa/inet.h>
+#include "libbpf.h"
+
+static inline int open_raw_sock(const char *name)
+{
+       struct sockaddr_ll sll;
+       int sock;
+
+       sock = socket(PF_PACKET, SOCK_RAW | SOCK_NONBLOCK | SOCK_CLOEXEC, htons(ETH_P_ALL));
+       if (sock < 0) {
+               printf("cannot create raw socket\n");
+               return -1;
+       }
+
+       memset(&sll, 0, sizeof(sll));
+       sll.sll_family = AF_PACKET;
+       sll.sll_ifindex = if_nametoindex(name);
+       sll.sll_protocol = htons(ETH_P_ALL);
+       if (bind(sock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
+               printf("bind to %s: %s\n", name, strerror(errno));
+               close(sock);
+               return -1;
+       }
+
+       return sock;
+}
index 678ce469355152650ee055136821f4ad8b50ed85..6cd2feb3e9b364aa4ec75c538fe954e581fbd84e 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/bpf.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "sock_example.h"
 #include <unistd.h>
 #include <arpa/inet.h>
 
@@ -32,13 +33,13 @@ int main(int ac, char **argv)
                int key;
 
                key = IPPROTO_TCP;
-               assert(bpf_lookup_elem(map_fd[0], &key, &tcp_cnt) == 0);
+               assert(bpf_map_lookup_elem(map_fd[0], &key, &tcp_cnt) == 0);
 
                key = IPPROTO_UDP;
-               assert(bpf_lookup_elem(map_fd[0], &key, &udp_cnt) == 0);
+               assert(bpf_map_lookup_elem(map_fd[0], &key, &udp_cnt) == 0);
 
                key = IPPROTO_ICMP;
-               assert(bpf_lookup_elem(map_fd[0], &key, &icmp_cnt) == 0);
+               assert(bpf_map_lookup_elem(map_fd[0], &key, &icmp_cnt) == 0);
 
                printf("TCP %lld UDP %lld ICMP %lld bytes\n",
                       tcp_cnt, udp_cnt, icmp_cnt);
index 8a4085c2d117acf2e1a47a8d85f6a21f7bbeff5e..0e0207c9084130c362b600f6b8cd453d2541c4dc 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/bpf.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "sock_example.h"
 #include <unistd.h>
 #include <arpa/inet.h>
 #include <sys/resource.h>
@@ -39,8 +40,8 @@ int main(int ac, char **argv)
                int key = 0, next_key;
                struct pair value;
 
-               while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0) {
-                       bpf_lookup_elem(map_fd[0], &next_key, &value);
+               while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) {
+                       bpf_map_lookup_elem(map_fd[0], &next_key, &value);
                        printf("ip %s bytes %lld packets %lld\n",
                               inet_ntoa((struct in_addr){htonl(next_key)}),
                               value.bytes, value.packets);
index 3fcfd8c4b2a3c69da6a4719559cdd4edbbca0b30..b5524d417eb57acd808aa07f4e876191df734166 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/bpf.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "sock_example.h"
 #include <unistd.h>
 #include <arpa/inet.h>
 #include <sys/resource.h>
@@ -54,8 +55,8 @@ int main(int argc, char **argv)
 
                sleep(1);
                printf("IP     src.port -> dst.port               bytes      packets\n");
-               while (bpf_get_next_key(map_fd[2], &key, &next_key) == 0) {
-                       bpf_lookup_elem(map_fd[2], &next_key, &value);
+               while (bpf_map_get_next_key(map_fd[2], &key, &next_key) == 0) {
+                       bpf_map_lookup_elem(map_fd[2], &next_key, &value);
                        printf("%s.%05d -> %s.%05d %12lld %12lld\n",
                               inet_ntoa((struct in_addr){htonl(next_key.src)}),
                               next_key.port16[0],
index 311ede532230646808a44c74b61316e21d70649a..80676c25fa5017abd8c91b51f1757c7e53e5df93 100644 (file)
@@ -31,8 +31,8 @@ int main(int ac, char **argv)
        for (i = 0; i < 5; i++) {
                key = 0;
                printf("kprobing funcs:");
-               while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0) {
-                       bpf_lookup_elem(map_fd[0], &next_key, &value);
+               while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) {
+                       bpf_map_lookup_elem(map_fd[0], &next_key, &value);
                        assert(next_key == value);
                        sym = ksym_search(value);
                        printf(" %s", sym->name);
@@ -41,8 +41,8 @@ int main(int ac, char **argv)
                if (key)
                        printf("\n");
                key = 0;
-               while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0)
-                       bpf_delete_elem(map_fd[0], &next_key);
+               while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0)
+                       bpf_map_delete_elem(map_fd[0], &next_key);
                sleep(1);
        }
 
index 4013c5337b912dd38fed05c15a944f1748d50487..28995a77656073721d5ea5c78eb33f9aceb66a2f 100644 (file)
@@ -60,9 +60,9 @@ int main(int argc, char **argv)
        }
 
        /* bpf_tunnel_key.remote_ipv4 expects host byte orders */
-       ret = bpf_update_elem(array_fd, &array_key, &ifindex, 0);
+       ret = bpf_map_update_elem(array_fd, &array_key, &ifindex, 0);
        if (ret) {
-               perror("bpf_update_elem");
+               perror("bpf_map_update_elem");
                goto out;
        }
 
index 70e86f7be69dae90dfcc99aa95c3cca866092640..8a1b8b5d8def4717b64fbac2b58209bd3aeacab6 100644 (file)
@@ -85,9 +85,9 @@ int main(int argc, char **argv)
                }
        }
 
-       ret = bpf_update_elem(array_fd, &array_key, &cg2_fd, 0);
+       ret = bpf_map_update_elem(array_fd, &array_key, &cg2_fd, 0);
        if (ret) {
-               perror("bpf_update_elem");
+               perror("bpf_map_update_elem");
                goto out;
        }
 
index a19484c45b79f0d600be81eadec23120e583e214..504058631ffccef319f9bc7f6a3349d6f854bdbd 100644 (file)
@@ -36,6 +36,8 @@ enum {
        MAP_KEY_BYTES,
 };
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static int prog_load(int map_fd, int verdict)
 {
        struct bpf_insn prog[] = {
@@ -66,9 +68,11 @@ static int prog_load(int map_fd, int verdict)
                BPF_MOV64_IMM(BPF_REG_0, verdict), /* r0 = verdict */
                BPF_EXIT_INSN(),
        };
+       size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn);
 
-       return bpf_prog_load(BPF_PROG_TYPE_CGROUP_SKB,
-                            prog, sizeof(prog), "GPL", 0);
+       return bpf_load_program(BPF_PROG_TYPE_CGROUP_SKB,
+                               prog, insns_cnt, "GPL", 0,
+                               bpf_log_buf, BPF_LOG_BUF_SIZE);
 }
 
 static int usage(const char *argv0)
@@ -108,10 +112,10 @@ static int attach_filter(int cg_fd, int type, int verdict)
        }
        while (1) {
                key = MAP_KEY_PACKETS;
-               assert(bpf_lookup_elem(map_fd, &key, &pkt_cnt) == 0);
+               assert(bpf_map_lookup_elem(map_fd, &key, &pkt_cnt) == 0);
 
                key = MAP_KEY_BYTES;
-               assert(bpf_lookup_elem(map_fd, &key, &byte_cnt) == 0);
+               assert(bpf_map_lookup_elem(map_fd, &key, &byte_cnt) == 0);
 
                printf("cgroup received %lld packets, %lld bytes\n",
                       pkt_cnt, byte_cnt);
index ddfac42ed4df65636b9a1c2b1e405d04c343f7b7..6e69be37f87f700dfd6a2c13a8d6310164b0cdd9 100644 (file)
@@ -32,6 +32,8 @@
 #define BAR            "/foo/bar/"
 #define PING_CMD       "ping -c1 -w1 127.0.0.1"
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static int prog_load(int verdict)
 {
        int ret;
@@ -39,9 +41,11 @@ static int prog_load(int verdict)
                BPF_MOV64_IMM(BPF_REG_0, verdict), /* r0 = verdict */
                BPF_EXIT_INSN(),
        };
+       size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn);
 
-       ret = bpf_prog_load(BPF_PROG_TYPE_CGROUP_SKB,
-                            prog, sizeof(prog), "GPL", 0);
+       ret = bpf_load_program(BPF_PROG_TYPE_CGROUP_SKB,
+                              prog, insns_cnt, "GPL", 0,
+                              bpf_log_buf, BPF_LOG_BUF_SIZE);
 
        if (ret < 0) {
                log_err("Loading program");
index d467b3c1c55c385ff1a1c20efe044072b6c7a539..0791b949cbe418e49fa29ab1efb52007e29d67d8 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "libbpf.h"
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static int prog_load(int idx)
 {
        struct bpf_insn prog[] = {
@@ -33,9 +35,10 @@ static int prog_load(int idx)
                BPF_MOV64_IMM(BPF_REG_0, 1), /* r0 = verdict */
                BPF_EXIT_INSN(),
        };
+       size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn);
 
-       return bpf_prog_load(BPF_PROG_TYPE_CGROUP_SOCK, prog, sizeof(prog),
-                            "GPL", 0);
+       return bpf_load_program(BPF_PROG_TYPE_CGROUP_SOCK, prog, insns_cnt,
+                               "GPL", 0, bpf_log_buf, BPF_LOG_BUF_SIZE);
 }
 
 static int usage(const char *argv0)
index 95aaaa84613039a063dd33192e6e115187b38a06..65b5fb51c1dbc5b34dcf4dc01e6d6e16eb43b265 100644 (file)
@@ -36,7 +36,7 @@ int main(int argc, char **argv)
        if (!cg2)
                goto err;
 
-       if (bpf_update_elem(map_fd[0], &idx, &cg2, BPF_ANY)) {
+       if (bpf_map_update_elem(map_fd[0], &idx, &cg2, BPF_ANY)) {
                log_err("Adding target cgroup to map");
                goto err;
        }
@@ -50,7 +50,7 @@ int main(int argc, char **argv)
         */
 
        sync();
-       bpf_lookup_elem(map_fd[1], &idx, &remote_pid);
+       bpf_map_lookup_elem(map_fd[1], &idx, &remote_pid);
 
        if (local_pid != remote_pid) {
                fprintf(stderr,
@@ -64,10 +64,10 @@ int main(int argc, char **argv)
                goto err;
 
        remote_pid = 0;
-       bpf_update_elem(map_fd[1], &idx, &remote_pid, BPF_ANY);
+       bpf_map_update_elem(map_fd[1], &idx, &remote_pid, BPF_ANY);
 
        sync();
-       bpf_lookup_elem(map_fd[1], &idx, &remote_pid);
+       bpf_map_lookup_elem(map_fd[1], &idx, &remote_pid);
 
        if (local_pid == remote_pid) {
                fprintf(stderr, "BPF cgroup negative test did not work\n");
index 316230a0ed2306271288d21c25970d505e9d0507..d96dc88d3b04067135fe80c95628fca37a29c022 100644 (file)
@@ -134,7 +134,7 @@ static int pfect_lru_lookup_or_insert(struct pfect_lru *lru,
        int seen = 0;
 
        lru->total++;
-       if (!bpf_lookup_elem(lru->map_fd, &key, &node)) {
+       if (!bpf_map_lookup_elem(lru->map_fd, &key, &node)) {
                if (node) {
                        list_move(&node->list, &lru->list);
                        return 1;
@@ -151,7 +151,7 @@ static int pfect_lru_lookup_or_insert(struct pfect_lru *lru,
                node = list_last_entry(&lru->list,
                                       struct pfect_lru_node,
                                       list);
-               bpf_update_elem(lru->map_fd, &node->key, &null_node, BPF_EXIST);
+               bpf_map_update_elem(lru->map_fd, &node->key, &null_node, BPF_EXIST);
        }
 
        node->key = key;
@@ -159,10 +159,10 @@ static int pfect_lru_lookup_or_insert(struct pfect_lru *lru,
 
        lru->nr_misses++;
        if (seen) {
-               assert(!bpf_update_elem(lru->map_fd, &key, &node, BPF_EXIST));
+               assert(!bpf_map_update_elem(lru->map_fd, &key, &node, BPF_EXIST));
        } else {
                lru->nr_unique++;
-               assert(!bpf_update_elem(lru->map_fd, &key, &node, BPF_NOEXIST));
+               assert(!bpf_map_update_elem(lru->map_fd, &key, &node, BPF_NOEXIST));
        }
 
        return seen;
@@ -285,11 +285,11 @@ static void do_test_lru_dist(int task, void *data)
 
                pfect_lru_lookup_or_insert(&pfect_lru, key);
 
-               if (!bpf_lookup_elem(lru_map_fd, &key, &value))
+               if (!bpf_map_lookup_elem(lru_map_fd, &key, &value))
                        continue;
 
-               if (bpf_update_elem(lru_map_fd, &key, &value, BPF_NOEXIST)) {
-                       printf("bpf_update_elem(lru_map_fd, %llu): errno:%d\n",
+               if (bpf_map_update_elem(lru_map_fd, &key, &value, BPF_NOEXIST)) {
+                       printf("bpf_map_update_elem(lru_map_fd, %llu): errno:%d\n",
                               key, errno);
                        assert(0);
                }
@@ -358,19 +358,19 @@ static void test_lru_loss0(int map_type, int map_flags)
        for (key = 1; key <= 1000; key++) {
                int start_key, end_key;
 
-               assert(bpf_update_elem(map_fd, &key, value, BPF_NOEXIST) == 0);
+               assert(bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST) == 0);
 
                start_key = 101;
                end_key = min(key, 900);
 
                while (start_key <= end_key) {
-                       bpf_lookup_elem(map_fd, &start_key, value);
+                       bpf_map_lookup_elem(map_fd, &start_key, value);
                        start_key++;
                }
        }
 
        for (key = 1; key <= 1000; key++) {
-               if (bpf_lookup_elem(map_fd, &key, value)) {
+               if (bpf_map_lookup_elem(map_fd, &key, value)) {
                        if (key <= 100)
                                old_unused_losses++;
                        else if (key <= 900)
@@ -408,10 +408,10 @@ static void test_lru_loss1(int map_type, int map_flags)
        value[0] = 1234;
 
        for (key = 1; key <= 1000; key++)
-               assert(!bpf_update_elem(map_fd, &key, value, BPF_NOEXIST));
+               assert(!bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST));
 
        for (key = 1; key <= 1000; key++) {
-               if (bpf_lookup_elem(map_fd, &key, value))
+               if (bpf_map_lookup_elem(map_fd, &key, value))
                        nr_losses++;
        }
 
@@ -436,7 +436,7 @@ static void do_test_parallel_lru_loss(int task, void *data)
        next_ins_key = stable_base;
        value[0] = 1234;
        for (i = 0; i < nr_stable_elems; i++) {
-               assert(bpf_update_elem(map_fd, &next_ins_key, value,
+               assert(bpf_map_update_elem(map_fd, &next_ins_key, value,
                                       BPF_NOEXIST) == 0);
                next_ins_key++;
        }
@@ -448,9 +448,9 @@ static void do_test_parallel_lru_loss(int task, void *data)
 
                if (rn % 10) {
                        key = rn % nr_stable_elems + stable_base;
-                       bpf_lookup_elem(map_fd, &key, value);
+                       bpf_map_lookup_elem(map_fd, &key, value);
                } else {
-                       bpf_update_elem(map_fd, &next_ins_key, value,
+                       bpf_map_update_elem(map_fd, &next_ins_key, value,
                                        BPF_NOEXIST);
                        next_ins_key++;
                }
@@ -458,7 +458,7 @@ static void do_test_parallel_lru_loss(int task, void *data)
 
        key = stable_base;
        for (i = 0; i < nr_stable_elems; i++) {
-               if (bpf_lookup_elem(map_fd, &key, value))
+               if (bpf_map_lookup_elem(map_fd, &key, value))
                        nr_losses++;
                key++;
        }
index a44bf347bedd30a8f9e90a40d78fb3c1446ac062..b5bf178a6ecc60eb7fa99b28abbe75dca8b06288 100644 (file)
@@ -50,7 +50,7 @@ int main(int ac, char **argv)
        mapped_addr_in->sin_port = htons(5555);
        mapped_addr_in->sin_addr.s_addr = inet_addr("255.255.255.255");
 
-       assert(!bpf_update_elem(map_fd[0], &mapped_addr, &serv_addr, BPF_ANY));
+       assert(!bpf_map_update_elem(map_fd[0], &mapped_addr, &serv_addr, BPF_ANY));
 
        assert(listen(serverfd, 5) == 0);
 
index 9a130d31ecf258b601d20e52367443a18f02c11c..0c5561d193a487f2257ccece359530b97b06a170 100644 (file)
@@ -20,6 +20,7 @@
 #include <sys/resource.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 #define SAMPLE_FREQ 50
 
@@ -61,14 +62,14 @@ static void print_stack(struct key_t *key, __u64 count)
        int i;
 
        printf("%3lld %s;", count, key->comm);
-       if (bpf_lookup_elem(map_fd[1], &key->kernstack, ip) != 0) {
+       if (bpf_map_lookup_elem(map_fd[1], &key->kernstack, ip) != 0) {
                printf("---;");
        } else {
                for (i = PERF_MAX_STACK_DEPTH - 1; i >= 0; i--)
                        print_ksym(ip[i]);
        }
        printf("-;");
-       if (bpf_lookup_elem(map_fd[1], &key->userstack, ip) != 0) {
+       if (bpf_map_lookup_elem(map_fd[1], &key->userstack, ip) != 0) {
                printf("---;");
        } else {
                for (i = PERF_MAX_STACK_DEPTH - 1; i >= 0; i--)
@@ -98,10 +99,10 @@ static void print_stacks(void)
        int fd = map_fd[0], stack_map = map_fd[1];
 
        sys_read_seen = sys_write_seen = false;
-       while (bpf_get_next_key(fd, &key, &next_key) == 0) {
-               bpf_lookup_elem(fd, &next_key, &value);
+       while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
+               bpf_map_lookup_elem(fd, &next_key, &value);
                print_stack(&next_key, value);
-               bpf_delete_elem(fd, &next_key);
+               bpf_map_delete_elem(fd, &next_key);
                key = next_key;
        }
 
@@ -111,8 +112,8 @@ static void print_stacks(void)
        }
 
        /* clear stack map */
-       while (bpf_get_next_key(stack_map, &stackid, &next_id) == 0) {
-               bpf_delete_elem(stack_map, &next_id);
+       while (bpf_map_get_next_key(stack_map, &stackid, &next_id) == 0) {
+               bpf_map_delete_elem(stack_map, &next_id);
                stackid = next_id;
        }
 }
@@ -125,9 +126,9 @@ static void test_perf_event_all_cpu(struct perf_event_attr *attr)
 
        /* open perf_event on all cpus */
        for (i = 0; i < nr_cpus; i++) {
-               pmu_fd[i] = perf_event_open(attr, -1, i, -1, 0);
+               pmu_fd[i] = sys_perf_event_open(attr, -1, i, -1, 0);
                if (pmu_fd[i] < 0) {
-                       printf("perf_event_open failed\n");
+                       printf("sys_perf_event_open failed\n");
                        goto all_cpu_err;
                }
                assert(ioctl(pmu_fd[i], PERF_EVENT_IOC_SET_BPF, prog_fd[0]) == 0);
@@ -146,9 +147,9 @@ static void test_perf_event_task(struct perf_event_attr *attr)
        int pmu_fd;
 
        /* open task bound event */
-       pmu_fd = perf_event_open(attr, 0, -1, -1, 0);
+       pmu_fd = sys_perf_event_open(attr, 0, -1, -1, 0);
        if (pmu_fd < 0) {
-               printf("perf_event_open failed\n");
+               printf("sys_perf_event_open failed\n");
                return;
        }
        assert(ioctl(pmu_fd, PERF_EVENT_IOC_SET_BPF, prog_fd[0]) == 0);
index 661a7d052f2cbb7a6a0f20acf4c71d34d49feb05..f4fa6af22def9fa9c01df1525c7a61b3aecb8cdd 100644 (file)
@@ -21,6 +21,7 @@
 #include <signal.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 static int pmu_fd;
 
@@ -61,7 +62,7 @@ struct perf_event_sample {
        char data[];
 };
 
-void perf_event_read(print_fn fn)
+static void perf_event_read(print_fn fn)
 {
        __u64 data_tail = header->data_tail;
        __u64 data_head = header->data_head;
@@ -159,10 +160,10 @@ static void test_bpf_perf_event(void)
        };
        int key = 0;
 
-       pmu_fd = perf_event_open(&attr, -1/*pid*/, 0/*cpu*/, -1/*group_fd*/, 0);
+       pmu_fd = sys_perf_event_open(&attr, -1/*pid*/, 0/*cpu*/, -1/*group_fd*/, 0);
 
        assert(pmu_fd >= 0);
-       assert(bpf_update_elem(map_fd[0], &key, &pmu_fd, BPF_ANY) == 0);
+       assert(bpf_map_update_elem(map_fd[0], &key, &pmu_fd, BPF_ANY) == 0);
        ioctl(pmu_fd, PERF_EVENT_IOC_ENABLE, 0);
 }
 
index 3e225e331f664847736242fc5fd1c7abce9c696b..ded9804c503418c9ed46b1ffa677455720e33a7b 100644 (file)
@@ -48,12 +48,12 @@ static void print_hist_for_pid(int fd, void *task)
        long max_value = 0;
        int i, ind;
 
-       while (bpf_get_next_key(fd, &key, &next_key) == 0) {
+       while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
                if (memcmp(&next_key, task, SIZE)) {
                        key = next_key;
                        continue;
                }
-               bpf_lookup_elem(fd, &next_key, values);
+               bpf_map_lookup_elem(fd, &next_key, values);
                value = 0;
                for (i = 0; i < nr_cpus; i++)
                        value += values[i];
@@ -83,7 +83,7 @@ static void print_hist(int fd)
        int task_cnt = 0;
        int i;
 
-       while (bpf_get_next_key(fd, &key, &next_key) == 0) {
+       while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
                int found = 0;
 
                for (i = 0; i < task_cnt; i++)
@@ -136,8 +136,8 @@ int main(int ac, char **argv)
 
        for (i = 0; i < 5; i++) {
                key = 0;
-               while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0) {
-                       bpf_lookup_elem(map_fd[0], &next_key, &value);
+               while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) {
+                       bpf_map_lookup_elem(map_fd[0], &next_key, &value);
                        printf("location 0x%lx count %ld\n", next_key, value);
                        key = next_key;
                }
index d0851cb4fa8d2c967662d9bcdc33b3b859eff9cc..8f7d199d59459cf16520b62a0ef12dcb7e6f6c04 100644 (file)
@@ -28,7 +28,7 @@ static void clear_stats(int fd)
 
        memset(values, 0, sizeof(values));
        for (key = 0; key < SLOTS; key++)
-               bpf_update_elem(fd, &key, values, BPF_ANY);
+               bpf_map_update_elem(fd, &key, values, BPF_ANY);
 }
 
 const char *color[] = {
@@ -89,7 +89,7 @@ static void print_hist(int fd)
        int i;
 
        for (key = 0; key < SLOTS; key++) {
-               bpf_lookup_elem(fd, &key, values);
+               bpf_map_lookup_elem(fd, &key, values);
                value = 0;
                for (i = 0; i < nr_cpus; i++)
                        value += values[i];
index bc4a3bdea6ed4cbceed4478899702b8ee04dd8eb..03449f773cb1f4da6b1e42c272cc1c83da36074f 100644 (file)
@@ -37,8 +37,8 @@ static void print_old_objects(int fd)
        key = write(1, "\e[1;1H\e[2J", 12); /* clear screen */
 
        key = -1;
-       while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0) {
-               bpf_lookup_elem(map_fd[0], &next_key, &v);
+       while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) {
+               bpf_map_lookup_elem(map_fd[0], &next_key, &v);
                key = next_key;
                if (val - v.val < 1000000000ll)
                        /* object was allocated more then 1 sec ago */
index 8ea4976cfcf1201a52f0ce4f4f27f06454c1f61f..ca7874ed77f4326db742366641c982612e9261b0 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/bpf.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 #define SAMPLE_PERIOD  0x7fffffffffffffffULL
 
@@ -30,13 +31,13 @@ static void test_bpf_perf_event(void)
        };
 
        for (i = 0; i < nr_cpus; i++) {
-               pmu_fd[i] = perf_event_open(&attr_insn_pmu, -1/*pid*/, i/*cpu*/, -1/*group_fd*/, 0);
+               pmu_fd[i] = sys_perf_event_open(&attr_insn_pmu, -1/*pid*/, i/*cpu*/, -1/*group_fd*/, 0);
                if (pmu_fd[i] < 0) {
                        printf("event syscall failed\n");
                        goto exit;
                }
 
-               bpf_update_elem(map_fd[0], &i, &pmu_fd[i], BPF_ANY);
+               bpf_map_update_elem(map_fd[0], &i, &pmu_fd[i], BPF_ANY);
                ioctl(pmu_fd[i], PERF_EVENT_IOC_ENABLE, 0);
        }
 
index 5f040a0d771291f7493226e9a4cdc312732fad1d..d2be65d1fd86ed199909bc6c68327f7d31e6b35a 100644 (file)
@@ -43,7 +43,7 @@ static void poll_stats(int interval)
                for (key = 0; key < nr_keys; key++) {
                        __u64 sum = 0;
 
-                       assert(bpf_lookup_elem(map_fd[0], &key, values) == 0);
+                       assert(bpf_map_lookup_elem(map_fd[0], &key, values) == 0);
                        for (i = 0; i < nr_cpus; i++)
                                sum += (values[i] - prev[key][i]);
                        if (sum)
index 7a71f5c746848fe29df7076c3aa7acb48101c544..70e192fc61aa4b9a317a1e8b11df0d36034cc877 100644 (file)
@@ -51,7 +51,7 @@ static void poll_stats(unsigned int kill_after_s)
                for (proto = 0; proto < nr_protos; proto++) {
                        __u64 sum = 0;
 
-                       assert(bpf_lookup_elem(map_fd[0], &proto, values) == 0);
+                       assert(bpf_map_lookup_elem(map_fd[0], &proto, values) == 0);
                        for (i = 0; i < nr_cpus; i++)
                                sum += (values[i] - prev[proto][i]);
 
@@ -237,8 +237,8 @@ int main(int argc, char **argv)
 
        while (min_port <= max_port) {
                vip.dport = htons(min_port++);
-               if (bpf_update_elem(map_fd[1], &vip, &tnl, BPF_NOEXIST)) {
-                       perror("bpf_update_elem(&vip2tnl)");
+               if (bpf_map_update_elem(map_fd[1], &vip, &tnl, BPF_NOEXIST)) {
+                       perror("bpf_map_update_elem(&vip2tnl)");
                        return 1;
                }
        }
index a932edbe38eb9eba5a1b3429bb67cc9c99d0d3a6..cbbd868a50a8b145bf018329542f4fde829e06da 100644 (file)
@@ -1,13 +1 @@
-#
-# Makefile for mtty.c file
-#
-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build
-
-obj-m:=mtty.o
-
-modules clean modules_install:
-       $(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) $@
-
-default: modules
-
-module: modules
+obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o
index 6b633a4ea33399aa32e6f3655b05c980aeb33403..1fc57a5093a7be425406cca55f4eb994e2eb979e 100644 (file)
@@ -164,7 +164,7 @@ static struct mdev_state *find_mdev_state_by_uuid(uuid_le uuid)
        struct mdev_state *mds;
 
        list_for_each_entry(mds, &mdev_devices_list, next) {
-               if (uuid_le_cmp(mds->mdev->uuid, uuid) == 0)
+               if (uuid_le_cmp(mdev_uuid(mds->mdev), uuid) == 0)
                        return mds;
        }
 
@@ -341,7 +341,8 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state,
                                pr_err("Serial port %d: Fifo level trigger\n",
                                        index);
 #endif
-                               mtty_trigger_interrupt(mdev_state->mdev->uuid);
+                               mtty_trigger_interrupt(
+                                               mdev_uuid(mdev_state->mdev));
                        }
                } else {
 #if defined(DEBUG_INTR)
@@ -355,7 +356,8 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state,
                         */
                        if (mdev_state->s[index].uart_reg[UART_IER] &
                                                                UART_IER_RLSI)
-                               mtty_trigger_interrupt(mdev_state->mdev->uuid);
+                               mtty_trigger_interrupt(
+                                               mdev_uuid(mdev_state->mdev));
                }
                mutex_unlock(&mdev_state->rxtx_lock);
                break;
@@ -374,7 +376,8 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state,
                                pr_err("Serial port %d: IER_THRI write\n",
                                        index);
 #endif
-                               mtty_trigger_interrupt(mdev_state->mdev->uuid);
+                               mtty_trigger_interrupt(
+                                               mdev_uuid(mdev_state->mdev));
                        }
 
                        mutex_unlock(&mdev_state->rxtx_lock);
@@ -445,7 +448,7 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state,
 #if defined(DEBUG_INTR)
                        pr_err("Serial port %d: MCR_OUT2 write\n", index);
 #endif
-                       mtty_trigger_interrupt(mdev_state->mdev->uuid);
+                       mtty_trigger_interrupt(mdev_uuid(mdev_state->mdev));
                }
 
                if ((mdev_state->s[index].uart_reg[UART_IER] & UART_IER_MSI) &&
@@ -453,7 +456,7 @@ static void handle_bar_write(unsigned int index, struct mdev_state *mdev_state,
 #if defined(DEBUG_INTR)
                        pr_err("Serial port %d: MCR RTS/DTR write\n", index);
 #endif
-                       mtty_trigger_interrupt(mdev_state->mdev->uuid);
+                       mtty_trigger_interrupt(mdev_uuid(mdev_state->mdev));
                }
                break;
 
@@ -504,7 +507,8 @@ static void handle_bar_read(unsigned int index, struct mdev_state *mdev_state,
 #endif
                        if (mdev_state->s[index].uart_reg[UART_IER] &
                                                         UART_IER_THRI)
-                               mtty_trigger_interrupt(mdev_state->mdev->uuid);
+                               mtty_trigger_interrupt(
+                                       mdev_uuid(mdev_state->mdev));
                }
                mutex_unlock(&mdev_state->rxtx_lock);
 
@@ -734,7 +738,7 @@ int mtty_create(struct kobject *kobj, struct mdev_device *mdev)
 
        for (i = 0; i < 2; i++) {
                snprintf(name, MTTY_STRING_LEN, "%s-%d",
-                       dev_driver_string(mdev->parent->dev), i + 1);
+                       dev_driver_string(mdev_parent_dev(mdev)), i + 1);
                if (!strcmp(kobj->name, name)) {
                        nr_ports = i + 1;
                        break;
@@ -1298,10 +1302,8 @@ static ssize_t
 sample_mdev_dev_show(struct device *dev, struct device_attribute *attr,
                     char *buf)
 {
-       struct mdev_device *mdev = to_mdev_device(dev);
-
-       if (mdev)
-               return sprintf(buf, "This is MDEV %s\n", dev_name(&mdev->dev));
+       if (mdev_from_dev(dev))
+               return sprintf(buf, "This is MDEV %s\n", dev_name(dev));
 
        return sprintf(buf, "\n");
 }
@@ -1402,7 +1404,7 @@ struct attribute_group *mdev_type_groups[] = {
        NULL,
 };
 
-struct parent_ops mdev_fops = {
+struct mdev_parent_ops mdev_fops = {
        .owner                  = THIS_MODULE,
        .dev_attr_groups        = mtty_dev_groups,
        .mdev_attr_groups       = mdev_dev_groups,
@@ -1447,6 +1449,7 @@ static int __init mtty_dev_init(void)
 
        if (IS_ERR(mtty_dev.vd_class)) {
                pr_err("Error: failed to register mtty_dev class\n");
+               ret = PTR_ERR(mtty_dev.vd_class);
                goto failed1;
        }
 
@@ -1458,7 +1461,8 @@ static int __init mtty_dev_init(void)
        if (ret)
                goto failed2;
 
-       if (mdev_register_device(&mtty_dev.dev, &mdev_fops) != 0)
+       ret = mdev_register_device(&mtty_dev.dev, &mdev_fops);
+       if (ret)
                goto failed3;
 
        mutex_init(&mdev_list_lock);
index 950fd2e64bb73b9f261188bba272ea7e7ec10249..12262c0cc6914e6a5eebac1b887b129a15fb7466 100644 (file)
@@ -39,6 +39,9 @@
 #include "hash-map.h"
 #endif
 
+#if BUILDING_GCC_VERSION >= 7000
+#include "memmodel.h"
+#endif
 #include "emit-rtl.h"
 #include "debug.h"
 #include "target.h"
@@ -91,6 +94,9 @@
 #include "tree-ssa-alias.h"
 #include "tree-ssa.h"
 #include "stringpool.h"
+#if BUILDING_GCC_VERSION >= 7000
+#include "tree-vrp.h"
+#endif
 #include "tree-ssanames.h"
 #include "print-tree.h"
 #include "tree-eh.h"
@@ -287,6 +293,22 @@ static inline struct cgraph_node *cgraph_next_function_with_gimple_body(struct c
        return NULL;
 }
 
+static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable)
+{
+       cgraph_node_ptr alias;
+
+       if (callback(node, data))
+               return true;
+
+       for (alias = node->same_body; alias; alias = alias->next) {
+               if (include_overwritable || cgraph_function_body_availability(alias) > AVAIL_OVERWRITABLE)
+                       if (cgraph_for_node_and_aliases(alias, callback, data, include_overwritable))
+                               return true;
+       }
+
+       return false;
+}
+
 #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
        for ((node) = cgraph_first_function_with_gimple_body(); (node); \
                (node) = cgraph_next_function_with_gimple_body(node))
@@ -399,6 +421,7 @@ typedef union gimple_statement_d gassign;
 typedef union gimple_statement_d gcall;
 typedef union gimple_statement_d gcond;
 typedef union gimple_statement_d gdebug;
+typedef union gimple_statement_d ggoto;
 typedef union gimple_statement_d gphi;
 typedef union gimple_statement_d greturn;
 
@@ -452,6 +475,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt)
        return stmt;
 }
 
+static inline ggoto *as_a_ggoto(gimple stmt)
+{
+       return stmt;
+}
+
+static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
+{
+       return stmt;
+}
+
 static inline gphi *as_a_gphi(gimple stmt)
 {
        return stmt;
@@ -496,6 +529,14 @@ static inline const greturn *as_a_const_greturn(const_gimple stmt)
 
 typedef struct rtx_def rtx_insn;
 
+static inline const char *get_decl_section_name(const_tree decl)
+{
+       if (DECL_SECTION_NAME(decl) == NULL_TREE)
+               return NULL;
+
+       return TREE_STRING_POINTER(DECL_SECTION_NAME(decl));
+}
+
 static inline void set_decl_section_name(tree node, const char *value)
 {
        if (value)
@@ -511,6 +552,7 @@ typedef struct gimple_statement_base gassign;
 typedef struct gimple_statement_call gcall;
 typedef struct gimple_statement_base gcond;
 typedef struct gimple_statement_base gdebug;
+typedef struct gimple_statement_base ggoto;
 typedef struct gimple_statement_phi gphi;
 typedef struct gimple_statement_base greturn;
 
@@ -564,6 +606,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt)
        return stmt;
 }
 
+static inline ggoto *as_a_ggoto(gimple stmt)
+{
+       return stmt;
+}
+
+static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
+{
+       return stmt;
+}
+
 static inline gphi *as_a_gphi(gimple stmt)
 {
        return as_a<gphi>(stmt);
@@ -611,6 +663,11 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs)
 
 #define INSN_DELETED_P(insn) (insn)->deleted()
 
+static inline const char *get_decl_section_name(const_tree decl)
+{
+       return DECL_SECTION_NAME(decl);
+}
+
 /* symtab/cgraph related */
 #define debug_cgraph_node(node) (node)->debug()
 #define cgraph_get_node(decl) cgraph_node::get(decl)
@@ -619,6 +676,7 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs)
 #define cgraph_n_nodes symtab->cgraph_count
 #define cgraph_max_uid symtab->cgraph_max_uid
 #define varpool_get_node(decl) varpool_node::get(decl)
+#define dump_varpool_node(file, node) (node)->dump(file)
 
 #define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
        (caller)->create_edge((callee), (call_stmt), (count), (freq))
@@ -674,6 +732,11 @@ static inline cgraph_node_ptr cgraph_alias_target(cgraph_node_ptr node)
        return node->get_alias_target();
 }
 
+static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable)
+{
+       return node->call_for_symbol_thunks_and_aliases(callback, data, include_overwritable);
+}
+
 static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data)
 {
        return symtab->add_cgraph_insertion_hook(hook, data);
@@ -729,6 +792,13 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l
        return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
 }
 
+template <>
+template <>
+inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
+{
+       return gs->code == GIMPLE_GOTO;
+}
+
 template <>
 template <>
 inline bool is_a_helper<const greturn *>::test(const_gimple gs)
@@ -766,6 +836,16 @@ static inline const gcall *as_a_const_gcall(const_gimple stmt)
        return as_a<const gcall *>(stmt);
 }
 
+static inline ggoto *as_a_ggoto(gimple stmt)
+{
+       return as_a<ggoto *>(stmt);
+}
+
+static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
+{
+       return as_a<const ggoto *>(stmt);
+}
+
 static inline gphi *as_a_gphi(gimple stmt)
 {
        return as_a<gphi *>(stmt);
@@ -828,4 +908,9 @@ static inline void debug_gimple_stmt(const_gimple s)
 #define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
 #endif
 
+#if BUILDING_GCC_VERSION >= 7000
+#define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning)  \
+       get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep)
+#endif
+
 #endif
index 12541126575b1e2416ad48d58f1d01f8e08a5d93..8ff203ad48093f57fccf04bb9d7c9b9e1952603b 100644 (file)
@@ -328,9 +328,9 @@ static enum tree_code get_op(tree *rhs)
                        op = LROTATE_EXPR;
                        /*
                         * This code limits the value of random_const to
-                        * the size of a wide int for the rotation
+                        * the size of a long for the rotation
                         */
-                       random_const &= HOST_BITS_PER_WIDE_INT - 1;
+                       random_const %= TYPE_PRECISION(long_unsigned_type_node);
                        break;
                }
 
index f89f1900e58d09b38ba4dc640f0a48c784e09e93..04a764f71ec88e6385f2c3fc38d5cb903817dfce 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/vmalloc.h>
 #include <linux/security.h>
 #include <linux/uio.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 #define KEY_MAX_DESC_SIZE 4096
index 40a88523978256278e64ace2befc3e45f9868de9..918cddcd4516aef4fd4ba7719b6ad01c69fd039d 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/mutex.h>
 #include <linux/security.h>
 #include <linux/user_namespace.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 /* Session keyring create vs join semaphore */
index 9db8b4a8278711fdf5d157160bb08a19fdd276d2..6bbe2f535f0804d34419fff59f86d9ca26b500a7 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/err.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 #include <keys/user-type.h>
 
index 66b1840b4110b6ee876af85c8ba598a3054a43f8..e187c8909d9db1b306c194e94a25fbf7886adbb1 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/seq_file.h>
 #include <linux/err.h>
 #include <keys/user-type.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "internal.h"
 
 static int logon_vet_description(const char *desc);
index e2f27022b363c482ba2614a2579f87f2b19192e3..1ac0c423903e7f3f41a2045fd20b9707df4ac00f 100644 (file)
@@ -58,7 +58,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
 
        /* calculate the drift */
        delta = ktime_sub(hrt->base->get_time(), hrtimer_get_expires(hrt));
-       if (delta.tv64 > 0)
+       if (delta > 0)
                ticks += ktime_divns(delta, ticks * resolution);
 
        snd_timer_interrupt(stime->timer, ticks);
index 3689f5f6be6498b1aa19dfb72f6446987c591686..aca2d7d5f059568bfc485b906ac8a351f4f7159b 100644 (file)
@@ -166,7 +166,7 @@ static int pcsp_start_playing(struct snd_pcsp *chip)
        atomic_set(&chip->timer_active, 1);
        chip->thalf = 0;
 
-       hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL);
+       hrtimer_start(&pcsp_chip.timer, 0, HRTIMER_MODE_REL);
        return 0;
 }
 
index ee47924aef0df676223975a08df37ad055cc1f51..827161bc269cfa1414972692bcdb45d0a42ad9ed 100644 (file)
@@ -117,7 +117,7 @@ destroy_stream(struct snd_efw *efw, struct amdtp_stream *stream)
                conn = &efw->in_conn;
 
        amdtp_stream_destroy(stream);
-       cmp_connection_destroy(&efw->out_conn);
+       cmp_connection_destroy(conn);
 }
 
 static int
index ca4dfcf4317579158c1cc6178a40fcf7eeda1052..7683238283b6c528e2eafa18f64a877fcbbe02c3 100644 (file)
@@ -114,7 +114,7 @@ static void async_midi_port_callback(struct fw_card *card, int rcode,
                snd_rawmidi_transmit_ack(substream, port->consume_bytes);
        else if (!rcode_is_permanent_error(rcode))
                /* To start next transaction immediately for recovery. */
-               port->next_ktime = ktime_set(0, 0);
+               port->next_ktime = 0;
        else
                /* Don't continue processing. */
                port->error = true;
@@ -156,7 +156,7 @@ static void midi_port_work(struct work_struct *work)
        if (port->consume_bytes <= 0) {
                /* Do it in next chance, immediately. */
                if (port->consume_bytes == 0) {
-                       port->next_ktime = ktime_set(0, 0);
+                       port->next_ktime = 0;
                        schedule_work(&port->work);
                } else {
                        /* Fatal error. */
@@ -219,7 +219,7 @@ int snd_fw_async_midi_port_init(struct snd_fw_async_midi_port *port,
        port->addr = addr;
        port->fill = fill;
        port->idling = true;
-       port->next_ktime = ktime_set(0, 0);
+       port->next_ktime = 0;
        port->error = false;
 
        INIT_WORK(&port->work, midi_port_work);
index 4ad3bd7fd4453e3a64fc4cd95001165510292559..f1657a4e0621ef4999349477ce6e71fdbcd7f411 100644 (file)
@@ -343,7 +343,7 @@ int snd_tscm_stream_init_duplex(struct snd_tscm *tscm)
        if (err < 0)
                amdtp_stream_destroy(&tscm->rx_stream);
 
-       return 0;
+       return err;
 }
 
 /* At bus reset, streaming is stopped and some registers are clear. */
index 38990a77d7b780081167fa14ded35745025553c1..c6994ebb4567bf7f6120f9d94405ce1b557a0970 100644 (file)
@@ -465,7 +465,7 @@ int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
 }
 EXPORT_SYMBOL_GPL(snd_hdac_stream_set_params);
 
-static cycle_t azx_cc_read(const struct cyclecounter *cc)
+static u64 azx_cc_read(const struct cyclecounter *cc)
 {
        struct hdac_stream *azx_dev = container_of(cc, struct hdac_stream, cc);
 
@@ -473,7 +473,7 @@ static cycle_t azx_cc_read(const struct cyclecounter *cc)
 }
 
 static void azx_timecounter_init(struct hdac_stream *azx_dev,
-                                bool force, cycle_t last)
+                                bool force, u64 last)
 {
        struct timecounter *tc = &azx_dev->tc;
        struct cyclecounter *cc = &azx_dev->cc;
@@ -523,7 +523,7 @@ void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev,
        struct snd_pcm_runtime *runtime = azx_dev->substream->runtime;
        struct hdac_stream *s;
        bool inited = false;
-       cycle_t cycle_last = 0;
+       u64 cycle_last = 0;
        int i = 0;
 
        list_for_each_entry(s, &bus->stream_list, list) {
index 1c56bf58eff906e0722c187cb6a4121b86f039fc..a1a2979c0bb1b93e5683abfba1c9870cac142828 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/atariints.h>
 #include <asm/atari_stram.h>
 
index f4ee85a4c42fb910ae2a234ffb4de3bb815bc155..5f248fb41beac9e65c2b6e700bb2254644048d36 100644 (file)
 #include <linux/poll.h>
 #include <linux/mutex.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include "dmasound.h"
 
index 3f653618614d3f37d8c6ea876db8dcc966045cb9..81eb82c4675a00cc168f502dfdb22a552cebbd26 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/setup.h>
 #include <asm/amigahw.h>
 #include <asm/amigaints.h>
index 99bcb21c22819de40784e4ea5873104a9d16945e..be4fe15cfd6b8c8cd43495e8fe7041318248141d 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/soundcard.h>
 #include <linux/interrupt.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/q40ints.h>
 #include <asm/q40_master.h>
 
index c0cc951ba97d99d52fb0a067754380ba44ed905c..b63010ad22f11ee7549ba6971fb25a22efcc5a14 100644 (file)
@@ -32,7 +32,7 @@
 #include <linux/interrupt.h>
 
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/spinlock.h>
 #include <asm/irq.h>
 #include "msnd.h"
index 75ad0cd0c0ab8b31b608c93dbf87ee3c07bf63c7..0bf89e1d679c07f5688d445305ab0f614044f82f 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/ioport.h>
 #include <asm/page.h>
 #include <linux/vmalloc.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/poll.h>
 #include <linux/pci.h>
 #endif
index 213a416b6e0b2c8cc9080742fdbfbe1010c200bc..f3af63e58b363f064ff9f1a7f60414d56b17f351 100644 (file)
@@ -80,7 +80,7 @@
 #include <asm/byteorder.h>
 #include <asm/dma.h>
 #include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #include <asm/sibyte/sb1250_regs.h>
 #include <asm/sibyte/sb1250_int.h>
index 9448daff9d8b55d5de49ef9a4ff66fd9e2a80f6b..7d660ee1d5e84e6f7eaa42404232d9aad461b25c 100644 (file)
@@ -2230,6 +2230,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
        SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
        SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
+       SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
        SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
        SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
        SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
@@ -6983,6 +6984,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
        SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
        SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
+       SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
        SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
        SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
        SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
index abf9c0cab1e2b69ac8256cd14fae066d9cad7c8f..461b310c7872d98adc8e37b86d30a53e77fd1f8c 100644 (file)
@@ -87,7 +87,7 @@ static void dac_audio_reset(struct snd_sh_dac *chip)
 
 static void dac_audio_set_rate(struct snd_sh_dac *chip)
 {
-       chip->wakeups_per_second = ktime_set(0, 1000000000 / chip->rate);
+       chip->wakeups_per_second = 1000000000 / chip->rate;
 }
 
 
index 15d1d5c63c3c40faa5f62316370ea9d8e711fa75..c90607ebe155b4dce4cfa8aa75fc14ecab953d52 100644 (file)
@@ -384,6 +384,9 @@ static void snd_complete_urb(struct urb *urb)
        if (unlikely(atomic_read(&ep->chip->shutdown)))
                goto exit_clear;
 
+       if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
+               goto exit_clear;
+
        if (usb_pipeout(ep->pipe)) {
                retire_outbound_urb(ep, ctx);
                /* can be stopped during retire callback */
@@ -534,6 +537,11 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep)
                        alive, ep->ep_num);
        clear_bit(EP_FLAG_STOPPING, &ep->flags);
 
+       ep->data_subs = NULL;
+       ep->sync_slave = NULL;
+       ep->retire_data_urb = NULL;
+       ep->prepare_data_urb = NULL;
+
        return 0;
 }
 
@@ -912,9 +920,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
 /**
  * snd_usb_endpoint_start: start an snd_usb_endpoint
  *
- * @ep:                the endpoint to start
- * @can_sleep: flag indicating whether the operation is executed in
- *             non-atomic context
+ * @ep: the endpoint to start
  *
  * A call to this function will increment the use count of the endpoint.
  * In case it is not already running, the URBs for this endpoint will be
@@ -924,7 +930,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
  *
  * Returns an error if the URB submission failed, 0 in all other cases.
  */
-int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep)
+int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
 {
        int err;
        unsigned int i;
@@ -938,8 +944,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep)
 
        /* just to be sure */
        deactivate_urbs(ep, false);
-       if (can_sleep)
-               wait_clear_urbs(ep);
 
        ep->active_mask = 0;
        ep->unlink_mask = 0;
@@ -1020,10 +1024,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep)
 
        if (--ep->use_count == 0) {
                deactivate_urbs(ep, false);
-               ep->data_subs = NULL;
-               ep->sync_slave = NULL;
-               ep->retire_data_urb = NULL;
-               ep->prepare_data_urb = NULL;
                set_bit(EP_FLAG_STOPPING, &ep->flags);
        }
 }
index 6428392d8f6244688e65d8be3d04bc9c30c68ce5..584f295d7c7738a6b91753c8c48eed0bf101a200 100644 (file)
@@ -18,7 +18,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
                                struct audioformat *fmt,
                                struct snd_usb_endpoint *sync_ep);
 
-int  snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep);
+int  snd_usb_endpoint_start(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
 int  snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
index 34c6d4f2c0b62967656b1687594161142bedf127..9aa5b18554812a949503375e23764b3d926a0f2d 100644 (file)
@@ -218,7 +218,7 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
        }
 }
 
-static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
+static int start_endpoints(struct snd_usb_substream *subs)
 {
        int err;
 
@@ -231,7 +231,7 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
                dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep);
 
                ep->data_subs = subs;
-               err = snd_usb_endpoint_start(ep, can_sleep);
+               err = snd_usb_endpoint_start(ep);
                if (err < 0) {
                        clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags);
                        return err;
@@ -260,7 +260,7 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
                dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep);
 
                ep->sync_slave = subs->data_endpoint;
-               err = snd_usb_endpoint_start(ep, can_sleep);
+               err = snd_usb_endpoint_start(ep);
                if (err < 0) {
                        clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags);
                        return err;
@@ -850,7 +850,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
        /* for playback, submit the URBs now; otherwise, the first hwptr_done
         * updates for all URBs would happen at the same time when starting */
        if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK)
-               ret = start_endpoints(subs, true);
+               ret = start_endpoints(subs);
 
  unlock:
        snd_usb_unlock_shutdown(subs->stream->chip);
@@ -1666,7 +1666,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
 
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
-               err = start_endpoints(subs, false);
+               err = start_endpoints(subs);
                if (err < 0)
                        return err;
 
index 9e5fc168c8a3d8cb3d8ef424eed6d67a74f2e8ac..0eb0e87dbe9f511672102f2123129328288a9159 100644 (file)
@@ -73,6 +73,8 @@ enum bpf_cmd {
        BPF_PROG_LOAD,
        BPF_OBJ_PIN,
        BPF_OBJ_GET,
+       BPF_PROG_ATTACH,
+       BPF_PROG_DETACH,
 };
 
 enum bpf_map_type {
@@ -85,6 +87,8 @@ enum bpf_map_type {
        BPF_MAP_TYPE_PERCPU_ARRAY,
        BPF_MAP_TYPE_STACK_TRACE,
        BPF_MAP_TYPE_CGROUP_ARRAY,
+       BPF_MAP_TYPE_LRU_HASH,
+       BPF_MAP_TYPE_LRU_PERCPU_HASH,
 };
 
 enum bpf_prog_type {
@@ -95,8 +99,23 @@ enum bpf_prog_type {
        BPF_PROG_TYPE_SCHED_ACT,
        BPF_PROG_TYPE_TRACEPOINT,
        BPF_PROG_TYPE_XDP,
+       BPF_PROG_TYPE_PERF_EVENT,
+       BPF_PROG_TYPE_CGROUP_SKB,
+       BPF_PROG_TYPE_CGROUP_SOCK,
+       BPF_PROG_TYPE_LWT_IN,
+       BPF_PROG_TYPE_LWT_OUT,
+       BPF_PROG_TYPE_LWT_XMIT,
 };
 
+enum bpf_attach_type {
+       BPF_CGROUP_INET_INGRESS,
+       BPF_CGROUP_INET_EGRESS,
+       BPF_CGROUP_INET_SOCK_CREATE,
+       __MAX_BPF_ATTACH_TYPE
+};
+
+#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
+
 #define BPF_PSEUDO_MAP_FD      1
 
 /* flags for BPF_MAP_UPDATE_ELEM command */
@@ -105,6 +124,13 @@ enum bpf_prog_type {
 #define BPF_EXIST      2 /* update existing element */
 
 #define BPF_F_NO_PREALLOC      (1U << 0)
+/* Instead of having one common LRU list in the
+ * BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list
+ * which can scale and perform better.
+ * Note, the LRU nodes (including free nodes) cannot be moved
+ * across different LRU lists.
+ */
+#define BPF_F_NO_COMMON_LRU    (1U << 1)
 
 union bpf_attr {
        struct { /* anonymous struct used by BPF_MAP_CREATE command */
@@ -140,243 +166,327 @@ union bpf_attr {
                __aligned_u64   pathname;
                __u32           bpf_fd;
        };
+
+       struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */
+               __u32           target_fd;      /* container object to attach to */
+               __u32           attach_bpf_fd;  /* eBPF program to attach */
+               __u32           attach_type;
+       };
 } __attribute__((aligned(8)));
 
+/* BPF helper function descriptions:
+ *
+ * void *bpf_map_lookup_elem(&map, &key)
+ *     Return: Map value or NULL
+ *
+ * int bpf_map_update_elem(&map, &key, &value, flags)
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_map_delete_elem(&map, &key)
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_probe_read(void *dst, int size, void *src)
+ *     Return: 0 on success or negative error
+ *
+ * u64 bpf_ktime_get_ns(void)
+ *     Return: current ktime
+ *
+ * int bpf_trace_printk(const char *fmt, int fmt_size, ...)
+ *     Return: length of buffer written or negative error
+ *
+ * u32 bpf_prandom_u32(void)
+ *     Return: random value
+ *
+ * u32 bpf_raw_smp_processor_id(void)
+ *     Return: SMP processor ID
+ *
+ * int bpf_skb_store_bytes(skb, offset, from, len, flags)
+ *     store bytes into packet
+ *     @skb: pointer to skb
+ *     @offset: offset within packet from skb->mac_header
+ *     @from: pointer where to copy bytes from
+ *     @len: number of bytes to store into packet
+ *     @flags: bit 0 - if true, recompute skb->csum
+ *             other bits - reserved
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_l3_csum_replace(skb, offset, from, to, flags)
+ *     recompute IP checksum
+ *     @skb: pointer to skb
+ *     @offset: offset within packet where IP checksum is located
+ *     @from: old value of header field
+ *     @to: new value of header field
+ *     @flags: bits 0-3 - size of header field
+ *             other bits - reserved
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_l4_csum_replace(skb, offset, from, to, flags)
+ *     recompute TCP/UDP checksum
+ *     @skb: pointer to skb
+ *     @offset: offset within packet where TCP/UDP checksum is located
+ *     @from: old value of header field
+ *     @to: new value of header field
+ *     @flags: bits 0-3 - size of header field
+ *             bit 4 - is pseudo header
+ *             other bits - reserved
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_tail_call(ctx, prog_array_map, index)
+ *     jump into another BPF program
+ *     @ctx: context pointer passed to next program
+ *     @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY
+ *     @index: index inside array that selects specific program to run
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_clone_redirect(skb, ifindex, flags)
+ *     redirect to another netdev
+ *     @skb: pointer to skb
+ *     @ifindex: ifindex of the net device
+ *     @flags: bit 0 - if set, redirect to ingress instead of egress
+ *             other bits - reserved
+ *     Return: 0 on success or negative error
+ *
+ * u64 bpf_get_current_pid_tgid(void)
+ *     Return: current->tgid << 32 | current->pid
+ *
+ * u64 bpf_get_current_uid_gid(void)
+ *     Return: current_gid << 32 | current_uid
+ *
+ * int bpf_get_current_comm(char *buf, int size_of_buf)
+ *     stores current->comm into buf
+ *     Return: 0 on success or negative error
+ *
+ * u32 bpf_get_cgroup_classid(skb)
+ *     retrieve a proc's classid
+ *     @skb: pointer to skb
+ *     Return: classid if != 0
+ *
+ * int bpf_skb_vlan_push(skb, vlan_proto, vlan_tci)
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_skb_vlan_pop(skb)
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_skb_get_tunnel_key(skb, key, size, flags)
+ * int bpf_skb_set_tunnel_key(skb, key, size, flags)
+ *     retrieve or populate tunnel metadata
+ *     @skb: pointer to skb
+ *     @key: pointer to 'struct bpf_tunnel_key'
+ *     @size: size of 'struct bpf_tunnel_key'
+ *     @flags: room for future extensions
+ *     Return: 0 on success or negative error
+ *
+ * u64 bpf_perf_event_read(&map, index)
+ *     Return: Number events read or error code
+ *
+ * int bpf_redirect(ifindex, flags)
+ *     redirect to another netdev
+ *     @ifindex: ifindex of the net device
+ *     @flags: bit 0 - if set, redirect to ingress instead of egress
+ *             other bits - reserved
+ *     Return: TC_ACT_REDIRECT
+ *
+ * u32 bpf_get_route_realm(skb)
+ *     retrieve a dst's tclassid
+ *     @skb: pointer to skb
+ *     Return: realm if != 0
+ *
+ * int bpf_perf_event_output(ctx, map, index, data, size)
+ *     output perf raw sample
+ *     @ctx: struct pt_regs*
+ *     @map: pointer to perf_event_array map
+ *     @index: index of event in the map
+ *     @data: data on stack to be output as raw data
+ *     @size: size of data
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_get_stackid(ctx, map, flags)
+ *     walk user or kernel stack and return id
+ *     @ctx: struct pt_regs*
+ *     @map: pointer to stack_trace map
+ *     @flags: bits 0-7 - numer of stack frames to skip
+ *             bit 8 - collect user stack instead of kernel
+ *             bit 9 - compare stacks by hash only
+ *             bit 10 - if two different stacks hash into the same stackid
+ *                      discard old
+ *             other bits - reserved
+ *     Return: >= 0 stackid on success or negative error
+ *
+ * s64 bpf_csum_diff(from, from_size, to, to_size, seed)
+ *     calculate csum diff
+ *     @from: raw from buffer
+ *     @from_size: length of from buffer
+ *     @to: raw to buffer
+ *     @to_size: length of to buffer
+ *     @seed: optional seed
+ *     Return: csum result or negative error code
+ *
+ * int bpf_skb_get_tunnel_opt(skb, opt, size)
+ *     retrieve tunnel options metadata
+ *     @skb: pointer to skb
+ *     @opt: pointer to raw tunnel option data
+ *     @size: size of @opt
+ *     Return: option size
+ *
+ * int bpf_skb_set_tunnel_opt(skb, opt, size)
+ *     populate tunnel options metadata
+ *     @skb: pointer to skb
+ *     @opt: pointer to raw tunnel option data
+ *     @size: size of @opt
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_skb_change_proto(skb, proto, flags)
+ *     Change protocol of the skb. Currently supported is v4 -> v6,
+ *     v6 -> v4 transitions. The helper will also resize the skb. eBPF
+ *     program is expected to fill the new headers via skb_store_bytes
+ *     and lX_csum_replace.
+ *     @skb: pointer to skb
+ *     @proto: new skb->protocol type
+ *     @flags: reserved
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_skb_change_type(skb, type)
+ *     Change packet type of skb.
+ *     @skb: pointer to skb
+ *     @type: new skb->pkt_type type
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_skb_under_cgroup(skb, map, index)
+ *     Check cgroup2 membership of skb
+ *     @skb: pointer to skb
+ *     @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type
+ *     @index: index of the cgroup in the bpf_map
+ *     Return:
+ *       == 0 skb failed the cgroup2 descendant test
+ *       == 1 skb succeeded the cgroup2 descendant test
+ *        < 0 error
+ *
+ * u32 bpf_get_hash_recalc(skb)
+ *     Retrieve and possibly recalculate skb->hash.
+ *     @skb: pointer to skb
+ *     Return: hash
+ *
+ * u64 bpf_get_current_task(void)
+ *     Returns current task_struct
+ *     Return: current
+ *
+ * int bpf_probe_write_user(void *dst, void *src, int len)
+ *     safely attempt to write to a location
+ *     @dst: destination address in userspace
+ *     @src: source address on stack
+ *     @len: number of bytes to copy
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_current_task_under_cgroup(map, index)
+ *     Check cgroup2 membership of current task
+ *     @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type
+ *     @index: index of the cgroup in the bpf_map
+ *     Return:
+ *       == 0 current failed the cgroup2 descendant test
+ *       == 1 current succeeded the cgroup2 descendant test
+ *        < 0 error
+ *
+ * int bpf_skb_change_tail(skb, len, flags)
+ *     The helper will resize the skb to the given new size, to be used f.e.
+ *     with control messages.
+ *     @skb: pointer to skb
+ *     @len: new skb length
+ *     @flags: reserved
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_skb_pull_data(skb, len)
+ *     The helper will pull in non-linear data in case the skb is non-linear
+ *     and not all of len are part of the linear section. Only needed for
+ *     read/write with direct packet access.
+ *     @skb: pointer to skb
+ *     @len: len to make read/writeable
+ *     Return: 0 on success or negative error
+ *
+ * s64 bpf_csum_update(skb, csum)
+ *     Adds csum into skb->csum in case of CHECKSUM_COMPLETE.
+ *     @skb: pointer to skb
+ *     @csum: csum to add
+ *     Return: csum on success or negative error
+ *
+ * void bpf_set_hash_invalid(skb)
+ *     Invalidate current skb->hash.
+ *     @skb: pointer to skb
+ *
+ * int bpf_get_numa_node_id()
+ *     Return: Id of current NUMA node.
+ *
+ * int bpf_skb_change_head()
+ *     Grows headroom of skb and adjusts MAC header offset accordingly.
+ *     Will extends/reallocae as required automatically.
+ *     May change skb data pointer and will thus invalidate any check
+ *     performed for direct packet access.
+ *     @skb: pointer to skb
+ *     @len: length of header to be pushed in front
+ *     @flags: Flags (unused for now)
+ *     Return: 0 on success or negative error
+ *
+ * int bpf_xdp_adjust_head(xdp_md, delta)
+ *     Adjust the xdp_md.data by delta
+ *     @xdp_md: pointer to xdp_md
+ *     @delta: An positive/negative integer to be added to xdp_md.data
+ *     Return: 0 on success or negative on error
+ */
+#define __BPF_FUNC_MAPPER(FN)          \
+       FN(unspec),                     \
+       FN(map_lookup_elem),            \
+       FN(map_update_elem),            \
+       FN(map_delete_elem),            \
+       FN(probe_read),                 \
+       FN(ktime_get_ns),               \
+       FN(trace_printk),               \
+       FN(get_prandom_u32),            \
+       FN(get_smp_processor_id),       \
+       FN(skb_store_bytes),            \
+       FN(l3_csum_replace),            \
+       FN(l4_csum_replace),            \
+       FN(tail_call),                  \
+       FN(clone_redirect),             \
+       FN(get_current_pid_tgid),       \
+       FN(get_current_uid_gid),        \
+       FN(get_current_comm),           \
+       FN(get_cgroup_classid),         \
+       FN(skb_vlan_push),              \
+       FN(skb_vlan_pop),               \
+       FN(skb_get_tunnel_key),         \
+       FN(skb_set_tunnel_key),         \
+       FN(perf_event_read),            \
+       FN(redirect),                   \
+       FN(get_route_realm),            \
+       FN(perf_event_output),          \
+       FN(skb_load_bytes),             \
+       FN(get_stackid),                \
+       FN(csum_diff),                  \
+       FN(skb_get_tunnel_opt),         \
+       FN(skb_set_tunnel_opt),         \
+       FN(skb_change_proto),           \
+       FN(skb_change_type),            \
+       FN(skb_under_cgroup),           \
+       FN(get_hash_recalc),            \
+       FN(get_current_task),           \
+       FN(probe_write_user),           \
+       FN(current_task_under_cgroup),  \
+       FN(skb_change_tail),            \
+       FN(skb_pull_data),              \
+       FN(csum_update),                \
+       FN(set_hash_invalid),           \
+       FN(get_numa_node_id),           \
+       FN(skb_change_head),            \
+       FN(xdp_adjust_head),
+
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
  */
+#define __BPF_ENUM_FN(x) BPF_FUNC_ ## x
 enum bpf_func_id {
-       BPF_FUNC_unspec,
-       BPF_FUNC_map_lookup_elem, /* void *map_lookup_elem(&map, &key) */
-       BPF_FUNC_map_update_elem, /* int map_update_elem(&map, &key, &value, flags) */
-       BPF_FUNC_map_delete_elem, /* int map_delete_elem(&map, &key) */
-       BPF_FUNC_probe_read,      /* int bpf_probe_read(void *dst, int size, void *src) */
-       BPF_FUNC_ktime_get_ns,    /* u64 bpf_ktime_get_ns(void) */
-       BPF_FUNC_trace_printk,    /* int bpf_trace_printk(const char *fmt, int fmt_size, ...) */
-       BPF_FUNC_get_prandom_u32, /* u32 prandom_u32(void) */
-       BPF_FUNC_get_smp_processor_id, /* u32 raw_smp_processor_id(void) */
-
-       /**
-        * skb_store_bytes(skb, offset, from, len, flags) - store bytes into packet
-        * @skb: pointer to skb
-        * @offset: offset within packet from skb->mac_header
-        * @from: pointer where to copy bytes from
-        * @len: number of bytes to store into packet
-        * @flags: bit 0 - if true, recompute skb->csum
-        *         other bits - reserved
-        * Return: 0 on success
-        */
-       BPF_FUNC_skb_store_bytes,
-
-       /**
-        * l3_csum_replace(skb, offset, from, to, flags) - recompute IP checksum
-        * @skb: pointer to skb
-        * @offset: offset within packet where IP checksum is located
-        * @from: old value of header field
-        * @to: new value of header field
-        * @flags: bits 0-3 - size of header field
-        *         other bits - reserved
-        * Return: 0 on success
-        */
-       BPF_FUNC_l3_csum_replace,
-
-       /**
-        * l4_csum_replace(skb, offset, from, to, flags) - recompute TCP/UDP checksum
-        * @skb: pointer to skb
-        * @offset: offset within packet where TCP/UDP checksum is located
-        * @from: old value of header field
-        * @to: new value of header field
-        * @flags: bits 0-3 - size of header field
-        *         bit 4 - is pseudo header
-        *         other bits - reserved
-        * Return: 0 on success
-        */
-       BPF_FUNC_l4_csum_replace,
-
-       /**
-        * bpf_tail_call(ctx, prog_array_map, index) - jump into another BPF program
-        * @ctx: context pointer passed to next program
-        * @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY
-        * @index: index inside array that selects specific program to run
-        * Return: 0 on success
-        */
-       BPF_FUNC_tail_call,
-
-       /**
-        * bpf_clone_redirect(skb, ifindex, flags) - redirect to another netdev
-        * @skb: pointer to skb
-        * @ifindex: ifindex of the net device
-        * @flags: bit 0 - if set, redirect to ingress instead of egress
-        *         other bits - reserved
-        * Return: 0 on success
-        */
-       BPF_FUNC_clone_redirect,
-
-       /**
-        * u64 bpf_get_current_pid_tgid(void)
-        * Return: current->tgid << 32 | current->pid
-        */
-       BPF_FUNC_get_current_pid_tgid,
-
-       /**
-        * u64 bpf_get_current_uid_gid(void)
-        * Return: current_gid << 32 | current_uid
-        */
-       BPF_FUNC_get_current_uid_gid,
-
-       /**
-        * bpf_get_current_comm(char *buf, int size_of_buf)
-        * stores current->comm into buf
-        * Return: 0 on success
-        */
-       BPF_FUNC_get_current_comm,
-
-       /**
-        * bpf_get_cgroup_classid(skb) - retrieve a proc's classid
-        * @skb: pointer to skb
-        * Return: classid if != 0
-        */
-       BPF_FUNC_get_cgroup_classid,
-       BPF_FUNC_skb_vlan_push, /* bpf_skb_vlan_push(skb, vlan_proto, vlan_tci) */
-       BPF_FUNC_skb_vlan_pop,  /* bpf_skb_vlan_pop(skb) */
-
-       /**
-        * bpf_skb_[gs]et_tunnel_key(skb, key, size, flags)
-        * retrieve or populate tunnel metadata
-        * @skb: pointer to skb
-        * @key: pointer to 'struct bpf_tunnel_key'
-        * @size: size of 'struct bpf_tunnel_key'
-        * @flags: room for future extensions
-        * Retrun: 0 on success
-        */
-       BPF_FUNC_skb_get_tunnel_key,
-       BPF_FUNC_skb_set_tunnel_key,
-       BPF_FUNC_perf_event_read,       /* u64 bpf_perf_event_read(&map, index) */
-       /**
-        * bpf_redirect(ifindex, flags) - redirect to another netdev
-        * @ifindex: ifindex of the net device
-        * @flags: bit 0 - if set, redirect to ingress instead of egress
-        *         other bits - reserved
-        * Return: TC_ACT_REDIRECT
-        */
-       BPF_FUNC_redirect,
-
-       /**
-        * bpf_get_route_realm(skb) - retrieve a dst's tclassid
-        * @skb: pointer to skb
-        * Return: realm if != 0
-        */
-       BPF_FUNC_get_route_realm,
-
-       /**
-        * bpf_perf_event_output(ctx, map, index, data, size) - output perf raw sample
-        * @ctx: struct pt_regs*
-        * @map: pointer to perf_event_array map
-        * @index: index of event in the map
-        * @data: data on stack to be output as raw data
-        * @size: size of data
-        * Return: 0 on success
-        */
-       BPF_FUNC_perf_event_output,
-       BPF_FUNC_skb_load_bytes,
-
-       /**
-        * bpf_get_stackid(ctx, map, flags) - walk user or kernel stack and return id
-        * @ctx: struct pt_regs*
-        * @map: pointer to stack_trace map
-        * @flags: bits 0-7 - numer of stack frames to skip
-        *         bit 8 - collect user stack instead of kernel
-        *         bit 9 - compare stacks by hash only
-        *         bit 10 - if two different stacks hash into the same stackid
-        *                  discard old
-        *         other bits - reserved
-        * Return: >= 0 stackid on success or negative error
-        */
-       BPF_FUNC_get_stackid,
-
-       /**
-        * bpf_csum_diff(from, from_size, to, to_size, seed) - calculate csum diff
-        * @from: raw from buffer
-        * @from_size: length of from buffer
-        * @to: raw to buffer
-        * @to_size: length of to buffer
-        * @seed: optional seed
-        * Return: csum result
-        */
-       BPF_FUNC_csum_diff,
-
-       /**
-        * bpf_skb_[gs]et_tunnel_opt(skb, opt, size)
-        * retrieve or populate tunnel options metadata
-        * @skb: pointer to skb
-        * @opt: pointer to raw tunnel option data
-        * @size: size of @opt
-        * Return: 0 on success for set, option size for get
-        */
-       BPF_FUNC_skb_get_tunnel_opt,
-       BPF_FUNC_skb_set_tunnel_opt,
-
-       /**
-        * bpf_skb_change_proto(skb, proto, flags)
-        * Change protocol of the skb. Currently supported is
-        * v4 -> v6, v6 -> v4 transitions. The helper will also
-        * resize the skb. eBPF program is expected to fill the
-        * new headers via skb_store_bytes and lX_csum_replace.
-        * @skb: pointer to skb
-        * @proto: new skb->protocol type
-        * @flags: reserved
-        * Return: 0 on success or negative error
-        */
-       BPF_FUNC_skb_change_proto,
-
-       /**
-        * bpf_skb_change_type(skb, type)
-        * Change packet type of skb.
-        * @skb: pointer to skb
-        * @type: new skb->pkt_type type
-        * Return: 0 on success or negative error
-        */
-       BPF_FUNC_skb_change_type,
-
-       /**
-        * bpf_skb_under_cgroup(skb, map, index) - Check cgroup2 membership of skb
-        * @skb: pointer to skb
-        * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type
-        * @index: index of the cgroup in the bpf_map
-        * Return:
-        *   == 0 skb failed the cgroup2 descendant test
-        *   == 1 skb succeeded the cgroup2 descendant test
-        *    < 0 error
-        */
-       BPF_FUNC_skb_under_cgroup,
-
-       /**
-        * bpf_get_hash_recalc(skb)
-        * Retrieve and possibly recalculate skb->hash.
-        * @skb: pointer to skb
-        * Return: hash
-        */
-       BPF_FUNC_get_hash_recalc,
-
-       /**
-        * u64 bpf_get_current_task(void)
-        * Returns current task_struct
-        * Return: current
-        */
-       BPF_FUNC_get_current_task,
-
-       /**
-        * bpf_probe_write_user(void *dst, void *src, int len)
-        * safely attempt to write to a location
-        * @dst: destination address in userspace
-        * @src: source address on stack
-        * @len: number of bytes to copy
-        * Return: 0 on success or negative error
-        */
-       BPF_FUNC_probe_write_user,
-
+       __BPF_FUNC_MAPPER(__BPF_ENUM_FN)
        __BPF_FUNC_MAX_ID,
 };
+#undef __BPF_ENUM_FN
 
 /* All flags used by eBPF helper functions, placed here. */
 
@@ -450,6 +560,31 @@ struct bpf_tunnel_key {
        __u32 tunnel_label;
 };
 
+/* Generic BPF return codes which all BPF program types may support.
+ * The values are binary compatible with their TC_ACT_* counter-part to
+ * provide backwards compatibility with existing SCHED_CLS and SCHED_ACT
+ * programs.
+ *
+ * XDP is handled seprately, see XDP_*.
+ */
+enum bpf_ret_code {
+       BPF_OK = 0,
+       /* 1 reserved */
+       BPF_DROP = 2,
+       /* 3-6 reserved */
+       BPF_REDIRECT = 7,
+       /* >127 are reserved for prog type specific return codes */
+};
+
+struct bpf_sock {
+       __u32 bound_dev_if;
+       __u32 family;
+       __u32 type;
+       __u32 protocol;
+};
+
+#define XDP_PACKET_HEADROOM 256
+
 /* User return codes for XDP prog type.
  * A valid XDP program must return one of these defined values. All other
  * return codes are reserved for future use. Unknown return codes will result
index 8143536b462a54a9d633e455615085b8a842aa01..3ddb58a36d3c2534ce6207581a4fee1730c6e6a0 100644 (file)
@@ -54,7 +54,7 @@ static int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
 }
 
 int bpf_create_map(enum bpf_map_type map_type, int key_size,
-                  int value_size, int max_entries)
+                  int value_size, int max_entries, __u32 map_flags)
 {
        union bpf_attr attr;
 
@@ -64,13 +64,14 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size,
        attr.key_size = key_size;
        attr.value_size = value_size;
        attr.max_entries = max_entries;
+       attr.map_flags = map_flags;
 
        return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
 }
 
 int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns,
                     size_t insns_cnt, char *license,
-                    u32 kern_version, char *log_buf, size_t log_buf_sz)
+                    __u32 kern_version, char *log_buf, size_t log_buf_sz)
 {
        int fd;
        union bpf_attr attr;
@@ -98,7 +99,7 @@ int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns,
 }
 
 int bpf_map_update_elem(int fd, void *key, void *value,
-                       u64 flags)
+                       __u64 flags)
 {
        union bpf_attr attr;
 
@@ -166,3 +167,26 @@ int bpf_obj_get(const char *pathname)
 
        return sys_bpf(BPF_OBJ_GET, &attr, sizeof(attr));
 }
+
+int bpf_prog_attach(int prog_fd, int target_fd, enum bpf_attach_type type)
+{
+       union bpf_attr attr;
+
+       bzero(&attr, sizeof(attr));
+       attr.target_fd     = target_fd;
+       attr.attach_bpf_fd = prog_fd;
+       attr.attach_type   = type;
+
+       return sys_bpf(BPF_PROG_ATTACH, &attr, sizeof(attr));
+}
+
+int bpf_prog_detach(int target_fd, enum bpf_attach_type type)
+{
+       union bpf_attr attr;
+
+       bzero(&attr, sizeof(attr));
+       attr.target_fd   = target_fd;
+       attr.attach_type = type;
+
+       return sys_bpf(BPF_PROG_DETACH, &attr, sizeof(attr));
+}
index 253c3dbb06b420a39558512f89b80ce81a719287..a2f9853dd88259d810e6506ec5ac48d863bc074b 100644 (file)
 #include <linux/bpf.h>
 
 int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
-                  int max_entries);
+                  int max_entries, __u32 map_flags);
 
 /* Recommend log buffer size */
 #define BPF_LOG_BUF_SIZE 65536
 int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns,
                     size_t insns_cnt, char *license,
-                    u32 kern_version, char *log_buf,
+                    __u32 kern_version, char *log_buf,
                     size_t log_buf_sz);
 
 int bpf_map_update_elem(int fd, void *key, void *value,
-                       u64 flags);
+                       __u64 flags);
 
 int bpf_map_lookup_elem(int fd, void *key, void *value);
 int bpf_map_delete_elem(int fd, void *key);
 int bpf_map_get_next_key(int fd, void *key, void *next_key);
 int bpf_obj_pin(int fd, const char *pathname);
 int bpf_obj_get(const char *pathname);
+int bpf_prog_attach(int prog_fd, int attachable_fd, enum bpf_attach_type type);
+int bpf_prog_detach(int attachable_fd, enum bpf_attach_type type);
+
 
 #endif
index 2e974593f3e8dc2b14b47d61b9354b31f7c8c0c5..84e6b35da4bd7da84022a1d914f765c5f7d8e3c6 100644 (file)
@@ -854,7 +854,8 @@ bpf_object__create_maps(struct bpf_object *obj)
                *pfd = bpf_create_map(def->type,
                                      def->key_size,
                                      def->value_size,
-                                     def->max_entries);
+                                     def->max_entries,
+                                     0);
                if (*pfd < 0) {
                        size_t j;
                        int err = *pfd;
index 7775b1eb2bee6bd092fe854b63b12150aa50699f..76173969ab80375c468e2722ec5e2773dab96a7c 100644 (file)
@@ -132,6 +132,10 @@ OPTIONS for 'perf sched timehist'
 --migrations::
        Show migration events.
 
+-I::
+--idle-hist::
+       Show idle-related events only.
+
 --time::
        Only analyze samples within given time window: <start>,<stop>. Times
        have the format seconds.microseconds. If start is not given (i.e., time
index e5af38eede17f5ec09aaaabf9ad963b6524e7cb1..8fc24824705e0bfecd696bfc50a53ec4924cf9d7 100644 (file)
@@ -201,6 +201,7 @@ goals := $(filter-out all sub-make, $(MAKECMDGOALS))
 $(goals) all: sub-make
 
 sub-make: fixdep
+       @./check-headers.sh
        $(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals)
 
 else # force_fixdep
@@ -404,99 +405,6 @@ export JEVENTS
 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
 $(PERF_IN): prepare FORCE
-       @(test -f ../../include/uapi/linux/perf_event.h && ( \
-        (diff -B ../include/uapi/linux/perf_event.h ../../include/uapi/linux/perf_event.h >/dev/null) \
-        || echo "Warning: tools/include/uapi/linux/perf_event.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/linux/hash.h && ( \
-        (diff -B ../include/linux/hash.h ../../include/linux/hash.h >/dev/null) \
-        || echo "Warning: tools/include/linux/hash.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/uapi/linux/hw_breakpoint.h && ( \
-        (diff -B ../include/uapi/linux/hw_breakpoint.h ../../include/uapi/linux/hw_breakpoint.h >/dev/null) \
-        || echo "Warning: tools/include/uapi/linux/hw_breakpoint.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/include/asm/disabled-features.h && ( \
-        (diff -B ../arch/x86/include/asm/disabled-features.h ../../arch/x86/include/asm/disabled-features.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/asm/disabled-features.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/include/asm/required-features.h && ( \
-        (diff -B ../arch/x86/include/asm/required-features.h ../../arch/x86/include/asm/required-features.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/asm/required-features.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/include/asm/cpufeatures.h && ( \
-        (diff -B ../arch/x86/include/asm/cpufeatures.h ../../arch/x86/include/asm/cpufeatures.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/asm/cpufeatures.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/lib/memcpy_64.S && ( \
-        (diff -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" ../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memcpy_64.S >/dev/null) \
-        || echo "Warning: tools/arch/x86/lib/memcpy_64.S differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/lib/memset_64.S && ( \
-        (diff -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" ../arch/x86/lib/memset_64.S ../../arch/x86/lib/memset_64.S >/dev/null) \
-        || echo "Warning: tools/arch/x86/lib/memset_64.S differs from kernel" >&2 )) || true
-       @(test -f ../../arch/arm/include/uapi/asm/perf_regs.h && ( \
-        (diff -B ../arch/arm/include/uapi/asm/perf_regs.h ../../arch/arm/include/uapi/asm/perf_regs.h >/dev/null) \
-        || echo "Warning: tools/arch/arm/include/uapi/asm/perf_regs.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/arm64/include/uapi/asm/perf_regs.h && ( \
-        (diff -B ../arch/arm64/include/uapi/asm/perf_regs.h ../../arch/arm64/include/uapi/asm/perf_regs.h >/dev/null) \
-        || echo "Warning: tools/arch/arm64/include/uapi/asm/perf_regs.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/powerpc/include/uapi/asm/perf_regs.h && ( \
-        (diff -B ../arch/powerpc/include/uapi/asm/perf_regs.h ../../arch/powerpc/include/uapi/asm/perf_regs.h >/dev/null) \
-        || echo "Warning: tools/arch/powerpc/include/uapi/asm/perf_regs.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/include/uapi/asm/perf_regs.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/perf_regs.h ../../arch/x86/include/uapi/asm/perf_regs.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/perf_regs.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/kvm.h ../../arch/x86/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/include/uapi/asm/kvm_perf.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/kvm_perf.h ../../arch/x86/include/uapi/asm/kvm_perf.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/kvm_perf.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/include/uapi/asm/svm.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/svm.h ../../arch/x86/include/uapi/asm/svm.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/svm.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/x86/include/uapi/asm/vmx.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/vmx.h ../../arch/x86/include/uapi/asm/vmx.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/vmx.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/powerpc/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/powerpc/include/uapi/asm/kvm.h ../../arch/powerpc/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/powerpc/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/s390/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/s390/include/uapi/asm/kvm.h ../../arch/s390/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/s390/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/s390/include/uapi/asm/kvm_perf.h && ( \
-        (diff -B ../arch/s390/include/uapi/asm/kvm_perf.h ../../arch/s390/include/uapi/asm/kvm_perf.h >/dev/null) \
-        || echo "Warning: tools/arch/s390/include/uapi/asm/kvm_perf.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/s390/include/uapi/asm/sie.h && ( \
-        (diff -B ../arch/s390/include/uapi/asm/sie.h ../../arch/s390/include/uapi/asm/sie.h >/dev/null) \
-        || echo "Warning: tools/arch/s390/include/uapi/asm/sie.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/arm/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/arm/include/uapi/asm/kvm.h ../../arch/arm/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/arm/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-       @(test -f ../../arch/arm64/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/arm64/include/uapi/asm/kvm.h ../../arch/arm64/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/arm64/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/asm-generic/bitops/arch_hweight.h && ( \
-        (diff -B ../include/asm-generic/bitops/arch_hweight.h ../../include/asm-generic/bitops/arch_hweight.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/arch_hweight.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/asm-generic/bitops/const_hweight.h && ( \
-        (diff -B ../include/asm-generic/bitops/const_hweight.h ../../include/asm-generic/bitops/const_hweight.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/const_hweight.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/asm-generic/bitops/__fls.h && ( \
-        (diff -B ../include/asm-generic/bitops/__fls.h ../../include/asm-generic/bitops/__fls.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/__fls.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/asm-generic/bitops/fls.h && ( \
-        (diff -B ../include/asm-generic/bitops/fls.h ../../include/asm-generic/bitops/fls.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/fls.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/asm-generic/bitops/fls64.h && ( \
-        (diff -B ../include/asm-generic/bitops/fls64.h ../../include/asm-generic/bitops/fls64.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/fls64.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/linux/coresight-pmu.h && ( \
-       (diff -B ../include/linux/coresight-pmu.h ../../include/linux/coresight-pmu.h >/dev/null) \
-       || echo "Warning: tools/include/linux/coresight-pmu.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/uapi/asm-generic/mman-common.h && ( \
-       (diff -B ../include/uapi/asm-generic/mman-common.h ../../include/uapi/asm-generic/mman-common.h >/dev/null) \
-       || echo "Warning: tools/include/uapi/asm-generic/mman-common.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/uapi/asm-generic/mman.h && ( \
-       (diff -B -I "^#include <\(uapi/\)*asm-generic/mman-common.h>$$" ../include/uapi/asm-generic/mman.h ../../include/uapi/asm-generic/mman.h >/dev/null) \
-       || echo "Warning: tools/include/uapi/asm-generic/mman.h differs from kernel" >&2 )) || true
-       @(test -f ../../include/uapi/linux/mman.h && ( \
-       (diff -B -I "^#include <\(uapi/\)*asm/mman.h>$$" ../include/uapi/linux/mman.h ../../include/uapi/linux/mman.h >/dev/null) \
-       || echo "Warning: tools/include/uapi/linux/mman.h differs from kernel" >&2 )) || true
        $(Q)$(MAKE) $(build)=perf
 
 $(JEVENTS_IN): FORCE
index 465012b320ee75a594465d4b76a2648811f7cb59..6d9d6c40a9164442ce2d0c8a9cdd8831cd4a6297 100644 (file)
@@ -48,7 +48,7 @@ static const struct option options[] = {
 };
 
 static const char * const bench_futex_lock_pi_usage[] = {
-       "perf bench futex requeue <options>",
+       "perf bench futex lock-pi <options>",
        NULL
 };
 
index 4b419631753d4882c9038e888113a76cc9f3b124..f8ca7a4ebabcf2f9b805283ddf4df82804316bee 100644 (file)
@@ -208,7 +208,7 @@ static void compute_stats(struct c2c_hist_entry *c2c_he,
 static int process_sample_event(struct perf_tool *tool __maybe_unused,
                                union perf_event *event,
                                struct perf_sample *sample,
-                               struct perf_evsel *evsel __maybe_unused,
+                               struct perf_evsel *evsel,
                                struct machine *machine)
 {
        struct c2c_hists *c2c_hists = &c2c.hists;
@@ -379,7 +379,7 @@ static int symbol_width(struct hists *hists, struct sort_entry *se)
 
 static int c2c_width(struct perf_hpp_fmt *fmt,
                     struct perf_hpp *hpp __maybe_unused,
-                    struct hists *hists __maybe_unused)
+                    struct hists *hists)
 {
        struct c2c_fmt *c2c_fmt;
        struct c2c_dimension *dim;
@@ -1127,7 +1127,7 @@ MEAN_ENTRY(mean_lcl_entry,  lcl_hitm);
 MEAN_ENTRY(mean_load_entry, load);
 
 static int
-cpucnt_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
+cpucnt_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
             struct hist_entry *he)
 {
        struct c2c_hist_entry *c2c_he;
@@ -1141,7 +1141,7 @@ cpucnt_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
 }
 
 static int
-cl_idx_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
+cl_idx_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
             struct hist_entry *he)
 {
        struct c2c_hist_entry *c2c_he;
@@ -1155,7 +1155,7 @@ cl_idx_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
 }
 
 static int
-cl_idx_empty_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
+cl_idx_empty_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
                   struct hist_entry *he)
 {
        int width = c2c_width(fmt, hpp, he->hists);
@@ -1779,7 +1779,6 @@ static int c2c_hists__init(struct c2c_hists *hists,
        return hpp_list__parse(&hists->list, NULL, sort);
 }
 
-__maybe_unused
 static int c2c_hists__reinit(struct c2c_hists *c2c_hists,
                             const char *output,
                             const char *sort)
@@ -2658,7 +2657,7 @@ out:
        return err;
 }
 
-static int parse_record_events(const struct option *opt __maybe_unused,
+static int parse_record_events(const struct option *opt,
                               const char *str, int unset __maybe_unused)
 {
        bool *event_set = (bool *) opt->value;
index d1ce29be560e5e7dad2a2faca9a68c2246510a11..cd7bc4d104e27e878e1ed694bf6be1d9b89d0a9d 100644 (file)
@@ -70,8 +70,8 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
        OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
        OPT_INCR('v', "verbose", &verbose,
                 "be more verbose (show counter open errors, etc)"),
-       OPT_BOOLEAN('U', "--all-user", &all_user, "collect only user level data"),
-       OPT_BOOLEAN('K', "--all-kernel", &all_kernel, "collect only kernel level data"),
+       OPT_BOOLEAN('U', "all-user", &all_user, "collect only user level data"),
+       OPT_BOOLEAN('K', "all-kernel", &all_kernel, "collect only kernel level data"),
        OPT_END()
        };
 
index fa26865364b64808e39407e5a3a6e5c9aa277d64..74d6a035133a96a7303287e130abe73af3fc4622 100644 (file)
@@ -1687,6 +1687,9 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
                goto out;
        }
 
+       /* Enable ignoring missing threads when -u option is defined. */
+       rec->opts.ignore_missing_thread = rec->opts.target.uid != UINT_MAX;
+
        err = -ENOMEM;
        if (perf_evlist__create_maps(rec->evlist, &rec->opts.target) < 0)
                usage_with_options(record_usage, record_options);
index d2afbe4a240dbc5c90168ff15a60405fa324bf8f..06cc759a459758472fc73925222b3eadd28aeee0 100644 (file)
@@ -648,7 +648,7 @@ report_parse_ignore_callees_opt(const struct option *opt __maybe_unused,
 }
 
 static int
-parse_branch_mode(const struct option *opt __maybe_unused,
+parse_branch_mode(const struct option *opt,
                  const char *str __maybe_unused, int unset)
 {
        int *branch_mode = opt->value;
index 1a3f1be93372fe3ef3ddb4ffd7cf427c9b8392cd..d53e706a6f1706d2d69caa93132521f55d89d072 100644 (file)
@@ -200,6 +200,7 @@ struct perf_sched {
        /* options for timehist command */
        bool            summary;
        bool            summary_only;
+       bool            idle_hist;
        bool            show_callchain;
        unsigned int    max_stack;
        bool            show_cpu_visual;
@@ -230,6 +231,15 @@ struct evsel_runtime {
        u32 ncpu;       /* highest cpu slot allocated */
 };
 
+/* per cpu idle time data */
+struct idle_thread_runtime {
+       struct thread_runtime   tr;
+       struct thread           *last_thread;
+       struct rb_root          sorted_root;
+       struct callchain_root   callchain;
+       struct callchain_cursor cursor;
+};
+
 /* track idle times per cpu */
 static struct thread **idle_threads;
 static int idle_max_cpu;
@@ -1765,7 +1775,7 @@ static u64 perf_evsel__get_time(struct perf_evsel *evsel, u32 cpu)
        return r->last_time[cpu];
 }
 
-static int comm_width = 20;
+static int comm_width = 30;
 
 static char *timehist_get_commstr(struct thread *thread)
 {
@@ -1807,7 +1817,7 @@ static void timehist_header(struct perf_sched *sched)
                printf(" ");
        }
 
-       printf(" %-20s  %9s  %9s  %9s",
+       printf(" %-*s  %9s  %9s  %9s", comm_width,
                "task name", "wait time", "sch delay", "run time");
 
        printf("\n");
@@ -1820,7 +1830,8 @@ static void timehist_header(struct perf_sched *sched)
        if (sched->show_cpu_visual)
                printf(" %*s ", ncpus, "");
 
-       printf(" %-20s  %9s  %9s  %9s\n", "[tid/pid]", "(msec)", "(msec)", "(msec)");
+       printf(" %-*s  %9s  %9s  %9s\n", comm_width,
+              "[tid/pid]", "(msec)", "(msec)", "(msec)");
 
        /*
         * separator
@@ -1830,7 +1841,7 @@ static void timehist_header(struct perf_sched *sched)
        if (sched->show_cpu_visual)
                printf(" %.*s ", ncpus, graph_dotted_line);
 
-       printf(" %.20s  %.9s  %.9s  %.9s",
+       printf(" %.*s  %.9s  %.9s  %.9s", comm_width,
                graph_dotted_line, graph_dotted_line, graph_dotted_line,
                graph_dotted_line);
 
@@ -1939,39 +1950,40 @@ static void timehist_update_runtime_stats(struct thread_runtime *r,
        r->total_run_time += r->dt_run;
 }
 
-static bool is_idle_sample(struct perf_sched *sched,
-                          struct perf_sample *sample,
-                          struct perf_evsel *evsel,
-                          struct machine *machine)
+static bool is_idle_sample(struct perf_sample *sample,
+                          struct perf_evsel *evsel)
 {
-       struct thread *thread;
-       struct callchain_cursor *cursor = &callchain_cursor;
-
        /* pid 0 == swapper == idle task */
-       if (sample->pid == 0)
-               return true;
+       if (strcmp(perf_evsel__name(evsel), "sched:sched_switch") == 0)
+               return perf_evsel__intval(evsel, sample, "prev_pid") == 0;
 
-       if (strcmp(perf_evsel__name(evsel), "sched:sched_switch") == 0) {
-               if (perf_evsel__intval(evsel, sample, "prev_pid") == 0)
-                       return true;
-       }
+       return sample->pid == 0;
+}
+
+static void save_task_callchain(struct perf_sched *sched,
+                               struct perf_sample *sample,
+                               struct perf_evsel *evsel,
+                               struct machine *machine)
+{
+       struct callchain_cursor *cursor = &callchain_cursor;
+       struct thread *thread;
 
        /* want main thread for process - has maps */
        thread = machine__findnew_thread(machine, sample->pid, sample->pid);
        if (thread == NULL) {
                pr_debug("Failed to get thread for pid %d.\n", sample->pid);
-               return false;
+               return;
        }
 
        if (!symbol_conf.use_callchain || sample->callchain == NULL)
-               return false;
+               return;
 
        if (thread__resolve_callchain(thread, cursor, evsel, sample,
                                      NULL, NULL, sched->max_stack + 2) != 0) {
                if (verbose)
                        error("Failed to resolve callchain. Skipping\n");
 
-               return false;
+               return;
        }
 
        callchain_cursor_commit(cursor);
@@ -1994,8 +2006,24 @@ static bool is_idle_sample(struct perf_sched *sched,
 
                callchain_cursor_advance(cursor);
        }
+}
+
+static int init_idle_thread(struct thread *thread)
+{
+       struct idle_thread_runtime *itr;
+
+       thread__set_comm(thread, idle_comm, 0);
+
+       itr = zalloc(sizeof(*itr));
+       if (itr == NULL)
+               return -ENOMEM;
 
-       return false;
+       init_stats(&itr->tr.run_stats);
+       callchain_init(&itr->callchain);
+       callchain_cursor_reset(&itr->cursor);
+       thread__set_priv(thread, itr);
+
+       return 0;
 }
 
 /*
@@ -2004,7 +2032,7 @@ static bool is_idle_sample(struct perf_sched *sched,
  */
 static int init_idle_threads(int ncpu)
 {
-       int i;
+       int i, ret;
 
        idle_threads = zalloc(ncpu * sizeof(struct thread *));
        if (!idle_threads)
@@ -2018,7 +2046,9 @@ static int init_idle_threads(int ncpu)
                if (idle_threads[i] == NULL)
                        return -ENOMEM;
 
-               thread__set_comm(idle_threads[i], idle_comm, 0);
+               ret = init_idle_thread(idle_threads[i]);
+               if (ret < 0)
+                       return ret;
        }
 
        return 0;
@@ -2065,14 +2095,23 @@ static struct thread *get_idle_thread(int cpu)
                idle_threads[cpu] = thread__new(0, 0);
 
                if (idle_threads[cpu]) {
-                       idle_threads[cpu]->tid = 0;
-                       thread__set_comm(idle_threads[cpu], idle_comm, 0);
+                       if (init_idle_thread(idle_threads[cpu]) < 0)
+                               return NULL;
                }
        }
 
        return idle_threads[cpu];
 }
 
+static void save_idle_callchain(struct idle_thread_runtime *itr,
+                               struct perf_sample *sample)
+{
+       if (!symbol_conf.use_callchain || sample->callchain == NULL)
+               return;
+
+       callchain_cursor__copy(&itr->cursor, &callchain_cursor);
+}
+
 /*
  * handle runtime stats saved per thread
  */
@@ -2111,7 +2150,7 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,
 {
        struct thread *thread;
 
-       if (is_idle_sample(sched, sample, evsel, machine)) {
+       if (is_idle_sample(sample, evsel)) {
                thread = get_idle_thread(sample->cpu);
                if (thread == NULL)
                        pr_err("Failed to get idle thread for cpu %d.\n", sample->cpu);
@@ -2124,13 +2163,37 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,
                        pr_debug("Failed to get thread for tid %d. skipping sample.\n",
                                 sample->tid);
                }
+
+               save_task_callchain(sched, sample, evsel, machine);
+               if (sched->idle_hist) {
+                       struct thread *idle;
+                       struct idle_thread_runtime *itr;
+
+                       idle = get_idle_thread(sample->cpu);
+                       if (idle == NULL) {
+                               pr_err("Failed to get idle thread for cpu %d.\n", sample->cpu);
+                               return NULL;
+                       }
+
+                       itr = thread__priv(idle);
+                       if (itr == NULL)
+                               return NULL;
+
+                       itr->last_thread = thread;
+
+                       /* copy task callchain when entering to idle */
+                       if (perf_evsel__intval(evsel, sample, "next_pid") == 0)
+                               save_idle_callchain(itr, sample);
+               }
        }
 
        return thread;
 }
 
 static bool timehist_skip_sample(struct perf_sched *sched,
-                                struct thread *thread)
+                                struct thread *thread,
+                                struct perf_evsel *evsel,
+                                struct perf_sample *sample)
 {
        bool rc = false;
 
@@ -2139,10 +2202,19 @@ static bool timehist_skip_sample(struct perf_sched *sched,
                sched->skipped_samples++;
        }
 
+       if (sched->idle_hist) {
+               if (strcmp(perf_evsel__name(evsel), "sched:sched_switch"))
+                       rc = true;
+               else if (perf_evsel__intval(evsel, sample, "prev_pid") != 0 &&
+                        perf_evsel__intval(evsel, sample, "next_pid") != 0)
+                       rc = true;
+       }
+
        return rc;
 }
 
 static void timehist_print_wakeup_event(struct perf_sched *sched,
+                                       struct perf_evsel *evsel,
                                        struct perf_sample *sample,
                                        struct machine *machine,
                                        struct thread *awakened)
@@ -2155,8 +2227,8 @@ static void timehist_print_wakeup_event(struct perf_sched *sched,
                return;
 
        /* show wakeup unless both awakee and awaker are filtered */
-       if (timehist_skip_sample(sched, thread) &&
-           timehist_skip_sample(sched, awakened)) {
+       if (timehist_skip_sample(sched, thread, evsel, sample) &&
+           timehist_skip_sample(sched, awakened, evsel, sample)) {
                return;
        }
 
@@ -2201,7 +2273,7 @@ static int timehist_sched_wakeup_event(struct perf_tool *tool,
        /* show wakeups if requested */
        if (sched->show_wakeups &&
            !perf_time__skip_sample(&sched->ptime, sample->time))
-               timehist_print_wakeup_event(sched, sample, machine, thread);
+               timehist_print_wakeup_event(sched, evsel, sample, machine, thread);
 
        return 0;
 }
@@ -2228,8 +2300,8 @@ static void timehist_print_migration_event(struct perf_sched *sched,
        if (thread == NULL)
                return;
 
-       if (timehist_skip_sample(sched, thread) &&
-           timehist_skip_sample(sched, migrated)) {
+       if (timehist_skip_sample(sched, thread, evsel, sample) &&
+           timehist_skip_sample(sched, migrated, evsel, sample)) {
                return;
        }
 
@@ -2314,7 +2386,7 @@ static int timehist_sched_change_event(struct perf_tool *tool,
                goto out;
        }
 
-       if (timehist_skip_sample(sched, thread))
+       if (timehist_skip_sample(sched, thread, evsel, sample))
                goto out;
 
        tr = thread__get_runtime(thread);
@@ -2333,7 +2405,7 @@ static int timehist_sched_change_event(struct perf_tool *tool,
        if (ptime->start && ptime->start > t)
                goto out;
 
-       if (ptime->start > tprev)
+       if (tprev && ptime->start > tprev)
                tprev = ptime->start;
 
        /*
@@ -2350,7 +2422,39 @@ static int timehist_sched_change_event(struct perf_tool *tool,
                        t = ptime->end;
        }
 
-       timehist_update_runtime_stats(tr, t, tprev);
+       if (!sched->idle_hist || thread->tid == 0) {
+               timehist_update_runtime_stats(tr, t, tprev);
+
+               if (sched->idle_hist) {
+                       struct idle_thread_runtime *itr = (void *)tr;
+                       struct thread_runtime *last_tr;
+
+                       BUG_ON(thread->tid != 0);
+
+                       if (itr->last_thread == NULL)
+                               goto out;
+
+                       /* add current idle time as last thread's runtime */
+                       last_tr = thread__get_runtime(itr->last_thread);
+                       if (last_tr == NULL)
+                               goto out;
+
+                       timehist_update_runtime_stats(last_tr, t, tprev);
+                       /*
+                        * remove delta time of last thread as it's not updated
+                        * and otherwise it will show an invalid value next
+                        * time.  we only care total run time and run stat.
+                        */
+                       last_tr->dt_run = 0;
+                       last_tr->dt_wait = 0;
+                       last_tr->dt_delay = 0;
+
+                       if (itr->cursor.nr)
+                               callchain_append(&itr->callchain, &itr->cursor, t - tprev);
+
+                       itr->last_thread = NULL;
+               }
+       }
 
        if (!sched->summary_only)
                timehist_print_sample(sched, sample, &al, thread, t);
@@ -2457,6 +2561,60 @@ static int show_deadthread_runtime(struct thread *t, void *priv)
        return __show_thread_runtime(t, priv);
 }
 
+static size_t callchain__fprintf_folded(FILE *fp, struct callchain_node *node)
+{
+       const char *sep = " <- ";
+       struct callchain_list *chain;
+       size_t ret = 0;
+       char bf[1024];
+       bool first;
+
+       if (node == NULL)
+               return 0;
+
+       ret = callchain__fprintf_folded(fp, node->parent);
+       first = (ret == 0);
+
+       list_for_each_entry(chain, &node->val, list) {
+               if (chain->ip >= PERF_CONTEXT_MAX)
+                       continue;
+               if (chain->ms.sym && chain->ms.sym->ignore)
+                       continue;
+               ret += fprintf(fp, "%s%s", first ? "" : sep,
+                              callchain_list__sym_name(chain, bf, sizeof(bf),
+                                                       false));
+               first = false;
+       }
+
+       return ret;
+}
+
+static size_t timehist_print_idlehist_callchain(struct rb_root *root)
+{
+       size_t ret = 0;
+       FILE *fp = stdout;
+       struct callchain_node *chain;
+       struct rb_node *rb_node = rb_first(root);
+
+       printf("  %16s  %8s  %s\n", "Idle time (msec)", "Count", "Callchains");
+       printf("  %.16s  %.8s  %.50s\n", graph_dotted_line, graph_dotted_line,
+              graph_dotted_line);
+
+       while (rb_node) {
+               chain = rb_entry(rb_node, struct callchain_node, rb_node);
+               rb_node = rb_next(rb_node);
+
+               ret += fprintf(fp, "  ");
+               print_sched_time(chain->hit, 12);
+               ret += 16;  /* print_sched_time returns 2nd arg + 4 */
+               ret += fprintf(fp, " %8d  ", chain->count);
+               ret += callchain__fprintf_folded(fp, chain);
+               ret += fprintf(fp, "\n");
+       }
+
+       return ret;
+}
+
 static void timehist_print_summary(struct perf_sched *sched,
                                   struct perf_session *session)
 {
@@ -2469,12 +2627,15 @@ static void timehist_print_summary(struct perf_sched *sched,
 
        memset(&totals, 0, sizeof(totals));
 
-       if (comm_width < 30)
-               comm_width = 30;
-
-       printf("\nRuntime summary\n");
-       printf("%*s  parent   sched-in  ", comm_width, "comm");
-       printf("   run-time    min-run     avg-run     max-run  stddev  migrations\n");
+       if (sched->idle_hist) {
+               printf("\nIdle-time summary\n");
+               printf("%*s  parent  sched-out  ", comm_width, "comm");
+               printf("  idle-time   min-idle    avg-idle    max-idle  stddev  migrations\n");
+       } else {
+               printf("\nRuntime summary\n");
+               printf("%*s  parent   sched-in  ", comm_width, "comm");
+               printf("   run-time    min-run     avg-run     max-run  stddev  migrations\n");
+       }
        printf("%*s            (count)  ", comm_width, "");
        printf("     (msec)     (msec)      (msec)      (msec)       %%\n");
        printf("%.117s\n", graph_dotted_line);
@@ -2490,7 +2651,7 @@ static void timehist_print_summary(struct perf_sched *sched,
                printf("<no terminated tasks>\n");
 
        /* CPU idle stats not tracked when samples were skipped */
-       if (sched->skipped_samples)
+       if (sched->skipped_samples && !sched->idle_hist)
                return;
 
        printf("\nIdle stats:\n");
@@ -2509,6 +2670,35 @@ static void timehist_print_summary(struct perf_sched *sched,
                        printf("    CPU %2d idle entire time window\n", i);
        }
 
+       if (sched->idle_hist && symbol_conf.use_callchain) {
+               callchain_param.mode  = CHAIN_FOLDED;
+               callchain_param.value = CCVAL_PERIOD;
+
+               callchain_register_param(&callchain_param);
+
+               printf("\nIdle stats by callchain:\n");
+               for (i = 0; i < idle_max_cpu; ++i) {
+                       struct idle_thread_runtime *itr;
+
+                       t = idle_threads[i];
+                       if (!t)
+                               continue;
+
+                       itr = thread__priv(t);
+                       if (itr == NULL)
+                               continue;
+
+                       callchain_param.sort(&itr->sorted_root, &itr->callchain,
+                                            0, &callchain_param);
+
+                       printf("  CPU %2d:", i);
+                       print_sched_time(itr->tr.total_run_time, 6);
+                       printf(" msec\n");
+                       timehist_print_idlehist_callchain(&itr->sorted_root);
+                       printf("\n");
+               }
+       }
+
        printf("\n"
               "    Total number of unique tasks: %" PRIu64 "\n"
               "Total number of context switches: %" PRIu64 "\n"
@@ -3036,6 +3226,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
        OPT_BOOLEAN('w', "wakeups", &sched.show_wakeups, "Show wakeup events"),
        OPT_BOOLEAN('M', "migrations", &sched.show_migrations, "Show migration events"),
        OPT_BOOLEAN('V', "cpu-visual", &sched.show_cpu_visual, "Add CPU visual"),
+       OPT_BOOLEAN('I', "idle-hist", &sched.idle_hist, "Show idle events only"),
        OPT_STRING(0, "time", &sched.time_str, "str",
                   "Time span for analysis (start,stop)"),
        OPT_PARENT(sched_options)
index 688dea7cb08f7337bc6c620f98aa3e996ce4d581..a02f2e9656284fa5d5c4a4b9d45f55c28e167e89 100644 (file)
@@ -2195,7 +2195,7 @@ static int process_stat_round_event(struct perf_tool *tool __maybe_unused,
 }
 
 static
-int process_stat_config_event(struct perf_tool *tool __maybe_unused,
+int process_stat_config_event(struct perf_tool *tool,
                              union perf_event *event,
                              struct perf_session *session __maybe_unused)
 {
@@ -2238,7 +2238,7 @@ static int set_maps(struct perf_stat *st)
 }
 
 static
-int process_thread_map_event(struct perf_tool *tool __maybe_unused,
+int process_thread_map_event(struct perf_tool *tool,
                             union perf_event *event,
                             struct perf_session *session __maybe_unused)
 {
@@ -2257,7 +2257,7 @@ int process_thread_map_event(struct perf_tool *tool __maybe_unused,
 }
 
 static
-int process_cpu_map_event(struct perf_tool *tool __maybe_unused,
+int process_cpu_map_event(struct perf_tool *tool,
                          union perf_event *event,
                          struct perf_session *session __maybe_unused)
 {
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
new file mode 100755 (executable)
index 0000000..c747bfd
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+HEADERS='
+include/uapi/linux/perf_event.h
+include/linux/hash.h
+include/uapi/linux/hw_breakpoint.h
+arch/x86/include/asm/disabled-features.h
+arch/x86/include/asm/required-features.h
+arch/x86/include/asm/cpufeatures.h
+arch/arm/include/uapi/asm/perf_regs.h
+arch/arm64/include/uapi/asm/perf_regs.h
+arch/powerpc/include/uapi/asm/perf_regs.h
+arch/x86/include/uapi/asm/perf_regs.h
+arch/x86/include/uapi/asm/kvm.h
+arch/x86/include/uapi/asm/kvm_perf.h
+arch/x86/include/uapi/asm/svm.h
+arch/x86/include/uapi/asm/vmx.h
+arch/powerpc/include/uapi/asm/kvm.h
+arch/s390/include/uapi/asm/kvm.h
+arch/s390/include/uapi/asm/kvm_perf.h
+arch/s390/include/uapi/asm/sie.h
+arch/arm/include/uapi/asm/kvm.h
+arch/arm64/include/uapi/asm/kvm.h
+include/asm-generic/bitops/arch_hweight.h
+include/asm-generic/bitops/const_hweight.h
+include/asm-generic/bitops/__fls.h
+include/asm-generic/bitops/fls.h
+include/asm-generic/bitops/fls64.h
+include/linux/coresight-pmu.h
+include/uapi/asm-generic/mman-common.h
+'
+
+check () {
+  file=$1
+  opts=
+
+  shift
+  while [ -n "$*" ]; do
+    opts="$opts \"$1\""
+    shift
+  done
+
+  cmd="diff $opts ../$file ../../$file > /dev/null"
+
+  test -f ../../$file &&
+  eval $cmd || echo "Warning: $file differs from kernel" >&2
+}
+
+
+# simple diff check
+for i in $HEADERS; do
+  check $i -B
+done
+
+# diff with extra ignore lines
+check arch/x86/lib/memcpy_64.S        -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"
+check arch/x86/lib/memset_64.S        -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"
+check include/uapi/asm-generic/mman.h -B -I "^#include <\(uapi/\)*asm-generic/mman-common.h>"
+check include/uapi/linux/mman.h       -B -I "^#include <\(uapi/\)*asm/mman.h>"
index 9a0236a4cf95fb7226af43e33b88e351359b8a2b..1c27d947c2fe55c9f0d0390695e6b586d839ec0b 100644 (file)
@@ -55,6 +55,7 @@ struct record_opts {
        bool         all_user;
        bool         tail_synthesize;
        bool         overwrite;
+       bool         ignore_missing_thread;
        unsigned int freq;
        unsigned int mmap_pages;
        unsigned int auxtrace_mmap_pages;
index 23605202d4a1acf2aaf26882f67b6dd6fbf3ee91..a77dcc0d24e3f356c9da230cd84a35eddde99852 100644 (file)
@@ -185,6 +185,10 @@ static struct test generic_tests[] = {
                .desc = "Synthesize thread map",
                .func = test__thread_map_synthesize,
        },
+       {
+               .desc = "Remove thread map",
+               .func = test__thread_map_remove,
+       },
        {
                .desc = "Synthesize cpu map",
                .func = test__cpu_map_synthesize,
index 0d7b251305afcffd355727c3792696b82192d7f3..a512f0c8ff5b50160b0206c602769df89185c521 100644 (file)
@@ -80,6 +80,7 @@ const char *test__bpf_subtest_get_desc(int subtest);
 int test__bpf_subtest_get_nr(void);
 int test_session_topology(int subtest);
 int test__thread_map_synthesize(int subtest);
+int test__thread_map_remove(int subtest);
 int test__cpu_map_synthesize(int subtest);
 int test__synthesize_stat_config(int subtest);
 int test__synthesize_stat(int subtest);
index cee2a2cdc93353fc18915889bd32b9a43cad9c30..a4a4b4625ac3d8864531b781c747945b53f1f849 100644 (file)
@@ -1,3 +1,4 @@
+#include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <sys/prctl.h>
@@ -93,3 +94,46 @@ int test__thread_map_synthesize(int subtest __maybe_unused)
 
        return 0;
 }
+
+int test__thread_map_remove(int subtest __maybe_unused)
+{
+       struct thread_map *threads;
+       char *str;
+       int i;
+
+       TEST_ASSERT_VAL("failed to allocate map string",
+                       asprintf(&str, "%d,%d", getpid(), getppid()) >= 0);
+
+       threads = thread_map__new_str(str, NULL, 0);
+
+       TEST_ASSERT_VAL("failed to allocate thread_map",
+                       threads);
+
+       if (verbose)
+               thread_map__fprintf(threads, stderr);
+
+       TEST_ASSERT_VAL("failed to remove thread",
+                       !thread_map__remove(threads, 0));
+
+       TEST_ASSERT_VAL("thread_map count != 1", threads->nr == 1);
+
+       if (verbose)
+               thread_map__fprintf(threads, stderr);
+
+       TEST_ASSERT_VAL("failed to remove thread",
+                       !thread_map__remove(threads, 0));
+
+       TEST_ASSERT_VAL("thread_map count != 0", threads->nr == 0);
+
+       if (verbose)
+               thread_map__fprintf(threads, stderr);
+
+       TEST_ASSERT_VAL("failed to not remove thread",
+                       thread_map__remove(threads, 0));
+
+       for (i = 0; i < threads->nr; i++)
+               free(threads->map[i].comm);
+
+       free(threads);
+       return 0;
+}
index fd710ab33684e65e6b62acc62ac51b5e12d02b35..af1cfde6b97b12962045d9bc66126c217335ad21 100644 (file)
@@ -42,7 +42,9 @@ static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
 
        P_MMAP_FLAG(SHARED);
        P_MMAP_FLAG(PRIVATE);
+#ifdef MAP_32BIT
        P_MMAP_FLAG(32BIT);
+#endif
        P_MMAP_FLAG(ANONYMOUS);
        P_MMAP_FLAG(DENYWRITE);
        P_MMAP_FLAG(EXECUTABLE);
index ec7a30fad14918bcdf8f01b6c90970da8f43a676..ba36aac340bc7d6531eaeaace7ee40ee38851806 100644 (file)
@@ -215,7 +215,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
                        ui_browser__set_color(browser, color);
                if (dl->ins.ops && dl->ins.ops->scnprintf) {
                        if (ins__is_jump(&dl->ins)) {
-                               bool fwd = dl->ops.target.offset > (u64)dl->offset;
+                               bool fwd = dl->ops.target.offset > dl->offset;
 
                                ui_browser__write_graph(browser, fwd ? SLSMG_DARROW_CHAR :
                                                                    SLSMG_UARROW_CHAR);
@@ -245,7 +245,8 @@ static bool disasm_line__is_valid_jump(struct disasm_line *dl, struct symbol *sy
 {
        if (!dl || !dl->ins.ops || !ins__is_jump(&dl->ins)
            || !disasm_line__has_offset(dl)
-           || dl->ops.target.offset >= symbol__size(sym))
+           || dl->ops.target.offset < 0
+           || dl->ops.target.offset >= (s64)symbol__size(sym))
                return false;
 
        return true;
index ea7e0de4b9c1445ae56f1ff04cd6d0e9b97cc5d2..06cc04e5806a2692fffabbc2c038b82380dfcafd 100644 (file)
@@ -223,13 +223,19 @@ bool ins__is_call(const struct ins *ins)
 static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *ops, struct map *map __maybe_unused)
 {
        const char *s = strchr(ops->raw, '+');
+       const char *c = strchr(ops->raw, ',');
 
-       ops->target.addr = strtoull(ops->raw, NULL, 16);
+       if (c++ != NULL)
+               ops->target.addr = strtoull(c, NULL, 16);
+       else
+               ops->target.addr = strtoull(ops->raw, NULL, 16);
 
-       if (s++ != NULL)
+       if (s++ != NULL) {
                ops->target.offset = strtoull(s, NULL, 16);
-       else
-               ops->target.offset = UINT64_MAX;
+               ops->target.offset_avail = true;
+       } else {
+               ops->target.offset_avail = false;
+       }
 
        return 0;
 }
@@ -237,7 +243,7 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op
 static int jump__scnprintf(struct ins *ins, char *bf, size_t size,
                           struct ins_operands *ops)
 {
-       if (!ops->target.addr)
+       if (!ops->target.addr || ops->target.offset < 0)
                return ins__raw_scnprintf(ins, bf, size, ops);
 
        return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset);
@@ -641,7 +647,8 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
 
        pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
 
-       if (addr < sym->start || addr >= sym->end) {
+       if ((addr < sym->start || addr >= sym->end) &&
+           (addr != sym->end || sym->start != sym->end)) {
                pr_debug("%s(%d): ERANGE! sym->name=%s, start=%#" PRIx64 ", addr=%#" PRIx64 ", end=%#" PRIx64 "\n",
                       __func__, __LINE__, sym->name, sym->start, addr, sym->end);
                return -ERANGE;
@@ -1205,9 +1212,11 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
        if (dl == NULL)
                return -1;
 
-       if (dl->ops.target.offset == UINT64_MAX)
+       if (!disasm_line__has_offset(dl)) {
                dl->ops.target.offset = dl->ops.target.addr -
                                        map__rip_2objdump(map, sym->start);
+               dl->ops.target.offset_avail = true;
+       }
 
        /* kcore has no symbols, so add the call target name */
        if (dl->ins.ops && ins__is_call(&dl->ins) && !dl->ops.target.name) {
index 87e4cadc5d2758ce4603428560c9f8548e4fc851..09776b5af991d3334fd35c1b9218999bdfda38da 100644 (file)
@@ -24,7 +24,8 @@ struct ins_operands {
                char    *raw;
                char    *name;
                u64     addr;
-               u64     offset;
+               s64     offset;
+               bool    offset_avail;
        } target;
        union {
                struct {
@@ -68,7 +69,7 @@ struct disasm_line {
 
 static inline bool disasm_line__has_offset(const struct disasm_line *dl)
 {
-       return dl->ops.target.offset != UINT64_MAX;
+       return dl->ops.target.offset_avail;
 }
 
 void disasm_line__free(struct disasm_line *dl);
index b2365a63db45c16f62c13093f55187f78ffd9c12..04e536ae4d88423e3c05a98fd1bd97ff64379b14 100644 (file)
@@ -990,6 +990,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
         * it overloads any global configuration.
         */
        apply_config_terms(evsel, opts);
+
+       evsel->ignore_missing_thread = opts->ignore_missing_thread;
 }
 
 static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
@@ -1419,6 +1421,33 @@ static int __open_attr__fprintf(FILE *fp, const char *name, const char *val,
        return fprintf(fp, "  %-32s %s\n", name, val);
 }
 
+static bool ignore_missing_thread(struct perf_evsel *evsel,
+                                 struct thread_map *threads,
+                                 int thread, int err)
+{
+       if (!evsel->ignore_missing_thread)
+               return false;
+
+       /* The system wide setup does not work with threads. */
+       if (evsel->system_wide)
+               return false;
+
+       /* The -ESRCH is perf event syscall errno for pid's not found. */
+       if (err != -ESRCH)
+               return false;
+
+       /* If there's only one thread, let it fail. */
+       if (threads->nr == 1)
+               return false;
+
+       if (thread_map__remove(threads, thread))
+               return false;
+
+       pr_warning("WARNING: Ignored open failure for pid %d\n",
+                  thread_map__pid(threads, thread));
+       return true;
+}
+
 static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
                              struct thread_map *threads)
 {
@@ -1474,7 +1503,7 @@ retry_sample_id:
        for (cpu = 0; cpu < cpus->nr; cpu++) {
 
                for (thread = 0; thread < nthreads; thread++) {
-                       int group_fd;
+                       int fd, group_fd;
 
                        if (!evsel->cgrp && !evsel->system_wide)
                                pid = thread_map__pid(threads, thread);
@@ -1484,21 +1513,37 @@ retry_open:
                        pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
                                  pid, cpus->map[cpu], group_fd, flags);
 
-                       FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
-                                                                    pid,
-                                                                    cpus->map[cpu],
-                                                                    group_fd, flags);
-                       if (FD(evsel, cpu, thread) < 0) {
+                       fd = sys_perf_event_open(&evsel->attr, pid, cpus->map[cpu],
+                                                group_fd, flags);
+
+                       FD(evsel, cpu, thread) = fd;
+
+                       if (fd < 0) {
                                err = -errno;
+
+                               if (ignore_missing_thread(evsel, threads, thread, err)) {
+                                       /*
+                                        * We just removed 1 thread, so take a step
+                                        * back on thread index and lower the upper
+                                        * nthreads limit.
+                                        */
+                                       nthreads--;
+                                       thread--;
+
+                                       /* ... and pretend like nothing have happened. */
+                                       err = 0;
+                                       continue;
+                               }
+
                                pr_debug2("\nsys_perf_event_open failed, error %d\n",
                                          err);
                                goto try_fallback;
                        }
 
-                       pr_debug2(" = %d\n", FD(evsel, cpu, thread));
+                       pr_debug2(" = %d\n", fd);
 
                        if (evsel->bpf_fd >= 0) {
-                               int evt_fd = FD(evsel, cpu, thread);
+                               int evt_fd = fd;
                                int bpf_fd = evsel->bpf_fd;
 
                                err = ioctl(evt_fd,
index 6abb89cd27f95e1c11cdd25786b0cade3a804fe6..06ef6f29efa12a6c1300eca641e9446a0a4d17f8 100644 (file)
@@ -120,6 +120,7 @@ struct perf_evsel {
        bool                    tracking;
        bool                    per_pkg;
        bool                    precise_max;
+       bool                    ignore_missing_thread;
        /* parse modifier helper */
        int                     exclude_GH;
        int                     nr_members;
index df2482b2ba45c47883a254db2ff4d6551aeea83b..dc93940de351540b89af3dfef487572e84d1f3f8 100644 (file)
@@ -1459,7 +1459,8 @@ int dso__load(struct dso *dso, struct map *map)
         * Read the build id if possible. This is required for
         * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
         */
-       if (is_regular_file(dso->long_name) &&
+       if (!dso->has_build_id &&
+           is_regular_file(dso->long_name) &&
            filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
                dso__set_build_id(dso, build_id);
 
index 40585f5b7027d1d1eb7c0d78e754c1a7963a74f9..f9eab200fd757ee0f6824cad0b2bbe9316afbec1 100644 (file)
@@ -448,3 +448,25 @@ bool thread_map__has(struct thread_map *threads, pid_t pid)
 
        return false;
 }
+
+int thread_map__remove(struct thread_map *threads, int idx)
+{
+       int i;
+
+       if (threads->nr < 1)
+               return -EINVAL;
+
+       if (idx >= threads->nr)
+               return -EINVAL;
+
+       /*
+        * Free the 'idx' item and shift the rest up.
+        */
+       free(threads->map[idx].comm);
+
+       for (i = idx; i < threads->nr - 1; i++)
+               threads->map[i] = threads->map[i + 1];
+
+       threads->nr--;
+       return 0;
+}
index bd3b971588da57ce14951df6d0a0870a6def1355..ea0ef08c6303413b6ececf2b93ec905914e558aa 100644 (file)
@@ -58,4 +58,5 @@ static inline char *thread_map__comm(struct thread_map *map, int thread)
 
 void thread_map__read_comms(struct thread_map *threads);
 bool thread_map__has(struct thread_map *threads, pid_t pid);
+int thread_map__remove(struct thread_map *threads, int idx);
 #endif /* __PERF_THREAD_MAP_H */
index 8561e7ddca59e7ce4267f08039a8105df2771645..8792ad8dbf837064adb180afa34ae0e275bdc6e5 100644 (file)
@@ -10,6 +10,7 @@ endif
 turbostat : turbostat.c
 CFLAGS +=      -Wall
 CFLAGS +=      -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
+CFLAGS +=      -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"'
 
 %: %.c
        @mkdir -p $(BUILD_OUTPUT)
index 492e84fbebfa8afd97171f3bd1e86e6e6b6caf49..03cb639b292ecc0e507b1c5190fffc877a9c4ac8 100644 (file)
@@ -25,9 +25,27 @@ Some information is not available on older processors.
 .SS Options
 Options can be specified with a single or double '-', and only as much of the option
 name as necessary to disambiguate it from others is necessary.  Note that options are case-sensitive.
-\fB--Counter MSR#\fP shows the delta of the specified 64-bit MSR counter.
 .PP
-\fB--counter MSR#\fP shows the delta of the specified 32-bit MSR counter.
+\fB--add attributes\fP add column with counter having specified 'attributes'.  The 'location' attribute is required, all others are optional.
+.nf
+       location: {\fBmsrDDD\fP | \fBmsr0xXXX\fP}
+               msrDDD is a decimal offset, eg. msr16
+               msr0xXXX is a hex offset, eg. msr0x10
+
+       scope: {\fBcpu\fP | \fBcore\fP | \fBpackage\fP}
+               sample and print the counter for every cpu, core, or package.
+               default: cpu
+
+       size: {\fBu32\fP | \fBu64\fP }
+               MSRs are read as 64-bits, u32 truncates the displayed value to 32-bits.
+               default: u64
+
+       format: {\fBraw\fP | \fBdelta\fP | \fBpercent\fP}
+               'raw' shows the MSR contents in hex.
+               'delta' shows the difference in values during the measurement interval.
+               'percent' shows the delta as a percentage of the cycles elapsed.
+               default: delta
+.fi
 .PP
 \fB--Dump\fP displays the raw counter values.
 .PP
@@ -43,10 +61,6 @@ The file is truncated if it already exists, and it is created if it does not exi
 .PP
 \fB--Joules\fP displays energy in Joules, rather than dividing Joules by time to print power in Watts.
 .PP
-\fB--MSR MSR#\fP shows the specified 64-bit MSR value.
-.PP
-\fB--msr MSR#\fP shows the specified 32-bit MSR value.
-.PP
 \fB--Package\fP limits output to the system summary plus the 1st thread in each Package.
 .PP
 \fB--processor\fP limits output to the system summary plus the 1st thread in each processor of each package.  Ie. it skips hyper-threaded siblings.
index 3e199b508a96f566159f2589d3112612fe91f36f..f13f61b065c699f2364d8d033d3a4f3a36110533 100644 (file)
@@ -21,6 +21,7 @@
 
 #define _GNU_SOURCE
 #include MSRHEADER
+#include INTEL_FAMILY_HEADER
 #include <stdarg.h>
 #include <stdio.h>
 #include <err.h>
@@ -51,8 +52,6 @@ unsigned int debug;
 unsigned int rapl_joules;
 unsigned int summary_only;
 unsigned int dump_only;
-unsigned int skip_c0;
-unsigned int skip_c1;
 unsigned int do_nhm_cstates;
 unsigned int do_snb_cstates;
 unsigned int do_knl_cstates;
@@ -72,10 +71,6 @@ unsigned int units = 1000000;        /* MHz etc */
 unsigned int genuine_intel;
 unsigned int has_invariant_tsc;
 unsigned int do_nhm_platform_info;
-unsigned int extra_msr_offset32;
-unsigned int extra_msr_offset64;
-unsigned int extra_delta_offset32;
-unsigned int extra_delta_offset64;
 unsigned int aperf_mperf_multiplier = 1;
 int do_irq = 1;
 int do_smi;
@@ -131,9 +126,8 @@ unsigned int has_hwp_pkg;           /* IA32_HWP_REQUEST_PKG */
 #define RAPL_DRAM_POWER_INFO   (1 << 5)
                                        /* 0x61c MSR_DRAM_POWER_INFO */
 
-#define RAPL_CORES             (1 << 6)
+#define RAPL_CORES_POWER_LIMIT (1 << 6)
                                        /* 0x638 MSR_PP0_POWER_LIMIT */
-                                       /* 0x639 MSR_PP0_ENERGY_STATUS */
 #define RAPL_CORE_POLICY       (1 << 7)
                                        /* 0x63a MSR_PP0_POLICY */
 
@@ -141,11 +135,20 @@ unsigned int has_hwp_pkg;         /* IA32_HWP_REQUEST_PKG */
                                        /* 0x640 MSR_PP1_POWER_LIMIT */
                                        /* 0x641 MSR_PP1_ENERGY_STATUS */
                                        /* 0x642 MSR_PP1_POLICY */
+
+#define RAPL_CORES_ENERGY_STATUS       (1 << 9)
+                                       /* 0x639 MSR_PP0_ENERGY_STATUS */
+#define RAPL_CORES (RAPL_CORES_ENERGY_STATUS | RAPL_CORES_POWER_LIMIT)
 #define        TJMAX_DEFAULT   100
 
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 
-int aperf_mperf_unstable;
+/*
+ * buffer size used by sscanf() for added column names
+ * Usually truncated to 7 characters, but also handles 18 columns for raw 64-bit counters
+ */
+#define        NAME_BYTES 20
+
 int backwards_count;
 char *progname;
 
@@ -157,16 +160,13 @@ struct thread_data {
        unsigned long long aperf;
        unsigned long long mperf;
        unsigned long long c1;
-       unsigned long long extra_msr64;
-       unsigned long long extra_delta64;
-       unsigned long long extra_msr32;
-       unsigned long long extra_delta32;
        unsigned int irq_count;
        unsigned int smi_count;
        unsigned int cpu_id;
        unsigned int flags;
 #define CPU_IS_FIRST_THREAD_IN_CORE    0x2
 #define CPU_IS_FIRST_CORE_IN_PACKAGE   0x4
+       unsigned long long counter[1];
 } *thread_even, *thread_odd;
 
 struct core_data {
@@ -175,6 +175,7 @@ struct core_data {
        unsigned long long c7;
        unsigned int core_temp_c;
        unsigned int core_id;
+       unsigned long long counter[1];
 } *core_even, *core_odd;
 
 struct pkg_data {
@@ -199,7 +200,7 @@ struct pkg_data {
        unsigned int rapl_pkg_perf_status;      /* MSR_PKG_PERF_STATUS */
        unsigned int rapl_dram_perf_status;     /* MSR_DRAM_PERF_STATUS */
        unsigned int pkg_temp_c;
-
+       unsigned long long counter[1];
 } *package_even, *package_odd;
 
 #define ODD_COUNTERS thread_odd, core_odd, package_odd
@@ -213,11 +214,33 @@ struct pkg_data {
        (core_base + (pkg_no) * topo.num_cores_per_pkg + (core_no))
 #define GET_PKG(pkg_base, pkg_no) (pkg_base + pkg_no)
 
+enum counter_scope {SCOPE_CPU, SCOPE_CORE, SCOPE_PACKAGE};
+enum counter_type {COUNTER_CYCLES, COUNTER_SECONDS};
+enum counter_format {FORMAT_RAW, FORMAT_DELTA, FORMAT_PERCENT};
+
+struct msr_counter {
+       unsigned int msr_num;
+       char name[NAME_BYTES];
+       unsigned int width;
+       enum counter_type type;
+       enum counter_format format;
+       struct msr_counter *next;
+};
+
+struct sys_counters {
+       unsigned int thread_counter_bytes;
+       unsigned int core_counter_bytes;
+       unsigned int package_counter_bytes;
+       struct msr_counter *tp;
+       struct msr_counter *cp;
+       struct msr_counter *pp;
+} sys;
+
 struct system_summary {
        struct thread_data threads;
        struct core_data cores;
        struct pkg_data packages;
-} sum, average;
+} average;
 
 
 struct topo_params {
@@ -319,120 +342,148 @@ int get_msr(int cpu, off_t offset, unsigned long long *msr)
 /*
  * Example Format w/ field column widths:
  *
- *  Package    Core     CPU Avg_MHz Bzy_MHz TSC_MHz     IRQ   SMI   Busy% CPU_%c1 CPU_%c3 CPU_%c6 CPU_%c7 CoreTmp  PkgTmp  GFXMHz Pkg%pc2 Pkg%pc3 Pkg%pc6 Pkg%pc7 PkgWatt CorWatt GFXWatt
+ *  Package    Core     CPU Avg_MHz Bzy_MHz TSC_MHz     IRQ   SMI   Busy% CPU_%c1 CPU_%c3 CPU_%c6 CPU_%c7 ThreadC CoreTmp  CoreCnt PkgTmp  GFXMHz Pkg%pc2 Pkg%pc3 Pkg%pc6 Pkg%pc7 PkgWatt CorWatt GFXWatt PkgCnt
  * 12345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678123456781234567812345678
  */
 
 void print_header(void)
 {
+       struct msr_counter *mp;
+
        if (show_pkg)
-               outp += sprintf(outp, " Package");
+               outp += sprintf(outp, "\tPackage");
        if (show_core)
-               outp += sprintf(outp, "    Core");
+               outp += sprintf(outp, "\tCore");
        if (show_cpu)
-               outp += sprintf(outp, "     CPU");
+               outp += sprintf(outp, "\tCPU");
        if (has_aperf)
-               outp += sprintf(outp, " Avg_MHz");
+               outp += sprintf(outp, "\tAvg_MHz");
        if (has_aperf)
-               outp += sprintf(outp, "   Busy%%");
+               outp += sprintf(outp, "\tBusy%%");
        if (has_aperf)
-               outp += sprintf(outp, " Bzy_MHz");
-       outp += sprintf(outp, " TSC_MHz");
-
-       if (extra_delta_offset32)
-               outp += sprintf(outp, "  count 0x%03X", extra_delta_offset32);
-       if (extra_delta_offset64)
-               outp += sprintf(outp, "  COUNT 0x%03X", extra_delta_offset64);
-       if (extra_msr_offset32)
-               outp += sprintf(outp, "   MSR 0x%03X", extra_msr_offset32);
-       if (extra_msr_offset64)
-               outp += sprintf(outp, "           MSR 0x%03X", extra_msr_offset64);
+               outp += sprintf(outp, "\tBzy_MHz");
+       outp += sprintf(outp, "\tTSC_MHz");
 
        if (!debug)
                goto done;
 
        if (do_irq)
-               outp += sprintf(outp, "     IRQ");
+               outp += sprintf(outp, "\tIRQ");
        if (do_smi)
-               outp += sprintf(outp, "     SMI");
+               outp += sprintf(outp, "\tSMI");
 
        if (do_nhm_cstates)
-               outp += sprintf(outp, "  CPU%%c1");
+               outp += sprintf(outp, "\tCPU%%c1");
        if (do_nhm_cstates && !do_slm_cstates && !do_knl_cstates)
-               outp += sprintf(outp, "  CPU%%c3");
+               outp += sprintf(outp, "\tCPU%%c3");
        if (do_nhm_cstates)
-               outp += sprintf(outp, "  CPU%%c6");
+               outp += sprintf(outp, "\tCPU%%c6");
        if (do_snb_cstates)
-               outp += sprintf(outp, "  CPU%%c7");
+               outp += sprintf(outp, "\tCPU%%c7");
+
+       for (mp = sys.tp; mp; mp = mp->next) {
+               if (mp->format == FORMAT_RAW) {
+                       if (mp->width == 64)
+                               outp += sprintf(outp, "\t%18.18s", mp->name);
+                       else
+                               outp += sprintf(outp, "\t%10.10s", mp->name);
+               } else {
+                       outp += sprintf(outp, "\t%-7.7s", mp->name);
+               }
+       }
 
        if (do_dts)
-               outp += sprintf(outp, " CoreTmp");
+               outp += sprintf(outp, "\tCoreTmp");
+
+       for (mp = sys.cp; mp; mp = mp->next) {
+               if (mp->format == FORMAT_RAW) {
+                       if (mp->width == 64)
+                               outp += sprintf(outp, "\t%18.18s", mp->name);
+                       else
+                               outp += sprintf(outp, "\t%10.10s", mp->name);
+               } else {
+                       outp += sprintf(outp, "\t%-7.7s", mp->name);
+               }
+       }
+
        if (do_ptm)
-               outp += sprintf(outp, "  PkgTmp");
+               outp += sprintf(outp, "\tPkgTmp");
 
        if (do_gfx_rc6_ms)
-               outp += sprintf(outp, " GFX%%rc6");
+               outp += sprintf(outp, "\tGFX%%rc6");
 
        if (do_gfx_mhz)
-               outp += sprintf(outp, "  GFXMHz");
+               outp += sprintf(outp, "\tGFXMHz");
 
        if (do_skl_residency) {
-               outp += sprintf(outp, " Totl%%C0");
-               outp += sprintf(outp, "  Any%%C0");
-               outp += sprintf(outp, "  GFX%%C0");
-               outp += sprintf(outp, " CPUGFX%%");
+               outp += sprintf(outp, "\tTotl%%C0");
+               outp += sprintf(outp, "\tAny%%C0");
+               outp += sprintf(outp, "\tGFX%%C0");
+               outp += sprintf(outp, "\tCPUGFX%%");
        }
 
        if (do_pc2)
-               outp += sprintf(outp, " Pkg%%pc2");
+               outp += sprintf(outp, "\tPkg%%pc2");
        if (do_pc3)
-               outp += sprintf(outp, " Pkg%%pc3");
+               outp += sprintf(outp, "\tPkg%%pc3");
        if (do_pc6)
-               outp += sprintf(outp, " Pkg%%pc6");
+               outp += sprintf(outp, "\tPkg%%pc6");
        if (do_pc7)
-               outp += sprintf(outp, " Pkg%%pc7");
+               outp += sprintf(outp, "\tPkg%%pc7");
        if (do_c8_c9_c10) {
-               outp += sprintf(outp, " Pkg%%pc8");
-               outp += sprintf(outp, " Pkg%%pc9");
-               outp += sprintf(outp, " Pk%%pc10");
+               outp += sprintf(outp, "\tPkg%%pc8");
+               outp += sprintf(outp, "\tPkg%%pc9");
+               outp += sprintf(outp, "\tPk%%pc10");
        }
 
        if (do_rapl && !rapl_joules) {
                if (do_rapl & RAPL_PKG)
-                       outp += sprintf(outp, " PkgWatt");
-               if (do_rapl & RAPL_CORES)
-                       outp += sprintf(outp, " CorWatt");
+                       outp += sprintf(outp, "\tPkgWatt");
+               if (do_rapl & RAPL_CORES_ENERGY_STATUS)
+                       outp += sprintf(outp, "\tCorWatt");
                if (do_rapl & RAPL_GFX)
-                       outp += sprintf(outp, " GFXWatt");
+                       outp += sprintf(outp, "\tGFXWatt");
                if (do_rapl & RAPL_DRAM)
-                       outp += sprintf(outp, " RAMWatt");
+                       outp += sprintf(outp, "\tRAMWatt");
                if (do_rapl & RAPL_PKG_PERF_STATUS)
-                       outp += sprintf(outp, "   PKG_%%");
+                       outp += sprintf(outp, "\tPKG_%%");
                if (do_rapl & RAPL_DRAM_PERF_STATUS)
-                       outp += sprintf(outp, "   RAM_%%");
+                       outp += sprintf(outp, "\tRAM_%%");
        } else if (do_rapl && rapl_joules) {
                if (do_rapl & RAPL_PKG)
-                       outp += sprintf(outp, "   Pkg_J");
-               if (do_rapl & RAPL_CORES)
-                       outp += sprintf(outp, "   Cor_J");
+                       outp += sprintf(outp, "\tPkg_J");
+               if (do_rapl & RAPL_CORES_ENERGY_STATUS)
+                       outp += sprintf(outp, "\tCor_J");
                if (do_rapl & RAPL_GFX)
-                       outp += sprintf(outp, "   GFX_J");
+                       outp += sprintf(outp, "\tGFX_J");
                if (do_rapl & RAPL_DRAM)
-                       outp += sprintf(outp, "   RAM_J");
+                       outp += sprintf(outp, "\tRAM_J");
                if (do_rapl & RAPL_PKG_PERF_STATUS)
-                       outp += sprintf(outp, "   PKG_%%");
+                       outp += sprintf(outp, "\tPKG_%%");
                if (do_rapl & RAPL_DRAM_PERF_STATUS)
-                       outp += sprintf(outp, "   RAM_%%");
-               outp += sprintf(outp, "   time");
-
+                       outp += sprintf(outp, "\tRAM_%%");
        }
-    done:
+       for (mp = sys.pp; mp; mp = mp->next) {
+               if (mp->format == FORMAT_RAW) {
+                       if (mp->width == 64)
+                               outp += sprintf(outp, "\t%18.18s", mp->name);
+                       else
+                               outp += sprintf(outp, "\t%10.10s", mp->name);
+               } else {
+                       outp += sprintf(outp, "\t%-7.7s", mp->name);
+               }
+       }
+
+done:
        outp += sprintf(outp, "\n");
 }
 
 int dump_counters(struct thread_data *t, struct core_data *c,
        struct pkg_data *p)
 {
+       int i;
+       struct msr_counter *mp;
+
        outp += sprintf(outp, "t %p, c %p, p %p\n", t, c, p);
 
        if (t) {
@@ -442,18 +493,16 @@ int dump_counters(struct thread_data *t, struct core_data *c,
                outp += sprintf(outp, "aperf: %016llX\n", t->aperf);
                outp += sprintf(outp, "mperf: %016llX\n", t->mperf);
                outp += sprintf(outp, "c1: %016llX\n", t->c1);
-               outp += sprintf(outp, "msr0x%x: %08llX\n",
-                       extra_delta_offset32, t->extra_delta32);
-               outp += sprintf(outp, "msr0x%x: %016llX\n",
-                       extra_delta_offset64, t->extra_delta64);
-               outp += sprintf(outp, "msr0x%x: %08llX\n",
-                       extra_msr_offset32, t->extra_msr32);
-               outp += sprintf(outp, "msr0x%x: %016llX\n",
-                       extra_msr_offset64, t->extra_msr64);
+
                if (do_irq)
                        outp += sprintf(outp, "IRQ: %08X\n", t->irq_count);
                if (do_smi)
                        outp += sprintf(outp, "SMI: %08X\n", t->smi_count);
+
+               for (i = 0, mp = sys.tp; mp; i++, mp = mp->next) {
+                       outp += sprintf(outp, "tADDED [%d] msr0x%x: %08llX\n",
+                               i, mp->msr_num, t->counter[i]);
+               }
        }
 
        if (c) {
@@ -462,6 +511,11 @@ int dump_counters(struct thread_data *t, struct core_data *c,
                outp += sprintf(outp, "c6: %016llX\n", c->c6);
                outp += sprintf(outp, "c7: %016llX\n", c->c7);
                outp += sprintf(outp, "DTS: %dC\n", c->core_temp_c);
+
+               for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
+                       outp += sprintf(outp, "cADDED [%d] msr0x%x: %08llX\n",
+                               i, mp->msr_num, c->counter[i]);
+               }
        }
 
        if (p) {
@@ -491,6 +545,11 @@ int dump_counters(struct thread_data *t, struct core_data *c,
                outp += sprintf(outp, "Throttle RAM: %0X\n",
                        p->rapl_dram_perf_status);
                outp += sprintf(outp, "PTM: %dC\n", p->pkg_temp_c);
+
+               for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) {
+                       outp += sprintf(outp, "pADDED [%d] msr0x%x: %08llX\n",
+                               i, mp->msr_num, p->counter[i]);
+               }
        }
 
        outp += sprintf(outp, "\n");
@@ -506,6 +565,8 @@ int format_counters(struct thread_data *t, struct core_data *c,
 {
        double interval_float;
        char *fmt8;
+       int i;
+       struct msr_counter *mp;
 
         /* if showing only 1st thread in core and this isn't one, bail out */
        if (show_core_only && !(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
@@ -520,99 +581,103 @@ int format_counters(struct thread_data *t, struct core_data *c,
        /* topo columns, print blanks on 1st (average) line */
        if (t == &average.threads) {
                if (show_pkg)
-                       outp += sprintf(outp, "       -");
+                       outp += sprintf(outp, "\t-");
                if (show_core)
-                       outp += sprintf(outp, "       -");
+                       outp += sprintf(outp, "\t-");
                if (show_cpu)
-                       outp += sprintf(outp, "       -");
+                       outp += sprintf(outp, "\t-");
        } else {
                if (show_pkg) {
                        if (p)
-                               outp += sprintf(outp, "%8d", p->package_id);
+                               outp += sprintf(outp, "\t%d", p->package_id);
                        else
-                               outp += sprintf(outp, "       -");
+                               outp += sprintf(outp, "\t-");
                }
                if (show_core) {
                        if (c)
-                               outp += sprintf(outp, "%8d", c->core_id);
+                               outp += sprintf(outp, "\t%d", c->core_id);
                        else
-                               outp += sprintf(outp, "       -");
+                               outp += sprintf(outp, "\t-");
                }
                if (show_cpu)
-                       outp += sprintf(outp, "%8d", t->cpu_id);
+                       outp += sprintf(outp, "\t%d", t->cpu_id);
        }
 
        /* Avg_MHz */
        if (has_aperf)
-               outp += sprintf(outp, "%8.0f",
+               outp += sprintf(outp, "\t%.0f",
                        1.0 / units * t->aperf / interval_float);
 
        /* Busy% */
-       if (has_aperf) {
-               if (!skip_c0)
-                       outp += sprintf(outp, "%8.2f", 100.0 * t->mperf/t->tsc/tsc_tweak);
-               else
-                       outp += sprintf(outp, "********");
-       }
+       if (has_aperf)
+               outp += sprintf(outp, "\t%.2f", 100.0 * t->mperf/t->tsc/tsc_tweak);
 
        /* Bzy_MHz */
        if (has_aperf) {
                if (has_base_hz)
-                       outp += sprintf(outp, "%8.0f", base_hz / units * t->aperf / t->mperf);
+                       outp += sprintf(outp, "\t%.0f", base_hz / units * t->aperf / t->mperf);
                else
-                       outp += sprintf(outp, "%8.0f",
+                       outp += sprintf(outp, "\t%.0f",
                                1.0 * t->tsc / units * t->aperf / t->mperf / interval_float);
        }
 
        /* TSC_MHz */
-       outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float);
-
-       /* delta */
-       if (extra_delta_offset32)
-               outp += sprintf(outp, "  %11llu", t->extra_delta32);
-
-       /* DELTA */
-       if (extra_delta_offset64)
-               outp += sprintf(outp, "  %11llu", t->extra_delta64);
-       /* msr */
-       if (extra_msr_offset32)
-               outp += sprintf(outp, "  0x%08llx", t->extra_msr32);
-
-       /* MSR */
-       if (extra_msr_offset64)
-               outp += sprintf(outp, "  0x%016llx", t->extra_msr64);
+       outp += sprintf(outp, "\t%.0f", 1.0 * t->tsc/units/interval_float);
 
        if (!debug)
                goto done;
 
        /* IRQ */
        if (do_irq)
-               outp += sprintf(outp, "%8d", t->irq_count);
+               outp += sprintf(outp, "\t%d", t->irq_count);
 
        /* SMI */
        if (do_smi)
-               outp += sprintf(outp, "%8d", t->smi_count);
+               outp += sprintf(outp, "\t%d", t->smi_count);
 
-       if (do_nhm_cstates) {
-               if (!skip_c1)
-                       outp += sprintf(outp, "%8.2f", 100.0 * t->c1/t->tsc);
-               else
-                       outp += sprintf(outp, "********");
-       }
+       if (do_nhm_cstates)
+               outp += sprintf(outp, "\t%.2f", 100.0 * t->c1/t->tsc);
 
        /* print per-core data only for 1st thread in core */
        if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
                goto done;
 
        if (do_nhm_cstates && !do_slm_cstates && !do_knl_cstates)
-               outp += sprintf(outp, "%8.2f", 100.0 * c->c3/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * c->c3/t->tsc);
        if (do_nhm_cstates)
-               outp += sprintf(outp, "%8.2f", 100.0 * c->c6/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * c->c6/t->tsc);
        if (do_snb_cstates)
-               outp += sprintf(outp, "%8.2f", 100.0 * c->c7/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * c->c7/t->tsc);
+
+       for (i = 0, mp = sys.tp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW) {
+                       if (mp->width == 32)
+                               outp += sprintf(outp, "\t0x%08lx", (unsigned long) t->counter[i]);
+                       else
+                               outp += sprintf(outp, "\t0x%016llx", t->counter[i]);
+               } else if (mp->format == FORMAT_DELTA) {
+                       outp += sprintf(outp, "\t%8lld", t->counter[i]);
+               } else if (mp->format == FORMAT_PERCENT) {
+                       outp += sprintf(outp, "\t%.2f", 100.0 * t->counter[i]/t->tsc);
+               }
+       }
+
 
        if (do_dts)
-               outp += sprintf(outp, "%8d", c->core_temp_c);
+               outp += sprintf(outp, "\t%d", c->core_temp_c);
+
+       for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW) {
+                       if (mp->width == 32)
+                               outp += sprintf(outp, "\t0x%08lx", (unsigned long) c->counter[i]);
+                       else
+                               outp += sprintf(outp, "\t0x%016llx", c->counter[i]);
+               } else if (mp->format == FORMAT_DELTA) {
+                       outp += sprintf(outp, "\t%8lld", c->counter[i]);
+               } else if (mp->format == FORMAT_PERCENT) {
+                       outp += sprintf(outp, "\t%.2f", 100.0 * c->counter[i]/t->tsc);
+               }
+       }
 
        /* print per-package data only for 1st core in package */
        if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
@@ -620,42 +685,42 @@ int format_counters(struct thread_data *t, struct core_data *c,
 
        /* PkgTmp */
        if (do_ptm)
-               outp += sprintf(outp, "%8d", p->pkg_temp_c);
+               outp += sprintf(outp, "\t%d", p->pkg_temp_c);
 
        /* GFXrc6 */
        if (do_gfx_rc6_ms) {
-               if (p->gfx_rc6_ms == -1) {      /* detect counter reset */
-                       outp += sprintf(outp, "  ***.**");
+               if (p->gfx_rc6_ms == -1) {      /* detect GFX counter reset */
+                       outp += sprintf(outp, "\t**.**");
                } else {
-                       outp += sprintf(outp, "%8.2f",
+                       outp += sprintf(outp, "\t%.2f",
                                p->gfx_rc6_ms / 10.0 / interval_float);
                }
        }
 
        /* GFXMHz */
        if (do_gfx_mhz)
-               outp += sprintf(outp, "%8d", p->gfx_mhz);
+               outp += sprintf(outp, "\t%d", p->gfx_mhz);
 
        /* Totl%C0, Any%C0 GFX%C0 CPUGFX% */
        if (do_skl_residency) {
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pkg_wtd_core_c0/t->tsc);
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pkg_any_core_c0/t->tsc);
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pkg_any_gfxe_c0/t->tsc);
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pkg_both_core_gfxe_c0/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pkg_wtd_core_c0/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pkg_any_core_c0/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pkg_any_gfxe_c0/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pkg_both_core_gfxe_c0/t->tsc);
        }
 
        if (do_pc2)
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pc2/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pc2/t->tsc);
        if (do_pc3)
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pc3/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pc3/t->tsc);
        if (do_pc6)
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pc6/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pc6/t->tsc);
        if (do_pc7)
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pc7/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pc7/t->tsc);
        if (do_c8_c9_c10) {
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pc8/t->tsc);
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pc9/t->tsc);
-               outp += sprintf(outp, "%8.2f", 100.0 * p->pc10/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pc8/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pc9/t->tsc);
+               outp += sprintf(outp, "\t%.2f", 100.0 * p->pc10/t->tsc);
        }
 
        /*
@@ -663,14 +728,14 @@ int format_counters(struct thread_data *t, struct core_data *c,
         * indicate that results are suspect by printing "**" in fraction place.
         */
        if (interval_float < rapl_joule_counter_range)
-               fmt8 = "%8.2f";
+               fmt8 = "\t%.2f";
        else
-               fmt8 = " %6.0f**";
+               fmt8 = "%6.0f**";
 
        if (do_rapl && !rapl_joules) {
                if (do_rapl & RAPL_PKG)
                        outp += sprintf(outp, fmt8, p->energy_pkg * rapl_energy_units / interval_float);
-               if (do_rapl & RAPL_CORES)
+               if (do_rapl & RAPL_CORES_ENERGY_STATUS)
                        outp += sprintf(outp, fmt8, p->energy_cores * rapl_energy_units / interval_float);
                if (do_rapl & RAPL_GFX)
                        outp += sprintf(outp, fmt8, p->energy_gfx * rapl_energy_units / interval_float);
@@ -697,9 +762,20 @@ int format_counters(struct thread_data *t, struct core_data *c,
                        outp += sprintf(outp, fmt8, 100.0 * p->rapl_pkg_perf_status * rapl_time_units / interval_float);
                if (do_rapl & RAPL_DRAM_PERF_STATUS)
                        outp += sprintf(outp, fmt8, 100.0 * p->rapl_dram_perf_status * rapl_time_units / interval_float);
-
-               outp += sprintf(outp, fmt8, interval_float);
        }
+       for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW) {
+                       if (mp->width == 32)
+                               outp += sprintf(outp, "\t0x%08lx", (unsigned long) p->counter[i]);
+                       else
+                               outp += sprintf(outp, "\t0x%016llx", p->counter[i]);
+               } else if (mp->format == FORMAT_DELTA) {
+                       outp += sprintf(outp, "\t%8lld", p->counter[i]);
+               } else if (mp->format == FORMAT_PERCENT) {
+                       outp += sprintf(outp, "\t%.2f", 100.0 * p->counter[i]/t->tsc);
+               }
+       }
+
 done:
        outp += sprintf(outp, "\n");
 
@@ -752,9 +828,11 @@ void format_all_counters(struct thread_data *t, struct core_data *c, struct pkg_
                old = 0x100000000 + new - old;  \
        }
 
-void
+int
 delta_package(struct pkg_data *new, struct pkg_data *old)
 {
+       int i;
+       struct msr_counter *mp;
 
        if (do_skl_residency) {
                old->pkg_wtd_core_c0 = new->pkg_wtd_core_c0 - old->pkg_wtd_core_c0;
@@ -788,24 +866,46 @@ delta_package(struct pkg_data *new, struct pkg_data *old)
        DELTA_WRAP32(new->energy_dram, old->energy_dram);
        DELTA_WRAP32(new->rapl_pkg_perf_status, old->rapl_pkg_perf_status);
        DELTA_WRAP32(new->rapl_dram_perf_status, old->rapl_dram_perf_status);
+
+       for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW)
+                       old->counter[i] = new->counter[i];
+               else
+                       old->counter[i] = new->counter[i] - old->counter[i];
+       }
+
+       return 0;
 }
 
 void
 delta_core(struct core_data *new, struct core_data *old)
 {
+       int i;
+       struct msr_counter *mp;
+
        old->c3 = new->c3 - old->c3;
        old->c6 = new->c6 - old->c6;
        old->c7 = new->c7 - old->c7;
        old->core_temp_c = new->core_temp_c;
+
+       for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW)
+                       old->counter[i] = new->counter[i];
+               else
+                       old->counter[i] = new->counter[i] - old->counter[i];
+       }
 }
 
 /*
  * old = new - old
  */
-void
+int
 delta_thread(struct thread_data *new, struct thread_data *old,
        struct core_data *core_delta)
 {
+       int i;
+       struct msr_counter *mp;
+
        old->tsc = new->tsc - old->tsc;
 
        /* check for TSC < 1 Mcycles over interval */
@@ -821,20 +921,7 @@ delta_thread(struct thread_data *new, struct thread_data *old,
                        old->aperf = new->aperf - old->aperf;
                        old->mperf = new->mperf - old->mperf;
                } else {
-
-                       if (!aperf_mperf_unstable) {
-                               fprintf(outf, "%s: APERF or MPERF went backwards *\n", progname);
-                               fprintf(outf, "* Frequency results do not cover entire interval *\n");
-                               fprintf(outf, "* fix this by running Linux-2.6.30 or later *\n");
-
-                               aperf_mperf_unstable = 1;
-                       }
-                       /*
-                        * mperf delta is likely a huge "positive" number
-                        * can not use it for calculating c0 time
-                        */
-                       skip_c0 = 1;
-                       skip_c1 = 1;
+                       return -1;
                }
        }
 
@@ -865,52 +952,53 @@ delta_thread(struct thread_data *new, struct thread_data *old,
                old->mperf = 1; /* divide by 0 protection */
        }
 
-       old->extra_delta32 = new->extra_delta32 - old->extra_delta32;
-       old->extra_delta32 &= 0xFFFFFFFF;
-
-       old->extra_delta64 = new->extra_delta64 - old->extra_delta64;
-
-       /*
-        * Extra MSR is just a snapshot, simply copy latest w/o subtracting
-        */
-       old->extra_msr32 = new->extra_msr32;
-       old->extra_msr64 = new->extra_msr64;
-
        if (do_irq)
                old->irq_count = new->irq_count - old->irq_count;
 
        if (do_smi)
                old->smi_count = new->smi_count - old->smi_count;
+
+       for (i = 0, mp = sys.tp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW)
+                       old->counter[i] = new->counter[i];
+               else
+                       old->counter[i] = new->counter[i] - old->counter[i];
+       }
+       return 0;
 }
 
 int delta_cpu(struct thread_data *t, struct core_data *c,
        struct pkg_data *p, struct thread_data *t2,
        struct core_data *c2, struct pkg_data *p2)
 {
+       int retval = 0;
+
        /* calculate core delta only for 1st thread in core */
        if (t->flags & CPU_IS_FIRST_THREAD_IN_CORE)
                delta_core(c, c2);
 
        /* always calculate thread delta */
-       delta_thread(t, t2, c2);        /* c2 is core delta */
+       retval = delta_thread(t, t2, c2);       /* c2 is core delta */
+       if (retval)
+               return retval;
 
        /* calculate package delta only for 1st core in package */
        if (t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)
-               delta_package(p, p2);
+               retval = delta_package(p, p2);
 
-       return 0;
+       return retval;
 }
 
 void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
 {
+       int i;
+       struct msr_counter  *mp;
+
        t->tsc = 0;
        t->aperf = 0;
        t->mperf = 0;
        t->c1 = 0;
 
-       t->extra_delta32 = 0;
-       t->extra_delta64 = 0;
-
        t->irq_count = 0;
        t->smi_count = 0;
 
@@ -948,21 +1036,36 @@ void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data
 
        p->gfx_rc6_ms = 0;
        p->gfx_mhz = 0;
+
+       for (i = 0, mp = sys.tp; mp; i++, mp = mp->next)
+               t->counter[i] = 0;
+
+       for (i = 0, mp = sys.cp; mp; i++, mp = mp->next)
+               c->counter[i] = 0;
+
+       for (i = 0, mp = sys.pp; mp; i++, mp = mp->next)
+               p->counter[i] = 0;
 }
 int sum_counters(struct thread_data *t, struct core_data *c,
        struct pkg_data *p)
 {
+       int i;
+       struct msr_counter *mp;
+
        average.threads.tsc += t->tsc;
        average.threads.aperf += t->aperf;
        average.threads.mperf += t->mperf;
        average.threads.c1 += t->c1;
 
-       average.threads.extra_delta32 += t->extra_delta32;
-       average.threads.extra_delta64 += t->extra_delta64;
-
        average.threads.irq_count += t->irq_count;
        average.threads.smi_count += t->smi_count;
 
+       for (i = 0, mp = sys.tp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW)
+                       continue;
+               average.threads.counter[i] += t->counter[i];
+       }
+
        /* sum per-core values only for 1st thread in core */
        if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
                return 0;
@@ -973,6 +1076,12 @@ int sum_counters(struct thread_data *t, struct core_data *c,
 
        average.cores.core_temp_c = MAX(average.cores.core_temp_c, c->core_temp_c);
 
+       for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW)
+                       continue;
+               average.cores.counter[i] += c->counter[i];
+       }
+
        /* sum per-pkg values only for 1st core in pkg */
        if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
                return 0;
@@ -1007,6 +1116,12 @@ int sum_counters(struct thread_data *t, struct core_data *c,
 
        average.packages.rapl_pkg_perf_status += p->rapl_pkg_perf_status;
        average.packages.rapl_dram_perf_status += p->rapl_dram_perf_status;
+
+       for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW)
+                       continue;
+               average.packages.counter[i] += p->counter[i];
+       }
        return 0;
 }
 /*
@@ -1016,6 +1131,9 @@ int sum_counters(struct thread_data *t, struct core_data *c,
 void compute_average(struct thread_data *t, struct core_data *c,
        struct pkg_data *p)
 {
+       int i;
+       struct msr_counter *mp;
+
        clear_counters(&average.threads, &average.cores, &average.packages);
 
        for_all_cpus(sum_counters, t, c, p);
@@ -1025,11 +1143,6 @@ void compute_average(struct thread_data *t, struct core_data *c,
        average.threads.mperf /= topo.num_cpus;
        average.threads.c1 /= topo.num_cpus;
 
-       average.threads.extra_delta32 /= topo.num_cpus;
-       average.threads.extra_delta32 &= 0xFFFFFFFF;
-
-       average.threads.extra_delta64 /= topo.num_cpus;
-
        average.cores.c3 /= topo.num_cores;
        average.cores.c6 /= topo.num_cores;
        average.cores.c7 /= topo.num_cores;
@@ -1052,6 +1165,22 @@ void compute_average(struct thread_data *t, struct core_data *c,
        average.packages.pc8 /= topo.num_packages;
        average.packages.pc9 /= topo.num_packages;
        average.packages.pc10 /= topo.num_packages;
+
+       for (i = 0, mp = sys.tp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW)
+                       continue;
+               average.threads.counter[i] /= topo.num_cpus;
+       }
+       for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW)
+                       continue;
+               average.cores.counter[i] /= topo.num_cores;
+       }
+       for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) {
+               if (mp->format == FORMAT_RAW)
+                       continue;
+               average.packages.counter[i] /= topo.num_packages;
+       }
 }
 
 static unsigned long long rdtsc(void)
@@ -1073,6 +1202,8 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
        int cpu = t->cpu_id;
        unsigned long long msr;
        int aperf_mperf_retry_count = 0;
+       struct msr_counter *mp;
+       int i;
 
        if (cpu_migrate(cpu)) {
                fprintf(outf, "Could not migrate to CPU %d\n", cpu);
@@ -1145,31 +1276,18 @@ retry:
                        return -5;
                t->smi_count = msr & 0xFFFFFFFF;
        }
-       if (extra_delta_offset32) {
-               if (get_msr(cpu, extra_delta_offset32, &msr))
-                       return -5;
-               t->extra_delta32 = msr & 0xFFFFFFFF;
-       }
-
-       if (extra_delta_offset64)
-               if (get_msr(cpu, extra_delta_offset64, &t->extra_delta64))
-                       return -5;
-
-       if (extra_msr_offset32) {
-               if (get_msr(cpu, extra_msr_offset32, &msr))
-                       return -5;
-               t->extra_msr32 = msr & 0xFFFFFFFF;
-       }
-
-       if (extra_msr_offset64)
-               if (get_msr(cpu, extra_msr_offset64, &t->extra_msr64))
-                       return -5;
 
        if (use_c1_residency_msr) {
                if (get_msr(cpu, MSR_CORE_C1_RES, &t->c1))
                        return -6;
        }
 
+       for (i = 0, mp = sys.tp; mp; i++, mp = mp->next) {
+               if (get_msr(cpu, mp->msr_num, &t->counter[i]))
+                       return -10;
+       }
+
+
        /* collect core counters only for 1st thread in core */
        if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
                return 0;
@@ -1197,6 +1315,10 @@ retry:
                c->core_temp_c = tcc_activation_temp - ((msr >> 16) & 0x7F);
        }
 
+       for (i = 0, mp = sys.cp; mp; i++, mp = mp->next) {
+               if (get_msr(cpu, mp->msr_num, &c->counter[i]))
+                       return -10;
+       }
 
        /* collect package counters only for 1st core in package */
        if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
@@ -1237,7 +1359,7 @@ retry:
                        return -13;
                p->energy_pkg = msr & 0xFFFFFFFF;
        }
-       if (do_rapl & RAPL_CORES) {
+       if (do_rapl & RAPL_CORES_ENERGY_STATUS) {
                if (get_msr(cpu, MSR_PP0_ENERGY_STATUS, &msr))
                        return -14;
                p->energy_cores = msr & 0xFFFFFFFF;
@@ -1274,6 +1396,11 @@ retry:
        if (do_gfx_mhz)
                p->gfx_mhz = gfx_cur_mhz;
 
+       for (i = 0, mp = sys.pp; mp; i++, mp = mp->next) {
+               if (get_msr(cpu, mp->msr_num, &p->counter[i]))
+                       return -10;
+       }
+
        return 0;
 }
 
@@ -1310,6 +1437,7 @@ int slv_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCLRSV, PCLRSV, PCL__4, PCLRSV,
 int amt_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCL__2, PCLRSV, PCLRSV, PCLRSV, PCL__6, PCL__7, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
 int phi_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
 int bxt_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
+int skx_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
 
 
 static void
@@ -1638,7 +1766,7 @@ void free_fd_percpu(void)
 {
        int i;
 
-       for (i = 0; i < topo.max_cpu_num; ++i) {
+       for (i = 0; i < topo.max_cpu_num + 1; ++i) {
                if (fd_percpu[i] != 0)
                        close(fd_percpu[i]);
        }
@@ -2071,7 +2199,10 @@ restart:
                }
                gettimeofday(&tv_odd, (struct timezone *)NULL);
                timersub(&tv_odd, &tv_even, &tv_delta);
-               for_all_cpus_2(delta_cpu, ODD_COUNTERS, EVEN_COUNTERS);
+               if (for_all_cpus_2(delta_cpu, ODD_COUNTERS, EVEN_COUNTERS)) {
+                       re_initialize();
+                       goto restart;
+               }
                compute_average(EVEN_COUNTERS);
                format_all_counters(EVEN_COUNTERS);
                flush_output_stdout();
@@ -2087,7 +2218,10 @@ restart:
                }
                gettimeofday(&tv_even, (struct timezone *)NULL);
                timersub(&tv_even, &tv_odd, &tv_delta);
-               for_all_cpus_2(delta_cpu, EVEN_COUNTERS, ODD_COUNTERS);
+               if (for_all_cpus_2(delta_cpu, EVEN_COUNTERS, ODD_COUNTERS)) {
+                       re_initialize();
+                       goto restart;
+               }
                compute_average(ODD_COUNTERS);
                format_all_counters(ODD_COUNTERS);
                flush_output_stdout();
@@ -2174,47 +2308,51 @@ int probe_nhm_msrs(unsigned int family, unsigned int model)
        bclk = discover_bclk(family, model);
 
        switch (model) {
-       case 0x1A:      /* Core i7, Xeon 5500 series - Bloomfield, Gainstown NHM-EP */
-       case 0x1E:      /* Core i7 and i5 Processor - Clarksfield, Lynnfield, Jasper Forest */
+       case INTEL_FAM6_NEHALEM_EP:     /* Core i7, Xeon 5500 series - Bloomfield, Gainstown NHM-EP */
+       case INTEL_FAM6_NEHALEM:        /* Core i7 and i5 Processor - Clarksfield, Lynnfield, Jasper Forest */
        case 0x1F:      /* Core i7 and i5 Processor - Nehalem */
-       case 0x25:      /* Westmere Client - Clarkdale, Arrandale */
-       case 0x2C:      /* Westmere EP - Gulftown */
-       case 0x2E:      /* Nehalem-EX Xeon - Beckton */
-       case 0x2F:      /* Westmere-EX Xeon - Eagleton */
+       case INTEL_FAM6_WESTMERE:       /* Westmere Client - Clarkdale, Arrandale */
+       case INTEL_FAM6_WESTMERE_EP:    /* Westmere EP - Gulftown */
+       case INTEL_FAM6_NEHALEM_EX:     /* Nehalem-EX Xeon - Beckton */
+       case INTEL_FAM6_WESTMERE_EX:    /* Westmere-EX Xeon - Eagleton */
                pkg_cstate_limits = nhm_pkg_cstate_limits;
                break;
-       case 0x2A:      /* SNB */
-       case 0x2D:      /* SNB Xeon */
-       case 0x3A:      /* IVB */
-       case 0x3E:      /* IVB Xeon */
+       case INTEL_FAM6_SANDYBRIDGE:    /* SNB */
+       case INTEL_FAM6_SANDYBRIDGE_X:  /* SNB Xeon */
+       case INTEL_FAM6_IVYBRIDGE:      /* IVB */
+       case INTEL_FAM6_IVYBRIDGE_X:    /* IVB Xeon */
                pkg_cstate_limits = snb_pkg_cstate_limits;
                break;
-       case 0x3C:      /* HSW */
-       case 0x3F:      /* HSX */
-       case 0x45:      /* HSW */
-       case 0x46:      /* HSW */
-       case 0x3D:      /* BDW */
-       case 0x47:      /* BDW */
-       case 0x4F:      /* BDX */
-       case 0x56:      /* BDX-DE */
-       case 0x4E:      /* SKL */
-       case 0x5E:      /* SKL */
-       case 0x8E:      /* KBL */
-       case 0x9E:      /* KBL */
-       case 0x55:      /* SKX */
+       case INTEL_FAM6_HASWELL_CORE:   /* HSW */
+       case INTEL_FAM6_HASWELL_X:      /* HSX */
+       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
+       case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
+       case INTEL_FAM6_BROADWELL_CORE: /* BDW */
+       case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
+       case INTEL_FAM6_BROADWELL_X:    /* BDX */
+       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
+       case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
+       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
+       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
+       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
                pkg_cstate_limits = hsw_pkg_cstate_limits;
                break;
-       case 0x37:      /* BYT */
-       case 0x4D:      /* AVN */
+       case INTEL_FAM6_SKYLAKE_X:      /* SKX */
+               pkg_cstate_limits = skx_pkg_cstate_limits;
+               break;
+       case INTEL_FAM6_ATOM_SILVERMONT1:       /* BYT */
+       case INTEL_FAM6_ATOM_SILVERMONT2:       /* AVN */
                pkg_cstate_limits = slv_pkg_cstate_limits;
                break;
-       case 0x4C:      /* AMT */
+       case INTEL_FAM6_ATOM_AIRMONT:   /* AMT */
                pkg_cstate_limits = amt_pkg_cstate_limits;
                break;
-       case 0x57:      /* PHI */
+       case INTEL_FAM6_XEON_PHI_KNL:   /* PHI */
+       case INTEL_FAM6_XEON_PHI_KNM:
                pkg_cstate_limits = phi_pkg_cstate_limits;
                break;
-       case 0x5C:      /* BXT */
+       case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
+       case INTEL_FAM6_ATOM_DENVERTON: /* DNV */
                pkg_cstate_limits = bxt_pkg_cstate_limits;
                break;
        default:
@@ -2234,9 +2372,10 @@ int has_nhm_turbo_ratio_limit(unsigned int family, unsigned int model)
 {
        switch (model) {
        /* Nehalem compatible, but do not include turbo-ratio limit support */
-       case 0x2E:      /* Nehalem-EX Xeon - Beckton */
-       case 0x2F:      /* Westmere-EX Xeon - Eagleton */
-       case 0x57:      /* PHI - Knights Landing (different MSR definition) */
+       case INTEL_FAM6_NEHALEM_EX:     /* Nehalem-EX Xeon - Beckton */
+       case INTEL_FAM6_WESTMERE_EX:    /* Westmere-EX Xeon - Eagleton */
+       case INTEL_FAM6_XEON_PHI_KNL:   /* PHI - Knights Landing (different MSR definition) */
+       case INTEL_FAM6_XEON_PHI_KNM:
                return 0;
        default:
                return 1;
@@ -2251,8 +2390,8 @@ int has_ivt_turbo_ratio_limit(unsigned int family, unsigned int model)
                return 0;
 
        switch (model) {
-       case 0x3E:      /* IVB Xeon */
-       case 0x3F:      /* HSW Xeon */
+       case INTEL_FAM6_IVYBRIDGE_X:    /* IVB Xeon */
+       case INTEL_FAM6_HASWELL_X:      /* HSW Xeon */
                return 1;
        default:
                return 0;
@@ -2267,7 +2406,7 @@ int has_hsw_turbo_ratio_limit(unsigned int family, unsigned int model)
                return 0;
 
        switch (model) {
-       case 0x3F:      /* HSW Xeon */
+       case INTEL_FAM6_HASWELL_X:      /* HSW Xeon */
                return 1;
        default:
                return 0;
@@ -2283,7 +2422,8 @@ int has_knl_turbo_ratio_limit(unsigned int family, unsigned int model)
                return 0;
 
        switch (model) {
-       case 0x57:      /* Knights Landing */
+       case INTEL_FAM6_XEON_PHI_KNL:   /* Knights Landing */
+       case INTEL_FAM6_XEON_PHI_KNM:
                return 1;
        default:
                return 0;
@@ -2298,22 +2438,23 @@ int has_config_tdp(unsigned int family, unsigned int model)
                return 0;
 
        switch (model) {
-       case 0x3A:      /* IVB */
-       case 0x3C:      /* HSW */
-       case 0x3F:      /* HSX */
-       case 0x45:      /* HSW */
-       case 0x46:      /* HSW */
-       case 0x3D:      /* BDW */
-       case 0x47:      /* BDW */
-       case 0x4F:      /* BDX */
-       case 0x56:      /* BDX-DE */
-       case 0x4E:      /* SKL */
-       case 0x5E:      /* SKL */
-       case 0x8E:      /* KBL */
-       case 0x9E:      /* KBL */
-       case 0x55:      /* SKX */
-
-       case 0x57:      /* Knights Landing */
+       case INTEL_FAM6_IVYBRIDGE:      /* IVB */
+       case INTEL_FAM6_HASWELL_CORE:   /* HSW */
+       case INTEL_FAM6_HASWELL_X:      /* HSX */
+       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
+       case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
+       case INTEL_FAM6_BROADWELL_CORE: /* BDW */
+       case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
+       case INTEL_FAM6_BROADWELL_X:    /* BDX */
+       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
+       case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
+       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
+       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
+       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
+       case INTEL_FAM6_SKYLAKE_X:      /* SKX */
+
+       case INTEL_FAM6_XEON_PHI_KNL:   /* Knights Landing */
+       case INTEL_FAM6_XEON_PHI_KNM:
                return 1;
        default:
                return 0;
@@ -2593,8 +2734,8 @@ double get_tdp(unsigned int model)
                        return ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units;
 
        switch (model) {
-       case 0x37:
-       case 0x4D:
+       case INTEL_FAM6_ATOM_SILVERMONT1:
+       case INTEL_FAM6_ATOM_SILVERMONT2:
                return 30.0;
        default:
                return 135.0;
@@ -2611,10 +2752,11 @@ rapl_dram_energy_units_probe(int  model, double rapl_energy_units)
        /* only called for genuine_intel, family 6 */
 
        switch (model) {
-       case 0x3F:      /* HSX */
-       case 0x4F:      /* BDX */
-       case 0x56:      /* BDX-DE */
-       case 0x57:      /* KNL */
+       case INTEL_FAM6_HASWELL_X:      /* HSX */
+       case INTEL_FAM6_BROADWELL_X:    /* BDX */
+       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
+       case INTEL_FAM6_XEON_PHI_KNL:   /* KNL */
+       case INTEL_FAM6_XEON_PHI_KNM:
                return (rapl_dram_energy_units = 15.3 / 1000000);
        default:
                return (rapl_energy_units);
@@ -2640,38 +2782,42 @@ void rapl_probe(unsigned int family, unsigned int model)
                return;
 
        switch (model) {
-       case 0x2A:
-       case 0x3A:
-       case 0x3C:      /* HSW */
-       case 0x45:      /* HSW */
-       case 0x46:      /* HSW */
-       case 0x3D:      /* BDW */
-       case 0x47:      /* BDW */
+       case INTEL_FAM6_SANDYBRIDGE:
+       case INTEL_FAM6_IVYBRIDGE:
+       case INTEL_FAM6_HASWELL_CORE:   /* HSW */
+       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
+       case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
+       case INTEL_FAM6_BROADWELL_CORE: /* BDW */
+       case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
                do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO;
                break;
-       case 0x5C:      /* BXT */
+       case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
                do_rapl = RAPL_PKG | RAPL_PKG_POWER_INFO;
                break;
-       case 0x4E:      /* SKL */
-       case 0x5E:      /* SKL */
-       case 0x8E:      /* KBL */
-       case 0x9E:      /* KBL */
+       case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
+       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
+       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
+       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
                do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO;
                break;
-       case 0x3F:      /* HSX */
-       case 0x4F:      /* BDX */
-       case 0x56:      /* BDX-DE */
-       case 0x55:      /* SKX */
-       case 0x57:      /* KNL */
+       case INTEL_FAM6_HASWELL_X:      /* HSX */
+       case INTEL_FAM6_BROADWELL_X:    /* BDX */
+       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
+       case INTEL_FAM6_SKYLAKE_X:      /* SKX */
+       case INTEL_FAM6_XEON_PHI_KNL:   /* KNL */
+       case INTEL_FAM6_XEON_PHI_KNM:
                do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO;
                break;
-       case 0x2D:
-       case 0x3E:
+       case INTEL_FAM6_SANDYBRIDGE_X:
+       case INTEL_FAM6_IVYBRIDGE_X:
                do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_PKG_PERF_STATUS | RAPL_DRAM_PERF_STATUS | RAPL_PKG_POWER_INFO;
                break;
-       case 0x37:      /* BYT */
-       case 0x4D:      /* AVN */
-               do_rapl = RAPL_PKG | RAPL_CORES ;
+       case INTEL_FAM6_ATOM_SILVERMONT1:       /* BYT */
+       case INTEL_FAM6_ATOM_SILVERMONT2:       /* AVN */
+               do_rapl = RAPL_PKG | RAPL_CORES;
+               break;
+       case INTEL_FAM6_ATOM_DENVERTON: /* DNV */
+               do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO | RAPL_CORES_ENERGY_STATUS;
                break;
        default:
                return;
@@ -2682,7 +2828,7 @@ void rapl_probe(unsigned int family, unsigned int model)
                return;
 
        rapl_power_units = 1.0 / (1 << (msr & 0xF));
-       if (model == 0x37)
+       if (model == INTEL_FAM6_ATOM_SILVERMONT1)
                rapl_energy_units = 1.0 * (1 << (msr >> 8 & 0x1F)) / 1000000;
        else
                rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F));
@@ -2713,11 +2859,11 @@ void perf_limit_reasons_probe(unsigned int family, unsigned int model)
                return;
 
        switch (model) {
-       case 0x3C:      /* HSW */
-       case 0x45:      /* HSW */
-       case 0x46:      /* HSW */
+       case INTEL_FAM6_HASWELL_CORE:   /* HSW */
+       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
+       case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
                do_gfx_perf_limit_reasons = 1;
-       case 0x3F:      /* HSX */
+       case INTEL_FAM6_HASWELL_X:      /* HSX */
                do_core_perf_limit_reasons = 1;
                do_ring_perf_limit_reasons = 1;
        default:
@@ -2737,7 +2883,7 @@ int print_thermal(struct thread_data *t, struct core_data *c, struct pkg_data *p
        cpu = t->cpu_id;
 
        /* DTS is per-core, no need to print for each thread */
-       if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) 
+       if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
                return 0;
 
        if (cpu_migrate(cpu)) {
@@ -2886,9 +3032,8 @@ int print_rapl(struct thread_data *t, struct core_data *c, struct pkg_data *p)
                        fprintf(outf, "cpu%d: MSR_PP0_POLICY: %lld\n", cpu, msr & 0xF);
                }
        }
-       if (do_rapl & RAPL_CORES) {
+       if (do_rapl & RAPL_CORES_POWER_LIMIT) {
                if (debug) {
-
                        if (get_msr(cpu, MSR_PP0_POWER_LIMIT, &msr))
                                return -9;
                        fprintf(outf, "cpu%d: MSR_PP0_POWER_LIMIT: 0x%08llx (%slocked)\n",
@@ -2927,24 +3072,25 @@ int has_snb_msrs(unsigned int family, unsigned int model)
                return 0;
 
        switch (model) {
-       case 0x2A:
-       case 0x2D:
-       case 0x3A:      /* IVB */
-       case 0x3E:      /* IVB Xeon */
-       case 0x3C:      /* HSW */
-       case 0x3F:      /* HSW */
-       case 0x45:      /* HSW */
-       case 0x46:      /* HSW */
-       case 0x3D:      /* BDW */
-       case 0x47:      /* BDW */
-       case 0x4F:      /* BDX */
-       case 0x56:      /* BDX-DE */
-       case 0x4E:      /* SKL */
-       case 0x5E:      /* SKL */
-       case 0x8E:      /* KBL */
-       case 0x9E:      /* KBL */
-       case 0x55:      /* SKX */
-       case 0x5C:      /* BXT */
+       case INTEL_FAM6_SANDYBRIDGE:
+       case INTEL_FAM6_SANDYBRIDGE_X:
+       case INTEL_FAM6_IVYBRIDGE:      /* IVB */
+       case INTEL_FAM6_IVYBRIDGE_X:    /* IVB Xeon */
+       case INTEL_FAM6_HASWELL_CORE:   /* HSW */
+       case INTEL_FAM6_HASWELL_X:      /* HSW */
+       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
+       case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
+       case INTEL_FAM6_BROADWELL_CORE: /* BDW */
+       case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
+       case INTEL_FAM6_BROADWELL_X:    /* BDX */
+       case INTEL_FAM6_BROADWELL_XEON_D:       /* BDX-DE */
+       case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
+       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
+       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
+       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
+       case INTEL_FAM6_SKYLAKE_X:      /* SKX */
+       case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
+       case INTEL_FAM6_ATOM_DENVERTON: /* DNV */
                return 1;
        }
        return 0;
@@ -2968,13 +3114,13 @@ int has_hsw_msrs(unsigned int family, unsigned int model)
                return 0;
 
        switch (model) {
-       case 0x45:      /* HSW */
-       case 0x3D:      /* BDW */
-       case 0x4E:      /* SKL */
-       case 0x5E:      /* SKL */
-       case 0x8E:      /* KBL */
-       case 0x9E:      /* KBL */
-       case 0x5C:      /* BXT */
+       case INTEL_FAM6_HASWELL_ULT:    /* HSW */
+       case INTEL_FAM6_BROADWELL_CORE: /* BDW */
+       case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
+       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
+       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
+       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
+       case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
                return 1;
        }
        return 0;
@@ -2994,10 +3140,10 @@ int has_skl_msrs(unsigned int family, unsigned int model)
                return 0;
 
        switch (model) {
-       case 0x4E:      /* SKL */
-       case 0x5E:      /* SKL */
-       case 0x8E:      /* KBL */
-       case 0x9E:      /* KBL */
+       case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
+       case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
+       case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
+       case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
                return 1;
        }
        return 0;
@@ -3010,8 +3156,8 @@ int is_slm(unsigned int family, unsigned int model)
        if (!genuine_intel)
                return 0;
        switch (model) {
-       case 0x37:      /* BYT */
-       case 0x4D:      /* AVN */
+       case INTEL_FAM6_ATOM_SILVERMONT1:       /* BYT */
+       case INTEL_FAM6_ATOM_SILVERMONT2:       /* AVN */
                return 1;
        }
        return 0;
@@ -3022,7 +3168,8 @@ int is_knl(unsigned int family, unsigned int model)
        if (!genuine_intel)
                return 0;
        switch (model) {
-       case 0x57:      /* KNL */
+       case INTEL_FAM6_XEON_PHI_KNL:   /* KNL */
+       case INTEL_FAM6_XEON_PHI_KNM:
                return 1;
        }
        return 0;
@@ -3050,7 +3197,7 @@ double slm_bclk(void)
        i = msr & 0xf;
        if (i >= SLM_BCLK_FREQS) {
                fprintf(outf, "SLM BCLK[%d] invalid\n", i);
-               msr = 3;
+               i = 3;
        }
        freq = slm_freq_table[i];
 
@@ -3174,10 +3321,11 @@ void decode_misc_pwr_mgmt_msr(void)
                return;
 
        if (!get_msr(base_cpu, MSR_MISC_PWR_MGMT, &msr))
-               fprintf(outf, "cpu%d: MSR_MISC_PWR_MGMT: 0x%08llx (%sable-EIST_Coordination %sable-EPB)\n",
+               fprintf(outf, "cpu%d: MSR_MISC_PWR_MGMT: 0x%08llx (%sable-EIST_Coordination %sable-EPB %sable-OOB)\n",
                        base_cpu, msr,
                        msr & (1 << 0) ? "DIS" : "EN",
-                       msr & (1 << 1) ? "EN" : "DIS");
+                       msr & (1 << 1) ? "EN" : "DIS",
+                       msr & (1 << 8) ? "EN" : "DIS");
 }
 
 void process_cpuid()
@@ -3303,16 +3451,17 @@ void process_cpuid()
 
                        if (crystal_hz == 0)
                                switch(model) {
-                               case 0x4E:      /* SKL */
-                               case 0x5E:      /* SKL */
-                               case 0x8E:      /* KBL */
-                               case 0x9E:      /* KBL */
+                               case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
+                               case INTEL_FAM6_SKYLAKE_DESKTOP:        /* SKL */
+                               case INTEL_FAM6_KABYLAKE_MOBILE:        /* KBL */
+                               case INTEL_FAM6_KABYLAKE_DESKTOP:       /* KBL */
                                        crystal_hz = 24000000;  /* 24.0 MHz */
                                        break;
-                               case 0x55:      /* SKX */
+                               case INTEL_FAM6_SKYLAKE_X:      /* SKX */
+                               case INTEL_FAM6_ATOM_DENVERTON: /* DNV */
                                        crystal_hz = 25000000;  /* 25.0 MHz */
                                        break;
-                               case 0x5C:      /* BXT */
+                               case INTEL_FAM6_ATOM_GOLDMONT:  /* BXT */
                                        crystal_hz = 19200000;  /* 19.2 MHz */
                                        break;
                                default:
@@ -3385,14 +3534,12 @@ void help()
        "when COMMAND completes.\n"
        "If no COMMAND is specified, turbostat wakes every 5-seconds\n"
        "to print statistics, until interrupted.\n"
+       "--add          add a counter\n"
+       "               eg. --add msr0x10,u64,cpu,delta,MY_TSC\n"
        "--debug        run in \"debug\" mode\n"
        "--interval sec Override default 5-second measurement interval\n"
        "--help         print this help message\n"
-       "--counter msr  print 32-bit counter at address \"msr\"\n"
-       "--Counter msr  print 64-bit Counter at address \"msr\"\n"
        "--out file     create or truncate \"file\" for all output\n"
-       "--msr msr      print 32-bit value at address \"msr\"\n"
-       "--MSR msr      print 64-bit Value at address \"msr\"\n"
        "--version      print version information\n"
        "\n"
        "For more help, run \"man turbostat\"\n");
@@ -3515,7 +3662,7 @@ allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_data
        int i;
 
        *t = calloc(topo.num_threads_per_core * topo.num_cores_per_pkg *
-               topo.num_packages, sizeof(struct thread_data));
+               topo.num_packages, sizeof(struct thread_data) + sys.thread_counter_bytes);
        if (*t == NULL)
                goto error;
 
@@ -3524,14 +3671,14 @@ allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_data
                (*t)[i].cpu_id = -1;
 
        *c = calloc(topo.num_cores_per_pkg * topo.num_packages,
-               sizeof(struct core_data));
+               sizeof(struct core_data) + sys.core_counter_bytes);
        if (*c == NULL)
                goto error;
 
        for (i = 0; i < topo.num_cores_per_pkg * topo.num_packages; i++)
                (*c)[i].core_id = -1;
 
-       *p = calloc(topo.num_packages, sizeof(struct pkg_data));
+       *p = calloc(topo.num_packages, sizeof(struct pkg_data) + sys.package_counter_bytes);
        if (*p == NULL)
                goto error;
 
@@ -3598,7 +3745,7 @@ void allocate_output_buffer()
 }
 void allocate_fd_percpu(void)
 {
-       fd_percpu = calloc(topo.max_cpu_num, sizeof(int));
+       fd_percpu = calloc(topo.max_cpu_num + 1, sizeof(int));
        if (fd_percpu == NULL)
                err(-1, "calloc fd_percpu");
 }
@@ -3608,9 +3755,9 @@ void allocate_irq_buffers(void)
        if (irq_column_2_cpu == NULL)
                err(-1, "calloc %d", topo.num_cpus);
 
-       irqs_per_cpu = calloc(topo.max_cpu_num, sizeof(int));
+       irqs_per_cpu = calloc(topo.max_cpu_num + 1, sizeof(int));
        if (irqs_per_cpu == NULL)
-               err(-1, "calloc %d", topo.max_cpu_num);
+               err(-1, "calloc %d", topo.max_cpu_num + 1);
 }
 void setup_all_buffers(void)
 {
@@ -3697,9 +3844,12 @@ int fork_it(char **argv)
        for_all_cpus(get_counters, ODD_COUNTERS);
        gettimeofday(&tv_odd, (struct timezone *)NULL);
        timersub(&tv_odd, &tv_even, &tv_delta);
-       for_all_cpus_2(delta_cpu, ODD_COUNTERS, EVEN_COUNTERS);
-       compute_average(EVEN_COUNTERS);
-       format_all_counters(EVEN_COUNTERS);
+       if (for_all_cpus_2(delta_cpu, ODD_COUNTERS, EVEN_COUNTERS))
+               fprintf(outf, "%s: Counter reset detected\n", progname);
+       else {
+               compute_average(EVEN_COUNTERS);
+               format_all_counters(EVEN_COUNTERS);
+       }
 
        fprintf(outf, "%.6f sec\n", tv_delta.tv_sec + tv_delta.tv_usec/1000000.0);
 
@@ -3726,24 +3876,170 @@ int get_and_dump_counters(void)
 }
 
 void print_version() {
-       fprintf(outf, "turbostat version 4.12 5 Apr 2016"
+       fprintf(outf, "turbostat version 4.16 24 Dec 2016"
                " - Len Brown <lenb@kernel.org>\n");
 }
 
+int add_counter(unsigned int msr_num, char *name, unsigned int width,
+       enum counter_scope scope, enum counter_type type,
+       enum counter_format format)
+{
+       struct msr_counter *msrp;
+
+       msrp = calloc(1, sizeof(struct msr_counter));
+       if (msrp == NULL) {
+               perror("calloc");
+               exit(1);
+       }
+
+       msrp->msr_num = msr_num;
+       strncpy(msrp->name, name, NAME_BYTES);
+       msrp->width = width;
+       msrp->type = type;
+       msrp->format = format;
+
+       switch (scope) {
+
+       case SCOPE_CPU:
+               sys.thread_counter_bytes += 64;
+               msrp->next = sys.tp;
+               sys.tp = msrp;
+               sys.thread_counter_bytes += sizeof(unsigned long long);
+               break;
+
+       case SCOPE_CORE:
+               sys.core_counter_bytes += 64;
+               msrp->next = sys.cp;
+               sys.cp = msrp;
+               sys.core_counter_bytes += sizeof(unsigned long long);
+               break;
+
+       case SCOPE_PACKAGE:
+               sys.package_counter_bytes += 64;
+               msrp->next = sys.pp;
+               sys.pp = msrp;
+               sys.package_counter_bytes += sizeof(unsigned long long);
+               break;
+       }
+
+       return 0;
+}
+
+void parse_add_command(char *add_command)
+{
+       int msr_num = 0;
+       char name_buffer[NAME_BYTES];
+       int width = 64;
+       int fail = 0;
+       enum counter_scope scope = SCOPE_CPU;
+       enum counter_type type = COUNTER_CYCLES;
+       enum counter_format format = FORMAT_DELTA;
+
+       while (add_command) {
+
+               if (sscanf(add_command, "msr0x%x", &msr_num) == 1)
+                       goto next;
+
+               if (sscanf(add_command, "msr%d", &msr_num) == 1)
+                       goto next;
+
+               if (sscanf(add_command, "u%d", &width) == 1) {
+                       if ((width == 32) || (width == 64))
+                               goto next;
+                       width = 64;
+               }
+               if (!strncmp(add_command, "cpu", strlen("cpu"))) {
+                       scope = SCOPE_CPU;
+                       goto next;
+               }
+               if (!strncmp(add_command, "core", strlen("core"))) {
+                       scope = SCOPE_CORE;
+                       goto next;
+               }
+               if (!strncmp(add_command, "package", strlen("package"))) {
+                       scope = SCOPE_PACKAGE;
+                       goto next;
+               }
+               if (!strncmp(add_command, "cycles", strlen("cycles"))) {
+                       type = COUNTER_CYCLES;
+                       goto next;
+               }
+               if (!strncmp(add_command, "seconds", strlen("seconds"))) {
+                       type = COUNTER_SECONDS;
+                       goto next;
+               }
+               if (!strncmp(add_command, "raw", strlen("raw"))) {
+                       format = FORMAT_RAW;
+                       goto next;
+               }
+               if (!strncmp(add_command, "delta", strlen("delta"))) {
+                       format = FORMAT_DELTA;
+                       goto next;
+               }
+               if (!strncmp(add_command, "percent", strlen("percent"))) {
+                       format = FORMAT_PERCENT;
+                       goto next;
+               }
+
+               if (sscanf(add_command, "%18s,%*s", name_buffer) == 1) {        /* 18 < NAME_BYTES */
+                       char *eos;
+
+                       eos = strchr(name_buffer, ',');
+                       if (eos)
+                               *eos = '\0';
+                       goto next;
+               }
+
+next:
+               add_command = strchr(add_command, ',');
+               if (add_command)
+                       add_command++;
+
+       }
+       if (msr_num == 0) {
+               fprintf(stderr, "--add: (msrDDD | msr0xXXX) required\n");
+               fail++;
+       }
+
+       /* generate default column header */
+       if (*name_buffer == '\0') {
+               if (format == FORMAT_RAW) {
+                       if (width == 32)
+                               sprintf(name_buffer, "msr%d", msr_num);
+                       else
+                               sprintf(name_buffer, "MSR%d", msr_num);
+               } else if (format == FORMAT_DELTA) {
+                       if (width == 32)
+                               sprintf(name_buffer, "cnt%d", msr_num);
+                       else
+                               sprintf(name_buffer, "CNT%d", msr_num);
+               } else if (format == FORMAT_PERCENT) {
+                       if (width == 32)
+                               sprintf(name_buffer, "msr%d%%", msr_num);
+                       else
+                               sprintf(name_buffer, "MSR%d%%", msr_num);
+               }
+       }
+
+       if (add_counter(msr_num, name_buffer, width, scope, type, format))
+               fail++;
+
+       if (fail) {
+               help();
+               exit(1);
+       }
+}
 void cmdline(int argc, char **argv)
 {
        int opt;
        int option_index = 0;
        static struct option long_options[] = {
-               {"Counter",     required_argument,      0, 'C'},
-               {"counter",     required_argument,      0, 'c'},
+               {"add",         required_argument,      0, 'a'},
                {"Dump",        no_argument,            0, 'D'},
                {"debug",       no_argument,            0, 'd'},
                {"interval",    required_argument,      0, 'i'},
                {"help",        no_argument,            0, 'h'},
                {"Joules",      no_argument,            0, 'J'},
-               {"MSR",         required_argument,      0, 'M'},
-               {"msr",         required_argument,      0, 'm'},
                {"out",         required_argument,      0, 'o'},
                {"Package",     no_argument,            0, 'p'},
                {"processor",   no_argument,            0, 'p'},
@@ -3758,11 +4054,8 @@ void cmdline(int argc, char **argv)
        while ((opt = getopt_long_only(argc, argv, "+C:c:Ddhi:JM:m:o:PpST:v",
                                long_options, &option_index)) != -1) {
                switch (opt) {
-               case 'C':
-                       sscanf(optarg, "%x", &extra_delta_offset64);
-                       break;
-               case 'c':
-                       sscanf(optarg, "%x", &extra_delta_offset32);
+               case 'a':
+                       parse_add_command(optarg);
                        break;
                case 'D':
                        dump_only++;
@@ -3791,12 +4084,6 @@ void cmdline(int argc, char **argv)
                case 'J':
                        rapl_joules++;
                        break;
-               case 'M':
-                       sscanf(optarg, "%x", &extra_msr_offset64);
-                       break;
-               case 'm':
-                       sscanf(optarg, "%x", &extra_msr_offset32);
-                       break;
                case 'o':
                        outf = fopen_or_die(optarg, "w");
                        break;
index 17a513268325d197b76aa36d7c26c337a70b9a4d..0b87e71c00fcc9c6cb0de2248b191e89228bf9b6 100644 (file)
@@ -5,8 +5,10 @@
 klibcdirs:;
 PHONY += klibcdirs
 
-suffix_y = $(CONFIG_INITRAMFS_COMPRESSION)
-AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
+suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION))
+datafile_y = initramfs_data.cpio$(suffix_y)
+AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)"
+
 
 # Generate builtin.o based on initramfs_data.o
 obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
@@ -14,7 +16,7 @@ obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
 # initramfs_data.o contains the compressed initramfs_data.cpio image.
 # The image is included using .incbin, a dependency which is not
 # tracked automatically.
-$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE
+$(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE
 
 #####
 # Generate the initramfs cpio archive
@@ -38,10 +40,8 @@ endif
 quiet_cmd_initfs = GEN     $@
       cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
 
-targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 \
-       initramfs_data.cpio.lzma initramfs_data.cpio.xz \
-       initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \
-       initramfs_data.cpio
+targets := $(datafile_y)
+
 # do not try to update files included in initramfs
 $(deps_initramfs): ;
 
@@ -51,6 +51,6 @@ $(deps_initramfs): klibcdirs
 # 2) There are changes in which files are included (added or deleted)
 # 3) If gen_init_cpio are newer than initramfs_data.cpio
 # 4) arguments to gen_initramfs.sh changes
-$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
+$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
        $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d
        $(call if_changed,initfs)
index ae95fc0e32143083b1e5aa34286cb6e771f043dc..a2dbbccbb6a3fe96751fafde8cd01658aa1301a5 100644 (file)
@@ -39,7 +39,7 @@ void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu)
        vcpu->arch.timer_cpu.active_cleared_last = false;
 }
 
-static cycle_t kvm_phys_timer_read(void)
+static u64 kvm_phys_timer_read(void)
 {
        return timecounter->cc->read(timecounter->cc);
 }
@@ -102,7 +102,7 @@ static void kvm_timer_inject_irq_work(struct work_struct *work)
 
 static u64 kvm_timer_compute_delta(struct kvm_vcpu *vcpu)
 {
-       cycle_t cval, now;
+       u64 cval, now;
 
        cval = vcpu->arch.timer_cpu.cntv_cval;
        now = kvm_phys_timer_read() - vcpu->kvm->arch.timer.cntvoff;
@@ -155,7 +155,7 @@ static bool kvm_timer_irq_can_fire(struct kvm_vcpu *vcpu)
 bool kvm_timer_should_fire(struct kvm_vcpu *vcpu)
 {
        struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
-       cycle_t cval, now;
+       u64 cval, now;
 
        if (!kvm_timer_irq_can_fire(vcpu))
                return false;
@@ -456,7 +456,7 @@ int kvm_timer_hyp_init(void)
        kvm_info("virtual timer IRQ%d\n", host_vtimer_irq);
 
        cpuhp_setup_state(CPUHP_AP_KVM_ARM_TIMER_STARTING,
-                         "AP_KVM_ARM_TIMER_STARTING", kvm_timer_starting_cpu,
+                         "kvm/arm/timer:starting", kvm_timer_starting_cpu,
                          kvm_timer_dying_cpu);
        return err;
 }
index 8cebfbc19e90ef053ec325f7d7d75ab7e626a049..5114391b7e5af52ee5f815baead6b4561243a31a 100644 (file)
@@ -428,7 +428,7 @@ int kvm_vgic_hyp_init(void)
        }
 
        ret = cpuhp_setup_state(CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING,
-                               "AP_KVM_ARM_VGIC_INIT_STARTING",
+                               "kvm/arm/vgic:starting",
                                vgic_init_cpu_starting, vgic_init_cpu_dying);
        if (ret) {
                kvm_err("Cannot register vgic CPU notifier\n");
index de102cae7125b5d2515aad0b9e660c53e520c1e4..482612b4e496f92527d5191a2a8adfa5962e4de8 100644 (file)
@@ -53,7 +53,7 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/ioctl.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/pgtable.h>
 
 #include "coalesced_mmio.h"
@@ -3944,7 +3944,7 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
                        goto out_free_1;
        }
 
-       r = cpuhp_setup_state_nocalls(CPUHP_AP_KVM_STARTING, "AP_KVM_STARTING",
+       r = cpuhp_setup_state_nocalls(CPUHP_AP_KVM_STARTING, "kvm/cpu:starting",
                                      kvm_starting_cpu, kvm_dying_cpu);
        if (r)
                goto out_free_2;