Merge tag 'gpio-v5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 2 Oct 2020 16:51:42 +0000 (09:51 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 2 Oct 2020 16:51:42 +0000 (09:51 -0700)
Pull GPIO fixes from Linus Walleij:
 "Some late GPIO fixes for the v5.9 series:

   - Fix compiler warnings on the OMAP when PM is disabled

   - Clear the interrupt when setting edge sensitivity on the Spreadtrum
     driver.

   - Fix up spurious interrupts on the TC35894.

   - Support threaded interrupts on the Siox controller.

   - Fix resource leaks on the mockup driver.

   - Fix line event handling in syscall compatible mode for the
     character device.

   - Fix an unitialized variable in the PCA953A driver.

   - Fix access to all GPIO IRQs on the Aspeed AST2600.

   - Fix line direction on the AMD FCH driver.

   - Use the bitmap API instead of compiler intrinsics for bit
     manipulation in the PCA953x driver"

* tag 'gpio-v5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpio: pca953x: Correctly initialize registers 6 and 7 for PCA957x
  gpio: pca953x: Use bitmap API over implicit GCC extension
  gpio: amd-fch: correct logic of GPIO_LINE_DIRECTION
  gpio: aspeed: fix ast2600 bank properties
  gpio/aspeed-sgpio: don't enable all interrupts by default
  gpio/aspeed-sgpio: enable access to all 80 input & output sgpios
  gpio: pca953x: Fix uninitialized pending variable
  gpiolib: Fix line event handling in syscall compatible mode
  gpio: mockup: fix resource leak in error path
  gpio: siox: explicitly support only threaded irqs
  gpio: tc35894: fix up tc35894 interrupt configuration
  gpio: sprd: Clear interrupt when setting the type as edge
  gpio: omap: Fix warnings if PM is disabled

2323 files changed:
.clang-format
.mailmap
Documentation/RCU/lockdep.rst
Documentation/admin-guide/cgroup-v2.rst
Documentation/admin-guide/device-mapper/dm-crypt.rst
Documentation/admin-guide/devices.txt
Documentation/admin-guide/dynamic-debug-howto.rst
Documentation/admin-guide/laptops/thinkpad-acpi.rst
Documentation/admin-guide/pm/intel_pstate.rst
Documentation/bpf/ringbuf.rst
Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml
Documentation/devicetree/bindings/crypto/ti,sa2ul.yaml
Documentation/devicetree/bindings/display/xlnx/xlnx,zynqmp-dpsub.yaml
Documentation/devicetree/bindings/dma/xilinx/xlnx,zynqmp-dpdma.yaml
Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt [deleted file]
Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt [deleted file]
Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml
Documentation/devicetree/bindings/media/i2c/imx274.txt [deleted file]
Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml
Documentation/devicetree/bindings/mmc/mtk-sd.txt
Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt
Documentation/devicetree/bindings/net/dsa/dsa.txt
Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.txt
Documentation/driver-api/dma-buf.rst
Documentation/driver-api/fpga/fpga-bridge.rst
Documentation/driver-api/fpga/fpga-mgr.rst
Documentation/driver-api/fpga/fpga-programming.rst
Documentation/driver-api/fpga/fpga-region.rst
Documentation/driver-api/iio/core.rst
Documentation/fault-injection/nvme-fault-injection.rst
Documentation/features/debug/debug-vm-pgtable/arch-support.txt
Documentation/filesystems/affs.rst
Documentation/hwmon/abituguru-datasheet.rst
Documentation/hwmon/abituguru.rst
Documentation/hwmon/abituguru3.rst
Documentation/kbuild/llvm.rst
Documentation/kbuild/makefiles.rst
Documentation/locking/locktypes.rst
Documentation/maintainer/maintainer-entry-profile.rst
Documentation/networking/dsa/configuration.rst
Documentation/networking/ethtool-netlink.rst
Documentation/powerpc/syscall64-abi.rst
Documentation/process/deprecated.rst
Documentation/sound/cards/audigy-mixer.rst
Documentation/sound/cards/sb-live-mixer.rst
Documentation/sound/designs/timestamping.rst
Documentation/translations/it_IT/process/deprecated.rst
Documentation/userspace-api/media/v4l/buffer.rst
Documentation/userspace-api/media/v4l/vidioc-create-bufs.rst
Documentation/userspace-api/media/v4l/vidioc-reqbufs.rst
Documentation/virt/kvm/api.rst
MAINTAINERS
Makefile
arch/alpha/kernel/module.c
arch/alpha/kernel/signal.c
arch/alpha/kernel/traps.c
arch/arc/boot/dts/hsdk.dts
arch/arc/include/asm/pgalloc.h
arch/arc/kernel/disasm.c
arch/arc/kernel/perf_event.c
arch/arc/kernel/signal.c
arch/arc/kernel/troubleshoot.c
arch/arc/kernel/unwind.c
arch/arc/mm/init.c
arch/arc/plat-eznps/include/plat/ctop.h
arch/arm/boot/dts/at91-sama5d2_icp.dts
arch/arm/boot/dts/bcm-hr2.dtsi
arch/arm/boot/dts/bcm-nsp.dtsi
arch/arm/boot/dts/bcm2835-rpi.dtsi
arch/arm/boot/dts/bcm5301x.dtsi
arch/arm/boot/dts/imx6q-logicpd.dts
arch/arm/boot/dts/imx6q-prtwd2.dts
arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
arch/arm/boot/dts/imx6sx-pinfunc.h
arch/arm/boot/dts/imx7d-zii-rmu2.dts
arch/arm/boot/dts/imx7ulp.dtsi
arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi
arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi
arch/arm/boot/dts/ls1021a.dtsi
arch/arm/boot/dts/omap5.dtsi
arch/arm/boot/dts/socfpga_arria10.dtsi
arch/arm/boot/dts/vfxxx.dtsi
arch/arm/configs/integrator_defconfig
arch/arm/kernel/hw_breakpoint.c
arch/arm/kernel/signal.c
arch/arm/mach-ep93xx/crunch.c
arch/arm/mach-mmp/pm-mmp2.c
arch/arm/mach-mmp/pm-pxa910.c
arch/arm/mach-omap2/id.c
arch/arm/mach-omap2/omap-iommu.c
arch/arm/mach-omap2/omap_device.c
arch/arm/mach-omap2/pm34xx.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-rpc/riscpc.c
arch/arm/mach-tegra/reset.c
arch/arm/mm/alignment.c
arch/arm/mm/proc-v7-bugs.c
arch/arm/plat-omap/dma.c
arch/arm/probes/decode.c
arch/arm/probes/kprobes/core.c
arch/arm64/Makefile
arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi
arch/arm64/boot/dts/freescale/Makefile
arch/arm64/boot/dts/freescale/imx8mp.dtsi
arch/arm64/boot/dts/freescale/imx8mq.dtsi
arch/arm64/boot/dts/mediatek/mt7622.dtsi
arch/arm64/boot/dts/nvidia/tegra186.dtsi
arch/arm64/boot/dts/nvidia/tegra194.dtsi
arch/arm64/boot/dts/nvidia/tegra210.dtsi
arch/arm64/boot/dts/ti/k3-am65-main.dtsi
arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
arch/arm64/boot/dts/ti/k3-am654-base-board.dts
arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi
arch/arm64/boot/dts/xilinx/zynqmp.dtsi
arch/arm64/configs/defconfig
arch/arm64/include/asm/compiler.h
arch/arm64/include/asm/irqflags.h
arch/arm64/include/asm/kvm_arm.h
arch/arm64/include/asm/kvm_asm.h
arch/arm64/include/asm/kvm_emulate.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/include/asm/tlbflush.h
arch/arm64/kernel/acpi.c
arch/arm64/kernel/cpu_errata.c
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/cpuinfo.c
arch/arm64/kernel/hw_breakpoint.c
arch/arm64/kernel/image-vars.h
arch/arm64/kernel/module-plts.c
arch/arm64/kernel/module.c
arch/arm64/kernel/paravirt.c
arch/arm64/kernel/process.c
arch/arm64/kernel/setup.c
arch/arm64/kernel/smp.c
arch/arm64/kernel/vmlinux.lds.S
arch/arm64/kvm/arm.c
arch/arm64/kvm/handle_exit.c
arch/arm64/kvm/hyp/entry.S
arch/arm64/kvm/hyp/hyp-entry.S
arch/arm64/kvm/hyp/include/hyp/debug-sr.h
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/hyp/nvhe/switch.c
arch/arm64/kvm/hyp/vgic-v3-sr.c
arch/arm64/kvm/hyp/vhe/switch.c
arch/arm64/kvm/mmu.c
arch/arm64/kvm/pvtime.c
arch/arm64/kvm/trace_arm.h
arch/arm64/kvm/trace_handle_exit.h
arch/arm64/mm/context.c
arch/arm64/net/bpf_jit_comp.c
arch/c6x/kernel/signal.c
arch/csky/kernel/signal.c
arch/h8300/kernel/signal.c
arch/hexagon/kernel/module.c
arch/hexagon/kernel/signal.c
arch/ia64/include/asm/acpi.h
arch/ia64/kernel/crash.c
arch/ia64/kernel/ia64_ksyms.c
arch/ia64/kernel/module.c
arch/ia64/kernel/perfmon.c
arch/ia64/kernel/signal.c
arch/ia64/kernel/unaligned.c
arch/ia64/kernel/unwind.c
arch/ia64/mm/init.c
arch/m68k/atari/atakeyb.c
arch/m68k/kernel/signal.c
arch/m68k/mac/config.c
arch/m68k/mac/via.c
arch/m68k/mm/fault.c
arch/microblaze/kernel/signal.c
arch/microblaze/mm/init.c
arch/mips/Kconfig
arch/mips/bcm47xx/setup.c
arch/mips/include/asm/cpu-type.h
arch/mips/include/asm/irqflags.h
arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h
arch/mips/include/asm/mach-loongson64/irq.h
arch/mips/include/asm/mach-loongson64/mmzone.h
arch/mips/include/asm/unroll.h
arch/mips/kernel/perf_event_mipsxx.c
arch/mips/kernel/smp-bmips.c
arch/mips/kernel/traps.c
arch/mips/kvm/mips.c
arch/mips/loongson2ef/Platform
arch/mips/loongson64/cop2-ex.c
arch/mips/mm/c-r4k.c
arch/mips/oprofile/op_model_mipsxx.c
arch/mips/sni/a20r.c
arch/nds32/include/asm/irqflags.h
arch/nds32/kernel/fpu.c
arch/nds32/kernel/signal.c
arch/openrisc/include/asm/uaccess.h
arch/openrisc/kernel/setup.c
arch/openrisc/kernel/signal.c
arch/openrisc/mm/cache.c
arch/parisc/kernel/signal.c
arch/parisc/kernel/traps.c
arch/parisc/mm/fault.c
arch/powerpc/Kconfig
arch/powerpc/configs/pasemi_defconfig
arch/powerpc/configs/ppc6xx_defconfig
arch/powerpc/include/asm/book3s/64/mmu.h
arch/powerpc/include/asm/book3s/64/pgtable.h
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/hw_irq.h
arch/powerpc/include/asm/mman.h
arch/powerpc/include/asm/nohash/64/pgtable.h
arch/powerpc/include/uapi/asm/mman.h
arch/powerpc/kernel/dma-iommu.c
arch/powerpc/kernel/dt_cpu_ftrs.c
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/process.c
arch/powerpc/kernel/vdso32/Makefile
arch/powerpc/kernel/vdso32/vdso32.lds.S
arch/powerpc/kernel/vdso64/Makefile
arch/powerpc/kernel/vdso64/vdso64.lds.S
arch/powerpc/mm/book3s64/hash_utils.c
arch/powerpc/mm/book3s64/radix_pgtable.c
arch/powerpc/mm/init_64.c
arch/powerpc/net/bpf_jit_comp.c
arch/powerpc/perf/core-book3s.c
arch/powerpc/perf/imc-pmu.c
arch/powerpc/platforms/Kconfig.cputype
arch/powerpc/platforms/powernv/idle.c
arch/powerpc/platforms/pseries/papr_scm.c
arch/riscv/Kconfig
arch/riscv/boot/dts/kendryte/k210.dtsi
arch/riscv/include/asm/clint.h [new file with mode: 0644]
arch/riscv/include/asm/ftrace.h
arch/riscv/include/asm/timex.h
arch/riscv/kernel/ftrace.c
arch/riscv/kernel/signal.c
arch/riscv/mm/init.c
arch/riscv/net/bpf_jit_comp32.c
arch/s390/Kconfig
arch/s390/configs/debug_defconfig
arch/s390/configs/defconfig
arch/s390/configs/zfcpdump_defconfig
arch/s390/include/asm/percpu.h
arch/s390/include/asm/pgtable.h
arch/s390/kernel/entry.h
arch/s390/kernel/idle.c
arch/s390/kernel/pgm_check.S
arch/s390/kernel/setup.c
arch/s390/mm/fault.c
arch/s390/mm/vmem.c
arch/s390/pci/pci.c
arch/s390/pci/pci_event.c
arch/sh/drivers/platform_early.c
arch/sh/include/asm/smp.h
arch/sh/kernel/disassemble.c
arch/sh/kernel/entry-common.S
arch/sh/kernel/kgdb.c
arch/sh/kernel/ptrace_32.c
arch/sh/kernel/signal_32.c
arch/sparc/kernel/auxio_64.c
arch/sparc/kernel/central.c
arch/sparc/kernel/kgdb_32.c
arch/sparc/kernel/kgdb_64.c
arch/sparc/kernel/pcr.c
arch/sparc/kernel/prom_32.c
arch/sparc/kernel/signal32.c
arch/sparc/kernel/signal_32.c
arch/sparc/kernel/signal_64.c
arch/sparc/math-emu/math_32.c
arch/sparc/net/bpf_jit_comp_32.c
arch/um/kernel/signal.c
arch/x86/boot/cmdline.c
arch/x86/boot/compressed/Makefile
arch/x86/boot/compressed/kaslr.c
arch/x86/configs/i386_defconfig
arch/x86/configs/x86_64_defconfig
arch/x86/entry/common.c
arch/x86/entry/entry_64.S
arch/x86/entry/thunk_32.S
arch/x86/events/intel/core.c
arch/x86/events/intel/lbr.c
arch/x86/include/asm/acpi.h
arch/x86/include/asm/entry-common.h
arch/x86/include/asm/frame.h
arch/x86/include/asm/idtentry.h
arch/x86/include/asm/irq_stack.h
arch/x86/include/asm/mmu.h
arch/x86/include/asm/ptrace.h
arch/x86/kernel/alternative.c
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/apic/probe_32.c
arch/x86/kernel/apic/vector.c
arch/x86/kernel/cpu/cacheinfo.c
arch/x86/kernel/cpu/mce/inject.c
arch/x86/kernel/cpu/mce/intel.c
arch/x86/kernel/cpu/mtrr/cyrix.c
arch/x86/kernel/hw_breakpoint.c
arch/x86/kernel/irq.c
arch/x86/kernel/irq_64.c
arch/x86/kernel/kgdb.c
arch/x86/kernel/kvm.c
arch/x86/kernel/mpparse.c
arch/x86/kernel/process.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/reboot.c
arch/x86/kernel/signal.c
arch/x86/kernel/smpboot.c
arch/x86/kernel/traps.c
arch/x86/kernel/uprobes.c
arch/x86/kvm/emulate.c
arch/x86/kvm/hyperv.c
arch/x86/kvm/irq_comm.c
arch/x86/kvm/lapic.c
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/svm/nested.c
arch/x86/kvm/svm/sev.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h
arch/x86/kvm/x86.c
arch/x86/lib/Makefile
arch/x86/lib/cmdline.c
arch/x86/lib/insn-eval.c
arch/x86/lib/usercopy_64.c
arch/x86/math-emu/errors.c
arch/x86/math-emu/fpu_trig.c
arch/x86/mm/fault.c
arch/x86/mm/ioremap.c
arch/x86/mm/numa_emulation.c
arch/x86/mm/tlb.c
arch/xtensa/kernel/signal.c
block/badblocks.c
block/bfq-cgroup.c
block/bfq-iosched.c
block/bfq-iosched.h
block/bfq-wf2q.c
block/bio.c
block/blk-cgroup.c
block/blk-core.c
block/blk-iocost.c
block/blk-merge.c
block/blk-mq-sched.c
block/blk-mq-sched.h
block/blk-mq.c
block/blk-settings.c
block/blk-stat.c
block/blk-wbt.c
block/bsg-lib.c
block/ioprio.c
block/partitions/core.c
crypto/af_alg.c
crypto/drbg.c
crypto/tcrypt.c
drivers/accessibility/braille/braille_console.c
drivers/accessibility/speakup/Kconfig
drivers/accessibility/speakup/Makefile
drivers/accessibility/speakup/serialio.c
drivers/accessibility/speakup/spk_priv.h
drivers/accessibility/speakup/spk_ttyio.c
drivers/accessibility/speakup/spk_types.h
drivers/accessibility/speakup/synth.c
drivers/acpi/acpi_apd.c
drivers/acpi/osl.c
drivers/acpi/processor_idle.c
drivers/ata/ahci.c
drivers/ata/ahci_brcm.c
drivers/ata/libahci_platform.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-scsi.c
drivers/ata/pata_atp867x.c
drivers/ata/pata_serverworks.c
drivers/ata/sata_mv.c
drivers/ata/sata_promise.c
drivers/ata/sata_sx4.c
drivers/atm/eni.c
drivers/atm/firestream.c
drivers/atm/fore200e.c
drivers/atm/he.c
drivers/atm/idt77105.c
drivers/atm/lanai.c
drivers/atm/zatm.c
drivers/auxdisplay/arm-charlcd.c
drivers/auxdisplay/panel.c
drivers/base/core.c
drivers/base/firmware_loader/fallback.c
drivers/base/firmware_loader/firmware.h
drivers/base/firmware_loader/main.c
drivers/base/node.c
drivers/base/power/main.c
drivers/base/regmap/internal.h
drivers/base/regmap/regcache.c
drivers/base/regmap/regmap-debugfs.c
drivers/base/regmap/regmap.c
drivers/block/aoe/aoecmd.c
drivers/block/ataflop.c
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_main.c
drivers/block/drbd/drbd_nl.c
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_req.c
drivers/block/floppy.c
drivers/block/loop.c
drivers/block/nbd.c
drivers/block/null_blk_main.c
drivers/block/paride/pd.c
drivers/block/pktcdvd.c
drivers/block/rbd.c
drivers/block/rnbd/rnbd-srv.c
drivers/block/rsxx/core.c
drivers/block/skd_main.c
drivers/block/virtio_blk.c
drivers/block/xen-blkback/blkback.c
drivers/block/xen-blkback/xenbus.c
drivers/block/xen-blkfront.c
drivers/bus/ti-sysc.c
drivers/char/agp/ali-agp.c
drivers/char/hw_random/ingenic-rng.c
drivers/char/ipmi/kcs_bmc.c
drivers/char/lp.c
drivers/char/mem.c
drivers/char/nvram.c
drivers/clk/bcm/Kconfig
drivers/clk/davinci/pll.c
drivers/clk/qcom/lpasscorecc-sc7180.c
drivers/clk/rockchip/clk-rk3228.c
drivers/clk/samsung/clk-exynos4.c
drivers/clk/samsung/clk-exynos5420.c
drivers/clk/socfpga/clk-s10.c
drivers/clk/tegra/clk-pll.c
drivers/clk/tegra/clk-tegra210-emc.c
drivers/clk/versatile/clk-impd1.c
drivers/clocksource/h8300_timer8.c
drivers/clocksource/timer-cadence-ttc.c
drivers/clocksource/timer-clint.c
drivers/clocksource/timer-gx6605s.c
drivers/clocksource/timer-ti-dm-systimer.c
drivers/counter/microchip-tcb-capture.c
drivers/cpufreq/cpufreq.c
drivers/cpufreq/intel_pstate.c
drivers/cpufreq/p4-clockmod.c
drivers/cpufreq/speedstep-lib.c
drivers/cpufreq/tegra194-cpufreq.c
drivers/cpufreq/ti-cpufreq.c
drivers/cpuidle/cpuidle-psci.c
drivers/cpuidle/cpuidle-pseries.c
drivers/cpuidle/cpuidle.c
drivers/crypto/Kconfig
drivers/crypto/axis/artpec6_crypto.c
drivers/crypto/cavium/cpt/cptvf_reqmanager.c
drivers/crypto/chelsio/chcr_ktls.c
drivers/crypto/marvell/octeontx/otx_cptvf_reqmgr.c
drivers/crypto/qat/qat_common/adf_admin.c
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
drivers/crypto/qat/qat_common/qat_uclo.c
drivers/crypto/ux500/cryp/cryp.c
drivers/dax/device.c
drivers/dax/super.c
drivers/devfreq/devfreq.c
drivers/devfreq/tegra30-devfreq.c
drivers/dma-buf/dma-buf.c
drivers/dma-buf/dma-fence-chain.c
drivers/dma/acpi-dma.c
drivers/dma/amba-pl08x.c
drivers/dma/at_hdmac.c
drivers/dma/dma-jz4780.c
drivers/dma/dmatest.c
drivers/dma/dw-edma/dw-edma-core.c
drivers/dma/fsldma.c
drivers/dma/fsldma.h
drivers/dma/idxd/device.c
drivers/dma/idxd/irq.c
drivers/dma/imx-dma.c
drivers/dma/iop-adma.h
drivers/dma/nbpfaxi.c
drivers/dma/of-dma.c
drivers/dma/pl330.c
drivers/dma/sh/shdma-base.c
drivers/dma/ti/k3-udma.c
drivers/edac/amd64_edac.c
drivers/edac/ghes_edac.c
drivers/edac/pnd2_edac.c
drivers/firewire/core-device.c
drivers/firewire/core-iso.c
drivers/firewire/core-topology.c
drivers/firewire/core-transaction.c
drivers/firewire/ohci.c
drivers/firmware/efi/efibc.c
drivers/firmware/efi/embedded-firmware.c
drivers/firmware/ti_sci.c
drivers/gpio/gpio-aspeed-sgpio.c
drivers/gpio/gpio-aspeed.c
drivers/gpio/gpio-ath79.c
drivers/gpio/gpio-eic-sprd.c
drivers/gpio/gpio-stmpe.c
drivers/gpio/gpiolib-acpi.c
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10_3.c
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
drivers/gpu/drm/amd/amdgpu/nv.c
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
drivers/gpu/drm/amd/amdgpu/si_dpm.c
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
drivers/gpu/drm/amd/display/dc/dc_stream.h
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
drivers/gpu/drm/amd/display/dc/dcn30/Makefile
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.h
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_3_0_default.h
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_3_0_offset.h
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_3_0_sh_mask.h
drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_3_0_0_sh_mask.h
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c
drivers/gpu/drm/amd/powerplay/navi10_ppt.c
drivers/gpu/drm/amd/powerplay/renoir_ppt.c
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
drivers/gpu/drm/arm/malidp_hw.c
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/bridge/nwl-dsi.c
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
drivers/gpu/drm/bridge/ti-sn65dsi86.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_bufs.c
drivers/gpu/drm/drm_color_mgmt.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_dp_helper.c
drivers/gpu/drm/drm_dp_mst_topology.c
drivers/gpu/drm/drm_mode_object.c
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/drm_plane.c
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
drivers/gpu/drm/etnaviv/etnaviv_sched.c
drivers/gpu/drm/exynos/exynos_drm_dsi.c
drivers/gpu/drm/exynos/exynos_drm_fbdev.c
drivers/gpu/drm/exynos/exynos_drm_gem.h
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
drivers/gpu/drm/i915/display/icl_dsi.c
drivers/gpu/drm/i915/display/intel_bios.c
drivers/gpu/drm/i915/display/intel_cdclk.c
drivers/gpu/drm/i915/display/intel_combo_phy.c
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_dpll_mgr.c
drivers/gpu/drm/i915/display/intel_hdcp.c
drivers/gpu/drm/i915/display/intel_panel.c
drivers/gpu/drm/i915/display/intel_sdvo.c
drivers/gpu/drm/i915/display/intel_sprite.c
drivers/gpu/drm/i915/display/intel_tc.c
drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
drivers/gpu/drm/i915/gem/i915_gem_mman.c
drivers/gpu/drm/i915/gem/i915_gem_object.h
drivers/gpu/drm/i915/gem/i915_gem_pages.c
drivers/gpu/drm/i915/gem/i915_gem_stolen.c
drivers/gpu/drm/i915/gem/i915_gem_userptr.c
drivers/gpu/drm/i915/gem/selftests/i915_gem_execbuffer.c
drivers/gpu/drm/i915/gt/intel_engine_cs.c
drivers/gpu/drm/i915/gt/intel_ggtt.c
drivers/gpu/drm/i915/gt/intel_lrc.c
drivers/gpu/drm/i915/gt/intel_ring_submission.c
drivers/gpu/drm/i915/gvt/handlers.c
drivers/gpu/drm/i915/gvt/vgpu.c
drivers/gpu/drm/i915/i915_cmd_parser.c
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/i915_pmu.c
drivers/gpu/drm/i915/i915_request.c
drivers/gpu/drm/i915/i915_sw_fence.c
drivers/gpu/drm/i915/selftests/mock_gem_device.c
drivers/gpu/drm/imx/ipuv3-plane.c
drivers/gpu/drm/ingenic/ingenic-drm-drv.c
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
drivers/gpu/drm/mediatek/mtk_drm_drv.c
drivers/gpu/drm/mediatek/mtk_dsi.c
drivers/gpu/drm/mediatek/mtk_hdmi.c
drivers/gpu/drm/meson/meson_osd_afbcd.c
drivers/gpu/drm/meson/meson_overlay.c
drivers/gpu/drm/msm/adreno/a2xx_gpu.c
drivers/gpu/drm/msm/adreno/a3xx_gpu.c
drivers/gpu/drm/msm/adreno/a4xx_gpu.c
drivers/gpu/drm/msm/adreno/a5xx_gpu.c
drivers/gpu/drm/msm/adreno/a5xx_gpu.h
drivers/gpu/drm/msm/adreno/a5xx_preempt.c
drivers/gpu/drm/msm/adreno/a6xx_gmu.c
drivers/gpu/drm/msm/adreno/a6xx_gpu.c
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.h
drivers/gpu/drm/msm/adreno/adreno_device.c
drivers/gpu/drm/msm/adreno/adreno_gpu.c
drivers/gpu/drm/msm/adreno/adreno_gpu.h
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
drivers/gpu/drm/msm/msm_atomic.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_gpu.c
drivers/gpu/drm/msm/msm_gpu.h
drivers/gpu/drm/msm/msm_ringbuffer.c
drivers/gpu/drm/nouveau/dispnv50/core507d.c
drivers/gpu/drm/nouveau/dispnv50/crcc37d.c
drivers/gpu/drm/nouveau/dispnv50/disp.c
drivers/gpu/drm/nouveau/include/nvif/push507c.h
drivers/gpu/drm/omapdrm/dss/venc.c
drivers/gpu/drm/omapdrm/omap_crtc.c
drivers/gpu/drm/radeon/ci_dpm.c
drivers/gpu/drm/radeon/r300.c
drivers/gpu/drm/radeon/r420.c
drivers/gpu/drm/radeon/r600_cs.c
drivers/gpu/drm/radeon/radeon_uvd.c
drivers/gpu/drm/radeon/si_dpm.c
drivers/gpu/drm/radeon/uvd_v1_0.c
drivers/gpu/drm/savage/savage_state.c
drivers/gpu/drm/sti/sti_hdmi.c
drivers/gpu/drm/sun4i/sun4i_backend.c
drivers/gpu/drm/sun4i/sun4i_tcon.c
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
drivers/gpu/drm/sun4i/sun8i_csc.h
drivers/gpu/drm/sun4i/sun8i_mixer.c
drivers/gpu/drm/sun4i/sun8i_vi_layer.c
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tilcdc/tilcdc_crtc.c
drivers/gpu/drm/ttm/ttm_bo_vm.c
drivers/gpu/drm/tve200/tve200_display.c
drivers/gpu/drm/vc4/vc4_hdmi.c
drivers/gpu/drm/via/via_dmablit.c
drivers/gpu/drm/virtio/virtgpu_display.c
drivers/gpu/drm/virtio/virtgpu_drv.h
drivers/gpu/drm/virtio/virtgpu_object.c
drivers/gpu/drm/virtio/virtgpu_plane.c
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
drivers/gpu/drm/xen/xen_drm_front.c
drivers/gpu/drm/xen/xen_drm_front_gem.c
drivers/gpu/drm/xlnx/Kconfig
drivers/gpu/ipu-v3/ipu-dc.c
drivers/hid/hid-core.c
drivers/hid/hid-cougar.c
drivers/hid/hid-elan.c
drivers/hid/hid-ids.h
drivers/hid/hid-input.c
drivers/hid/hid-lg-g15.c
drivers/hid/hid-logitech-dj.c
drivers/hid/hid-macally.c
drivers/hid/hid-microsoft.c
drivers/hid/hid-multitouch.c
drivers/hid/hid-quirks.c
drivers/hid/hid-rmi.c
drivers/hid/hid-roccat-kone.c
drivers/hid/hid-uclogic-params.c
drivers/hid/hid-wiimote-core.c
drivers/hid/i2c-hid/i2c-hid-core.c
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/hiddev.c
drivers/hid/usbhid/usbhid.h
drivers/hid/wacom_wac.c
drivers/hsi/clients/ssi_protocol.c
drivers/hsi/controllers/omap_ssi_core.c
drivers/hv/channel_mgmt.c
drivers/hv/hv_kvp.c
drivers/hv/hv_util.c
drivers/hv/vmbus_drv.c
drivers/hwmon/adt7462.c
drivers/hwmon/applesmc.c
drivers/hwmon/emc1403.c
drivers/hwmon/f71882fg.c
drivers/hwmon/gsc-hwmon.c
drivers/hwmon/hwmon-vid.c
drivers/hwmon/ina3221.c
drivers/hwmon/nct6775.c
drivers/hwmon/nct7904.c
drivers/hwmon/occ/common.c
drivers/hwmon/pmbus/isl68137.c
drivers/hwmon/w83627hf.c
drivers/hwmon/w83781d.c
drivers/hwmon/w83795.c
drivers/hwtracing/coresight/coresight-cpu-debug.c
drivers/hwtracing/coresight/coresight-etm4x.c
drivers/hwtracing/coresight/coresight-tmc.c
drivers/hwtracing/intel_th/sth.c
drivers/i2c/algos/i2c-algo-pca.c
drivers/i2c/busses/i2c-aspeed.c
drivers/i2c/busses/i2c-bcm-iproc.c
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-mt65xx.c
drivers/i2c/busses/i2c-mxs.c
drivers/i2c/busses/i2c-npcm7xx.c
drivers/i2c/busses/i2c-omap.c
drivers/i2c/busses/i2c-opal.c
drivers/i2c/busses/i2c-rcar.c
drivers/i2c/i2c-core-acpi.c
drivers/i2c/i2c-core-base.c
drivers/i2c/i2c-core.h
drivers/i3c/master/dw-i3c-master.c
drivers/ide/hpt366.c
drivers/ide/ide-cd.c
drivers/ide/ide-floppy.c
drivers/ide/ide-probe.c
drivers/ide/ide-taskfile.c
drivers/ide/sis5513.c
drivers/idle/intel_idle.c
drivers/iio/accel/bmc150-accel-core.c
drivers/iio/accel/kxsd9.c
drivers/iio/accel/mma7455_core.c
drivers/iio/accel/mma8452.c
drivers/iio/adc/Kconfig
drivers/iio/adc/ab8500-gpadc.c
drivers/iio/adc/cpcap-adc.c
drivers/iio/adc/ina2xx-adc.c
drivers/iio/adc/max1118.c
drivers/iio/adc/mcp3422.c
drivers/iio/adc/meson_saradc.c
drivers/iio/adc/ti-adc081c.c
drivers/iio/adc/ti-adc084s021.c
drivers/iio/adc/ti-ads1015.c
drivers/iio/chemical/ccs811.c
drivers/iio/chemical/sps30.c
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
drivers/iio/dac/ad5592r-base.c
drivers/iio/dac/dpot-dac.c
drivers/iio/health/max30102.c
drivers/iio/imu/adis.c
drivers/iio/industrialio-core.c
drivers/iio/light/ltr501.c
drivers/iio/light/max44000.c
drivers/iio/light/si1145.c
drivers/iio/magnetometer/ak8974.c
drivers/iio/magnetometer/ak8975.c
drivers/iio/proximity/mb1232.c
drivers/infiniband/core/cm.c
drivers/infiniband/core/cma.c
drivers/infiniband/core/cq.c
drivers/infiniband/core/device.c
drivers/infiniband/core/rw.c
drivers/infiniband/core/ucma.c
drivers/infiniband/core/uverbs_ioctl.c
drivers/infiniband/core/verbs.c
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/main.c
drivers/infiniband/hw/bnxt_re/qplib_fp.c
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h
drivers/infiniband/hw/bnxt_re/qplib_sp.c
drivers/infiniband/hw/bnxt_re/qplib_sp.h
drivers/infiniband/hw/cxgb4/cm.c
drivers/infiniband/hw/cxgb4/qp.c
drivers/infiniband/hw/hfi1/pio_copy.c
drivers/infiniband/hw/i40iw/i40iw_cm.c
drivers/infiniband/hw/i40iw/i40iw_ctrl.c
drivers/infiniband/hw/i40iw/i40iw_hw.c
drivers/infiniband/hw/i40iw/i40iw_main.c
drivers/infiniband/hw/i40iw/i40iw_puda.c
drivers/infiniband/hw/i40iw/i40iw_utils.c
drivers/infiniband/hw/i40iw/i40iw_verbs.c
drivers/infiniband/hw/mlx4/cq.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx4/mcg.c
drivers/infiniband/hw/mlx4/qp.c
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/mad.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/qp.c
drivers/infiniband/hw/mthca/mthca_av.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
drivers/infiniband/hw/qedr/verbs.c
drivers/infiniband/hw/qib/qib_iba6120.c
drivers/infiniband/hw/qib/qib_iba7220.c
drivers/infiniband/hw/qib/qib_iba7322.c
drivers/infiniband/hw/qib/qib_mad.c
drivers/infiniband/hw/qib/qib_rc.c
drivers/infiniband/hw/qib/qib_sdma.c
drivers/infiniband/hw/qib/qib_uc.c
drivers/infiniband/hw/qib/qib_verbs.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
drivers/infiniband/sw/rdmavt/qp.c
drivers/infiniband/sw/rxe/rxe.c
drivers/infiniband/sw/rxe/rxe.h
drivers/infiniband/sw/rxe/rxe_comp.c
drivers/infiniband/sw/rxe/rxe_mr.c
drivers/infiniband/sw/rxe/rxe_sysfs.c
drivers/infiniband/sw/rxe/rxe_task.c
drivers/infiniband/sw/rxe/rxe_verbs.c
drivers/infiniband/sw/siw/siw_cm.c
drivers/infiniband/sw/siw/siw_qp_rx.c
drivers/infiniband/sw/siw/siw_qp_tx.c
drivers/infiniband/ulp/ipoib/ipoib_cm.c
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/iser/iser_verbs.c
drivers/infiniband/ulp/isert/ib_isert.c
drivers/infiniband/ulp/isert/ib_isert.h
drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
drivers/infiniband/ulp/rtrs/rtrs-srv.c
drivers/input/joystick/fsia6b.c
drivers/input/joystick/gamecon.c
drivers/input/mouse/trackpoint.c
drivers/input/mouse/trackpoint.h
drivers/input/serio/i8042-x86ia64io.h
drivers/input/tablet/wacom_serial4.c
drivers/input/touchscreen/atmel_mxt_ts.c
drivers/input/touchscreen/wm831x-ts.c
drivers/interconnect/core.c
drivers/interconnect/qcom/bcm-voter.c
drivers/iommu/amd/Kconfig
drivers/iommu/amd/init.c
drivers/iommu/amd/iommu.c
drivers/iommu/amd/iommu_v2.c
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
drivers/iommu/exynos-iommu.c
drivers/iommu/intel/iommu.c
drivers/iommu/intel/irq_remapping.c
drivers/iommu/virtio-iommu.c
drivers/irqchip/Kconfig
drivers/irqchip/irq-gic-v3-its.c
drivers/irqchip/irq-gic-v3.c
drivers/irqchip/irq-imx-gpcv2.c
drivers/irqchip/irq-ingenic.c
drivers/irqchip/irq-mips-gic.c
drivers/irqchip/irq-mtk-cirq.c
drivers/irqchip/irq-mtk-sysirq.c
drivers/irqchip/irq-stm32-exti.c
drivers/irqchip/irq-ti-sci-inta.c
drivers/irqchip/irq-ti-sci-intr.c
drivers/irqchip/irq-vic.c
drivers/irqchip/irqchip.c
drivers/irqchip/qcom-pdc.c
drivers/isdn/hardware/mISDN/avmfritz.c
drivers/isdn/hardware/mISDN/hfc_multi_8xx.h
drivers/isdn/hardware/mISDN/hfcpci.c
drivers/isdn/hardware/mISDN/hfcsusb.c
drivers/isdn/hardware/mISDN/isdnhdlc.c
drivers/isdn/hardware/mISDN/mISDNinfineon.c
drivers/isdn/hardware/mISDN/mISDNisar.c
drivers/isdn/mISDN/stack.c
drivers/lightnvm/pblk-core.c
drivers/macintosh/adbhid.c
drivers/macintosh/smu.c
drivers/md/bcache/journal.c
drivers/md/bcache/util.c
drivers/md/dm-cache-metadata.c
drivers/md/dm-crypt.c
drivers/md/dm-integrity.c
drivers/md/dm-mpath.c
drivers/md/dm-table.c
drivers/md/dm-thin-metadata.c
drivers/md/dm-writecache.c
drivers/md/dm.c
drivers/md/md-autodetect.c
drivers/md/md-bitmap.c
drivers/md/persistent-data/dm-block-manager.c
drivers/md/raid5.c
drivers/media/cec/core/cec-adap.c
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
drivers/media/common/videobuf2/videobuf2-core.c
drivers/media/common/videobuf2/videobuf2-dma-contig.c
drivers/media/common/videobuf2/videobuf2-dma-sg.c
drivers/media/common/videobuf2/videobuf2-v4l2.c
drivers/media/dvb-core/dvb_net.c
drivers/media/dvb-core/dvb_vb2.c
drivers/media/dvb-frontends/bcm3510.c
drivers/media/dvb-frontends/dib0090.c
drivers/media/dvb-frontends/dib3000mb.c
drivers/media/dvb-frontends/dib7000p.c
drivers/media/dvb-frontends/drx39xyj/drxj.c
drivers/media/dvb-frontends/drxd_hard.c
drivers/media/dvb-frontends/drxk_hard.c
drivers/media/dvb-frontends/lgdt3306a.c
drivers/media/dvb-frontends/mt352.c
drivers/media/dvb-frontends/mxl5xx.c
drivers/media/dvb-frontends/or51132.c
drivers/media/dvb-frontends/s5h1411.c
drivers/media/dvb-frontends/zl10353.c
drivers/media/i2c/Kconfig
drivers/media/pci/cx23885/cx23885-cards.c
drivers/media/pci/ddbridge/ddbridge-core.c
drivers/media/pci/meye/meye.c
drivers/media/pci/ttpci/av7110.c
drivers/media/pci/ttpci/av7110_hw.c
drivers/media/pci/ttpci/av7110_ipack.c
drivers/media/pci/ttpci/budget-av.c
drivers/media/pci/ttpci/budget.c
drivers/media/platform/sh_vou.c
drivers/media/platform/ti-vpe/cal.h
drivers/media/radio/radio-si476x.c
drivers/media/radio/tea575x.c
drivers/media/rc/bpf-lirc.c
drivers/media/rc/gpio-ir-tx.c
drivers/media/rc/ir-rc6-decoder.c
drivers/media/rc/ir-sony-decoder.c
drivers/media/rc/mceusb.c
drivers/media/rc/rc-main.c
drivers/media/test-drivers/vicodec/vicodec-core.c
drivers/media/tuners/xc5000.c
drivers/media/usb/b2c2/flexcop-usb.c
drivers/media/usb/cpia2/cpia2_core.c
drivers/media/usb/cx231xx/cx231xx-video.c
drivers/media/usb/dvb-usb/dib0700_devices.c
drivers/media/usb/dvb-usb/dw2102.c
drivers/media/v4l2-core/v4l2-compat-ioctl32.c
drivers/media/v4l2-core/v4l2-ctrls.c
drivers/media/v4l2-core/v4l2-ioctl.c
drivers/media/v4l2-core/videobuf-core.c
drivers/memory/omap-gpmc.c
drivers/memstick/core/memstick.c
drivers/memstick/core/ms_block.c
drivers/memstick/host/jmb38x_ms.c
drivers/memstick/host/tifm_ms.c
drivers/message/fusion/mptbase.c
drivers/message/fusion/mptsas.c
drivers/message/fusion/mptscsih.c
drivers/mfd/db8500-prcmu.c
drivers/mfd/iqs62x.c
drivers/mfd/mfd-core.c
drivers/mfd/mxs-lradc.c
drivers/mfd/omap-usb-host.c
drivers/mfd/rave-sp.c
drivers/mfd/syscon.c
drivers/misc/eeprom/at24.c
drivers/misc/eeprom/at25.c
drivers/misc/habanalabs/common/command_buffer.c
drivers/misc/habanalabs/common/command_submission.c
drivers/misc/habanalabs/common/debugfs.c
drivers/misc/habanalabs/common/device.c
drivers/misc/habanalabs/common/firmware_if.c
drivers/misc/habanalabs/common/habanalabs.h
drivers/misc/habanalabs/common/memory.c
drivers/misc/habanalabs/common/mmu.c
drivers/misc/habanalabs/common/pci.c
drivers/misc/habanalabs/common/sysfs.c
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/gaudi/gaudiP.h
drivers/misc/habanalabs/gaudi/gaudi_coresight.c
drivers/misc/habanalabs/goya/goya.c
drivers/misc/habanalabs/goya/goya_coresight.c
drivers/misc/habanalabs/include/gaudi/gaudi_masks.h
drivers/misc/mei/hdcp/mei_hdcp.c
drivers/misc/mic/scif/scif_api.c
drivers/misc/mic/scif/scif_rma.c
drivers/misc/sgi-gru/grukservices.c
drivers/misc/sgi-xp/xpc_main.c
drivers/misc/sgi-xp/xpc_partition.c
drivers/misc/sgi-xp/xpc_uv.c
drivers/mmc/core/host.c
drivers/mmc/core/sdio_ops.c
drivers/mmc/host/Kconfig
drivers/mmc/host/atmel-mci.c
drivers/mmc/host/davinci_mmc.c
drivers/mmc/host/dw_mmc-k3.c
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/jz4740_mmc.c
drivers/mmc/host/meson-mx-sdio.c
drivers/mmc/host/mmc_spi.c
drivers/mmc/host/mtk-sd.c
drivers/mmc/host/renesas_sdhi_core.c
drivers/mmc/host/sdhci-acpi.c
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/sdhci-msm.c
drivers/mmc/host/sdhci-of-esdhc.c
drivers/mmc/host/sdhci-pci-core.c
drivers/mmc/host/sdhci-s3c.c
drivers/mmc/host/sdhci-sprd.c
drivers/mmc/host/sdhci-tegra.c
drivers/mmc/host/sdhci-xenon-phy.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/tifm_sd.c
drivers/mmc/host/usdhi6rol0.c
drivers/mtd/spi-nor/core.c
drivers/mtd/spi-nor/core.h
drivers/mux/adgs1408.c
drivers/net/appletalk/cops.c
drivers/net/arcnet/arc-rimi.c
drivers/net/arcnet/com20020-isa.c
drivers/net/arcnet/com90io.c
drivers/net/arcnet/com90xx.c
drivers/net/bonding/bond_3ad.c
drivers/net/bonding/bond_main.c
drivers/net/can/at91_can.c
drivers/net/can/peak_canfd/peak_pciefd_main.c
drivers/net/can/sja1000/sja1000_platform.c
drivers/net/can/slcan.c
drivers/net/can/spi/mcp251x.c
drivers/net/can/usb/peak_usb/pcan_usb.c
drivers/net/can/usb/peak_usb/pcan_usb_core.c
drivers/net/can/usb/peak_usb/pcan_usb_pro.c
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/b53/b53_serdes.c
drivers/net/dsa/bcm_sf2.c
drivers/net/dsa/microchip/ksz8795.c
drivers/net/dsa/microchip/ksz9477.c
drivers/net/dsa/microchip/ksz_common.c
drivers/net/dsa/microchip/ksz_common.h
drivers/net/dsa/mt7530.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/ocelot/felix.c
drivers/net/dsa/ocelot/felix_vsc9959.c
drivers/net/dsa/ocelot/seville_vsc9953.c
drivers/net/dsa/rtl8366.c
drivers/net/dsa/sja1105/sja1105_main.c
drivers/net/ethernet/3com/3c509.c
drivers/net/ethernet/3com/3c574_cs.c
drivers/net/ethernet/8390/axnet_cs.c
drivers/net/ethernet/8390/pcnet_cs.c
drivers/net/ethernet/alacritech/slicoss.c
drivers/net/ethernet/alteon/acenic.c
drivers/net/ethernet/amd/amd8111e.c
drivers/net/ethernet/amd/xgbe/xgbe-drv.c
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
drivers/net/ethernet/arc/emac_mdio.c
drivers/net/ethernet/broadcom/bcmsysport.c
drivers/net/ethernet/broadcom/bgmac-bcma.c
drivers/net/ethernet/broadcom/bgmac-platform.c
drivers/net/ethernet/broadcom/bnx2.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
drivers/net/ethernet/broadcom/cnic.c
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/broadcom/genet/bcmmii.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/brocade/bna/bfa_ioc.c
drivers/net/ethernet/brocade/bna/bna_enet.c
drivers/net/ethernet/brocade/bna/bna_tx_rx.c
drivers/net/ethernet/cadence/macb_main.c
drivers/net/ethernet/cadence/macb_ptp.c
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
drivers/net/ethernet/cavium/thunder/nicvf_main.c
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
drivers/net/ethernet/chelsio/cxgb3/l2t.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
drivers/net/ethernet/chelsio/cxgb4/l2t.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
drivers/net/ethernet/cisco/enic/enic_main.c
drivers/net/ethernet/cortina/gemini.c
drivers/net/ethernet/davicom/dm9000.c
drivers/net/ethernet/dec/tulip/de2104x.c
drivers/net/ethernet/dec/tulip/de4x5.c
drivers/net/ethernet/dec/tulip/tulip_core.c
drivers/net/ethernet/dec/tulip/winbond-840.c
drivers/net/ethernet/emulex/benet/be_ethtool.c
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h
drivers/net/ethernet/freescale/enetc/enetc_pf.c
drivers/net/ethernet/freescale/fman/fman_memac.c
drivers/net/ethernet/freescale/fman/fman_port.c
drivers/net/ethernet/freescale/ucc_geth.c
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
drivers/net/ethernet/hisilicon/hns/hns_enet.c
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.c
drivers/net/ethernet/huawei/hinic/hinic_main.c
drivers/net/ethernet/huawei/hinic/hinic_rx.c
drivers/net/ethernet/huawei/hinic/hinic_tx.c
drivers/net/ethernet/ibm/ehea/ehea_main.c
drivers/net/ethernet/ibm/emac/core.c
drivers/net/ethernet/ibm/ibmvnic.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/igc/igc.h
drivers/net/ethernet/intel/igc/igc_ptp.c
drivers/net/ethernet/lantiq_xrx200.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
drivers/net/ethernet/marvell/skge.c
drivers/net/ethernet/marvell/sky2.c
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/mellanox/mlx4/mr.c
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en/monitor_stats.c
drivers/net/ethernet/mellanox/mlx5/core/en/port.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_stats.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c
drivers/net/ethernet/mellanox/mlxsw/core.c
drivers/net/ethernet/mellanox/mlxsw/core_env.c
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
drivers/net/ethernet/microchip/lan743x_ethtool.c
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/mscc/ocelot_net.c
drivers/net/ethernet/mscc/ocelot_vsc7514.c
drivers/net/ethernet/natsemi/natsemi.c
drivers/net/ethernet/neterion/vxge/vxge-config.c
drivers/net/ethernet/netronome/nfp/crypto/tls.c
drivers/net/ethernet/netronome/nfp/flower/action.c
drivers/net/ethernet/netronome/nfp/flower/cmsg.c
drivers/net/ethernet/netronome/nfp/flower/offload.c
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
drivers/net/ethernet/netronome/nfp/nfp_asm.c
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_rtsym.c
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c
drivers/net/ethernet/packetengines/yellowfin.c
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
drivers/net/ethernet/qlogic/qed/qed_cxt.c
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_l2.c
drivers/net/ethernet/qlogic/qed/qed_main.c
drivers/net/ethernet/qlogic/qed/qed_mcp.c
drivers/net/ethernet/qlogic/qed/qed_sriov.c
drivers/net/ethernet/qlogic/qede/qede_filter.c
drivers/net/ethernet/qlogic/qede/qede_main.c
drivers/net/ethernet/qlogic/qla3xxx.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
drivers/net/ethernet/realtek/r8169_main.c
drivers/net/ethernet/renesas/ravb_main.c
drivers/net/ethernet/rocker/rocker_main.c
drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
drivers/net/ethernet/sfc/ef100.c
drivers/net/ethernet/sfc/ef100_rx.c
drivers/net/ethernet/sfc/falcon/ethtool.c
drivers/net/ethernet/sfc/falcon/farch.c
drivers/net/ethernet/sfc/farch.c
drivers/net/ethernet/sfc/mcdi_filters.c
drivers/net/ethernet/sfc/mcdi_port_common.c
drivers/net/ethernet/sfc/rx.c
drivers/net/ethernet/sis/sis900.c
drivers/net/ethernet/smsc/smc911x.c
drivers/net/ethernet/socionext/netsec.c
drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
drivers/net/ethernet/sun/cassini.c
drivers/net/ethernet/sun/niu.c
drivers/net/ethernet/sun/sungem.c
drivers/net/ethernet/ti/am65-cpsw-nuss.c
drivers/net/ethernet/ti/cpsw-phy-sel.c
drivers/net/ethernet/ti/cpsw.c
drivers/net/ethernet/ti/cpsw_new.c
drivers/net/ethernet/ti/cpsw_priv.c
drivers/net/ethernet/ti/tlan.c
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
drivers/net/ethernet/toshiba/spider_net.c
drivers/net/ethernet/xircom/xirc2ps_cs.c
drivers/net/fddi/skfp/pcmplc.c
drivers/net/fjes/fjes_main.c
drivers/net/geneve.c
drivers/net/gtp.c
drivers/net/hamradio/baycom_epp.c
drivers/net/hamradio/mkiss.c
drivers/net/hyperv/hyperv_net.h
drivers/net/hyperv/netvsc.c
drivers/net/hyperv/netvsc_drv.c
drivers/net/hyperv/rndis_filter.c
drivers/net/ieee802154/adf7242.c
drivers/net/ieee802154/ca8210.c
drivers/net/ipa/ipa_table.c
drivers/net/macvlan.c
drivers/net/mii.c
drivers/net/netdevsim/bus.c
drivers/net/netdevsim/fib.c
drivers/net/phy/adin.c
drivers/net/phy/dp83640.c
drivers/net/phy/dp83867.c
drivers/net/phy/dp83869.c
drivers/net/phy/fixed_phy.c
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
drivers/net/phy/phylink.c
drivers/net/phy/sfp-bus.c
drivers/net/phy/sfp.c
drivers/net/plip/plip.c
drivers/net/tun.c
drivers/net/usb/Kconfig
drivers/net/usb/aqc111.c
drivers/net/usb/asix_common.c
drivers/net/usb/catc.c
drivers/net/usb/cdc-phonet.c
drivers/net/usb/dm9601.c
drivers/net/usb/lan78xx.c
drivers/net/usb/pegasus.c
drivers/net/usb/r8152.c
drivers/net/usb/rndis_host.c
drivers/net/usb/rtl8150.c
drivers/net/usb/usbnet.c
drivers/net/veth.c
drivers/net/virtio_net.c
drivers/net/vmxnet3/vmxnet3_ethtool.c
drivers/net/wan/hdlc.c
drivers/net/wan/hdlc_cisco.c
drivers/net/wan/hdlc_fr.c
drivers/net/wan/hdlc_ppp.c
drivers/net/wan/lapbether.c
drivers/net/wan/sdla.c
drivers/net/wan/x25_asy.c
drivers/net/wimax/i2400m/control.c
drivers/net/wimax/i2400m/usb-fw.c
drivers/net/wimax/i2400m/usb-tx.c
drivers/net/wimax/i2400m/usb.c
drivers/net/wireguard/noise.c
drivers/net/wireguard/peerlookup.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
drivers/net/wireless/marvell/mwifiex/fw.h
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
drivers/net/wireless/mediatek/mt76/mt7915/init.c
drivers/net/wireless/mediatek/mt76/mt7915/mac.c
drivers/net/wireless/ti/wlcore/cmd.h
drivers/net/wireless/ti/wlcore/main.c
drivers/net/xen-netback/hash.c
drivers/net/xen-netback/xenbus.c
drivers/net/xen-netfront.c
drivers/nfc/pn533/pn533.c
drivers/nfc/st21nfca/dep.c
drivers/nfc/st95hf/core.c
drivers/nfc/trf7970a.c
drivers/ntb/ntb_transport.c
drivers/nvdimm/dimm_devs.c
drivers/nvme/host/Kconfig
drivers/nvme/host/core.c
drivers/nvme/host/fabrics.c
drivers/nvme/host/fc.c
drivers/nvme/host/hwmon.c
drivers/nvme/host/multipath.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/nvme/host/rdma.c
drivers/nvme/host/tcp.c
drivers/nvme/target/configfs.c
drivers/nvme/target/core.c
drivers/nvme/target/fc.c
drivers/nvme/target/fcloop.c
drivers/nvme/target/io-cmd-bdev.c
drivers/nvme/target/loop.c
drivers/nvme/target/passthru.c
drivers/nvme/target/rdma.c
drivers/nvme/target/tcp.c
drivers/opp/core.c
drivers/opp/opp.h
drivers/parport/ieee1284.c
drivers/parport/parport_pc.c
drivers/pci/controller/dwc/pci-imx6.c
drivers/pci/controller/pci-rcar-gen2.c
drivers/pci/hotplug/ibmphp_res.c
drivers/pci/hotplug/pciehp_ctrl.c
drivers/pci/hotplug/shpchp_ctrl.c
drivers/pci/pci.c
drivers/pci/proc.c
drivers/pci/quirks.c
drivers/pci/setup-bus.c
drivers/pci/xen-pcifront.c
drivers/pcmcia/db1xxx_ss.c
drivers/perf/arm-ccn.c
drivers/perf/arm_spe_pmu.c
drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c
drivers/phy/qualcomm/phy-qcom-qmp.c
drivers/phy/qualcomm/phy-qcom-qmp.h
drivers/phy/qualcomm/phy-qcom-usb-hs.c
drivers/phy/rockchip/phy-rockchip-inno-usb2.c
drivers/phy/ti/phy-omap-usb2.c
drivers/platform/olpc/olpc-xo175-ec.c
drivers/platform/x86/acer-wmi.c
drivers/platform/x86/dell-laptop.c
drivers/platform/x86/surfacepro3_button.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/toshiba_acpi.c
drivers/power/supply/ab8500_charger.c
drivers/power/supply/ab8500_fg.c
drivers/power/supply/abx500_chargalg.c
drivers/power/supply/axp20x_usb_power.c
drivers/power/supply/cros_usbpd-charger.c
drivers/power/supply/max8925_power.c
drivers/power/supply/wm831x_power.c
drivers/power/supply/wm8350_power.c
drivers/powercap/intel_rapl_common.c
drivers/ps3/ps3av.c
drivers/ps3/ps3av_cmd.c
drivers/rapidio/Kconfig
drivers/rapidio/devices/rio_mport_cdev.c
drivers/regulator/axp20x-regulator.c
drivers/regulator/core.c
drivers/regulator/cros-ec-regulator.c
drivers/regulator/fixed.c
drivers/regulator/pwm-regulator.c
drivers/regulator/slg51000-regulator.c
drivers/regulator/twl6030-regulator.c
drivers/remoteproc/omap_remoteproc.c
drivers/reset/reset-imx7.c
drivers/rpmsg/qcom_glink_native.c
drivers/rtc/rtc-m41t80.c
drivers/rtc/rtc-pcf85063.c
drivers/rtc/rtc-pcf8523.c
drivers/rtc/rtc-stmp3xxx.c
drivers/s390/block/dasd_fba.c
drivers/s390/crypto/zcrypt_api.c
drivers/s390/crypto/zcrypt_ccamisc.c
drivers/s390/net/ctcm_fsms.c
drivers/s390/net/ctcm_mpc.c
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_ethtool.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c
drivers/scsi/53c700.c
drivers/scsi/BusLogic.c
drivers/scsi/FlashPoint.c
drivers/scsi/NCR5380.c
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/commsup.c
drivers/scsi/aacraid/linit.c
drivers/scsi/aic7xxx/aic79xx_core.c
drivers/scsi/aic7xxx/aic79xx_osm.c
drivers/scsi/aic7xxx/aic7xxx_core.c
drivers/scsi/aic94xx/aic94xx_scb.c
drivers/scsi/aic94xx/aic94xx_tmf.c
drivers/scsi/arcmsr/arcmsr_hba.c
drivers/scsi/arm/fas216.c
drivers/scsi/be2iscsi/be_iscsi.c
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/bfa/bfa_fcpim.c
drivers/scsi/bfa/bfa_fcs_lport.c
drivers/scsi/bfa/bfa_fcs_rport.c
drivers/scsi/bfa/bfa_ioc.c
drivers/scsi/bfa/bfa_svc.c
drivers/scsi/bnx2fc/bnx2fc_hwi.c
drivers/scsi/csiostor/csio_hw.c
drivers/scsi/csiostor/csio_lnode.c
drivers/scsi/csiostor/csio_wr.c
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
drivers/scsi/cxgbi/libcxgbi.c
drivers/scsi/cxlflash/main.c
drivers/scsi/cxlflash/superpipe.c
drivers/scsi/device_handler/scsi_dh_hp_sw.c
drivers/scsi/esas2r/esas2r_flash.c
drivers/scsi/esas2r/esas2r_init.c
drivers/scsi/esp_scsi.c
drivers/scsi/fcoe/fcoe_ctlr.c
drivers/scsi/g_NCR5380.c
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hpsa.c
drivers/scsi/ibmvscsi/ibmvfc.c
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
drivers/scsi/imm.c
drivers/scsi/isci/phy.c
drivers/scsi/isci/remote_device.c
drivers/scsi/isci/remote_node_context.c
drivers/scsi/isci/request.c
drivers/scsi/libfc/fc_disc.c
drivers/scsi/libfc/fc_exch.c
drivers/scsi/libfc/fc_fcp.c
drivers/scsi/libfc/fc_lport.c
drivers/scsi/libfc/fc_rport.c
drivers/scsi/libiscsi.c
drivers/scsi/libiscsi_tcp.c
drivers/scsi/libsas/sas_ata.c
drivers/scsi/libsas/sas_discover.c
drivers/scsi/libsas/sas_expander.c
drivers/scsi/libsas/sas_scsi_host.c
drivers/scsi/lpfc/lpfc_ct.c
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/lpfc/lpfc_hw4.h
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_nportdisc.c
drivers/scsi/lpfc/lpfc_nvme.c
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/lpfc/lpfc_version.h
drivers/scsi/megaraid.c
drivers/scsi/megaraid/megaraid_mbox.c
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/megaraid/megaraid_sas_fusion.c
drivers/scsi/mesh.c
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/mpt3sas/mpt3sas_ctl.c
drivers/scsi/mpt3sas/mpt3sas_scsih.c
drivers/scsi/myrb.c
drivers/scsi/ncr53c8xx.c
drivers/scsi/pcmcia/nsp_cs.c
drivers/scsi/pm8001/pm8001_sas.c
drivers/scsi/ppa.c
drivers/scsi/qedf/qedf_main.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_gs.c
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_iocb.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_sup.c
drivers/scsi/qla2xxx/qla_target.c
drivers/scsi/qla4xxx/ql4_os.c
drivers/scsi/qlogicpti.c
drivers/scsi/scsi_debug.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/scsi_lib.c
drivers/scsi/sd.c
drivers/scsi/sd.h
drivers/scsi/sd_zbc.c
drivers/scsi/smartpqi/smartpqi_init.c
drivers/scsi/sr.c
drivers/scsi/st.c
drivers/scsi/sun3_scsi.c
drivers/scsi/sym53c8xx_2/sym_fw.c
drivers/scsi/sym53c8xx_2/sym_hipd.c
drivers/scsi/sym53c8xx_2/sym_nvram.c
drivers/scsi/ufs/ufs_bsg.c
drivers/scsi/ufs/ufshcd.c
drivers/scsi/virtio_scsi.c
drivers/scsi/vmw_pvscsi.c
drivers/scsi/wd33c93.c
drivers/scsi/xen-scsifront.c
drivers/soc/qcom/socinfo.c
drivers/soc/tegra/pmc.c
drivers/soundwire/bus.c
drivers/soundwire/stream.c
drivers/spi/spi-bcm-qspi.c
drivers/spi/spi-bcm2835.c
drivers/spi/spi-bcm2835aux.c
drivers/spi/spi-cadence-quadspi.c
drivers/spi/spi-fsl-cpm.c
drivers/spi/spi-fsl-dspi.c
drivers/spi/spi-fsl-espi.c
drivers/spi/spi-loopback-test.c
drivers/spi/spi-sprd-adi.c
drivers/spi/spi-stm32.c
drivers/spi/spi.c
drivers/ssb/driver_chipcommon.c
drivers/ssb/driver_mipscore.c
drivers/ssb/scan.c
drivers/staging/greybus/audio_helper.c
drivers/staging/greybus/audio_topology.c
drivers/staging/media/atomisp/pci/atomisp_cmd.c
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
drivers/staging/media/atomisp/pci/atomisp_v4l2.c
drivers/staging/media/atomisp/pci/hmm/hmm_bo.c
drivers/staging/media/atomisp/pci/sh_css.c
drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c
drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c
drivers/staging/media/imx/imx-media-csi.c
drivers/staging/media/sunxi/cedrus/cedrus.c
drivers/staging/media/usbvision/usbvision-i2c.c
drivers/staging/wlan-ng/hfa384x_usb.c
drivers/staging/wlan-ng/prism2usb.c
drivers/target/iscsi/cxgbit/cxgbit_main.c
drivers/target/iscsi/iscsi_target.c
drivers/target/iscsi/iscsi_target_login.c
drivers/target/iscsi/iscsi_target_login.h
drivers/target/iscsi/iscsi_target_nego.c
drivers/target/target_core_pr.c
drivers/target/target_core_sbc.c
drivers/target/target_core_transport.c
drivers/target/tcm_fc/tfc_cmd.c
drivers/thermal/qcom/qcom-spmi-temp-alarm.c
drivers/thermal/qcom/tsens-v0_1.c
drivers/thermal/qcom/tsens-v1.c
drivers/thermal/thermal_core.c
drivers/thermal/ti-soc-thermal/omap4-thermal-data.c
drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h
drivers/thunderbolt/ctl.c
drivers/thunderbolt/eeprom.c
drivers/thunderbolt/switch.c
drivers/thunderbolt/tb.h
drivers/thunderbolt/tunnel.c
drivers/tty/hvc/hvc_xen.c
drivers/tty/mips_ejtag_fdc.c
drivers/tty/n_gsm.c
drivers/tty/n_hdlc.c
drivers/tty/n_r3964.c
drivers/tty/serial/8250/8250_em.c
drivers/tty/serial/8250/8250_exar.c
drivers/tty/serial/8250/8250_fintek.c
drivers/tty/serial/8250/8250_pci.c
drivers/tty/serial/8250/8250_port.c
drivers/tty/serial/8250/8250_uniphier.c
drivers/tty/serial/Kconfig
drivers/tty/serial/Makefile
drivers/tty/serial/amba-pl011.c
drivers/tty/serial/atmel_serial.c
drivers/tty/serial/omap-serial.c
drivers/tty/serial/qcom_geni_serial.c
drivers/tty/serial/rda-uart.c
drivers/tty/serial/samsung_tty.c
drivers/tty/serial/serial-tegra.c
drivers/tty/serial/serial_core.c
drivers/tty/serial/stm32-usart.c
drivers/tty/serial/sunsu.c
drivers/tty/serial/sunzilog.c
drivers/tty/serial/xilinx_uartps.c
drivers/tty/tty_ioctl.c
drivers/tty/vt/vt.c
drivers/tty/vt/vt_ioctl.c
drivers/usb/c67x00/c67x00-sched.c
drivers/usb/class/cdc-acm.c
drivers/usb/class/usblp.c
drivers/usb/core/driver.c
drivers/usb/core/generic.c
drivers/usb/core/hcd-pci.c
drivers/usb/core/hub.c
drivers/usb/core/message.c
drivers/usb/core/quirks.c
drivers/usb/core/sysfs.c
drivers/usb/dwc3/core.c
drivers/usb/dwc3/dwc3-meson-g12a.c
drivers/usb/dwc3/gadget.c
drivers/usb/gadget/function/f_mass_storage.c
drivers/usb/gadget/function/f_ncm.c
drivers/usb/gadget/function/f_tcm.c
drivers/usb/gadget/u_f.h
drivers/usb/gadget/udc/atmel_usba_udc.c
drivers/usb/gadget/udc/fsl_udc_core.c
drivers/usb/gadget/udc/pxa25x_udc.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-hub.c
drivers/usb/host/isp116x-hcd.c
drivers/usb/host/ohci-exynos.c
drivers/usb/host/pci-quirks.c
drivers/usb/host/xhci-dbgcap.c
drivers/usb/host/xhci-debugfs.c
drivers/usb/host/xhci-hub.c
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci-pci-renesas.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci-tegra.c
drivers/usb/host/xhci.c
drivers/usb/misc/lvstest.c
drivers/usb/misc/yurex.c
drivers/usb/musb/cppi_dma.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_dsps.c
drivers/usb/musb/musb_gadget_ep0.c
drivers/usb/musb/musb_host.c
drivers/usb/musb/musb_virthub.c
drivers/usb/musb/omap2430.c
drivers/usb/musb/tusb6010.c
drivers/usb/phy/phy-jz4770.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio_ids.h
drivers/usb/serial/option.c
drivers/usb/storage/sddr55.c
drivers/usb/storage/uas.c
drivers/usb/storage/unusual_devs.h
drivers/usb/storage/unusual_uas.h
drivers/usb/typec/mux/intel_pmc_mux.c
drivers/usb/typec/tcpm/tcpci.c
drivers/usb/typec/tcpm/tcpm.c
drivers/usb/typec/ucsi/displayport.c
drivers/usb/typec/ucsi/ucsi.c
drivers/usb/typec/ucsi/ucsi_acpi.c
drivers/usb/usbip/stub_dev.c
drivers/vdpa/ifcvf/ifcvf_base.h
drivers/vdpa/ifcvf/ifcvf_main.c
drivers/vdpa/mlx5/net/mlx5_vnet.c
drivers/vfio/pci/vfio_pci.c
drivers/vfio/vfio_iommu_type1.c
drivers/vhost/iotlb.c
drivers/vhost/vdpa.c
drivers/vhost/vhost.c
drivers/video/backlight/adp8860_bl.c
drivers/video/console/Kconfig
drivers/video/console/vgacon.c
drivers/video/fbdev/acornfb.c
drivers/video/fbdev/arcfb.c
drivers/video/fbdev/atmel_lcdfb.c
drivers/video/fbdev/aty/radeon_pm.c
drivers/video/fbdev/cirrusfb.c
drivers/video/fbdev/controlfb.c
drivers/video/fbdev/core/bitblit.c
drivers/video/fbdev/core/fbcon.c
drivers/video/fbdev/core/fbcon.h
drivers/video/fbdev/core/fbcon_ccw.c
drivers/video/fbdev/core/fbcon_cw.c
drivers/video/fbdev/core/fbcon_ud.c
drivers/video/fbdev/core/fbmem.c
drivers/video/fbdev/core/tileblit.c
drivers/video/fbdev/fsl-diu-fb.c
drivers/video/fbdev/gxt4500.c
drivers/video/fbdev/hyperv_fb.c
drivers/video/fbdev/i740fb.c
drivers/video/fbdev/mmp/fb/mmpfb.c
drivers/video/fbdev/nvidia/nv_hw.c
drivers/video/fbdev/offb.c
drivers/video/fbdev/omap/lcdc.c
drivers/video/fbdev/omap/omapfb_main.c
drivers/video/fbdev/omap2/omapfb/dss/dispc.c
drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
drivers/video/fbdev/omap2/omapfb/omapfb-main.c
drivers/video/fbdev/pm2fb.c
drivers/video/fbdev/pxa168fb.c
drivers/video/fbdev/pxafb.c
drivers/video/fbdev/riva/fbdev.c
drivers/video/fbdev/s3c-fb.c
drivers/video/fbdev/sa1100fb.c
drivers/video/fbdev/savage/savagefb_driver.c
drivers/video/fbdev/sh_mobile_lcdcfb.c
drivers/video/fbdev/sis/sis_main.c
drivers/video/fbdev/sm501fb.c
drivers/video/fbdev/stifb.c
drivers/video/fbdev/tdfxfb.c
drivers/video/fbdev/vga16fb.c
drivers/video/fbdev/via/lcd.c
drivers/video/fbdev/xen-fbfront.c
drivers/watchdog/sc1200wdt.c
drivers/watchdog/wdrtas.c
drivers/xen/Kconfig
drivers/xen/Makefile
drivers/xen/balloon.c
drivers/xen/events/events_base.c
drivers/xen/grant-table.c
drivers/xen/privcmd.c
drivers/xen/pvcalls-front.c
drivers/xen/unpopulated-alloc.c [new file with mode: 0644]
drivers/xen/xen-acpi-memhotplug.c
drivers/xen/xen-pciback/xenbus.c
drivers/xen/xen-scsiback.c
drivers/xen/xenbus/xenbus_client.c
drivers/xen/xenbus/xenbus_probe_frontend.c
drivers/xen/xlate_mmu.c
fs/9p/vfs_file.c
fs/adfs/dir_f.c
fs/affs/amigaffs.c
fs/affs/file.c
fs/affs/inode.c
fs/affs/super.c
fs/afs/cmservice.c
fs/afs/file.c
fs/afs/flock.c
fs/afs/fs_probe.c
fs/afs/fsclient.c
fs/afs/internal.h
fs/afs/misc.c
fs/afs/proc.c
fs/afs/rotate.c
fs/afs/rxrpc.c
fs/afs/vl_list.c
fs/afs/vl_probe.c
fs/afs/vl_rotate.c
fs/afs/vlclient.c
fs/afs/write.c
fs/afs/yfsclient.c
fs/aio.c
fs/autofs/waitq.c
fs/binfmt_flat.c
fs/btrfs/block-group.c
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/file.c
fs/btrfs/free-space-cache.c
fs/btrfs/free-space-tree.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/print-tree.c
fs/btrfs/scrub.c
fs/btrfs/super.c
fs/btrfs/sysfs.c
fs/btrfs/transaction.c
fs/btrfs/tree-checker.c
fs/btrfs/tree-log.c
fs/btrfs/volumes.c
fs/buffer.c
fs/ceph/caps.c
fs/ceph/debugfs.c
fs/ceph/dir.c
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/mds_client.h
fs/ceph/quota.c
fs/ceph/super.h
fs/cifs/cifsglob.h
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/inode.c
fs/cifs/sess.c
fs/cifs/smb2pdu.c
fs/configfs/dir.c
fs/dax.c
fs/debugfs/file.c
fs/dlm/lock.c
fs/erofs/zmap.c
fs/eventpoll.c
fs/ext2/file.c
fs/ext2/inode.c
fs/ext2/super.c
fs/ext4/inode.c
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/node.c
fs/f2fs/segment.c
fs/fcntl.c
fs/fs-writeback.c
fs/fs_context.c
fs/fsopen.c
fs/fuse/file.c
fs/gfs2/bmap.c
fs/gfs2/log.c
fs/gfs2/quota.c
fs/gfs2/trans.c
fs/hfsplus/wrapper.c
fs/io-wq.c
fs/io_uring.c
fs/iomap/seek.c
fs/jffs2/fs.c
fs/jffs2/readinode.c
fs/libfs.c
fs/locks.c
fs/nfs/blocklayout/blocklayout.c
fs/nfs/dir.c
fs/nfs/filelayout/filelayout.c
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/fs_context.c
fs/nfs/nfs3acl.c
fs/nfs/nfs42proc.c
fs/nfs/nfs4file.c
fs/nfs/nfs4idmap.c
fs/nfs/nfs4proc.c
fs/nfs/nfs4state.c
fs/nfs/pagelist.c
fs/nfs/pnfs.c
fs/nfs_common/nfsacl.c
fs/nfsd/blocklayout.c
fs/nfsd/nfs4callback.c
fs/nfsd/nfs4layouts.c
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4state.c
fs/nfsd/nfsfh.c
fs/nfsd/nfsproc.c
fs/nfsd/nfssvc.c
fs/nfsd/vfs.c
fs/nilfs2/bmap.c
fs/nilfs2/recovery.c
fs/nilfs2/segment.c
fs/notify/fanotify/fanotify_user.c
fs/ocfs2/cluster/quorum.c
fs/pipe.c
fs/pstore/zone.c
fs/quota/quota.c
fs/read_write.c
fs/seq_file.c
fs/signalfd.c
fs/splice.c
fs/ubifs/lprops.c
fs/udf/symlink.c
fs/ufs/util.h
fs/vboxsf/super.c
fs/vboxsf/utils.c
fs/xfs/libxfs/xfs_attr_leaf.c
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/libxfs/xfs_trans_inode.c
fs/xfs/libxfs/xfs_trans_space.h
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_file.c
include/drm/drm_hdcp.h
include/drm/drm_modeset_lock.h
include/linux/acpi.h
include/linux/blk_types.h
include/linux/blkdev.h
include/linux/bvec.h
include/linux/ceph/ceph_features.h
include/linux/compat.h
include/linux/compiler_attributes.h
include/linux/compiler_types.h
include/linux/cpufreq.h
include/linux/cpuhotplug.h
include/linux/cpuidle.h
include/linux/dax.h
include/linux/device.h
include/linux/dynamic_debug.h
include/linux/efi_embedded_fw.h
include/linux/entry-common.h
include/linux/filter.h
include/linux/fs.h
include/linux/fs_parser.h
include/linux/ftrace.h
include/linux/hid.h
include/linux/i2c-algo-pca.h
include/linux/irqflags.h
include/linux/jhash.h
include/linux/kernel.h
include/linux/kprobes.h
include/linux/ksm.h
include/linux/kvm_host.h
include/linux/libata.h
include/linux/lockdep.h
include/linux/log2.h
include/linux/memremap.h
include/linux/memstick.h
include/linux/mm.h
include/linux/mm_types.h
include/linux/mmu_context.h
include/linux/mmzone.h
include/linux/netdev_features.h
include/linux/netdevice.h
include/linux/netfilter/nf_conntrack_sctp.h
include/linux/netfilter/nfnetlink.h
include/linux/nfs_xdr.h
include/linux/node.h
include/linux/percpu-rwsem.h
include/linux/pgtable.h
include/linux/pipe_fs_i.h
include/linux/powercap.h
include/linux/qed/qed_if.h
include/linux/sched.h
include/linux/serial_core.h
include/linux/signal.h
include/linux/skbuff.h
include/linux/soc/ti/ti_sci_protocol.h
include/linux/stackleak.h
include/linux/vm_event_item.h
include/linux/vmstat.h
include/linux/wait.h
include/math-emu/op-common.h
include/media/videobuf2-core.h
include/net/af_rxrpc.h
include/net/flow.h
include/net/ndisc.h
include/net/netfilter/nf_tables.h
include/net/netlink.h
include/net/netns/nftables.h
include/net/sctp/structs.h
include/net/vxlan.h
include/soc/mscc/ocelot.h
include/soc/nps/common.h
include/sound/soc.h
include/trace/events/mmflags.h
include/trace/events/rxrpc.h
include/trace/events/writeback.h
include/uapi/linux/ethtool_netlink.h
include/uapi/linux/in.h
include/uapi/linux/kvm.h
include/uapi/linux/netfilter/nf_tables.h
include/uapi/linux/videodev2.h
include/xen/arm/page.h
include/xen/balloon.h
include/xen/xen.h
init/initramfs.c
init/main.c
ipc/ipc_sysctl.c
ipc/sem.c
ipc/shm.c
kernel/auditfilter.c
kernel/bpf/cgroup.c
kernel/bpf/cpumap.c
kernel/bpf/hashtab.c
kernel/bpf/inode.c
kernel/bpf/syscall.c
kernel/bpf/verifier.c
kernel/capability.c
kernel/compat.c
kernel/debug/gdbstub.c
kernel/debug/kdb/kdb_keyboard.c
kernel/debug/kdb/kdb_support.c
kernel/dma/pool.c
kernel/entry/common.c
kernel/events/core.c
kernel/fork.c
kernel/gcov/gcc_4_7.c
kernel/irq/handle.c
kernel/irq/manage.c
kernel/irq/matrix.c
kernel/kallsyms.c
kernel/kprobes.c
kernel/locking/lockdep.c
kernel/locking/lockdep_internals.h
kernel/locking/percpu-rwsem.c
kernel/padata.c
kernel/power/hibernate.c
kernel/power/qos.c
kernel/rcu/tasks.h
kernel/rcu/tree.c
kernel/sched/core.c
kernel/sched/idle.c
kernel/sched/topology.c
kernel/seccomp.c
kernel/signal.c
kernel/stackleak.c
kernel/sys.c
kernel/sysctl.c
kernel/time/hrtimer.c
kernel/time/posix-timers.c
kernel/time/tick-broadcast.c
kernel/time/timer.c
kernel/trace/blktrace.c
kernel/trace/ftrace.c
kernel/trace/trace.c
kernel/trace/trace_events_filter.c
kernel/trace/trace_events_hist.c
kernel/trace/trace_output.c
kernel/trace/trace_preemptirq.c
lib/Kconfig.debug
lib/bootconfig.c
lib/dynamic_debug.c
lib/glob.c
lib/kobject.c
lib/memregion.c
lib/random32.c
lib/string.c
lib/test_firmware.c
lib/test_rhashtable.c
lib/vsprintf.c
lib/xz/xz_dec_lzma2.c
lib/xz/xz_dec_stream.c
lib/zstd/decompress.c
mm/filemap.c
mm/gup.c
mm/huge_memory.c
mm/hugetlb.c
mm/khugepaged.c
mm/ksm.c
mm/madvise.c
mm/memcontrol.c
mm/memory.c
mm/memory_hotplug.c
mm/memremap.c
mm/migrate.c
mm/mlock.c
mm/page_alloc.c
mm/page_isolation.c
mm/percpu.c
mm/rmap.c
mm/shmem.c
mm/slab.c
mm/slub.c
mm/swap.c
mm/swapfile.c
mm/vmscan.c
mm/vmstat.c
net/8021q/vlan_dev.c
net/9p/trans_xen.c
net/atm/common.c
net/atm/lec.c
net/atm/resources.c
net/batman-adv/bat_v_ogm.c
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/bridge_loop_avoidance.h
net/batman-adv/gateway_client.c
net/batman-adv/multicast.c
net/batman-adv/multicast.h
net/batman-adv/routing.c
net/batman-adv/soft-interface.c
net/bpf/test_run.c
net/bridge/br_vlan.c
net/caif/cfrfml.c
net/can/j1939/socket.c
net/can/j1939/transport.c
net/ceph/ceph_hash.c
net/ceph/crush/mapper.c
net/ceph/messenger.c
net/ceph/mon_client.c
net/ceph/osd_client.c
net/core/dev.c
net/core/dev_ioctl.c
net/core/devlink.c
net/core/drop_monitor.c
net/core/dst.c
net/core/fib_rules.c
net/core/filter.c
net/core/net_namespace.c
net/core/netpoll.c
net/core/pktgen.c
net/core/skbuff.c
net/core/skmsg.c
net/core/sock.c
net/dcb/dcbnl.c
net/dccp/ccids/ccid3.c
net/dccp/feat.c
net/dccp/input.c
net/dccp/options.c
net/dccp/output.c
net/dccp/proto.c
net/decnet/af_decnet.c
net/decnet/dn_nsp_in.c
net/decnet/dn_table.c
net/decnet/sysctl_net_decnet.c
net/dsa/slave.c
net/dsa/tag_ocelot.c
net/ethtool/tunnels.c
net/hsr/hsr_netlink.c
net/ieee802154/6lowpan/reassembly.c
net/ieee802154/6lowpan/rx.c
net/ipv4/fib_frontend.c
net/ipv4/fib_trie.c
net/ipv4/inet_diag.c
net/ipv4/ip_output.c
net/ipv4/ip_tunnel_core.c
net/ipv4/netfilter/nf_nat_pptp.c
net/ipv4/raw.c
net/ipv4/route.c
net/ipv6/Kconfig
net/ipv6/ip6_fib.c
net/ipv6/route.c
net/ipv6/sysctl_net_ipv6.c
net/iucv/af_iucv.c
net/l3mdev/l3mdev.c
net/mac80211/airtime.c
net/mac80211/mlme.c
net/mac80211/rx.c
net/mac80211/sta_info.h
net/mac80211/status.c
net/mac80211/util.c
net/mac80211/vht.c
net/mac802154/tx.c
net/mpls/af_mpls.c
net/mptcp/pm_netlink.c
net/mptcp/protocol.c
net/mptcp/subflow.c
net/ncsi/ncsi-manage.c
net/netfilter/ipvs/ip_vs_proto_tcp.c
net/netfilter/ipvs/ip_vs_proto_udp.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_pptp.c
net/netfilter/nf_conntrack_proto.c
net/netfilter/nf_conntrack_proto_sctp.c
net/netfilter/nf_conntrack_proto_tcp.c
net/netfilter/nf_conntrack_proto_udp.c
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink.c
net/netfilter/nfnetlink_log.c
net/netfilter/nfnetlink_queue.c
net/netfilter/nft_flow_offload.c
net/netfilter/nft_meta.c
net/netfilter/nft_payload.c
net/netfilter/nft_set_rbtree.c
net/netfilter/xt_recent.c
net/netlabel/netlabel_domainhash.c
net/netlink/af_netlink.c
net/netlink/policy.c
net/netrom/nr_in.c
net/netrom/nr_route.c
net/openvswitch/conntrack.c
net/openvswitch/flow.c
net/packet/af_packet.c
net/phonet/pep.c
net/qrtr/qrtr.c
net/rds/send.c
net/rose/rose_in.c
net/rose/rose_route.c
net/rxrpc/af_rxrpc.c
net/rxrpc/ar-internal.h
net/rxrpc/call_accept.c
net/rxrpc/call_object.c
net/rxrpc/conn_client.c
net/rxrpc/input.c
net/rxrpc/local_object.c
net/rxrpc/output.c
net/rxrpc/peer_event.c
net/rxrpc/peer_object.c
net/rxrpc/recvmsg.c
net/rxrpc/rtt.c
net/rxrpc/rxkad.c
net/rxrpc/sendmsg.c
net/sched/act_ife.c
net/sched/act_tunnel_key.c
net/sched/cls_flower.c
net/sched/sch_cake.c
net/sched/sch_generic.c
net/sched/sch_red.c
net/sched/sch_taprio.c
net/sctp/ipv6.c
net/sctp/outqueue.c
net/sctp/sm_make_chunk.c
net/sctp/sm_sideeffect.c
net/sctp/sm_statefuns.c
net/sctp/socket.c
net/smc/smc_close.c
net/smc/smc_core.c
net/smc/smc_llc.c
net/socket.c
net/sunrpc/auth_gss/gss_krb5_wrap.c
net/sunrpc/auth_gss/trace.c
net/sunrpc/clnt.c
net/sunrpc/rpcb_clnt.c
net/sunrpc/svcsock.c
net/sunrpc/xprt.c
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtsock.c
net/tipc/bearer.c
net/tipc/crypto.c
net/tipc/group.c
net/tipc/link.c
net/tipc/msg.c
net/tipc/socket.c
net/unix/af_unix.c
net/wireless/Kconfig
net/wireless/chan.c
net/wireless/mlme.c
net/wireless/nl80211.c
net/wireless/reg.c
net/wireless/scan.c
net/wireless/sme.c
net/wireless/util.c
net/wireless/wext-compat.c
net/x25/x25_facilities.c
net/x25/x25_in.c
net/xdp/xdp_umem.c
net/xfrm/xfrm_policy.c
samples/bpf/hbm.c
scripts/checkpatch.pl
scripts/dtc/Makefile
scripts/kallsyms.c
scripts/kconfig/lkc.h
scripts/kconfig/lkc_proto.h
scripts/kconfig/nconf.c
scripts/kconfig/qconf.cc
scripts/kconfig/streamline_config.pl
scripts/tags.sh
security/apparmor/domain.c
security/apparmor/lib.c
security/device_cgroup.c
security/integrity/ima/ima_appraise.c
security/integrity/ima/ima_policy.c
security/integrity/ima/ima_template_lib.c
security/keys/process_keys.c
security/keys/request_key.c
security/selinux/hooks.c
security/selinux/ss/mls.c
security/smack/smack_lsm.c
security/tomoyo/common.c
security/tomoyo/file.c
sound/core/oss/mulaw.c
sound/core/timer.c
sound/firewire/amdtp-stream.c
sound/firewire/digi00x/digi00x.c
sound/firewire/tascam/tascam.c
sound/hda/hdac_device.c
sound/hda/intel-dsp-config.c
sound/pci/asihpi/asihpi.c
sound/pci/asihpi/hpioctl.c
sound/pci/ca0106/ca0106_main.c
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_tegra.c
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_realtek.c
sound/pci/riptide/riptide.c
sound/pci/rme9652/hdsp.c
sound/pci/rme9652/hdspm.c
sound/ppc/snd_ps3.c
sound/soc/atmel/mchp-i2s-mcc.c
sound/soc/codecs/jz4770.c
sound/soc/codecs/max98373-sdw.c
sound/soc/codecs/pcm186x.c
sound/soc/codecs/pcm3168a.c
sound/soc/codecs/rt1308-sdw.c
sound/soc/codecs/rt700-sdw.c
sound/soc/codecs/rt711-sdw.c
sound/soc/codecs/rt715-sdw.c
sound/soc/codecs/tlv320adcx140.c
sound/soc/codecs/wm8994.c
sound/soc/codecs/wm_hubs.c
sound/soc/codecs/wm_hubs.h
sound/soc/fsl/fsl_esai.c
sound/soc/fsl/fsl_ssi.c
sound/soc/hisilicon/hi6210-i2s.c
sound/soc/intel/atom/sst-mfld-platform-pcm.c
sound/soc/intel/baytrail/sst-baytrail-pcm.c
sound/soc/intel/boards/bytcht_es8316.c
sound/soc/intel/boards/bytcr_rt5640.c
sound/soc/intel/boards/bytcr_rt5651.c
sound/soc/intel/boards/skl_hda_dsp_generic.c
sound/soc/intel/boards/sof_maxim_common.c
sound/soc/intel/haswell/sst-haswell-dsp.c
sound/soc/intel/skylake/skl-pcm.c
sound/soc/meson/axg-tdm-interface.c
sound/soc/meson/axg-toddr.c
sound/soc/pxa/pxa-ssp.c
sound/soc/qcom/apq8016_sbc.c
sound/soc/qcom/apq8096.c
sound/soc/qcom/common.c
sound/soc/qcom/sdm845.c
sound/soc/qcom/storm.c
sound/soc/rockchip/rockchip_pdm.c
sound/soc/samsung/i2s.c
sound/soc/sh/siu_pcm.c
sound/soc/soc-core.c
sound/soc/soc-dai.c
sound/soc/soc-pcm.c
sound/soc/soc-topology.c
sound/soc/sof/intel/hda-dai.c
sound/soc/sof/pcm.c
sound/soc/ti/ams-delta.c
sound/soc/ti/davinci-i2s.c
sound/soc/ti/n810.c
sound/soc/ti/omap-dmic.c
sound/soc/ti/omap-mcpdm.c
sound/soc/ti/rx51.c
sound/soc/txx9/txx9aclc.c
sound/soc/zte/zx-i2s.c
sound/soc/zte/zx-spdif.c
sound/usb/midi.c
sound/usb/misc/ua101.c
sound/usb/mixer_maps.c
sound/usb/pcm.c
sound/usb/quirks-table.h
sound/usb/quirks.c
sound/usb/usbaudio.h
sound/x86/Kconfig
tools/bootconfig/test-bootconfig.sh
tools/bpf/Makefile
tools/bpf/resolve_btfids/Makefile
tools/include/uapi/linux/in.h
tools/include/uapi/linux/kvm.h
tools/include/uapi/linux/perf_event.h
tools/io_uring/io_uring-bench.c
tools/lib/bpf/Makefile
tools/lib/bpf/libbpf.c
tools/lib/traceevent/event-parse.c
tools/objtool/check.c
tools/perf/Documentation/perf-record.txt
tools/perf/Documentation/perf-stat.txt
tools/perf/bench/sched-messaging.c
tools/perf/bench/synthesize.c
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/builtin-sched.c
tools/perf/builtin-stat.c
tools/perf/builtin-top.c
tools/perf/pmu-events/arch/x86/amdzen1/core.json
tools/perf/pmu-events/arch/x86/amdzen2/core.json
tools/perf/pmu-events/jevents.c
tools/perf/tests/attr/README
tools/perf/tests/attr/test-record-group2 [new file with mode: 0644]
tools/perf/tests/bp_signal.c
tools/perf/tests/bpf.c
tools/perf/tests/parse-events.c
tools/perf/tests/parse-metric.c
tools/perf/tests/pmu-events.c
tools/perf/tests/pmu.c
tools/perf/ui/browsers/hists.c
tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
tools/perf/util/cs-etm.c
tools/perf/util/evlist.c
tools/perf/util/evsel.c
tools/perf/util/intel-pt.c
tools/perf/util/machine.c
tools/perf/util/map.c
tools/perf/util/map.h
tools/perf/util/metricgroup.c
tools/perf/util/parse-events.c
tools/perf/util/parse-events.y
tools/perf/util/pmu.c
tools/perf/util/pmu.h
tools/perf/util/record.c
tools/perf/util/session.c
tools/perf/util/stat-display.c
tools/perf/util/stat-shadow.c
tools/perf/util/stat.h
tools/perf/util/symbol.c
tools/perf/util/zstd.c
tools/testing/selftests/bpf/progs/bpf_iter_bpf_hash_map.c
tools/testing/selftests/bpf/test_maps.c
tools/testing/selftests/bpf/test_progs.c
tools/testing/selftests/kvm/x86_64/debug_regs.c
tools/testing/selftests/net/rtnetlink.sh
tools/testing/selftests/netfilter/nft_flowtable.sh
tools/testing/selftests/powerpc/mm/.gitignore
tools/testing/selftests/powerpc/mm/Makefile
tools/testing/selftests/powerpc/mm/prot_sao.c [new file with mode: 0644]
tools/testing/selftests/timers/Makefile
tools/testing/selftests/timers/settings [new file with mode: 0644]
tools/testing/selftests/vm/map_hugetlb.c
tools/testing/selftests/x86/test_vsyscall.c
tools/usb/Build [new file with mode: 0644]
tools/usb/Makefile
virt/kvm/kvm_main.c

index a0a96088c74f49a961a80bc0851a84214b0a9f83..badfc1ba440afc1c87f056ee61c8e38105d60022 100644 (file)
@@ -111,6 +111,7 @@ ForEachMacros:
   - 'css_for_each_descendant_pre'
   - 'device_for_each_child_node'
   - 'dma_fence_chain_for_each'
+  - 'do_for_each_ftrace_op'
   - 'drm_atomic_crtc_for_each_plane'
   - 'drm_atomic_crtc_state_for_each_plane'
   - 'drm_atomic_crtc_state_for_each_plane_state'
@@ -136,6 +137,7 @@ ForEachMacros:
   - 'for_each_active_dev_scope'
   - 'for_each_active_drhd_unit'
   - 'for_each_active_iommu'
+  - 'for_each_aggr_pgid'
   - 'for_each_available_child_of_node'
   - 'for_each_bio'
   - 'for_each_board_func_rsrc'
@@ -234,6 +236,7 @@ ForEachMacros:
   - 'for_each_node_state'
   - 'for_each_node_with_cpus'
   - 'for_each_node_with_property'
+  - 'for_each_nonreserved_multicast_dest_pgid'
   - 'for_each_of_allnodes'
   - 'for_each_of_allnodes_from'
   - 'for_each_of_cpu_node'
@@ -256,6 +259,7 @@ ForEachMacros:
   - 'for_each_pci_dev'
   - 'for_each_pci_msi_entry'
   - 'for_each_pcm_streams'
+  - 'for_each_physmem_range'
   - 'for_each_populated_zone'
   - 'for_each_possible_cpu'
   - 'for_each_present_cpu'
@@ -265,6 +269,8 @@ ForEachMacros:
   - 'for_each_process_thread'
   - 'for_each_property_of_node'
   - 'for_each_registered_fb'
+  - 'for_each_requested_gpio'
+  - 'for_each_requested_gpio_in_range'
   - 'for_each_reserved_mem_region'
   - 'for_each_rtd_codec_dais'
   - 'for_each_rtd_codec_dais_rollback'
@@ -278,12 +284,17 @@ ForEachMacros:
   - 'for_each_sg'
   - 'for_each_sg_dma_page'
   - 'for_each_sg_page'
+  - 'for_each_sgtable_dma_page'
+  - 'for_each_sgtable_dma_sg'
+  - 'for_each_sgtable_page'
+  - 'for_each_sgtable_sg'
   - 'for_each_sibling_event'
   - 'for_each_subelement'
   - 'for_each_subelement_extid'
   - 'for_each_subelement_id'
   - '__for_each_thread'
   - 'for_each_thread'
+  - 'for_each_unicast_dest_pgid'
   - 'for_each_wakeup_source'
   - 'for_each_zone'
   - 'for_each_zone_zonelist'
@@ -464,6 +475,7 @@ ForEachMacros:
   - 'v4l2_m2m_for_each_src_buf'
   - 'v4l2_m2m_for_each_src_buf_safe'
   - 'virtio_device_for_each_vq'
+  - 'while_for_each_ftrace_op'
   - 'xa_for_each'
   - 'xa_for_each_marked'
   - 'xa_for_each_range'
index 332c7833057f51da02805add9b60161ff31aee71..a780211468e4e4a7a79c9fb39135e92d2ae168a7 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -169,6 +169,10 @@ Juha Yrjola <juha.yrjola@solidboot.com>
 Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com>
 Kamil Konieczny <k.konieczny@samsung.com> <k.konieczny@partner.samsung.com>
 Kay Sievers <kay.sievers@vrfy.org>
+Kees Cook <keescook@chromium.org> <kees.cook@canonical.com>
+Kees Cook <keescook@chromium.org> <keescook@google.com>
+Kees Cook <keescook@chromium.org> <kees@outflux.net>
+Kees Cook <keescook@chromium.org> <kees@ubuntu.com>
 Kenneth W Chen <kenneth.w.chen@intel.com>
 Konstantin Khlebnikov <koct9i@gmail.com> <khlebnikov@yandex-team.ru>
 Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>
@@ -308,6 +312,7 @@ Tony Luck <tony.luck@intel.com>
 TripleX Chung <xxx.phy@gmail.com> <triplex@zh-kernel.org>
 TripleX Chung <xxx.phy@gmail.com> <zhongyu@18mail.cn>
 Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com>
+Tycho Andersen <tycho@tycho.pizza> <tycho@tycho.ws>
 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
 Uwe Kleine-König <ukl@pengutronix.de>
 Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
index f1fc8ae3846a4058796b12769517372350f9f47d..cc860a0c296be1bdb3f57ac79fa10dbe30fd99db 100644 (file)
@@ -49,7 +49,7 @@ checking of rcu_dereference() primitives:
                is invoked by both RCU-sched readers and updaters.
        srcu_dereference_check(p, c):
                Use explicit check expression "c" along with
-               srcu_read_lock_held()().  This is useful in code that
+               srcu_read_lock_held().  This is useful in code that
                is invoked by both SRCU readers and updaters.
        rcu_dereference_raw(p):
                Don't check.  (Use sparingly, if at all.)
index 6be43781ec7f3aee3dda5da026650f0ee646145a..baa07b30845e270eb5ecd57ee679bb62b82f9d07 100644 (file)
@@ -1324,15 +1324,26 @@ PAGE_SIZE multiple when read back.
          pgmajfault
                Number of major page faults incurred
 
-         workingset_refault
-               Number of refaults of previously evicted pages
+         workingset_refault_anon
+               Number of refaults of previously evicted anonymous pages.
 
-         workingset_activate
-               Number of refaulted pages that were immediately activated
+         workingset_refault_file
+               Number of refaults of previously evicted file pages.
 
-         workingset_restore
-               Number of restored pages which have been detected as an active
-               workingset before they got reclaimed.
+         workingset_activate_anon
+               Number of refaulted anonymous pages that were immediately
+               activated.
+
+         workingset_activate_file
+               Number of refaulted file pages that were immediately activated.
+
+         workingset_restore_anon
+               Number of restored anonymous pages which have been detected as
+               an active workingset before they got reclaimed.
+
+         workingset_restore_file
+               Number of restored file pages which have been detected as an
+               active workingset before they got reclaimed.
 
          workingset_nodereclaim
                Number of times a shadow node has been reclaimed
index 8f4a3f889d43ee50c47b5316c176a81ae106ae13..bc28a9527ee55f87d3d145e9cac97a3896d6e017 100644 (file)
@@ -67,7 +67,7 @@ Parameters::
     the value passed in <key_size>.
 
 <key_type>
-    Either 'logon' or 'user' kernel key type.
+    Either 'logon', 'user' or 'encrypted' kernel key type.
 
 <key_description>
     The kernel keyring key description crypt target should look for
@@ -121,6 +121,14 @@ submit_from_crypt_cpus
     thread because it benefits CFQ to have writes submitted using the
     same context.
 
+no_read_workqueue
+    Bypass dm-crypt internal workqueue and process read requests synchronously.
+
+no_write_workqueue
+    Bypass dm-crypt internal workqueue and process write requests synchronously.
+    This option is automatically enabled for host-managed zoned block devices
+    (e.g. host-managed SMR hard-disks).
+
 integrity:<bytes>:<type>
     The device requires additional <bytes> metadata per-sector stored
     in per-bio integrity structure. This metadata must by provided
index d336f3f73a4c1b6b308a4ef8c019d91a3b5ecf7d..63fd4e6a014bcce2c161288fed6eb90a64b2b4d6 100644 (file)
 
   98 block     User-mode virtual block device
                  0 = /dev/ubda         First user-mode block device
-                16 = /dev/udbb         Second user-mode block device
+                16 = /dev/ubdb         Second user-mode block device
                    ...
 
                Partitions are handled in the same way as for IDE
index e5a8def45f3f8e9f215219b47976338401ed57e4..6c04aea8f4cd83652fc8de70cb104f2348a1d456 100644 (file)
@@ -156,7 +156,6 @@ against.  Possible keywords are:::
   ``line-range`` cannot contain space, e.g.
   "1-30" is valid range but "1 - 30" is not.
 
-  ``module=foo`` combined keyword=value form is interchangably accepted
 
 The meanings of each keyword are:
 
index 5e477869df1829c2bd1fc031a9101bb3113a86e2..5fe1ade88c177170fd6af1364d19b5c396eaef77 100644 (file)
@@ -1434,7 +1434,7 @@ on the feature, restricting the viewing angles.
 
 
 DYTC Lapmode sensor
-------------------
+-------------------
 
 sysfs: dytc_lapmode
 
index 7adef969ffeef4b93d7036ffe7a92a83a88400da..5072e7064d13d5ac8500ee94a97454f82346fd9a 100644 (file)
@@ -123,7 +123,9 @@ Energy-Performance Bias (EPB) knob (otherwise), which means that the processor's
 internal P-state selection logic is expected to focus entirely on performance.
 
 This will override the EPP/EPB setting coming from the ``sysfs`` interface
-(see `Energy vs Performance Hints`_ below).
+(see `Energy vs Performance Hints`_ below).  Moreover, any attempts to change
+the EPP/EPB to a value different from 0 ("performance") via ``sysfs`` in this
+configuration will be rejected.
 
 Also, in this configuration the range of P-states available to the processor's
 internal P-state selection logic is always restricted to the upper boundary
@@ -564,8 +566,8 @@ Energy-Performance Preference (EPP) knob (if supported) or its
 Energy-Performance Bias (EPB) knob. It is also possible to write a positive
 integer value between 0 to 255, if the EPP feature is present. If the EPP
 feature is not present, writing integer value to this attribute is not
-supported. In this case, user can use
- "/sys/devices/system/cpu/cpu*/power/energy_perf_bias" interface.
+supported. In this case, user can use the
+"/sys/devices/system/cpu/cpu*/power/energy_perf_bias" interface.
 
 [Note that tasks may by migrated from one CPU to another by the scheduler's
 load-balancing algorithm and if different energy vs performance hints are
index 75f943f0009dfbd513c3ae27aa3d6695fd327d4b..6a615cd62bda2f4e1085cd98285acc5f646d819e 100644 (file)
@@ -182,9 +182,6 @@ in the order of reservations, but only after all previous records where
 already committed. It is thus possible for slow producers to temporarily hold
 off submitted records, that were reserved later.
 
-Reservation/commit/consumer protocol is verified by litmus tests in
-Documentation/litmus_tests/bpf-rb/_.
-
 One interesting implementation bit, that significantly simplifies (and thus
 speeds up as well) implementation of both producers and consumers is how data
 area is mapped twice contiguously back-to-back in the virtual memory. This
@@ -200,7 +197,7 @@ a self-pacing notifications of new data being availability.
 being available after commit only if consumer has already caught up right up to
 the record being committed. If not, consumer still has to catch up and thus
 will see new data anyways without needing an extra poll notification.
-Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbuf.c_) show that
+Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbufs.c) show that
 this allows to achieve a very high throughput without having to resort to
 tricks like "notify only every Nth sample", which are necessary with perf
 buffer. For extreme cases, when BPF program wants more manual control of
index 17e4f20c8d39bc0e4779dff24f23197fe91d373d..6834f5e8df5f08a5fe4e8d7f540bf320fbd373b6 100644 (file)
@@ -23,7 +23,7 @@ properties:
   compatible:
     items:
       - const: raspberrypi,bcm2835-firmware
-      - const: simple-bus
+      - const: simple-mfd
 
   mboxes:
     $ref: '/schemas/types.yaml#/definitions/phandle'
@@ -57,7 +57,7 @@ required:
 examples:
   - |
     firmware {
-        compatible = "raspberrypi,bcm2835-firmware", "simple-bus";
+        compatible = "raspberrypi,bcm2835-firmware", "simple-mfd";
         mboxes = <&mailbox>;
 
         firmware_clocks: clocks {
index 85ef69ffebed97dc4bdc6fdde64184e973d8333e..1465c9ebaf938c6d2ea2288e7b0f697dd6f7bba7 100644 (file)
@@ -67,7 +67,7 @@ examples:
 
     main_crypto: crypto@4e00000 {
         compatible = "ti,j721-sa2ul";
-        reg = <0x0 0x4e00000 0x0 0x1200>;
+        reg = <0x4e00000 0x1200>;
         power-domains = <&k3_pds 264 TI_SCI_PD_EXCLUSIVE>;
         dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
                <&main_udmap 0x4001>;
index 52a939cade3b58b5b20b59d877b95f86d36ca875..7b9d468c3e52cd1226fd9cc9197b314c1cc1b250 100644 (file)
@@ -145,10 +145,10 @@ examples:
 
     display@fd4a0000 {
         compatible = "xlnx,zynqmp-dpsub-1.7";
-        reg = <0x0 0xfd4a0000 0x0 0x1000>,
-              <0x0 0xfd4aa000 0x0 0x1000>,
-              <0x0 0xfd4ab000 0x0 0x1000>,
-              <0x0 0xfd4ac000 0x0 0x1000>;
+        reg = <0xfd4a0000 0x1000>,
+              <0xfd4aa000 0x1000>,
+              <0xfd4ab000 0x1000>,
+              <0xfd4ac000 0x1000>;
         reg-names = "dp", "blend", "av_buf", "aud";
         interrupts = <0 119 4>;
         interrupt-parent = <&gic>;
index 5de510f8c88cd4fbb9305129b559dcc8efdcc420..2a595b18ff6c72158c7c9a6804c1e897a5dc613b 100644 (file)
@@ -57,7 +57,7 @@ examples:
 
     dma: dma-controller@fd4c0000 {
       compatible = "xlnx,zynqmp-dpdma";
-      reg = <0x0 0xfd4c0000 0x0 0x1000>;
+      reg = <0xfd4c0000 0x1000>;
       interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
       interrupt-parent = <&gic>;
       clocks = <&dpdma_clk>;
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt
deleted file mode 100644 (file)
index 7841cb0..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-Texas Instruments K3 Interrupt Aggregator
-=========================================
-
-The Interrupt Aggregator (INTA) provides a centralized machine
-which handles the termination of system events to that they can
-be coherently processed by the host(s) in the system. A maximum
-of 64 events can be mapped to a single interrupt.
-
-
-                              Interrupt Aggregator
-                     +-----------------------------------------+
-                     |      Intmap            VINT             |
-                     | +--------------+  +------------+        |
-            m ------>| | vint  | bit  |  | 0 |.....|63| vint0  |
-               .     | +--------------+  +------------+        |       +------+
-               .     |         .               .               |       | HOST |
-Globalevents  ------>|         .               .               |------>| IRQ  |
-               .     |         .               .               |       | CTRL |
-               .     |         .               .               |       +------+
-            n ------>| +--------------+  +------------+        |
-                     | | vint  | bit  |  | 0 |.....|63| vintx  |
-                     | +--------------+  +------------+        |
-                     |                                         |
-                     +-----------------------------------------+
-
-Configuration of these Intmap registers that maps global events to vint is done
-by a system controller (like the Device Memory and Security Controller on K3
-AM654 SoC). Driver should request the system controller to get the range
-of global events and vints assigned to the requesting host. Management
-of these requested resources should be handled by driver and requests
-system controller to map specific global event to vint, bit pair.
-
-Communication between the host processor running an OS and the system
-controller happens through a protocol called TI System Control Interface
-(TISCI protocol). For more details refer:
-Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
-
-TISCI Interrupt Aggregator Node:
--------------------------------
-- compatible:          Must be "ti,sci-inta".
-- reg:                 Should contain registers location and length.
-- interrupt-controller:        Identifies the node as an interrupt controller
-- msi-controller:      Identifies the node as an MSI controller.
-- interrupt-parent:    phandle of irq parent.
-- ti,sci:              Phandle to TI-SCI compatible System controller node.
-- ti,sci-dev-id:       TISCI device ID of the Interrupt Aggregator.
-- ti,sci-rm-range-vint:        Array of TISCI subtype ids representing vints(inta
-                       outputs) range within this INTA, assigned to the
-                       requesting host context.
-- ti,sci-rm-range-global-event:        Array of TISCI subtype ids representing the
-                       global events range reaching this IA and are assigned
-                       to the requesting host context.
-
-Example:
---------
-main_udmass_inta: interrupt-controller@33d00000 {
-       compatible = "ti,sci-inta";
-       reg = <0x0 0x33d00000 0x0 0x100000>;
-       interrupt-controller;
-       msi-controller;
-       interrupt-parent = <&main_navss_intr>;
-       ti,sci = <&dmsc>;
-       ti,sci-dev-id = <179>;
-       ti,sci-rm-range-vint = <0x0>;
-       ti,sci-rm-range-global-event = <0x1>;
-};
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml
new file mode 100644 (file)
index 0000000..c7cd056
--- /dev/null
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/ti,sci-inta.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments K3 Interrupt Aggregator
+
+maintainers:
+  - Lokesh Vutla <lokeshvutla@ti.com>
+
+allOf:
+  - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
+
+description: |
+  The Interrupt Aggregator (INTA) provides a centralized machine
+  which handles the termination of system events to that they can
+  be coherently processed by the host(s) in the system. A maximum
+  of 64 events can be mapped to a single interrupt.
+
+                                Interrupt Aggregator
+                       +-----------------------------------------+
+                       |      Intmap            VINT             |
+                       | +--------------+  +------------+        |
+              m ------>| | vint  | bit  |  | 0 |.....|63| vint0  |
+                 .     | +--------------+  +------------+        |      +------+
+                 .     |         .               .               |      | HOST |
+  Globalevents  ------>|         .               .               |----->| IRQ  |
+                 .     |         .               .               |      | CTRL |
+                 .     |         .               .               |      +------+
+              n ------>| +--------------+  +------------+        |
+                       | | vint  | bit  |  | 0 |.....|63| vintx  |
+                       | +--------------+  +------------+        |
+                       |                                         |
+                       +-----------------------------------------+
+
+  Configuration of these Intmap registers that maps global events to vint is
+  done by a system controller (like the Device Memory and Security Controller
+  on AM654 SoC). Driver should request the system controller to get the range
+  of global events and vints assigned to the requesting host. Management
+  of these requested resources should be handled by driver and requests
+  system controller to map specific global event to vint, bit pair.
+
+  Communication between the host processor running an OS and the system
+  controller happens through a protocol called TI System Control Interface
+  (TISCI protocol).
+
+properties:
+  compatible:
+    const: ti,sci-inta
+
+  reg:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  msi-controller: true
+
+  ti,interrupt-ranges:
+    $ref: /schemas/types.yaml#/definitions/uint32-matrix
+    description: |
+      Interrupt ranges that converts the INTA output hw irq numbers
+      to parents's input interrupt numbers.
+    items:
+      items:
+        - description: |
+            "output_irq" specifies the base for inta output irq
+        - description: |
+            "parent's input irq" specifies the base for parent irq
+        - description: |
+            "limit" specifies the limit for translation
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - msi-controller
+  - ti,sci
+  - ti,sci-dev-id
+  - ti,interrupt-ranges
+
+examples:
+  - |
+    bus {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        main_udmass_inta: msi-controller@33d00000 {
+            compatible = "ti,sci-inta";
+            reg = <0x0 0x33d00000 0x0 0x100000>;
+            interrupt-controller;
+            msi-controller;
+            interrupt-parent = <&main_navss_intr>;
+            ti,sci = <&dmsc>;
+            ti,sci-dev-id = <179>;
+            ti,interrupt-ranges = <0 0 256>;
+        };
+    };
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt
deleted file mode 100644 (file)
index 178fca0..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-Texas Instruments K3 Interrupt Router
-=====================================
-
-The Interrupt Router (INTR) module provides a mechanism to mux M
-interrupt inputs to N interrupt outputs, where all M inputs are selectable
-to be driven per N output. An Interrupt Router can either handle edge triggered
-or level triggered interrupts and that is fixed in hardware.
-
-                                 Interrupt Router
-                             +----------------------+
-                             |  Inputs     Outputs  |
-        +-------+            | +------+    +-----+  |
-        | GPIO  |----------->| | irq0 |    |  0  |  |       Host IRQ
-        +-------+            | +------+    +-----+  |      controller
-                             |    .           .     |      +-------+
-        +-------+            |    .           .     |----->|  IRQ  |
-        | INTA  |----------->|    .           .     |      +-------+
-        +-------+            |    .        +-----+  |
-                             | +------+    |  N  |  |
-                             | | irqM |    +-----+  |
-                             | +------+             |
-                             |                      |
-                             +----------------------+
-
-There is one register per output (MUXCNTL_N) that controls the selection.
-Configuration of these MUXCNTL_N registers is done by a system controller
-(like the Device Memory and Security Controller on K3 AM654 SoC). System
-controller will keep track of the used and unused registers within the Router.
-Driver should request the system controller to get the range of GIC IRQs
-assigned to the requesting hosts. It is the drivers responsibility to keep
-track of Host IRQs.
-
-Communication between the host processor running an OS and the system
-controller happens through a protocol called TI System Control Interface
-(TISCI protocol). For more details refer:
-Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
-
-TISCI Interrupt Router Node:
-----------------------------
-Required Properties:
-- compatible:          Must be "ti,sci-intr".
-- ti,intr-trigger-type:        Should be one of the following:
-                       1: If intr supports edge triggered interrupts.
-                       4: If intr supports level triggered interrupts.
-- interrupt-controller:        Identifies the node as an interrupt controller
-- #interrupt-cells:    Specifies the number of cells needed to encode an
-                       interrupt source. The value should be 2.
-                       First cell should contain the TISCI device ID of source
-                       Second cell should contain the interrupt source offset
-                       within the device.
-- ti,sci:              Phandle to TI-SCI compatible System controller node.
-- ti,sci-dst-id:       TISCI device ID of the destination IRQ controller.
-- ti,sci-rm-range-girq:        Array of TISCI subtype ids representing the host irqs
-                       assigned to this interrupt router. Each subtype id
-                       corresponds to a range of host irqs.
-
-For more details on TISCI IRQ resource management refer:
-https://downloads.ti.com/tisci/esd/latest/2_tisci_msgs/rm/rm_irq.html
-
-Example:
---------
-The following example demonstrates both interrupt router node and the consumer
-node(main gpio) on the AM654 SoC:
-
-main_intr: interrupt-controller0 {
-       compatible = "ti,sci-intr";
-       ti,intr-trigger-type = <1>;
-       interrupt-controller;
-       interrupt-parent = <&gic500>;
-       #interrupt-cells = <2>;
-       ti,sci = <&dmsc>;
-       ti,sci-dst-id = <56>;
-       ti,sci-rm-range-girq = <0x1>;
-};
-
-main_gpio0: gpio@600000 {
-       ...
-       interrupt-parent = <&main_intr>;
-       interrupts = <57 256>, <57 257>, <57 258>,
-                    <57 259>, <57 260>, <57 261>;
-       ...
-};
diff --git a/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml b/Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml
new file mode 100644 (file)
index 0000000..cff6a95
--- /dev/null
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/ti,sci-intr.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments K3 Interrupt Router
+
+maintainers:
+  - Lokesh Vutla <lokeshvutla@ti.com>
+
+allOf:
+  - $ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
+
+description: |
+  The Interrupt Router (INTR) module provides a mechanism to mux M
+  interrupt inputs to N interrupt outputs, where all M inputs are selectable
+  to be driven per N output. An Interrupt Router can either handle edge
+  triggered or level triggered interrupts and that is fixed in hardware.
+
+                                   Interrupt Router
+                               +----------------------+
+                               |  Inputs     Outputs  |
+          +-------+            | +------+    +-----+  |
+          | GPIO  |----------->| | irq0 |    |  0  |  |       Host IRQ
+          +-------+            | +------+    +-----+  |      controller
+                               |    .           .     |      +-------+
+          +-------+            |    .           .     |----->|  IRQ  |
+          | INTA  |----------->|    .           .     |      +-------+
+          +-------+            |    .        +-----+  |
+                               | +------+    |  N  |  |
+                               | | irqM |    +-----+  |
+                               | +------+             |
+                               |                      |
+                               +----------------------+
+
+  There is one register per output (MUXCNTL_N) that controls the selection.
+  Configuration of these MUXCNTL_N registers is done by a system controller
+  (like the Device Memory and Security Controller on K3 AM654 SoC). System
+  controller will keep track of the used and unused registers within the Router.
+  Driver should request the system controller to get the range of GIC IRQs
+  assigned to the requesting hosts. It is the drivers responsibility to keep
+  track of Host IRQs.
+
+  Communication between the host processor running an OS and the system
+  controller happens through a protocol called TI System Control Interface
+  (TISCI protocol).
+
+properties:
+  compatible:
+    const: ti,sci-intr
+
+  ti,intr-trigger-type:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 4]
+    description: |
+      Should be one of the following.
+        1 = If intr supports edge triggered interrupts.
+        4 = If intr supports level triggered interrupts.
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 1
+    description: |
+      The 1st cell should contain interrupt router input hw number.
+
+  ti,interrupt-ranges:
+    $ref: /schemas/types.yaml#/definitions/uint32-matrix
+    description: |
+      Interrupt ranges that converts the INTR output hw irq numbers
+      to parents's input interrupt numbers.
+    items:
+      items:
+        - description: |
+            "output_irq" specifies the base for intr output irq
+        - description: |
+            "parent's input irq" specifies the base for parent irq
+        - description: |
+            "limit" specifies the limit for translation
+
+required:
+  - compatible
+  - ti,intr-trigger-type
+  - interrupt-controller
+  - '#interrupt-cells'
+  - ti,sci
+  - ti,sci-dev-id
+  - ti,interrupt-ranges
+
+examples:
+  - |
+    main_gpio_intr: interrupt-controller0 {
+        compatible = "ti,sci-intr";
+        ti,intr-trigger-type = <1>;
+        interrupt-controller;
+        interrupt-parent = <&gic500>;
+        #interrupt-cells = <1>;
+        ti,sci = <&dmsc>;
+        ti,sci-dev-id = <131>;
+        ti,interrupt-ranges = <0 360 32>;
+    };
index 24ad1446445ea4ae1ad3e29f1351919d2cfabef7..fe7fa25877fd20741551573b6d653664abd0a86c 100644 (file)
@@ -30,7 +30,7 @@ properties:
     const: 0
 
 patternProperties:
-  "^multi-led[0-9a-f]$":
+  "^multi-led@[0-9a-b]$":
     type: object
     allOf:
       - $ref: leds-class-multicolor.yaml#
diff --git a/Documentation/devicetree/bindings/media/i2c/imx274.txt b/Documentation/devicetree/bindings/media/i2c/imx274.txt
deleted file mode 100644 (file)
index 0727079..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-* Sony 1/2.5-Inch 8.51Mp CMOS Digital Image Sensor
-
-The Sony imx274 is a 1/2.5-inch CMOS active pixel digital image sensor with
-an active array size of 3864H x 2202V. It is programmable through I2C
-interface. The I2C address is fixed to 0x1a as per sensor data sheet.
-Image data is sent through MIPI CSI-2, which is configured as 4 lanes
-at 1440 Mbps.
-
-
-Required Properties:
-- compatible: value should be "sony,imx274" for imx274 sensor
-- reg: I2C bus address of the device
-
-Optional Properties:
-- reset-gpios: Sensor reset GPIO
-- clocks: Reference to the input clock.
-- clock-names: Should be "inck".
-- VANA-supply: Sensor 2.8v analog supply.
-- VDIG-supply: Sensor 1.8v digital core supply.
-- VDDL-supply: Sensor digital IO 1.2v supply.
-
-The imx274 device node should contain one 'port' child node with
-an 'endpoint' subnode. For further reading on port node refer to
-Documentation/devicetree/bindings/media/video-interfaces.txt.
-
-Example:
-       sensor@1a {
-               compatible = "sony,imx274";
-               reg = <0x1a>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-               reset-gpios = <&gpio_sensor 0 0>;
-               port {
-                       sensor_out: endpoint {
-                               remote-endpoint = <&csiss_in>;
-                       };
-               };
-       };
diff --git a/Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml b/Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml
new file mode 100644 (file)
index 0000000..f697e1a
--- /dev/null
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/sony,imx274.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sony 1/2.5-Inch 8.51MP CMOS Digital Image Sensor
+
+maintainers:
+  - Leon Luo <leonl@leopardimaging.com>
+
+description: |
+  The Sony IMX274 is a 1/2.5-inch CMOS active pixel digital image sensor with an
+  active array size of 3864H x 2202V. It is programmable through I2C interface.
+  Image data is sent through MIPI CSI-2, which is configured as 4 lanes at 1440
+  Mbps.
+
+properties:
+  compatible:
+    const: sony,imx274
+
+  reg:
+    const: 0x1a
+
+  reset-gpios:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: inck
+
+  vana-supply:
+    description: Sensor 2.8 V analog supply.
+    maxItems: 1
+
+  vdig-supply:
+    description: Sensor 1.8 V digital core supply.
+    maxItems: 1
+
+  vddl-supply:
+    description: Sensor digital IO 1.2 V supply.
+    maxItems: 1
+
+  port:
+    type: object
+    description: Output video port. See ../video-interfaces.txt.
+
+required:
+  - compatible
+  - reg
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        imx274: camera-sensor@1a {
+            compatible = "sony,imx274";
+            reg = <0x1a>;
+            reset-gpios = <&gpio_sensor 0 0>;
+
+            port {
+                sensor_out: endpoint {
+                    remote-endpoint = <&csiss_in>;
+                };
+            };
+        };
+    };
+
+...
index 5887c917d480be82b19cc6c588cacd19503226cd..58fe9d02a781a035c1b35a0a234a98f8652293bf 100644 (file)
@@ -30,9 +30,13 @@ allOf:
     then:
       properties:
         clock-output-names:
-          items:
-            - const: clk_out_sd0
-            - const: clk_in_sd0
+          oneOf:
+            - items:
+              - const: clk_out_sd0
+              - const: clk_in_sd0
+            - items:
+              - const: clk_out_sd1
+              - const: clk_in_sd1
 
 properties:
   compatible:
index 0c9cf6a8808c10e516dec5771ae6349754cc03d9..26a8f320a15636a26f0bb583b30fe16898050b44 100644 (file)
@@ -50,6 +50,8 @@ Optional properties:
                     error caused by stop clock(fifo full)
                     Valid range = [0:0x7]. if not present, default value is 0.
                     applied to compatible "mediatek,mt2701-mmc".
+- resets: Phandle and reset specifier pair to softreset line of MSDC IP.
+- reset-names: Should be "hrst".
 
 Examples:
 mmc0: mmc@11230000 {
index 2cf3affa1be705b37a1bf95879980df3ffc4e157..96c0b1440c9c5fe942e99c8f294cddaf5d84625a 100644 (file)
@@ -15,8 +15,15 @@ Required properties:
   - "nvidia,tegra210-sdhci": for Tegra210
   - "nvidia,tegra186-sdhci": for Tegra186
   - "nvidia,tegra194-sdhci": for Tegra194
-- clocks : Must contain one entry, for the module clock.
-  See ../clocks/clock-bindings.txt for details.
+- clocks: For Tegra210, Tegra186 and Tegra194 must contain two entries.
+         One for the module clock and one for the timeout clock.
+         For all other Tegra devices, must contain a single entry for
+         the module clock. See ../clocks/clock-bindings.txt for details.
+- clock-names: For Tegra210, Tegra186 and Tegra194 must contain the
+              strings 'sdhci' and 'tmclk' to represent the module and
+              the timeout clocks, respectively.
+              For all other Tegra devices must contain the string 'sdhci'
+              to represent the module clock.
 - resets : Must contain an entry for each entry in reset-names.
   See ../reset/reset.txt for details.
 - reset-names : Must include the following entries:
@@ -99,7 +106,7 @@ Optional properties for Tegra210, Tegra186 and Tegra194:
 
 Example:
 sdhci@700b0000 {
-       compatible = "nvidia,tegra210-sdhci", "nvidia,tegra124-sdhci";
+       compatible = "nvidia,tegra124-sdhci";
        reg = <0x0 0x700b0000 0x0 0x200>;
        interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&tegra_car TEGRA210_CLK_SDMMC1>;
@@ -115,3 +122,22 @@ sdhci@700b0000 {
        nvidia,pad-autocal-pull-down-offset-1v8 = <0x7b>;
        status = "disabled";
 };
+
+sdhci@700b0000 {
+       compatible = "nvidia,tegra210-sdhci";
+       reg = <0x0 0x700b0000 0x0 0x200>;
+       interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
+       clocks = <&tegra_car TEGRA210_CLK_SDMMC1>,
+                <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
+       clock-names = "sdhci", "tmclk";
+       resets = <&tegra_car 14>;
+       reset-names = "sdhci";
+       pinctrl-names = "sdmmc-3v3", "sdmmc-1v8";
+       pinctrl-0 = <&sdmmc1_3v3>;
+       pinctrl-1 = <&sdmmc1_1v8>;
+       nvidia,pad-autocal-pull-up-offset-3v3 = <0x00>;
+       nvidia,pad-autocal-pull-down-offset-3v3 = <0x7d>;
+       nvidia,pad-autocal-pull-up-offset-1v8 = <0x7b>;
+       nvidia,pad-autocal-pull-down-offset-1v8 = <0x7b>;
+       status = "disabled";
+};
index bf7328aba3305f122345cfb528b7d35c0b8965ea..dab208b5c7c7e007bb40c01c31b8025d61e72120 100644 (file)
@@ -1,4 +1,4 @@
 Distributed Switch Architecture Device Tree Bindings
 ----------------------------------------------------
 
-See Documentation/devicetree/bindings/net/dsa/dsa.yaml for the documenation.
+See Documentation/devicetree/bindings/net/dsa/dsa.yaml for the documentation.
index f5e518d099f2c2057afe360b824c1d88bb2203b5..62d4ed2d7fd79e6eb6ab69647a380fd78a1a34eb 100644 (file)
@@ -23,8 +23,8 @@ Required properties:
 
 - compatible:
     Must be one of :
-    "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-qspi" : MSPI+BSPI on BRCMSTB SoCs
-    "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI
+    "brcm,spi-brcmstb-qspi", "brcm,spi-bcm-qspi" : MSPI+BSPI on BRCMSTB SoCs
+    "brcm,spi-brcmstb-mspi", "brcm,spi-bcm-qspi" : Second Instance of MSPI
                                                   BRCMSTB  SoCs
     "brcm,spi-bcm7425-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI
                                                                            BRCMSTB  SoCs
@@ -36,8 +36,8 @@ Required properties:
                                                                            BRCMSTB  SoCs
     "brcm,spi-bcm7278-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI
                                                                            BRCMSTB  SoCs
-    "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"     : MSPI+BSPI on Cygnus, NSP
-    "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi"     : NS2 SoCs
+    "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"     : MSPI+BSPI on Cygnus, NSP
+    "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi"     : NS2 SoCs
 
 - reg:
     Define the bases and ranges of the associated I/O address spaces.
@@ -86,7 +86,7 @@ BRCMSTB SoC Example:
     spi@f03e3400 {
                #address-cells = <0x1>;
                #size-cells = <0x0>;
-               compatible = "brcm,spi-brcmstb-qspi", "brcm,spi-brcmstb-qspi";
+               compatible = "brcm,spi-brcmstb-qspi", "brcm,spi-bcm-qspi";
                reg = <0xf03e0920 0x4 0xf03e3400 0x188 0xf03e3200 0x50>;
                reg-names = "cs_reg", "mspi", "bspi";
                interrupts = <0x6 0x5 0x4 0x3 0x2 0x1 0x0>;
@@ -149,7 +149,7 @@ BRCMSTB SoC Example:
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&upg_fixed>;
-               compatible = "brcm,spi-brcmstb-qspi", "brcm,spi-brcmstb-mspi";
+               compatible = "brcm,spi-brcmstb-mspi", "brcm,spi-bcm-qspi";
                reg = <0xf0416000 0x180>;
                reg-names = "mspi";
                interrupts = <0x14>;
@@ -160,7 +160,7 @@ BRCMSTB SoC Example:
 iProc SoC Example:
 
     qspi: spi@18027200 {
-       compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
+       compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
        reg = <0x18027200 0x184>,
              <0x18027000 0x124>,
              <0x1811c408 0x004>,
@@ -191,7 +191,7 @@ iProc SoC Example:
  NS2 SoC Example:
 
               qspi: spi@66470200 {
-                      compatible = "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi";
+                      compatible = "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi";
                       reg = <0x66470200 0x184>,
                             <0x66470000 0x124>,
                             <0x67017408 0x004>,
index 100bfd22726537e372f362ff10c3ca2db551dd30..13ea0cc0a3fa2eb442f6d2b5ab122b8f47aefc07 100644 (file)
@@ -179,7 +179,7 @@ DMA Fence uABI/Sync File
    :internal:
 
 Indefinite DMA Fences
-~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~
 
 At various times &dma_fence with an indefinite time until dma_fence_wait()
 finishes have been proposed. Examples include:
index 71c5a40da3203d0a2268dd7beed9f0e0d2cf3e20..ccd677ba7d769d5cb178e16ccee4e34324a07fb9 100644 (file)
@@ -6,9 +6,9 @@ API to implement a new FPGA bridge
 
 * struct :c:type:`fpga_bridge` â€” The FPGA Bridge structure
 * struct :c:type:`fpga_bridge_ops` â€” Low level Bridge driver ops
-* :c:func:`devm_fpga_bridge_create()` â€” Allocate and init a bridge struct
-* :c:func:`fpga_bridge_register()` â€” Register a bridge
-* :c:func:`fpga_bridge_unregister()` â€” Unregister a bridge
+* devm_fpga_bridge_create() â€” Allocate and init a bridge struct
+* fpga_bridge_register() â€” Register a bridge
+* fpga_bridge_unregister() â€” Unregister a bridge
 
 .. kernel-doc:: include/linux/fpga/fpga-bridge.h
    :functions: fpga_bridge
index 576f1945eacd9c0a26544ae1ee21defe55d17656..af5382af1379b878ea2b251a3bf7047b2d03bc97 100644 (file)
@@ -104,9 +104,9 @@ API for implementing a new FPGA Manager driver
 * ``fpga_mgr_states`` â€”  Values for :c:member:`fpga_manager->state`.
 * struct :c:type:`fpga_manager` â€”  the FPGA manager struct
 * struct :c:type:`fpga_manager_ops` â€”  Low level FPGA manager driver ops
-* :c:func:`devm_fpga_mgr_create` â€”  Allocate and init a manager struct
-* :c:func:`fpga_mgr_register` â€”  Register an FPGA manager
-* :c:func:`fpga_mgr_unregister` â€”  Unregister an FPGA manager
+* devm_fpga_mgr_create() â€”  Allocate and init a manager struct
+* fpga_mgr_register() â€”  Register an FPGA manager
+* fpga_mgr_unregister() â€”  Unregister an FPGA manager
 
 .. kernel-doc:: include/linux/fpga/fpga-mgr.h
    :functions: fpga_mgr_states
index b5484df6ff0f50d5833418fa1739ec1733ba9632..f487ad64dfb980db388252f4cfdaf8b6d9198dac 100644 (file)
@@ -6,9 +6,9 @@ Overview
 
 The in-kernel API for FPGA programming is a combination of APIs from
 FPGA manager, bridge, and regions.  The actual function used to
-trigger FPGA programming is :c:func:`fpga_region_program_fpga()`.
+trigger FPGA programming is fpga_region_program_fpga().
 
-:c:func:`fpga_region_program_fpga()` uses functionality supplied by
+fpga_region_program_fpga() uses functionality supplied by
 the FPGA manager and bridges.  It will:
 
  * lock the region's mutex
@@ -20,8 +20,8 @@ the FPGA manager and bridges.  It will:
  * release the locks
 
 The struct fpga_image_info specifies what FPGA image to program.  It is
-allocated/freed by :c:func:`fpga_image_info_alloc()` and freed with
-:c:func:`fpga_image_info_free()`
+allocated/freed by fpga_image_info_alloc() and freed with
+fpga_image_info_free()
 
 How to program an FPGA using a region
 -------------------------------------
@@ -84,10 +84,10 @@ will generate that list.  Here's some sample code of what to do next::
 API for programming an FPGA
 ---------------------------
 
-* :c:func:`fpga_region_program_fpga` â€”  Program an FPGA
-* :c:type:`fpga_image_info` â€”  Specifies what FPGA image to program
-* :c:func:`fpga_image_info_alloc()` â€”  Allocate an FPGA image info struct
-* :c:func:`fpga_image_info_free()` â€”  Free an FPGA image info struct
+* fpga_region_program_fpga() â€”  Program an FPGA
+* fpga_image_info() â€”  Specifies what FPGA image to program
+* fpga_image_info_alloc() â€”  Allocate an FPGA image info struct
+* fpga_image_info_free() â€”  Free an FPGA image info struct
 
 .. kernel-doc:: drivers/fpga/fpga-region.c
    :functions: fpga_region_program_fpga
index 0529b2d2231a74d07b7a55acc2ce78a28e27bd15..31118a8ba218fa4dd769f047518c3a99b94e1e70 100644 (file)
@@ -46,18 +46,18 @@ API to add a new FPGA region
 ----------------------------
 
 * struct :c:type:`fpga_region` â€” The FPGA region struct
-* :c:func:`devm_fpga_region_create` â€” Allocate and init a region struct
-* :c:func:`fpga_region_register` â€”  Register an FPGA region
-* :c:func:`fpga_region_unregister` â€”  Unregister an FPGA region
+* devm_fpga_region_create() â€” Allocate and init a region struct
+* fpga_region_register() â€”  Register an FPGA region
+* fpga_region_unregister() â€”  Unregister an FPGA region
 
 The FPGA region's probe function will need to get a reference to the FPGA
 Manager it will be using to do the programming.  This usually would happen
 during the region's probe function.
 
-* :c:func:`fpga_mgr_get` â€” Get a reference to an FPGA manager, raise ref count
-* :c:func:`of_fpga_mgr_get` â€”  Get a reference to an FPGA manager, raise ref count,
+* fpga_mgr_get() â€” Get a reference to an FPGA manager, raise ref count
+* of_fpga_mgr_get() â€”  Get a reference to an FPGA manager, raise ref count,
   given a device node.
-* :c:func:`fpga_mgr_put` â€” Put an FPGA manager
+* fpga_mgr_put() â€” Put an FPGA manager
 
 The FPGA region will need to specify which bridges to control while programming
 the FPGA.  The region driver can build a list of bridges during probe time
@@ -66,11 +66,11 @@ the list of bridges to program just before programming
 (:c:member:`fpga_region->get_bridges`).  The FPGA bridge framework supplies the
 following APIs to handle building or tearing down that list.
 
-* :c:func:`fpga_bridge_get_to_list` â€” Get a ref of an FPGA bridge, add it to a
+* fpga_bridge_get_to_list() â€” Get a ref of an FPGA bridge, add it to a
   list
-* :c:func:`of_fpga_bridge_get_to_list` â€” Get a ref of an FPGA bridge, add it to a
+* of_fpga_bridge_get_to_list() â€” Get a ref of an FPGA bridge, add it to a
   list, given a device node
-* :c:func:`fpga_bridges_put` â€” Given a list of bridges, put them
+* fpga_bridges_put() â€” Given a list of bridges, put them
 
 .. kernel-doc:: include/linux/fpga/fpga-region.h
    :functions: fpga_region
index b0bc0c028cc500d242632a653705ea7ac221581c..51b21e00239612052476d897f16b5f95b7a58563 100644 (file)
@@ -11,10 +11,10 @@ Industrial I/O Devices
 ----------------------
 
 * struct :c:type:`iio_dev` - industrial I/O device
-* :c:func:`iio_device_alloc()` - allocate an :c:type:`iio_dev` from a driver
-* :c:func:`iio_device_free()` - free an :c:type:`iio_dev` from a driver
-* :c:func:`iio_device_register()` - register a device with the IIO subsystem
-* :c:func:`iio_device_unregister()` - unregister a device from the IIO
+* iio_device_alloc() - allocate an :c:type:`iio_dev` from a driver
+* iio_device_free() - free an :c:type:`iio_dev` from a driver
+* iio_device_register() - register a device with the IIO subsystem
+* iio_device_unregister() - unregister a device from the IIO
   subsystem
 
 An IIO device usually corresponds to a single hardware sensor and it
@@ -34,17 +34,17 @@ A typical IIO driver will register itself as an :doc:`I2C <../i2c>` or
 
 At probe:
 
-1. Call :c:func:`iio_device_alloc()`, which allocates memory for an IIO device.
+1. Call iio_device_alloc(), which allocates memory for an IIO device.
 2. Initialize IIO device fields with driver specific information (e.g.
    device name, device channels).
-3. Call :c:func:`iio_device_register()`, this registers the device with the
+3. Call iio_device_register(), this registers the device with the
    IIO core. After this call the device is ready to accept requests from user
    space applications.
 
 At remove, we free the resources allocated in probe in reverse order:
 
-1. :c:func:`iio_device_unregister()`, unregister the device from the IIO core.
-2. :c:func:`iio_device_free()`, free the memory allocated for the IIO device.
+1. iio_device_unregister(), unregister the device from the IIO core.
+2. iio_device_free(), free the memory allocated for the IIO device.
 
 IIO device sysfs interface
 ==========================
index cdb2e829228e3efc7104b411cc7323173ac45c5e..1d4427890d75913a2397fa8c510977cbc232a8d2 100644 (file)
@@ -3,7 +3,7 @@ NVMe Fault Injection
 Linux's fault injection framework provides a systematic way to support
 error injection via debugfs in the /sys/kernel/debug directory. When
 enabled, the default NVME_SC_INVALID_OPCODE with no retry will be
-injected into the nvme_end_request. Users can change the default status
+injected into the nvme_try_complete_req. Users can change the default status
 code and no retry flag via the debugfs. The list of Generic Command
 Status can be found in include/linux/nvme.h
 
index 53da483c8326a160822cedb625c26b6704c97067..1c49723e7534577b770a0a16507a3a71a6b2524b 100644 (file)
@@ -22,7 +22,7 @@
     |       nios2: | TODO |
     |    openrisc: | TODO |
     |      parisc: | TODO |
-    |     powerpc: |  ok  |
+    |     powerpc: | TODO |
     |       riscv: |  ok  |
     |        s390: |  ok  |
     |          sh: | TODO |
index 7f1a40dce6d3d641aef598f0bdf481f567ea457d..5776cbd5fa53295d97d637df8a8381df43aaa78c 100644 (file)
@@ -110,13 +110,15 @@ The Amiga protection flags RWEDRWEDHSPARWED are handled as follows:
 
   - R maps to r for user, group and others. On directories, R implies x.
 
-  - If both W and D are allowed, w will be set.
+  - W maps to w.
 
   - E maps to x.
 
-  - H and P are always retained and ignored under Linux.
+  - D is ignored.
 
-  - A is always reset when a file is written to.
+  - H, S and P are always retained and ignored under Linux.
+
+  - A is cleared when a file is written to.
 
 User id and group id will be used unless set[gu]id are given as mount
 options. Since most of the Amiga file systems are single user systems
@@ -128,11 +130,13 @@ Linux -> Amiga:
 
 The Linux rwxrwxrwx file mode is handled as follows:
 
-  - r permission will set R for user, group and others.
+  - r permission will allow R for user, group and others.
+
+  - w permission will allow W for user, group and others.
 
-  - w permission will set W and D for user, group and others.
+  - x permission of the user will allow E for plain files.
 
-  - x permission of the user will set E for plain files.
+  - D will be allowed for user, group and others.
 
   - All other flags (suid, sgid, ...) are ignored and will
     not be retained.
index 6d5253e2223ba66cdb0d538913ff66d6a99aed7e..0cd61471d2a22c473f4a7f0da8c17bad47496b94 100644 (file)
@@ -68,7 +68,7 @@ See below for all known bank addresses, numbers of sensors in that bank,
 number of bytes data per sensor and contents/meaning of those bytes.
 
 Although both this document and the kernel driver have kept the sensor
-terminoligy for the addressing within a bank this is not 100% correct, in
+terminology for the addressing within a bank this is not 100% correct, in
 bank 0x24 for example the addressing within the bank selects a PWM output not
 a sensor.
 
@@ -155,7 +155,7 @@ After wider testing of the Linux kernel driver some variants of the uGuru have
 turned up which do not hold 0x08 at DATA within 250 reads after writing the
 bank address. With these versions this happens quite frequent, using larger
 timeouts doesn't help, they just go offline for a second or 2, doing some
-internal callibration or whatever. Your code should be prepared to handle
+internal calibration or whatever. Your code should be prepared to handle
 this and in case of no response in this specific case just goto sleep for a
 while and then retry.
 
@@ -331,6 +331,6 @@ the voltage / clock programming out, I tried reading and only reading banks
 0-0x30 with the reading code used for the sensor banks (0x20-0x28) and this
 resulted in a _permanent_ reprogramming of the voltages, luckily I had the
 sensors part configured so that it would shutdown my system on any out of spec
-voltages which proprably safed my computer (after a reboot I managed to
+voltages which probably safed my computer (after a reboot I managed to
 immediately enter the bios and reload the defaults). This probably means that
 the read/write cycle for the non sensor part is different from the sensor part.
index d8243c827de995cd7d39cd71604808da934ceca1..cfda60b757ce53662c13564c0347bb2d246d6207 100644 (file)
@@ -17,7 +17,7 @@ Supported chips:
     Note:
        The uGuru is a microcontroller with onboard firmware which programs
        it to behave as a hwmon IC. There are many different revisions of the
-       firmware and thus effectivly many different revisions of the uGuru.
+       firmware and thus effectively many different revisions of the uGuru.
        Below is an incomplete list with which revisions are used for which
        Motherboards:
 
@@ -33,7 +33,7 @@ Supported chips:
        sensortype (Volt or Temp) for bank1 sensors, for revision 1 uGuru's
        this does not always work. For these uGuru's the autodetection can
        be overridden with the bank1_types module param. For all 3 known
-       revison 1 motherboards the correct use of this param is:
+       revision 1 motherboards the correct use of this param is:
        bank1_types=1,1,0,0,0,0,0,2,0,0,0,0,2,0,0,1
        You may also need to specify the fan_sensors option for these boards
        fan_sensors=5
index 514f11f41e8b523025f31482d081c9d09bad503c..88046d8663857978ea530a09725c0bb4996c0701 100644 (file)
@@ -13,7 +13,7 @@ Supported chips:
     Note:
        The uGuru is a microcontroller with onboard firmware which programs
        it to behave as a hwmon IC. There are many different revisions of the
-       firmware and thus effectivly many different revisions of the uGuru.
+       firmware and thus effectively many different revisions of the uGuru.
        Below is an incomplete list with which revisions are used for which
        Motherboards:
 
@@ -24,7 +24,7 @@ Supported chips:
        - uGuru 3.0.0.0 ~ 3.0.x.x (AW8, AL8, AT8, NI8 SLI, AT8 32X, AN8 32X,
          AW9D-MAX)
 
-       The abituguru3 driver is only for revison 3.0.x.x motherboards,
+       The abituguru3 driver is only for revision 3.0.x.x motherboards,
        this driver will not work on older motherboards. For older
        motherboards use the abituguru (without the 3 !) driver.
 
index 2aac50b97921f09e9d777a4c39257f30f163efec..dae90c21aed30dc6a9a95215c4b69c50ab917176 100644 (file)
@@ -23,8 +23,8 @@ supports C and the GNU C extensions required by the kernel, and is pronounced
 Clang
 -----
 
-The compiler used can be swapped out via `CC=` command line argument to `make`.
-`CC=` should be set when selecting a config and during a build.
+The compiler used can be swapped out via ``CC=`` command line argument to ``make``.
+``CC=`` should be set when selecting a config and during a build. ::
 
        make CC=clang defconfig
 
@@ -34,33 +34,33 @@ Cross Compiling
 ---------------
 
 A single Clang compiler binary will typically contain all supported backends,
-which can help simplify cross compiling.
+which can help simplify cross compiling. ::
 
        ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
 
-`CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead
-`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
-example:
+``CROSS_COMPILE`` is not used to prefix the Clang compiler binary, instead
+``CROSS_COMPILE`` is used to set a command line flag: ``--target=<triple>``. For
+example: ::
 
-       clang --target aarch64-linux-gnu foo.c
+       clang --target=aarch64-linux-gnu foo.c
 
 LLVM Utilities
 --------------
 
-LLVM has substitutes for GNU binutils utilities. Kbuild supports `LLVM=1`
-to enable them.
+LLVM has substitutes for GNU binutils utilities. Kbuild supports ``LLVM=1``
+to enable them. ::
 
        make LLVM=1
 
-They can be enabled individually. The full list of the parameters:
+They can be enabled individually. The full list of the parameters: ::
 
-       make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
-         OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\
-         READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
+       make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \
+         OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \
+         READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \
          HOSTLD=ld.lld
 
 Currently, the integrated assembler is disabled by default. You can pass
-`LLVM_IAS=1` to enable it.
+``LLVM_IAS=1`` to enable it.
 
 Getting Help
 ------------
index b81b8913a5a3714c60ef475ea2901bfe9c281808..58d513a0fa95d706add7d02b60c183994d6d4047 100644 (file)
@@ -16,7 +16,7 @@ This document describes the Linux kernel Makefiles.
           --- 3.5 Library file goals - lib-y
           --- 3.6 Descending down in directories
           --- 3.7 Compilation flags
-          --- 3.8 Command line dependency
+          --- 3.8 <deleted>
           --- 3.9 Dependency tracking
           --- 3.10 Special Rules
           --- 3.11 $(CC) support functions
@@ -39,8 +39,8 @@ This document describes the Linux kernel Makefiles.
 
        === 7 Architecture Makefiles
           --- 7.1 Set variables to tweak the build to the architecture
-          --- 7.2 Add prerequisites to archheaders:
-          --- 7.3 Add prerequisites to archprepare:
+          --- 7.2 Add prerequisites to archheaders
+          --- 7.3 Add prerequisites to archprepare
           --- 7.4 List directories to visit when descending
           --- 7.5 Architecture-specific boot images
           --- 7.6 Building non-kbuild targets
@@ -129,7 +129,7 @@ The preferred name for the kbuild files are 'Makefile' but 'Kbuild' can
 be used and if both a 'Makefile' and a 'Kbuild' file exists, then the 'Kbuild'
 file will be used.
 
-Section 3.1 "Goal definitions" is a quick intro, further chapters provide
+Section 3.1 "Goal definitions" is a quick intro; further chapters provide
 more details, with real examples.
 
 3.1 Goal definitions
@@ -965,7 +965,7 @@ When kbuild executes, the following steps are followed (roughly):
                KBUILD_LDFLAGS         := -m elf_s390
 
        Note: ldflags-y can be used to further customise
-       the flags used. See chapter 3.7.
+       the flags used. See section 3.7.
 
     LDFLAGS_vmlinux
        Options for $(LD) when linking vmlinux
@@ -1121,7 +1121,7 @@ When kbuild executes, the following steps are followed (roughly):
 
        In this example, the file target maketools will be processed
        before descending down in the subdirectories.
-       See also chapter XXX-TODO that describe how kbuild supports
+       See also chapter XXX-TODO that describes how kbuild supports
        generating offset header files.
 
 
@@ -1261,7 +1261,7 @@ When kbuild executes, the following steps are followed (roughly):
        always be built.
        Assignments to $(targets) are without $(obj)/ prefix.
        if_changed may be used in conjunction with custom commands as
-       defined in 6.8 "Custom kbuild commands".
+       defined in 7.8 "Custom kbuild commands".
 
        Note: It is a typical mistake to forget the FORCE prerequisite.
        Another common pitfall is that whitespace is sometimes
@@ -1411,7 +1411,7 @@ When kbuild executes, the following steps are followed (roughly):
        that may be shared between individual architectures.
        The recommended approach how to use a generic header file is
        to list the file in the Kbuild file.
-       See "7.2 generic-y" for further info on syntax etc.
+       See "8.2 generic-y" for further info on syntax etc.
 
 7.11 Post-link pass
 -------------------
@@ -1601,4 +1601,4 @@ is the right choice.
 
 - Describe how kbuild supports shipped files with _shipped.
 - Generating offset header files.
-- Add more variables to section 7?
+- Add more variables to chapters 7 or 9?
index 4cefed8048ca42c473148c113529c11ffbb5d9ba..ddada4a53749364b86a9d11f11d2dcf4b7470ca6 100644 (file)
@@ -164,14 +164,14 @@ by disabling preemption or interrupts.
 On non-PREEMPT_RT kernels local_lock operations map to the preemption and
 interrupt disabling and enabling primitives:
 
- =========================== ======================
- local_lock(&llock)          preempt_disable()
- local_unlock(&llock)        preempt_enable()
- local_lock_irq(&llock)      local_irq_disable()
- local_unlock_irq(&llock)    local_irq_enable()
- local_lock_save(&llock)     local_irq_save()
- local_lock_restore(&llock)  local_irq_save()
- =========================== ======================
+ ===============================  ======================
+ local_lock(&llock)               preempt_disable()
+ local_unlock(&llock)             preempt_enable()
+ local_lock_irq(&llock)           local_irq_disable()
+ local_unlock_irq(&llock)         local_irq_enable()
+ local_lock_irqsave(&llock)       local_irq_save()
+ local_unlock_irqrestore(&llock)  local_irq_restore()
+ ===============================  ======================
 
 The named scope of local_lock has two advantages over the regular
 primitives:
@@ -353,14 +353,14 @@ protection scope. So the following substitution is wrong::
   {
     local_irq_save(flags);    -> local_lock_irqsave(&local_lock_1, flags);
     func3();
-    local_irq_restore(flags); -> local_lock_irqrestore(&local_lock_1, flags);
+    local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock_1, flags);
   }
 
   func2()
   {
     local_irq_save(flags);    -> local_lock_irqsave(&local_lock_2, flags);
     func3();
-    local_irq_restore(flags); -> local_lock_irqrestore(&local_lock_2, flags);
+    local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock_2, flags);
   }
 
   func3()
@@ -379,14 +379,14 @@ PREEMPT_RT-specific semantics of spinlock_t. The correct substitution is::
   {
     local_irq_save(flags);    -> local_lock_irqsave(&local_lock, flags);
     func3();
-    local_irq_restore(flags); -> local_lock_irqrestore(&local_lock, flags);
+    local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock, flags);
   }
 
   func2()
   {
     local_irq_save(flags);    -> local_lock_irqsave(&local_lock, flags);
     func3();
-    local_irq_restore(flags); -> local_lock_irqrestore(&local_lock, flags);
+    local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock, flags);
   }
 
   func3()
index 227f427118e816896d0407f4178673dbc884f9f8..b7a627d6c97dc672c7060c30d632c8c1384d1b01 100644 (file)
@@ -101,3 +101,4 @@ to do something different in the near future.
 
    ../doc-guide/maintainer-profile
    ../nvdimm/maintainer-entry-profile
+   ../riscv/patch-acceptance
index af029b3ca2abe58ba54bff2fdbc7363248fa6a36..11bd5e6108c0049ce307b8d7f843c98dfe91571d 100644 (file)
@@ -180,7 +180,7 @@ The configuration can only be set up via VLAN tagging and bridge setup.
 
   # bring up the slave interfaces
   ip link set lan1 up
-  ip link set lan1 up
+  ip link set lan2 up
   ip link set lan3 up
 
   # create bridge
index d53bcb31645a4707ed9fd0bacaf912481097f7d6..b5a79881551f87c82b458f9061eafe5de318ca41 100644 (file)
@@ -206,6 +206,7 @@ Userspace to kernel:
   ``ETHTOOL_MSG_TSINFO_GET``           get timestamping info
   ``ETHTOOL_MSG_CABLE_TEST_ACT``        action start cable test
   ``ETHTOOL_MSG_CABLE_TEST_TDR_ACT``    action start raw TDR cable test
+  ``ETHTOOL_MSG_TUNNEL_INFO_GET``       get tunnel offload info
   ===================================== ================================
 
 Kernel to userspace:
@@ -239,6 +240,7 @@ Kernel to userspace:
   ``ETHTOOL_MSG_TSINFO_GET_REPLY``     timestamping info
   ``ETHTOOL_MSG_CABLE_TEST_NTF``        Cable test results
   ``ETHTOOL_MSG_CABLE_TEST_TDR_NTF``    Cable test TDR results
+  ``ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY`` tunnel offload info
   ===================================== =================================
 
 ``GET`` requests are sent by userspace applications to retrieve device
@@ -1363,4 +1365,5 @@ are netlink only.
   ``ETHTOOL_SFECPARAM``               n/a
   n/a                                 ''ETHTOOL_MSG_CABLE_TEST_ACT''
   n/a                                 ''ETHTOOL_MSG_CABLE_TEST_TDR_ACT''
+  n/a                                 ``ETHTOOL_MSG_TUNNEL_INFO_GET``
   =================================== =====================================
index 46caaadbb0290fe66eed0081ef8a62c5584ec695..379817ca64d2b729e36e8de4ba518df26f6cec23 100644 (file)
@@ -49,16 +49,18 @@ Register preservation rules
 Register preservation rules match the ELF ABI calling sequence with the
 following differences:
 
-=========== ============= ========================================
 --- For the sc instruction, differences with the ELF ABI ---
+=========== ============= ========================================
 r0          Volatile      (System call number.)
 r3          Volatile      (Parameter 1, and return value.)
 r4-r8       Volatile      (Parameters 2-6.)
 cr0         Volatile      (cr0.SO is the return error condition.)
 cr1, cr5-7  Nonvolatile
 lr          Nonvolatile
+=========== ============= ========================================
 
 --- For the scv 0 instruction, differences with the ELF ABI ---
+=========== ============= ========================================
 r0          Volatile      (System call number.)
 r3          Volatile      (Parameter 1, and return value.)
 r4-r8       Volatile      (Parameters 2-6.)
index 4a9aa4f0681e5de1b85e1000b54f3aee87f446e1..918e32d76fc44e42cbd76d0df473e144a04ff62e 100644 (file)
@@ -142,7 +142,7 @@ only NUL-terminated strings. The safe replacement is strscpy().
 (Users of strscpy() still needing NUL-padding should instead
 use strscpy_pad().)
 
-If a caller is using non-NUL-terminated strings, strncpy()() can
+If a caller is using non-NUL-terminated strings, strncpy() can
 still be used, but destinations should be marked with the `__nonstring
 <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_
 attribute to avoid future compiler warnings.
index 998f76e19cdd69788701ba6a1cb2a359268e396a..f3f4640ee2afc6242b1dbe6a47253530ad8a4358 100644 (file)
@@ -332,7 +332,7 @@ WO 9901953 (A1)
 
 
 US Patents (https://www.uspto.gov/)
-----------------------------------
+-----------------------------------
 
 US 5925841
        Digital Sampling Instrument employing cache memory (Jul. 20, 1999)
index eccb0f0ffd0ff865c216bf584ed3e2c4471936f4..2ce41d3822d8b9b148d00df721ba991527f49397 100644 (file)
@@ -337,7 +337,7 @@ WO 9901953 (A1)
 
 
 US Patents (https://www.uspto.gov/)
-----------------------------------
+-----------------------------------
 
 US 5925841
        Digital Sampling Instrument employing cache memory (Jul. 20, 1999)
index 2b0fff503415199d93092152b08c45cb5a796174..7c7ecf5dbc4bd75be49d0ed5953fb16376c3aa4a 100644 (file)
@@ -143,7 +143,7 @@ timestamp shows when the information is put together by the driver
 before returning from the ``STATUS`` and ``STATUS_EXT`` ioctl. in most cases
 this driver_timestamp will be identical to the regular system tstamp.
 
-Examples of typestamping with HDaudio:
+Examples of timestamping with HDAudio:
 
 1. DMA timestamp, no compensation for DMA+analog delay
 ::
index e108eaf82cf6719ddc02817c6bb83c7907fd54bd..a642ff3fdc8bbdfee5e7720891140dd69e90e411 100644 (file)
@@ -130,7 +130,7 @@ chi usa solo stringe terminate. La versione sicura da usare Ã¨
 strscpy(). (chi usa strscpy() e necessita di estendere la
 terminazione con NUL deve aggiungere una chiamata a memset())
 
-Se il chiamate no usa stringhe terminate con NUL, allore strncpy()()
+Se il chiamate no usa stringhe terminate con NUL, allore strncpy()
 può continuare ad essere usata, ma i buffer di destinazione devono essere
 marchiati con l'attributo `__nonstring <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_
 per evitare avvisi durante la compilazione.
index 57e752aaf414a7ab4aaf7590eae02491200e2dac..2044ed13cd9d7dfa4943e85d327cf16a51c9b681 100644 (file)
@@ -701,23 +701,6 @@ Memory Consistency Flags
     :stub-columns: 0
     :widths:       3 1 4
 
-    * .. _`V4L2-FLAG-MEMORY-NON-CONSISTENT`:
-
-      - ``V4L2_FLAG_MEMORY_NON_CONSISTENT``
-      - 0x00000001
-      - A buffer is allocated either in consistent (it will be automatically
-       coherent between the CPU and the bus) or non-consistent memory. The
-       latter can provide performance gains, for instance the CPU cache
-       sync/flush operations can be avoided if the buffer is accessed by the
-       corresponding device only and the CPU does not read/write to/from that
-       buffer. However, this requires extra care from the driver -- it must
-       guarantee memory consistency by issuing a cache flush/sync when
-       consistency is needed. If this flag is set V4L2 will attempt to
-       allocate the buffer in non-consistent memory. The flag takes effect
-       only if the buffer is used for :ref:`memory mapping <mmap>` I/O and the
-       queue reports the :ref:`V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS
-       <V4L2-BUF-CAP-SUPPORTS-MMAP-CACHE-HINTS>` capability.
-
 .. c:type:: v4l2_memory
 
 enum v4l2_memory
index f2a702870fadc1d6895da83a44b7bcbc0ffb9607..12cf6b44f414f7a011cc982c09a76428e63dc836 100644 (file)
@@ -120,13 +120,9 @@ than the number requested.
        If you want to just query the capabilities without making any
        other changes, then set ``count`` to 0, ``memory`` to
        ``V4L2_MEMORY_MMAP`` and ``format.type`` to the buffer type.
-    * - __u32
-      - ``flags``
-      - Specifies additional buffer management attributes.
-       See :ref:`memory-flags`.
 
     * - __u32
-      - ``reserved``\ [6]
+      - ``reserved``\ [7]
       - A place holder for future extensions. Drivers and applications
        must set the array to zero.
 
index 75d894d9c36c4294f330572f8e1673309e798ee0..0e3e2fde65e8506bfbc5a37b961d62b2909fcc16 100644 (file)
@@ -112,17 +112,10 @@ aborting or finishing any DMA in progress, an implicit
        ``V4L2_MEMORY_MMAP`` and ``type`` set to the buffer type. This will
        free any previously allocated buffers, so this is typically something
        that will be done at the start of the application.
-    * - union {
-      - (anonymous)
-    * - __u32
-      - ``flags``
-      - Specifies additional buffer management attributes.
-       See :ref:`memory-flags`.
     * - __u32
       - ``reserved``\ [1]
-      - Kept for backwards compatibility. Use ``flags`` instead.
-    * - }
-      -
+      - A place holder for future extensions. Drivers and applications
+       must set the array to zero.
 
 .. tabularcolumns:: |p{6.1cm}|p{2.2cm}|p{8.7cm}|
 
@@ -169,7 +162,6 @@ aborting or finishing any DMA in progress, an implicit
       - This capability is set by the driver to indicate that the queue supports
         cache and memory management hints. However, it's only valid when the
         queue is used for :ref:`memory mapping <mmap>` streaming I/O. See
-        :ref:`V4L2_FLAG_MEMORY_NON_CONSISTENT <V4L2-FLAG-MEMORY-NON-CONSISTENT>`,
         :ref:`V4L2_BUF_FLAG_NO_CACHE_INVALIDATE <V4L2-BUF-FLAG-NO-CACHE-INVALIDATE>` and
         :ref:`V4L2_BUF_FLAG_NO_CACHE_CLEAN <V4L2-BUF-FLAG-NO-CACHE-CLEAN>`.
 
index eb3a1316f03ec91fc1a310b29ad2191493bf102f..51191b56e61cbc1af31df42f76cca3df6eea1b43 100644 (file)
@@ -6130,7 +6130,7 @@ HvCallSendSyntheticClusterIpi, HvCallSendSyntheticClusterIpiEx.
 8.21 KVM_CAP_HYPERV_DIRECT_TLBFLUSH
 -----------------------------------
 
-:Architecture: x86
+:Architectures: x86
 
 This capability indicates that KVM running on top of Hyper-V hypervisor
 enables Direct TLB flush for its guests meaning that TLB flush
@@ -6143,19 +6143,53 @@ in CPUID and only exposes Hyper-V identification. In this case, guest
 thinks it's running on Hyper-V and only use Hyper-V hypercalls.
 
 8.22 KVM_CAP_S390_VCPU_RESETS
+-----------------------------
 
-Architectures: s390
+:Architectures: s390
 
 This capability indicates that the KVM_S390_NORMAL_RESET and
 KVM_S390_CLEAR_RESET ioctls are available.
 
 8.23 KVM_CAP_S390_PROTECTED
+---------------------------
 
-Architecture: s390
-
+:Architectures: s390
 
 This capability indicates that the Ultravisor has been initialized and
 KVM can therefore start protected VMs.
 This capability governs the KVM_S390_PV_COMMAND ioctl and the
 KVM_MP_STATE_LOAD MP_STATE. KVM_SET_MP_STATE can fail for protected
 guests when the state change is invalid.
+
+8.24 KVM_CAP_STEAL_TIME
+-----------------------
+
+:Architectures: arm64, x86
+
+This capability indicates that KVM supports steal time accounting.
+When steal time accounting is supported it may be enabled with
+architecture-specific interfaces.  This capability and the architecture-
+specific interfaces must be consistent, i.e. if one says the feature
+is supported, than the other should as well and vice versa.  For arm64
+see Documentation/virt/kvm/devices/vcpu.rst "KVM_ARM_VCPU_PVTIME_CTRL".
+For x86 see Documentation/virt/kvm/msr.rst "MSR_KVM_STEAL_TIME".
+
+8.25 KVM_CAP_S390_DIAG318
+-------------------------
+
+:Architectures: s390
+
+This capability enables a guest to set information about its control program
+(i.e. guest kernel type and version). The information is helpful during
+system/firmware service events, providing additional data about the guest
+environments running on the machine.
+
+The information is associated with the DIAGNOSE 0x318 instruction, which sets
+an 8-byte value consisting of a one-byte Control Program Name Code (CPNC) and
+a 7-byte Control Program Version Code (CPVC). The CPNC determines what
+environment the control program is running in (e.g. Linux, z/VM...), and the
+CPVC is used for information specific to OS (e.g. Linux version, Linux
+distribution...)
+
+If this capability is available, then the CPNC and CPVC can be synchronized
+between KVM and userspace via the sync regs mechanism (KVM_SYNC_DIAG318).
index f0068bceeb6158a30c6eee430ca6d2a7e4c4013a..190c7fa2ea010aad5e48aba914f552e5dc5ddb77 100644 (file)
@@ -1694,7 +1694,6 @@ F:        arch/arm/mach-cns3xxx/
 
 ARM/CAVIUM THUNDER NETWORK DRIVER
 M:     Sunil Goutham <sgoutham@marvell.com>
-M:     Robert Richter <rrichter@marvell.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Supported
 F:     drivers/net/ethernet/cavium/thunder/
@@ -3205,6 +3204,7 @@ S:        Maintained
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
 F:     block/
 F:     drivers/block/
+F:     include/linux/blk*
 F:     kernel/trace/blktrace.c
 F:     lib/sbitmap.c
 
@@ -3388,6 +3388,7 @@ M:        Florian Fainelli <f.fainelli@gmail.com>
 L:     netdev@vger.kernel.org
 L:     openwrt-devel@lists.openwrt.org (subscribers-only)
 S:     Supported
+F:     Documentation/devicetree/bindings/net/dsa/b53.txt
 F:     drivers/net/dsa/b53/*
 F:     include/linux/platform_data/b53.h
 
@@ -3573,13 +3574,28 @@ L:      bcm-kernel-feedback-list@broadcom.com
 S:     Maintained
 F:     drivers/phy/broadcom/phy-brcm-usb*
 
+BROADCOM ETHERNET PHY DRIVERS
+M:     Florian Fainelli <f.fainelli@gmail.com>
+L:     bcm-kernel-feedback-list@broadcom.com
+L:     netdev@vger.kernel.org
+S:     Supported
+F:     Documentation/devicetree/bindings/net/broadcom-bcm87xx.txt
+F:     drivers/net/phy/bcm*.[ch]
+F:     drivers/net/phy/broadcom.c
+F:     include/linux/brcmphy.h
+
 BROADCOM GENET ETHERNET DRIVER
 M:     Doug Berger <opendmb@gmail.com>
 M:     Florian Fainelli <f.fainelli@gmail.com>
 L:     bcm-kernel-feedback-list@broadcom.com
 L:     netdev@vger.kernel.org
 S:     Supported
+F:     Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
+F:     Documentation/devicetree/bindings/net/brcm,unimac-mdio.txt
 F:     drivers/net/ethernet/broadcom/genet/
+F:     drivers/net/mdio/mdio-bcm-unimac.c
+F:     include/linux/platform_data/bcmgenet.h
+F:     include/linux/platform_data/mdio-bcm-unimac.h
 
 BROADCOM IPROC ARM ARCHITECTURE
 M:     Ray Jui <rjui@broadcom.com>
@@ -3931,8 +3947,8 @@ W:        https://wireless.wiki.kernel.org/en/users/Drivers/carl9170
 F:     drivers/net/wireless/ath/carl9170/
 
 CAVIUM I2C DRIVER
-M:     Robert Richter <rrichter@marvell.com>
-S:     Supported
+M:     Robert Richter <rric@kernel.org>
+S:     Odd Fixes
 W:     http://www.marvell.com
 F:     drivers/i2c/busses/i2c-octeon*
 F:     drivers/i2c/busses/i2c-thunderx*
@@ -3947,8 +3963,8 @@ W:        http://www.marvell.com
 F:     drivers/net/ethernet/cavium/liquidio/
 
 CAVIUM MMC DRIVER
-M:     Robert Richter <rrichter@marvell.com>
-S:     Supported
+M:     Robert Richter <rric@kernel.org>
+S:     Odd Fixes
 W:     http://www.marvell.com
 F:     drivers/mmc/host/cavium*
 
@@ -3960,9 +3976,9 @@ W:        http://www.marvell.com
 F:     drivers/crypto/cavium/cpt/
 
 CAVIUM THUNDERX2 ARM64 SOC
-M:     Robert Richter <rrichter@marvell.com>
+M:     Robert Richter <rric@kernel.org>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-S:     Maintained
+S:     Odd Fixes
 F:     Documentation/devicetree/bindings/arm/cavium-thunder2.txt
 F:     arch/arm64/boot/dts/cavium/thunder2-99xx*
 
@@ -4241,6 +4257,8 @@ S:        Maintained
 F:     .clang-format
 
 CLANG/LLVM BUILD SUPPORT
+M:     Nathan Chancellor <natechancellor@gmail.com>
+M:     Nick Desaulniers <ndesaulniers@google.com>
 L:     clang-built-linux@googlegroups.com
 S:     Supported
 W:     https://clangbuiltlinux.github.io/
@@ -4390,12 +4408,6 @@ T:       git git://git.infradead.org/users/hch/configfs.git
 F:     fs/configfs/
 F:     include/linux/configfs.h
 
-CONNECTOR
-M:     Evgeniy Polyakov <zbr@ioremap.net>
-L:     netdev@vger.kernel.org
-S:     Maintained
-F:     drivers/connector/
-
 CONSOLE SUBSYSTEM
 M:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 S:     Supported
@@ -5239,6 +5251,7 @@ DOCUMENTATION
 M:     Jonathan Corbet <corbet@lwn.net>
 L:     linux-doc@vger.kernel.org
 S:     Maintained
+P:     Documentation/doc-guide/maintainer-profile.rst
 T:     git git://git.lwn.net/linux.git docs-next
 F:     Documentation/
 F:     scripts/documentation-file-ref-check
@@ -6161,7 +6174,7 @@ F:        Documentation/devicetree/bindings/edac/aspeed-sdram-edac.txt
 F:     drivers/edac/aspeed_edac.c
 
 EDAC-BLUEFIELD
-M:     Shravan Kumar Ramani <sramani@nvidia.com>
+M:     Shravan Kumar Ramani <shravankr@nvidia.com>
 S:     Supported
 F:     drivers/edac/bluefield_edac.c
 
@@ -6173,16 +6186,15 @@ F:      drivers/edac/highbank*
 
 EDAC-CAVIUM OCTEON
 M:     Ralf Baechle <ralf@linux-mips.org>
-M:     Robert Richter <rrichter@marvell.com>
 L:     linux-edac@vger.kernel.org
 L:     linux-mips@vger.kernel.org
 S:     Supported
 F:     drivers/edac/octeon_edac*
 
 EDAC-CAVIUM THUNDERX
-M:     Robert Richter <rrichter@marvell.com>
+M:     Robert Richter <rric@kernel.org>
 L:     linux-edac@vger.kernel.org
-S:     Supported
+S:     Odd Fixes
 F:     drivers/edac/thunderx_edac*
 
 EDAC-CORE
@@ -6190,7 +6202,7 @@ M:        Borislav Petkov <bp@alien8.de>
 M:     Mauro Carvalho Chehab <mchehab@kernel.org>
 M:     Tony Luck <tony.luck@intel.com>
 R:     James Morse <james.morse@arm.com>
-R:     Robert Richter <rrichter@marvell.com>
+R:     Robert Richter <rric@kernel.org>
 L:     linux-edac@vger.kernel.org
 S:     Supported
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next
@@ -6494,7 +6506,6 @@ F:        net/bridge/
 
 ETHERNET PHY LIBRARY
 M:     Andrew Lunn <andrew@lunn.ch>
-M:     Florian Fainelli <f.fainelli@gmail.com>
 M:     Heiner Kallweit <hkallweit1@gmail.com>
 R:     Russell King <linux@armlinux.org.uk>
 L:     netdev@vger.kernel.org
@@ -6884,6 +6895,14 @@ L:       linuxppc-dev@lists.ozlabs.org
 S:     Maintained
 F:     drivers/dma/fsldma.*
 
+FREESCALE DSPI DRIVER
+M:     Vladimir Oltean <olteanv@gmail.com>
+L:     linux-spi@vger.kernel.org
+S:     Maintained
+F:     Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt
+F:     drivers/spi/spi-fsl-dspi.c
+F:     include/linux/spi/spi-fsl-dspi.h
+
 FREESCALE ENETC ETHERNET DRIVERS
 M:     Claudiu Manoil <claudiu.manoil@nxp.com>
 L:     netdev@vger.kernel.org
@@ -8255,7 +8274,7 @@ IA64 (Itanium) PLATFORM
 M:     Tony Luck <tony.luck@intel.com>
 M:     Fenghua Yu <fenghua.yu@intel.com>
 L:     linux-ia64@vger.kernel.org
-S:     Maintained
+S:     Odd Fixes
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git
 F:     Documentation/ia64/
 F:     arch/ia64/
@@ -8304,8 +8323,9 @@ S:        Supported
 F:     drivers/pci/hotplug/rpaphp*
 
 IBM Power SRIOV Virtual NIC Device Driver
-M:     Thomas Falcon <tlfalcon@linux.ibm.com>
-M:     John Allen <jallen@linux.ibm.com>
+M:     Dany Madden <drt@linux.ibm.com>
+M:     Lijun Pan <ljp@linux.ibm.com>
+M:     Sukadev Bhattiprolu <sukadev@linux.ibm.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 F:     drivers/net/ethernet/ibm/ibmvnic.*
@@ -8319,7 +8339,7 @@ F:        arch/powerpc/platforms/powernv/copy-paste.h
 F:     arch/powerpc/platforms/powernv/vas*
 
 IBM Power Virtual Ethernet Device Driver
-M:     Thomas Falcon <tlfalcon@linux.ibm.com>
+M:     Cristobal Forno <cforno12@linux.ibm.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 F:     drivers/net/ethernet/ibm/ibmveth.*
@@ -9226,7 +9246,7 @@ F:        drivers/firmware/iscsi_ibft*
 
 ISCSI EXTENSIONS FOR RDMA (ISER) INITIATOR
 M:     Sagi Grimberg <sagi@grimberg.me>
-M:     Max Gurtovoy <maxg@nvidia.com>
+M:     Max Gurtovoy <mgurtovoy@nvidia.com>
 L:     linux-rdma@vger.kernel.org
 S:     Supported
 W:     http://www.openfabrics.org
@@ -9775,7 +9795,7 @@ F:        drivers/scsi/53c700*
 
 LEAKING_ADDRESSES
 M:     Tobin C. Harding <me@tobin.cc>
-M:     Tycho Andersen <tycho@tycho.ws>
+M:     Tycho Andersen <tycho@tycho.pizza>
 L:     kernel-hardening@lists.openwall.com
 S:     Maintained
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks.git
@@ -11017,6 +11037,7 @@ F:      drivers/char/hw_random/mtk-rng.c
 
 MEDIATEK SWITCH DRIVER
 M:     Sean Wang <sean.wang@mediatek.com>
+M:     Landen Chao <Landen.Chao@mediatek.com>
 L:     netdev@vger.kernel.org
 S:     Maintained
 F:     drivers/net/dsa/mt7530.*
@@ -12030,6 +12051,7 @@ Q:      http://patchwork.ozlabs.org/project/netdev/list/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
 F:     Documentation/devicetree/bindings/net/
+F:     drivers/connector/
 F:     drivers/net/
 F:     include/linux/etherdevice.h
 F:     include/linux/fcdevice.h
@@ -13429,10 +13451,10 @@ F:    Documentation/devicetree/bindings/pci/axis,artpec*
 F:     drivers/pci/controller/dwc/*artpec*
 
 PCIE DRIVER FOR CAVIUM THUNDERX
-M:     Robert Richter <rrichter@marvell.com>
+M:     Robert Richter <rric@kernel.org>
 L:     linux-pci@vger.kernel.org
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-S:     Supported
+S:     Odd Fixes
 F:     drivers/pci/controller/pci-thunder-*
 
 PCIE DRIVER FOR HISILICON
@@ -13569,12 +13591,18 @@ F:    kernel/events/*
 F:     tools/lib/perf/
 F:     tools/perf/
 
-PERFORMANCE EVENTS SUBSYSTEM ARM64 PMU EVENTS
+PERFORMANCE EVENTS TOOLING ARM64
 R:     John Garry <john.garry@huawei.com>
 R:     Will Deacon <will@kernel.org>
+R:     Mathieu Poirier <mathieu.poirier@linaro.org>
+R:     Leo Yan <leo.yan@linaro.org>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Supported
+F:     tools/build/feature/test-libopencsd.c
+F:     tools/perf/arch/arm*/
 F:     tools/perf/pmu-events/arch/arm64/
+F:     tools/perf/util/arm-spe*
+F:     tools/perf/util/cs-etm*
 
 PERSONALITY HANDLING
 M:     Christoph Hellwig <hch@infradead.org>
@@ -14365,7 +14393,7 @@ M:      Rob Clark <robdclark@gmail.com>
 L:     iommu@lists.linux-foundation.org
 L:     linux-arm-msm@vger.kernel.org
 S:     Maintained
-F:     drivers/iommu/qcom_iommu.c
+F:     drivers/iommu/arm/arm-smmu/qcom_iommu.c
 
 QUALCOMM IPCC MAILBOX DRIVER
 M:     Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
@@ -15546,6 +15574,7 @@ F:      include/uapi/linux/sed*
 SECURITY CONTACT
 M:     Security Officers <security@kernel.org>
 S:     Supported
+F:     Documentation/admin-guide/security-bugs.rst
 
 SECURITY SUBSYSTEM
 M:     James Morris <jmorris@namei.org>
@@ -16125,7 +16154,7 @@ M:      Leon Luo <leonl@leopardimaging.com>
 L:     linux-media@vger.kernel.org
 S:     Maintained
 T:     git git://linuxtv.org/media_tree.git
-F:     Documentation/devicetree/bindings/media/i2c/imx274.txt
+F:     Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml
 F:     drivers/media/i2c/imx274.c
 
 SONY IMX290 SENSOR DRIVER
@@ -17116,8 +17145,8 @@ S:      Maintained
 F:     Documentation/devicetree/bindings/arm/keystone/ti,k3-sci-common.yaml
 F:     Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
 F:     Documentation/devicetree/bindings/clock/ti,sci-clk.txt
-F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt
-F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt
+F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml
+F:     Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml
 F:     Documentation/devicetree/bindings/reset/ti,sci-reset.txt
 F:     Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
 F:     drivers/clk/keystone/sci-clk.c
@@ -17214,8 +17243,8 @@ S:      Maintained
 F:     drivers/net/thunderbolt.c
 
 THUNDERX GPIO DRIVER
-M:     Robert Richter <rrichter@marvell.com>
-S:     Maintained
+M:     Robert Richter <rric@kernel.org>
+S:     Odd Fixes
 F:     drivers/gpio/gpio-thunderx.c
 
 TI AM437X VPFE DRIVER
@@ -18874,6 +18903,15 @@ S:     Maintained
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
 F:     arch/x86/platform
 
+X86 PLATFORM UV HPE SUPERDOME FLEX
+M:     Steve Wahl <steve.wahl@hpe.com>
+R:     Dimitri Sivanich <dimitri.sivanich@hpe.com>
+R:     Russ Anderson <russ.anderson@hpe.com>
+S:     Supported
+F:     arch/x86/include/asm/uv/
+F:     arch/x86/kernel/apic/x2apic_uv_x.c
+F:     arch/x86/platform/uv/
+
 X86 VDSO
 M:     Andy Lutomirski <luto@kernel.org>
 L:     linux-kernel@vger.kernel.org
index f2116815416091dbfa7dcf58ae179ae3241ec1b1..992d24467ca0ab5c3377131eca9d381baa53b341 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 9
 SUBLEVEL = 0
-EXTRAVERSION = -rc2
+EXTRAVERSION = -rc7
 NAME = Kleptomaniac Octopus
 
 # *DOCUMENTATION*
@@ -882,10 +882,6 @@ KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
 LDFLAGS_vmlinux += --gc-sections
 endif
 
-ifdef CONFIG_LIVEPATCH
-KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone)
-endif
-
 ifdef CONFIG_SHADOW_CALL_STACK
 CC_FLAGS_SCS   := -fsanitize=shadow-call-stack
 KBUILD_CFLAGS  += $(CC_FLAGS_SCS)
index ac110ae8f978032b6ad837663ab3b3f83c0d3b5d..5b60c248de9eae6d762937f3eb570fbfeaeb5b65 100644 (file)
@@ -212,7 +212,7 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
                            STO_ALPHA_STD_GPLOAD)
                                /* Omit the prologue. */
                                value += 8;
-                       /* FALLTHRU */
+                       fallthrough;
                case R_ALPHA_BRADDR:
                        value -= (u64)location + 4;
                        if (value & 3)
index a813020d2f1170b3daba65ccc270718d5ea24b84..15bc9d1e79f4d70cead96ffed802c879499efea1 100644 (file)
@@ -453,7 +453,7 @@ syscall_restart(unsigned long r0, unsigned long r19,
                        regs->r0 = EINTR;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case ERESTARTNOINTR:
                regs->r0 = r0;  /* reset v0 and a3 and replay syscall */
                regs->r19 = r19;
index 49754e07e04f47e596ad0662b484283b974cb786..921d4b6e4d956185e6dbb7c3dd06f18f47b84bd7 100644 (file)
@@ -883,7 +883,7 @@ do_entUnaUser(void __user * va, unsigned long opcode,
 
        case 0x26: /* sts */
                fake_reg = s_reg_to_mem(alpha_read_fp_reg(reg));
-               /* FALLTHRU */
+               fallthrough;
 
        case 0x2c: /* stl */
                __asm__ __volatile__(
@@ -911,7 +911,7 @@ do_entUnaUser(void __user * va, unsigned long opcode,
 
        case 0x27: /* stt */
                fake_reg = alpha_read_fp_reg(reg);
-               /* FALLTHRU */
+               fallthrough;
 
        case 0x2d: /* stq */
                __asm__ __volatile__(
index 9acbeba832c0b532ca1c4a2623f215335edcd481..dcaa44e408ace2adc3bdad5c8545ccaf046d55f9 100644 (file)
@@ -88,6 +88,8 @@
 
        arcpct: pct {
                compatible = "snps,archs-pct";
+               interrupt-parent = <&cpu_intc>;
+               interrupts = <20>;
        };
 
        /* TIMER0 with interrupt for clockevent */
                        reg = <0x8000 0x2000>;
                        interrupts = <10>;
                        interrupt-names = "macirq";
-                       phy-mode = "rgmii";
+                       phy-mode = "rgmii-id";
                        snps,pbl = <32>;
                        snps,multicast-filter-bins = <256>;
                        clocks = <&gmacclk>;
                                #address-cells = <1>;
                                #size-cells = <0>;
                                compatible = "snps,dwmac-mdio";
-                               phy0: ethernet-phy@0 {
+                               phy0: ethernet-phy@0 { /* Micrel KSZ9031 */
                                        reg = <0>;
                                };
                        };
index b747f2ec2928770e8e1a023841f3fc7e75975b04..6147db9252487f76875afbc7953a3c69b518aac1 100644 (file)
  * vineetg: April 2010
  *  -Switched pgtable_t from being struct page * to unsigned long
  *      =Needed so that Page Table allocator (pte_alloc_one) is not forced to
- *       to deal with struct page. Thay way in future we can make it allocate
+ *       deal with struct page. That way in future we can make it allocate
  *       multiple PG Tbls in one Page Frame
  *      =sweet side effect is avoiding calls to ugly page_address( ) from the
- *       pg-tlb allocator sub-sys (pte_alloc_one, ptr_free, pmd_populate
+ *       pg-tlb allocator sub-sys (pte_alloc_one, ptr_free, pmd_populate)
  *
  *  Amit Bhor, Sameer Dhavale: Codito Technologies 2004
  */
index d04837d91b407797d2881cff37c2cd00b08e0487..03f8b1be0c3a82ba27b54e0ba96243a4766f8b66 100644 (file)
@@ -339,7 +339,7 @@ void __kprobes disasm_instr(unsigned long addr, struct disasm_state *state,
 
        case op_LDWX_S: /* LDWX_S c, [b, u6] */
                state->x = 1;
-               /* intentional fall-through */
+               fallthrough;
 
        case op_LDW_S:  /* LDW_S c, [b, u6] */
                state->zz = 2;
index 661fd842ea97db7ad4f3871b2a1038d715a44130..79849f37e782c696528055b3f1ff852f3bceb08d 100644 (file)
@@ -562,7 +562,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev)
 {
        struct arc_reg_pct_build pct_bcr;
        struct arc_reg_cc_build cc_bcr;
-       int i, has_interrupts;
+       int i, has_interrupts, irq;
        int counter_size;       /* in bits */
 
        union cc_name {
@@ -637,13 +637,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev)
                .attr_groups    = arc_pmu->attr_groups,
        };
 
-       if (has_interrupts) {
-               int irq = platform_get_irq(pdev, 0);
-
-               if (irq < 0) {
-                       pr_err("Cannot get IRQ number for the platform\n");
-                       return -ENODEV;
-               }
+       if (has_interrupts && (irq = platform_get_irq(pdev, 0) >= 0)) {
 
                arc_pmu->irq = irq;
 
@@ -652,9 +646,9 @@ static int arc_pmu_device_probe(struct platform_device *pdev)
                                   this_cpu_ptr(&arc_pmu_cpu));
 
                on_each_cpu(arc_cpu_pmu_irq_init, &irq, 1);
-
-       } else
+       } else {
                arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+       }
 
        /*
         * perf parser doesn't really like '-' symbol in events name, so let's
index 3d57ed0d8535098d958b03091ba59c271c98f126..8222f8c546902950abd7f4568e785a8de9122e9e 100644 (file)
@@ -321,7 +321,7 @@ static void arc_restart_syscall(struct k_sigaction *ka, struct pt_regs *regs)
                        regs->r0 = -EINTR;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
 
        case -ERESTARTNOINTR:
                /*
index 28e8bf04b253f47be704cc375907d270536ecb94..a331bb5d8319f2b9110a87eb8fc5f0a27b71988c 100644 (file)
 
 #define ARC_PATH_MAX   256
 
-/*
- * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25)
- *   -Prints 3 regs per line and a CR.
- *   -To continue, callee regs right after scratch, special handling of CR
- */
-static noinline void print_reg_file(long *reg_rev, int start_num)
+static noinline void print_regs_scratch(struct pt_regs *regs)
 {
-       unsigned int i;
-       char buf[512];
-       int n = 0, len = sizeof(buf);
-
-       for (i = start_num; i < start_num + 13; i++) {
-               n += scnprintf(buf + n, len - n, "r%02u: 0x%08lx\t",
-                              i, (unsigned long)*reg_rev);
-
-               if (((i + 1) % 3) == 0)
-                       n += scnprintf(buf + n, len - n, "\n");
-
-               /* because pt_regs has regs reversed: r12..r0, r25..r13 */
-               if (is_isa_arcv2() && start_num == 0)
-                       reg_rev++;
-               else
-                       reg_rev--;
-       }
-
-       if (start_num != 0)
-               n += scnprintf(buf + n, len - n, "\n\n");
+       pr_cont("BTA: 0x%08lx\n SP: 0x%08lx  FP: 0x%08lx BLK: %pS\n",
+               regs->bta, regs->sp, regs->fp, (void *)regs->blink);
+       pr_cont("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n",
+               regs->lp_start, regs->lp_end, regs->lp_count);
 
-       /* To continue printing callee regs on same line as scratch regs */
-       if (start_num == 0)
-               pr_info("%s", buf);
-       else
-               pr_cont("%s\n", buf);
+       pr_info("r00: 0x%08lx\tr01: 0x%08lx\tr02: 0x%08lx\n"    \
+               "r03: 0x%08lx\tr04: 0x%08lx\tr05: 0x%08lx\n"    \
+               "r06: 0x%08lx\tr07: 0x%08lx\tr08: 0x%08lx\n"    \
+               "r09: 0x%08lx\tr10: 0x%08lx\tr11: 0x%08lx\n"    \
+               "r12: 0x%08lx\t",
+               regs->r0, regs->r1, regs->r2,
+               regs->r3, regs->r4, regs->r5,
+               regs->r6, regs->r7, regs->r8,
+               regs->r9, regs->r10, regs->r11,
+               regs->r12);
 }
 
-static void show_callee_regs(struct callee_regs *cregs)
+static void print_regs_callee(struct callee_regs *regs)
 {
-       print_reg_file(&(cregs->r13), 13);
+       pr_cont("r13: 0x%08lx\tr14: 0x%08lx\n"                  \
+               "r15: 0x%08lx\tr16: 0x%08lx\tr17: 0x%08lx\n"    \
+               "r18: 0x%08lx\tr19: 0x%08lx\tr20: 0x%08lx\n"    \
+               "r21: 0x%08lx\tr22: 0x%08lx\tr23: 0x%08lx\n"    \
+               "r24: 0x%08lx\tr25: 0x%08lx\n",
+               regs->r13, regs->r14,
+               regs->r15, regs->r16, regs->r17,
+               regs->r18, regs->r19, regs->r20,
+               regs->r21, regs->r22, regs->r23,
+               regs->r24, regs->r25);
 }
 
 static void print_task_path_n_nm(struct task_struct *tsk)
@@ -175,7 +168,7 @@ static void show_ecr_verbose(struct pt_regs *regs)
 void show_regs(struct pt_regs *regs)
 {
        struct task_struct *tsk = current;
-       struct callee_regs *cregs;
+       struct callee_regs *cregs = (struct callee_regs *)tsk->thread.callee_reg;
 
        /*
         * generic code calls us with preemption disabled, but some calls
@@ -204,25 +197,15 @@ void show_regs(struct pt_regs *regs)
                        STS_BIT(regs, A2), STS_BIT(regs, A1),
                        STS_BIT(regs, E2), STS_BIT(regs, E1));
 #else
-       pr_cont(" [%2s%2s%2s%2s]",
+       pr_cont(" [%2s%2s%2s%2s]   ",
                        STS_BIT(regs, IE),
                        (regs->status32 & STATUS_U_MASK) ? "U " : "K ",
                        STS_BIT(regs, DE), STS_BIT(regs, AE));
 #endif
-       pr_cont("  BTA: 0x%08lx\n  SP: 0x%08lx  FP: 0x%08lx BLK: %pS\n",
-               regs->bta, regs->sp, regs->fp, (void *)regs->blink);
-       pr_info("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n",
-               regs->lp_start, regs->lp_end, regs->lp_count);
-
-       /* print regs->r0 thru regs->r12
-        * Sequential printing was generating horrible code
-        */
-       print_reg_file(&(regs->r0), 0);
 
-       /* If Callee regs were saved, display them too */
-       cregs = (struct callee_regs *)current->thread.callee_reg;
+       print_regs_scratch(regs);
        if (cregs)
-               show_callee_regs(cregs);
+               print_regs_callee(cregs);
 
        preempt_disable();
 }
index f87758a6851bd132124c88512a9fbccf7870c49d..74ad4256022e4b80ac9b2937a1e86471197d1909 100644 (file)
@@ -572,7 +572,7 @@ static unsigned long read_pointer(const u8 **pLoc, const void *end,
 #else
                BUILD_BUG_ON(sizeof(u32) != sizeof(value));
 #endif
-               /* Fall through */
+               fallthrough;
        case DW_EH_PE_native:
                if (end < (const void *)(ptr.pul + 1))
                        return 0;
@@ -827,7 +827,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc,
                        case DW_CFA_def_cfa:
                                state->cfa.reg = get_uleb128(&ptr.p8, end);
                                unw_debug("cfa_def_cfa: r%lu ", state->cfa.reg);
-                               /* fall through */
+                               fallthrough;
                        case DW_CFA_def_cfa_offset:
                                state->cfa.offs = get_uleb128(&ptr.p8, end);
                                unw_debug("cfa_def_cfa_offset: 0x%lx ",
@@ -835,7 +835,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc,
                                break;
                        case DW_CFA_def_cfa_sf:
                                state->cfa.reg = get_uleb128(&ptr.p8, end);
-                               /* fall through */
+                               fallthrough;
                        case DW_CFA_def_cfa_offset_sf:
                                state->cfa.offs = get_sleb128(&ptr.p8, end)
                                    * state->dataAlign;
index f886ac69d8ada101fc6bf14f34f0293cd732a032..3a35b82a718e3e292ee68ede738a2fc501706442 100644 (file)
@@ -26,8 +26,8 @@ static unsigned long low_mem_sz;
 
 #ifdef CONFIG_HIGHMEM
 static unsigned long min_high_pfn, max_high_pfn;
-static u64 high_mem_start;
-static u64 high_mem_sz;
+static phys_addr_t high_mem_start;
+static phys_addr_t high_mem_sz;
 #endif
 
 #ifdef CONFIG_DISCONTIGMEM
@@ -69,6 +69,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
                high_mem_sz = size;
                in_use = 1;
                memblock_add_node(base, size, 1);
+               memblock_reserve(base, size);
 #endif
        }
 
@@ -157,7 +158,7 @@ void __init setup_arch_memory(void)
        min_high_pfn = PFN_DOWN(high_mem_start);
        max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
 
-       max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
+       max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
 
        high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
        kmap_init();
@@ -166,22 +167,26 @@ void __init setup_arch_memory(void)
        free_area_init(max_zone_pfn);
 }
 
-/*
- * mem_init - initializes memory
- *
- * Frees up bootmem
- * Calculates and displays memory available/used
- */
-void __init mem_init(void)
+static void __init highmem_init(void)
 {
 #ifdef CONFIG_HIGHMEM
        unsigned long tmp;
 
-       reset_all_zones_managed_pages();
+       memblock_free(high_mem_start, high_mem_sz);
        for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++)
                free_highmem_page(pfn_to_page(tmp));
 #endif
+}
 
+/*
+ * mem_init - initializes memory
+ *
+ * Frees up bootmem
+ * Calculates and displays memory available/used
+ */
+void __init mem_init(void)
+{
        memblock_free_all();
+       highmem_init();
        mem_init_print_info(NULL);
 }
index a4a61531c7fb9388e31fbc63b72d559663e1e965..77712c5ffe8482eac5db53249a1c34653d0e48f8 100644 (file)
@@ -33,7 +33,6 @@
 #define CTOP_AUX_DPC                           (CTOP_AUX_BASE + 0x02C)
 #define CTOP_AUX_LPC                           (CTOP_AUX_BASE + 0x030)
 #define CTOP_AUX_EFLAGS                                (CTOP_AUX_BASE + 0x080)
-#define CTOP_AUX_IACK                          (CTOP_AUX_BASE + 0x088)
 #define CTOP_AUX_GPA1                          (CTOP_AUX_BASE + 0x08C)
 #define CTOP_AUX_UDMC                          (CTOP_AUX_BASE + 0x300)
 
index 8d19925fc09e43cd67613a46df297135947126cc..6783cf16ff818ca8ea4c5e879c0b8840cb651e9f 100644 (file)
                switch0: ksz8563@0 {
                        compatible = "microchip,ksz8563";
                        reg = <0>;
-                       phy-mode = "mii";
                        reset-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_LOW>;
 
                        spi-max-frequency = <500000>;
                                        reg = <2>;
                                        label = "cpu";
                                        ethernet = <&macb0>;
+                                       phy-mode = "mii";
                                        fixed-link {
                                                speed = <100>;
                                                full-duplex;
index cbebed5f050eb09a29b3134f5ff9848f07ce42b8..e8df458aad392e7223228c9b250d4da9ce0b3099 100644 (file)
                };
 
                qspi: spi@27200 {
-                       compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
+                       compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
                        reg = <0x027200 0x184>,
                              <0x027000 0x124>,
                              <0x11c408 0x004>,
index 0346ea621f0f930add2149c4b0817052d4a12606..c846fa3c244d36555eead3328d3c81d2042a0039 100644 (file)
                };
 
                qspi: spi@27200 {
-                       compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
+                       compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
                        reg = <0x027200 0x184>,
                              <0x027000 0x124>,
                              <0x11c408 0x004>,
index f7ae5a4530b8807e4ad3f6b90c7c8205bcd9b2c2..d94357b21f7e9df3fd5d62199212d7c2ea85d97f 100644 (file)
@@ -13,7 +13,7 @@
 
        soc {
                firmware: firmware {
-                       compatible = "raspberrypi,bcm2835-firmware", "simple-bus";
+                       compatible = "raspberrypi,bcm2835-firmware", "simple-mfd";
                        #address-cells = <1>;
                        #size-cells = <1>;
 
index 2d9b4dd058307e7f1c5c44bae5e4f2e75d5ea6c3..0016720ce530012119a3e560b6f92db01389c3a6 100644 (file)
        };
 
        spi@18029200 {
-               compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
+               compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
                reg = <0x18029200 0x184>,
                      <0x18029000 0x124>,
                      <0x1811b408 0x004>,
index 7a3d1d3e54a9427c90f1f0846c1234bce93aec1c..8f94364ba484721192383bdd40bb1902f9c02637 100644 (file)
@@ -13,7 +13,7 @@
 
        backlight: backlight-lvds {
                compatible = "pwm-backlight";
-               pwms = <&pwm3 0 20000>;
+               pwms = <&pwm3 0 20000 0>;
                brightness-levels = <0 4 8 16 32 64 128 255>;
                default-brightness-level = <6>;
                power-supply = <&reg_lcd>;
index dffafbcaa7af337eb220af2edecb337362dbab4f..349959d38020066b3028bef12fe601c81041b3a2 100644 (file)
@@ -30,7 +30,7 @@
        };
 
        /* PRTWD2 rev 1 bitbang I2C for Ethernet Switch */
-       i2c@4 {
+       i2c {
                compatible = "i2c-gpio";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_i2c4>;
index 7705285d9e3c7de096fab0c696534fa78c384337..4d01c3300b975c5dd1046c4b9feec5a6e24ef753 100644 (file)
@@ -22,8 +22,6 @@
 
        gpio-keys {
                compatible = "gpio-keys";
-               #address-cells = <1>;
-               #size-cells = <0>;
 
                user-pb {
                        label = "user_pb";
index 0b02c7e60c174573ffb56792e20aaefe84985ab1..f4dc46207954ce46485ad1164dc5254ae53790d0 100644 (file)
 #define MX6SX_PAD_QSPI1B_DQS__SIM_M_HADDR_15                      0x01B0 0x04F8 0x0000 0x7 0x0
 #define MX6SX_PAD_QSPI1B_SCLK__QSPI1_B_SCLK                       0x01B4 0x04FC 0x0000 0x0 0x0
 #define MX6SX_PAD_QSPI1B_SCLK__UART3_DCE_RX                       0x01B4 0x04FC 0x0840 0x1 0x4
-#define MX6SX_PAD_QSPI1B_SCLK__UART3_DTE_TX                       0x01B4 0x04FC 0x0000 0x0 0x0
+#define MX6SX_PAD_QSPI1B_SCLK__UART3_DTE_TX                       0x01B4 0x04FC 0x0000 0x1 0x0
 #define MX6SX_PAD_QSPI1B_SCLK__ECSPI3_SCLK                        0x01B4 0x04FC 0x0730 0x2 0x1
 #define MX6SX_PAD_QSPI1B_SCLK__ESAI_RX_HF_CLK                     0x01B4 0x04FC 0x0780 0x3 0x2
 #define MX6SX_PAD_QSPI1B_SCLK__CSI1_DATA_16                       0x01B4 0x04FC 0x06DC 0x4 0x1
index e5e20b07f184b320e3c3e2aea2d9428d81ac1eb6..7cb6153fc650b129abb7436c918b5b4db175e5e0 100644 (file)
@@ -58,7 +58,7 @@
                          <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
        assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
        assigned-clock-rates = <0>, <100000000>;
-       phy-mode = "rgmii";
+       phy-mode = "rgmii-id";
        phy-handle = <&fec1_phy>;
        status = "okay";
 
index 367439639da9193e6f51d364c2b465ab660d2b41..b7ea37ad4e55c45f5615766f3fa30bf7d9eab4a4 100644 (file)
                        clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
                                 <&pcc3 IMX7ULP_CLK_PCTLC>;
                        clock-names = "gpio", "port";
-                       gpio-ranges = <&iomuxc1 0 0 32>;
+                       gpio-ranges = <&iomuxc1 0 0 20>;
                };
 
                gpio_ptd: gpio@40af0000 {
                        clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
                                 <&pcc3 IMX7ULP_CLK_PCTLD>;
                        clock-names = "gpio", "port";
-                       gpio-ranges = <&iomuxc1 0 32 32>;
+                       gpio-ranges = <&iomuxc1 0 32 12>;
                };
 
                gpio_pte: gpio@40b00000 {
                        clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
                                 <&pcc3 IMX7ULP_CLK_PCTLE>;
                        clock-names = "gpio", "port";
-                       gpio-ranges = <&iomuxc1 0 64 32>;
+                       gpio-ranges = <&iomuxc1 0 64 16>;
                };
 
                gpio_ptf: gpio@40b10000 {
                        clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
                                 <&pcc3 IMX7ULP_CLK_PCTLF>;
                        clock-names = "gpio", "port";
-                       gpio-ranges = <&iomuxc1 0 96 32>;
+                       gpio-ranges = <&iomuxc1 0 96 20>;
                };
        };
 
index 100396f6c2feb1e15e4fab19667c0b83dda82d23..395e05f10d36ce91ea6fceb2c18c9b2e28caf604 100644 (file)
@@ -51,6 +51,8 @@
 
 &mcbsp2 {
        status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&mcbsp2_pins>;
 };
 
 &charger {
                regulator-max-microvolt = <3300000>;
        };
 
-       lcd0: display@0 {
-               compatible = "panel-dpi";
-               label = "28";
-               status = "okay";
-               /* default-on; */
+       lcd0: display {
+               /* This isn't the exact LCD, but the timings meet spec */
+               compatible = "logicpd,type28";
                pinctrl-names = "default";
                pinctrl-0 = <&lcd_enable_pin>;
-               enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>;    /* gpio155, lcd INI */
+               backlight = <&bl>;
+               enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>;
                port {
                        lcd_in: endpoint {
                                remote-endpoint = <&dpi_out>;
                        };
                };
-
-               panel-timing {
-                       clock-frequency = <9000000>;
-                       hactive = <480>;
-                       vactive = <272>;
-                       hfront-porch = <3>;
-                       hback-porch = <2>;
-                       hsync-len = <42>;
-                       vback-porch = <3>;
-                       vfront-porch = <2>;
-                       vsync-len = <11>;
-                       hsync-active = <1>;
-                       vsync-active = <1>;
-                       de-active = <1>;
-                       pixelclk-active = <0>;
-               };
        };
 
        bl: backlight {
index 381f0e82bb706cc5b9b8b951dcb4e09cafb93991..b0f6613e6d5498d55c9a2ebc1f10ebda9ceabb2e 100644 (file)
@@ -81,6 +81,8 @@
 };
 
 &mcbsp2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mcbsp2_pins>;
        status = "okay";
 };
 
index 069af9a19bb64456ca28b2d0d2edef04d0d18703..827373ef1a547ef6e5f74bd49787a3237853bc76 100644 (file)
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x0 0x1550000 0x0 0x10000>,
-                             <0x0 0x40000000 0x0 0x40000000>;
+                             <0x0 0x40000000 0x0 0x20000000>;
                        reg-names = "QuadSPI", "QuadSPI-memory";
                        interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
                        clock-names = "qspi_en", "qspi";
index 5da9cff7a53c7378f6453a4a2ff112b267207e1e..a82c96258a9336ab5c1895b61857e66d591c9687 100644 (file)
                                        };
                                };
 
-                               target-module@5000 {
+                               target-module@4000 {
                                        compatible = "ti,sysc-omap2", "ti,sysc";
-                                       reg = <0x5000 0x4>,
-                                             <0x5010 0x4>,
-                                             <0x5014 0x4>;
+                                       reg = <0x4000 0x4>,
+                                             <0x4010 0x4>,
+                                             <0x4014 0x4>;
                                        reg-names = "rev", "sysc", "syss";
                                        ti,sysc-sidle = <SYSC_IDLE_FORCE>,
                                                        <SYSC_IDLE_NO>,
                                        ti,syss-mask = <1>;
                                        #address-cells = <1>;
                                        #size-cells = <1>;
-                                       ranges = <0 0x5000 0x1000>;
+                                       ranges = <0 0x4000 0x1000>;
 
                                        dsi1: encoder@0 {
                                                compatible = "ti,omap5-dsi";
                                                reg-names = "proto", "phy", "pll";
                                                interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
                                                status = "disabled";
-                                               clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>;
-                                               clock-names = "fck";
+                                               clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>,
+                                                        <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>;
+                                               clock-names = "fck", "sys_clk";
                                        };
                                };
 
                                                reg-names = "proto", "phy", "pll";
                                                interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
                                                status = "disabled";
-                                               clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>;
-                                               clock-names = "fck";
+                                               clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>,
+                                                        <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>;
+                                               clock-names = "fck", "sys_clk";
                                        };
                                };
 
index fc4abef143a066eb86d0d704600c30170faca7c8..0013ec3463c46569750d52d8f0ce6867285d664a 100644 (file)
                timer3: timer3@ffd00100 {
                        compatible = "snps,dw-apb-timer";
                        interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>;
-                       reg = <0xffd01000 0x100>;
+                       reg = <0xffd00100 0x100>;
                        clocks = <&l4_sys_free_clk>;
                        clock-names = "timer";
                        resets = <&rst L4SYSTIMER1_RESET>;
index 0fe03aa0367f236ce964b1438e5c760a233bf3d1..2259d11af721e8d90acea7ca0de3df971b66dd91 100644 (file)
                        };
 
                        ocotp: ocotp@400a5000 {
-                               compatible = "fsl,vf610-ocotp";
+                               compatible = "fsl,vf610-ocotp", "syscon";
                                reg = <0x400a5000 0x1000>;
                                clocks = <&clks VF610_CLK_OCOTP>;
                        };
index a9755c501bec405669b8213f820d58009980a2ac..b06e537d5149031afa1acf974ad53b0dcaa9f77f 100644 (file)
@@ -1,13 +1,11 @@
 CONFIG_SYSVIPC=y
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_BLK_DEV_INITRD=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_PARTITION_ADVANCED=y
 CONFIG_ARCH_MULTI_V4T=y
 CONFIG_ARCH_MULTI_V5=y
 # CONFIG_ARCH_MULTI_V7 is not set
@@ -15,19 +13,17 @@ CONFIG_ARCH_INTEGRATOR=y
 CONFIG_ARCH_INTEGRATOR_AP=y
 CONFIG_INTEGRATOR_IMPD1=y
 CONFIG_ARCH_INTEGRATOR_CP=y
-CONFIG_PCI=y
-CONFIG_PREEMPT=y
 CONFIG_AEABI=y
 # CONFIG_ATAGS is not set
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp"
 CONFIG_CPU_FREQ=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
 CONFIG_CPU_FREQ_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_ONDEMAND=y
 CONFIG_CPUFREQ_DT=y
-CONFIG_CMA=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_PARTITION_ADVANCED=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -37,6 +33,7 @@ CONFIG_IP_PNP=y
 CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
 # CONFIG_IPV6 is not set
+CONFIG_PCI=y
 CONFIG_MTD=y
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_AFS_PARTS=y
@@ -52,9 +49,12 @@ CONFIG_BLK_DEV_RAM_SIZE=8192
 CONFIG_NETDEVICES=y
 CONFIG_E100=y
 CONFIG_SMC91X=y
+CONFIG_INPUT_EVDEV=y
 # CONFIG_KEYBOARD_ATKBD is not set
+CONFIG_KEYBOARD_GPIO=y
 # CONFIG_SERIO_SERPORT is not set
 CONFIG_DRM=y
+CONFIG_DRM_DISPLAY_CONNECTOR=y
 CONFIG_DRM_SIMPLE_BRIDGE=y
 CONFIG_DRM_PL111=y
 CONFIG_FB_MODE_HELPERS=y
index 7fff88e612525cfba94b4987ee526f58285debd5..7a4853b1213a8e3d3f20f23122b7bc0cf6cff05e 100644 (file)
@@ -547,7 +547,7 @@ static int arch_build_bp_info(struct perf_event *bp,
                if ((hw->ctrl.type != ARM_BREAKPOINT_EXECUTE)
                        && max_watchpoint_len >= 8)
                        break;
-               /* Else, fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
@@ -612,12 +612,12 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
                /* Allow halfword watchpoints and breakpoints. */
                if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2)
                        break;
-               /* Else, fall through */
+               fallthrough;
        case 3:
                /* Allow single byte watchpoint. */
                if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1)
                        break;
-               /* Else, fall through */
+               fallthrough;
        default:
                ret = -EINVAL;
                goto out;
@@ -884,7 +884,7 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
                break;
        case ARM_ENTRY_ASYNC_WATCHPOINT:
                WARN(1, "Asynchronous watchpoint exception taken. Debugging results may be unreliable\n");
-               /* Fall through */
+               fallthrough;
        case ARM_ENTRY_SYNC_WATCHPOINT:
                watchpoint_handler(addr, fsr, regs);
                break;
@@ -933,7 +933,7 @@ static bool core_has_os_save_restore(void)
                ARM_DBG_READ(c1, c1, 4, oslsr);
                if (oslsr & ARM_OSLSR_OSLM0)
                        return true;
-               /* Else, fall through */
+               fallthrough;
        default:
                return false;
        }
index c9dc912b83f0129fc3664b43ccb4bdc56b8be2b8..c1892f733f208da0b2a0a419e296dd2fc0b03675 100644 (file)
@@ -596,7 +596,7 @@ static int do_signal(struct pt_regs *regs, int syscall)
                switch (retval) {
                case -ERESTART_RESTARTBLOCK:
                        restart -= 2;
-                       /* Fall through */
+                       fallthrough;
                case -ERESTARTNOHAND:
                case -ERESTARTSYS:
                case -ERESTARTNOINTR:
index 1c05c5bf7e5c89331f9b72771334b819c4ec8a2c..757032d82f6309834ef0470aa026272a4cb5a165 100644 (file)
@@ -49,7 +49,7 @@ static int crunch_do(struct notifier_block *self, unsigned long cmd, void *t)
                 * FALLTHROUGH: Ensure we don't try to overwrite our newly
                 * initialised state information on the first fault.
                 */
-               /* Fall through */
+               fallthrough;
 
        case THREAD_NOTIFY_EXIT:
                crunch_task_release(thread);
index 2d86381e152d6604cb9d4cb96e655a14885f8ca0..7a6f74c32d428ff7d0887cd75e6ce02930ce3505 100644 (file)
@@ -123,19 +123,19 @@ void mmp2_pm_enter_lowpower_mode(int state)
        case POWER_MODE_SYS_SLEEP:
                apcr |= MPMU_PCR_PJ_SLPEN;              /* set the SLPEN bit */
                apcr |= MPMU_PCR_PJ_VCTCXOSD;           /* set VCTCXOSD */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_CHIP_SLEEP:
                apcr |= MPMU_PCR_PJ_SLPEN;
-               /* fall through */
+               fallthrough;
        case POWER_MODE_APPS_SLEEP:
                apcr |= MPMU_PCR_PJ_APBSD;              /* set APBSD */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_APPS_IDLE:
                apcr |= MPMU_PCR_PJ_AXISD;              /* set AXISDD bit */
                apcr |= MPMU_PCR_PJ_DDRCORSD;           /* set DDRCORSD bit */
                idle_cfg |= APMU_PJ_IDLE_CFG_PJ_PWRDWN; /* PJ power down */
                apcr |= MPMU_PCR_PJ_SPSD;
-               /* fall through */
+               fallthrough;
        case POWER_MODE_CORE_EXTIDLE:
                idle_cfg |= APMU_PJ_IDLE_CFG_PJ_IDLE;   /* set the IDLE bit */
                idle_cfg &= ~APMU_PJ_IDLE_CFG_ISO_MODE_CNTRL_MASK;
index 69ebe18ff209fa39d72d06391ee56240ed320fad..1d71d73c18620608ca6d47ab96f785a8fef77399 100644 (file)
@@ -145,23 +145,23 @@ void pxa910_pm_enter_lowpower_mode(int state)
        case POWER_MODE_UDR:
                /* only shutdown APB in UDR */
                apcr |= MPMU_APCR_STBYEN | MPMU_APCR_APBSD;
-               /* fall through */
+               fallthrough;
        case POWER_MODE_SYS_SLEEP:
                apcr |= MPMU_APCR_SLPEN;                /* set the SLPEN bit */
                apcr |= MPMU_APCR_VCTCXOSD;             /* set VCTCXOSD */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_APPS_SLEEP:
                apcr |= MPMU_APCR_DDRCORSD;             /* set DDRCORSD */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_APPS_IDLE:
                apcr |= MPMU_APCR_AXISD;                /* set AXISDD bit */
-               /* fall through */
+               fallthrough;
        case POWER_MODE_CORE_EXTIDLE:
                idle_cfg |= APMU_MOH_IDLE_CFG_MOH_IDLE;
                idle_cfg |= APMU_MOH_IDLE_CFG_MOH_PWRDWN;
                idle_cfg |= APMU_MOH_IDLE_CFG_MOH_PWR_SW(3)
                        | APMU_MOH_IDLE_CFG_MOH_L2_PWR_SW(3);
-               /* fall through */
+               fallthrough;
        case POWER_MODE_CORE_INTIDLE:
                break;
        }
index 1d119b974f5ff951c40b5975eac5583dfadf61c0..59755b5a1ad7a5d996abd9feb607cfb0cc4f5012 100644 (file)
@@ -396,7 +396,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "3.1";
                        break;
                case 7:
-               /* FALLTHROUGH */
                default:
                        /* Use the latest known revision as default */
                        omap_revision = OMAP3430_REV_ES3_1_2;
@@ -416,7 +415,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "1.0";
                        break;
                case 1:
-               /* FALLTHROUGH */
                default:
                        omap_revision = AM35XX_REV_ES1_1;
                        cpu_rev = "1.1";
@@ -435,7 +433,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "1.1";
                        break;
                case 2:
-               /* FALLTHROUGH */
                default:
                        omap_revision = OMAP3630_REV_ES1_2;
                        cpu_rev = "1.2";
@@ -456,7 +453,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "2.0";
                        break;
                case 3:
-                       /* FALLTHROUGH */
                default:
                        omap_revision = TI8168_REV_ES2_1;
                        cpu_rev = "2.1";
@@ -473,7 +469,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "2.0";
                        break;
                case 2:
-               /* FALLTHROUGH */
                default:
                        omap_revision = AM335X_REV_ES2_1;
                        cpu_rev = "2.1";
@@ -491,7 +486,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "1.1";
                        break;
                case 2:
-               /* FALLTHROUGH */
                default:
                        omap_revision = AM437X_REV_ES1_2;
                        cpu_rev = "1.2";
@@ -502,7 +496,6 @@ void __init omap3xxx_check_revision(void)
        case 0xb968:
                switch (rev) {
                case 0:
-               /* FALLTHROUGH */
                case 1:
                        omap_revision = TI8148_REV_ES1_0;
                        cpu_rev = "1.0";
@@ -512,7 +505,6 @@ void __init omap3xxx_check_revision(void)
                        cpu_rev = "2.0";
                        break;
                case 3:
-               /* FALLTHROUGH */
                default:
                        omap_revision = TI8148_REV_ES2_1;
                        cpu_rev = "2.1";
index 54aff33e55e6efac5de04ce915967ee77c9c412b..bfa5e1b8dba7f86a63cbe26ef01161250d1c4b8a 100644 (file)
@@ -74,7 +74,7 @@ static struct powerdomain *_get_pwrdm(struct device *dev)
                return pwrdm;
 
        clk = of_clk_get(dev->of_node->parent, 0);
-       if (!clk) {
+       if (IS_ERR(clk)) {
                dev_err(dev, "no fck found\n");
                return NULL;
        }
index 6b4548f3b57f08e26939099189b589d931da70c4..fc7bb2ca16727dadf7eec4885f6afb96c16bb9cc 100644 (file)
@@ -240,7 +240,7 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
                if (pdev->dev.of_node)
                        omap_device_build_from_dt(pdev);
                omap_auxdata_legacy_init(dev);
-               /* fall through */
+               fallthrough;
        default:
                od = to_omap_device(pdev);
                if (od)
index 6df395fff971b08f5b24cc67dec547d710ab9845..f5dfddf492e210979564f29c0cfa80b9f2850f0a 100644 (file)
@@ -298,11 +298,7 @@ static void omap3_pm_idle(void)
        if (omap_irq_pending())
                return;
 
-       trace_cpu_idle_rcuidle(1, smp_processor_id());
-
        omap_sram_idle();
-
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 }
 
 #ifdef CONFIG_SUSPEND
index d13344b2ddcd4ef0ad6c8b8554733a0fc6063610..87cb47220e825938ae9d8c5bc011e4c70ccb4d96 100644 (file)
@@ -624,7 +624,7 @@ static void __init dns323_init(void)
                 dns323ab_leds[0].active_low = 1;
                 gpio_request(DNS323_GPIO_LED_POWER1, "Power Led Enable");
                 gpio_direction_output(DNS323_GPIO_LED_POWER1, 0);
-               /* Fall through */
+               fallthrough;
        case DNS323_REV_B1:
                i2c_register_board_info(0, dns323ab_i2c_devices,
                                ARRAY_SIZE(dns323ab_i2c_devices));
index ea2c84214bac18a18e03475e48a765156f72e6fa..d23970bd638d9bd0d4f93a507752d0ec54f9392e 100644 (file)
@@ -46,7 +46,7 @@ static int __init parse_tag_acorn(const struct tag *tag)
        switch (tag->u.acorn.vram_pages) {
        case 512:
                vram_size += PAGE_SIZE * 256;
-               /* Fall through - ??? */
+               fallthrough;    /* ??? */
        case 256:
                vram_size += PAGE_SIZE * 256;
        default:
index 76a65df42d10f2968de89c8e935215ab1da11977..d5c805adf7a82b938bebd8941eae974cf6bcdbe3 100644 (file)
@@ -70,7 +70,7 @@ static void __init tegra_cpu_reset_handler_enable(void)
        switch (err) {
        case -ENOSYS:
                tegra_cpu_reset_handler_set(reset_address);
-               /* fall through */
+               fallthrough;
        case 0:
                is_enabled = true;
                break;
index f4bfc1cac91aa2998750fedde133745c6b02d30d..ea81e89e77400e6318698085f2a82e10d5f1ccb5 100644 (file)
@@ -694,7 +694,7 @@ thumb2arm(u16 tinstr)
                        return subset[(L<<1) | ((tinstr & (1<<8)) >> 8)] |
                            (tinstr & 255);             /* register_list */
                }
-               /* Else, fall through - for illegal instruction case */
+               fallthrough;    /* for illegal instruction case */
 
        default:
                return BAD_INSTR;
@@ -750,7 +750,7 @@ do_alignment_t32_to_handler(u32 *pinstr, struct pt_regs *regs,
        case 0xe8e0:
        case 0xe9e0:
                poffset->un = (tinst2 & 0xff) << 2;
-               /* Fall through */
+               fallthrough;
 
        case 0xe940:
        case 0xe9c0:
index c0fbfca5da8bfe58189eee1bb219290af8c89443..114c05ab4dd919a26064eda1f395f1c8f4119ec1 100644 (file)
@@ -71,7 +71,7 @@ static void cpu_v7_spectre_init(void)
                /* Other ARM CPUs require no workaround */
                if (read_cpuid_implementor() == ARM_CPU_IMP_ARM)
                        break;
-               /* fallthrough */
+               fallthrough;
                /* Cortex A57/A72 require firmware workaround */
        case ARM_CPU_PART_CORTEX_A57:
        case ARM_CPU_PART_CORTEX_A72: {
index b2e9e822426fd02b742fb836d624707bbc6e9f7e..1eb59003bdecdea32408afb842c800d94ca0d072 100644 (file)
@@ -309,14 +309,14 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
                 * not supported by current hardware on OMAP1
                 * w |= (0x03 << 7);
                 */
-               /* fall through */
+               fallthrough;
        case OMAP_DMA_DATA_BURST_16:
                if (dma_omap2plus()) {
                        burst = 0x3;
                        break;
                }
                /* OMAP1 don't support burst 16 */
-               /* fall through */
+               fallthrough;
        default:
                BUG();
        }
@@ -393,7 +393,7 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
                        break;
                }
                /* OMAP1 don't support burst 16 */
-               /* fall through */
+               fallthrough;
        default:
                printk(KERN_ERR "Invalid DMA burst mode\n");
                BUG();
index fe81a9c21f2d2dc2daeca5732a5d5533f13d3854..c84053a81358f3ff80776cd52a48095c11e8c611 100644 (file)
@@ -307,7 +307,7 @@ static bool __kprobes decode_regs(probes_opcode_t *pinsn, u32 regs, bool modify)
                case REG_TYPE_NOPCWB:
                        if (!is_writeback(insn))
                                break; /* No writeback, so any register is OK */
-                       /* fall through... */
+                       fallthrough;
                case REG_TYPE_NOPC:
                case REG_TYPE_NOPCX:
                        /* Reject PC (R15) */
index 90b5bc723c83f0163831d003920d1a7bb80f7c47..feefa2055ebaa5a95af1b73d91ee3bdc372a1add 100644 (file)
@@ -280,7 +280,7 @@ void __kprobes kprobe_handler(struct pt_regs *regs)
                                /* A nested probe was hit in FIQ, it is a BUG */
                                pr_warn("Unrecoverable kprobe detected.\n");
                                dump_kprobe(p);
-                               /* fall through */
+                               fallthrough;
                        default:
                                /* impossible cases */
                                BUG();
index b45f0124cc16f3bf04c02976b11be5bdc2ab7a32..130569f90c54ae64ef479adc20c0c7b76f44a3b8 100644 (file)
@@ -82,8 +82,8 @@ endif
 # compiler to generate them and consequently to break the single image contract
 # we pass it only to the assembler. This option is utilized only in case of non
 # integrated assemblers.
-ifneq ($(CONFIG_AS_HAS_ARMV8_4), y)
-branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
+ifeq ($(CONFIG_AS_HAS_PAC), y)
+asm-arch := armv8.3-a
 endif
 endif
 
@@ -91,7 +91,12 @@ KBUILD_CFLAGS += $(branch-prot-flags-y)
 
 ifeq ($(CONFIG_AS_HAS_ARMV8_4), y)
 # make sure to pass the newest target architecture to -march.
-KBUILD_CFLAGS  += -Wa,-march=armv8.4-a
+asm-arch := armv8.4-a
+endif
+
+ifdef asm-arch
+KBUILD_CFLAGS  += -Wa,-march=$(asm-arch) \
+                  -DARM64_ASM_ARCH='"$(asm-arch)"'
 endif
 
 ifeq ($(CONFIG_SHADOW_CALL_STACK), y)
@@ -165,7 +170,8 @@ zinstall install:
 PHONY += vdso_install
 vdso_install:
        $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
-       $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@
+       $(if $(CONFIG_COMPAT_VDSO), \
+               $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@)
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
index 15f7b0ed38369a0821ee4b40b2dcbaf1cf5d0a20..39802066232e1e942cd0e20b11f633332d32c6e0 100644 (file)
                };
 
                qspi: spi@66470200 {
-                       compatible = "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi";
+                       compatible = "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi";
                        reg = <0x66470200 0x184>,
                                <0x66470000 0x124>,
                                <0x67017408 0x004>,
index a39f0a1723e026b752bd8d40e6c3e8cb345a2475..903c0eb61290d320d719a83c5991e747a5afae61 100644 (file)
@@ -28,6 +28,7 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-honeycomb.dtb
 dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-qds.dtb
 dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb
 
+dtb-$(CONFIG_ARCH_MXC) += imx8mm-beacon-kit.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mn-evk.dtb
 dtb-$(CONFIG_ARCH_MXC) += imx8mn-ddr4-evk.dtb
index 9de2aa1c573c7f41b34416d02bc767593b47e976..a5154f13a18e924386e370bd8efd015b7f9a0cc2 100644 (file)
                                reg = <0x30bd0000 0x10000>;
                                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MP_CLK_SDMA1_ROOT>,
-                                        <&clk IMX8MP_CLK_SDMA1_ROOT>;
+                                        <&clk IMX8MP_CLK_AHB>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
index f70435cf9ad57c123339ebcc63b9776ed0f8af03..561fa792fe5a98508db38a739090551468655a5c 100644 (file)
                        tmu: tmu@30260000 {
                                compatible = "fsl,imx8mq-tmu";
                                reg = <0x30260000 0x10000>;
-                               interrupt = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MQ_CLK_TMU_ROOT>;
                                little-endian;
                                fsl,tmu-range = <0xb0000 0xa0026 0x80048 0x70061>;
index 1a39e0ef776bb300775d022493653b3d5cbec074..5b9ec032ce8d8dfb6c3c125b50e28fbd62cef31b 100644 (file)
                clocks = <&pericfg CLK_PERI_MSDC30_0_PD>,
                         <&topckgen CLK_TOP_MSDC50_0_SEL>;
                clock-names = "source", "hclk";
+               resets = <&pericfg MT7622_PERI_MSDC0_SW_RST>;
+               reset-names = "hrst";
                status = "disabled";
        };
 
index 34d249d85da7653a9252ac1fff3c653aea9da2db..8eb61dd9921ebf007c3af265e6bc6a2d09c84ca3 100644 (file)
                compatible = "nvidia,tegra186-sdhci";
                reg = <0x0 0x03400000 0x0 0x10000>;
                interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
-               clocks = <&bpmp TEGRA186_CLK_SDMMC1>;
-               clock-names = "sdhci";
+               clocks = <&bpmp TEGRA186_CLK_SDMMC1>,
+                        <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>;
+               clock-names = "sdhci", "tmclk";
                resets = <&bpmp TEGRA186_RESET_SDMMC1>;
                reset-names = "sdhci";
                interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRA &emc>,
                compatible = "nvidia,tegra186-sdhci";
                reg = <0x0 0x03420000 0x0 0x10000>;
                interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
-               clocks = <&bpmp TEGRA186_CLK_SDMMC2>;
-               clock-names = "sdhci";
+               clocks = <&bpmp TEGRA186_CLK_SDMMC2>,
+                        <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>;
+               clock-names = "sdhci", "tmclk";
                resets = <&bpmp TEGRA186_RESET_SDMMC2>;
                reset-names = "sdhci";
                interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRAA &emc>,
                compatible = "nvidia,tegra186-sdhci";
                reg = <0x0 0x03440000 0x0 0x10000>;
                interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
-               clocks = <&bpmp TEGRA186_CLK_SDMMC3>;
-               clock-names = "sdhci";
+               clocks = <&bpmp TEGRA186_CLK_SDMMC3>,
+                        <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>;
+               clock-names = "sdhci", "tmclk";
                resets = <&bpmp TEGRA186_RESET_SDMMC3>;
                reset-names = "sdhci";
                interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCR &emc>,
                compatible = "nvidia,tegra186-sdhci";
                reg = <0x0 0x03460000 0x0 0x10000>;
                interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
-               clocks = <&bpmp TEGRA186_CLK_SDMMC4>;
-               clock-names = "sdhci";
+               clocks = <&bpmp TEGRA186_CLK_SDMMC4>,
+                        <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>;
+               clock-names = "sdhci", "tmclk";
                assigned-clocks = <&bpmp TEGRA186_CLK_SDMMC4>,
                                  <&bpmp TEGRA186_CLK_PLLC4_VCO>;
                assigned-clock-parents = <&bpmp TEGRA186_CLK_PLLC4_VCO>;
index 48160f48003aa65dc9ff0b3a2108769916d4023f..ca5cb6aef5ee43606bef3eb856a5760787ab851e 100644 (file)
                        compatible = "nvidia,tegra194-sdhci";
                        reg = <0x03400000 0x10000>;
                        interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&bpmp TEGRA194_CLK_SDMMC1>;
-                       clock-names = "sdhci";
+                       clocks = <&bpmp TEGRA194_CLK_SDMMC1>,
+                                <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>;
+                       clock-names = "sdhci", "tmclk";
                        resets = <&bpmp TEGRA194_RESET_SDMMC1>;
                        reset-names = "sdhci";
                        interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCRA &emc>,
                        compatible = "nvidia,tegra194-sdhci";
                        reg = <0x03440000 0x10000>;
                        interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&bpmp TEGRA194_CLK_SDMMC3>;
-                       clock-names = "sdhci";
+                       clocks = <&bpmp TEGRA194_CLK_SDMMC3>,
+                                <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>;
+                       clock-names = "sdhci", "tmclk";
                        resets = <&bpmp TEGRA194_RESET_SDMMC3>;
                        reset-names = "sdhci";
                        interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCR &emc>,
                        compatible = "nvidia,tegra194-sdhci";
                        reg = <0x03460000 0x10000>;
                        interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
-                       clocks = <&bpmp TEGRA194_CLK_SDMMC4>;
-                       clock-names = "sdhci";
+                       clocks = <&bpmp TEGRA194_CLK_SDMMC4>,
+                                <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>;
+                       clock-names = "sdhci", "tmclk";
                        assigned-clocks = <&bpmp TEGRA194_CLK_SDMMC4>,
                                          <&bpmp TEGRA194_CLK_PLLC4>;
                        assigned-clock-parents =
index 829f786af1338d80aab566d6db830f296c320551..8cca2166a446ab7e384ae8236bb4ab95863301b4 100644 (file)
                compatible = "nvidia,tegra210-sdhci";
                reg = <0x0 0x700b0000 0x0 0x200>;
                interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
-               clocks = <&tegra_car TEGRA210_CLK_SDMMC1>;
-               clock-names = "sdhci";
+               clocks = <&tegra_car TEGRA210_CLK_SDMMC1>,
+                        <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
+               clock-names = "sdhci", "tmclk";
                resets = <&tegra_car 14>;
                reset-names = "sdhci";
                pinctrl-names = "sdmmc-3v3", "sdmmc-1v8",
                compatible = "nvidia,tegra210-sdhci";
                reg = <0x0 0x700b0200 0x0 0x200>;
                interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
-               clocks = <&tegra_car TEGRA210_CLK_SDMMC2>;
-               clock-names = "sdhci";
+               clocks = <&tegra_car TEGRA210_CLK_SDMMC2>,
+                        <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
+               clock-names = "sdhci", "tmclk";
                resets = <&tegra_car 9>;
                reset-names = "sdhci";
                pinctrl-names = "sdmmc-1v8-drv";
                compatible = "nvidia,tegra210-sdhci";
                reg = <0x0 0x700b0400 0x0 0x200>;
                interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
-               clocks = <&tegra_car TEGRA210_CLK_SDMMC3>;
-               clock-names = "sdhci";
+               clocks = <&tegra_car TEGRA210_CLK_SDMMC3>,
+                        <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
+               clock-names = "sdhci", "tmclk";
                resets = <&tegra_car 69>;
                reset-names = "sdhci";
                pinctrl-names = "sdmmc-3v3", "sdmmc-1v8",
                compatible = "nvidia,tegra210-sdhci";
                reg = <0x0 0x700b0600 0x0 0x200>;
                interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
-               clocks = <&tegra_car TEGRA210_CLK_SDMMC4>;
-               clock-names = "sdhci";
+               clocks = <&tegra_car TEGRA210_CLK_SDMMC4>,
+                        <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
+               clock-names = "sdhci", "tmclk";
                resets = <&tegra_car 15>;
                reset-names = "sdhci";
                pinctrl-names = "sdmmc-3v3-drv", "sdmmc-1v8-drv";
index 9edfae5944f727a700a336e3b928fb91280e131a..24ef18fe77df07fb24a05ac5297a546ca1f374e7 100644 (file)
                ti,intr-trigger-type = <1>;
                interrupt-controller;
                interrupt-parent = <&gic500>;
-               #interrupt-cells = <2>;
+               #interrupt-cells = <1>;
                ti,sci = <&dmsc>;
-               ti,sci-dst-id = <56>;
-               ti,sci-rm-range-girq = <0x1>;
+               ti,sci-dev-id = <100>;
+               ti,interrupt-ranges = <0 392 32>;
        };
 
        main_navss {
                        ti,intr-trigger-type = <4>;
                        interrupt-controller;
                        interrupt-parent = <&gic500>;
-                       #interrupt-cells = <2>;
+                       #interrupt-cells = <1>;
                        ti,sci = <&dmsc>;
-                       ti,sci-dst-id = <56>;
-                       ti,sci-rm-range-girq = <0x0>, <0x2>;
+                       ti,sci-dev-id = <182>;
+                       ti,interrupt-ranges = <0 64 64>,
+                                             <64 448 64>;
                };
 
                inta_main_udmass: interrupt-controller@33d00000 {
                        msi-controller;
                        ti,sci = <&dmsc>;
                        ti,sci-dev-id = <179>;
-                       ti,sci-rm-range-vint = <0x0>;
-                       ti,sci-rm-range-global-event = <0x1>;
+                       ti,interrupt-ranges = <0 0 256>;
                };
 
                secure_proxy_main: mailbox@32c00000 {
                                <0x0 0x33000000 0x0 0x40000>;
                        reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target";
                        ti,num-rings = <818>;
-                       ti,sci-rm-range-gp-rings = <0x2>; /* GP ring range */
+                       ti,sci-rm-range-gp-rings = <0x1>; /* GP ring range */
                        ti,dma-ring-reset-quirk;
                        ti,sci = <&dmsc>;
                        ti,sci-dev-id = <187>;
                        ti,sci-dev-id = <188>;
                        ti,ringacc = <&ringacc>;
 
-                       ti,sci-rm-range-tchan = <0x1>, /* TX_HCHAN */
-                                               <0x2>; /* TX_CHAN */
-                       ti,sci-rm-range-rchan = <0x4>, /* RX_HCHAN */
-                                               <0x5>; /* RX_CHAN */
-                       ti,sci-rm-range-rflow = <0x6>; /* GP RFLOW */
+                       ti,sci-rm-range-tchan = <0xf>, /* TX_HCHAN */
+                                               <0xd>; /* TX_CHAN */
+                       ti,sci-rm-range-rchan = <0xb>, /* RX_HCHAN */
+                                               <0xa>; /* RX_CHAN */
+                       ti,sci-rm-range-rflow = <0x0>; /* GP RFLOW */
                };
 
                cpts@310d0000 {
                        reg-names = "cpts";
                        clocks = <&main_cpts_mux>;
                        clock-names = "cpts";
-                       interrupts-extended = <&intr_main_navss 163 0>;
+                       interrupts-extended = <&intr_main_navss 391>;
                        interrupt-names = "cpts";
                        ti,cpts-periodic-outputs = <6>;
                        ti,cpts-ext-ts-inputs = <8>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&intr_main_gpio>;
-               interrupts = <57 256>, <57 257>, <57 258>, <57 259>, <57 260>,
-                               <57 261>;
+               interrupts = <192>, <193>, <194>, <195>, <196>, <197>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <96>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&intr_main_gpio>;
-               interrupts = <58 256>, <58 257>, <58 258>, <58 259>, <58 260>,
-                               <58 261>;
+               interrupts = <200>, <201>, <202>, <203>, <204>, <205>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <90>;
index 8c1abcfe08605c18c339709c71c26431ace4d1e3..51ca4b4d4c21438d43de8b1bbc2a80a92b4d8df7 100644 (file)
                                <0x0 0x2a500000 0x0 0x40000>;
                        reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target";
                        ti,num-rings = <286>;
-                       ti,sci-rm-range-gp-rings = <0x2>; /* GP ring range */
+                       ti,sci-rm-range-gp-rings = <0x1>; /* GP ring range */
                        ti,dma-ring-reset-quirk;
                        ti,sci = <&dmsc>;
                        ti,sci-dev-id = <195>;
                        ti,sci-dev-id = <194>;
                        ti,ringacc = <&mcu_ringacc>;
 
-                       ti,sci-rm-range-tchan = <0x1>, /* TX_HCHAN */
-                                               <0x2>; /* TX_CHAN */
-                       ti,sci-rm-range-rchan = <0x3>, /* RX_HCHAN */
-                                               <0x4>; /* RX_CHAN */
-                       ti,sci-rm-range-rflow = <0x5>; /* GP RFLOW */
+                       ti,sci-rm-range-tchan = <0xf>, /* TX_HCHAN */
+                                               <0xd>; /* TX_CHAN */
+                       ti,sci-rm-range-rchan = <0xb>, /* RX_HCHAN */
+                                               <0xa>; /* RX_CHAN */
+                       ti,sci-rm-range-rflow = <0x0>; /* GP RFLOW */
                };
        };
 
index 5f55b9e82cf1e467de6f92fdfc89bcb882d19e4a..a1ffe88d966414811ed9a8f8f1646c550c5d2a85 100644 (file)
                ti,intr-trigger-type = <1>;
                interrupt-controller;
                interrupt-parent = <&gic500>;
-               #interrupt-cells = <2>;
+               #interrupt-cells = <1>;
                ti,sci = <&dmsc>;
-               ti,sci-dst-id = <56>;
-               ti,sci-rm-range-girq = <0x4>;
+               ti,sci-dev-id = <156>;
+               ti,interrupt-ranges = <0 712 16>;
        };
 
        wkup_gpio0: wkup_gpio0@42110000 {
@@ -86,7 +86,7 @@
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&intr_wkup_gpio>;
-               interrupts = <59 128>, <59 129>, <59 130>, <59 131>;
+               interrupts = <60>, <61>, <62>, <63>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <56>;
index 611e6620701078e0e7a0fc9b8374834ba67d7029..b8a8a0fcb8af1a6c04e26aca57e16053af5087d4 100644 (file)
 };
 
 &mailbox0_cluster0 {
-       interrupts = <164 0>;
+       interrupts = <436>;
 
        mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
                ti,mbox-tx = <1 0 0>;
 };
 
 &mailbox0_cluster1 {
-       interrupts = <165 0>;
+       interrupts = <432>;
 
        mbox_mcu_r5fss0_core1: mbox-mcu-r5fss0-core1 {
                ti,mbox-tx = <1 0 0>;
index 8bc1e6ecc50ebcf083829bf3f8d509abfb92ca0b..e8fc01d97adadaddb8d253d33e3358af06ad55fe 100644 (file)
 };
 
 &mailbox0_cluster0 {
-       interrupts = <214 0>;
+       interrupts = <436>;
 
        mbox_mcu_r5fss0_core0: mbox-mcu-r5fss0-core0 {
                ti,mbox-rx = <0 0 0>;
 };
 
 &mailbox0_cluster1 {
-       interrupts = <215 0>;
+       interrupts = <432>;
 
        mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 {
                ti,mbox-rx = <0 0 0>;
 };
 
 &mailbox0_cluster2 {
-       interrupts = <216 0>;
+       interrupts = <428>;
 
        mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 {
                ti,mbox-rx = <0 0 0>;
 };
 
 &mailbox0_cluster3 {
-       interrupts = <217 0>;
+       interrupts = <424>;
 
        mbox_c66_0: mbox-c66-0 {
                ti,mbox-rx = <0 0 0>;
 };
 
 &mailbox0_cluster4 {
-       interrupts = <218 0>;
+       interrupts = <420>;
 
        mbox_c71_0: mbox-c71-0 {
                ti,mbox-rx = <0 0 0>;
index d14060207f0097f31dd106bc945720d4eaa4e719..12ceea9b3c9aef8da1ea4610ba3cd7083d9fd722 100644 (file)
                ti,intr-trigger-type = <1>;
                interrupt-controller;
                interrupt-parent = <&gic500>;
-               #interrupt-cells = <2>;
+               #interrupt-cells = <1>;
                ti,sci = <&dmsc>;
-               ti,sci-dst-id = <14>;
-               ti,sci-rm-range-girq = <0x1>;
+               ti,sci-dev-id = <131>;
+               ti,interrupt-ranges = <8 392 56>;
        };
 
        main_navss {
                        ti,intr-trigger-type = <4>;
                        interrupt-controller;
                        interrupt-parent = <&gic500>;
-                       #interrupt-cells = <2>;
+                       #interrupt-cells = <1>;
                        ti,sci = <&dmsc>;
-                       ti,sci-dst-id = <14>;
-                       ti,sci-rm-range-girq = <0>, <2>;
+                       ti,sci-dev-id = <213>;
+                       ti,interrupt-ranges = <0 64 64>,
+                                             <64 448 64>,
+                                             <128 672 64>;
                };
 
                main_udmass_inta: interrupt-controller@33d00000 {
                        msi-controller;
                        ti,sci = <&dmsc>;
                        ti,sci-dev-id = <209>;
-                       ti,sci-rm-range-vint = <0xa>;
-                       ti,sci-rm-range-global-event = <0xd>;
+                       ti,interrupt-ranges = <0 0 256>;
                };
 
                secure_proxy_main: mailbox@32c00000 {
                        reg-names = "cpts";
                        clocks = <&k3_clks 201 1>;
                        clock-names = "cpts";
-                       interrupts-extended = <&main_navss_intr 201 0>;
+                       interrupts-extended = <&main_navss_intr 391>;
                        interrupt-names = "cpts";
                        ti,cpts-periodic-outputs = <6>;
                        ti,cpts-ext-ts-inputs = <8>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <105 0>, <105 1>, <105 2>, <105 3>,
-                            <105 4>, <105 5>, <105 6>, <105 7>;
+               interrupts = <256>, <257>, <258>, <259>,
+                            <260>, <261>, <262>, <263>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <128>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <106 0>, <106 1>, <106 2>;
+               interrupts = <288>, <289>, <290>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <36>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <107 0>, <107 1>, <107 2>, <107 3>,
-                            <107 4>, <107 5>, <107 6>, <107 7>;
+               interrupts = <264>, <265>, <266>, <267>,
+                            <268>, <269>, <270>, <271>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <128>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <108 0>, <108 1>, <108 2>;
+               interrupts = <292>, <293>, <294>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <36>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <109 0>, <109 1>, <109 2>, <109 3>,
-                            <109 4>, <109 5>, <109 6>, <109 7>;
+               interrupts = <272>, <273>, <274>, <275>,
+                            <276>, <277>, <278>, <279>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <128>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <110 0>, <110 1>, <110 2>;
+               interrupts = <296>, <297>, <298>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <36>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <111 0>, <111 1>, <111 2>, <111 3>,
-                            <111 4>, <111 5>, <111 6>, <111 7>;
+               interrupts = <280>, <281>, <282>, <283>,
+                            <284>, <285>, <286>, <287>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <128>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&main_gpio_intr>;
-               interrupts = <112 0>, <112 1>, <112 2>;
+               interrupts = <300>, <301>, <302>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <36>;
index 30a735bcd0c894f37ef53ba7ffee9f1d8bb90c41..c4a48e8d420a2b42e280f22d72373260575db7ee 100644 (file)
                ti,intr-trigger-type = <1>;
                interrupt-controller;
                interrupt-parent = <&gic500>;
-               #interrupt-cells = <2>;
+               #interrupt-cells = <1>;
                ti,sci = <&dmsc>;
-               ti,sci-dst-id = <14>;
-               ti,sci-rm-range-girq = <0x5>;
+               ti,sci-dev-id = <137>;
+               ti,interrupt-ranges = <16 960 16>;
        };
 
        wkup_gpio0: gpio@42110000 {
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&wkup_gpio_intr>;
-               interrupts = <113 0>, <113 1>, <113 2>,
-                            <113 3>, <113 4>, <113 5>;
+               interrupts = <103>, <104>, <105>, <106>, <107>, <108>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <84>;
                gpio-controller;
                #gpio-cells = <2>;
                interrupt-parent = <&wkup_gpio_intr>;
-               interrupts = <114 0>, <114 1>, <114 2>,
-                            <114 3>, <114 4>, <114 5>;
+               interrupts = <112>, <113>, <114>, <115>, <116>, <117>;
                interrupt-controller;
                #interrupt-cells = <2>;
                ti,ngpio = <84>;
index 9174ddc76bdc3a9ce651d0f25f844fc1afe2d31c..3ec99f13c259e34fc6180d430f3cd52abbcb772d 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <dt-bindings/power/xlnx-zynqmp-power.h>
+#include <dt-bindings/reset/xlnx-zynqmp-resets.h>
 
 / {
        compatible = "xlnx,zynqmp";
                        };
                };
 
+               psgtr: phy@fd400000 {
+                       compatible = "xlnx,zynqmp-psgtr-v1.1";
+                       status = "disabled";
+                       reg = <0x0 0xfd400000 0x0 0x40000>,
+                             <0x0 0xfd3d0000 0x0 0x1000>;
+                       reg-names = "serdes", "siou";
+                       #phy-cells = <4>;
+               };
+
                rtc: rtc@ffa60000 {
                        compatible = "xlnx,zynqmp-rtc";
                        status = "disabled";
                        power-domains = <&zynqmp_firmware PD_SD_1>;
                };
 
-               smmu: smmu@fd800000 {
+               smmu: iommu@fd800000 {
                        compatible = "arm,mmu-500";
                        reg = <0x0 0xfd800000 0x0 0x20000>;
                        status = "disabled";
index e0f33826819f1e0f0e038dec3dc13da7c5034228..6d04b9577b0bddf95a219e6b00e47c0ae590d894 100644 (file)
@@ -724,6 +724,17 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_RENESAS_USBHS_UDC=m
 CONFIG_USB_RENESAS_USB3=m
 CONFIG_USB_TEGRA_XUDC=m
+CONFIG_USB_CONFIGFS=m
+CONFIG_USB_CONFIGFS_SERIAL=y
+CONFIG_USB_CONFIGFS_ACM=y
+CONFIG_USB_CONFIGFS_OBEX=y
+CONFIG_USB_CONFIGFS_NCM=y
+CONFIG_USB_CONFIGFS_ECM=y
+CONFIG_USB_CONFIGFS_ECM_SUBSET=y
+CONFIG_USB_CONFIGFS_RNDIS=y
+CONFIG_USB_CONFIGFS_EEM=y
+CONFIG_USB_CONFIGFS_MASS_STORAGE=y
+CONFIG_USB_CONFIGFS_F_FS=y
 CONFIG_TYPEC=m
 CONFIG_TYPEC_TCPM=m
 CONFIG_TYPEC_FUSB302=m
@@ -914,6 +925,7 @@ CONFIG_ARCH_TEGRA_194_SOC=y
 CONFIG_ARCH_K3_AM6_SOC=y
 CONFIG_ARCH_K3_J721E_SOC=y
 CONFIG_TI_SCI_PM_DOMAINS=y
+CONFIG_EXTCON_PTN5150=m
 CONFIG_EXTCON_USB_GPIO=y
 CONFIG_EXTCON_USBC_CROS_EC=y
 CONFIG_IIO=y
index 51a7ce87cdfe07c55409d766118dfedda56d9535..6fb2e6bcc392fe8b0f5e7ebee1a1893fdc4c548d 100644 (file)
@@ -2,6 +2,12 @@
 #ifndef __ASM_COMPILER_H
 #define __ASM_COMPILER_H
 
+#ifdef ARM64_ASM_ARCH
+#define ARM64_ASM_PREAMBLE ".arch " ARM64_ASM_ARCH "\n"
+#else
+#define ARM64_ASM_PREAMBLE
+#endif
+
 /*
  * The EL0/EL1 pointer bits used by a pointer authentication code.
  * This is dependent on TBI0/TBI1 being enabled, or bits 63:56 would also apply.
index aa4b6521ef14412796c6ddd1367d33ff9652c278..ff328e5bbb75721e93d1df93bf43cf55aae6f492 100644 (file)
@@ -95,6 +95,11 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
        return res;
 }
 
+static inline int arch_irqs_disabled(void)
+{
+       return arch_irqs_disabled_flags(arch_local_save_flags());
+}
+
 static inline unsigned long arch_local_irq_save(void)
 {
        unsigned long flags;
index 51c1d9918999205d9034781f5ea8a68a335201b2..1da8e3dc4455511de6b14f37e23a9533eaa144fe 100644 (file)
  * IMO:                Override CPSR.I and enable signaling with VI
  * FMO:                Override CPSR.F and enable signaling with VF
  * SWIO:       Turn set/way invalidates into set/way clean+invalidate
+ * PTW:                Take a stage2 fault if a stage1 walk steps in device memory
  */
 #define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | HCR_VM | \
                         HCR_BSU_IS | HCR_FB | HCR_TAC | \
                         HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW | HCR_TLOR | \
-                        HCR_FMO | HCR_IMO)
+                        HCR_FMO | HCR_IMO | HCR_PTW )
 #define HCR_VIRT_EXCP_MASK (HCR_VSE | HCR_VI | HCR_VF)
 #define HCR_HOST_NVHE_FLAGS (HCR_RW | HCR_API | HCR_APK)
 #define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H)
index fb1a922b31ba2167d0d51467a17312f25037f436..6f98fbd0ac8162cc1b165aea059b68bbb20af4ae 100644 (file)
@@ -169,6 +169,34 @@ extern char __smccc_workaround_1_smc[__SMCCC_WORKAROUND_1_SMC_SZ];
                *__hyp_this_cpu_ptr(sym);                               \
         })
 
+#define __KVM_EXTABLE(from, to)                                                \
+       "       .pushsection    __kvm_ex_table, \"a\"\n"                \
+       "       .align          3\n"                                    \
+       "       .long           (" #from " - .), (" #to " - .)\n"       \
+       "       .popsection\n"
+
+
+#define __kvm_at(at_op, addr)                                          \
+( {                                                                    \
+       int __kvm_at_err = 0;                                           \
+       u64 spsr, elr;                                                  \
+       asm volatile(                                                   \
+       "       mrs     %1, spsr_el2\n"                                 \
+       "       mrs     %2, elr_el2\n"                                  \
+       "1:     at      "at_op", %3\n"                                  \
+       "       isb\n"                                                  \
+       "       b       9f\n"                                           \
+       "2:     msr     spsr_el2, %1\n"                                 \
+       "       msr     elr_el2, %2\n"                                  \
+       "       mov     %w0, %4\n"                                      \
+       "9:\n"                                                          \
+       __KVM_EXTABLE(1b, 2b)                                           \
+       : "+r" (__kvm_at_err), "=&r" (spsr), "=&r" (elr)                \
+       : "r" (addr), "i" (-EFAULT));                                   \
+       __kvm_at_err;                                                   \
+} )
+
+
 #else /* __ASSEMBLY__ */
 
 .macro hyp_adr_this_cpu reg, sym, tmp
@@ -193,6 +221,21 @@ extern char __smccc_workaround_1_smc[__SMCCC_WORKAROUND_1_SMC_SZ];
        ldr     \vcpu, [\ctxt, #HOST_CONTEXT_VCPU]
 .endm
 
+/*
+ * KVM extable for unexpected exceptions.
+ * In the same format _asm_extable, but output to a different section so that
+ * it can be mapped to EL2. The KVM version is not sorted. The caller must
+ * ensure:
+ * x18 has the hypervisor value to allow any Shadow-Call-Stack instrumented
+ * code to write to it, and that SPSR_EL2 and ELR_EL2 are restored by the fixup.
+ */
+.macro _kvm_extable, from, to
+       .pushsection    __kvm_ex_table, "a"
+       .align          3
+       .long           (\from - .), (\to - .)
+       .popsection
+.endm
+
 #endif
 
 #endif /* __ARM_KVM_ASM_H__ */
index 49a55be2b9a20a260cd6fd2c0a31c7f875a8c692..1cc5f5f72d0bfe12e869d7f907c744613c8f6c71 100644 (file)
@@ -298,15 +298,15 @@ static __always_inline int kvm_vcpu_dabt_get_rd(const struct kvm_vcpu *vcpu)
        return (kvm_vcpu_get_esr(vcpu) & ESR_ELx_SRT_MASK) >> ESR_ELx_SRT_SHIFT;
 }
 
-static __always_inline bool kvm_vcpu_dabt_iss1tw(const struct kvm_vcpu *vcpu)
+static __always_inline bool kvm_vcpu_abt_iss1tw(const struct kvm_vcpu *vcpu)
 {
        return !!(kvm_vcpu_get_esr(vcpu) & ESR_ELx_S1PTW);
 }
 
+/* Always check for S1PTW *before* using this. */
 static __always_inline bool kvm_vcpu_dabt_iswrite(const struct kvm_vcpu *vcpu)
 {
-       return !!(kvm_vcpu_get_esr(vcpu) & ESR_ELx_WNR) ||
-               kvm_vcpu_dabt_iss1tw(vcpu); /* AF/DBM update */
+       return kvm_vcpu_get_esr(vcpu) & ESR_ELx_WNR;
 }
 
 static inline bool kvm_vcpu_dabt_is_cm(const struct kvm_vcpu *vcpu)
@@ -335,6 +335,11 @@ static inline bool kvm_vcpu_trap_is_iabt(const struct kvm_vcpu *vcpu)
        return kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_IABT_LOW;
 }
 
+static inline bool kvm_vcpu_trap_is_exec_fault(const struct kvm_vcpu *vcpu)
+{
+       return kvm_vcpu_trap_is_iabt(vcpu) && !kvm_vcpu_abt_iss1tw(vcpu);
+}
+
 static __always_inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu)
 {
        return kvm_vcpu_get_esr(vcpu) & ESR_ELx_FSC;
@@ -372,6 +377,9 @@ static __always_inline int kvm_vcpu_sys_get_rt(struct kvm_vcpu *vcpu)
 
 static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu)
 {
+       if (kvm_vcpu_abt_iss1tw(vcpu))
+               return true;
+
        if (kvm_vcpu_trap_is_iabt(vcpu))
                return false;
 
index e52c927aade53856a3d07622710891d23712be45..905c2b87e05acc8fb778b11a2220cccaa90041d4 100644 (file)
@@ -368,7 +368,6 @@ struct kvm_vcpu_arch {
 
        /* Guest PV state */
        struct {
-               u64 steal;
                u64 last_steal;
                gpa_t base;
        } steal;
@@ -544,6 +543,7 @@ long kvm_hypercall_pv_features(struct kvm_vcpu *vcpu);
 gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu);
 void kvm_update_stolen_time(struct kvm_vcpu *vcpu);
 
+bool kvm_arm_pvtime_supported(void);
 int kvm_arm_pvtime_set_attr(struct kvm_vcpu *vcpu,
                            struct kvm_device_attr *attr);
 int kvm_arm_pvtime_get_attr(struct kvm_vcpu *vcpu,
index d493174415dbf55a4ade7d13b7379988e990829d..cc3f5a33ff9c543c2911a7c33d0503b7d981a429 100644 (file)
  * not. The macros handles invoking the asm with or without the
  * register argument as appropriate.
  */
-#define __TLBI_0(op, arg) asm ("tlbi " #op "\n"                                       \
+#define __TLBI_0(op, arg) asm (ARM64_ASM_PREAMBLE                             \
+                              "tlbi " #op "\n"                                \
                   ALTERNATIVE("nop\n                   nop",                  \
                               "dsb ish\n               tlbi " #op,            \
                               ARM64_WORKAROUND_REPEAT_TLBI,                   \
                               CONFIG_ARM64_WORKAROUND_REPEAT_TLBI)            \
                            : : )
 
-#define __TLBI_1(op, arg) asm ("tlbi " #op ", %0\n"                           \
+#define __TLBI_1(op, arg) asm (ARM64_ASM_PREAMBLE                             \
+                              "tlbi " #op ", %0\n"                            \
                   ALTERNATIVE("nop\n                   nop",                  \
                               "dsb ish\n               tlbi " #op ", %0",     \
                               ARM64_WORKAROUND_REPEAT_TLBI,                   \
index 4559664011026a5920788b192cc832c921c2a922..cada0b816c8a35a084d86e97797e39b8b1fa6d51 100644 (file)
@@ -298,8 +298,21 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
                case EFI_BOOT_SERVICES_DATA:
                case EFI_CONVENTIONAL_MEMORY:
                case EFI_PERSISTENT_MEMORY:
-                       pr_warn(FW_BUG "requested region covers kernel memory @ %pa\n", &phys);
-                       return NULL;
+                       if (memblock_is_map_memory(phys) ||
+                           !memblock_is_region_memory(phys, size)) {
+                               pr_warn(FW_BUG "requested region covers kernel memory @ %pa\n", &phys);
+                               return NULL;
+                       }
+                       /*
+                        * Mapping kernel memory is permitted if the region in
+                        * question is covered by a single memblock with the
+                        * NOMAP attribute set: this enables the use of ACPI
+                        * table overrides passed via initramfs, which are
+                        * reserved in memory using arch_reserve_mem_area()
+                        * below. As this particular use case only requires
+                        * read access, fall through to the R/O mapping case.
+                        */
+                       fallthrough;
 
                case EFI_RUNTIME_SERVICES_CODE:
                        /*
@@ -322,7 +335,7 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
                         */
                        if (memblock_is_map_memory(phys))
                                return (void __iomem *)__phys_to_virt(phys);
-                       /* fall through */
+                       fallthrough;
 
                default:
                        if (region->attribute & EFI_MEMORY_WB)
@@ -388,3 +401,8 @@ int apei_claim_sea(struct pt_regs *regs)
 
        return err;
 }
+
+void arch_reserve_mem_area(acpi_physical_address addr, size_t size)
+{
+       memblock_mark_nomap(addr, size);
+}
index c332d49780dc96c6afe8cbe7b88f7cbef3d727b9..560ba69e13c11b0fccd018fe0cba0e76b8edd292 100644 (file)
@@ -910,8 +910,12 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
                .desc = "ARM erratum 1418040",
                .capability = ARM64_WORKAROUND_1418040,
                ERRATA_MIDR_RANGE_LIST(erratum_1418040_list),
-               .type = (ARM64_CPUCAP_SCOPE_LOCAL_CPU |
-                        ARM64_CPUCAP_PERMITTED_FOR_LATE_CPU),
+               /*
+                * We need to allow affected CPUs to come in late, but
+                * also need the non-affected CPUs to be able to come
+                * in at any point in time. Wonderful.
+                */
+               .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,
        },
 #endif
 #ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT
index a389b999482e739db360cb75da86721df3c49270..6424584be01e6dd0a6d5e846d8e205dad6a6f1c0 100644 (file)
@@ -686,7 +686,7 @@ static s64 arm64_ftr_safe_value(const struct arm64_ftr_bits *ftrp, s64 new,
        case FTR_HIGHER_OR_ZERO_SAFE:
                if (!cur || !new)
                        break;
-               /* Fallthrough */
+               fallthrough;
        case FTR_HIGHER_SAFE:
                ret = new > cur ? new : cur;
                break;
index 393c6fb1f1cb438c2cf0cb09ba922cf1e2250e59..d0076c2159e6676daf00d12b03b72ea0b1f263be 100644 (file)
@@ -327,7 +327,6 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
                set_bit(ICACHEF_VPIPT, &__icache_flags);
                break;
        default:
-               /* Fallthrough */
        case ICACHE_POLICY_VIPT:
                /* Assume aliasing */
                set_bit(ICACHEF_ALIASING, &__icache_flags);
index af234a1e08b7d29f66a2d9c2ff2fb7e0be74142b..712e97c03e54c287e4f6e9ee0e5d02ee3665a3cf 100644 (file)
@@ -257,7 +257,7 @@ static int hw_breakpoint_control(struct perf_event *bp,
                 * level.
                 */
                enable_debug_monitors(dbg_el);
-               /* Fall through */
+               fallthrough;
        case HW_BREAKPOINT_RESTORE:
                /* Setup the address register. */
                write_wb_reg(val_reg, i, info->address);
@@ -541,13 +541,13 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
                        if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2)
                                break;
 
-                       /* Fallthrough */
+                       fallthrough;
                case 3:
                        /* Allow single byte watchpoint. */
                        if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1)
                                break;
 
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        return -EINVAL;
                }
index 9e897c500237dfe449abdeba47257a9de5eba3b9..8982b68289b79f2d8177ed9e8eb5d861e14df0ef 100644 (file)
@@ -103,6 +103,10 @@ KVM_NVHE_ALIAS(vgic_v3_cpuif_trap);
 KVM_NVHE_ALIAS(gic_pmr_sync);
 #endif
 
+/* EL2 exception handling */
+KVM_NVHE_ALIAS(__start___kvm_ex_table);
+KVM_NVHE_ALIAS(__stop___kvm_ex_table);
+
 #endif /* CONFIG_KVM */
 
 #endif /* __ARM64_KERNEL_IMAGE_VARS_H */
index 0ce3a28e33479284880fccabfe49224504d46930..2e224435c0249ac28c5eb63f8577250a3ff89f40 100644 (file)
@@ -305,8 +305,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
                        mod->arch.core.plt_shndx = i;
                else if (!strcmp(secstrings + sechdrs[i].sh_name, ".init.plt"))
                        mod->arch.init.plt_shndx = i;
-               else if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE) &&
-                        !strcmp(secstrings + sechdrs[i].sh_name,
+               else if (!strcmp(secstrings + sechdrs[i].sh_name,
                                 ".text.ftrace_trampoline"))
                        tramp = sechdrs + i;
                else if (sechdrs[i].sh_type == SHT_SYMTAB)
index 1cd1a4d0ed30e651b2f8dc854933991f1f69e15d..2a1ad95d9b2ccd8a32ff9ee0f7f1748983561d5c 100644 (file)
@@ -315,21 +315,21 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
                /* MOVW instruction relocations. */
                case R_AARCH64_MOVW_UABS_G0_NC:
                        overflow_check = false;
-                       /* Fall through */
+                       fallthrough;
                case R_AARCH64_MOVW_UABS_G0:
                        ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 0,
                                              AARCH64_INSN_IMM_MOVKZ);
                        break;
                case R_AARCH64_MOVW_UABS_G1_NC:
                        overflow_check = false;
-                       /* Fall through */
+                       fallthrough;
                case R_AARCH64_MOVW_UABS_G1:
                        ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 16,
                                              AARCH64_INSN_IMM_MOVKZ);
                        break;
                case R_AARCH64_MOVW_UABS_G2_NC:
                        overflow_check = false;
-                       /* Fall through */
+                       fallthrough;
                case R_AARCH64_MOVW_UABS_G2:
                        ovf = reloc_insn_movw(RELOC_OP_ABS, loc, val, 32,
                                              AARCH64_INSN_IMM_MOVKZ);
@@ -397,7 +397,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
                        break;
                case R_AARCH64_ADR_PREL_PG_HI21_NC:
                        overflow_check = false;
-                       /* Fall through */
+                       fallthrough;
                case R_AARCH64_ADR_PREL_PG_HI21:
                        ovf = reloc_insn_adrp(me, sechdrs, loc, val);
                        if (ovf && ovf != -ERANGE)
index 295d66490584bb8ec31073d77f3a99590f848b38..c07d7a03494108a9a75fea9e9bb6b98830b3d0fa 100644 (file)
@@ -50,16 +50,19 @@ static u64 pv_steal_clock(int cpu)
        struct pv_time_stolen_time_region *reg;
 
        reg = per_cpu_ptr(&stolen_time_region, cpu);
-       if (!reg->kaddr) {
-               pr_warn_once("stolen time enabled but not configured for cpu %d\n",
-                            cpu);
+
+       /*
+        * paravirt_steal_clock() may be called before the CPU
+        * online notification callback runs. Until the callback
+        * has run we just return zero.
+        */
+       if (!reg->kaddr)
                return 0;
-       }
 
        return le64_to_cpu(READ_ONCE(reg->kaddr->stolen_time));
 }
 
-static int stolen_time_dying_cpu(unsigned int cpu)
+static int stolen_time_cpu_down_prepare(unsigned int cpu)
 {
        struct pv_time_stolen_time_region *reg;
 
@@ -73,7 +76,7 @@ static int stolen_time_dying_cpu(unsigned int cpu)
        return 0;
 }
 
-static int init_stolen_time_cpu(unsigned int cpu)
+static int stolen_time_cpu_online(unsigned int cpu)
 {
        struct pv_time_stolen_time_region *reg;
        struct arm_smccc_res res;
@@ -103,19 +106,20 @@ static int init_stolen_time_cpu(unsigned int cpu)
        return 0;
 }
 
-static int pv_time_init_stolen_time(void)
+static int __init pv_time_init_stolen_time(void)
 {
        int ret;
 
-       ret = cpuhp_setup_state(CPUHP_AP_ARM_KVMPV_STARTING,
-                               "hypervisor/arm/pvtime:starting",
-                               init_stolen_time_cpu, stolen_time_dying_cpu);
+       ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
+                               "hypervisor/arm/pvtime:online",
+                               stolen_time_cpu_online,
+                               stolen_time_cpu_down_prepare);
        if (ret < 0)
                return ret;
        return 0;
 }
 
-static bool has_pv_steal_clock(void)
+static bool __init has_pv_steal_clock(void)
 {
        struct arm_smccc_res res;
 
index b63ce4c54cfe9c3804db3814cdb5b26b6aac38e5..f1804496b93508caad6174a635dbe91e98dfeedf 100644 (file)
@@ -123,10 +123,8 @@ void arch_cpu_idle(void)
         * This should do all the clock switching and wait for interrupt
         * tricks
         */
-       trace_cpu_idle_rcuidle(1, smp_processor_id());
        cpu_do_idle();
        local_irq_enable();
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
index 77c4c9bad1b8527280428bde70c38f37f4410fc1..53acbeca4f574f9528feb6b64dd273496698fa03 100644 (file)
@@ -280,7 +280,6 @@ u64 cpu_logical_map(int cpu)
 {
        return __cpu_logical_map[cpu];
 }
-EXPORT_SYMBOL_GPL(cpu_logical_map);
 
 void __init __no_sanitize_address setup_arch(char **cmdline_p)
 {
index 03957a1ae6c0cc27a16e6011f61a3a83c8bf6183..355ee9eed4dded61a666edd0944aa14a512128e9 100644 (file)
@@ -151,7 +151,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
                        break;
                }
                pr_crit("CPU%u: may not have shut down cleanly\n", cpu);
-               /* Fall through */
+               fallthrough;
        case CPU_STUCK_IN_KERNEL:
                pr_crit("CPU%u: is stuck in kernel\n", cpu);
                if (status & CPU_STUCK_REASON_52_BIT_VA)
index ec8e894684a78eee91df855949da3a5eb309528b..7cba7623fcec75a7411c3388a3d5b516e46c49cc 100644 (file)
@@ -20,6 +20,13 @@ ENTRY(_text)
 
 jiffies = jiffies_64;
 
+
+#define HYPERVISOR_EXTABLE                                     \
+       . = ALIGN(SZ_8);                                        \
+       __start___kvm_ex_table = .;                             \
+       *(__kvm_ex_table)                                       \
+       __stop___kvm_ex_table = .;
+
 #define HYPERVISOR_TEXT                                        \
        /*                                              \
         * Align to 4 KB so that                        \
@@ -35,6 +42,7 @@ jiffies = jiffies_64;
        __hyp_idmap_text_end = .;                       \
        __hyp_text_start = .;                           \
        *(.hyp.text)                                    \
+       HYPERVISOR_EXTABLE                              \
        __hyp_text_end = .;
 
 #define IDMAP_TEXT                                     \
index 46dc3d75cf1359f0d128dfef9fe98f82caccc82d..b588c3b5c2f07b580be180ff727b3ff2db7d7c78 100644 (file)
@@ -206,6 +206,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
                 */
                r = 1;
                break;
+       case KVM_CAP_STEAL_TIME:
+               r = kvm_arm_pvtime_supported();
+               break;
        default:
                r = kvm_arch_vm_ioctl_check_extension(kvm, ext);
                break;
index fe6c7d79309d6724825ee7429b2cb0bc944beb4d..5d690d60ccad53bc6889365196537dcee26d2ab2 100644 (file)
@@ -128,7 +128,7 @@ static int kvm_handle_guest_debug(struct kvm_vcpu *vcpu)
        switch (ESR_ELx_EC(esr)) {
        case ESR_ELx_EC_WATCHPT_LOW:
                run->debug.arch.far = vcpu->arch.fault.far_el2;
-               /* fall through */
+               fallthrough;
        case ESR_ELx_EC_SOFTSTP_LOW:
        case ESR_ELx_EC_BREAKPT_LOW:
        case ESR_ELx_EC_BKPT32:
index ee32a77433898da3e24bafcbee5d8c64ea2ab4d4..76e7eaf4675eb4b7a148ab06c4db62c33dc2db96 100644 (file)
@@ -196,20 +196,23 @@ alternative_endif
        // This is our single instruction exception window. A pending
        // SError is guaranteed to occur at the earliest when we unmask
        // it, and at the latest just after the ISB.
-       .global abort_guest_exit_start
 abort_guest_exit_start:
 
        isb
 
-       .global abort_guest_exit_end
 abort_guest_exit_end:
 
        msr     daifset, #4     // Mask aborts
+       ret
+
+       _kvm_extable    abort_guest_exit_start, 9997f
+       _kvm_extable    abort_guest_exit_end, 9997f
+9997:
+       msr     daifset, #4     // Mask aborts
+       mov     x0, #(1 << ARM_EXIT_WITH_SERROR_BIT)
 
-       // If the exception took place, restore the EL1 exception
-       // context so that we can report some information.
-       // Merge the exception code with the SError pending bit.
-       tbz     x0, #ARM_EXIT_WITH_SERROR_BIT, 1f
+       // restore the EL1 exception context so that we can report some
+       // information. Merge the exception code with the SError pending bit.
        msr     elr_el2, x2
        msr     esr_el2, x3
        msr     spsr_el2, x4
index 689fccbc9de72d84894f0383b469dfeaba8894b8..46b4dab933d0e7c415a9deff583565970bdba1c1 100644 (file)
 #include <asm/kvm_mmu.h>
 #include <asm/mmu.h>
 
+.macro save_caller_saved_regs_vect
+       /* x0 and x1 were saved in the vector entry */
+       stp     x2, x3,   [sp, #-16]!
+       stp     x4, x5,   [sp, #-16]!
+       stp     x6, x7,   [sp, #-16]!
+       stp     x8, x9,   [sp, #-16]!
+       stp     x10, x11, [sp, #-16]!
+       stp     x12, x13, [sp, #-16]!
+       stp     x14, x15, [sp, #-16]!
+       stp     x16, x17, [sp, #-16]!
+.endm
+
+.macro restore_caller_saved_regs_vect
+       ldp     x16, x17, [sp], #16
+       ldp     x14, x15, [sp], #16
+       ldp     x12, x13, [sp], #16
+       ldp     x10, x11, [sp], #16
+       ldp     x8, x9,   [sp], #16
+       ldp     x6, x7,   [sp], #16
+       ldp     x4, x5,   [sp], #16
+       ldp     x2, x3,   [sp], #16
+       ldp     x0, x1,   [sp], #16
+.endm
+
        .text
 
 .macro do_el2_call
@@ -143,13 +167,19 @@ el1_error:
        b       __guest_exit
 
 el2_sync:
-       /* Check for illegal exception return, otherwise panic */
+       /* Check for illegal exception return */
        mrs     x0, spsr_el2
+       tbnz    x0, #20, 1f
 
-       /* if this was something else, then panic! */
-       tst     x0, #PSR_IL_BIT
-       b.eq    __hyp_panic
+       save_caller_saved_regs_vect
+       stp     x29, x30, [sp, #-16]!
+       bl      kvm_unexpected_el2_exception
+       ldp     x29, x30, [sp], #16
+       restore_caller_saved_regs_vect
 
+       eret
+
+1:
        /* Let's attempt a recovery from the illegal exception return */
        get_vcpu_ptr    x1, x0
        mov     x0, #ARM_EXCEPTION_IL
@@ -157,27 +187,14 @@ el2_sync:
 
 
 el2_error:
-       ldp     x0, x1, [sp], #16
+       save_caller_saved_regs_vect
+       stp     x29, x30, [sp, #-16]!
+
+       bl      kvm_unexpected_el2_exception
+
+       ldp     x29, x30, [sp], #16
+       restore_caller_saved_regs_vect
 
-       /*
-        * Only two possibilities:
-        * 1) Either we come from the exit path, having just unmasked
-        *    PSTATE.A: change the return code to an EL2 fault, and
-        *    carry on, as we're already in a sane state to handle it.
-        * 2) Or we come from anywhere else, and that's a bug: we panic.
-        *
-        * For (1), x0 contains the original return code and x1 doesn't
-        * contain anything meaningful at that stage. We can reuse them
-        * as temp registers.
-        * For (2), who cares?
-        */
-       mrs     x0, elr_el2
-       adr     x1, abort_guest_exit_start
-       cmp     x0, x1
-       adr     x1, abort_guest_exit_end
-       ccmp    x0, x1, #4, ne
-       b.ne    __hyp_panic
-       mov     x0, #(1 << ARM_EXIT_WITH_SERROR_BIT)
        eret
        sb
 
index 0297dc63988c0faa897234524a985ac334ceb025..5e28ea6aa097b026c0b61fd37f5be18ab34ba649 100644 (file)
 #define save_debug(ptr,reg,nr)                                         \
        switch (nr) {                                                   \
        case 15:        ptr[15] = read_debug(reg, 15);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 14:        ptr[14] = read_debug(reg, 14);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 13:        ptr[13] = read_debug(reg, 13);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 12:        ptr[12] = read_debug(reg, 12);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 11:        ptr[11] = read_debug(reg, 11);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 10:        ptr[10] = read_debug(reg, 10);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 9:         ptr[9] = read_debug(reg, 9);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 8:         ptr[8] = read_debug(reg, 8);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 7:         ptr[7] = read_debug(reg, 7);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 6:         ptr[6] = read_debug(reg, 6);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 5:         ptr[5] = read_debug(reg, 5);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 4:         ptr[4] = read_debug(reg, 4);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 3:         ptr[3] = read_debug(reg, 3);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 2:         ptr[2] = read_debug(reg, 2);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 1:         ptr[1] = read_debug(reg, 1);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        default:        ptr[0] = read_debug(reg, 0);                    \
        }
 
 #define restore_debug(ptr,reg,nr)                                      \
        switch (nr) {                                                   \
        case 15:        write_debug(ptr[15], reg, 15);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 14:        write_debug(ptr[14], reg, 14);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 13:        write_debug(ptr[13], reg, 13);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 12:        write_debug(ptr[12], reg, 12);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 11:        write_debug(ptr[11], reg, 11);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 10:        write_debug(ptr[10], reg, 10);                  \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 9:         write_debug(ptr[9], reg, 9);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 8:         write_debug(ptr[8], reg, 8);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 7:         write_debug(ptr[7], reg, 7);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 6:         write_debug(ptr[6], reg, 6);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 5:         write_debug(ptr[5], reg, 5);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 4:         write_debug(ptr[4], reg, 4);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 3:         write_debug(ptr[3], reg, 3);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 2:         write_debug(ptr[2], reg, 2);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        case 1:         write_debug(ptr[1], reg, 1);                    \
-                       /* Fall through */                              \
+                       fallthrough;                                    \
        default:        write_debug(ptr[0], reg, 0);                    \
        }
 
index 426ef65601dd9c82cc71828012bd0ac110514e8b..0261308bf944ac85d316a6d208c80b3e918ac931 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <asm/barrier.h>
 #include <asm/cpufeature.h>
+#include <asm/extable.h>
 #include <asm/kprobes.h>
 #include <asm/kvm_asm.h>
 #include <asm/kvm_emulate.h>
@@ -29,6 +30,9 @@
 
 extern const char __hyp_panic_string[];
 
+extern struct exception_table_entry __start___kvm_ex_table;
+extern struct exception_table_entry __stop___kvm_ex_table;
+
 /* Check whether the FP regs were dirtied while in the host-side run loop: */
 static inline bool update_fp_enabled(struct kvm_vcpu *vcpu)
 {
@@ -142,10 +146,10 @@ static inline bool __translate_far_to_hpfar(u64 far, u64 *hpfar)
         * saved the guest context yet, and we may return early...
         */
        par = read_sysreg(par_el1);
-       asm volatile("at s1e1r, %0" : : "r" (far));
-       isb();
-
-       tmp = read_sysreg(par_el1);
+       if (!__kvm_at("s1e1r", far))
+               tmp = read_sysreg(par_el1);
+       else
+               tmp = SYS_PAR_EL1_F; /* back to the guest */
        write_sysreg(par, par_el1);
 
        if (unlikely(tmp & SYS_PAR_EL1_F))
@@ -445,7 +449,7 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
                        kvm_vcpu_trap_get_fault_type(vcpu) == FSC_FAULT &&
                        kvm_vcpu_dabt_isvalid(vcpu) &&
                        !kvm_vcpu_abt_issea(vcpu) &&
-                       !kvm_vcpu_dabt_iss1tw(vcpu);
+                       !kvm_vcpu_abt_iss1tw(vcpu);
 
                if (valid) {
                        int ret = __vgic_v2_perform_cpuif_access(vcpu);
@@ -508,4 +512,31 @@ static inline void __set_host_arch_workaround_state(struct kvm_vcpu *vcpu)
 #endif
 }
 
+static inline void __kvm_unexpected_el2_exception(void)
+{
+       unsigned long addr, fixup;
+       struct kvm_cpu_context *host_ctxt;
+       struct exception_table_entry *entry, *end;
+       unsigned long elr_el2 = read_sysreg(elr_el2);
+
+       entry = hyp_symbol_addr(__start___kvm_ex_table);
+       end = hyp_symbol_addr(__stop___kvm_ex_table);
+       host_ctxt = &__hyp_this_cpu_ptr(kvm_host_data)->host_ctxt;
+
+       while (entry < end) {
+               addr = (unsigned long)&entry->insn + entry->insn;
+               fixup = (unsigned long)&entry->fixup + entry->fixup;
+
+               if (addr != elr_el2) {
+                       entry++;
+                       continue;
+               }
+
+               write_sysreg(fixup, elr_el2);
+               return;
+       }
+
+       hyp_panic(host_ctxt);
+}
+
 #endif /* __ARM64_KVM_HYP_SWITCH_H__ */
index 341be2f2f31261c36563b67d818d7f52b0c2ec05..0970442d2dbcf779c44d5f88155c65c3705712b8 100644 (file)
@@ -270,3 +270,8 @@ void __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt)
                       read_sysreg(hpfar_el2), par, vcpu);
        unreachable();
 }
+
+asmlinkage void kvm_unexpected_el2_exception(void)
+{
+       return __kvm_unexpected_el2_exception();
+}
index 5a0073511efb65dbae5fdb9fd7bb9b689d09d054..452f4cacd674351d2adb514a5c2f1b1269e2934c 100644 (file)
@@ -340,10 +340,10 @@ void __vgic_v3_save_aprs(struct vgic_v3_cpu_if *cpu_if)
        case 7:
                cpu_if->vgic_ap0r[3] = __vgic_v3_read_ap0rn(3);
                cpu_if->vgic_ap0r[2] = __vgic_v3_read_ap0rn(2);
-               /* Fall through */
+               fallthrough;
        case 6:
                cpu_if->vgic_ap0r[1] = __vgic_v3_read_ap0rn(1);
-               /* Fall through */
+               fallthrough;
        default:
                cpu_if->vgic_ap0r[0] = __vgic_v3_read_ap0rn(0);
        }
@@ -352,10 +352,10 @@ void __vgic_v3_save_aprs(struct vgic_v3_cpu_if *cpu_if)
        case 7:
                cpu_if->vgic_ap1r[3] = __vgic_v3_read_ap1rn(3);
                cpu_if->vgic_ap1r[2] = __vgic_v3_read_ap1rn(2);
-               /* Fall through */
+               fallthrough;
        case 6:
                cpu_if->vgic_ap1r[1] = __vgic_v3_read_ap1rn(1);
-               /* Fall through */
+               fallthrough;
        default:
                cpu_if->vgic_ap1r[0] = __vgic_v3_read_ap1rn(0);
        }
@@ -373,10 +373,10 @@ void __vgic_v3_restore_aprs(struct vgic_v3_cpu_if *cpu_if)
        case 7:
                __vgic_v3_write_ap0rn(cpu_if->vgic_ap0r[3], 3);
                __vgic_v3_write_ap0rn(cpu_if->vgic_ap0r[2], 2);
-               /* Fall through */
+               fallthrough;
        case 6:
                __vgic_v3_write_ap0rn(cpu_if->vgic_ap0r[1], 1);
-               /* Fall through */
+               fallthrough;
        default:
                __vgic_v3_write_ap0rn(cpu_if->vgic_ap0r[0], 0);
        }
@@ -385,10 +385,10 @@ void __vgic_v3_restore_aprs(struct vgic_v3_cpu_if *cpu_if)
        case 7:
                __vgic_v3_write_ap1rn(cpu_if->vgic_ap1r[3], 3);
                __vgic_v3_write_ap1rn(cpu_if->vgic_ap1r[2], 2);
-               /* Fall through */
+               fallthrough;
        case 6:
                __vgic_v3_write_ap1rn(cpu_if->vgic_ap1r[1], 1);
-               /* Fall through */
+               fallthrough;
        default:
                __vgic_v3_write_ap1rn(cpu_if->vgic_ap1r[0], 0);
        }
index c52d714e0d7592962011c709d7d728eb87d25375..c1da4f86ccacac9c65b0525265b2568f94217a57 100644 (file)
@@ -217,3 +217,8 @@ void __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt)
        __hyp_call_panic(spsr, elr, par, host_ctxt);
        unreachable();
 }
+
+asmlinkage void kvm_unexpected_el2_exception(void)
+{
+       return __kvm_unexpected_el2_exception();
+}
index ba00bcc0c88463b31ac11d7c1632fb6c86f710b2..3d26b47a1343080cfb502733390f5dc72f2970f4 100644 (file)
@@ -1849,7 +1849,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
        struct kvm_s2_mmu *mmu = vcpu->arch.hw_mmu;
 
        write_fault = kvm_is_write_fault(vcpu);
-       exec_fault = kvm_vcpu_trap_is_iabt(vcpu);
+       exec_fault = kvm_vcpu_trap_is_exec_fault(vcpu);
        VM_BUG_ON(write_fault && exec_fault);
 
        if (fault_status == FSC_PERM && !write_fault && !exec_fault) {
@@ -1877,6 +1877,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
            !fault_supports_stage2_huge_mapping(memslot, hva, vma_pagesize)) {
                force_pte = true;
                vma_pagesize = PAGE_SIZE;
+               vma_shift = PAGE_SHIFT;
        }
 
        /*
@@ -1970,7 +1971,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
                (fault_status == FSC_PERM &&
                 stage2_is_exec(mmu, fault_ipa, vma_pagesize));
 
-       if (vma_pagesize == PUD_SIZE) {
+       /*
+        * If PUD_SIZE == PMD_SIZE, there is no real PUD level, and
+        * all we have is a 2-level page table. Trying to map a PUD in
+        * this case would be fatally wrong.
+        */
+       if (PUD_SIZE != PMD_SIZE && vma_pagesize == PUD_SIZE) {
                pud_t new_pud = kvm_pfn_pud(pfn, mem_type);
 
                new_pud = kvm_pud_mkhuge(new_pud);
@@ -2125,7 +2131,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu)
                        goto out;
                }
 
-               if (kvm_vcpu_dabt_iss1tw(vcpu)) {
+               if (kvm_vcpu_abt_iss1tw(vcpu)) {
                        kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu));
                        ret = 1;
                        goto out_unlock;
index f7b52ce1557ec393635d1fb71aa4a76274627335..920ac43077ad3b48023c917bdd2eb8fb925e22dc 100644 (file)
 void kvm_update_stolen_time(struct kvm_vcpu *vcpu)
 {
        struct kvm *kvm = vcpu->kvm;
-       u64 steal;
-       __le64 steal_le;
-       u64 offset;
-       int idx;
        u64 base = vcpu->arch.steal.base;
+       u64 last_steal = vcpu->arch.steal.last_steal;
+       u64 offset = offsetof(struct pvclock_vcpu_stolen_time, stolen_time);
+       u64 steal = 0;
+       int idx;
 
        if (base == GPA_INVALID)
                return;
 
-       /* Let's do the local bookkeeping */
-       steal = vcpu->arch.steal.steal;
-       steal += current->sched_info.run_delay - vcpu->arch.steal.last_steal;
-       vcpu->arch.steal.last_steal = current->sched_info.run_delay;
-       vcpu->arch.steal.steal = steal;
-
-       steal_le = cpu_to_le64(steal);
        idx = srcu_read_lock(&kvm->srcu);
-       offset = offsetof(struct pvclock_vcpu_stolen_time, stolen_time);
-       kvm_put_guest(kvm, base + offset, steal_le, u64);
+       if (!kvm_get_guest(kvm, base + offset, steal)) {
+               steal = le64_to_cpu(steal);
+               vcpu->arch.steal.last_steal = READ_ONCE(current->sched_info.run_delay);
+               steal += vcpu->arch.steal.last_steal - last_steal;
+               kvm_put_guest(kvm, base + offset, cpu_to_le64(steal));
+       }
        srcu_read_unlock(&kvm->srcu, idx);
 }
 
@@ -43,7 +40,8 @@ long kvm_hypercall_pv_features(struct kvm_vcpu *vcpu)
        switch (feature) {
        case ARM_SMCCC_HV_PV_TIME_FEATURES:
        case ARM_SMCCC_HV_PV_TIME_ST:
-               val = SMCCC_RET_SUCCESS;
+               if (vcpu->arch.steal.base != GPA_INVALID)
+                       val = SMCCC_RET_SUCCESS;
                break;
        }
 
@@ -64,7 +62,6 @@ gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu)
         * Start counting stolen time from the time the guest requests
         * the feature enabled.
         */
-       vcpu->arch.steal.steal = 0;
        vcpu->arch.steal.last_steal = current->sched_info.run_delay;
 
        idx = srcu_read_lock(&kvm->srcu);
@@ -74,7 +71,7 @@ gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu)
        return base;
 }
 
-static bool kvm_arm_pvtime_supported(void)
+bool kvm_arm_pvtime_supported(void)
 {
        return !!sched_info_on();
 }
index 4691053c5ee426dc8601f009ac73e41972a8788a..ff0444352bba3eea5dfe8f1634a3d615a552b0f3 100644 (file)
@@ -23,7 +23,7 @@ TRACE_EVENT(kvm_entry,
                __entry->vcpu_pc                = vcpu_pc;
        ),
 
-       TP_printk("PC: 0x%08lx", __entry->vcpu_pc)
+       TP_printk("PC: 0x%016lx", __entry->vcpu_pc)
 );
 
 TRACE_EVENT(kvm_exit,
@@ -42,7 +42,7 @@ TRACE_EVENT(kvm_exit,
                __entry->vcpu_pc                = vcpu_pc;
        ),
 
-       TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx",
+       TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%016lx",
                  __print_symbolic(__entry->ret, kvm_arm_exception_type),
                  __entry->esr_ec,
                  __print_symbolic(__entry->esr_ec, kvm_arm_exception_class),
@@ -69,7 +69,7 @@ TRACE_EVENT(kvm_guest_fault,
                __entry->ipa                    = ipa;
        ),
 
-       TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx",
+       TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#016lx",
                  __entry->ipa, __entry->hsr,
                  __entry->hxfar, __entry->vcpu_pc)
 );
@@ -131,7 +131,7 @@ TRACE_EVENT(kvm_mmio_emulate,
                __entry->cpsr                   = cpsr;
        ),
 
-       TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)",
+       TP_printk("Emulate MMIO at: 0x%016lx (instr: %08lx, cpsr: %08lx)",
                  __entry->vcpu_pc, __entry->instr, __entry->cpsr)
 );
 
@@ -149,7 +149,7 @@ TRACE_EVENT(kvm_unmap_hva_range,
                __entry->end            = end;
        ),
 
-       TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
+       TP_printk("mmu notifier unmap range: %#016lx -- %#016lx",
                  __entry->start, __entry->end)
 );
 
@@ -165,7 +165,7 @@ TRACE_EVENT(kvm_set_spte_hva,
                __entry->hva            = hva;
        ),
 
-       TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva)
+       TP_printk("mmu notifier set pte hva: %#016lx", __entry->hva)
 );
 
 TRACE_EVENT(kvm_age_hva,
@@ -182,7 +182,7 @@ TRACE_EVENT(kvm_age_hva,
                __entry->end            = end;
        ),
 
-       TP_printk("mmu notifier age hva: %#08lx -- %#08lx",
+       TP_printk("mmu notifier age hva: %#016lx -- %#016lx",
                  __entry->start, __entry->end)
 );
 
@@ -198,7 +198,7 @@ TRACE_EVENT(kvm_test_age_hva,
                __entry->hva            = hva;
        ),
 
-       TP_printk("mmu notifier test age hva: %#08lx", __entry->hva)
+       TP_printk("mmu notifier test age hva: %#016lx", __entry->hva)
 );
 
 TRACE_EVENT(kvm_set_way_flush,
index 2c56d1e0f5bd543060ea99185409cee510dd6407..8d78acc4fba7efd0837ea396c751373b787dde87 100644 (file)
@@ -22,7 +22,7 @@ TRACE_EVENT(kvm_wfx_arm64,
                __entry->is_wfe  = is_wfe;
        ),
 
-       TP_printk("guest executed wf%c at: 0x%08lx",
+       TP_printk("guest executed wf%c at: 0x%016lx",
                  __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc)
 );
 
@@ -42,7 +42,7 @@ TRACE_EVENT(kvm_hvc_arm64,
                __entry->imm = imm;
        ),
 
-       TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx)",
+       TP_printk("HVC at 0x%016lx (r0: 0x%016lx, imm: 0x%lx)",
                  __entry->vcpu_pc, __entry->r0, __entry->imm)
 );
 
@@ -135,7 +135,7 @@ TRACE_EVENT(trap_reg,
                __entry->write_value = write_value;
        ),
 
-       TP_printk("%s %s reg %d (0x%08llx)", __entry->fn,  __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value)
+       TP_printk("%s %s reg %d (0x%016llx)", __entry->fn,  __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value)
 );
 
 TRACE_EVENT(kvm_handle_sys_reg,
index a206655a39a52b5d5ff139006c8aad7ba8d13615..9b11c096a04230e90cf47e41c0b51f3b35ab6ce3 100644 (file)
@@ -45,7 +45,7 @@ static u32 get_cpu_asid_bits(void)
        default:
                pr_warn("CPU%d: Unknown ASID size (%d); assuming 8-bit\n",
                                        smp_processor_id(),  fld);
-               /* Fallthrough */
+               fallthrough;
        case 0:
                asid = 8;
                break;
index f8912e45be7ab0033b5710a70c882da0ef1c0272..ef9f1d5e989d062a589e286d3dac30693d1e43c0 100644 (file)
@@ -143,14 +143,17 @@ static inline void emit_addr_mov_i64(const int reg, const u64 val,
        }
 }
 
-static inline int bpf2a64_offset(int bpf_to, int bpf_from,
+static inline int bpf2a64_offset(int bpf_insn, int off,
                                 const struct jit_ctx *ctx)
 {
-       int to = ctx->offset[bpf_to];
-       /* -1 to account for the Branch instruction */
-       int from = ctx->offset[bpf_from] - 1;
-
-       return to - from;
+       /* BPF JMP offset is relative to the next instruction */
+       bpf_insn++;
+       /*
+        * Whereas arm64 branch instructions encode the offset
+        * from the branch itself, so we must subtract 1 from the
+        * instruction offset.
+        */
+       return ctx->offset[bpf_insn + off] - (ctx->offset[bpf_insn] - 1);
 }
 
 static void jit_fill_hole(void *area, unsigned int size)
@@ -642,7 +645,7 @@ emit_bswap_uxt:
 
        /* JUMP off */
        case BPF_JMP | BPF_JA:
-               jmp_offset = bpf2a64_offset(i + off, i, ctx);
+               jmp_offset = bpf2a64_offset(i, off, ctx);
                check_imm26(jmp_offset);
                emit(A64_B(jmp_offset), ctx);
                break;
@@ -669,7 +672,7 @@ emit_bswap_uxt:
        case BPF_JMP32 | BPF_JSLE | BPF_X:
                emit(A64_CMP(is64, dst, src), ctx);
 emit_cond_jmp:
-               jmp_offset = bpf2a64_offset(i + off, i, ctx);
+               jmp_offset = bpf2a64_offset(i, off, ctx);
                check_imm19(jmp_offset);
                switch (BPF_OP(code)) {
                case BPF_JEQ:
@@ -908,10 +911,21 @@ static int build_body(struct jit_ctx *ctx, bool extra_pass)
        const struct bpf_prog *prog = ctx->prog;
        int i;
 
+       /*
+        * - offset[0] offset of the end of prologue,
+        *   start of the 1st instruction.
+        * - offset[1] - offset of the end of 1st instruction,
+        *   start of the 2nd instruction
+        * [....]
+        * - offset[3] - offset of the end of 3rd instruction,
+        *   start of 4th instruction
+        */
        for (i = 0; i < prog->len; i++) {
                const struct bpf_insn *insn = &prog->insnsi[i];
                int ret;
 
+               if (ctx->image == NULL)
+                       ctx->offset[i] = ctx->idx;
                ret = build_insn(insn, ctx, extra_pass);
                if (ret > 0) {
                        i++;
@@ -919,11 +933,16 @@ static int build_body(struct jit_ctx *ctx, bool extra_pass)
                                ctx->offset[i] = ctx->idx;
                        continue;
                }
-               if (ctx->image == NULL)
-                       ctx->offset[i] = ctx->idx;
                if (ret)
                        return ret;
        }
+       /*
+        * offset is allocated with prog->len + 1 so fill in
+        * the last element with the offset after the last
+        * instruction (end of program)
+        */
+       if (ctx->image == NULL)
+               ctx->offset[i] = ctx->idx;
 
        return 0;
 }
@@ -1002,7 +1021,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
        memset(&ctx, 0, sizeof(ctx));
        ctx.prog = prog;
 
-       ctx.offset = kcalloc(prog->len, sizeof(int), GFP_KERNEL);
+       ctx.offset = kcalloc(prog->len + 1, sizeof(int), GFP_KERNEL);
        if (ctx.offset == NULL) {
                prog = orig_prog;
                goto out_off;
@@ -1089,7 +1108,7 @@ skip_init_ctx:
        prog->jited_len = prog_size;
 
        if (!prog->is_func || extra_pass) {
-               bpf_prog_fill_jited_linfo(prog, ctx.offset);
+               bpf_prog_fill_jited_linfo(prog, ctx.offset + 1);
 out_off:
                kfree(ctx.offset);
                kfree(jit_data);
index e456652facce5177b975ec466d4e743c086d600c..d05c78eace1bf7f6ca1dc5f5e689dd12e637b0e0 100644 (file)
@@ -220,7 +220,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
                        regs->a4 = -EINTR;
                        break;
                }
-       /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
 do_restart:
                regs->a4 = regs->orig_a4;
@@ -252,7 +252,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs,
                                break;
                        }
 
-                       /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->a4 = regs->orig_a4;
                        regs->pc -= 4;
index 9452d6570b7e8126e51c8921cfe64244fd2fb4b1..970895df75ec3ea1186528c036e2a0965eb5a089 100644 (file)
@@ -194,7 +194,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->a0 = -EINTR;
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->a0 = regs->orig_a0;
                        regs->pc -= TRAP0_SIZE;
index 38d335488a54bd42edb80a7b3611e3e9e08ef142..69e68949787febb37f24931a254f9489d876b2bf 100644 (file)
@@ -227,7 +227,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka)
                        regs->er0 = -EINTR;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
 do_restart:
                regs->er0 = regs->orig_er0;
index cf99fb79a12411d3b8a901f74e1c6bdf7c2debe5..cb3bf19b064007442e6145fd209de2293a9e637d 100644 (file)
@@ -120,7 +120,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
                }
                case R_HEXAGON_HI16:
                        value = (value>>16) & 0xffff;
-                       /* fallthrough */
+                       fallthrough;
                case R_HEXAGON_LO16:
                        *location &= ~0x00c03fff;
                        *location |= value & 0x3fff;
index d48864c48e5ac49cf6210a35b793e4cfc710fa3c..94cc7ff52dce80eeceec6c1d57f22777704cc840 100644 (file)
@@ -155,7 +155,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->r00 = -EINTR;
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->r06 = regs->syscall_nr;
                        pt_set_elr(regs, pt_elr(regs) - 4);
index b66ba907019ce11d6304b041650a968bc5c8d69d..87927eb824ccd9ed2f14d83434a2fb2ec793aaee 100644 (file)
@@ -74,8 +74,6 @@ static inline void arch_acpi_set_pdc_bits(u32 *buf)
        buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
 }
 
-#define acpi_unlazy_tlb(x)
-
 #ifdef CONFIG_ACPI_NUMA
 extern cpumask_t early_cpu_possible_map;
 #define for_each_possible_early_cpu(cpu)  \
index bec762a9b418d3a52d12a9ebe890ad103c8ba8fb..fec70d662d0c2da737308bfbdd74e45d6088a5d4 100644 (file)
@@ -163,7 +163,7 @@ kdump_init_notifier(struct notifier_block *self, unsigned long val, void *data)
                case DIE_INIT_MONARCH_LEAVE:
                        if (!kdump_freeze_monarch)
                                break;
-                       /* fall through */
+                       fallthrough;
                case DIE_INIT_SLAVE_LEAVE:
                case DIE_INIT_MONARCH_ENTER:
                case DIE_MCA_RENDZVOUS_LEAVE:
index b49fe6f618edb1dc78f2bd371998b56613b56ede..f8150ee74f2974f3dc7b98fcf84902e22de2a03d 100644 (file)
@@ -3,7 +3,7 @@
  * Architecture-specific kernel symbols
  */
 
-#ifdef CONFIG_VIRTUAL_MEM_MAP
+#if defined(CONFIG_VIRTUAL_MEM_MAP) || defined(CONFIG_DISCONTIGMEM)
 #include <linux/compiler.h>
 #include <linux/export.h>
 #include <linux/memblock.h>
index 1a42ba885188a5c8e865bb28108c685ed1a37515..00a496cb346f6ebd4400e2314022ecc6b13a5619 100644 (file)
@@ -654,7 +654,7 @@ do_reloc (struct module *mod, uint8_t r_type, Elf64_Sym *sym, uint64_t addend,
                                }
                        } else if (!is_internal(mod, val))
                                val = get_plt(mod, location, val, &ok);
-                       /* FALL THROUGH */
+                       fallthrough;
                      default:
                        val -= bundle(location);
                        break;
index 971f166873aa693b7d2a2fa5872c143f5bbea384..0dc3611e79715650af7a0471a64ba269993a8798 100644 (file)
@@ -3472,7 +3472,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
                        break;
                case PFM_CTX_LOADED: 
                        if (CTX_HAS_SMPL(ctx) && fmt->fmt_restart_active) break;
-                       /* fall through */
+                       fallthrough;
                case PFM_CTX_UNLOADED:
                case PFM_CTX_ZOMBIE:
                        DPRINT(("invalid state=%d\n", state));
index d07ed65c9c6e95481f5f8aa2cb4119a43875d960..e67b22fc3c60b7dbe47494b836a5cf5ea583ee5e 100644 (file)
@@ -374,7 +374,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
                                        /* note: scr->pt.r10 is already -1 */
                                        break;
                                }
-                               /*FALLTHRU*/
+                               fallthrough;
                        case ERESTARTNOINTR:
                                ia64_decrement_ip(&scr->pt);
                                restart = 0; /* don't restart twice if handle_signal() fails... */
index 2d4e65ba5c3e9025bb0ccad498a0ee5f6624bccc..6c1a8951dfbb81aa76e5a0425170168ea23ed568 100644 (file)
@@ -1431,7 +1431,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
                if (u.insn.x)
                        /* oops, really a semaphore op (cmpxchg, etc) */
                        goto failure;
-               /*FALLTHRU*/
+               fallthrough;
              case LDS_IMM_OP:
              case LDSA_IMM_OP:
              case LDFS_OP:
@@ -1459,7 +1459,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
                if (u.insn.x)
                        /* oops, really a semaphore op (cmpxchg, etc) */
                        goto failure;
-               /*FALLTHRU*/
+               fallthrough;
              case LD_IMM_OP:
              case LDA_IMM_OP:
              case LDBIAS_IMM_OP:
@@ -1475,7 +1475,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
                if (u.insn.x)
                        /* oops, really a semaphore op (cmpxchg, etc) */
                        goto failure;
-               /*FALLTHRU*/
+               fallthrough;
              case ST_IMM_OP:
              case STREL_IMM_OP:
                ret = emulate_store_int(ifa, u.insn, regs);
index 7601fe0622d25e26ee083b317d159479df16ddf0..6bd64c35e691ae9e4a8c00182f436172d0a09f73 100644 (file)
@@ -324,7 +324,7 @@ unw_access_gr (struct unw_frame_info *info, int regnum, unsigned long *val, char
                                                        return 0;
                                                }
                                        }
-                                       /* fall through */
+                                       fallthrough;
                                      case UNW_NAT_NONE:
                                        dummy_nat = 0;
                                        nat_addr = &dummy_nat;
index 0b3fb4c7af292094d009c2c287469d5a5fa751a0..8e7b8c6c576eeea47aa2fe72accb50aa73f7ab67 100644 (file)
@@ -538,7 +538,7 @@ virtual_memmap_init(u64 start, u64 end, void *arg)
        if (map_start < map_end)
                memmap_init_zone((unsigned long)(map_end - map_start),
                                 args->nid, args->zone, page_to_pfn(map_start),
-                                MEMMAP_EARLY, NULL);
+                                MEMINIT_EARLY, NULL);
        return 0;
 }
 
@@ -547,8 +547,8 @@ memmap_init (unsigned long size, int nid, unsigned long zone,
             unsigned long start_pfn)
 {
        if (!vmem_map) {
-               memmap_init_zone(size, nid, zone, start_pfn, MEMMAP_EARLY,
-                               NULL);
+               memmap_init_zone(size, nid, zone, start_pfn,
+                                MEMINIT_EARLY, NULL);
        } else {
                struct page *start;
                struct memmap_init_callback_data args;
index 37091898adb3d3b54249df3f50558337d72ce751..5e0e682f9c61a60ef3a2370aaab7573d7690f99e 100644 (file)
@@ -207,7 +207,7 @@ repeat:
                                        self_test_last_rcv = jiffies;
                                        break;
                                }
-                               /* FALL THROUGH */
+                               fallthrough;
 
                        default:
                                break_flag = scancode & BREAK_MASK;
index fc034fd19798eb783c15c2487cbb9a360c3da6d2..a98fca97707375aab338e9f06ab6e9611da97bdf 100644 (file)
@@ -1067,7 +1067,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
                        regs->d0 = -EINTR;
                        break;
                }
-       /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
        do_restart:
                regs->d0 = regs->orig_d0;
index 5c9f3a2d6538821fcbbf9b3d492f73657d401bb6..a621fcc1a576ac06ddf2d1468615c7b44a7c00ab 100644 (file)
@@ -1018,7 +1018,7 @@ int __init mac_platform_init(void)
                 */
                platform_device_register_simple("mac_scsi", 1,
                        mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
-               /* fall through */
+               fallthrough;
        case MAC_SCSI_OLD:
                /* Addresses from Developer Notes for Duo System,
                 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
index 1f0fad2a98a07dd437a1486fb18f09cc48558f55..ac77d73af19a59dec55410a784aa0982525828a0 100644 (file)
@@ -370,7 +370,7 @@ void via_nubus_irq_startup(int irq)
                        /* Allow NuBus slots 9 through F. */
                        via2[vDirA] &= 0x80 | ~(1 << irq_idx);
                }
-               /* fall through */
+               fallthrough;
        case MAC_VIA_IICI:
                via_irq_enable(irq);
                break;
index 795f483b105091a6c65942cda524a54375bd2d9a..ef46e77e97a5b35ad0315691af456ca90f1870fb 100644 (file)
@@ -118,7 +118,7 @@ good_area:
        pr_debug("do_page_fault: good_area\n");
        switch (error_code & 3) {
                default:        /* 3: write, present */
-                       /* fall through */
+                       fallthrough;
                case 2:         /* write, not present */
                        if (!(vma->vm_flags & VM_WRITE))
                                goto acc_err;
index 65bf5fd8d4733b63e68edb627dd8543899a2a0f8..4a96b59f0beed3835854c266d4ac4c39ee89ff04 100644 (file)
@@ -249,7 +249,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
                        regs->r3 = -EINTR;
                        break;
        }
-       /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
 do_restart:
                /* offset of 4 bytes to re-execute trap (brki) instruction */
index 0880a003573d9d3d1d0d8e14623fce8cf379524d..3344d4a1fe890c9af7fbb8ba62aaad4ac6d797a0 100644 (file)
@@ -46,6 +46,9 @@ unsigned long memory_size;
 EXPORT_SYMBOL(memory_size);
 unsigned long lowmem_size;
 
+EXPORT_SYMBOL(min_low_pfn);
+EXPORT_SYMBOL(max_low_pfn);
+
 #ifdef CONFIG_HIGHMEM
 pte_t *kmap_pte;
 EXPORT_SYMBOL(kmap_pte);
index c95fa3a2484cf056c9dc4238980acd896ef13ca6..8f328298f8cc871078732b579323fba7d796be27 100644 (file)
@@ -877,6 +877,7 @@ config SNI_RM
        select I8253
        select I8259
        select ISA
+       select MIPS_L1_CACHE_SHIFT_6
        select SWAP_IO_SPACE if CPU_BIG_ENDIAN
        select SYS_HAS_CPU_R4X00
        select SYS_HAS_CPU_R5000
index 82627c264964446c1319288823c8fce02f6c9be6..01427bde23970afd9ad9c193a3744254da070d08 100644 (file)
@@ -148,7 +148,7 @@ void __init plat_mem_setup(void)
 {
        struct cpuinfo_mips *c = &current_cpu_data;
 
-       if ((c->cputype == CPU_74K) || (c->cputype == CPU_1074K)) {
+       if (c->cputype == CPU_74K) {
                pr_info("Using bcma bus\n");
 #ifdef CONFIG_BCM47XX_BCMA
                bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
index 75a7a382da099db4f7b976c986bf8f7c102b2e32..3288cef4b168c36d6ded0e63f6d3bc46c6972686 100644 (file)
@@ -47,6 +47,7 @@ static inline int __pure __get_cpu_type(const int cpu_type)
        case CPU_34K:
        case CPU_1004K:
        case CPU_74K:
+       case CPU_1074K:
        case CPU_M14KC:
        case CPU_M14KEC:
        case CPU_INTERAPTIV:
index 47a8ffc0b413edd02fc26f2a890501803b280247..f5b8300f45735c033c81b49d91330127b6a52803 100644 (file)
@@ -137,6 +137,11 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
        return !(flags & 1);
 }
 
+static inline int arch_irqs_disabled(void)
+{
+       return arch_irqs_disabled_flags(arch_local_save_flags());
+}
+
 #endif /* #ifndef __ASSEMBLY__ */
 
 /*
index b6e9c99b85a529661aaba3571150f1a306bcc4f2..eb181224eb4c4353926e6eb97a70fdd49b53ccac 100644 (file)
@@ -26,7 +26,6 @@
 #define cpu_has_counter                1
 #define cpu_has_dc_aliases     (PAGE_SIZE < 0x4000)
 #define cpu_has_divec          0
-#define cpu_has_ejtag          0
 #define cpu_has_inclusive_pcaches      1
 #define cpu_has_llsc           1
 #define cpu_has_mcheck         0
@@ -42,7 +41,6 @@
 #define cpu_has_veic           0
 #define cpu_has_vint           0
 #define cpu_has_vtag_icache    0
-#define cpu_has_watch          1
 #define cpu_has_wsbh           1
 #define cpu_has_ic_fills_f_dc  1
 #define cpu_hwrena_impl_bits   0xc0000000
index f5e362f7970199533019237857846f050f7bafb8..bf24809231541644874229c21a3b244db38622a4 100644 (file)
@@ -2,8 +2,6 @@
 #ifndef __ASM_MACH_LOONGSON64_IRQ_H_
 #define __ASM_MACH_LOONGSON64_IRQ_H_
 
-#include <boot_param.h>
-
 /* cpu core interrupt numbers */
 #define NR_IRQS_LEGACY         16
 #define NR_MIPS_CPU_IRQS       8
index 3a25dbd3b3e99ea6075ec1e2b10de1c8ea58bdc1..5eaca4fe3f924f96330c4e44fa5e1a675f12e2b1 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef _ASM_MACH_LOONGSON64_MMZONE_H
 #define _ASM_MACH_LOONGSON64_MMZONE_H
 
-#include <boot_param.h>
 #define NODE_ADDRSPACE_SHIFT 44
 #define NODE0_ADDRSPACE_OFFSET 0x000000000000UL
 #define NODE1_ADDRSPACE_OFFSET 0x100000000000UL
index 7dd4a80e05d6ddef8d132d09acad6251210c92cf..6f4ac854b12d28911e409ee2df9c8c17a293e958 100644 (file)
        BUILD_BUG_ON(!__builtin_constant_p(times));             \
                                                                \
        switch (times) {                                        \
-       case 32: fn(__VA_ARGS__); /* fall through */            \
-       case 31: fn(__VA_ARGS__); /* fall through */            \
-       case 30: fn(__VA_ARGS__); /* fall through */            \
-       case 29: fn(__VA_ARGS__); /* fall through */            \
-       case 28: fn(__VA_ARGS__); /* fall through */            \
-       case 27: fn(__VA_ARGS__); /* fall through */            \
-       case 26: fn(__VA_ARGS__); /* fall through */            \
-       case 25: fn(__VA_ARGS__); /* fall through */            \
-       case 24: fn(__VA_ARGS__); /* fall through */            \
-       case 23: fn(__VA_ARGS__); /* fall through */            \
-       case 22: fn(__VA_ARGS__); /* fall through */            \
-       case 21: fn(__VA_ARGS__); /* fall through */            \
-       case 20: fn(__VA_ARGS__); /* fall through */            \
-       case 19: fn(__VA_ARGS__); /* fall through */            \
-       case 18: fn(__VA_ARGS__); /* fall through */            \
-       case 17: fn(__VA_ARGS__); /* fall through */            \
-       case 16: fn(__VA_ARGS__); /* fall through */            \
-       case 15: fn(__VA_ARGS__); /* fall through */            \
-       case 14: fn(__VA_ARGS__); /* fall through */            \
-       case 13: fn(__VA_ARGS__); /* fall through */            \
-       case 12: fn(__VA_ARGS__); /* fall through */            \
-       case 11: fn(__VA_ARGS__); /* fall through */            \
-       case 10: fn(__VA_ARGS__); /* fall through */            \
-       case 9: fn(__VA_ARGS__); /* fall through */             \
-       case 8: fn(__VA_ARGS__); /* fall through */             \
-       case 7: fn(__VA_ARGS__); /* fall through */             \
-       case 6: fn(__VA_ARGS__); /* fall through */             \
-       case 5: fn(__VA_ARGS__); /* fall through */             \
-       case 4: fn(__VA_ARGS__); /* fall through */             \
-       case 3: fn(__VA_ARGS__); /* fall through */             \
-       case 2: fn(__VA_ARGS__); /* fall through */             \
-       case 1: fn(__VA_ARGS__); /* fall through */             \
+       case 32: fn(__VA_ARGS__); fallthrough;                  \
+       case 31: fn(__VA_ARGS__); fallthrough;                  \
+       case 30: fn(__VA_ARGS__); fallthrough;                  \
+       case 29: fn(__VA_ARGS__); fallthrough;                  \
+       case 28: fn(__VA_ARGS__); fallthrough;                  \
+       case 27: fn(__VA_ARGS__); fallthrough;                  \
+       case 26: fn(__VA_ARGS__); fallthrough;                  \
+       case 25: fn(__VA_ARGS__); fallthrough;                  \
+       case 24: fn(__VA_ARGS__); fallthrough;                  \
+       case 23: fn(__VA_ARGS__); fallthrough;                  \
+       case 22: fn(__VA_ARGS__); fallthrough;                  \
+       case 21: fn(__VA_ARGS__); fallthrough;                  \
+       case 20: fn(__VA_ARGS__); fallthrough;                  \
+       case 19: fn(__VA_ARGS__); fallthrough;                  \
+       case 18: fn(__VA_ARGS__); fallthrough;                  \
+       case 17: fn(__VA_ARGS__); fallthrough;                  \
+       case 16: fn(__VA_ARGS__); fallthrough;                  \
+       case 15: fn(__VA_ARGS__); fallthrough;                  \
+       case 14: fn(__VA_ARGS__); fallthrough;                  \
+       case 13: fn(__VA_ARGS__); fallthrough;                  \
+       case 12: fn(__VA_ARGS__); fallthrough;                  \
+       case 11: fn(__VA_ARGS__); fallthrough;                  \
+       case 10: fn(__VA_ARGS__); fallthrough;                  \
+       case 9: fn(__VA_ARGS__); fallthrough;                   \
+       case 8: fn(__VA_ARGS__); fallthrough;                   \
+       case 7: fn(__VA_ARGS__); fallthrough;                   \
+       case 6: fn(__VA_ARGS__); fallthrough;                   \
+       case 5: fn(__VA_ARGS__); fallthrough;                   \
+       case 4: fn(__VA_ARGS__); fallthrough;                   \
+       case 3: fn(__VA_ARGS__); fallthrough;                   \
+       case 2: fn(__VA_ARGS__); fallthrough;                   \
+       case 1: fn(__VA_ARGS__); fallthrough;                   \
        case 0: break;                                          \
                                                                \
        default:                                                \
index efce5defcc5cfd1548d66c52ab8b7460e3e40237..011eb6bbf81a5ef8e1b62874c8e64e6bf510deae 100644 (file)
@@ -1898,8 +1898,8 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config)
                                (base_id >= 64 && base_id < 90) ||
                                (base_id >= 128 && base_id < 164) ||
                                (base_id >= 192 && base_id < 200) ||
-                               (base_id >= 256 && base_id < 274) ||
-                               (base_id >= 320 && base_id < 358) ||
+                               (base_id >= 256 && base_id < 275) ||
+                               (base_id >= 320 && base_id < 361) ||
                                (base_id >= 384 && base_id < 574))
                                break;
 
index 2f513506a3d527403d698d191d91826e6dbe360f..1dbfb5aadffd6422b0a04d30cad818350b780512 100644 (file)
@@ -239,6 +239,8 @@ static int bmips_boot_secondary(int cpu, struct task_struct *idle)
  */
 static void bmips_init_secondary(void)
 {
+       bmips_cpu_setup();
+
        switch (current_cpu_type()) {
        case CPU_BMIPS4350:
        case CPU_BMIPS4380:
index 38aa07ccdbcc25758ac931f8909a22971a7f3b8f..cf788591f0911271490e999c34f21b3f100edf2f 100644 (file)
@@ -1287,6 +1287,18 @@ static int enable_restore_fp_context(int msa)
                err = own_fpu_inatomic(1);
                if (msa && !err) {
                        enable_msa();
+                       /*
+                        * with MSA enabled, userspace can see MSACSR
+                        * and MSA regs, but the values in them are from
+                        * other task before current task, restore them
+                        * from saved fp/msa context
+                        */
+                       write_msa_csr(current->thread.fpu.msacsr);
+                       /*
+                        * own_fpu_inatomic(1) just restore low 64bit,
+                        * fix the high 64bit
+                        */
+                       init_msa_upper();
                        set_thread_flag(TIF_USEDMSA);
                        set_thread_flag(TIF_MSA_CTX_LIVE);
                }
index 7de85d2253ff5c436446e46358b8d7e7d5688710..0c50ac4442221f07814ed38d0e07d7dd67c8a2bc 100644 (file)
@@ -137,6 +137,8 @@ extern void kvm_init_loongson_ipi(struct kvm *kvm);
 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 {
        switch (type) {
+       case KVM_VM_MIPS_AUTO:
+               break;
 #ifdef CONFIG_KVM_MIPS_VZ
        case KVM_VM_MIPS_VZ:
 #else
index 4ab55f1123a0422b7e8e6ef16b8abd29bd4fd7fe..ae023b9a1c5113c076a9b711d7880aa5203fcb4c 100644 (file)
@@ -44,6 +44,10 @@ ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
   endif
 endif
 
+# Some -march= flags enable MMI instructions, and GCC complains about that
+# support being enabled alongside -msoft-float. Thus explicitly disable MMI.
+cflags-y += $(call cc-option,-mno-loongson-mmi)
+
 #
 # Loongson Machines' Support
 #
index f130f62129b86277f56838c2667d88607b35c09a..00055d4b6042f6fff23b5fa8d9f892c82298ed4d 100644 (file)
@@ -95,10 +95,8 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                        if (res)
                                goto fault;
 
-                       set_fpr64(current->thread.fpu.fpr,
-                               insn.loongson3_lswc2_format.rt, value);
-                       set_fpr64(current->thread.fpu.fpr,
-                               insn.loongson3_lswc2_format.rq, value_next);
+                       set_fpr64(&current->thread.fpu.fpr[insn.loongson3_lswc2_format.rt], 0, value);
+                       set_fpr64(&current->thread.fpu.fpr[insn.loongson3_lswc2_format.rq], 0, value_next);
                        compute_return_epc(regs);
                        own_fpu(1);
                }
@@ -130,15 +128,13 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                                goto sigbus;
 
                        lose_fpu(1);
-                       value_next = get_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lswc2_format.rq);
+                       value_next = get_fpr64(&current->thread.fpu.fpr[insn.loongson3_lswc2_format.rq], 0);
 
                        StoreDW(addr + 8, value_next, res);
                        if (res)
                                goto fault;
 
-                       value = get_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lswc2_format.rt);
+                       value = get_fpr64(&current->thread.fpu.fpr[insn.loongson3_lswc2_format.rt], 0);
 
                        StoreDW(addr, value, res);
                        if (res)
@@ -204,8 +200,7 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                        if (res)
                                goto fault;
 
-                       set_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lsdc2_format.rt, value);
+                       set_fpr64(&current->thread.fpu.fpr[insn.loongson3_lsdc2_format.rt], 0, value);
                        compute_return_epc(regs);
                        own_fpu(1);
 
@@ -221,8 +216,7 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                        if (res)
                                goto fault;
 
-                       set_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lsdc2_format.rt, value);
+                       set_fpr64(&current->thread.fpu.fpr[insn.loongson3_lsdc2_format.rt], 0, value);
                        compute_return_epc(regs);
                        own_fpu(1);
                        break;
@@ -286,8 +280,7 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                                goto sigbus;
 
                        lose_fpu(1);
-                       value = get_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lsdc2_format.rt);
+                       value = get_fpr64(&current->thread.fpu.fpr[insn.loongson3_lsdc2_format.rt], 0);
 
                        StoreW(addr, value, res);
                        if (res)
@@ -305,8 +298,7 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                                goto sigbus;
 
                        lose_fpu(1);
-                       value = get_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lsdc2_format.rt);
+                       value = get_fpr64(&current->thread.fpu.fpr[insn.loongson3_lsdc2_format.rt], 0);
 
                        StoreDW(addr, value, res);
                        if (res)
index fc5a6d25f74ff42040e4dc9e9c655baaf1596869..0ef717093262fd3892c4e6595e99a9de3ce6f796 100644 (file)
@@ -1712,7 +1712,11 @@ static void setup_scache(void)
                                printk("MIPS secondary cache %ldkB, %s, linesize %d bytes.\n",
                                       scache_size >> 10,
                                       way_string[c->scache.ways], c->scache.linesz);
+
+                               if (current_cpu_type() == CPU_BMIPS5000)
+                                       c->options |= MIPS_CPU_INCLUSIVE_CACHES;
                        }
+
 #else
                        if (!(c->scache.flags & MIPS_CACHE_NOT_PRESENT))
                                panic("Dunno how to handle MIPS32 / MIPS64 second level cache");
index 1493c49ca47a1933e86b4a87871ce244e0df22a1..55d7b7fd18b6fba66ef1d2c4b9d46e637fbc3cf3 100644 (file)
@@ -245,7 +245,6 @@ static int mipsxx_perfcount_handler(void)
 
        switch (counters) {
 #define HANDLE_COUNTER(n)                                              \
-       fallthrough;                                                    \
        case n + 1:                                                     \
                control = r_c0_perfctrl ## n();                         \
                counter = r_c0_perfcntr ## n();                         \
@@ -256,8 +255,11 @@ static int mipsxx_perfcount_handler(void)
                        handled = IRQ_HANDLED;                          \
                }
        HANDLE_COUNTER(3)
+       fallthrough;
        HANDLE_COUNTER(2)
+       fallthrough;
        HANDLE_COUNTER(1)
+       fallthrough;
        HANDLE_COUNTER(0)
        }
 
index 0ecffb65fd6d1adbce4cbc324a42aabe8f91f088..eeeec18c420a63ab69a4edd36755595d52a31c87 100644 (file)
@@ -143,7 +143,10 @@ static struct platform_device sc26xx_pdev = {
        },
 };
 
-static u32 a20r_ack_hwint(void)
+/*
+ * Trigger chipset to update CPU's CAUSE IP field
+ */
+static u32 a20r_update_cause_ip(void)
 {
        u32 status = read_c0_status();
 
@@ -205,12 +208,14 @@ static void a20r_hwint(void)
        int irq;
 
        clear_c0_status(IE_IRQ0);
-       status = a20r_ack_hwint();
+       status = a20r_update_cause_ip();
        cause = read_c0_cause();
 
        irq = ffs(((cause & status) >> 8) & 0xf8);
        if (likely(irq > 0))
                do_IRQ(SNI_A20R_IRQ_BASE + irq - 1);
+
+       a20r_update_cause_ip();
        set_c0_status(IE_IRQ0);
 }
 
@@ -222,8 +227,8 @@ void __init sni_a20r_irq_init(void)
                irq_set_chip_and_handler(i, &a20r_irq_type, handle_level_irq);
        sni_hwint = a20r_hwint;
        change_c0_status(ST0_IM, IE_IRQ0);
-       if (request_irq(SNI_A20R_IRQ_BASE + 3, sni_isa_irq_handler, 0, "ISA",
-                       NULL))
+       if (request_irq(SNI_A20R_IRQ_BASE + 3, sni_isa_irq_handler,
+                       IRQF_SHARED, "ISA", sni_isa_irq_handler))
                pr_err("Failed to register ISA interrupt\n");
 }
 
index fb45ec46bb1b2e7be861a236a3773c090ca65b1e..51ef800bb3018b17449089ad7335875b97aba160 100644 (file)
@@ -34,3 +34,8 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
 {
        return !flags;
 }
+
+static inline int arch_irqs_disabled(void)
+{
+       return arch_irqs_disabled_flags(arch_local_save_flags());
+}
index 62bdafbc53f4c8183a3412ffbf6a5065346db92b..9edd7ed7d7bf849e6d32b8036f6d6b5f1b0f37a5 100644 (file)
@@ -45,7 +45,7 @@ void save_fpu(struct task_struct *tsk)
                              : /* no output */
                              : "r" (&tsk->thread.fpu)
                              : "memory");
-               /* fall through */
+               fallthrough;
        case SP32_DP16_reg:
                asm volatile ("fsdi $fd15, [%0+0x78]\n\t"
                              "fsdi $fd14, [%0+0x70]\n\t"
@@ -58,7 +58,7 @@ void save_fpu(struct task_struct *tsk)
                              : /* no output */
                              : "r" (&tsk->thread.fpu)
                              : "memory");
-               /* fall through */
+               fallthrough;
        case SP16_DP8_reg:
                asm volatile ("fsdi $fd7,  [%0+0x38]\n\t"
                              "fsdi $fd6,  [%0+0x30]\n\t"
@@ -67,7 +67,7 @@ void save_fpu(struct task_struct *tsk)
                              : /* no output */
                              : "r" (&tsk->thread.fpu)
                              : "memory");
-               /* fall through */
+               fallthrough;
        case SP8_DP4_reg:
                asm volatile ("fsdi $fd3,  [%1+0x18]\n\t"
                              "fsdi $fd2,  [%1+0x10]\n\t"
@@ -108,7 +108,7 @@ void load_fpu(const struct fpu_struct *fpregs)
                              "fldi $fd16, [%0+0x80]\n\t"
                              : /* no output */
                              : "r" (fpregs));
-               /* fall through */
+               fallthrough;
        case SP32_DP16_reg:
                asm volatile ("fldi $fd15, [%0+0x78]\n\t"
                              "fldi $fd14, [%0+0x70]\n\t"
@@ -120,7 +120,7 @@ void load_fpu(const struct fpu_struct *fpregs)
                              "fldi $fd8,  [%0+0x40]\n\t"
                              : /* no output */
                              : "r" (fpregs));
-               /* fall through */
+               fallthrough;
        case SP16_DP8_reg:
                asm volatile ("fldi $fd7,  [%0+0x38]\n\t"
                              "fldi $fd6,  [%0+0x30]\n\t"
@@ -128,7 +128,7 @@ void load_fpu(const struct fpu_struct *fpregs)
                              "fldi $fd4,  [%0+0x20]\n\t"
                              : /* no output */
                              : "r" (fpregs));
-               /* fall through */
+               fallthrough;
        case SP8_DP4_reg:
                asm volatile ("fldi $fd3,  [%1+0x18]\n\t"
                              "fldi $fd2,  [%1+0x10]\n\t"
index 330b19fcd990317d7c34e5a986f677f54e3f2851..36e25a410bb0ec27eb4971d191ba6a0ee2846e53 100644 (file)
@@ -316,7 +316,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->uregs[0] = -EINTR;
                                break;
                        }
-                       /* Else, fall through */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->uregs[0] = regs->orig_r0;
                        regs->ipc -= 4;
@@ -361,7 +361,7 @@ static void do_signal(struct pt_regs *regs)
                switch (regs->uregs[0]) {
                case -ERESTART_RESTARTBLOCK:
                        regs->uregs[15] = __NR_restart_syscall;
-                       /* Fall through */
+                       fallthrough;
                case -ERESTARTNOHAND:
                case -ERESTARTSYS:
                case -ERESTARTNOINTR:
index f0390211236bfae0f5b438b73e8a3e9cbbdd1454..120f5005461b812466cf351ea4b3de5c3efb9ac9 100644 (file)
@@ -165,19 +165,19 @@ struct __large_struct {
 
 #define __get_user_nocheck(x, ptr, size)                       \
 ({                                                             \
-       long __gu_err, __gu_val;                                \
-       __get_user_size(__gu_val, (ptr), (size), __gu_err);     \
-       (x) = (__force __typeof__(*(ptr)))__gu_val;             \
+       long __gu_err;                                          \
+       __get_user_size((x), (ptr), (size), __gu_err);          \
        __gu_err;                                               \
 })
 
 #define __get_user_check(x, ptr, size)                                 \
 ({                                                                     \
-       long __gu_err = -EFAULT, __gu_val = 0;                          \
+       long __gu_err = -EFAULT;                                        \
        const __typeof__(*(ptr)) __user *__gu_addr = (ptr);             \
-       if (access_ok(__gu_addr, size))                 \
-               __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
-       (x) = (__force __typeof__(*(ptr)))__gu_val;                     \
+       if (access_ok(__gu_addr, size))                                 \
+               __get_user_size((x), __gu_addr, (size), __gu_err);      \
+       else                                                            \
+               (x) = (__typeof__(*(ptr))) 0;                           \
        __gu_err;                                                       \
 })
 
@@ -191,11 +191,13 @@ do {                                                                      \
        case 2: __get_user_asm(x, ptr, retval, "l.lhz"); break;         \
        case 4: __get_user_asm(x, ptr, retval, "l.lwz"); break;         \
        case 8: __get_user_asm2(x, ptr, retval); break;                 \
-       default: (x) = __get_user_bad();                                \
+       default: (x) = (__typeof__(*(ptr)))__get_user_bad();            \
        }                                                               \
 } while (0)
 
 #define __get_user_asm(x, addr, err, op)               \
+{                                                      \
+       unsigned long __gu_tmp;                         \
        __asm__ __volatile__(                           \
                "1:     "op" %1,0(%2)\n"                \
                "2:\n"                                  \
@@ -209,10 +211,14 @@ do {                                                                      \
                "       .align 2\n"                     \
                "       .long 1b,3b\n"                  \
                ".previous"                             \
-               : "=r"(err), "=r"(x)                    \
-               : "r"(addr), "i"(-EFAULT), "0"(err))
+               : "=r"(err), "=r"(__gu_tmp)             \
+               : "r"(addr), "i"(-EFAULT), "0"(err));   \
+       (x) = (__typeof__(*(addr)))__gu_tmp;            \
+}
 
 #define __get_user_asm2(x, addr, err)                  \
+{                                                      \
+       unsigned long long __gu_tmp;                    \
        __asm__ __volatile__(                           \
                "1:     l.lwz %1,0(%2)\n"               \
                "2:     l.lwz %H1,4(%2)\n"              \
@@ -229,8 +235,11 @@ do {                                                                       \
                "       .long 1b,4b\n"                  \
                "       .long 2b,4b\n"                  \
                ".previous"                             \
-               : "=r"(err), "=&r"(x)                   \
-               : "r"(addr), "i"(-EFAULT), "0"(err))
+               : "=r"(err), "=&r"(__gu_tmp)            \
+               : "r"(addr), "i"(-EFAULT), "0"(err));   \
+       (x) = (__typeof__(*(addr)))(                    \
+               (__typeof__((x)-(x)))__gu_tmp);         \
+}
 
 /* more complex routines */
 
index b18e775f8be3b101ef2b204914771daaebb5f5b0..13c87f1f872b44b4152f8c3e5745f0c525455eed 100644 (file)
@@ -80,6 +80,16 @@ static void __init setup_memory(void)
         */
        memblock_reserve(__pa(_stext), _end - _stext);
 
+#ifdef CONFIG_BLK_DEV_INITRD
+       /* Then reserve the initrd, if any */
+       if (initrd_start && (initrd_end > initrd_start)) {
+               unsigned long aligned_start = ALIGN_DOWN(initrd_start, PAGE_SIZE);
+               unsigned long aligned_end = ALIGN(initrd_end, PAGE_SIZE);
+
+               memblock_reserve(__pa(aligned_start), aligned_end - aligned_start);
+       }
+#endif /* CONFIG_BLK_DEV_INITRD */
+
        early_init_fdt_reserve_self();
        early_init_fdt_scan_reserved_mem();
 
index 97804f21a40c832a61d646cf4cefddd17746f31a..c779364f0cd09bf1b1aa57c188711498b9831a2e 100644 (file)
@@ -244,7 +244,7 @@ int do_signal(struct pt_regs *regs, int syscall)
                switch (retval) {
                case -ERESTART_RESTARTBLOCK:
                        restart = -2;
-                       /* Fall through */
+                       fallthrough;
                case -ERESTARTNOHAND:
                case -ERESTARTSYS:
                case -ERESTARTNOINTR:
index 08f56af387ac4b12700ee26e993966b7dc700158..534a52ec5e66780fc73dcdfcd15b9c0929319c0c 100644 (file)
@@ -16,7 +16,7 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 
-static void cache_loop(struct page *page, const unsigned int reg)
+static __always_inline void cache_loop(struct page *page, const unsigned int reg)
 {
        unsigned long paddr = page_to_pfn(page) << PAGE_SHIFT;
        unsigned long line = paddr & ~(L1_CACHE_BYTES - 1);
index 5df5d4cd5d4cf0f08da843c4039f8920cfbafef3..3c037fc960387bb7b5cad81b2c4c450a8dcaae9f 100644 (file)
@@ -502,7 +502,7 @@ syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)
                        regs->gr[28] = -EINTR;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case -ERESTARTNOINTR:
                check_syscallno_in_delay_branch(regs);
                break;
index 43875c289723ea9f6669e5e5eb67d59ac6f64d12..a52c7abf2ca49284ce495eda92270e7aefada485 100644 (file)
@@ -437,7 +437,6 @@ void parisc_terminate(char *msg, struct pt_regs *regs, int code, unsigned long o
                break;
 
        default:
-               /* Fall through */
                break;
 
        }
@@ -644,12 +643,12 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
 
        case 15:
                /* Data TLB miss fault/Data page fault */
-               /* Fall through */
+               fallthrough;
        case 16:
                /* Non-access instruction TLB miss fault */
                /* The instruction TLB entry needed for the target address of the FIC
                   is absent, and hardware can't find it, so we get to cleanup */
-               /* Fall through */
+               fallthrough;
        case 17:
                /* Non-access data TLB miss fault/Non-access data page fault */
                /* FIXME: 
@@ -673,7 +672,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
                        handle_unaligned(regs);
                        return;
                }
-               /* Fall Through */
+               fallthrough;
        case 26: 
                /* PCXL: Data memory access rights trap */
                fault_address = regs->ior;
@@ -683,7 +682,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
        case 19:
                /* Data memory break trap */
                regs->gr[0] |= PSW_X; /* So we can single-step over the trap */
-               /* fall thru */
+               fallthrough;
        case 21:
                /* Page reference trap */
                handle_gdb_break(regs, TRAP_HWBKPT);
@@ -730,7 +729,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
                        }
                        mmap_read_unlock(current->mm);
                }
-               /* Fall Through */
+               fallthrough;
        case 27: 
                /* Data memory protection ID trap */
                if (code == 27 && !user_mode(regs) &&
index 4bfe2da9fbe3a4f9cc81a2788eb9394d8868d088..716960f5d92ea460a4b1084954e7bb69ac6cc476 100644 (file)
@@ -67,7 +67,7 @@ parisc_acctyp(unsigned long code, unsigned int inst)
        case 0x30000000: /* coproc2 */
                if (bit22set(inst))
                        return VM_WRITE;
-               /* fall through */
+               fallthrough;
 
        case 0x0: /* indexed/memory management */
                if (bit22set(inst)) {
@@ -370,7 +370,7 @@ bad_area:
                        }
 
                        /* probably address is outside of mapped file */
-                       /* fall through */
+                       fallthrough;
                case 17:        /* NA data TLB miss / page fault */
                case 18:        /* Unaligned access - PCXS only */
                        signo = SIGBUS;
index 1f48bbfb3ce99dc9eccbee3612689e88be4ae675..787e829b6f25cafeeb316b55730e9c0b7a546960 100644 (file)
@@ -116,7 +116,6 @@ config PPC
        #
        select ARCH_32BIT_OFF_T if PPC32
        select ARCH_HAS_DEBUG_VIRTUAL
-       select ARCH_HAS_DEBUG_VM_PGTABLE
        select ARCH_HAS_DEVMEM_IS_ALLOWED
        select ARCH_HAS_ELF_RANDOMIZE
        select ARCH_HAS_FORTIFY_SOURCE
@@ -860,6 +859,18 @@ config PPC_SUBPAGE_PROT
 
          If unsure, say N here.
 
+config PPC_PROT_SAO_LPAR
+       bool "Support PROT_SAO mappings in LPARs"
+       depends on PPC_BOOK3S_64
+       help
+         This option adds support for PROT_SAO mappings from userspace
+         inside LPARs on supported CPUs.
+
+         This may cause issues when performing guest migration from
+         a CPU that supports SAO to one that does not.
+
+         If unsure, say N here.
+
 config PPC_COPRO_BASE
        bool
 
index af9af03059e457282e7c56a6fe3a199210466583..15ed8d0aa0146755f84a175759cfdc281ea0c7b5 100644 (file)
@@ -108,7 +108,6 @@ CONFIG_FB_NVIDIA=y
 CONFIG_FB_NVIDIA_I2C=y
 CONFIG_FB_RADEON=y
 # CONFIG_LCD_CLASS_DEVICE is not set
-CONFIG_VGACON_SOFT_SCROLLBACK=y
 CONFIG_LOGO=y
 CONFIG_SOUND=y
 CONFIG_SND=y
index 5e6f92ba3210e96d316a86b8654e2dba05de70c4..66e9a0fd64ff20e0ad1be225f8593f072acfcec2 100644 (file)
@@ -743,7 +743,6 @@ CONFIG_FB_TRIDENT=m
 CONFIG_FB_SM501=m
 CONFIG_FB_IBM_GXT4500=y
 CONFIG_LCD_PLATFORM=m
-CONFIG_VGACON_SOFT_SCROLLBACK=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_LOGO=y
index 55442d45c59791e05f828597106265d817a0b636..b392384a3b15089c04eef26f61a73cd7cfef33bf 100644 (file)
@@ -239,14 +239,14 @@ static inline void early_init_mmu_secondary(void)
 
 extern void hash__setup_initial_memory_limit(phys_addr_t first_memblock_base,
                                         phys_addr_t first_memblock_size);
-extern void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
-                                        phys_addr_t first_memblock_size);
 static inline void setup_initial_memory_limit(phys_addr_t first_memblock_base,
                                              phys_addr_t first_memblock_size)
 {
-       if (early_radix_enabled())
-               return radix__setup_initial_memory_limit(first_memblock_base,
-                                                  first_memblock_size);
+       /*
+        * Hash has more strict restrictions. At this point we don't
+        * know which translations we will pick. Hence go with hash
+        * restrictions.
+        */
        return hash__setup_initial_memory_limit(first_memblock_base,
                                           first_memblock_size);
 }
index 6de56c3b33c4217c40805ac4e3c76f84fc0c0e47..495fc0ccb45318404567b474d44528824477ff33 100644 (file)
 #define _PAGE_RW               (_PAGE_READ | _PAGE_WRITE)
 #define _PAGE_RWX              (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)
 #define _PAGE_PRIVILEGED       0x00008 /* kernel access only */
-
-#define _PAGE_CACHE_CTL                0x00030 /* Bits for the folowing cache modes */
-                       /*      No bits set is normal cacheable memory */
-                       /*      0x00010 unused, is SAO bit on radix POWER9 */
+#define _PAGE_SAO              0x00010 /* Strong access order */
 #define _PAGE_NON_IDEMPOTENT   0x00020 /* non idempotent memory */
 #define _PAGE_TOLERANT         0x00030 /* tolerant memory, cache inhibited */
-
 #define _PAGE_DIRTY            0x00080 /* C: page changed */
 #define _PAGE_ACCESSED         0x00100 /* R: page referenced */
 /*
@@ -828,6 +824,8 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
        return hash__set_pte_at(mm, addr, ptep, pte, percpu);
 }
 
+#define _PAGE_CACHE_CTL        (_PAGE_SAO | _PAGE_NON_IDEMPOTENT | _PAGE_TOLERANT)
+
 #define pgprot_noncached pgprot_noncached
 static inline pgprot_t pgprot_noncached(pgprot_t prot)
 {
index e005b458102327acd614458bf159d7bf5a840889..32a15dc49e8ca95ba096b63bf4945ca1b93633de 100644 (file)
@@ -196,7 +196,7 @@ static inline void cpu_feature_keys_init(void) { }
 #define CPU_FTR_SPURR                  LONG_ASM_CONST(0x0000000001000000)
 #define CPU_FTR_DSCR                   LONG_ASM_CONST(0x0000000002000000)
 #define CPU_FTR_VSX                    LONG_ASM_CONST(0x0000000004000000)
-// Free                                        LONG_ASM_CONST(0x0000000008000000)
+#define CPU_FTR_SAO                    LONG_ASM_CONST(0x0000000008000000)
 #define CPU_FTR_CP_USE_DCBTZ           LONG_ASM_CONST(0x0000000010000000)
 #define CPU_FTR_UNALIGNED_LD_STD       LONG_ASM_CONST(0x0000000020000000)
 #define CPU_FTR_ASYM_SMT               LONG_ASM_CONST(0x0000000040000000)
@@ -441,7 +441,7 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_MMCRA | CPU_FTR_SMT | \
            CPU_FTR_COHERENT_ICACHE | \
            CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
-           CPU_FTR_DSCR | CPU_FTR_ASYM_SMT | \
+           CPU_FTR_DSCR | CPU_FTR_SAO  | CPU_FTR_ASYM_SMT | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_CFAR | CPU_FTR_HVMODE | \
            CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR | CPU_FTR_DABRX )
@@ -450,7 +450,7 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_MMCRA | CPU_FTR_SMT | \
            CPU_FTR_COHERENT_ICACHE | \
            CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
-           CPU_FTR_DSCR | \
+           CPU_FTR_DSCR | CPU_FTR_SAO  | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
            CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \
@@ -461,7 +461,7 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_MMCRA | CPU_FTR_SMT | \
            CPU_FTR_COHERENT_ICACHE | \
            CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
-           CPU_FTR_DSCR | \
+           CPU_FTR_DSCR | CPU_FTR_SAO  | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
            CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \
@@ -479,7 +479,7 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_MMCRA | CPU_FTR_SMT | \
            CPU_FTR_COHERENT_ICACHE | \
            CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
-           CPU_FTR_DSCR | \
+           CPU_FTR_DSCR | CPU_FTR_SAO  | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
            CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
            CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \
index 3a0db7b0b46efcd9780ed23a8ec7a9852ec18cdc..35060be090732d7cc0bd5b9906df4602a8d2ffea 100644 (file)
@@ -200,17 +200,14 @@ static inline bool arch_irqs_disabled(void)
 #define powerpc_local_irq_pmu_save(flags)                      \
         do {                                                   \
                raw_local_irq_pmu_save(flags);                  \
-               trace_hardirqs_off();                           \
+               if (!raw_irqs_disabled_flags(flags))            \
+                       trace_hardirqs_off();                   \
        } while(0)
 #define powerpc_local_irq_pmu_restore(flags)                   \
        do {                                                    \
-               if (raw_irqs_disabled_flags(flags)) {           \
-                       raw_local_irq_pmu_restore(flags);       \
-                       trace_hardirqs_off();                   \
-               } else {                                        \
+               if (!raw_irqs_disabled_flags(flags))            \
                        trace_hardirqs_on();                    \
-                       raw_local_irq_pmu_restore(flags);       \
-               }                                               \
+               raw_local_irq_pmu_restore(flags);               \
        } while(0)
 #else
 #define powerpc_local_irq_pmu_save(flags)                      \
index 7c07728af300b8b7a53fe75ff153886e3ba99d65..7cb6d18f5cd6d5f0f8e5b9971fd64ab5b34e2bb1 100644 (file)
 #include <linux/pkeys.h>
 #include <asm/cpu_has_feature.h>
 
-#ifdef CONFIG_PPC_MEM_KEYS
 static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
                unsigned long pkey)
 {
-       return pkey_to_vmflag_bits(pkey);
+#ifdef CONFIG_PPC_MEM_KEYS
+       return (((prot & PROT_SAO) ? VM_SAO : 0) | pkey_to_vmflag_bits(pkey));
+#else
+       return ((prot & PROT_SAO) ? VM_SAO : 0);
+#endif
 }
 #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
 
 static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags)
 {
-       return __pgprot(vmflag_to_pte_pkey_bits(vm_flags));
+#ifdef CONFIG_PPC_MEM_KEYS
+       return (vm_flags & VM_SAO) ?
+               __pgprot(_PAGE_SAO | vmflag_to_pte_pkey_bits(vm_flags)) :
+               __pgprot(0 | vmflag_to_pte_pkey_bits(vm_flags));
+#else
+       return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
+#endif
 }
 #define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags)
-#endif
+
+static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
+{
+       if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
+               return false;
+       if (prot & PROT_SAO) {
+               if (!cpu_has_feature(CPU_FTR_SAO))
+                       return false;
+               if (firmware_has_feature(FW_FEATURE_LPAR) &&
+                   !IS_ENABLED(CONFIG_PPC_PROT_SAO_LPAR))
+                       return false;
+       }
+       return true;
+}
+#define arch_validate_prot arch_validate_prot
 
 #endif /* CONFIG_PPC64 */
 #endif /* _ASM_POWERPC_MMAN_H */
index 59ee9fa4ae09d2b498b6c2d16d45f708a4283ebe..6cb8aa35719176a297218f94e6ef089351e5bd77 100644 (file)
@@ -82,6 +82,8 @@
  */
 #include <asm/nohash/pte-book3e.h>
 
+#define _PAGE_SAO      0
+
 #define PTE_RPN_MASK   (~((1UL << PTE_RPN_SHIFT) - 1))
 
 /*
index 3a700351fecafbf7f1b26d574cd65852dd6156f3..c0c737215b00bdc70def55a5b35aa8216e456db0 100644 (file)
@@ -11,7 +11,7 @@
 #include <asm-generic/mman-common.h>
 
 
-#define PROT_SAO       0x10            /* Unsupported since v5.9 */
+#define PROT_SAO       0x10            /* Strong Access Ordering */
 
 #define MAP_RENAME      MAP_ANONYMOUS   /* In SunOS terminology */
 #define MAP_NORESERVE   0x40            /* don't reserve swap pages */
index 569fecd7b5b23489e21fbc53c27da733a39b3c58..9053fc9d20c723921f36a72dd0233f1b5f775f85 100644 (file)
@@ -120,7 +120,8 @@ u64 dma_iommu_get_required_mask(struct device *dev)
        if (!tbl)
                return 0;
 
-       mask = 1ULL < (fls_long(tbl->it_offset + tbl->it_size) - 1);
+       mask = 1ULL << (fls_long(tbl->it_offset + tbl->it_size) +
+                       tbl->it_page_shift - 1);
        mask += mask - 1;
 
        return mask;
index 8dc46f38680b25195481533df9a0121aced8775a..f204ad79b6b54c55990eead08c87cb13b58bb737 100644 (file)
@@ -653,7 +653,7 @@ static struct dt_cpu_feature_match __initdata
        {"processor-control-facility-v3", feat_enable_dbell, CPU_FTR_DBELL},
        {"processor-utilization-of-resources-register", feat_enable_purr, 0},
        {"no-execute", feat_enable, 0},
-       /* strong-access-ordering is unused */
+       {"strong-access-ordering", feat_enable, CPU_FTR_SAO},
        {"cache-inhibited-large-page", feat_enable_large_ci, 0},
        {"coprocessor-icswx", feat_enable, 0},
        {"hypervisor-virtualization-interrupt", feat_enable_hvi, 0},
index 33a42e42c56f6774705a4be29f41e980772f9e71..733e40eba4ebe3edbbd3afb1e1bb2bb8ef354aa6 100644 (file)
@@ -113,6 +113,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_TM)
        ld      r11,exception_marker@toc(r2)
        std     r11,-16(r10)            /* "regshere" marker */
 
+BEGIN_FTR_SECTION
+       HMT_MEDIUM
+END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
+
        /*
         * RECONCILE_IRQ_STATE without calling trace_hardirqs_off(), which
         * would clobber syscall parameters. Also we always enter with IRQs
index 016bd831908ec191fe02d252a8d4cc298ca4b33f..73a57043ee6621c00569086177372a7987c3212a 100644 (file)
@@ -548,7 +548,7 @@ void notrace restore_math(struct pt_regs *regs)
         * are live for the user thread).
         */
        if ((!(msr & MSR_FP)) && should_restore_fp())
-               new_msr |= MSR_FP | current->thread.fpexc_mode;
+               new_msr |= MSR_FP;
 
        if ((!(msr & MSR_VEC)) && should_restore_altivec())
                new_msr |= MSR_VEC;
@@ -559,11 +559,17 @@ void notrace restore_math(struct pt_regs *regs)
        }
 
        if (new_msr) {
+               unsigned long fpexc_mode = 0;
+
                msr_check_and_set(new_msr);
 
-               if (new_msr & MSR_FP)
+               if (new_msr & MSR_FP) {
                        do_restore_fp();
 
+                       // This also covers VSX, because VSX implies FP
+                       fpexc_mode = current->thread.fpexc_mode;
+               }
+
                if (new_msr & MSR_VEC)
                        do_restore_altivec();
 
@@ -572,7 +578,7 @@ void notrace restore_math(struct pt_regs *regs)
 
                msr_check_and_clear(new_msr);
 
-               regs->msr |= new_msr;
+               regs->msr |= new_msr | fpexc_mode;
        }
 }
 #endif
index 87ab1152d5ce54dd9d6dc3c588fd0460607ec398..e147bbdc12cdfab1b0bc95d7a7af38a2458ff18c 100644 (file)
@@ -50,7 +50,7 @@ $(obj-vdso32): %.o: %.S FORCE
 
 # actual build commands
 quiet_cmd_vdso32ld = VDSO32L $@
-      cmd_vdso32ld = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ $(call cc-ldoption, -Wl$(comma)--orphan-handling=warn) -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
+      cmd_vdso32ld = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
 quiet_cmd_vdso32as = VDSO32A $@
       cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $<
 
index 4c985467a668038edf955084d026c526a26febd9..5206c2eb2a1de8eb2831b511b8266b8edd34f62a 100644 (file)
@@ -111,7 +111,6 @@ SECTIONS
                *(.note.GNU-stack)
                *(.data .data.* .gnu.linkonce.d.* .sdata*)
                *(.bss .sbss .dynbss .dynsbss)
-               *(.glink .iplt .plt .rela*)
        }
 }
 
index 38c317f2514178d5dc29f237455b750aea60554c..32ebb3522ea19c90165fac2909f20f618e428e67 100644 (file)
@@ -34,7 +34,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
 
 # actual build commands
 quiet_cmd_vdso64ld = VDSO64L $@
-      cmd_vdso64ld = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) $(call cc-ldoption, -Wl$(comma)--orphan-handling=warn)
+      cmd_vdso64ld = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^)
 
 # install commands for the unstripped file
 quiet_cmd_vdso_install = INSTALL $@
index 4e3a8d4ee6140c4a1785e1f1f5bd995d2c4aadcc..256fb972029871cc6c16e46a58b3652c4fbf9f8c 100644 (file)
@@ -30,7 +30,7 @@ SECTIONS
        . = ALIGN(16);
        .text           : {
                *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*)
-               *(.sfpr)
+               *(.sfpr .glink)
        }                                               :text
        PROVIDE(__etext = .);
        PROVIDE(_etext = .);
@@ -111,7 +111,6 @@ SECTIONS
                *(.branch_lt)
                *(.data .data.* .gnu.linkonce.d.* .sdata*)
                *(.bss .sbss .dynbss .dynsbss)
-               *(.glink .iplt .plt .rela*)
        }
 }
 
index 890a71c5293eef229e48473e14563a454ef4b0fd..c663e7ba801fce6969ea717958b7170c941935e8 100644 (file)
@@ -232,6 +232,8 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags)
                rflags |= HPTE_R_I;
        else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_NON_IDEMPOTENT)
                rflags |= (HPTE_R_I | HPTE_R_G);
+       else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_SAO)
+               rflags |= (HPTE_R_W | HPTE_R_I | HPTE_R_M);
        else
                /*
                 * Add memory coherence if cache inhibited is not set
index 28c784976beda540c875c99d2ca041bf2aba548e..d5f0c10d752a37086146ab68c6ce6769d587ed81 100644 (file)
@@ -734,21 +734,6 @@ void radix__mmu_cleanup_all(void)
        }
 }
 
-void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
-                               phys_addr_t first_memblock_size)
-{
-       /*
-        * We don't currently support the first MEMBLOCK not mapping 0
-        * physical on those processors
-        */
-       BUG_ON(first_memblock_base != 0);
-
-       /*
-        * Radix mode is not limited by RMA / VRMA addressing.
-        */
-       ppc64_rma_size = ULONG_MAX;
-}
-
 #ifdef CONFIG_MEMORY_HOTPLUG
 static void free_pte_table(pte_t *pte_start, pmd_t *pmd)
 {
index 02e127fa5777c0050e29a2a71f420e33a35670e7..8459056cce671efd7c49171a7b35d1c019c6d29c 100644 (file)
@@ -433,9 +433,16 @@ void __init mmu_early_init_devtree(void)
        if (!(mfmsr() & MSR_HV))
                early_check_vec5();
 
-       if (early_radix_enabled())
+       if (early_radix_enabled()) {
                radix__early_init_devtree();
-       else
+               /*
+                * We have finalized the translation we are going to use by now.
+                * Radix mode is not limited by RMA / VRMA addressing.
+                * Hence don't limit memblock allocations.
+                */
+               ppc64_rma_size = ULONG_MAX;
+               memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);
+       } else
                hash__early_init_devtree();
 }
 #endif /* CONFIG_PPC_BOOK3S_64 */
index 16d09b36fe0638899308b7d4704567dcee4b0968..78d61f97371e1b70ecdb6bf19b38f95e53a22707 100644 (file)
@@ -475,7 +475,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
                case BPF_JMP | BPF_JSET | BPF_K:
                case BPF_JMP | BPF_JSET | BPF_X:
                        true_cond = COND_NE;
-                       /* Fall through */
+                       fallthrough;
                cond_branch:
                        /* same targets, can avoid doing the test :) */
                        if (filter[i].jt == filter[i].jf) {
index 93d20e1ed845148391a0a891877c5883707227c8..08643cba1494822f7585906c3b3b39aab4cb1a90 100644 (file)
@@ -1557,9 +1557,16 @@ nocheck:
        ret = 0;
  out:
        if (has_branch_stack(event)) {
-               power_pmu_bhrb_enable(event);
-               cpuhw->bhrb_filter = ppmu->bhrb_filter_map(
-                                       event->attr.branch_sample_type);
+               u64 bhrb_filter = -1;
+
+               if (ppmu->bhrb_filter_map)
+                       bhrb_filter = ppmu->bhrb_filter_map(
+                               event->attr.branch_sample_type);
+
+               if (bhrb_filter != -1) {
+                       cpuhw->bhrb_filter = bhrb_filter;
+                       power_pmu_bhrb_enable(event);
+               }
        }
 
        perf_pmu_enable(event->pmu);
@@ -1881,7 +1888,6 @@ static int power_pmu_event_init(struct perf_event *event)
        int n;
        int err;
        struct cpu_hw_events *cpuhw;
-       u64 bhrb_filter;
 
        if (!ppmu)
                return -ENOENT;
@@ -1987,7 +1993,10 @@ static int power_pmu_event_init(struct perf_event *event)
        err = power_check_constraints(cpuhw, events, cflags, n + 1);
 
        if (has_branch_stack(event)) {
-               bhrb_filter = ppmu->bhrb_filter_map(
+               u64 bhrb_filter = -1;
+
+               if (ppmu->bhrb_filter_map)
+                       bhrb_filter = ppmu->bhrb_filter_map(
                                        event->attr.branch_sample_type);
 
                if (bhrb_filter == -1) {
index a45d694a5d5d88814ec13bb2d76ec12cc6e4af82..62d0b54086f884c1f8a43023988363a18373953f 100644 (file)
@@ -1289,7 +1289,7 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem,
        header->misc = 0;
 
        if (cpu_has_feature(CPU_FTR_ARCH_31)) {
-               switch (IMC_TRACE_RECORD_VAL_HVPR(mem->val)) {
+               switch (IMC_TRACE_RECORD_VAL_HVPR(be64_to_cpu(READ_ONCE(mem->val)))) {
                case 0:/* when MSR HV and PR not set in the trace-record */
                        header->misc |= PERF_RECORD_MISC_GUEST_KERNEL;
                        break;
@@ -1297,7 +1297,7 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem,
                        header->misc |= PERF_RECORD_MISC_GUEST_USER;
                        break;
                case 2: /* MSR HV is 1 and PR is 0 */
-                       header->misc |= PERF_RECORD_MISC_HYPERVISOR;
+                       header->misc |= PERF_RECORD_MISC_KERNEL;
                        break;
                case 3: /* MSR HV is 1 and PR is 1 */
                        header->misc |= PERF_RECORD_MISC_USER;
index 87737ec86d39aa3b9236bb5b27408f081d82e4d9..1dc9d3c818726b5e78a64c9b04efdb136bcb43d2 100644 (file)
@@ -36,7 +36,7 @@ config PPC_BOOK3S_6xx
        select PPC_HAVE_PMU_SUPPORT
        select PPC_HAVE_KUEP
        select PPC_HAVE_KUAP
-       select HAVE_ARCH_VMAP_STACK
+       select HAVE_ARCH_VMAP_STACK if !ADB_PMU
 
 config PPC_BOOK3S_601
        bool "PowerPC 601"
index 77513a80cef902ed4cb61f69118007691e8b9648..345ab062b21af7cbd23f0f1aaffb5329043f7ac8 100644 (file)
@@ -1223,7 +1223,7 @@ static void __init pnv_probe_idle_states(void)
                return;
        }
 
-       if (pvr_version_is(PVR_POWER9))
+       if (cpu_has_feature(CPU_FTR_ARCH_300))
                pnv_power9_idle_init();
 
        for (i = 0; i < nr_pnv_idle_states; i++)
index f439f0dfea7d12cc3522717e0ed1db6af1e82399..a88a707a608aac9243e0a3f37c80259afbfd5798 100644 (file)
@@ -822,7 +822,7 @@ free_stats:
        kfree(stats);
        return rc ? rc : seq_buf_used(&s);
 }
-DEVICE_ATTR_RO(perf_stats);
+DEVICE_ATTR_ADMIN_RO(perf_stats);
 
 static ssize_t flags_show(struct device *dev,
                          struct device_attribute *attr, char *buf)
index df18372861d8d22e3c0f6b8485c6128c65de733b..7766e1289468bfee07d5b6d7940f3aa3c2bcfab7 100644 (file)
@@ -32,6 +32,7 @@ config RISCV
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
        select CLONE_BACKWARDS
+       select CLINT_TIMER if !MMU
        select COMMON_CLK
        select EDAC_SUPPORT
        select GENERIC_ARCH_TOPOLOGY if SMP
index c1df56ccb8d55f2ad30c4eee92eac7aec6d3b80c..d2d0ff6456325bc0276b4bac867644ea761fb967 100644 (file)
                        #clock-cells = <1>;
                };
 
-               clint0: interrupt-controller@2000000 {
+               clint0: clint@2000000 {
+                       #interrupt-cells = <1>;
                        compatible = "riscv,clint0";
                        reg = <0x2000000 0xC000>;
-                       interrupts-extended = <&cpu0_intc 3>,  <&cpu1_intc 3>;
+                       interrupts-extended =  <&cpu0_intc 3 &cpu0_intc 7
+                                               &cpu1_intc 3 &cpu1_intc 7>;
                        clocks = <&sysctl K210_CLK_ACLK>;
                };
 
diff --git a/arch/riscv/include/asm/clint.h b/arch/riscv/include/asm/clint.h
new file mode 100644 (file)
index 0000000..0789fd3
--- /dev/null
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020 Google, Inc
+ */
+
+#ifndef _ASM_RISCV_CLINT_H
+#define _ASM_RISCV_CLINT_H
+
+#include <linux/types.h>
+#include <asm/mmio.h>
+
+#ifdef CONFIG_RISCV_M_MODE
+/*
+ * This lives in the CLINT driver, but is accessed directly by timex.h to avoid
+ * any overhead when accessing the MMIO timer.
+ *
+ * The ISA defines mtime as a 64-bit memory-mapped register that increments at
+ * a constant frequency, but it doesn't define some other constraints we depend
+ * on (most notably ordering constraints, but also some simpler stuff like the
+ * memory layout).  Thus, this is called "clint_time_val" instead of something
+ * like "riscv_mtime", to signify that these non-ISA assumptions must hold.
+ */
+extern u64 __iomem *clint_time_val;
+#endif
+
+#endif
index ace8a6e2d11d379562c530022341f4b8dbe9bd28..845002cc2e571764fcef957587d984bdc700dce4 100644 (file)
@@ -66,6 +66,13 @@ do {                                                                 \
  * Let auipc+jalr be the basic *mcount unit*, so we make it 8 bytes here.
  */
 #define MCOUNT_INSN_SIZE 8
+
+#ifndef __ASSEMBLY__
+struct dyn_ftrace;
+int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
+#define ftrace_init_nop ftrace_init_nop
+#endif
+
 #endif
 
 #endif /* _ASM_RISCV_FTRACE_H */
index a3fb85d505d44fada43cc15625b2f007783e9025..7f659dda003230d7702134dcb29054a42488c229 100644 (file)
 
 typedef unsigned long cycles_t;
 
+#ifdef CONFIG_RISCV_M_MODE
+
+#include <asm/clint.h>
+
+#ifdef CONFIG_64BIT
+static inline cycles_t get_cycles(void)
+{
+       return readq_relaxed(clint_time_val);
+}
+#else /* !CONFIG_64BIT */
+static inline u32 get_cycles(void)
+{
+       return readl_relaxed(((u32 *)clint_time_val));
+}
+#define get_cycles get_cycles
+
+static inline u32 get_cycles_hi(void)
+{
+       return readl_relaxed(((u32 *)clint_time_val) + 1);
+}
+#define get_cycles_hi get_cycles_hi
+#endif /* CONFIG_64BIT */
+
+#else /* CONFIG_RISCV_M_MODE */
+
 static inline cycles_t get_cycles(void)
 {
        return csr_read(CSR_TIME);
@@ -41,6 +66,8 @@ static inline u64 get_cycles64(void)
 }
 #endif /* CONFIG_64BIT */
 
+#endif /* !CONFIG_RISCV_M_MODE */
+
 #define ARCH_HAS_READ_CURRENT_TIMER
 static inline int read_current_timer(unsigned long *timer_val)
 {
index 2ff63d0cbb500828d3ff78b1b56752d81406107d..99e12faa54986a3c32e26b6dc34ee4cf8f45b22c 100644 (file)
@@ -97,6 +97,25 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
        return __ftrace_modify_call(rec->ip, addr, false);
 }
 
+
+/*
+ * This is called early on, and isn't wrapped by
+ * ftrace_arch_code_modify_{prepare,post_process}() and therefor doesn't hold
+ * text_mutex, which triggers a lockdep failure.  SMP isn't running so we could
+ * just directly poke the text, but it's simpler to just take the lock
+ * ourselves.
+ */
+int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec)
+{
+       int out;
+
+       ftrace_arch_code_modify_prepare();
+       out = ftrace_make_nop(mod, rec, MCOUNT_ADDR);
+       ftrace_arch_code_modify_post_process();
+
+       return out;
+}
+
 int ftrace_update_ftrace_func(ftrace_func_t func)
 {
        int ret = __ftrace_modify_call((unsigned long)&ftrace_call,
index 17ba190e84a53df83a3b9a6c263724de3d757b12..e996e08f1061e5e46bd38acd01623ae8ee87e532 100644 (file)
@@ -250,7 +250,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->a0 = -EINTR;
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                         regs->a0 = regs->orig_a0;
                        regs->epc -= 0x4;
index 787c75f751a55ec4f2dba3d9c5de5ad2d57fc28f..ca03762a373382e04af23bfbf5417c09acb06356 100644 (file)
@@ -226,12 +226,11 @@ void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot)
 
        ptep = &fixmap_pte[pte_index(addr)];
 
-       if (pgprot_val(prot)) {
+       if (pgprot_val(prot))
                set_pte(ptep, pfn_pte(phys >> PAGE_SHIFT, prot));
-       } else {
+       else
                pte_clear(&init_mm, addr, ptep);
-               local_flush_tlb_page(addr);
-       }
+       local_flush_tlb_page(addr);
 }
 
 static pte_t *__init get_pte_virt(phys_addr_t pa)
index bc5f2204693fccc13c103ef0fc1369aaeb784323..579575f9cdae0873057ceb878fc6e9dce46e21c8 100644 (file)
@@ -1020,7 +1020,7 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx,
                        emit_zext64(dst, ctx);
                        break;
                }
-               /* Fallthrough. */
+               fallthrough;
 
        case BPF_ALU | BPF_ADD | BPF_X:
        case BPF_ALU | BPF_SUB | BPF_X:
@@ -1079,7 +1079,7 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx,
                case 16:
                        emit(rv_slli(lo(rd), lo(rd), 16), ctx);
                        emit(rv_srli(lo(rd), lo(rd), 16), ctx);
-                       /* Fallthrough. */
+                       fallthrough;
                case 32:
                        if (!ctx->prog->aux->verifier_zext)
                                emit(rv_addi(hi(rd), RV_REG_ZERO, 0), ctx);
index 3d86e12e8e3c21ed6a23395f6d946f95411000f0..b29fcc66ec39b06e5baba74cf3d4fdb8bcbdf42b 100644 (file)
@@ -30,7 +30,7 @@ config GENERIC_BUG_RELATIVE_POINTERS
        def_bool y
 
 config GENERIC_LOCKBREAK
-       def_bool y if PREEMPTTION
+       def_bool y if PREEMPTION
 
 config PGSTE
        def_bool y if KVM
index 0cf9a82326a85b4f254f46bd0648096621577831..7228aabe9da615f716e9b9fa32a3be19dd899023 100644 (file)
@@ -626,6 +626,7 @@ CONFIG_NTFS_RW=y
 CONFIG_PROC_KCORE=y
 CONFIG_TMPFS=y
 CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_TMPFS_INODE64=y
 CONFIG_HUGETLBFS=y
 CONFIG_CONFIGFS_FS=m
 CONFIG_ECRYPT_FS=m
@@ -807,6 +808,7 @@ CONFIG_DEBUG_NOTIFIERS=y
 CONFIG_BUG_ON_DATA_CORRUPTION=y
 CONFIG_DEBUG_CREDENTIALS=y
 CONFIG_RCU_TORTURE_TEST=m
+CONFIG_RCU_REF_SCALE_TEST=m
 CONFIG_RCU_CPU_STALL_TIMEOUT=300
 # CONFIG_RCU_TRACE is not set
 CONFIG_LATENCYTOP=y
@@ -818,6 +820,7 @@ CONFIG_PREEMPT_TRACER=y
 CONFIG_SCHED_TRACER=y
 CONFIG_FTRACE_SYSCALLS=y
 CONFIG_BLK_DEV_IO_TRACE=y
+CONFIG_BPF_KPROBE_OVERRIDE=y
 CONFIG_HIST_TRIGGERS=y
 CONFIG_S390_PTDUMP=y
 CONFIG_NOTIFIER_ERROR_INJECTION=m
@@ -829,6 +832,7 @@ CONFIG_FAIL_MAKE_REQUEST=y
 CONFIG_FAIL_IO_TIMEOUT=y
 CONFIG_FAIL_FUTEX=y
 CONFIG_FAULT_INJECTION_DEBUG_FS=y
+CONFIG_FAIL_FUNCTION=y
 CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
 CONFIG_LKDTM=m
 CONFIG_TEST_LIST_SORT=y
index 5df9759e8ff6700e6771f9999604b3192e545568..fab03b7a69324bd99085c452e5981f123d56f364 100644 (file)
@@ -617,6 +617,7 @@ CONFIG_NTFS_RW=y
 CONFIG_PROC_KCORE=y
 CONFIG_TMPFS=y
 CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_TMPFS_INODE64=y
 CONFIG_HUGETLBFS=y
 CONFIG_CONFIGFS_FS=m
 CONFIG_ECRYPT_FS=m
@@ -763,6 +764,7 @@ CONFIG_PANIC_ON_OOPS=y
 CONFIG_TEST_LOCKUP=m
 CONFIG_BUG_ON_DATA_CORRUPTION=y
 CONFIG_RCU_TORTURE_TEST=m
+CONFIG_RCU_REF_SCALE_TEST=m
 CONFIG_RCU_CPU_STALL_TIMEOUT=60
 CONFIG_LATENCYTOP=y
 CONFIG_BOOTTIME_TRACING=y
@@ -771,6 +773,7 @@ CONFIG_STACK_TRACER=y
 CONFIG_SCHED_TRACER=y
 CONFIG_FTRACE_SYSCALLS=y
 CONFIG_BLK_DEV_IO_TRACE=y
+CONFIG_BPF_KPROBE_OVERRIDE=y
 CONFIG_HIST_TRIGGERS=y
 CONFIG_S390_PTDUMP=y
 CONFIG_LKDTM=m
index 4091c50449cd06238578d5b640bb364269c5a293..8f67c55625f9eb0f744ebc529361f6a97d80a4dd 100644 (file)
@@ -74,5 +74,6 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_PANIC_ON_OOPS=y
 # CONFIG_SCHED_DEBUG is not set
 CONFIG_RCU_CPU_STALL_TIMEOUT=60
+# CONFIG_RCU_TRACE is not set
 # CONFIG_FTRACE is not set
 # CONFIG_RUNTIME_TESTING_MENU is not set
index 50b4ce8cddfdc4c2f0940e932169458ea4b2141c..918f0ba4f4d20f9934929639dcd4190b0b0f5a1e 100644 (file)
@@ -29,7 +29,7 @@
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ old__, new__, prev__;                                \
        pcp_op_T__ *ptr__;                                              \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        prev__ = *ptr__;                                                \
        do {                                                            \
@@ -37,7 +37,7 @@
                new__ = old__ op (val);                                 \
                prev__ = cmpxchg(ptr__, old__, new__);                  \
        } while (prev__ != old__);                                      \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
        new__;                                                          \
 })
 
@@ -68,7 +68,7 @@
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ val__ = (val);                                       \
        pcp_op_T__ old__, *ptr__;                                       \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                            \
        if (__builtin_constant_p(val__) &&                              \
            ((szcast)val__ > -129) && ((szcast)val__ < 128)) {          \
@@ -84,7 +84,7 @@
                        : [val__] "d" (val__)                           \
                        : "cc");                                        \
        }                                                               \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
 }
 
 #define this_cpu_add_4(pcp, val) arch_this_cpu_add(pcp, val, "laa", "asi", int)
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ val__ = (val);                                       \
        pcp_op_T__ old__, *ptr__;                                       \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        asm volatile(                                                   \
                op "    %[old__],%[val__],%[ptr__]\n"                   \
                : [old__] "=d" (old__), [ptr__] "+Q" (*ptr__)           \
                : [val__] "d" (val__)                                   \
                : "cc");                                                \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                               \
        old__ + val__;                                                  \
 })
 
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ val__ = (val);                                       \
        pcp_op_T__ old__, *ptr__;                                       \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        asm volatile(                                                   \
                op "    %[old__],%[val__],%[ptr__]\n"                   \
                : [old__] "=d" (old__), [ptr__] "+Q" (*ptr__)           \
                : [val__] "d" (val__)                                   \
                : "cc");                                                \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
 }
 
 #define this_cpu_and_4(pcp, val)       arch_this_cpu_to_op(pcp, val, "lan")
        typedef typeof(pcp) pcp_op_T__;                                 \
        pcp_op_T__ ret__;                                               \
        pcp_op_T__ *ptr__;                                              \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        ret__ = cmpxchg(ptr__, oval, nval);                             \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
        ret__;                                                          \
 })
 
 ({                                                                     \
        typeof(pcp) *ptr__;                                             \
        typeof(pcp) ret__;                                              \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        ptr__ = raw_cpu_ptr(&(pcp));                                    \
        ret__ = xchg(ptr__, nval);                                      \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
        ret__;                                                          \
 })
 
        typeof(pcp1) *p1__;                                             \
        typeof(pcp2) *p2__;                                             \
        int ret__;                                                      \
-       preempt_disable();                                              \
+       preempt_disable_notrace();                                      \
        p1__ = raw_cpu_ptr(&(pcp1));                                    \
        p2__ = raw_cpu_ptr(&(pcp2));                                    \
        ret__ = __cmpxchg_double(p1__, p2__, o1__, o2__, n1__, n2__);   \
-       preempt_enable();                                               \
+       preempt_enable_notrace();                                       \
        ret__;                                                          \
 })
 
index 7eb01a5459cdff8912461287b9c9bd9f95642809..b55561cc878655a54901af08239c72c4a173de67 100644 (file)
@@ -1260,26 +1260,44 @@ static inline pgd_t *pgd_offset_raw(pgd_t *pgd, unsigned long address)
 
 #define pgd_offset(mm, address) pgd_offset_raw(READ_ONCE((mm)->pgd), address)
 
-static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)
+static inline p4d_t *p4d_offset_lockless(pgd_t *pgdp, pgd_t pgd, unsigned long address)
 {
-       if ((pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R1)
-               return (p4d_t *) pgd_deref(*pgd) + p4d_index(address);
-       return (p4d_t *) pgd;
+       if ((pgd_val(pgd) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R1)
+               return (p4d_t *) pgd_deref(pgd) + p4d_index(address);
+       return (p4d_t *) pgdp;
 }
+#define p4d_offset_lockless p4d_offset_lockless
 
-static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address)
+static inline p4d_t *p4d_offset(pgd_t *pgdp, unsigned long address)
 {
-       if ((p4d_val(*p4d) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R2)
-               return (pud_t *) p4d_deref(*p4d) + pud_index(address);
-       return (pud_t *) p4d;
+       return p4d_offset_lockless(pgdp, *pgdp, address);
+}
+
+static inline pud_t *pud_offset_lockless(p4d_t *p4dp, p4d_t p4d, unsigned long address)
+{
+       if ((p4d_val(p4d) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R2)
+               return (pud_t *) p4d_deref(p4d) + pud_index(address);
+       return (pud_t *) p4dp;
+}
+#define pud_offset_lockless pud_offset_lockless
+
+static inline pud_t *pud_offset(p4d_t *p4dp, unsigned long address)
+{
+       return pud_offset_lockless(p4dp, *p4dp, address);
 }
 #define pud_offset pud_offset
 
-static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
+static inline pmd_t *pmd_offset_lockless(pud_t *pudp, pud_t pud, unsigned long address)
+{
+       if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R3)
+               return (pmd_t *) pud_deref(pud) + pmd_index(address);
+       return (pmd_t *) pudp;
+}
+#define pmd_offset_lockless pmd_offset_lockless
+
+static inline pmd_t *pmd_offset(pud_t *pudp, unsigned long address)
 {
-       if ((pud_val(*pud) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R3)
-               return (pmd_t *) pud_deref(*pud) + pmd_index(address);
-       return (pmd_t *) pud;
+       return pmd_offset_lockless(pudp, *pudp, address);
 }
 #define pmd_offset pmd_offset
 
index faca269d5f27862edb24fc22dfd742ad106e4972..a44ddc2f2dec519408ea8139e5ea3bd0b65b6165 100644 (file)
@@ -26,6 +26,7 @@ void do_protection_exception(struct pt_regs *regs);
 void do_dat_exception(struct pt_regs *regs);
 void do_secure_storage_access(struct pt_regs *regs);
 void do_non_secure_storage_access(struct pt_regs *regs);
+void do_secure_storage_violation(struct pt_regs *regs);
 
 void addressing_exception(struct pt_regs *regs);
 void data_exception(struct pt_regs *regs);
index 88bb42ca50084769c155acdcb3c1876fac07a287..f7f1e64e0d980f6e36bd1621d7ed01b2393c1331 100644 (file)
@@ -33,21 +33,19 @@ void enabled_wait(void)
                PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
        clear_cpu_flag(CIF_NOHZ_DELAY);
 
-       trace_cpu_idle_rcuidle(1, smp_processor_id());
        local_irq_save(flags);
        /* Call the assembler magic in entry.S */
        psw_idle(idle, psw_mask);
        local_irq_restore(flags);
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 
        /* Account time spent with enabled wait psw loaded as idle time. */
-       write_seqcount_begin(&idle->seqcount);
+       raw_write_seqcount_begin(&idle->seqcount);
        idle_time = idle->clock_idle_exit - idle->clock_idle_enter;
        idle->clock_idle_enter = idle->clock_idle_exit = 0ULL;
        idle->idle_time += idle_time;
        idle->idle_count++;
        account_idle_time(cputime_to_nsecs(idle_time));
-       write_seqcount_end(&idle->seqcount);
+       raw_write_seqcount_end(&idle->seqcount);
 }
 NOKPROBE_SYMBOL(enabled_wait);
 
index 2c27907a5ffcb8a5db60c7e667d9a3e5412f71bb..9a92638360eee67ee5eca2bdb795e930f5065fa2 100644 (file)
@@ -80,7 +80,7 @@ PGM_CHECK(do_dat_exception)           /* 3b */
 PGM_CHECK_DEFAULT                      /* 3c */
 PGM_CHECK(do_secure_storage_access)    /* 3d */
 PGM_CHECK(do_non_secure_storage_access)        /* 3e */
-PGM_CHECK_DEFAULT                      /* 3f */
+PGM_CHECK(do_secure_storage_violation) /* 3f */
 PGM_CHECK(monitor_event_exception)     /* 40 */
 PGM_CHECK_DEFAULT                      /* 41 */
 PGM_CHECK_DEFAULT                      /* 42 */
index e600f6953d7ceff50264f79e1f99d8d3a163c665..c2c1b4e723eafbd91ea7d0e9cbd4d2bd1f205167 100644 (file)
@@ -619,7 +619,7 @@ static struct notifier_block kdump_mem_nb = {
 /*
  * Make sure that the area behind memory_end is protected
  */
-static void reserve_memory_end(void)
+static void __init reserve_memory_end(void)
 {
        if (memory_end_set)
                memblock_reserve(memory_end, ULONG_MAX);
@@ -628,7 +628,7 @@ static void reserve_memory_end(void)
 /*
  * Make sure that oldmem, where the dump is stored, is protected
  */
-static void reserve_oldmem(void)
+static void __init reserve_oldmem(void)
 {
 #ifdef CONFIG_CRASH_DUMP
        if (OLDMEM_BASE)
@@ -640,7 +640,7 @@ static void reserve_oldmem(void)
 /*
  * Make sure that oldmem, where the dump is stored, is protected
  */
-static void remove_oldmem(void)
+static void __init remove_oldmem(void)
 {
 #ifdef CONFIG_CRASH_DUMP
        if (OLDMEM_BASE)
index 4c8c063bce5b1611cb3aac566b27b26e62cc3584..996884dcc9fdb0bbdb9cf1033ad56ed6df6289cc 100644 (file)
@@ -859,6 +859,21 @@ void do_non_secure_storage_access(struct pt_regs *regs)
 }
 NOKPROBE_SYMBOL(do_non_secure_storage_access);
 
+void do_secure_storage_violation(struct pt_regs *regs)
+{
+       /*
+        * Either KVM messed up the secure guest mapping or the same
+        * page is mapped into multiple secure guests.
+        *
+        * This exception is only triggered when a guest 2 is running
+        * and can therefore never occur in kernel context.
+        */
+       printk_ratelimited(KERN_WARNING
+                          "Secure storage violation in task: %s, pid %d\n",
+                          current->comm, current->pid);
+       send_sig(SIGSEGV, current, 0);
+}
+
 #else
 void do_secure_storage_access(struct pt_regs *regs)
 {
@@ -869,4 +884,9 @@ void do_non_secure_storage_access(struct pt_regs *regs)
 {
        default_trap_handler(regs);
 }
+
+void do_secure_storage_violation(struct pt_regs *regs)
+{
+       default_trap_handler(regs);
+}
 #endif
index 1aed1a4dfc2d6a446f6113d72ce4074404ef2a21..eddf71c22875e3a2487095a8dab0bd0809b85b0a 100644 (file)
@@ -402,6 +402,7 @@ static int modify_p4d_table(pgd_t *pgd, unsigned long addr, unsigned long end,
                        pud = vmem_crst_alloc(_REGION3_ENTRY_EMPTY);
                        if (!pud)
                                goto out;
+                       p4d_populate(&init_mm, p4d, pud);
                }
                ret = modify_pud_table(p4d, addr, next, add, direct);
                if (ret)
index 4b62d6b550246ddf20c8cd72dcabebfb6e8e2075..1804230dd8d822d8649c000a0d4704e9a058d0fe 100644 (file)
@@ -668,6 +668,10 @@ EXPORT_SYMBOL_GPL(zpci_enable_device);
 int zpci_disable_device(struct zpci_dev *zdev)
 {
        zpci_dma_exit_device(zdev);
+       /*
+        * The zPCI function may already be disabled by the platform, this is
+        * detected in clp_disable_fh() which becomes a no-op.
+        */
        return clp_disable_fh(zdev);
 }
 EXPORT_SYMBOL_GPL(zpci_disable_device);
index 9a3a291cad43244feca43b05c2ad7896a38dded7..d9ae7456dd4c8a1a85f33d5a303268e7f7da6338 100644 (file)
@@ -143,6 +143,8 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
                        zpci_remove_device(zdev);
                }
 
+               zdev->fh = ccdf->fh;
+               zpci_disable_device(zdev);
                zdev->state = ZPCI_FN_STATE_STANDBY;
                if (!clp_get_state(ccdf->fid, &state) &&
                    state == ZPCI_FN_STATE_RESERVED) {
index f3dc3f25b3ff08c2af8bd2a1db845fd2c6308ded..143747c45206fe6fd5e78cf57148127a9133c0ee 100644 (file)
@@ -246,7 +246,7 @@ static int __init sh_early_platform_driver_probe_id(char *class_str,
                case EARLY_PLATFORM_ID_ERROR:
                        pr_warn("%s: unable to parse %s parameter\n",
                                class_str, epdrv->pdrv->driver.name);
-                       /* fall-through */
+                       fallthrough;
                case EARLY_PLATFORM_ID_UNSET:
                        match = NULL;
                        break;
index 1a0d7cf71c102db7a28af88f769a8d83a88ee11a..100bf241340b92373bba3787a27272c795034283 100644 (file)
@@ -8,7 +8,6 @@
 
 #ifdef CONFIG_SMP
 
-#include <linux/spinlock.h>
 #include <linux/atomic.h>
 #include <asm/current.h>
 #include <asm/percpu.h>
index 08e1af63edd9623c2fd941df937fa28a2aa1f7a2..34e25a439c811cbf3e113cc6c8fd82b57ff7afb4 100644 (file)
@@ -486,7 +486,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
                                        pr_cont("xd%d", rn & ~1);
                                        break;
                                }
-                               /* else, fall through */
+                               fallthrough;
                        case D_REG_N:
                                pr_cont("dr%d", rn);
                                break;
@@ -495,7 +495,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
                                        pr_cont("xd%d", rm & ~1);
                                        break;
                                }
-                               /* else, fall through */
+                               fallthrough;
                        case D_REG_M:
                                pr_cont("dr%d", rm);
                                break;
index ad963104d22d47fd2afdfb21bf135d4ded22921d..91ab2607a1ff9f24ba615481a9761f946d69e871 100644 (file)
@@ -370,7 +370,6 @@ syscall_trace_entry:
         nop
        cmp/eq  #-1, r0
        bt      syscall_exit
-       mov.l   r0, @(OFF_R0,r15)       ! Save return value
        !                       Reload R0-R4 from kernel stack, where the
        !                       parent may have modified them using
        !                       ptrace(POKEUSR).  (Note that R0-R2 are
index 0d5f3c9d52f30edbcbf51141b8de16a294236903..e4147efa9ec6da2f2a73840361169c65324990d9 100644 (file)
@@ -266,7 +266,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                ptr = &remcomInBuffer[1];
                if (kgdb_hex2long(&ptr, &addr))
                        linux_regs->pc = addr;
-               /* fallthrough */
+               fallthrough;
        case 'D':
        case 'k':
                atomic_set(&kgdb_cpu_doing_single_step, -1);
index b05bf92f9c3254469d31be2f898b183dbe2305dc..5281685f6ad1f728b3ac8c577aaa54a1c7f99fc2 100644 (file)
@@ -455,16 +455,11 @@ long arch_ptrace(struct task_struct *child, long request,
 
 asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
 {
-       long ret = 0;
-
        if (test_thread_flag(TIF_SYSCALL_TRACE) &&
-           tracehook_report_syscall_entry(regs))
-               /*
-                * Tracing decided this syscall should not happen.
-                * We'll return a bogus call number to get an ENOSYS
-                * error, but leave the original number in regs->regs[0].
-                */
-               ret = -1L;
+           tracehook_report_syscall_entry(regs)) {
+               regs->regs[0] = -ENOSYS;
+               return -1;
+       }
 
        if (secure_computing() == -1)
                return -1;
@@ -475,7 +470,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
        audit_syscall_entry(regs->regs[3], regs->regs[4], regs->regs[5],
                            regs->regs[6], regs->regs[7]);
 
-       return ret ?: regs->regs[0];
+       return 0;
 }
 
 asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
index a0fbb8427b3911c66a9ef5ac21dd614d418ba3d5..4fe3f00137bc0d173aff33d121ce3602254408a2 100644 (file)
@@ -418,7 +418,7 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs,
                case -ERESTARTSYS:
                        if (!(sa->sa_flags & SA_RESTART))
                                goto no_system_call_restart;
-               /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->regs[0] = save_r0;
                        regs->pc -= instruction_size(__raw_readw(regs->pc - 4));
index 4843f48bfe85f7f2543bde7d1670230ecefe2bc3..774a82b0c649f0bcf0d7bb15d66d7eaa805e41ed 100644 (file)
@@ -87,7 +87,6 @@ void auxio_set_lte(int on)
                __auxio_sbus_set_lte(on);
                break;
        case AUXIO_TYPE_EBUS:
-               /* FALL-THROUGH */
        default:
                break;
        }
index bfae98ab863814dcd54418438f8715c184f89d72..23f8838dd96e3ad3dd6be1ff0f7c2394f1244e6b 100644 (file)
@@ -55,7 +55,7 @@ static int clock_board_calc_nslots(struct clock_board *p)
                        else
                                return 5;
                }
-               /* Fallthrough */
+               fallthrough;
        default:
                return 4;
        }
index 7580775a14b9e71567252dae142f5bb111efdcf8..58ad3f7de1fb531061e93bdb7ab346181b2fbffb 100644 (file)
@@ -122,7 +122,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                        linux_regs->pc = addr;
                        linux_regs->npc = addr + 4;
                }
-               /* fall through */
+               fallthrough;
 
        case 'D':
        case 'k':
index 5d6c2d287e85533fafba6b9c3fb8243a32e4de93..177746ae2c817fed08a3119f131d09751b099646 100644 (file)
@@ -148,7 +148,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                        linux_regs->tpc = addr;
                        linux_regs->tnpc = addr + 4;
                }
-               /* fall through */
+               fallthrough;
 
        case 'D':
        case 'k':
index c0886b400dad23a58057d0f0869bb64ba16616a7..2a12c86af956e0dfbde6ceeaa5939a4e70e8fccf 100644 (file)
@@ -359,7 +359,7 @@ int __init pcr_arch_init(void)
                 * counter overflow interrupt so we can't make use of
                 * their hardware currently.
                 */
-               /* fallthrough */
+               fallthrough;
        default:
                err = -ENODEV;
                goto out_unregister;
index da8902295c8c37780de6998dd818195c496dddf3..3df960c137f7641b8456ef61912e40e5c3ca1e0e 100644 (file)
@@ -224,7 +224,7 @@ void __init of_console_init(void)
 
                case PROMDEV_TTYB:
                        skip = 1;
-                       /* FALLTHRU */
+                       fallthrough;
 
                case PROMDEV_TTYA:
                        type = "serial";
index e2c6f0abda009be9972b82d76e5f4c18b5dd8334..e9695a06492ff2f51ee8466ff209ea4ce8f09778 100644 (file)
@@ -646,7 +646,7 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
        case ERESTARTSYS:
                if (!(sa->sa_flags & SA_RESTART))
                        goto no_system_call_restart;
-               /* fallthrough */
+               fallthrough;
        case ERESTARTNOINTR:
                regs->u_regs[UREG_I0] = orig_i0;
                regs->tpc -= 4;
@@ -686,7 +686,7 @@ void do_signal32(struct pt_regs * regs)
                                regs->tpc -= 4;
                                regs->tnpc -= 4;
                                pt_regs_clear_syscall(regs);
-                               /* fall through */
+                               fallthrough;
                        case ERESTART_RESTARTBLOCK:
                                regs->u_regs[UREG_G1] = __NR_restart_syscall;
                                regs->tpc -= 4;
index f1f8c8ebe641d395f87034e466114b2467989cf9..d0e0025ee3ba82eaef7e79bcb9db85230ce1dbd2 100644 (file)
@@ -440,7 +440,7 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
        case ERESTARTSYS:
                if (!(sa->sa_flags & SA_RESTART))
                        goto no_system_call_restart;
-               /* fallthrough */
+               fallthrough;
        case ERESTARTNOINTR:
                regs->u_regs[UREG_I0] = orig_i0;
                regs->pc -= 4;
@@ -506,7 +506,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
                                regs->pc -= 4;
                                regs->npc -= 4;
                                pt_regs_clear_syscall(regs);
-                               /* fall through */
+                               fallthrough;
                        case ERESTART_RESTARTBLOCK:
                                regs->u_regs[UREG_G1] = __NR_restart_syscall;
                                regs->pc -= 4;
index 6937339a272c5111297dc92d9d81a489777df438..255264bcb46a7cf6906060250addd2aeeee06c23 100644 (file)
@@ -461,7 +461,7 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
        case ERESTARTSYS:
                if (!(sa->sa_flags & SA_RESTART))
                        goto no_system_call_restart;
-               /* fallthrough */
+               fallthrough;
        case ERESTARTNOINTR:
                regs->u_regs[UREG_I0] = orig_i0;
                regs->tpc -= 4;
@@ -532,7 +532,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
                                regs->tpc -= 4;
                                regs->tnpc -= 4;
                                pt_regs_clear_syscall(regs);
-                               /* fall through */
+                               fallthrough;
                        case ERESTART_RESTARTBLOCK:
                                regs->u_regs[UREG_G1] = __NR_restart_syscall;
                                regs->tpc -= 4;
index 72e560ef4a0912f4b3d29939db0733e2e1a88742..d5beec856146088e06a77bf59df49145203df10f 100644 (file)
@@ -359,7 +359,7 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs)
                        *pfsr |= (6 << 14);
                        return 0;                       /* simulate invalid_fp_register exception */
                }
-       /* fall through */
+               fallthrough;
        case 2:
                if (freg & 1) {                         /* doublewords must have bit 5 zeroed */
                        *pfsr |= (6 << 14);
@@ -380,7 +380,7 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs)
                        *pfsr |= (6 << 14);
                        return 0;                       /* simulate invalid_fp_register exception */
                }
-       /* fall through */
+               fallthrough;
        case 2:
                if (freg & 1) {                         /* doublewords must have bit 5 zeroed */
                        *pfsr |= (6 << 14);
@@ -408,13 +408,13 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs)
                        *pfsr |= (6 << 14);
                        return 0;                       /* simulate invalid_fp_register exception */
                }
-       /* fall through */
+               fallthrough;
        case 2:
                if (freg & 1) {                         /* doublewords must have bit 5 zeroed */
                        *pfsr |= (6 << 14);
                        return 0;
                }
-       /* fall through */
+               fallthrough;
        case 1:
                rd = (void *)&fregs[freg];
                break;
index c8eabb973b8688648dff42f70bd6f05b43a35103..b1dbf2fa8c0ae82e4bdb5ed87b3ddc8964a96d6d 100644 (file)
@@ -491,7 +491,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
                                } else {
                                        emit_loadimm(K, r_A);
                                }
-                               /* Fallthrough */
+                               fallthrough;
                        case BPF_RET | BPF_A:
                                if (seen_or_pass0) {
                                        if (i != flen - 1) {
index 3d57c71c532e47a41654d1a2974824f52f4d3ddf..88cd9b5c1b74442f72658b6740e24e9869e5c5f1 100644 (file)
@@ -70,7 +70,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                PT_REGS_SYSCALL_RET(regs) = -EINTR;
                                break;
                        }
-               /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        PT_REGS_RESTART_SYSCALL(regs);
                        PT_REGS_ORIG_SYSCALL(regs) = PT_REGS_SYSCALL_NR(regs);
index 4ff01176c1cc1dfcf812b9750e428d370ea78497..21d56ae83cdf1701cc5b6e8030cefb44daa79df5 100644 (file)
@@ -54,7 +54,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *b
                        /* else */
                        state = st_wordcmp;
                        opptr = option;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordcmp:
                        if (c == '=' && !*opptr) {
@@ -129,7 +129,7 @@ int __cmdline_find_option_bool(unsigned long cmdline_ptr, const char *option)
                        state = st_wordcmp;
                        opptr = option;
                        wstart = pos;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordcmp:
                        if (!*opptr)
index 3962f592633d1a7a8ab819a14c4f5ee785644463..ff7894f39e0eaa304a74007588e7d3b45f022038 100644 (file)
@@ -43,6 +43,8 @@ KBUILD_CFLAGS += -Wno-pointer-sign
 KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 KBUILD_CFLAGS += -D__DISABLE_EXPORTS
+# Disable relocation relaxation in case the link is not PIE.
+KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no)
 
 KBUILD_AFLAGS  := $(KBUILD_CFLAGS) -D__ASSEMBLY__
 GCOV_PROFILE := n
index 0048269180d58ab1ca597df5ada2a7fcd66c8c9e..dde7cb3724df38e7c51af9fdc73142167ad298e9 100644 (file)
@@ -178,7 +178,7 @@ parse_memmap(char *p, unsigned long long *start, unsigned long long *size,
                        }
                        *size = 0;
                }
-               /* Fall through */
+               fallthrough;
        default:
                /*
                 * If w/o offset, only size specified, memmap=nn[KMG] has the
index d7577fece9ebaad75530eb2470570b2d5deef74f..78210793d357cf027b8a44419ec3b9447bdad98a 100644 (file)
@@ -19,6 +19,7 @@ CONFIG_CGROUP_CPUACCT=y
 CONFIG_BLK_DEV_INITRD=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_PROFILING=y
+# CONFIG_64BIT is not set
 CONFIG_SMP=y
 CONFIG_X86_GENERIC=y
 CONFIG_HPET_TIMER=y
@@ -186,7 +187,6 @@ CONFIG_DRM_I915=y
 CONFIG_FB_MODE_HELPERS=y
 CONFIG_FB_TILEBLITTING=y
 CONFIG_FB_EFI=y
-CONFIG_VGACON_SOFT_SCROLLBACK=y
 CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_MONO is not set
 # CONFIG_LOGO_LINUX_VGA16 is not set
index f8560014374762fe3b79a6ad70dc39f23f94ad03..9936528e19393afad0f87a89196e43dd2c52e171 100644 (file)
@@ -181,7 +181,6 @@ CONFIG_DRM_I915=y
 CONFIG_FB_MODE_HELPERS=y
 CONFIG_FB_TILEBLITTING=y
 CONFIG_FB_EFI=y
-CONFIG_VGACON_SOFT_SCROLLBACK=y
 CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_MONO is not set
 # CONFIG_LOGO_LINUX_VGA16 is not set
index 48512c7944e7e63ae70f2e452fc318e6b0e4fcf6..870efeec8bdacc2f8d027892198d96c5a54cabd7 100644 (file)
@@ -60,16 +60,10 @@ __visible noinstr void do_syscall_64(unsigned long nr, struct pt_regs *regs)
 #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
 static __always_inline unsigned int syscall_32_enter(struct pt_regs *regs)
 {
-       unsigned int nr = (unsigned int)regs->orig_ax;
-
        if (IS_ENABLED(CONFIG_IA32_EMULATION))
                current_thread_info()->status |= TS_COMPAT;
-       /*
-        * Subtlety here: if ptrace pokes something larger than 2^32-1 into
-        * orig_ax, the unsigned int return value truncates it.  This may
-        * or may not be necessary, but it matches the old asm behavior.
-        */
-       return (unsigned int)syscall_enter_from_user_mode(regs, nr);
+
+       return (unsigned int)regs->orig_ax;
 }
 
 /*
@@ -91,15 +85,29 @@ __visible noinstr void do_int80_syscall_32(struct pt_regs *regs)
 {
        unsigned int nr = syscall_32_enter(regs);
 
+       /*
+        * Subtlety here: if ptrace pokes something larger than 2^32-1 into
+        * orig_ax, the unsigned int return value truncates it.  This may
+        * or may not be necessary, but it matches the old asm behavior.
+        */
+       nr = (unsigned int)syscall_enter_from_user_mode(regs, nr);
+
        do_syscall_32_irqs_on(regs, nr);
        syscall_exit_to_user_mode(regs);
 }
 
 static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
 {
-       unsigned int nr = syscall_32_enter(regs);
+       unsigned int nr = syscall_32_enter(regs);
        int res;
 
+       /*
+        * This cannot use syscall_enter_from_user_mode() as it has to
+        * fetch EBP before invoking any of the syscall entry work
+        * functions.
+        */
+       syscall_enter_from_user_mode_prepare(regs);
+
        instrumentation_begin();
        /* Fetch EBP from where the vDSO stashed it. */
        if (IS_ENABLED(CONFIG_X86_64)) {
@@ -122,6 +130,9 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
                return false;
        }
 
+       /* The case truncates any ptrace induced syscall nr > 2^32 -1 */
+       nr = (unsigned int)syscall_enter_from_user_mode_work(regs, nr);
+
        /* Now this is just like a normal syscall. */
        do_syscall_32_irqs_on(regs, nr);
        syscall_exit_to_user_mode(regs);
@@ -288,7 +299,7 @@ __visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs)
        old_regs = set_irq_regs(regs);
 
        instrumentation_begin();
-       run_on_irqstack_cond(__xen_pv_evtchn_do_upcall, NULL, regs);
+       run_on_irqstack_cond(__xen_pv_evtchn_do_upcall, regs);
        instrumentation_begin();
 
        set_irq_regs(old_regs);
index 70dea9337816272caf56675f1d5b900554cf3d8b..d977079a7d02e2b92d85d3b9c7545a8969d29d5e 100644 (file)
@@ -682,6 +682,8 @@ SYM_CODE_END(.Lbad_gs)
  * rdx: Function argument (can be NULL if none)
  */
 SYM_FUNC_START(asm_call_on_stack)
+SYM_INNER_LABEL(asm_call_sysvec_on_stack, SYM_L_GLOBAL)
+SYM_INNER_LABEL(asm_call_irq_on_stack, SYM_L_GLOBAL)
        /*
         * Save the frame pointer unconditionally. This allows the ORC
         * unwinder to handle the stack switch.
index 3a07ce3ec70bafd65e437a837796ba0b5d4c53ed..f1f96d4d8cd607ef2a11cf4850cbfe8f50cfcb9b 100644 (file)
@@ -29,11 +29,6 @@ SYM_CODE_START_NOALIGN(\name)
 SYM_CODE_END(\name)
        .endm
 
-#ifdef CONFIG_TRACE_IRQFLAGS
-       THUNK trace_hardirqs_on_thunk,trace_hardirqs_on_caller,1
-       THUNK trace_hardirqs_off_thunk,trace_hardirqs_off_caller,1
-#endif
-
 #ifdef CONFIG_PREEMPTION
        THUNK preempt_schedule_thunk, preempt_schedule
        THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace
index 50963472ee850c35abed7d43b097f72a4c9277b7..31e6887d24f1a9dadfc1ad0f0fd9ea955daca925 100644 (file)
@@ -4682,7 +4682,7 @@ __init int intel_pmu_init(void)
 
        case INTEL_FAM6_CORE2_MEROM:
                x86_add_quirk(intel_clovertown_quirk);
-               /* fall through */
+               fallthrough;
 
        case INTEL_FAM6_CORE2_MEROM_L:
        case INTEL_FAM6_CORE2_PENRYN:
@@ -5062,7 +5062,7 @@ __init int intel_pmu_init(void)
 
        case INTEL_FAM6_SKYLAKE_X:
                pmem = true;
-               /* fall through */
+               fallthrough;
        case INTEL_FAM6_SKYLAKE_L:
        case INTEL_FAM6_SKYLAKE:
        case INTEL_FAM6_KABYLAKE_L:
@@ -5114,7 +5114,7 @@ __init int intel_pmu_init(void)
        case INTEL_FAM6_ICELAKE_X:
        case INTEL_FAM6_ICELAKE_D:
                pmem = true;
-               /* fall through */
+               fallthrough;
        case INTEL_FAM6_ICELAKE_L:
        case INTEL_FAM6_ICELAKE:
        case INTEL_FAM6_TIGERLAKE_L:
index 63f58bdf556c433f46a215ba70cc12204250313c..8961653c5dd2ba91118c566a1c0738ab0ad9d4d7 100644 (file)
@@ -1268,7 +1268,7 @@ static int branch_type(unsigned long from, unsigned long to, int abort)
                        ret = X86_BR_ZERO_CALL;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case 0x9a: /* call far absolute */
                ret = X86_BR_CALL;
                break;
index ca0976456a6b0e5d1e336f6f021658125b61aaab..6d2df1ee427b96d18533761694aaeb2f0b8ad71f 100644 (file)
@@ -159,8 +159,6 @@ static inline u64 x86_default_get_root_pointer(void)
 extern int x86_acpi_numa_init(void);
 #endif /* CONFIG_ACPI_NUMA */
 
-#define acpi_unlazy_tlb(x)     leave_mm(x)
-
 #ifdef CONFIG_ACPI_APEI
 static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
 {
index a8f9315b9eaeff990bf3781b3f085b16619acf8b..6fe54b2813c13960786595db35b7b1f2b0c0dba1 100644 (file)
@@ -18,8 +18,16 @@ static __always_inline void arch_check_user_regs(struct pt_regs *regs)
                 * state, not the interrupt state as imagined by Xen.
                 */
                unsigned long flags = native_save_fl();
-               WARN_ON_ONCE(flags & (X86_EFLAGS_AC | X86_EFLAGS_DF |
-                                     X86_EFLAGS_NT));
+               unsigned long mask = X86_EFLAGS_DF | X86_EFLAGS_NT;
+
+               /*
+                * For !SMAP hardware we patch out CLAC on entry.
+                */
+               if (boot_cpu_has(X86_FEATURE_SMAP) ||
+                   (IS_ENABLED(CONFIG_64_BIT) && boot_cpu_has(X86_FEATURE_XENPV)))
+                       mask |= X86_EFLAGS_AC;
+
+               WARN_ON_ONCE(flags & mask);
 
                /* We think we came from user mode. Make sure pt_regs agrees. */
                WARN_ON_ONCE(!user_mode(regs));
index 296b346184b27bba25836516f4f24ffa29694a5f..fb42659f6e98860112320225f4bc84e44f43c620 100644 (file)
 #define FRAME_END "pop %" _ASM_BP "\n"
 
 #ifdef CONFIG_X86_64
+
 #define ENCODE_FRAME_POINTER                   \
        "lea 1(%rsp), %rbp\n\t"
+
+static inline unsigned long encode_frame_pointer(struct pt_regs *regs)
+{
+       return (unsigned long)regs + 1;
+}
+
 #else /* !CONFIG_X86_64 */
+
 #define ENCODE_FRAME_POINTER                   \
        "movl %esp, %ebp\n\t"                   \
        "andl $0x7fffffff, %ebp\n\t"
+
+static inline unsigned long encode_frame_pointer(struct pt_regs *regs)
+{
+       return (unsigned long)regs & 0x7fffffff;
+}
+
 #endif /* CONFIG_X86_64 */
 
 #endif /* __ASSEMBLY__ */
 
 #define ENCODE_FRAME_POINTER
 
+static inline unsigned long encode_frame_pointer(struct pt_regs *regs)
+{
+       return 0;
+}
+
 #endif
 
 #define FRAME_BEGIN
index a4336619121208135c18fad12be42d90ba9d603e..a0638640f1edae20c15139a042ae9f45830206bc 100644 (file)
@@ -242,7 +242,7 @@ __visible noinstr void func(struct pt_regs *regs)                   \
        instrumentation_begin();                                        \
        irq_enter_rcu();                                                \
        kvm_set_cpu_l1tf_flush_l1d();                                   \
-       run_on_irqstack_cond(__##func, regs, regs);                     \
+       run_sysvec_on_irqstack_cond(__##func, regs);                    \
        irq_exit_rcu();                                                 \
        instrumentation_end();                                          \
        irqentry_exit(regs, state);                                     \
index 4ae66f097101d1cae8c2b23f2f4835fd944e4b56..775816965c6ae098f249dcf83c61d131da0ced9a 100644 (file)
@@ -12,20 +12,50 @@ static __always_inline bool irqstack_active(void)
        return __this_cpu_read(irq_count) != -1;
 }
 
-void asm_call_on_stack(void *sp, void *func, void *arg);
+void asm_call_on_stack(void *sp, void (*func)(void), void *arg);
+void asm_call_sysvec_on_stack(void *sp, void (*func)(struct pt_regs *regs),
+                             struct pt_regs *regs);
+void asm_call_irq_on_stack(void *sp, void (*func)(struct irq_desc *desc),
+                          struct irq_desc *desc);
 
-static __always_inline void __run_on_irqstack(void *func, void *arg)
+static __always_inline void __run_on_irqstack(void (*func)(void))
 {
        void *tos = __this_cpu_read(hardirq_stack_ptr);
 
        __this_cpu_add(irq_count, 1);
-       asm_call_on_stack(tos - 8, func, arg);
+       asm_call_on_stack(tos - 8, func, NULL);
+       __this_cpu_sub(irq_count, 1);
+}
+
+static __always_inline void
+__run_sysvec_on_irqstack(void (*func)(struct pt_regs *regs),
+                        struct pt_regs *regs)
+{
+       void *tos = __this_cpu_read(hardirq_stack_ptr);
+
+       __this_cpu_add(irq_count, 1);
+       asm_call_sysvec_on_stack(tos - 8, func, regs);
+       __this_cpu_sub(irq_count, 1);
+}
+
+static __always_inline void
+__run_irq_on_irqstack(void (*func)(struct irq_desc *desc),
+                     struct irq_desc *desc)
+{
+       void *tos = __this_cpu_read(hardirq_stack_ptr);
+
+       __this_cpu_add(irq_count, 1);
+       asm_call_irq_on_stack(tos - 8, func, desc);
        __this_cpu_sub(irq_count, 1);
 }
 
 #else /* CONFIG_X86_64 */
 static inline bool irqstack_active(void) { return false; }
-static inline void __run_on_irqstack(void *func, void *arg) { }
+static inline void __run_on_irqstack(void (*func)(void)) { }
+static inline void __run_sysvec_on_irqstack(void (*func)(struct pt_regs *regs),
+                                           struct pt_regs *regs) { }
+static inline void __run_irq_on_irqstack(void (*func)(struct irq_desc *desc),
+                                        struct irq_desc *desc) { }
 #endif /* !CONFIG_X86_64 */
 
 static __always_inline bool irq_needs_irq_stack(struct pt_regs *regs)
@@ -37,17 +67,40 @@ static __always_inline bool irq_needs_irq_stack(struct pt_regs *regs)
        return !user_mode(regs) && !irqstack_active();
 }
 
-static __always_inline void run_on_irqstack_cond(void *func, void *arg,
+
+static __always_inline void run_on_irqstack_cond(void (*func)(void),
                                                 struct pt_regs *regs)
 {
-       void (*__func)(void *arg) = func;
+       lockdep_assert_irqs_disabled();
+
+       if (irq_needs_irq_stack(regs))
+               __run_on_irqstack(func);
+       else
+               func();
+}
+
+static __always_inline void
+run_sysvec_on_irqstack_cond(void (*func)(struct pt_regs *regs),
+                           struct pt_regs *regs)
+{
+       lockdep_assert_irqs_disabled();
 
+       if (irq_needs_irq_stack(regs))
+               __run_sysvec_on_irqstack(func, regs);
+       else
+               func(regs);
+}
+
+static __always_inline void
+run_irq_on_irqstack_cond(void (*func)(struct irq_desc *desc), struct irq_desc *desc,
+                        struct pt_regs *regs)
+{
        lockdep_assert_irqs_disabled();
 
        if (irq_needs_irq_stack(regs))
-               __run_on_irqstack(__func, arg);
+               __run_irq_on_irqstack(func, desc);
        else
-               __func(arg);
+               func(desc);
 }
 
 #endif
index 0a301ad0b02f0018c054bb2676340860f7d5f9bc..9257667d13c5e37519ccfe6c5440129ed1d4f4c3 100644 (file)
@@ -59,5 +59,6 @@ typedef struct {
        }
 
 void leave_mm(int cpu);
+#define leave_mm leave_mm
 
 #endif /* _ASM_X86_MMU_H */
index 40aa69d04862e1d00d82a2dd2fd5f3e7b7f495f3..d8324a23669610e379078543e3cbed3855aaae3e 100644 (file)
@@ -327,8 +327,8 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs,
        static const unsigned int argument_offs[] = {
 #ifdef __i386__
                offsetof(struct pt_regs, ax),
-               offsetof(struct pt_regs, cx),
                offsetof(struct pt_regs, dx),
+               offsetof(struct pt_regs, cx),
 #define NR_REG_ARGUMENTS 3
 #else
                offsetof(struct pt_regs, di),
index c3daf0aaa0ee6d387a5ff1c2ddafff2bea746fb1..cdaab30880b91c969344e42ba3392f98a055def3 100644 (file)
@@ -239,7 +239,7 @@ void __init arch_init_ideal_nops(void)
                        return;
                }
 
-               /* fall through */
+               fallthrough;
 
        default:
 #ifdef CONFIG_X86_64
index 21325a4a78b92d6d03be3fc6e96a02ec91ad9b3a..21f9c7f117796c9c298ba0a199f88b197384fdba 100644 (file)
@@ -800,7 +800,7 @@ static int irq_polarity(int idx)
                return IOAPIC_POL_HIGH;
        case MP_IRQPOL_RESERVED:
                pr_warn("IOAPIC: Invalid polarity: 2, defaulting to low\n");
-               /* fall through */
+               fallthrough;
        case MP_IRQPOL_ACTIVE_LOW:
        default: /* Pointless default required due to do gcc stupidity */
                return IOAPIC_POL_LOW;
@@ -848,7 +848,7 @@ static int irq_trigger(int idx)
                return IOAPIC_EDGE;
        case MP_IRQTRIG_RESERVED:
                pr_warn("IOAPIC: Invalid trigger mode 2 defaulting to level\n");
-               /* fall through */
+               fallthrough;
        case MP_IRQTRIG_LEVEL:
        default: /* Pointless default required due to do gcc stupidity */
                return IOAPIC_LEVEL;
@@ -2243,6 +2243,7 @@ static inline void __init check_timer(void)
        legacy_pic->init(0);
        legacy_pic->make_irq(0);
        apic_write(APIC_LVT0, APIC_DM_EXTINT);
+       legacy_pic->unmask(0);
 
        unlock_ExtINT_logic();
 
index 7bda71def557bc559310bff246eddb09d1017ec1..99ee61c9ba548f3485edcad9b9c1874c10828af5 100644 (file)
@@ -149,7 +149,7 @@ void __init default_setup_apic_routing(void)
                                break;
                        }
                        /* P4 and above */
-                       /* fall through */
+                       fallthrough;
                case X86_VENDOR_HYGON:
                case X86_VENDOR_AMD:
                        def_to_bigsmp = 1;
index dae32d948bf25ead0ff7193ea31ee32fb926fe5f..f8a56b5dc29fe572a2e2fcb50e5e0c57b661c043 100644 (file)
@@ -161,6 +161,7 @@ static void apic_update_vector(struct irq_data *irqd, unsigned int newvec,
                apicd->move_in_progress = true;
                apicd->prev_vector = apicd->vector;
                apicd->prev_cpu = apicd->cpu;
+               WARN_ON_ONCE(apicd->cpu == newcpu);
        } else {
                irq_matrix_free(vector_matrix, apicd->cpu, apicd->vector,
                                managed);
@@ -910,7 +911,7 @@ void send_cleanup_vector(struct irq_cfg *cfg)
                __send_cleanup_vector(apicd);
 }
 
-static void __irq_complete_move(struct irq_cfg *cfg, unsigned vector)
+void irq_complete_move(struct irq_cfg *cfg)
 {
        struct apic_chip_data *apicd;
 
@@ -918,15 +919,16 @@ static void __irq_complete_move(struct irq_cfg *cfg, unsigned vector)
        if (likely(!apicd->move_in_progress))
                return;
 
-       if (vector == apicd->vector && apicd->cpu == smp_processor_id())
+       /*
+        * If the interrupt arrived on the new target CPU, cleanup the
+        * vector on the old target CPU. A vector check is not required
+        * because an interrupt can never move from one vector to another
+        * on the same CPU.
+        */
+       if (apicd->cpu == smp_processor_id())
                __send_cleanup_vector(apicd);
 }
 
-void irq_complete_move(struct irq_cfg *cfg)
-{
-       __irq_complete_move(cfg, ~get_irq_regs()->orig_ax);
-}
-
 /*
  * Called from fixup_irqs() with @desc->lock held and interrupts disabled.
  */
index c7503be92f35936d6d9b66ac310f22e9b12d7a41..57074cf3ad7c1a28dc1abf453920461c2eea9b66 100644 (file)
@@ -248,7 +248,7 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
        switch (leaf) {
        case 1:
                l1 = &l1i;
-               /* fall through */
+               fallthrough;
        case 0:
                if (!l1->val)
                        return;
index 7843ab3fde099d58c88a11a1c7fbcde9b9929795..3a44346f2276601a06d9aa5a5aae4b78c48b2418 100644 (file)
@@ -199,7 +199,7 @@ static int raise_local(void)
                         * calling irq_enter, but the necessary
                         * machinery isn't exported currently.
                         */
-                       /*FALL THROUGH*/
+                       fallthrough;
                case MCJ_CTX_PROCESS:
                        raise_exception(m, NULL);
                        break;
index d8f9230d2034132ea6b026153841722e67766a70..abe9fe0fb8517ce9b1af73740684708a83f07829 100644 (file)
@@ -193,7 +193,7 @@ unsigned long cmci_intel_adjust_timer(unsigned long interval)
                if (!atomic_sub_return(1, &cmci_storm_on_cpus))
                        pr_notice("CMCI storm subsided: switching to interrupt mode\n");
 
-               /* FALLTHROUGH */
+               fallthrough;
 
        case CMCI_STORM_SUBSIDED:
                /*
index 72182809b3339bc610c5c1fa23633ee236d66359..ca670919b56180e8c390bc471608fdcd5dc14721 100644 (file)
@@ -98,7 +98,7 @@ cyrix_get_free_region(unsigned long base, unsigned long size, int replace_reg)
        case 7:
                if (size < 0x40)
                        break;
-               /* Else, fall through */
+               fallthrough;
        case 6:
        case 5:
        case 4:
index 8cdf29ffd95f170b5aa959817dd7af12c00216d9..b98ff620ba77250164c689fe2cc5c7727bbf25b9 100644 (file)
@@ -349,7 +349,7 @@ static int arch_build_bp_info(struct perf_event *bp,
                        hw->len = X86_BREAKPOINT_LEN_X;
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index 181060247e3cb75789d7522b0b0be0d6483c3596..c5dd50369e2f3394bc483b8744ace94eaaea552b 100644 (file)
@@ -227,7 +227,7 @@ static __always_inline void handle_irq(struct irq_desc *desc,
                                       struct pt_regs *regs)
 {
        if (IS_ENABLED(CONFIG_X86_64))
-               run_on_irqstack_cond(desc->handle_irq, desc, regs);
+               run_irq_on_irqstack_cond(desc->handle_irq, desc, regs);
        else
                __handle_irq(desc, regs);
 }
index 1b4fe93a86c5ce90cdc2d636dba732e80649ddde..440eed558558d9891547ee1bd09a4570bc398156 100644 (file)
@@ -74,5 +74,5 @@ int irq_init_percpu_irqstack(unsigned int cpu)
 
 void do_softirq_own_stack(void)
 {
-       run_on_irqstack_cond(__do_softirq, NULL, NULL);
+       run_on_irqstack_cond(__do_softirq, NULL);
 }
index 68acd30c6b878bacb65244c0edb1e3ddbdde52c0..c2f02f308ecfc2c045bde69bd8cfe7545d3294aa 100644 (file)
@@ -450,7 +450,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                ptr = &remcomInBuffer[1];
                if (kgdb_hex2long(&ptr, &addr))
                        linux_regs->ip = addr;
-               /* fall through */
+               fallthrough;
        case 'D':
        case 'k':
                /* clear the trace bit */
@@ -539,7 +539,7 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
                         * a system call which should be ignored
                         */
                        return NOTIFY_DONE;
-               /* fall through */
+               fallthrough;
        default:
                if (user_mode(regs))
                        return NOTIFY_DONE;
index 08320b0b2b276f0ceb82e28b07812d12dfdd0465..9663ba31347c20141e4d1806731f2e8512239c52 100644 (file)
@@ -270,9 +270,8 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_kvm_asyncpf_interrupt)
 {
        struct pt_regs *old_regs = set_irq_regs(regs);
        u32 token;
-       irqentry_state_t state;
 
-       state = irqentry_enter(regs);
+       ack_APIC_irq();
 
        inc_irq_stat(irq_hv_callback_count);
 
@@ -283,7 +282,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_kvm_asyncpf_interrupt)
                wrmsrl(MSR_KVM_ASYNC_PF_ACK, 1);
        }
 
-       irqentry_exit(regs, state);
        set_irq_regs(old_regs);
 }
 
index 411af4aa7b51f3de393c9efa04be95697838734b..baa21090c9be31733be4b8cc175565dd82206ef3 100644 (file)
@@ -312,7 +312,7 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type)
                case 2:
                        if (i == 0 || i == 13)
                                continue;       /* IRQ0 & IRQ13 not connected */
-                       /* fall through */
+                       fallthrough;
                default:
                        if (i == 2)
                                continue;       /* IRQ2 is never connected */
@@ -356,7 +356,7 @@ static void __init construct_ioapic_table(int mpc_default_type)
        default:
                pr_err("???\nUnknown standard configuration %d\n",
                       mpc_default_type);
-               /* fall through */
+               fallthrough;
        case 1:
        case 5:
                memcpy(bus.bustype, "ISA   ", 6);
index 994d8393f2f7b078b7e5f4c0111d06e01ccae994..ba4593a913fab3dc6f5b136470c07c02699aeefd 100644 (file)
@@ -42,6 +42,7 @@
 #include <asm/spec-ctrl.h>
 #include <asm/io_bitmap.h>
 #include <asm/proto.h>
+#include <asm/frame.h>
 
 #include "process.h"
 
@@ -133,7 +134,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg,
        fork_frame = container_of(childregs, struct fork_frame, regs);
        frame = &fork_frame->frame;
 
-       frame->bp = 0;
+       frame->bp = encode_frame_pointer(childregs);
        frame->ret_addr = (unsigned long) ret_from_fork;
        p->thread.sp = (unsigned long) fork_frame;
        p->thread.io_bitmap = NULL;
@@ -684,9 +685,7 @@ void arch_cpu_idle(void)
  */
 void __cpuidle default_idle(void)
 {
-       trace_cpu_idle_rcuidle(1, smp_processor_id());
        safe_halt();
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 }
 #if defined(CONFIG_APM_MODULE) || defined(CONFIG_HALTPOLL_CPUIDLE_MODULE)
 EXPORT_SYMBOL(default_idle);
@@ -792,7 +791,6 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c)
 static __cpuidle void mwait_idle(void)
 {
        if (!current_set_polling_and_test()) {
-               trace_cpu_idle_rcuidle(1, smp_processor_id());
                if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) {
                        mb(); /* quirk */
                        clflush((void *)&current_thread_info()->flags);
@@ -804,7 +802,6 @@ static __cpuidle void mwait_idle(void)
                        __sti_mwait(0, 0);
                else
                        local_irq_enable();
-               trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
        } else {
                local_irq_enable();
        }
index 5679aa3fdcb87be4c504c3cbe9bc08c55509402b..e7537c5440bbac1cdf31ddd42bfb36055d16b33f 100644 (file)
@@ -204,7 +204,7 @@ static int set_segment_reg(struct task_struct *task,
        case offsetof(struct user_regs_struct, ss):
                if (unlikely(value == 0))
                        return -EIO;
-               /* Else, fall through */
+               fallthrough;
 
        default:
                *pt_regs_access(task_pt_regs(task), offset) = value;
index 0ec7ced727fe859f7c6cd616348bfca6e156b1cb..a515e2d230b7564ae94b3cea11f6cca63318a91e 100644 (file)
@@ -654,7 +654,7 @@ static void native_machine_emergency_restart(void)
 
                case BOOT_CF9_FORCE:
                        port_cf9_safe = true;
-                       /* Fall through */
+                       fallthrough;
 
                case BOOT_CF9_SAFE:
                        if (port_cf9_safe) {
index d5fa494c2304de8f92b8dc04ed426faea9ab8702..be0d7d4152eca4302535369110e373c1486c78bf 100644 (file)
@@ -726,7 +726,7 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
                                regs->ax = -EINTR;
                                break;
                        }
-               /* fallthrough */
+                       fallthrough;
                case -ERESTARTNOINTR:
                        regs->ax = regs->orig_ax;
                        regs->ip -= 2;
index 27aa04a9570211c0d89e4d7a3112b65c286198dc..f5ef689dd62ad743e18a9159206eb8ce15a13803 100644 (file)
@@ -1594,14 +1594,28 @@ int native_cpu_disable(void)
        if (ret)
                return ret;
 
-       /*
-        * Disable the local APIC. Otherwise IPI broadcasts will reach
-        * it. It still responds normally to INIT, NMI, SMI, and SIPI
-        * messages.
-        */
-       apic_soft_disable();
        cpu_disable_common();
 
+        /*
+         * Disable the local APIC. Otherwise IPI broadcasts will reach
+         * it. It still responds normally to INIT, NMI, SMI, and SIPI
+         * messages.
+         *
+         * Disabling the APIC must happen after cpu_disable_common()
+         * which invokes fixup_irqs().
+         *
+         * Disabling the APIC preserves already set bits in IRR, but
+         * an interrupt arriving after disabling the local APIC does not
+         * set the corresponding IRR bit.
+         *
+         * fixup_irqs() scans IRR for set bits so it can raise a not
+         * yet handled interrupt on the new destination CPU via an IPI
+         * but obviously it can't do so for IRR bits which are not set.
+         * IOW, interrupts arriving after disabling the local APIC will
+         * be lost.
+         */
+       apic_soft_disable();
+
        return 0;
 }
 
index 1f66d2d1e998db62758fb03e1b64d5c1ae05f081..81a2fb711091c9ee4829dfb753eacd8d40cc4bf1 100644 (file)
@@ -729,20 +729,9 @@ static bool is_sysenter_singlestep(struct pt_regs *regs)
 #endif
 }
 
-static __always_inline void debug_enter(unsigned long *dr6, unsigned long *dr7)
+static __always_inline unsigned long debug_read_clear_dr6(void)
 {
-       /*
-        * Disable breakpoints during exception handling; recursive exceptions
-        * are exceedingly 'fun'.
-        *
-        * Since this function is NOKPROBE, and that also applies to
-        * HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a
-        * HW_BREAKPOINT_W on our stack)
-        *
-        * Entry text is excluded for HW_BP_X and cpu_entry_area, which
-        * includes the entry stack is excluded for everything.
-        */
-       *dr7 = local_db_save();
+       unsigned long dr6;
 
        /*
         * The Intel SDM says:
@@ -755,15 +744,12 @@ static __always_inline void debug_enter(unsigned long *dr6, unsigned long *dr7)
         *
         * Keep it simple: clear DR6 immediately.
         */
-       get_debugreg(*dr6, 6);
+       get_debugreg(dr6, 6);
        set_debugreg(0, 6);
        /* Filter out all the reserved bits which are preset to 1 */
-       *dr6 &= ~DR6_RESERVED;
-}
+       dr6 &= ~DR6_RESERVED;
 
-static __always_inline void debug_exit(unsigned long dr7)
-{
-       local_db_restore(dr7);
+       return dr6;
 }
 
 /*
@@ -863,6 +849,18 @@ out:
 static __always_inline void exc_debug_kernel(struct pt_regs *regs,
                                             unsigned long dr6)
 {
+       /*
+        * Disable breakpoints during exception handling; recursive exceptions
+        * are exceedingly 'fun'.
+        *
+        * Since this function is NOKPROBE, and that also applies to
+        * HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a
+        * HW_BREAKPOINT_W on our stack)
+        *
+        * Entry text is excluded for HW_BP_X and cpu_entry_area, which
+        * includes the entry stack is excluded for everything.
+        */
+       unsigned long dr7 = local_db_save();
        bool irq_state = idtentry_enter_nmi(regs);
        instrumentation_begin();
 
@@ -883,6 +881,8 @@ static __always_inline void exc_debug_kernel(struct pt_regs *regs,
 
        instrumentation_end();
        idtentry_exit_nmi(regs, irq_state);
+
+       local_db_restore(dr7);
 }
 
 static __always_inline void exc_debug_user(struct pt_regs *regs,
@@ -894,6 +894,15 @@ static __always_inline void exc_debug_user(struct pt_regs *regs,
         */
        WARN_ON_ONCE(!user_mode(regs));
 
+       /*
+        * NB: We can't easily clear DR7 here because
+        * idtentry_exit_to_usermode() can invoke ptrace, schedule, access
+        * user memory, etc.  This means that a recursive #DB is possible.  If
+        * this happens, that #DB will hit exc_debug_kernel() and clear DR7.
+        * Since we're not on the IST stack right now, everything will be
+        * fine.
+        */
+
        irqentry_enter_from_user_mode(regs);
        instrumentation_begin();
 
@@ -907,36 +916,24 @@ static __always_inline void exc_debug_user(struct pt_regs *regs,
 /* IST stack entry */
 DEFINE_IDTENTRY_DEBUG(exc_debug)
 {
-       unsigned long dr6, dr7;
-
-       debug_enter(&dr6, &dr7);
-       exc_debug_kernel(regs, dr6);
-       debug_exit(dr7);
+       exc_debug_kernel(regs, debug_read_clear_dr6());
 }
 
 /* User entry, runs on regular task stack */
 DEFINE_IDTENTRY_DEBUG_USER(exc_debug)
 {
-       unsigned long dr6, dr7;
-
-       debug_enter(&dr6, &dr7);
-       exc_debug_user(regs, dr6);
-       debug_exit(dr7);
+       exc_debug_user(regs, debug_read_clear_dr6());
 }
 #else
 /* 32 bit does not have separate entry points. */
 DEFINE_IDTENTRY_RAW(exc_debug)
 {
-       unsigned long dr6, dr7;
-
-       debug_enter(&dr6, &dr7);
+       unsigned long dr6 = debug_read_clear_dr6();
 
        if (user_mode(regs))
                exc_debug_user(regs, dr6);
        else
                exc_debug_kernel(regs, dr6);
-
-       debug_exit(dr7);
 }
 #endif
 
index 15e5aad8ac2c1dd2f3c26869234a17d3f26c243d..3fdaa042823d026366eaddcf95dc0f7de0775e89 100644 (file)
@@ -735,7 +735,7 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
                 * OPCODE1() of the "short" jmp which checks the same condition.
                 */
                opc1 = OPCODE2(insn) - 0x10;
-               /* fall through */
+               fallthrough;
        default:
                if (!is_cond_jmp_opcode(opc1))
                        return -ENOSYS;
@@ -892,7 +892,7 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
                        fix_ip_or_call = 0;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                riprel_analyze(auprobe, &insn);
        }
index d0e2825ae6174c1e172ec522b5fb900a06a3064e..2f6510de6b0c037ae969aa8f992b5814be694127 100644 (file)
@@ -2505,9 +2505,14 @@ static int rsm_load_state_32(struct x86_emulate_ctxt *ctxt,
                *reg_write(ctxt, i) = GET_SMSTATE(u32, smstate, 0x7fd0 + i * 4);
 
        val = GET_SMSTATE(u32, smstate, 0x7fcc);
-       ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1);
+
+       if (ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1))
+               return X86EMUL_UNHANDLEABLE;
+
        val = GET_SMSTATE(u32, smstate, 0x7fc8);
-       ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1);
+
+       if (ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1))
+               return X86EMUL_UNHANDLEABLE;
 
        selector =                 GET_SMSTATE(u32, smstate, 0x7fc4);
        set_desc_base(&desc,       GET_SMSTATE(u32, smstate, 0x7f64));
@@ -2560,16 +2565,23 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt,
        ctxt->eflags = GET_SMSTATE(u32, smstate, 0x7f70) | X86_EFLAGS_FIXED;
 
        val = GET_SMSTATE(u32, smstate, 0x7f68);
-       ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1);
+
+       if (ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1))
+               return X86EMUL_UNHANDLEABLE;
+
        val = GET_SMSTATE(u32, smstate, 0x7f60);
-       ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1);
+
+       if (ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1))
+               return X86EMUL_UNHANDLEABLE;
 
        cr0 =                       GET_SMSTATE(u64, smstate, 0x7f58);
        cr3 =                       GET_SMSTATE(u64, smstate, 0x7f50);
        cr4 =                       GET_SMSTATE(u64, smstate, 0x7f48);
        ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smstate, 0x7f00));
        val =                       GET_SMSTATE(u64, smstate, 0x7ed0);
-       ctxt->ops->set_msr(ctxt, MSR_EFER, val & ~EFER_LMA);
+
+       if (ctxt->ops->set_msr(ctxt, MSR_EFER, val & ~EFER_LMA))
+               return X86EMUL_UNHANDLEABLE;
 
        selector =                  GET_SMSTATE(u32, smstate, 0x7e90);
        rsm_set_desc_flags(&desc,   GET_SMSTATE(u32, smstate, 0x7e92) << 8);
@@ -3016,7 +3028,7 @@ static void string_registers_quirk(struct x86_emulate_ctxt *ctxt)
        case 0xa4:      /* movsb */
        case 0xa5:      /* movsd/w */
                *reg_rmw(ctxt, VCPU_REGS_RSI) &= (u32)-1;
-               /* fall through */
+               fallthrough;
        case 0xaa:      /* stosb */
        case 0xab:      /* stosd/w */
                *reg_rmw(ctxt, VCPU_REGS_RDI) &= (u32)-1;
index 814d3aee5ceff10b2ac1d16bfaeebd40c9c75983..1d330564eed8ca2bf5995f587dc2f9d4a2caf2d4 100644 (file)
@@ -1779,7 +1779,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
                ret = kvm_hvcall_signal_event(vcpu, fast, ingpa);
                if (ret != HV_STATUS_INVALID_PORT_ID)
                        break;
-               /* fall through - maybe userspace knows this conn_id. */
+               fallthrough;    /* maybe userspace knows this conn_id */
        case HVCALL_POST_MESSAGE:
                /* don't bother userspace if it has no way to handle it */
                if (unlikely(rep || !vcpu_to_synic(vcpu)->active)) {
index c47d2acec52934eae639a8c4b347fbfa660caca6..4aa1c2e00e2abb76ac57e1b2fdc495539b5e5d69 100644 (file)
@@ -285,7 +285,7 @@ int kvm_set_routing_entry(struct kvm *kvm,
                switch (ue->u.irqchip.irqchip) {
                case KVM_IRQCHIP_PIC_SLAVE:
                        e->irqchip.pin += PIC_NUM_PINS / 2;
-                       /* fall through */
+                       fallthrough;
                case KVM_IRQCHIP_PIC_MASTER:
                        if (ue->u.irqchip.pin >= PIC_NUM_PINS / 2)
                                return -EINVAL;
index 5ccbee7165a215f31744073adcb74364939a956d..35cca2e0c802691c8e5c0028393bd22380a299a3 100644 (file)
@@ -1053,7 +1053,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
        switch (delivery_mode) {
        case APIC_DM_LOWEST:
                vcpu->arch.apic_arb_prio++;
-               /* fall through */
+               fallthrough;
        case APIC_DM_FIXED:
                if (unlikely(trig_mode && !level))
                        break;
@@ -1341,7 +1341,7 @@ static u32 __apic_read(struct kvm_lapic *apic, unsigned int offset)
                break;
        case APIC_TASKPRI:
                report_tpr_access(apic, false);
-               /* fall thru */
+               fallthrough;
        default:
                val = kvm_lapic_get_reg(apic, offset);
                break;
@@ -2027,7 +2027,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
 
        case APIC_LVT0:
                apic_manage_nmi_watchdog(apic, val);
-               /* fall through */
+               fallthrough;
        case APIC_LVTTHMR:
        case APIC_LVTPC:
        case APIC_LVT1:
index a5d0207e71897aa04f109f30ea84ed8ce0a24d17..71aa3da2a0b7b015ad091e7b229c4dc0a20182c4 100644 (file)
@@ -2469,7 +2469,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
                }
 
                if (sp->unsync_children)
-                       kvm_make_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu);
+                       kvm_make_request(KVM_REQ_MMU_SYNC, vcpu);
 
                __clear_sp_write_flooding_count(sp);
 
@@ -4422,7 +4422,7 @@ __reset_rsvds_bits_mask(struct kvm_vcpu *vcpu,
                        rsvd_bits(maxphyaddr, 51);
                rsvd_check->rsvd_bits_mask[1][4] =
                        rsvd_check->rsvd_bits_mask[0][4];
-               /* fall through */
+               fallthrough;
        case PT64_ROOT_4LEVEL:
                rsvd_check->rsvd_bits_mask[0][3] = exb_bit_rsvd |
                        nonleaf_bit8_rsvd | rsvd_bits(7, 7) |
index fb68467e60496aa5bc2abd2f8fa5dfd85e257ebd..e90bc436f5849b3bbe4727a5cd6e59d5b687c8d1 100644 (file)
@@ -586,7 +586,6 @@ int nested_svm_vmexit(struct vcpu_svm *svm)
        svm->vcpu.arch.mp_state = KVM_MP_STATE_RUNNABLE;
 
        /* Give the current vmcb to the guest */
-       svm_set_gif(svm, false);
 
        nested_vmcb->save.es     = vmcb->save.es;
        nested_vmcb->save.cs     = vmcb->save.cs;
@@ -632,6 +631,9 @@ int nested_svm_vmexit(struct vcpu_svm *svm)
        /* Restore the original control entries */
        copy_vmcb_control_area(&vmcb->control, &hsave->control);
 
+       /* On vmexit the  GIF is set to false */
+       svm_set_gif(svm, false);
+
        svm->vmcb->control.tsc_offset = svm->vcpu.arch.tsc_offset =
                svm->vcpu.arch.l1_tsc_offset;
 
@@ -1132,6 +1134,9 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
        load_nested_vmcb_control(svm, &ctl);
        nested_prepare_vmcb_control(svm);
 
+       if (!nested_svm_vmrun_msrpm(svm))
+               return -EINVAL;
+
 out_set_gif:
        svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET));
        return 0;
index 402dc4234e397861daef0be131a61118c8f2681a..7bf7bf734979488ac0f1cf10808f32ce3be882a9 100644 (file)
@@ -1106,6 +1106,7 @@ void sev_vm_destroy(struct kvm *kvm)
                list_for_each_safe(pos, q, head) {
                        __unregister_enc_region_locked(kvm,
                                list_entry(pos, struct enc_region, list));
+                       cond_resched();
                }
        }
 
index 03dd7bac80348857b378be2edff0382302ed6e2a..91ea74ae71b85dee975a3414ec261351c64c3b76 100644 (file)
@@ -2183,6 +2183,12 @@ static int iret_interception(struct vcpu_svm *svm)
        return 1;
 }
 
+static int invd_interception(struct vcpu_svm *svm)
+{
+       /* Treat an INVD instruction as a NOP and just skip it. */
+       return kvm_skip_emulated_instruction(&svm->vcpu);
+}
+
 static int invlpg_interception(struct vcpu_svm *svm)
 {
        if (!static_cpu_has(X86_FEATURE_DECODEASSISTS))
@@ -2668,7 +2674,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
        case MSR_IA32_APICBASE:
                if (kvm_vcpu_apicv_active(vcpu))
                        avic_update_vapic_bar(to_svm(vcpu), data);
-               /* Fall through */
+               fallthrough;
        default:
                return kvm_set_msr_common(vcpu, msr);
        }
@@ -2774,7 +2780,7 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = {
        [SVM_EXIT_RDPMC]                        = rdpmc_interception,
        [SVM_EXIT_CPUID]                        = cpuid_interception,
        [SVM_EXIT_IRET]                         = iret_interception,
-       [SVM_EXIT_INVD]                         = emulate_on_interception,
+       [SVM_EXIT_INVD]                         = invd_interception,
        [SVM_EXIT_PAUSE]                        = pause_interception,
        [SVM_EXIT_HLT]                          = halt_interception,
        [SVM_EXIT_INVLPG]                       = invlpg_interception,
@@ -2938,8 +2944,6 @@ static int handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
        if (npt_enabled)
                vcpu->arch.cr3 = svm->vmcb->save.cr3;
 
-       svm_complete_interrupts(svm);
-
        if (is_guest_mode(vcpu)) {
                int vmexit;
 
@@ -3504,7 +3508,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu)
        stgi();
 
        /* Any pending NMI will happen here */
-       exit_fastpath = svm_exit_handlers_fastpath(vcpu);
 
        if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI))
                kvm_after_interrupt(&svm->vcpu);
@@ -3518,6 +3521,7 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu)
        }
 
        svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING;
+       vmcb_mark_all_clean(svm->vmcb);
 
        /* if exit due to PF check for async PF */
        if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR)
@@ -3537,7 +3541,8 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu)
                     SVM_EXIT_EXCP_BASE + MC_VECTOR))
                svm_handle_mce(svm);
 
-       vmcb_mark_all_clean(svm->vmcb);
+       svm_complete_interrupts(svm);
+       exit_fastpath = svm_exit_handlers_fastpath(vcpu);
        return exit_fastpath;
 }
 
@@ -3900,21 +3905,28 @@ static int svm_pre_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
 static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
 {
        struct vcpu_svm *svm = to_svm(vcpu);
-       struct vmcb *nested_vmcb;
        struct kvm_host_map map;
-       u64 guest;
-       u64 vmcb;
        int ret = 0;
 
-       guest = GET_SMSTATE(u64, smstate, 0x7ed8);
-       vmcb = GET_SMSTATE(u64, smstate, 0x7ee0);
+       if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) {
+               u64 saved_efer = GET_SMSTATE(u64, smstate, 0x7ed0);
+               u64 guest = GET_SMSTATE(u64, smstate, 0x7ed8);
+               u64 vmcb = GET_SMSTATE(u64, smstate, 0x7ee0);
 
-       if (guest) {
-               if (kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb), &map) == -EINVAL)
-                       return 1;
-               nested_vmcb = map.hva;
-               ret = enter_svm_guest_mode(svm, vmcb, nested_vmcb);
-               kvm_vcpu_unmap(&svm->vcpu, &map, true);
+               if (guest) {
+                       if (!guest_cpuid_has(vcpu, X86_FEATURE_SVM))
+                               return 1;
+
+                       if (!(saved_efer & EFER_SVME))
+                               return 1;
+
+                       if (kvm_vcpu_map(&svm->vcpu,
+                                        gpa_to_gfn(vmcb), &map) == -EINVAL)
+                               return 1;
+
+                       ret = enter_svm_guest_mode(svm, vmcb, map.hva);
+                       kvm_vcpu_unmap(&svm->vcpu, &map, true);
+               }
        }
 
        return ret;
index 23b58c28a1c926f461cb87c9ee1f03a310f23e25..1bb6b31eb64666d57eb5095566f5579b1d26694c 100644 (file)
@@ -4404,6 +4404,14 @@ void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 vm_exit_reason,
        if (kvm_check_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu))
                kvm_vcpu_flush_tlb_current(vcpu);
 
+       /*
+        * VCPU_EXREG_PDPTR will be clobbered in arch/x86/kvm/vmx/vmx.h between
+        * now and the new vmentry.  Ensure that the VMCS02 PDPTR fields are
+        * up-to-date before switching to L1.
+        */
+       if (enable_ept && is_pae_paging(vcpu))
+               vmx_ept_load_pdptrs(vcpu);
+
        leave_guest_mode(vcpu);
 
        if (nested_cpu_has_preemption_timer(vmcs12))
@@ -4668,7 +4676,7 @@ void nested_vmx_pmu_entry_exit_ctls_update(struct kvm_vcpu *vcpu)
                vmx->nested.msrs.entry_ctls_high &=
                                ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL;
                vmx->nested.msrs.exit_ctls_high &=
-                               ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL;
+                               ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL;
        }
 }
 
index 46ba2e03a8926d7a3d47463b5661ecd857aa76fb..7b2a068f08c1d34ab1f7e22b1894f4424e21ee28 100644 (file)
@@ -129,6 +129,9 @@ static bool __read_mostly enable_preemption_timer = 1;
 module_param_named(preemption_timer, enable_preemption_timer, bool, S_IRUGO);
 #endif
 
+extern bool __read_mostly allow_smaller_maxphyaddr;
+module_param(allow_smaller_maxphyaddr, bool, S_IRUGO);
+
 #define KVM_VM_CR0_ALWAYS_OFF (X86_CR0_NW | X86_CR0_CD)
 #define KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST X86_CR0_NE
 #define KVM_VM_CR0_ALWAYS_ON                           \
@@ -2971,7 +2974,7 @@ static void vmx_flush_tlb_guest(struct kvm_vcpu *vcpu)
        vpid_sync_context(to_vmx(vcpu)->vpid);
 }
 
-static void ept_load_pdptrs(struct kvm_vcpu *vcpu)
+void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu)
 {
        struct kvm_mmu *mmu = vcpu->arch.walk_mmu;
 
@@ -3114,7 +3117,7 @@ static void vmx_load_mmu_pgd(struct kvm_vcpu *vcpu, unsigned long pgd,
                        guest_cr3 = vcpu->arch.cr3;
                else /* vmcs01.GUEST_CR3 is already up-to-date. */
                        update_guest_cr3 = false;
-               ept_load_pdptrs(vcpu);
+               vmx_ept_load_pdptrs(vcpu);
        } else {
                guest_cr3 = pgd;
        }
@@ -4654,7 +4657,7 @@ static bool rmode_exception(struct kvm_vcpu *vcpu, int vec)
                        vmcs_read32(VM_EXIT_INSTRUCTION_LEN);
                if (vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP)
                        return false;
-               /* fall through */
+               fallthrough;
        case DB_VECTOR:
                return !(vcpu->guest_debug &
                        (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP));
@@ -4803,6 +4806,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
                         * EPT will cause page fault only if we need to
                         * detect illegal GPAs.
                         */
+                       WARN_ON_ONCE(!allow_smaller_maxphyaddr);
                        kvm_fixup_and_inject_pf_error(vcpu, cr2, error_code);
                        return 1;
                } else
@@ -4827,7 +4831,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
                }
                kvm_run->debug.arch.dr6 = dr6 | DR6_FIXED_1 | DR6_RTM;
                kvm_run->debug.arch.dr7 = vmcs_readl(GUEST_DR7);
-               /* fall through */
+               fallthrough;
        case BP_VECTOR:
                /*
                 * Update instruction length as we may reinject #BP from
@@ -5257,7 +5261,7 @@ static int handle_task_switch(struct kvm_vcpu *vcpu)
                                error_code =
                                        vmcs_read32(IDT_VECTORING_ERROR_CODE);
                        }
-                       /* fall through */
+                       fallthrough;
                case INTR_TYPE_SOFT_EXCEPTION:
                        kvm_clear_exception_queue(vcpu);
                        break;
@@ -5331,7 +5335,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
         * would also use advanced VM-exit information for EPT violations to
         * reconstruct the page fault error code.
         */
-       if (unlikely(kvm_mmu_is_illegal_gpa(vcpu, gpa)))
+       if (unlikely(allow_smaller_maxphyaddr && kvm_mmu_is_illegal_gpa(vcpu, gpa)))
                return kvm_emulate_instruction(vcpu, 0);
 
        return kvm_mmu_page_fault(vcpu, gpa, error_code, NULL, 0);
@@ -5610,7 +5614,7 @@ static int handle_invpcid(struct kvm_vcpu *vcpu)
                 * keeping track of global entries in shadow page tables.
                 */
 
-               /* fall-through */
+               fallthrough;
        case INVPCID_TYPE_ALL_INCL_GLOBAL:
                kvm_mmu_unload(vcpu);
                return kvm_skip_emulated_instruction(vcpu);
@@ -6054,6 +6058,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
                        (exit_reason != EXIT_REASON_EXCEPTION_NMI &&
                        exit_reason != EXIT_REASON_EPT_VIOLATION &&
                        exit_reason != EXIT_REASON_PML_FULL &&
+                       exit_reason != EXIT_REASON_APIC_ACCESS &&
                        exit_reason != EXIT_REASON_TASK_SWITCH)) {
                vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
                vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV;
@@ -6578,7 +6583,7 @@ static void __vmx_complete_interrupts(struct kvm_vcpu *vcpu,
                break;
        case INTR_TYPE_SOFT_EXCEPTION:
                vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field);
-               /* fall through */
+               fallthrough;
        case INTR_TYPE_HARD_EXCEPTION:
                if (idt_vectoring_info & VECTORING_INFO_DELIVER_CODE_MASK) {
                        u32 err = vmcs_read32(error_code_field);
@@ -6588,7 +6593,7 @@ static void __vmx_complete_interrupts(struct kvm_vcpu *vcpu,
                break;
        case INTR_TYPE_SOFT_INTR:
                vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field);
-               /* fall through */
+               fallthrough;
        case INTR_TYPE_EXT_INTR:
                kvm_queue_interrupt(vcpu, vector, type == INTR_TYPE_SOFT_INTR);
                break;
@@ -8304,11 +8309,12 @@ static int __init vmx_init(void)
        vmx_check_vmcs12_offsets();
 
        /*
-        * Intel processors don't have problems with
-        * GUEST_MAXPHYADDR < HOST_MAXPHYADDR so enable
-        * it for VMX by default
+        * Shadow paging doesn't have a (further) performance penalty
+        * from GUEST_MAXPHYADDR < HOST_MAXPHYADDR so enable it
+        * by default
         */
-       allow_smaller_maxphyaddr = true;
+       if (!enable_ept)
+               allow_smaller_maxphyaddr = true;
 
        return 0;
 }
index 26175a4759fa5f8eef34b443dcb3fd6415b4f6b6..a0e47720f60cdf4846c46ab10e700c828a5ffd4f 100644 (file)
@@ -356,6 +356,7 @@ void vmx_update_host_rsp(struct vcpu_vmx *vmx, unsigned long host_rsp);
 int vmx_find_msr_index(struct vmx_msrs *m, u32 msr);
 int vmx_handle_memory_failure(struct kvm_vcpu *vcpu, int r,
                              struct x86_exception *e);
+void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu);
 
 #define POSTED_INTR_ON  0
 #define POSTED_INTR_SN  1
@@ -551,7 +552,10 @@ static inline bool vmx_has_waitpkg(struct vcpu_vmx *vmx)
 
 static inline bool vmx_need_pf_intercept(struct kvm_vcpu *vcpu)
 {
-       return !enable_ept || cpuid_maxphyaddr(vcpu) < boot_cpu_data.x86_phys_bits;
+       if (!enable_ept)
+               return true;
+
+       return allow_smaller_maxphyaddr && cpuid_maxphyaddr(vcpu) < boot_cpu_data.x86_phys_bits;
 }
 
 void dump_vmcs(void);
index 33945283fe07ddddbf3c1eaf159c3b7d2a11b99f..ce856e0ece84491a8212466441dc6308950cad91 100644 (file)
@@ -188,7 +188,7 @@ static struct kvm_shared_msrs __percpu *shared_msrs;
 u64 __read_mostly host_efer;
 EXPORT_SYMBOL_GPL(host_efer);
 
-bool __read_mostly allow_smaller_maxphyaddr;
+bool __read_mostly allow_smaller_maxphyaddr = 0;
 EXPORT_SYMBOL_GPL(allow_smaller_maxphyaddr);
 
 static u64 __read_mostly host_xss;
@@ -976,6 +976,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
        unsigned long old_cr4 = kvm_read_cr4(vcpu);
        unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE |
                                   X86_CR4_SMEP;
+       unsigned long mmu_role_bits = pdptr_bits | X86_CR4_SMAP | X86_CR4_PKE;
 
        if (kvm_valid_cr4(vcpu, cr4))
                return 1;
@@ -1003,7 +1004,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
        if (kvm_x86_ops.set_cr4(vcpu, cr4))
                return 1;
 
-       if (((cr4 ^ old_cr4) & pdptr_bits) ||
+       if (((cr4 ^ old_cr4) & mmu_role_bits) ||
            (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE)))
                kvm_mmu_reset_context(vcpu);
 
@@ -1116,14 +1117,12 @@ static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val)
                        vcpu->arch.eff_db[dr] = val;
                break;
        case 4:
-               /* fall through */
        case 6:
                if (!kvm_dr6_valid(val))
                        return -1; /* #GP */
                vcpu->arch.dr6 = (val & DR6_VOLATILE) | kvm_dr6_fixed(vcpu);
                break;
        case 5:
-               /* fall through */
        default: /* 7 */
                if (!kvm_dr7_valid(val))
                        return -1; /* #GP */
@@ -1154,12 +1153,10 @@ int kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val)
                *val = vcpu->arch.db[array_index_nospec(dr, size)];
                break;
        case 4:
-               /* fall through */
        case 6:
                *val = vcpu->arch.dr6;
                break;
        case 5:
-               /* fall through */
        default: /* 7 */
                *val = vcpu->arch.dr7;
                break;
@@ -2735,7 +2732,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data)
                return 1;
 
        if (!lapic_in_kernel(vcpu))
-               return 1;
+               return data ? 1 : 0;
 
        vcpu->arch.apf.msr_en_val = data;
 
@@ -3051,7 +3048,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 
        case MSR_K7_PERFCTR0 ... MSR_K7_PERFCTR3:
        case MSR_P6_PERFCTR0 ... MSR_P6_PERFCTR1:
-               pr = true; /* fall through */
+               pr = true;
+               fallthrough;
        case MSR_K7_EVNTSEL0 ... MSR_K7_EVNTSEL3:
        case MSR_P6_EVNTSEL0 ... MSR_P6_EVNTSEL1:
                if (kvm_pmu_is_valid_msr(vcpu, msr))
@@ -3224,9 +3222,22 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
        case MSR_IA32_POWER_CTL:
                msr_info->data = vcpu->arch.msr_ia32_power_ctl;
                break;
-       case MSR_IA32_TSC:
-               msr_info->data = kvm_scale_tsc(vcpu, rdtsc()) + vcpu->arch.tsc_offset;
+       case MSR_IA32_TSC: {
+               /*
+                * Intel SDM states that MSR_IA32_TSC read adds the TSC offset
+                * even when not intercepted. AMD manual doesn't explicitly
+                * state this but appears to behave the same.
+                *
+                * On userspace reads and writes, however, we unconditionally
+                * operate L1's TSC value to ensure backwards-compatible
+                * behavior for migration.
+                */
+               u64 tsc_offset = msr_info->host_initiated ? vcpu->arch.l1_tsc_offset :
+                                                           vcpu->arch.tsc_offset;
+
+               msr_info->data = kvm_scale_tsc(vcpu, rdtsc()) + tsc_offset;
                break;
+       }
        case MSR_MTRRcap:
        case 0x200 ... 0x2ff:
                return kvm_mtrr_get_msr(vcpu, msr_info->index, &msr_info->data);
@@ -3581,6 +3592,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
        case KVM_CAP_SMALLER_MAXPHYADDR:
                r = (int) allow_smaller_maxphyaddr;
                break;
+       case KVM_CAP_STEAL_TIME:
+               r = sched_info_on();
+               break;
        default:
                break;
        }
@@ -4359,7 +4373,7 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
        case KVM_CAP_HYPERV_SYNIC2:
                if (cap->args[0])
                        return -EINVAL;
-               /* fall through */
+               fallthrough;
 
        case KVM_CAP_HYPERV_SYNIC:
                if (!irqchip_in_kernel(vcpu->kvm))
@@ -8672,7 +8686,7 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu)
                vcpu->arch.pv.pv_unhalted = false;
                vcpu->arch.mp_state =
                        KVM_MP_STATE_RUNNABLE;
-               /* fall through */
+               fallthrough;
        case KVM_MP_STATE_RUNNABLE:
                vcpu->arch.apf.halted = false;
                break;
index d46fff11f06fa36b402b87e378bbbea68345f5b2..aa067859a70b64c4ebeff1e279a9d3a4ee10cefc 100644 (file)
@@ -24,7 +24,7 @@ ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_cmdline.o = -pg
 endif
 
-CFLAGS_cmdline.o := -fno-stack-protector
+CFLAGS_cmdline.o := -fno-stack-protector -fno-jump-tables
 endif
 
 inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
index 4f1719e22d3cb47f6c4eab50d28fcdab866687ed..b6da0933930859d577db66b6ea3e0e061c0554d9 100644 (file)
@@ -58,7 +58,7 @@ __cmdline_find_option_bool(const char *cmdline, int max_cmdline_size,
                        state = st_wordcmp;
                        opptr = option;
                        wstart = pos;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordcmp:
                        if (!*opptr) {
@@ -89,7 +89,7 @@ __cmdline_find_option_bool(const char *cmdline, int max_cmdline_size,
                                break;
                        }
                        state = st_wordskip;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordskip:
                        if (!c)
@@ -151,7 +151,7 @@ __cmdline_find_option(const char *cmdline, int max_cmdline_size,
 
                        state = st_wordcmp;
                        opptr = option;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordcmp:
                        if ((c == '=') && !*opptr) {
@@ -172,7 +172,7 @@ __cmdline_find_option(const char *cmdline, int max_cmdline_size,
                                break;
                        }
                        state = st_wordskip;
-                       /* fall through */
+                       fallthrough;
 
                case st_wordskip:
                        if (myisspace(c))
index 31600d851fd8e3c327f524a87443debdee52be71..5e69603ff63ffa3c7e0de515d7de8a1f7a179bfd 100644 (file)
@@ -179,7 +179,7 @@ static int resolve_default_seg(struct insn *insn, struct pt_regs *regs, int off)
                if (insn->addr_bytes == 2)
                        return -EINVAL;
 
-               /* fall through */
+               fallthrough;
 
        case -EDOM:
        case offsetof(struct pt_regs, bx):
@@ -362,7 +362,6 @@ static short get_segment_selector(struct pt_regs *regs, int seg_reg_idx)
                case INAT_SEG_REG_GS:
                        return vm86regs->gs;
                case INAT_SEG_REG_IGNORE:
-                       /* fall through */
                default:
                        return -EINVAL;
                }
@@ -386,7 +385,6 @@ static short get_segment_selector(struct pt_regs *regs, int seg_reg_idx)
                 */
                return get_user_gs(regs);
        case INAT_SEG_REG_IGNORE:
-               /* fall through */
        default:
                return -EINVAL;
        }
@@ -786,7 +784,7 @@ int insn_get_code_seg_params(struct pt_regs *regs)
                 */
                return INSN_CODE_SEG_PARAMS(4, 8);
        case 3: /* Invalid setting. CS.L=1, CS.D=1 */
-               /* fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index b0dfac3d3df712e8db9b5ccf87287d0fb1ca244f..1847e993ac63a6b277d36d0f70455247d7bb81bc 100644 (file)
@@ -120,7 +120,7 @@ long __copy_user_flushcache(void *dst, const void __user *src, unsigned size)
         */
        if (size < 8) {
                if (!IS_ALIGNED(dest, 4) || size != 4)
-                       clean_cache_range(dst, 1);
+                       clean_cache_range(dst, size);
        } else {
                if (!IS_ALIGNED(dest, 8)) {
                        dest = ALIGN(dest, boot_cpu_data.x86_clflush_size);
index 73dc66d887f354a78d9e48efcee214be22cb866a..ec071cbb080432301b92e16ab4ff7249b0c960c1 100644 (file)
@@ -186,7 +186,7 @@ void FPU_printall(void)
                case TAG_Special:
                        /* Update tagi for the printk below */
                        tagi = FPU_Special(r);
-                       /* fall through */
+                       fallthrough;
                case TAG_Valid:
                        printk("st(%d)  %c .%04lx %04lx %04lx %04lx e%+-6d ", i,
                               getsign(r) ? '-' : '+',
index 127ea54122d75f48b97633cfa96b589ada8f5f19..4a9887851ad8ab05e11fb427df846721bd66ff43 100644 (file)
@@ -1352,7 +1352,7 @@ static void fyl2xp1(FPU_REG *st0_ptr, u_char st0_tag)
                case TW_Denormal:
                        if (denormal_operand() < 0)
                                return;
-                       /* fall through */
+                       fallthrough;
                case TAG_Zero:
                case TAG_Valid:
                        setsign(st0_ptr, getsign(st0_ptr) ^ getsign(st1_ptr));
index 35f1498e98324f50a8d6ca4f670a5e76470409a5..6e3e8a1249031193697833c3740f9749a9613d3f 100644 (file)
@@ -190,6 +190,53 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
        return pmd_k;
 }
 
+/*
+ *   Handle a fault on the vmalloc or module mapping area
+ *
+ *   This is needed because there is a race condition between the time
+ *   when the vmalloc mapping code updates the PMD to the point in time
+ *   where it synchronizes this update with the other page-tables in the
+ *   system.
+ *
+ *   In this race window another thread/CPU can map an area on the same
+ *   PMD, finds it already present and does not synchronize it with the
+ *   rest of the system yet. As a result v[mz]alloc might return areas
+ *   which are not mapped in every page-table in the system, causing an
+ *   unhandled page-fault when they are accessed.
+ */
+static noinline int vmalloc_fault(unsigned long address)
+{
+       unsigned long pgd_paddr;
+       pmd_t *pmd_k;
+       pte_t *pte_k;
+
+       /* Make sure we are in vmalloc area: */
+       if (!(address >= VMALLOC_START && address < VMALLOC_END))
+               return -1;
+
+       /*
+        * Synchronize this task's top level page-table
+        * with the 'reference' page table.
+        *
+        * Do _not_ use "current" here. We might be inside
+        * an interrupt in the middle of a task switch..
+        */
+       pgd_paddr = read_cr3_pa();
+       pmd_k = vmalloc_sync_one(__va(pgd_paddr), address);
+       if (!pmd_k)
+               return -1;
+
+       if (pmd_large(*pmd_k))
+               return 0;
+
+       pte_k = pte_offset_kernel(pmd_k, address);
+       if (!pte_present(*pte_k))
+               return -1;
+
+       return 0;
+}
+NOKPROBE_SYMBOL(vmalloc_fault);
+
 void arch_sync_kernel_mappings(unsigned long start, unsigned long end)
 {
        unsigned long addr;
@@ -1110,6 +1157,37 @@ do_kern_addr_fault(struct pt_regs *regs, unsigned long hw_error_code,
         */
        WARN_ON_ONCE(hw_error_code & X86_PF_PK);
 
+#ifdef CONFIG_X86_32
+       /*
+        * We can fault-in kernel-space virtual memory on-demand. The
+        * 'reference' page table is init_mm.pgd.
+        *
+        * NOTE! We MUST NOT take any locks for this case. We may
+        * be in an interrupt or a critical region, and should
+        * only copy the information from the master page table,
+        * nothing more.
+        *
+        * Before doing this on-demand faulting, ensure that the
+        * fault is not any of the following:
+        * 1. A fault on a PTE with a reserved bit set.
+        * 2. A fault caused by a user-mode access.  (Do not demand-
+        *    fault kernel memory due to user-mode accesses).
+        * 3. A fault caused by a page-level protection violation.
+        *    (A demand fault would be on a non-present page which
+        *     would have X86_PF_PROT==0).
+        *
+        * This is only needed to close a race condition on x86-32 in
+        * the vmalloc mapping/unmapping code. See the comment above
+        * vmalloc_fault() for details. On x86-64 the race does not
+        * exist as the vmalloc mappings don't need to be synchronized
+        * there.
+        */
+       if (!(hw_error_code & (X86_PF_RSVD | X86_PF_USER | X86_PF_PROT))) {
+               if (vmalloc_fault(address) >= 0)
+                       return;
+       }
+#endif
+
        /* Was the fault spurious, caused by lazy TLB invalidation? */
        if (spurious_kernel_fault(hw_error_code, address))
                return;
index 84d85dbd1dad6f430c9bf174146dd377cffe59c6..9e5ccc56f8e0775e5a3fda8661d44cd5d8f7a760 100644 (file)
@@ -574,7 +574,7 @@ static bool memremap_should_map_decrypted(resource_size_t phys_addr,
                /* For SEV, these areas are encrypted */
                if (sev_active())
                        break;
-               /* Fallthrough */
+               fallthrough;
 
        case E820_TYPE_PRAM:
                return true;
index c5174b4e318b4811ca22aefcd5bcb447bd4bc640..683cd12f4793890d1a71a4939065c6a467ff1d5b 100644 (file)
@@ -321,7 +321,7 @@ static int __init split_nodes_size_interleave(struct numa_meminfo *ei,
                                              u64 addr, u64 max_addr, u64 size)
 {
        return split_nodes_size_interleave_uniform(ei, pi, addr, max_addr, size,
-                       0, NULL, NUMA_NO_NODE);
+                       0, NULL, 0);
 }
 
 static int __init setup_emu2phys_nid(int *dfl_phys_nid)
index 1a3569b43aa5bd3b8abf96556bc068f44922dabf..0951b47e64c10b9923a02267041f270d525d50ed 100644 (file)
@@ -555,21 +555,12 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
                this_cpu_write(cpu_tlbstate.ctxs[new_asid].tlb_gen, next_tlb_gen);
                load_new_mm_cr3(next->pgd, new_asid, true);
 
-               /*
-                * NB: This gets called via leave_mm() in the idle path
-                * where RCU functions differently.  Tracing normally
-                * uses RCU, so we need to use the _rcuidle variant.
-                *
-                * (There is no good reason for this.  The idle code should
-                *  be rearranged to call this before rcu_idle_enter().)
-                */
-               trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
+               trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
        } else {
                /* The new ASID is already up to date. */
                load_new_mm_cr3(next->pgd, new_asid, false);
 
-               /* See above wrt _rcuidle. */
-               trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, 0);
+               trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, 0);
        }
 
        /* Make sure we write CR3 before loaded_mm. */
index 76cee341507b7330b3955bf71a2aa4be887d351b..b3b17d6c50f079997a84f673ffd53a6c641c5bc7 100644 (file)
@@ -448,7 +448,7 @@ static void do_signal(struct pt_regs *regs)
                                                regs->areg[2] = -EINTR;
                                                break;
                                        }
-                                       /* fallthrough */
+                                       fallthrough;
                                case -ERESTARTNOINTR:
                                        regs->areg[2] = regs->syscall;
                                        regs->pc -= 3;
index 2e5f5697db358a4efd1199c1e35a1806543a15f2..d39056630d9c1de07d3923daeb8b80e6ab6a086e 100644 (file)
@@ -525,7 +525,7 @@ ssize_t badblocks_store(struct badblocks *bb, const char *page, size_t len,
        case 3:
                if (newline != '\n')
                        return -EINVAL;
-               /* fall through */
+               fallthrough;
        case 2:
                if (length <= 0)
                        return -EINVAL;
index 68882b9b8f11fae420572eee256b3fd894258e7c..b791e2041e49b3bbdf1c3e41fc8ea1fb589e647a 100644 (file)
@@ -332,7 +332,7 @@ static void bfqg_put(struct bfq_group *bfqg)
                kfree(bfqg);
 }
 
-void bfqg_and_blkg_get(struct bfq_group *bfqg)
+static void bfqg_and_blkg_get(struct bfq_group *bfqg)
 {
        /* see comments in bfq_bic_update_cgroup for why refcounting bfqg */
        bfqg_get(bfqg);
index a4c0bec920cbde6bef9f61909efc353937de85d4..fa98470df3f0a35c61b453cf094f62f95d87a9d9 100644 (file)
@@ -4980,7 +4980,7 @@ bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic)
                pr_err("bdi %s: bfq: bad prio class %d\n",
                                bdi_dev_name(bfqq->bfqd->queue->backing_dev_info),
                                ioprio_class);
-               /* fall through */
+               fallthrough;
        case IOPRIO_CLASS_NONE:
                /*
                 * No prio set, inherit CPU scheduling settings.
@@ -5112,7 +5112,7 @@ static struct bfq_queue **bfq_async_queue_prio(struct bfq_data *bfqd,
                return &bfqg->async_bfqq[0][ioprio];
        case IOPRIO_CLASS_NONE:
                ioprio = IOPRIO_NORM;
-               /* fall through */
+               fallthrough;
        case IOPRIO_CLASS_BE:
                return &bfqg->async_bfqq[1][ioprio];
        case IOPRIO_CLASS_IDLE:
@@ -5895,18 +5895,6 @@ static void bfq_finish_requeue_request(struct request *rq)
        struct bfq_queue *bfqq = RQ_BFQQ(rq);
        struct bfq_data *bfqd;
 
-       /*
-        * Requeue and finish hooks are invoked in blk-mq without
-        * checking whether the involved request is actually still
-        * referenced in the scheduler. To handle this fact, the
-        * following two checks make this function exit in case of
-        * spurious invocations, for which there is nothing to do.
-        *
-        * First, check whether rq has nothing to do with an elevator.
-        */
-       if (unlikely(!(rq->rq_flags & RQF_ELVPRIV)))
-               return;
-
        /*
         * rq either is not associated with any icq, or is an already
         * requeued request that has not (yet) been re-inserted into
index cd224aaf9f52a541e8851b5f7cb92c7008b3bcf1..703895224562c69097d0968643c851bfdbf953eb 100644 (file)
@@ -986,7 +986,6 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
 struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg);
 struct bfq_group *bfqq_group(struct bfq_queue *bfqq);
 struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node);
-void bfqg_and_blkg_get(struct bfq_group *bfqg);
 void bfqg_and_blkg_put(struct bfq_group *bfqg);
 
 #ifdef CONFIG_BFQ_GROUP_IOSCHED
index eb0e2a6daabe63f30be59394f73e201e05f59488..26776bdbdf360c97635c6fb197b0b3c497689f2e 100644 (file)
@@ -533,9 +533,7 @@ static void bfq_get_entity(struct bfq_entity *entity)
                bfqq->ref++;
                bfq_log_bfqq(bfqq->bfqd, bfqq, "get_entity: %p %d",
                             bfqq, bfqq->ref);
-       } else
-               bfqg_and_blkg_get(container_of(entity, struct bfq_group,
-                                              entity));
+       }
 }
 
 /**
@@ -649,14 +647,8 @@ static void bfq_forget_entity(struct bfq_service_tree *st,
 
        entity->on_st_or_in_serv = false;
        st->wsum -= entity->weight;
-       if (is_in_service)
-               return;
-
-       if (bfqq)
+       if (bfqq && !is_in_service)
                bfq_put_queue(bfqq);
-       else
-               bfqg_and_blkg_put(container_of(entity, struct bfq_group,
-                                              entity));
 }
 
 /**
index c63ba04bd629675cf272523bb6ee1fc8052005bf..e865ea55b9f9a25e1d48bc6cdcae67e26b9afd48 100644 (file)
@@ -740,8 +740,8 @@ static inline bool page_is_mergeable(const struct bio_vec *bv,
                struct page *page, unsigned int len, unsigned int off,
                bool *same_page)
 {
-       phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) +
-               bv->bv_offset + bv->bv_len - 1;
+       size_t bv_end = bv->bv_offset + bv->bv_len;
+       phys_addr_t vec_end_addr = page_to_phys(bv->bv_page) + bv_end - 1;
        phys_addr_t page_addr = page_to_phys(page);
 
        if (vec_end_addr + 1 != page_addr + off)
@@ -750,9 +750,9 @@ static inline bool page_is_mergeable(const struct bio_vec *bv,
                return false;
 
        *same_page = ((vec_end_addr & PAGE_MASK) == page_addr);
-       if (!*same_page && pfn_to_page(PFN_DOWN(vec_end_addr)) + 1 != page)
-               return false;
-       return true;
+       if (*same_page)
+               return true;
+       return (bv->bv_page + bv_end / PAGE_SIZE) == (page + off / PAGE_SIZE);
 }
 
 /*
@@ -879,8 +879,10 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page,
                struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1];
 
                if (page_is_mergeable(bv, page, len, off, same_page)) {
-                       if (bio->bi_iter.bi_size > UINT_MAX - len)
+                       if (bio->bi_iter.bi_size > UINT_MAX - len) {
+                               *same_page = false;
                                return false;
+                       }
                        bv->bv_len += len;
                        bio->bi_iter.bi_size += len;
                        return true;
index 619a79b51068cd8aa8fa2a5ba4142c9123de4c18..c195365c98172e133972ccb899433ba5a4ba81c8 100644 (file)
@@ -1152,13 +1152,15 @@ int blkcg_init_queue(struct request_queue *q)
        if (preloaded)
                radix_tree_preload_end();
 
-       ret = blk_iolatency_init(q);
+       ret = blk_throtl_init(q);
        if (ret)
                goto err_destroy_all;
 
-       ret = blk_throtl_init(q);
-       if (ret)
+       ret = blk_iolatency_init(q);
+       if (ret) {
+               blk_throtl_exit(q);
                goto err_destroy_all;
+       }
        return 0;
 
 err_destroy_all:
index d9d632639bd185ac2e5d93b71f247cef56e1b997..10c08ac506978852a1d1b0d66d3663f7adde1226 100644 (file)
@@ -539,6 +539,7 @@ struct request_queue *blk_alloc_queue(int node_id)
                goto fail_stats;
 
        q->backing_dev_info->ra_pages = VM_READAHEAD_PAGES;
+       q->backing_dev_info->io_pages = VM_READAHEAD_PAGES;
        q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK;
        q->node = node_id;
 
index 413e0b5c8e6b08cb9e76af181b267bbed84e8ead..d37b55db24099152594cdde3084fc78519c29060 100644 (file)
@@ -2092,14 +2092,15 @@ static void ioc_pd_free(struct blkg_policy_data *pd)
 {
        struct ioc_gq *iocg = pd_to_iocg(pd);
        struct ioc *ioc = iocg->ioc;
+       unsigned long flags;
 
        if (ioc) {
-               spin_lock(&ioc->lock);
+               spin_lock_irqsave(&ioc->lock, flags);
                if (!list_empty(&iocg->active_list)) {
                        propagate_active_weight(iocg, 0, 0);
                        list_del_init(&iocg->active_list);
                }
-               spin_unlock(&ioc->lock);
+               spin_unlock_irqrestore(&ioc->lock, flags);
 
                hrtimer_cancel(&iocg->waitq_timer);
                hrtimer_cancel(&iocg->delay_timer);
index 6529e3aab001184a92dc83fc29228149e5a3c00f..f685d633bcc9b0b409233c1ead8306b06209c456 100644 (file)
@@ -154,7 +154,7 @@ static inline unsigned get_max_io_size(struct request_queue *q,
        if (max_sectors > start_offset)
                return max_sectors - start_offset;
 
-       return sectors & (lbs - 1);
+       return sectors & ~(lbs - 1);
 }
 
 static inline unsigned get_max_segment_size(const struct request_queue *q,
@@ -533,10 +533,17 @@ int __blk_rq_map_sg(struct request_queue *q, struct request *rq,
 }
 EXPORT_SYMBOL(__blk_rq_map_sg);
 
+static inline unsigned int blk_rq_get_max_segments(struct request *rq)
+{
+       if (req_op(rq) == REQ_OP_DISCARD)
+               return queue_max_discard_segments(rq->q);
+       return queue_max_segments(rq->q);
+}
+
 static inline int ll_new_hw_segment(struct request *req, struct bio *bio,
                unsigned int nr_phys_segs)
 {
-       if (req->nr_phys_segments + nr_phys_segs > queue_max_segments(req->q))
+       if (req->nr_phys_segments + nr_phys_segs > blk_rq_get_max_segments(req))
                goto no_merge;
 
        if (blk_integrity_merge_bio(req->q, req, bio) == false)
@@ -624,7 +631,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
                return 0;
 
        total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
-       if (total_phys_segments > queue_max_segments(q))
+       if (total_phys_segments > blk_rq_get_max_segments(req))
                return 0;
 
        if (blk_integrity_merge_rq(q, req, next) == false)
index a19cdf159b7536a6a941effa75da65869da7b076..d2790e5b06d1487fde47730e3bf7a6a7b712da1a 100644 (file)
@@ -78,6 +78,15 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *hctx)
                return;
        clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
 
+       /*
+        * Order clearing SCHED_RESTART and list_empty_careful(&hctx->dispatch)
+        * in blk_mq_run_hw_queue(). Its pair is the barrier in
+        * blk_mq_dispatch_rq_list(). So dispatch code won't see SCHED_RESTART,
+        * meantime new request added to hctx->dispatch is missed to check in
+        * blk_mq_run_hw_queue().
+        */
+       smp_mb();
+
        blk_mq_run_hw_queue(hctx, true);
 }
 
index 126021fc3a11f9308a5fe0745ba2a6f9f1ee2ee5..e81ca1bf6e10b6dfcb3838f2424ee71ca89aea87 100644 (file)
@@ -66,7 +66,7 @@ static inline void blk_mq_sched_requeue_request(struct request *rq)
        struct request_queue *q = rq->q;
        struct elevator_queue *e = q->elevator;
 
-       if (e && e->type->ops.requeue_request)
+       if ((rq->rq_flags & RQF_ELVPRIV) && e && e->type->ops.requeue_request)
                e->type->ops.requeue_request(rq);
 }
 
index 0015a1892153ad59e0d04c61dc041efe4bc946ab..b3d2785eefe930692416d8540a7897e8819f9d3b 100644 (file)
@@ -1437,6 +1437,15 @@ out:
                list_splice_tail_init(list, &hctx->dispatch);
                spin_unlock(&hctx->lock);
 
+               /*
+                * Order adding requests to hctx->dispatch and checking
+                * SCHED_RESTART flag. The pair of this smp_mb() is the one
+                * in blk_mq_sched_restart(). Avoid restart code path to
+                * miss the new added requests to hctx->dispatch, meantime
+                * SCHED_RESTART is observed here.
+                */
+               smp_mb();
+
                /*
                 * If SCHED_RESTART was set by the caller of this function and
                 * it is no longer set that means that it was cleared by another
@@ -1834,6 +1843,7 @@ void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
 /**
  * blk_mq_request_bypass_insert - Insert a request at dispatch list.
  * @rq: Pointer to request to be inserted.
+ * @at_head: true if the request should be inserted at the head of the list.
  * @run_queue: If we should run the hardware queue after inserting the request.
  *
  * Should only be used carefully, when the caller knows we want to
@@ -2016,7 +2026,8 @@ insert:
        if (bypass_insert)
                return BLK_STS_RESOURCE;
 
-       blk_mq_request_bypass_insert(rq, false, run_queue);
+       blk_mq_sched_insert_request(rq, false, run_queue, false);
+
        return BLK_STS_OK;
 }
 
index 76a7e03bcd6cace32a556c22fcad8e39ebed126b..34b721a2743afd6748bee37db6236ec79fc0b37a 100644 (file)
@@ -801,6 +801,52 @@ bool blk_queue_can_use_dma_map_merging(struct request_queue *q,
 }
 EXPORT_SYMBOL_GPL(blk_queue_can_use_dma_map_merging);
 
+/**
+ * blk_queue_set_zoned - configure a disk queue zoned model.
+ * @disk:      the gendisk of the queue to configure
+ * @model:     the zoned model to set
+ *
+ * Set the zoned model of the request queue of @disk according to @model.
+ * When @model is BLK_ZONED_HM (host managed), this should be called only
+ * if zoned block device support is enabled (CONFIG_BLK_DEV_ZONED option).
+ * If @model specifies BLK_ZONED_HA (host aware), the effective model used
+ * depends on CONFIG_BLK_DEV_ZONED settings and on the existence of partitions
+ * on the disk.
+ */
+void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model)
+{
+       switch (model) {
+       case BLK_ZONED_HM:
+               /*
+                * Host managed devices are supported only if
+                * CONFIG_BLK_DEV_ZONED is enabled.
+                */
+               WARN_ON_ONCE(!IS_ENABLED(CONFIG_BLK_DEV_ZONED));
+               break;
+       case BLK_ZONED_HA:
+               /*
+                * Host aware devices can be treated either as regular block
+                * devices (similar to drive managed devices) or as zoned block
+                * devices to take advantage of the zone command set, similarly
+                * to host managed devices. We try the latter if there are no
+                * partitions and zoned block device support is enabled, else
+                * we do nothing special as far as the block layer is concerned.
+                */
+               if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED) ||
+                   disk_has_partitions(disk))
+                       model = BLK_ZONED_NONE;
+               break;
+       case BLK_ZONED_NONE:
+       default:
+               if (WARN_ON_ONCE(model != BLK_ZONED_NONE))
+                       model = BLK_ZONED_NONE;
+               break;
+       }
+
+       disk->queue->limits.zoned = model;
+}
+EXPORT_SYMBOL_GPL(blk_queue_set_zoned);
+
 static int __init blk_settings_init(void)
 {
        blk_max_low_pfn = max_low_pfn - 1;
index 7da302ff88d0d512151b9d82e08744581a864dc6..ae3dd1fb8e61d7b88c581d22dc6682bdb0ca994f 100644 (file)
@@ -137,6 +137,7 @@ void blk_stat_add_callback(struct request_queue *q,
                           struct blk_stat_callback *cb)
 {
        unsigned int bucket;
+       unsigned long flags;
        int cpu;
 
        for_each_possible_cpu(cpu) {
@@ -147,20 +148,22 @@ void blk_stat_add_callback(struct request_queue *q,
                        blk_rq_stat_init(&cpu_stat[bucket]);
        }
 
-       spin_lock(&q->stats->lock);
+       spin_lock_irqsave(&q->stats->lock, flags);
        list_add_tail_rcu(&cb->list, &q->stats->callbacks);
        blk_queue_flag_set(QUEUE_FLAG_STATS, q);
-       spin_unlock(&q->stats->lock);
+       spin_unlock_irqrestore(&q->stats->lock, flags);
 }
 
 void blk_stat_remove_callback(struct request_queue *q,
                              struct blk_stat_callback *cb)
 {
-       spin_lock(&q->stats->lock);
+       unsigned long flags;
+
+       spin_lock_irqsave(&q->stats->lock, flags);
        list_del_rcu(&cb->list);
        if (list_empty(&q->stats->callbacks) && !q->stats->enable_accounting)
                blk_queue_flag_clear(QUEUE_FLAG_STATS, q);
-       spin_unlock(&q->stats->lock);
+       spin_unlock_irqrestore(&q->stats->lock, flags);
 
        del_timer_sync(&cb->timer);
 }
@@ -183,10 +186,12 @@ void blk_stat_free_callback(struct blk_stat_callback *cb)
 
 void blk_stat_enable_accounting(struct request_queue *q)
 {
-       spin_lock(&q->stats->lock);
+       unsigned long flags;
+
+       spin_lock_irqsave(&q->stats->lock, flags);
        q->stats->enable_accounting = true;
        blk_queue_flag_set(QUEUE_FLAG_STATS, q);
-       spin_unlock(&q->stats->lock);
+       spin_unlock_irqrestore(&q->stats->lock, flags);
 }
 EXPORT_SYMBOL_GPL(blk_stat_enable_accounting);
 
index 0fa615eefd52639cc25490d9534310f27b1f5da7..fd410086fe1de59b02e926dd364b9253a05a6311 100644 (file)
@@ -528,7 +528,7 @@ static inline bool wbt_should_throttle(struct rq_wb *rwb, struct bio *bio)
                if ((bio->bi_opf & (REQ_SYNC | REQ_IDLE)) ==
                    (REQ_SYNC | REQ_IDLE))
                        return false;
-               /* fallthrough */
+               fallthrough;
        case REQ_OP_DISCARD:
                return true;
        default:
index fb7b347f80105b142c3577f0c0bde4fc72583c6a..d185396d88bbc5ed8d240cad9a5deb89a24dbb75 100644 (file)
@@ -378,7 +378,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
        bset->timeout_fn = timeout;
 
        set = &bset->tag_set;
-       set->ops = &bsg_mq_ops,
+       set->ops = &bsg_mq_ops;
        set->nr_hw_queues = 1;
        set->queue_depth = 128;
        set->numa_node = NUMA_NO_NODE;
index 77bcab11dce5794531abf58f1d6e7957ea06c887..04ebd37966f181eee55282e67bc96c696de2fdc2 100644 (file)
@@ -71,7 +71,7 @@ int ioprio_check_cap(int ioprio)
                case IOPRIO_CLASS_RT:
                        if (!capable(CAP_SYS_ADMIN))
                                return -EPERM;
-                       /* fall through */
+                       fallthrough;
                        /* rt has prio field too */
                case IOPRIO_CLASS_BE:
                        if (data >= IOPRIO_BE_NR || data < 0)
index e62a98a8eeb75039ea1e8341356b7d4aa4112aa0..722406b841dfc7b44a76be504afc2495e175ef3d 100644 (file)
@@ -278,6 +278,15 @@ static void hd_struct_free_work(struct work_struct *work)
 {
        struct hd_struct *part =
                container_of(to_rcu_work(work), struct hd_struct, rcu_work);
+       struct gendisk *disk = part_to_disk(part);
+
+       /*
+        * Release the disk reference acquired in delete_partition here.
+        * We can't release it in hd_struct_free because the final put_device
+        * needs process context and thus can't be run directly from a
+        * percpu_ref ->release handler.
+        */
+       put_device(disk_to_dev(disk));
 
        part->start_sect = 0;
        part->nr_sects = 0;
@@ -293,7 +302,6 @@ static void hd_struct_free(struct percpu_ref *ref)
                rcu_dereference_protected(disk->part_tbl, 1);
 
        rcu_assign_pointer(ptbl->last_lookup, NULL);
-       put_device(disk_to_dev(disk));
 
        INIT_RCU_WORK(&part->rcu_work, hd_struct_free_work);
        queue_rcu_work(system_wq, &part->rcu_work);
@@ -524,19 +532,20 @@ int bdev_add_partition(struct block_device *bdev, int partno,
 int bdev_del_partition(struct block_device *bdev, int partno)
 {
        struct block_device *bdevp;
-       struct hd_struct *part;
-       int ret = 0;
+       struct hd_struct *part = NULL;
+       int ret;
 
-       part = disk_get_part(bdev->bd_disk, partno);
-       if (!part)
-               return -ENXIO;
-
-       ret = -ENOMEM;
-       bdevp = bdget(part_devt(part));
+       bdevp = bdget_disk(bdev->bd_disk, partno);
        if (!bdevp)
-               goto out_put_part;
+               return -ENXIO;
 
        mutex_lock(&bdevp->bd_mutex);
+       mutex_lock_nested(&bdev->bd_mutex, 1);
+
+       ret = -ENXIO;
+       part = disk_get_part(bdev->bd_disk, partno);
+       if (!part)
+               goto out_unlock;
 
        ret = -EBUSY;
        if (bdevp->bd_openers)
@@ -545,16 +554,14 @@ int bdev_del_partition(struct block_device *bdev, int partno)
        sync_blockdev(bdevp);
        invalidate_bdev(bdevp);
 
-       mutex_lock_nested(&bdev->bd_mutex, 1);
        delete_partition(bdev->bd_disk, part);
-       mutex_unlock(&bdev->bd_mutex);
-
        ret = 0;
 out_unlock:
+       mutex_unlock(&bdev->bd_mutex);
        mutex_unlock(&bdevp->bd_mutex);
        bdput(bdevp);
-out_put_part:
-       disk_put_part(part);
+       if (part)
+               disk_put_part(part);
        return ret;
 }
 
index a6f581ab200c12c2d464dfe077ebfc2a0b18e0e2..8be8bec07cdd2c7a14f9a65bde64b4ed0b992e94 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/rwsem.h>
+#include <linux/sched.h>
 #include <linux/sched/signal.h>
 #include <linux/security.h>
 
@@ -845,9 +846,15 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
        }
 
        lock_sock(sk);
-       if (ctx->init && (init || !ctx->more)) {
-               err = -EINVAL;
-               goto unlock;
+       if (ctx->init && !ctx->more) {
+               if (ctx->used) {
+                       err = -EINVAL;
+                       goto unlock;
+               }
+
+               pr_info_once(
+                       "%s sent an empty control message without MSG_MORE.\n",
+                       current->comm);
        }
        ctx->init = true;
 
index e99fe34cfa0054046d2a4226b5c8dff50169b266..3132967a1749721e2ef8658a2e04fbfeebe315c0 100644 (file)
@@ -1521,7 +1521,7 @@ static int drbg_prepare_hrng(struct drbg_state *drbg)
 
        case -EALREADY:
                err = 0;
-               /* fall through */
+               fallthrough;
 
        default:
                drbg->random_ready.func = NULL;
index ba0b7702f2e91be21359c12ef583c20b890349c5..12e82a61b8961c230f6d72edcaa030ed0878ffaf 100644 (file)
@@ -2348,121 +2348,121 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
                        test_hash_speed(alg, sec, generic_hash_speed_template);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case 301:
                test_hash_speed("md4", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 302:
                test_hash_speed("md5", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 303:
                test_hash_speed("sha1", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 304:
                test_hash_speed("sha256", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 305:
                test_hash_speed("sha384", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 306:
                test_hash_speed("sha512", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 307:
                test_hash_speed("wp256", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 308:
                test_hash_speed("wp384", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 309:
                test_hash_speed("wp512", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 310:
                test_hash_speed("tgr128", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 311:
                test_hash_speed("tgr160", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 312:
                test_hash_speed("tgr192", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 313:
                test_hash_speed("sha224", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 314:
                test_hash_speed("rmd128", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 315:
                test_hash_speed("rmd160", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 316:
                test_hash_speed("rmd256", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 317:
                test_hash_speed("rmd320", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 318:
                test_hash_speed("ghash-generic", sec, hash_speed_template_16);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 319:
                test_hash_speed("crc32c", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 320:
                test_hash_speed("crct10dif", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 321:
                test_hash_speed("poly1305", sec, poly1305_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 322:
                test_hash_speed("sha3-224", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 323:
                test_hash_speed("sha3-256", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 324:
                test_hash_speed("sha3-384", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 325:
                test_hash_speed("sha3-512", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 326:
                test_hash_speed("sm3", sec, generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 327:
                test_hash_speed("streebog256", sec,
                                generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 328:
                test_hash_speed("streebog512", sec,
                                generic_hash_speed_template);
                if (mode > 300 && mode < 400) break;
-               /* fall through */
+               fallthrough;
        case 399:
                break;
 
@@ -2471,121 +2471,121 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
                        test_ahash_speed(alg, sec, generic_hash_speed_template);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case 401:
                test_ahash_speed("md4", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 402:
                test_ahash_speed("md5", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 403:
                test_ahash_speed("sha1", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 404:
                test_ahash_speed("sha256", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 405:
                test_ahash_speed("sha384", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 406:
                test_ahash_speed("sha512", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 407:
                test_ahash_speed("wp256", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 408:
                test_ahash_speed("wp384", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 409:
                test_ahash_speed("wp512", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 410:
                test_ahash_speed("tgr128", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 411:
                test_ahash_speed("tgr160", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 412:
                test_ahash_speed("tgr192", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 413:
                test_ahash_speed("sha224", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 414:
                test_ahash_speed("rmd128", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 415:
                test_ahash_speed("rmd160", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 416:
                test_ahash_speed("rmd256", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 417:
                test_ahash_speed("rmd320", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 418:
                test_ahash_speed("sha3-224", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 419:
                test_ahash_speed("sha3-256", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 420:
                test_ahash_speed("sha3-384", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 421:
                test_ahash_speed("sha3-512", sec, generic_hash_speed_template);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 422:
                test_mb_ahash_speed("sha1", sec, generic_hash_speed_template,
                                    num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 423:
                test_mb_ahash_speed("sha256", sec, generic_hash_speed_template,
                                    num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 424:
                test_mb_ahash_speed("sha512", sec, generic_hash_speed_template,
                                    num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 425:
                test_mb_ahash_speed("sm3", sec, generic_hash_speed_template,
                                    num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 426:
                test_mb_ahash_speed("streebog256", sec,
                                    generic_hash_speed_template, num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 427:
                test_mb_ahash_speed("streebog512", sec,
                                    generic_hash_speed_template, num_mb);
                if (mode > 400 && mode < 500) break;
-               /* fall through */
+               fallthrough;
        case 499:
                break;
 
index c2b452af68068465abeb06abdc4ebbbd8acd21d3..9861302cc7dbb92200792f90f3ee69f135e32289 100644 (file)
@@ -290,7 +290,7 @@ static int vt_notifier_call(struct notifier_block *blk,
                        break;
                case '\t':
                        c = ' ';
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        if (c < 32)
                                /* Ignore other control sequences */
index 0803c2013cf4d476cdb9136d165f95332c595d2e..07ecbbde0384123d22509a37c01a117273507546 100644 (file)
@@ -42,6 +42,11 @@ config SPEAKUP
                one of the listed synthesizers, you should say n.
 
 if SPEAKUP
+
+config SPEAKUP_SERIALIO
+       def_bool y
+       depends on ISA || COMPILE_TEST
+
 config SPEAKUP_SYNTH_ACNTSA
        tristate "Accent SA synthesizer support"
        help
@@ -52,7 +57,7 @@ config SPEAKUP_SYNTH_ACNTSA
 
 config SPEAKUP_SYNTH_ACNTPC
        tristate "Accent PC synthesizer support"
-       depends on ISA || COMPILE_TEST
+       depends on SPEAKUP_SERIALIO
        help
                This is the Speakup driver for the accent pc
                synthesizer.  You can say y to build it into the kernel,
@@ -104,7 +109,7 @@ config SPEAKUP_SYNTH_DECEXT
 
 config SPEAKUP_SYNTH_DECPC
        depends on m
-       depends on ISA || COMPILE_TEST
+       depends on SPEAKUP_SERIALIO
        tristate "DECtalk PC (big ISA card) synthesizer support"
        help
 
@@ -127,7 +132,7 @@ config SPEAKUP_SYNTH_DECPC
 
 config SPEAKUP_SYNTH_DTLK
        tristate "DoubleTalk PC synthesizer support"
-       depends on ISA || COMPILE_TEST
+       depends on SPEAKUP_SERIALIO
        help
 
                This is the Speakup driver for the internal DoubleTalk
@@ -138,7 +143,7 @@ config SPEAKUP_SYNTH_DTLK
 
 config SPEAKUP_SYNTH_KEYPC
        tristate "Keynote Gold PC synthesizer support"
-       depends on ISA || COMPILE_TEST
+       depends on SPEAKUP_SERIALIO
        help
 
                This is the Speakup driver for the Keynote Gold
index 5befb4933b850e0cd2fdc9c5bb082a2ba9fa6579..6e4bfac8af650de79d4ce2020fc507db699ecb0a 100644 (file)
@@ -25,8 +25,8 @@ speakup-y := \
        keyhelp.o \
        kobjects.o \
        selection.o \
-       serialio.o \
        spk_ttyio.o \
        synth.o \
        thread.o \
        varhandlers.o
+speakup-$(CONFIG_SPEAKUP_SERIALIO) += serialio.o
index 177a2988641c16ea4922ea3de6e0b0a7ee06df2e..403b01d66367e69651afeffa60dfc155a25f1aac 100644 (file)
@@ -32,6 +32,7 @@ static void spk_serial_tiocmset(unsigned int set, unsigned int clear);
 static unsigned char spk_serial_in(void);
 static unsigned char spk_serial_in_nowait(void);
 static void spk_serial_flush_buffer(void);
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_serial_io_ops = {
        .synth_out = spk_serial_out,
@@ -40,6 +41,7 @@ struct spk_io_ops spk_serial_io_ops = {
        .synth_in = spk_serial_in,
        .synth_in_nowait = spk_serial_in_nowait,
        .flush_buffer = spk_serial_flush_buffer,
+       .wait_for_xmitr = spk_serial_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_serial_io_ops);
 
@@ -211,7 +213,7 @@ void spk_stop_serial_interrupt(void)
 }
 EXPORT_SYMBOL_GPL(spk_stop_serial_interrupt);
 
-int spk_wait_for_xmitr(struct spk_synth *in_synth)
+static int spk_serial_wait_for_xmitr(struct spk_synth *in_synth)
 {
        int tmout = SPK_XMITR_TIMEOUT;
 
@@ -280,7 +282,7 @@ static void spk_serial_flush_buffer(void)
 
 static int spk_serial_out(struct spk_synth *in_synth, const char ch)
 {
-       if (in_synth->alive && spk_wait_for_xmitr(in_synth)) {
+       if (in_synth->alive && spk_serial_wait_for_xmitr(in_synth)) {
                outb_p(ch, speakup_info.port_tts);
                return 1;
        }
@@ -295,7 +297,7 @@ const char *spk_serial_synth_immediate(struct spk_synth *synth,
        while ((ch = *buff)) {
                if (ch == '\n')
                        ch = synth->procspeech;
-               if (spk_wait_for_xmitr(synth))
+               if (spk_serial_wait_for_xmitr(synth))
                        outb(ch, speakup_info.port_tts);
                else
                        return buff;
index c75b40838794710f8d44bd19651124e3ecf85aeb..0f4bcbe5ddb93974fcfbe7979d8cff60f8b0c403 100644 (file)
@@ -34,7 +34,6 @@
 
 const struct old_serial_port *spk_serial_init(int index);
 void spk_stop_serial_interrupt(void);
-int spk_wait_for_xmitr(struct spk_synth *in_synth);
 void spk_serial_release(void);
 void spk_ttyio_release(void);
 void spk_ttyio_register_ldisc(void);
index 9b95f77f926573ad0056b6b1a249e9e71f845e87..a831ff64f8ba579e9acd967f7906e43a633dac6d 100644 (file)
@@ -116,6 +116,7 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear);
 static unsigned char spk_ttyio_in(void);
 static unsigned char spk_ttyio_in_nowait(void);
 static void spk_ttyio_flush_buffer(void);
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth);
 
 struct spk_io_ops spk_ttyio_ops = {
        .synth_out = spk_ttyio_out,
@@ -125,6 +126,7 @@ struct spk_io_ops spk_ttyio_ops = {
        .synth_in = spk_ttyio_in,
        .synth_in_nowait = spk_ttyio_in_nowait,
        .flush_buffer = spk_ttyio_flush_buffer,
+       .wait_for_xmitr = spk_ttyio_wait_for_xmitr,
 };
 EXPORT_SYMBOL_GPL(spk_ttyio_ops);
 
@@ -286,6 +288,11 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
        mutex_unlock(&speakup_tty_mutex);
 }
 
+static int spk_ttyio_wait_for_xmitr(struct spk_synth *in_synth)
+{
+       return 1;
+}
+
 static unsigned char ttyio_in(int timeout)
 {
        struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data;
index d3272c6d199aaabe08d0caef0dc53a1dbd378357..7398f1196e103732845570dd83cdf3ca1d6698ac 100644 (file)
@@ -158,6 +158,7 @@ struct spk_io_ops {
        unsigned char (*synth_in)(void);
        unsigned char (*synth_in_nowait)(void);
        void (*flush_buffer)(void);
+       int (*wait_for_xmitr)(struct spk_synth *synth);
 };
 
 struct spk_synth {
index 3568bfb89912c3316d649b6c19223f4206936457..ac47dbac72075d03f7a67c51c8c8ce66c9351f6f 100644 (file)
@@ -159,7 +159,7 @@ int spk_synth_is_alive_restart(struct spk_synth *synth)
 {
        if (synth->alive)
                return 1;
-       if (spk_wait_for_xmitr(synth) > 0) {
+       if (synth->io_ops->wait_for_xmitr(synth) > 0) {
                /* restart */
                synth->alive = 1;
                synth_printf("%s", synth->init);
index 4c348377a39d87419c4bdbfcdff9b8e2ed2713e4..806b8ce05624b1772f1585790c6f0edd28c5a32e 100644 (file)
@@ -99,8 +99,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
        if (ret < 0)
                return -ENOENT;
 
-       acpi_dev_get_property(adev, "is-rv", ACPI_TYPE_INTEGER, &obj);
-       clk_data->is_rv = obj->integer.value;
+       if (!acpi_dev_get_property(adev, "is-rv", ACPI_TYPE_INTEGER, &obj))
+               clk_data->is_rv = obj->integer.value;
 
        list_for_each_entry(rentry, &resource_list, node) {
                clk_data->base = devm_ioremap(&adev->dev, rentry->res->start,
index 6ad8cb05f672fe630237f9cd218573eb11748fb9..4a0b07792233ef5208b67fa9eb7b2df6e4b2b2f2 100644 (file)
@@ -350,7 +350,7 @@ void __iomem __ref
 
        pg_off = round_down(phys, PAGE_SIZE);
        pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
-       virt = acpi_map(pg_off, pg_sz);
+       virt = acpi_map(phys, size);
        if (!virt) {
                mutex_unlock(&acpi_ioremap_lock);
                kfree(map);
@@ -358,7 +358,7 @@ void __iomem __ref
        }
 
        INIT_LIST_HEAD(&map->list);
-       map->virt = virt;
+       map->virt = (void __iomem __force *)((unsigned long)virt & PAGE_MASK);
        map->phys = pg_off;
        map->size = pg_sz;
        map->track.refcount = 1;
@@ -1575,11 +1575,26 @@ static acpi_status acpi_deactivate_mem_region(acpi_handle handle, u32 level,
 acpi_status acpi_release_memory(acpi_handle handle, struct resource *res,
                                u32 level)
 {
+       acpi_status status;
+
        if (!(res->flags & IORESOURCE_MEM))
                return AE_TYPE;
 
-       return acpi_walk_namespace(ACPI_TYPE_REGION, handle, level,
-                                  acpi_deactivate_mem_region, NULL, res, NULL);
+       status = acpi_walk_namespace(ACPI_TYPE_REGION, handle, level,
+                                    acpi_deactivate_mem_region, NULL,
+                                    res, NULL);
+       if (ACPI_FAILURE(status))
+               return status;
+
+       /*
+        * Wait for all of the mappings queued up for removal by
+        * acpi_deactivate_mem_region() to actually go away.
+        */
+       synchronize_rcu();
+       rcu_barrier();
+       flush_scheduled_work();
+
+       return AE_OK;
 }
 EXPORT_SYMBOL_GPL(acpi_release_memory);
 
index 71a30b0d0f05a9cf75cafd20e178accd15ce3141..f66236cff69b02ee6a8e3ac8014c35e49571a8a6 100644 (file)
@@ -161,18 +161,10 @@ static void lapic_timer_propagate_broadcast(struct acpi_processor *pr)
 }
 
 /* Power(C) State timer broadcast control */
-static void lapic_timer_state_broadcast(struct acpi_processor *pr,
-                                      struct acpi_processor_cx *cx,
-                                      int broadcast)
+static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,
+                                       struct acpi_processor_cx *cx)
 {
-       int state = cx - pr->power.states;
-
-       if (state >= pr->power.timer_broadcast_on_state) {
-               if (broadcast)
-                       tick_broadcast_enter();
-               else
-                       tick_broadcast_exit();
-       }
+       return cx - pr->power.states >= pr->power.timer_broadcast_on_state;
 }
 
 #else
@@ -180,10 +172,11 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,
 static void lapic_timer_check_state(int state, struct acpi_processor *pr,
                                   struct acpi_processor_cx *cstate) { }
 static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { }
-static void lapic_timer_state_broadcast(struct acpi_processor *pr,
-                                      struct acpi_processor_cx *cx,
-                                      int broadcast)
+
+static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,
+                                       struct acpi_processor_cx *cx)
 {
+       return false;
 }
 
 #endif
@@ -566,32 +559,43 @@ static DEFINE_RAW_SPINLOCK(c3_lock);
 
 /**
  * acpi_idle_enter_bm - enters C3 with proper BM handling
+ * @drv: cpuidle driver
  * @pr: Target processor
  * @cx: Target state context
- * @timer_bc: Whether or not to change timer mode to broadcast
+ * @index: index of target state
  */
-static void acpi_idle_enter_bm(struct acpi_processor *pr,
-                              struct acpi_processor_cx *cx, bool timer_bc)
+static int acpi_idle_enter_bm(struct cpuidle_driver *drv,
+                              struct acpi_processor *pr,
+                              struct acpi_processor_cx *cx,
+                              int index)
 {
-       acpi_unlazy_tlb(smp_processor_id());
-
-       /*
-        * Must be done before busmaster disable as we might need to
-        * access HPET !
-        */
-       if (timer_bc)
-               lapic_timer_state_broadcast(pr, cx, 1);
+       static struct acpi_processor_cx safe_cx = {
+               .entry_method = ACPI_CSTATE_HALT,
+       };
 
        /*
         * disable bus master
         * bm_check implies we need ARB_DIS
         * bm_control implies whether we can do ARB_DIS
         *
-        * That leaves a case where bm_check is set and bm_control is
-        * not set. In that case we cannot do much, we enter C3
-        * without doing anything.
+        * That leaves a case where bm_check is set and bm_control is not set.
+        * In that case we cannot do much, we enter C3 without doing anything.
         */
-       if (pr->flags.bm_control) {
+       bool dis_bm = pr->flags.bm_control;
+
+       /* If we can skip BM, demote to a safe state. */
+       if (!cx->bm_sts_skip && acpi_idle_bm_check()) {
+               dis_bm = false;
+               index = drv->safe_state_index;
+               if (index >= 0) {
+                       cx = this_cpu_read(acpi_cstate[index]);
+               } else {
+                       cx = &safe_cx;
+                       index = -EBUSY;
+               }
+       }
+
+       if (dis_bm) {
                raw_spin_lock(&c3_lock);
                c3_cpu_count++;
                /* Disable bus master arbitration when all CPUs are in C3 */
@@ -600,18 +604,21 @@ static void acpi_idle_enter_bm(struct acpi_processor *pr,
                raw_spin_unlock(&c3_lock);
        }
 
+       rcu_idle_enter();
+
        acpi_idle_do_entry(cx);
 
+       rcu_idle_exit();
+
        /* Re-enable bus master arbitration */
-       if (pr->flags.bm_control) {
+       if (dis_bm) {
                raw_spin_lock(&c3_lock);
                acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
                c3_cpu_count--;
                raw_spin_unlock(&c3_lock);
        }
 
-       if (timer_bc)
-               lapic_timer_state_broadcast(pr, cx, 0);
+       return index;
 }
 
 static int acpi_idle_enter(struct cpuidle_device *dev,
@@ -625,32 +632,21 @@ static int acpi_idle_enter(struct cpuidle_device *dev,
                return -EINVAL;
 
        if (cx->type != ACPI_STATE_C1) {
+               if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check)
+                       return acpi_idle_enter_bm(drv, pr, cx, index);
+
+               /* C2 to C1 demotion. */
                if (acpi_idle_fallback_to_c1(pr) && num_online_cpus() > 1) {
                        index = ACPI_IDLE_STATE_START;
                        cx = per_cpu(acpi_cstate[index], dev->cpu);
-               } else if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check) {
-                       if (cx->bm_sts_skip || !acpi_idle_bm_check()) {
-                               acpi_idle_enter_bm(pr, cx, true);
-                               return index;
-                       } else if (drv->safe_state_index >= 0) {
-                               index = drv->safe_state_index;
-                               cx = per_cpu(acpi_cstate[index], dev->cpu);
-                       } else {
-                               acpi_safe_halt();
-                               return -EBUSY;
-                       }
                }
        }
 
-       lapic_timer_state_broadcast(pr, cx, 1);
-
        if (cx->type == ACPI_STATE_C3)
                ACPI_FLUSH_CPU_CACHE();
 
        acpi_idle_do_entry(cx);
 
-       lapic_timer_state_broadcast(pr, cx, 0);
-
        return index;
 }
 
@@ -666,7 +662,13 @@ static int acpi_idle_enter_s2idle(struct cpuidle_device *dev,
                        return 0;
 
                if (pr->flags.bm_check) {
-                       acpi_idle_enter_bm(pr, cx, false);
+                       u8 bm_sts_skip = cx->bm_sts_skip;
+
+                       /* Don't check BM_STS, do an unconditional ARB_DIS for S2IDLE */
+                       cx->bm_sts_skip = 1;
+                       acpi_idle_enter_bm(drv, pr, cx, index);
+                       cx->bm_sts_skip = bm_sts_skip;
+
                        return 0;
                } else {
                        ACPI_FLUSH_CPU_CACHE();
@@ -682,11 +684,13 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
 {
        int i, count = ACPI_IDLE_STATE_START;
        struct acpi_processor_cx *cx;
+       struct cpuidle_state *state;
 
        if (max_cstate == 0)
                max_cstate = 1;
 
        for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
+               state = &acpi_idle_driver.states[count];
                cx = &pr->power.states[i];
 
                if (!cx->valid)
@@ -694,6 +698,15 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
 
                per_cpu(acpi_cstate[count], dev->cpu) = cx;
 
+               if (lapic_timer_needs_broadcast(pr, cx))
+                       state->flags |= CPUIDLE_FLAG_TIMER_STOP;
+
+               if (cx->type == ACPI_STATE_C3) {
+                       state->flags |= CPUIDLE_FLAG_TLB_FLUSHED;
+                       if (pr->flags.bm_check)
+                               state->flags |= CPUIDLE_FLAG_RCU_IDLE;
+               }
+
                count++;
                if (count == CPUIDLE_STATE_MAX)
                        break;
index 0c0a736eb8613d16e9ef597c7ce179d2595bd169..fbd8eaa32d32505cb26991a16edbbf9b3388b363 100644 (file)
@@ -807,8 +807,7 @@ static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class,
                                (sstatus & 0xf) != 1)
                        break;
 
-               ata_link_printk(link, KERN_INFO, "avn bounce port%d\n",
-                               port);
+               ata_link_info(link,  "avn bounce port%d\n", port);
 
                pci_read_config_word(pdev, 0x92, &val);
                val &= ~(1 << port);
index 6853dbb4131d8765ff8f1b013f0ba29e6e67bc22..49f7acbfcf01e91d7bd42277292441fc090320f1 100644 (file)
@@ -470,7 +470,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)
        switch (priv->version) {
        case BRCM_SATA_BCM7425:
                hpriv->flags |= AHCI_HFLAG_DELAY_ENGINE;
-               /* fall through */
+               fallthrough;
        case BRCM_SATA_NSP:
                hpriv->flags |= AHCI_HFLAG_NO_NCQ;
                priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE;
index 129556fcf6be760ce48834873ea3ea057c4bd8a5..86261deeb4c58d48ff866b578f62e6c82f9cd1e1 100644 (file)
@@ -326,7 +326,7 @@ static int ahci_platform_get_phy(struct ahci_host_priv *hpriv, u32 port,
                                node);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case -ENODEV:
                /* continue normally */
                hpriv->phys[port] = NULL;
index b1cd4d97bc2a75994361aa88e7c86a305aa8f5d7..f546a5761c4f2c419ddb1d24fd0e8972ea633324 100644 (file)
@@ -190,7 +190,7 @@ struct ata_link *ata_link_next(struct ata_link *link, struct ata_port *ap,
                case ATA_LITER_PMP_FIRST:
                        if (sata_pmp_attached(ap))
                                return ap->pmp_link;
-                       /* fall through */
+                       fallthrough;
                case ATA_LITER_HOST_FIRST:
                        return &ap->link;
                }
@@ -201,11 +201,11 @@ struct ata_link *ata_link_next(struct ata_link *link, struct ata_port *ap,
                case ATA_LITER_HOST_FIRST:
                        if (sata_pmp_attached(ap))
                                return ap->pmp_link;
-                       /* fall through */
+                       fallthrough;
                case ATA_LITER_PMP_FIRST:
                        if (unlikely(ap->slave_link))
                                return ap->slave_link;
-                       /* fall through */
+                       fallthrough;
                case ATA_LITER_EDGE:
                        return NULL;
                }
@@ -523,7 +523,7 @@ int atapi_cmd_type(u8 opcode)
        case ATA_12:
                if (atapi_passthru16)
                        return ATAPI_PASS_THRU;
-               /* fall thru */
+               fallthrough;
        default:
                return ATAPI_MISC;
        }
@@ -1800,7 +1800,7 @@ retry:
        switch (class) {
        case ATA_DEV_SEMB:
                class = ATA_DEV_ATA;    /* some hard drives report SEMB sig */
-               /* fall through */
+               fallthrough;
        case ATA_DEV_ATA:
        case ATA_DEV_ZAC:
                tf.command = ATA_CMD_ID_ATA;
@@ -2907,7 +2907,7 @@ int ata_bus_probe(struct ata_port *ap)
        case -ENODEV:
                /* give it just one more chance */
                tries[dev->devno] = min(tries[dev->devno], 1);
-               /* fall through */
+               fallthrough;
        case -EIO:
                if (tries[dev->devno] == 1) {
                        /* This is the last chance, better to slow
@@ -3158,7 +3158,7 @@ int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel)
 
        case ATA_DNXFER_FORCE_PIO0:
                pio_mask &= 1;
-               /* fall through */
+               fallthrough;
        case ATA_DNXFER_FORCE_PIO:
                mwdma_mask = 0;
                udma_mask = 0;
@@ -3868,9 +3868,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        /* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */
        { "C300-CTFDDAC128MAG", "0001",         ATA_HORKAGE_NONCQ, },
 
-       /* Some Sandisk SSDs lock up hard with NCQ enabled.  Reported on
-          SD7SN6S256G and SD8SN8U256G */
-       { "SanDisk SD[78]SN*G", NULL,           ATA_HORKAGE_NONCQ, },
+       /* Sandisk SD7/8/9s lock up hard on large trims */
+       { "SanDisk SD[789]*",   NULL,           ATA_HORKAGE_MAX_TRIM_128M, },
 
        /* devices which puke on READ_NATIVE_MAX */
        { "HDS724040KLSA80",    "KFAOA20N",     ATA_HORKAGE_BROKEN_HPA, },
@@ -4694,7 +4693,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
                            qc->tf.feature != SETFEATURES_RA_ON &&
                            qc->tf.feature != SETFEATURES_RA_OFF)
                                break;
-                       /* fall through */
+                       fallthrough;
                case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
                case ATA_CMD_SET_MULTI: /* multi_count changed */
                        /* revalidate device */
index 474c6c34fe022dc92f5d5f4e8c7e864bc69cc2f6..d912eaa65c943ebd9c4e325535cc356878b8c655 100644 (file)
@@ -1576,7 +1576,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
        case ATA_DEV_ZAC:
                if (stat & ATA_SENSE)
                        ata_eh_request_sense(qc, qc->scsicmd);
-               /* fall through */
+               fallthrough;
        case ATA_DEV_ATA:
                if (err & ATA_ICRC)
                        qc->err_mask |= AC_ERR_ATA_BUS;
@@ -3473,11 +3473,11 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
        case -ENODEV:
                /* device missing or wrong IDENTIFY data, schedule probing */
                ehc->i.probe_mask |= (1 << dev->devno);
-               /* fall through */
+               fallthrough;
        case -EINVAL:
                /* give it just one more chance */
                ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
-               /* fall through */
+               fallthrough;
        case -EIO:
                if (ehc->tries[dev->devno] == 1) {
                        /* This is the last chance, better to slow
index ec233208585bd4ad58a4feab9b7d3fb442f07f1c..70431912dc6352d53b630e1aaaa39bd212f51ade 100644 (file)
@@ -2080,6 +2080,7 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf)
 
 static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
 {
+       struct ata_device *dev = args->dev;
        u16 min_io_sectors;
 
        rbuf[1] = 0xb0;
@@ -2105,7 +2106,12 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
         * with the unmap bit set.
         */
        if (ata_id_has_trim(args->id)) {
-               put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM, &rbuf[36]);
+               u64 max_blocks = 65535 * ATA_MAX_TRIM_RNUM;
+
+               if (dev->horkage & ATA_HORKAGE_MAX_TRIM_128M)
+                       max_blocks = 128 << (20 - SECTOR_SHIFT);
+
+               put_unaligned_be64(max_blocks, &rbuf[36]);
                put_unaligned_be32(1, &rbuf[28]);
        }
 
@@ -4162,7 +4168,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
                                ata_scsi_rbuf_fill(&args, ata_scsiop_inq_b6);
                                break;
                        }
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        ata_scsi_set_invalid_field(dev, cmd, 2, 0xff);
                        break;
@@ -4198,7 +4204,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
         * turning this into a no-op.
         */
        case SYNCHRONIZE_CACHE:
-               /* fall through */
+               fallthrough;
 
        /* no-op's, complete with success */
        case REZERO_UNIT:
index e01a3a6e4d462a3ed1089ad6ff52cea21252d5ab..2bc5fc81efe30c8fc45c53bd67185a171775dc07 100644 (file)
@@ -157,7 +157,7 @@ static int atp867x_get_active_clocks_shifted(struct ata_port *ap,
        default:
                printk(KERN_WARNING "ATP867X: active %dclk is invalid. "
                        "Using 12clk.\n", clk);
-               /* fall through */
+               fallthrough;
        case 9 ... 12:
                clocks = 7;     /* 12 clk */
                break;
@@ -190,7 +190,7 @@ static int atp867x_get_recover_clocks_shifted(unsigned int clk)
        default:
                printk(KERN_WARNING "ATP867X: recover %dclk is invalid. "
                        "Using default 12clk.\n", clk);
-               /* fall through */
+               fallthrough;
        case 12:        /* default 12 clk */
                clocks = 0;
                break;
index 916bf024d737542e9770c833113b9a4d853215bb..7511e11eef4d6af0799914b0bf654e7c38f4ee05 100644 (file)
@@ -369,7 +369,7 @@ static int serverworks_fixup(struct pci_dev *pdev)
                break;
        case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
                ata_pci_bmdma_clear_simplex(pdev);
-               /* fall through */
+               fallthrough;
        case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE:
        case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2:
                rc = serverworks_fixup_csb(pdev);
index d7228f8e9297c001e730c7f62c8901ebad20715f..664ef658a955f93ba4743c469a097cbb7eb3ddf3 100644 (file)
@@ -2010,7 +2010,7 @@ static void mv_rw_multi_errata_sata24(struct ata_queued_cmd *qc)
                                break;
                        case ATA_CMD_WRITE_MULTI_FUA_EXT:
                                tf->flags &= ~ATA_TFLAG_FUA; /* ugh */
-                               /* fall through */
+                               fallthrough;
                        case ATA_CMD_WRITE_MULTI_EXT:
                                tf->command = ATA_CMD_PIO_WRITE_EXT;
                                break;
@@ -2044,7 +2044,7 @@ static enum ata_completion_errors mv_qc_prep(struct ata_queued_cmd *qc)
        case ATA_PROT_DMA:
                if (tf->command == ATA_CMD_DSM)
                        return AC_ERR_OK;
-               /* fall-thru */
+               fallthrough;
        case ATA_PROT_NCQ:
                break;  /* continue below */
        case ATA_PROT_PIO:
@@ -2296,7 +2296,7 @@ static unsigned int mv_qc_issue_fis(struct ata_queued_cmd *qc)
        switch (qc->tf.protocol) {
        case ATAPI_PROT_PIO:
                pp->pp_flags |= MV_PP_FLAG_FAKE_ATA_BUSY;
-               /* fall through */
+               fallthrough;
        case ATAPI_PROT_NODATA:
                ap->hsm_task_state = HSM_ST_FIRST;
                break;
@@ -2347,7 +2347,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
                                return AC_ERR_OTHER;
                        break;  /* use bmdma for this */
                }
-               /* fall thru */
+               fallthrough;
        case ATA_PROT_NCQ:
                mv_start_edma(ap, port_mmio, pp, qc->tf.protocol);
                pp->req_idx = (pp->req_idx + 1) & MV_MAX_Q_DEPTH_MASK;
@@ -2376,7 +2376,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
                                      ": attempting PIO w/multiple DRQ: "
                                      "this may fail due to h/w errata\n");
                }
-               /* fall through */
+               fallthrough;
        case ATA_PROT_NODATA:
        case ATAPI_PROT_PIO:
        case ATAPI_PROT_NODATA:
@@ -3864,7 +3864,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
                                " and avoid the final two gigabytes on"
                                " all RocketRAID BIOS initialized drives.\n");
                }
-               /* fall through */
+               fallthrough;
        case chip_6042:
                hpriv->ops = &mv6xxx_ops;
                hp_flags |= MV_HP_GEN_IIE;
index 8729f78cef5fdb1243508b0de7b286abd9420968..7815da8ef9e58917305622168813693be7b30256 100644 (file)
@@ -637,7 +637,7 @@ static enum ata_completion_errors pdc_qc_prep(struct ata_queued_cmd *qc)
        switch (qc->tf.protocol) {
        case ATA_PROT_DMA:
                pdc_fill_sg(qc);
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATA_PROT_NODATA:
                i = pdc_pkt_header(&qc->tf, qc->ap->bmdma_prd_dma,
                                   qc->dev->devno, pp->pkt);
@@ -652,7 +652,7 @@ static enum ata_completion_errors pdc_qc_prep(struct ata_queued_cmd *qc)
                break;
        case ATAPI_PROT_DMA:
                pdc_fill_sg(qc);
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATAPI_PROT_NODATA:
                pdc_atapi_pkt(qc);
                break;
@@ -1022,11 +1022,11 @@ static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc)
        case ATAPI_PROT_NODATA:
                if (qc->dev->flags & ATA_DFLAG_CDB_INTR)
                        break;
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATA_PROT_NODATA:
                if (qc->tf.flags & ATA_TFLAG_POLLING)
                        break;
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATAPI_PROT_DMA:
        case ATA_PROT_DMA:
                pdc_packet_start(qc);
index 2c7b30c5ea3dd8a7f90fa10405957212e37c0e0f..4c01190a5e370e1e86793feae8f8f9dbef3b22e7 100644 (file)
@@ -669,7 +669,7 @@ static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc)
        case ATA_PROT_NODATA:
                if (qc->tf.flags & ATA_TFLAG_POLLING)
                        break;
-               /*FALLTHROUGH*/
+               fallthrough;
        case ATA_PROT_DMA:
                pdc20621_packet_start(qc);
                return 0;
index 39be444534d03aaa6bee4b9140fa61140d56b427..316a9947541fe005fac119697fe93c70f70f9051 100644 (file)
@@ -2224,7 +2224,7 @@ static int eni_init_one(struct pci_dev *pci_dev,
 
        rc = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));
        if (rc < 0)
-               goto out;
+               goto err_disable;
 
        rc = -ENOMEM;
        eni_dev = kmalloc(sizeof(struct eni_dev), GFP_KERNEL);
index 2ca9ec8027342996ded892562f737b3a1864e21f..0ddd611b427766f4f4d01eb17334a1e7ff13124b 100644 (file)
@@ -711,7 +711,7 @@ static void process_txdone_queue (struct fs_dev *dev, struct queue *q)
 
                switch (STATUS_CODE (qe)) {
                case 0x01: /* This is for AAL0 where we put the chip in streaming mode */
-                       /* Fall through */
+                       fallthrough;
                case 0x02:
                        /* Process a real txdone entry. */
                        tmp = qe->p0;
@@ -998,6 +998,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
                                error = make_rate (pcr, r, &tmc0, NULL);
                                if (error) {
                                        kfree(tc);
+                                       kfree(vcc);
                                        return error;
                                }
                        }
index a81bc49c14acc6774dd04162ec9d06782476adaa..9a70bee841251d881ea43cebdf75e1a1e6b7910d 100644 (file)
@@ -376,33 +376,33 @@ fore200e_shutdown(struct fore200e* fore200e)
     case FORE200E_STATE_COMPLETE:
        kfree(fore200e->stats);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_IRQ:
        free_irq(fore200e->irq, fore200e->atm_dev);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_ALLOC_BUF:
        fore200e_free_rx_buf(fore200e);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INIT_BSQ:
        fore200e_uninit_bs_queue(fore200e);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INIT_RXQ:
        fore200e_dma_chunk_free(fore200e, &fore200e->host_rxq.status);
        fore200e_dma_chunk_free(fore200e, &fore200e->host_rxq.rpd);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INIT_TXQ:
        fore200e_dma_chunk_free(fore200e, &fore200e->host_txq.status);
        fore200e_dma_chunk_free(fore200e, &fore200e->host_txq.tpd);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INIT_CMDQ:
        fore200e_dma_chunk_free(fore200e, &fore200e->host_cmdq.status);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_INITIALIZE:
        /* nothing to do for that state */
 
@@ -415,7 +415,7 @@ fore200e_shutdown(struct fore200e* fore200e)
     case FORE200E_STATE_MAP:
        fore200e->bus->unmap(fore200e);
 
-       /* fall through */
+       fallthrough;
     case FORE200E_STATE_CONFIGURE:
        /* nothing to do for that state */
 
index 8af793f5e811322af3d933b911419c49211e1da3..17f44abc9418ead4d9cc9c6ffb6e26060724d506 100644 (file)
@@ -1944,14 +1944,14 @@ he_tasklet(unsigned long data)
                switch (type) {
                        case ITYPE_RBRQ_THRESH:
                                HPRINTK("rbrq%d threshold\n", group);
-                               /* fall through */
+                               fallthrough;
                        case ITYPE_RBRQ_TIMER:
                                if (he_service_rbrq(he_dev, group))
                                        he_service_rbpl(he_dev, group);
                                break;
                        case ITYPE_TBRQ_THRESH:
                                HPRINTK("tbrq%d threshold\n", group);
-                               /* fall through */
+                               fallthrough;
                        case ITYPE_TPD_COMPLETE:
                                he_service_tbrq(he_dev, group);
                                break;
index 63871859e6e8ed85d56a06f81ee67c96906275ed..3c081b6171a8fc39ffd3ac2535533861ffc14d9f 100644 (file)
@@ -192,7 +192,7 @@ static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
        switch (cmd) {
                case IDT77105_GETSTATZ:
                        if (!capable(CAP_NET_ADMIN)) return -EPERM;
-                       /* fall through */
+                       fallthrough;
                case IDT77105_GETSTAT:
                        return fetch_stats(dev, arg, cmd == IDT77105_GETSTATZ);
                case ATM_SETLOOP:
index 986c1313694c66f3b79b7a853d4fd5b600942c5a..ac811cfa6843108644c94d0fddb565be3de260c5 100644 (file)
@@ -2019,7 +2019,7 @@ static int lanai_normalize_ci(struct lanai_dev *lanai,
        switch (*vpip) {
                case ATM_VPI_ANY:
                        *vpip = 0;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case 0:
                        break;
                default:
index ee059c77e3bbc717e45d88b96974f798fbbbacb5..cf5fffcf98a1e6db5d25b300d4938733c9088fc6 100644 (file)
@@ -1447,7 +1447,7 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
        switch (cmd) {
                case ZATM_GETPOOLZ:
                        if (!capable(CAP_NET_ADMIN)) return -EPERM;
-                       /* fall through */
+                       fallthrough;
                case ZATM_GETPOOL:
                        {
                                struct zatm_pool_info info;
index dea031484cc4874a4ccad0f47b45ff5208a05088..0b1c99cca7334ff14b497f9c95709d1bacff0b9f 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Driver for the on-board character LCD found on some ARM reference boards
  * This is basically an Hitachi HD44780 LCD with a custom IP block to drive it
- * http://en.wikipedia.org/wiki/HD44780_Character_LCD
+ * https://en.wikipedia.org/wiki/HD44780_Character_LCD
  * Currently it will just display the text "ARM Linux" and the linux version
  *
  * Author: Linus Walleij <triad@df.lth.se>
index 99980aa3644bc3ffd4e7cf75cc307ad7e13df23e..1c82d824ae0078ea57d1cf3810f04bfd4e682dc0 100644 (file)
@@ -1365,7 +1365,7 @@ static void panel_process_inputs(void)
                                break;
                        input->rise_timer = 0;
                        input->state = INPUT_ST_RISING;
-                       /* fall through */
+                       fallthrough;
                case INPUT_ST_RISING:
                        if ((phys_curr & input->mask) != input->value) {
                                input->state = INPUT_ST_LOW;
@@ -1378,11 +1378,11 @@ static void panel_process_inputs(void)
                        }
                        input->high_timer = 0;
                        input->state = INPUT_ST_HIGH;
-                       /* fall through */
+                       fallthrough;
                case INPUT_ST_HIGH:
                        if (input_state_high(input))
                                break;
-                       /* fall through */
+                       fallthrough;
                case INPUT_ST_FALLING:
                        input_state_falling(input);
                }
index ac1046a382bc027153be5148424ffde43c3b320e..bb5806a2bd4ca7cc1920096104a7eb2fe8b5d8e2 100644 (file)
@@ -807,9 +807,7 @@ static void device_link_put_kref(struct device_link *link)
 void device_link_del(struct device_link *link)
 {
        device_links_write_lock();
-       device_pm_lock();
        device_link_put_kref(link);
-       device_pm_unlock();
        device_links_write_unlock();
 }
 EXPORT_SYMBOL_GPL(device_link_del);
@@ -830,7 +828,6 @@ void device_link_remove(void *consumer, struct device *supplier)
                return;
 
        device_links_write_lock();
-       device_pm_lock();
 
        list_for_each_entry(link, &supplier->links.consumers, s_node) {
                if (link->consumer == consumer) {
@@ -839,7 +836,6 @@ void device_link_remove(void *consumer, struct device *supplier)
                }
        }
 
-       device_pm_unlock();
        device_links_write_unlock();
 }
 EXPORT_SYMBOL_GPL(device_link_remove);
@@ -4237,10 +4233,10 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
        vaf.va = &args;
 
        if (err != -EPROBE_DEFER) {
-               dev_err(dev, "error %d: %pV", err, &vaf);
+               dev_err(dev, "error %pe: %pV", ERR_PTR(err), &vaf);
        } else {
                device_set_deferred_probe_reason(dev, &vaf);
-               dev_dbg(dev, "error %d: %pV", err, &vaf);
+               dev_dbg(dev, "error %pe: %pV", ERR_PTR(err), &vaf);
        }
 
        va_end(args);
@@ -4264,9 +4260,9 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
  */
 void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
 {
-       if (fwnode) {
-               struct fwnode_handle *fn = dev->fwnode;
+       struct fwnode_handle *fn = dev->fwnode;
 
+       if (fwnode) {
                if (fwnode_is_primary(fn))
                        fn = fn->secondary;
 
@@ -4276,8 +4272,12 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
                }
                dev->fwnode = fwnode;
        } else {
-               dev->fwnode = fwnode_is_primary(dev->fwnode) ?
-                       dev->fwnode->secondary : NULL;
+               if (fwnode_is_primary(fn)) {
+                       dev->fwnode = fn->secondary;
+                       fn->secondary = NULL;
+               } else {
+                       dev->fwnode = NULL;
+               }
        }
 }
 EXPORT_SYMBOL_GPL(set_primary_fwnode);
index 5327bfc6ba719c333af665ff526cc5dbd9ae3f68..283ca2de76d45ea26a772c4b9330a61580ba269b 100644 (file)
@@ -289,10 +289,10 @@ static ssize_t firmware_loading_store(struct device *dev,
                        }
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        default:
                dev_err(dev, "%s: unexpected value (%d)\n", __func__, loading);
-               /* fallthrough */
+               fallthrough;
        case -1:
                fw_load_abort(fw_sysfs);
                break;
index 933e2192fbe8a13a7ed72f9c83587a85c8d8f984..d08efc77cf16a0f3d75ddc95ee6f92558e2ad2a2 100644 (file)
@@ -142,10 +142,12 @@ int assign_fw(struct firmware *fw, struct device *device, u32 opt_flags);
 void fw_free_paged_buf(struct fw_priv *fw_priv);
 int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed);
 int fw_map_paged_buf(struct fw_priv *fw_priv);
+bool fw_is_paged_buf(struct fw_priv *fw_priv);
 #else
 static inline void fw_free_paged_buf(struct fw_priv *fw_priv) {}
 static inline int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed) { return -ENXIO; }
 static inline int fw_map_paged_buf(struct fw_priv *fw_priv) { return -ENXIO; }
+static inline bool fw_is_paged_buf(struct fw_priv *fw_priv) { return false; }
 #endif
 
 #endif /* __FIRMWARE_LOADER_H */
index 9da0c9d5f538ea2ce87f1dc7d52bf05a4fce92b6..63b9714a0154855c9eacd1f3e3e5982a2a179e64 100644 (file)
@@ -252,9 +252,11 @@ static void __free_fw_priv(struct kref *ref)
        list_del(&fw_priv->list);
        spin_unlock(&fwc->lock);
 
-       fw_free_paged_buf(fw_priv); /* free leftover pages */
-       if (!fw_priv->allocated_size)
+       if (fw_is_paged_buf(fw_priv))
+               fw_free_paged_buf(fw_priv);
+       else if (!fw_priv->allocated_size)
                vfree(fw_priv->data);
+
        kfree_const(fw_priv->fw_name);
        kfree(fw_priv);
 }
@@ -268,6 +270,11 @@ static void free_fw_priv(struct fw_priv *fw_priv)
 }
 
 #ifdef CONFIG_FW_LOADER_PAGED_BUF
+bool fw_is_paged_buf(struct fw_priv *fw_priv)
+{
+       return fw_priv->is_paged_buf;
+}
+
 void fw_free_paged_buf(struct fw_priv *fw_priv)
 {
        int i;
@@ -275,6 +282,8 @@ void fw_free_paged_buf(struct fw_priv *fw_priv)
        if (!fw_priv->pages)
                return;
 
+       vunmap(fw_priv->data);
+
        for (i = 0; i < fw_priv->nr_pages; i++)
                __free_page(fw_priv->pages[i]);
        kvfree(fw_priv->pages);
@@ -328,10 +337,6 @@ int fw_map_paged_buf(struct fw_priv *fw_priv)
        if (!fw_priv->data)
                return -ENOMEM;
 
-       /* page table is no longer needed after mapping, let's free */
-       kvfree(fw_priv->pages);
-       fw_priv->pages = NULL;
-
        return 0;
 }
 #endif
index 508b80f6329b4e06f1fbd4958ea006f146334c91..50af16e68d98d1f364dca0980b8b72a5891be239 100644 (file)
@@ -761,14 +761,36 @@ static int __ref get_nid_for_pfn(unsigned long pfn)
        return pfn_to_nid(pfn);
 }
 
+static int do_register_memory_block_under_node(int nid,
+                                              struct memory_block *mem_blk)
+{
+       int ret;
+
+       /*
+        * If this memory block spans multiple nodes, we only indicate
+        * the last processed node.
+        */
+       mem_blk->nid = nid;
+
+       ret = sysfs_create_link_nowarn(&node_devices[nid]->dev.kobj,
+                                      &mem_blk->dev.kobj,
+                                      kobject_name(&mem_blk->dev.kobj));
+       if (ret)
+               return ret;
+
+       return sysfs_create_link_nowarn(&mem_blk->dev.kobj,
+                               &node_devices[nid]->dev.kobj,
+                               kobject_name(&node_devices[nid]->dev.kobj));
+}
+
 /* register memory section under specified node if it spans that node */
-static int register_mem_sect_under_node(struct memory_block *mem_blk,
-                                        void *arg)
+static int register_mem_block_under_node_early(struct memory_block *mem_blk,
+                                              void *arg)
 {
        unsigned long memory_block_pfns = memory_block_size_bytes() / PAGE_SIZE;
        unsigned long start_pfn = section_nr_to_pfn(mem_blk->start_section_nr);
        unsigned long end_pfn = start_pfn + memory_block_pfns - 1;
-       int ret, nid = *(int *)arg;
+       int nid = *(int *)arg;
        unsigned long pfn;
 
        for (pfn = start_pfn; pfn <= end_pfn; pfn++) {
@@ -785,38 +807,33 @@ static int register_mem_sect_under_node(struct memory_block *mem_blk,
                }
 
                /*
-                * We need to check if page belongs to nid only for the boot
-                * case, during hotplug we know that all pages in the memory
-                * block belong to the same node.
-                */
-               if (system_state == SYSTEM_BOOTING) {
-                       page_nid = get_nid_for_pfn(pfn);
-                       if (page_nid < 0)
-                               continue;
-                       if (page_nid != nid)
-                               continue;
-               }
-
-               /*
-                * If this memory block spans multiple nodes, we only indicate
-                * the last processed node.
+                * We need to check if page belongs to nid only at the boot
+                * case because node's ranges can be interleaved.
                 */
-               mem_blk->nid = nid;
-
-               ret = sysfs_create_link_nowarn(&node_devices[nid]->dev.kobj,
-                                       &mem_blk->dev.kobj,
-                                       kobject_name(&mem_blk->dev.kobj));
-               if (ret)
-                       return ret;
+               page_nid = get_nid_for_pfn(pfn);
+               if (page_nid < 0)
+                       continue;
+               if (page_nid != nid)
+                       continue;
 
-               return sysfs_create_link_nowarn(&mem_blk->dev.kobj,
-                               &node_devices[nid]->dev.kobj,
-                               kobject_name(&node_devices[nid]->dev.kobj));
+               return do_register_memory_block_under_node(nid, mem_blk);
        }
        /* mem section does not span the specified node */
        return 0;
 }
 
+/*
+ * During hotplug we know that all pages in the memory block belong to the same
+ * node.
+ */
+static int register_mem_block_under_node_hotplug(struct memory_block *mem_blk,
+                                                void *arg)
+{
+       int nid = *(int *)arg;
+
+       return do_register_memory_block_under_node(nid, mem_blk);
+}
+
 /*
  * Unregister a memory block device under the node it spans. Memory blocks
  * with multiple nodes cannot be offlined and therefore also never be removed.
@@ -832,11 +849,19 @@ void unregister_memory_block_under_nodes(struct memory_block *mem_blk)
                          kobject_name(&node_devices[mem_blk->nid]->dev.kobj));
 }
 
-int link_mem_sections(int nid, unsigned long start_pfn, unsigned long end_pfn)
+int link_mem_sections(int nid, unsigned long start_pfn, unsigned long end_pfn,
+                     enum meminit_context context)
 {
+       walk_memory_blocks_func_t func;
+
+       if (context == MEMINIT_HOTPLUG)
+               func = register_mem_block_under_node_hotplug;
+       else
+               func = register_mem_block_under_node_early;
+
        return walk_memory_blocks(PFN_PHYS(start_pfn),
                                  PFN_PHYS(end_pfn - start_pfn), (void *)&nid,
-                                 register_mem_sect_under_node);
+                                 func);
 }
 
 #ifdef CONFIG_HUGETLBFS
index 9dd85bea40260a951a805a6c44100c7b6e500149..205a06752ca90c4bfe601477cc203c5dc6007302 100644 (file)
@@ -1606,13 +1606,17 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
        }
 
        /*
-        * If a device configured to wake up the system from sleep states
-        * has been suspended at run time and there's a resume request pending
-        * for it, this is equivalent to the device signaling wakeup, so the
-        * system suspend operation should be aborted.
+        * Wait for possible runtime PM transitions of the device in progress
+        * to complete and if there's a runtime resume request pending for it,
+        * resume it before proceeding with invoking the system-wide suspend
+        * callbacks for it.
+        *
+        * If the system-wide suspend callbacks below change the configuration
+        * of the device, they must disable runtime PM for it or otherwise
+        * ensure that its runtime-resume callbacks will not be confused by that
+        * change in case they are invoked going forward.
         */
-       if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
-               pm_wakeup_event(dev, 0);
+       pm_runtime_barrier(dev);
 
        if (pm_wakeup_pending()) {
                dev->power.direct_complete = false;
index 3d80c4b43f72017c670329cb744230fee176933c..7be2fcfeea52bc24a237199052f4c85ec9408e13 100644 (file)
@@ -217,7 +217,7 @@ struct regmap_field {
 
 #ifdef CONFIG_DEBUG_FS
 extern void regmap_debugfs_initcall(void);
-extern void regmap_debugfs_init(struct regmap *map, const char *name);
+extern void regmap_debugfs_init(struct regmap *map);
 extern void regmap_debugfs_exit(struct regmap *map);
 
 static inline void regmap_debugfs_disable(struct regmap *map)
@@ -227,7 +227,7 @@ static inline void regmap_debugfs_disable(struct regmap *map)
 
 #else
 static inline void regmap_debugfs_initcall(void) { }
-static inline void regmap_debugfs_init(struct regmap *map, const char *name) { }
+static inline void regmap_debugfs_init(struct regmap *map) { }
 static inline void regmap_debugfs_exit(struct regmap *map) { }
 static inline void regmap_debugfs_disable(struct regmap *map) { }
 #endif
@@ -259,7 +259,7 @@ bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
 int regcache_lookup_reg(struct regmap *map, unsigned int reg);
 
 int _regmap_raw_write(struct regmap *map, unsigned int reg,
-                     const void *val, size_t val_len);
+                     const void *val, size_t val_len, bool noinc);
 
 void regmap_async_complete_cb(struct regmap_async *async, int ret);
 
index a93cafd7be4f237a83bc169d7095d307349d6db0..7f4b3b62492ca3849fb08b0bbe888d8b548c12a7 100644 (file)
@@ -717,7 +717,7 @@ static int regcache_sync_block_raw_flush(struct regmap *map, const void **data,
 
        map->cache_bypass = true;
 
-       ret = _regmap_raw_write(map, base, *data, count * val_bytes);
+       ret = _regmap_raw_write(map, base, *data, count * val_bytes, false);
        if (ret)
                dev_err(map->dev, "Unable to sync registers %#x-%#x. %d\n",
                        base, cur - map->reg_stride, ret);
index f58baff2be0af6d0eb5e28091cce3a2c3a76a039..b6d63ef16b442e05053ff20e462251c449f51468 100644 (file)
@@ -17,7 +17,6 @@
 
 struct regmap_debugfs_node {
        struct regmap *map;
-       const char *name;
        struct list_head link;
 };
 
@@ -544,11 +543,12 @@ static const struct file_operations regmap_cache_bypass_fops = {
        .write = regmap_cache_bypass_write_file,
 };
 
-void regmap_debugfs_init(struct regmap *map, const char *name)
+void regmap_debugfs_init(struct regmap *map)
 {
        struct rb_node *next;
        struct regmap_range_node *range_node;
        const char *devname = "dummy";
+       const char *name = map->name;
 
        /*
         * Userspace can initiate reads from the hardware over debugfs.
@@ -569,7 +569,6 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
                if (!node)
                        return;
                node->map = map;
-               node->name = name;
                mutex_lock(&regmap_debugfs_early_lock);
                list_add(&node->link, &regmap_debugfs_early_list);
                mutex_unlock(&regmap_debugfs_early_lock);
@@ -679,7 +678,7 @@ void regmap_debugfs_initcall(void)
 
        mutex_lock(&regmap_debugfs_early_lock);
        list_for_each_entry_safe(node, tmp, &regmap_debugfs_early_list, link) {
-               regmap_debugfs_init(node->map, node->name);
+               regmap_debugfs_init(node->map);
                list_del(&node->link);
                kfree(node);
        }
index e93700af7e6e340f2663e113eea0034030e1c3b4..b71f9ecddff5dbcde9cec4af17b609594aaf16dd 100644 (file)
@@ -581,14 +581,34 @@ static void regmap_range_exit(struct regmap *map)
        kfree(map->selector_work_buf);
 }
 
+static int regmap_set_name(struct regmap *map, const struct regmap_config *config)
+{
+       if (config->name) {
+               const char *name = kstrdup_const(config->name, GFP_KERNEL);
+
+               if (!name)
+                       return -ENOMEM;
+
+               kfree_const(map->name);
+               map->name = name;
+       }
+
+       return 0;
+}
+
 int regmap_attach_dev(struct device *dev, struct regmap *map,
                      const struct regmap_config *config)
 {
        struct regmap **m;
+       int ret;
 
        map->dev = dev;
 
-       regmap_debugfs_init(map, config->name);
+       ret = regmap_set_name(map, config);
+       if (ret)
+               return ret;
+
+       regmap_debugfs_init(map);
 
        /* Add a devres resource for dev_get_regmap() */
        m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL);
@@ -687,13 +707,9 @@ struct regmap *__regmap_init(struct device *dev,
                goto err;
        }
 
-       if (config->name) {
-               map->name = kstrdup_const(config->name, GFP_KERNEL);
-               if (!map->name) {
-                       ret = -ENOMEM;
-                       goto err_map;
-               }
-       }
+       ret = regmap_set_name(map, config);
+       if (ret)
+               goto err_map;
 
        if (config->disable_locking) {
                map->lock = map->unlock = regmap_lock_unlock_none;
@@ -1137,7 +1153,7 @@ skip_format_initialization:
                if (ret != 0)
                        goto err_regcache;
        } else {
-               regmap_debugfs_init(map, config->name);
+               regmap_debugfs_init(map);
        }
 
        return map;
@@ -1297,6 +1313,8 @@ EXPORT_SYMBOL_GPL(regmap_field_free);
  */
 int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
 {
+       int ret;
+
        regcache_exit(map);
        regmap_debugfs_exit(map);
 
@@ -1309,7 +1327,11 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
        map->readable_noinc_reg = config->readable_noinc_reg;
        map->cache_type = config->cache_type;
 
-       regmap_debugfs_init(map, config->name);
+       ret = regmap_set_name(map, config);
+       if (ret)
+               return ret;
+
+       regmap_debugfs_init(map);
 
        map->cache_bypass = false;
        map->cache_only = false;
@@ -1464,7 +1486,7 @@ static void regmap_set_work_buf_flag_mask(struct regmap *map, int max_bytes,
 }
 
 static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
-                                 const void *val, size_t val_len)
+                                 const void *val, size_t val_len, bool noinc)
 {
        struct regmap_range_node *range;
        unsigned long flags;
@@ -1523,7 +1545,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
                                win_residue, val_len / map->format.val_bytes);
                        ret = _regmap_raw_write_impl(map, reg, val,
                                                     win_residue *
-                                                    map->format.val_bytes);
+                                                    map->format.val_bytes, noinc);
                        if (ret != 0)
                                return ret;
 
@@ -1537,7 +1559,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
                        win_residue = range->window_len - win_offset;
                }
 
-               ret = _regmap_select_page(map, &reg, range, val_num);
+               ret = _regmap_select_page(map, &reg, range, noinc ? 1 : val_num);
                if (ret != 0)
                        return ret;
        }
@@ -1745,7 +1767,8 @@ static int _regmap_bus_raw_write(void *context, unsigned int reg,
                                      map->work_buf +
                                      map->format.reg_bytes +
                                      map->format.pad_bytes,
-                                     map->format.val_bytes);
+                                     map->format.val_bytes,
+                                     false);
 }
 
 static inline void *_regmap_map_get_context(struct regmap *map)
@@ -1839,7 +1862,7 @@ int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val)
 EXPORT_SYMBOL_GPL(regmap_write_async);
 
 int _regmap_raw_write(struct regmap *map, unsigned int reg,
-                     const void *val, size_t val_len)
+                     const void *val, size_t val_len, bool noinc)
 {
        size_t val_bytes = map->format.val_bytes;
        size_t val_count = val_len / val_bytes;
@@ -1860,7 +1883,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
 
        /* Write as many bytes as possible with chunk_size */
        for (i = 0; i < chunk_count; i++) {
-               ret = _regmap_raw_write_impl(map, reg, val, chunk_bytes);
+               ret = _regmap_raw_write_impl(map, reg, val, chunk_bytes, noinc);
                if (ret)
                        return ret;
 
@@ -1871,7 +1894,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
 
        /* Write remaining bytes */
        if (val_len)
-               ret = _regmap_raw_write_impl(map, reg, val, val_len);
+               ret = _regmap_raw_write_impl(map, reg, val, val_len, noinc);
 
        return ret;
 }
@@ -1904,7 +1927,7 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
 
        map->lock(map->lock_arg);
 
-       ret = _regmap_raw_write(map, reg, val, val_len);
+       ret = _regmap_raw_write(map, reg, val, val_len, false);
 
        map->unlock(map->lock_arg);
 
@@ -1962,7 +1985,7 @@ int regmap_noinc_write(struct regmap *map, unsigned int reg,
                        write_len = map->max_raw_write;
                else
                        write_len = val_len;
-               ret = _regmap_raw_write(map, reg, val, write_len);
+               ret = _regmap_raw_write(map, reg, val, write_len, true);
                if (ret)
                        goto out_unlock;
                val = ((u8 *)val) + write_len;
@@ -2439,7 +2462,7 @@ int regmap_raw_write_async(struct regmap *map, unsigned int reg,
 
        map->async = true;
 
-       ret = _regmap_raw_write(map, reg, val, val_len);
+       ret = _regmap_raw_write(map, reg, val, val_len, false);
 
        map->async = false;
 
@@ -2450,7 +2473,7 @@ int regmap_raw_write_async(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_raw_write_async);
 
 static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
-                           unsigned int val_len)
+                           unsigned int val_len, bool noinc)
 {
        struct regmap_range_node *range;
        int ret;
@@ -2463,7 +2486,7 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
        range = _regmap_range_lookup(map, reg);
        if (range) {
                ret = _regmap_select_page(map, &reg, range,
-                                         val_len / map->format.val_bytes);
+                                         noinc ? 1 : val_len / map->format.val_bytes);
                if (ret != 0)
                        return ret;
        }
@@ -2501,7 +2524,7 @@ static int _regmap_bus_read(void *context, unsigned int reg,
        if (!map->format.parse_val)
                return -EINVAL;
 
-       ret = _regmap_raw_read(map, reg, work_val, map->format.val_bytes);
+       ret = _regmap_raw_read(map, reg, work_val, map->format.val_bytes, false);
        if (ret == 0)
                *val = map->format.parse_val(work_val);
 
@@ -2617,7 +2640,7 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 
                /* Read bytes that fit into whole chunks */
                for (i = 0; i < chunk_count; i++) {
-                       ret = _regmap_raw_read(map, reg, val, chunk_bytes);
+                       ret = _regmap_raw_read(map, reg, val, chunk_bytes, false);
                        if (ret != 0)
                                goto out;
 
@@ -2628,7 +2651,7 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 
                /* Read remaining bytes */
                if (val_len) {
-                       ret = _regmap_raw_read(map, reg, val, val_len);
+                       ret = _regmap_raw_read(map, reg, val, val_len, false);
                        if (ret != 0)
                                goto out;
                }
@@ -2703,7 +2726,7 @@ int regmap_noinc_read(struct regmap *map, unsigned int reg,
                        read_len = map->max_raw_read;
                else
                        read_len = val_len;
-               ret = _regmap_raw_read(map, reg, val, read_len);
+               ret = _regmap_raw_read(map, reg, val, read_len, true);
                if (ret)
                        goto out_unlock;
                val = ((u8 *)val) + read_len;
index 3cf9bc5d8d9599abd13600af41f9f59d3c682ca8..6dba4139515517d5012f47591e1b740d15f44a86 100644 (file)
@@ -1135,7 +1135,7 @@ noskb:            if (buf)
                        break;
                }
                bvcpy(skb, f->buf->bio, f->iter, n);
-               /* fall through */
+               fallthrough;
        case ATA_CMD_PIO_WRITE:
        case ATA_CMD_PIO_WRITE_EXT:
                spin_lock_irq(&d->lock);
index 1553d41f0b9161dc632b409802e4e7a962934c60..a50e13af030526ddcd8bb7a2a05a697b3791d537 100644 (file)
@@ -1726,7 +1726,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode,
                /* MSch: invalidate default_params */
                default_params[drive].blocks  = 0;
                set_capacity(floppy->disk, MAX_DISK_SIZE * 2);
-               /* Fall through */
+               fallthrough;
        case FDFMTEND:
        case FDFLUSH:
                /* invalidate the buffer track to force a reread */
index fe6cb99eb917644d1c4b963eae79bb6b53a6bda1..740e93bad21feb65e8d2a077e62e30fe5aba2f90 100644 (file)
@@ -1733,7 +1733,7 @@ static inline void __drbd_chk_io_error_(struct drbd_device *device,
                                _drbd_set_state(_NS(device, disk, D_INCONSISTENT), CS_HARD, NULL);
                        break;
                }
-               /* fall through - for DRBD_META_IO_ERROR or DRBD_FORCE_DETACH */
+               fallthrough;    /* for DRBD_META_IO_ERROR or DRBD_FORCE_DETACH */
        case EP_DETACH:
        case EP_CALL_HELPER:
                /* Remember whether we saw a READ or WRITE error.
index cb687ccdbd96f04dc2e84d20a5f9317f0de2ed04..04b6bde9419d2a49d74d7d9d65442c72dffafcdc 100644 (file)
@@ -430,7 +430,7 @@ int drbd_thread_start(struct drbd_thread *thi)
                thi->t_state = RESTARTING;
                drbd_info(resource, "Restarting %s thread (from %s [%d])\n",
                                thi->name, current->comm, current->pid);
-               /* fall through */
+               fallthrough;
        case RUNNING:
        case RESTARTING:
        default:
index 28eb078f8b754d669e39129e8d7bb8e4c55f5b48..43c8ae4d9fca812bb770d89ba967a378778ea950 100644 (file)
@@ -3883,7 +3883,7 @@ static int nla_put_status_info(struct sk_buff *skb, struct drbd_device *device,
                        if (nla_put_u32(skb, T_helper_exit_code,
                                        sib->helper_exit_code))
                                goto nla_put_failure;
-                       /* fall through */
+                       fallthrough;
                case SIB_HELPER_PRE:
                        if (nla_put_string(skb, T_helper, sib->helper_name))
                                goto nla_put_failure;
index 1d17593f5d2bb7a4059eb91b4b425b6ca8391c58..422363daa6180b54a35ce1ee15d36ca1cc0afa80 100644 (file)
@@ -1797,7 +1797,7 @@ static int receive_Barrier(struct drbd_connection *connection, struct packet_inf
                        break;
                else
                        drbd_warn(connection, "Allocation of an epoch failed, slowing down\n");
-                       /* Fall through */
+               fallthrough;
 
        case WO_BDEV_FLUSH:
        case WO_DRAIN_IO:
@@ -2917,7 +2917,7 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet
                   then we would do something smarter here than reading
                   the block... */
                peer_req->flags |= EE_RS_THIN_REQ;
-               /* fall through */
+               fallthrough;
        case P_RS_DATA_REQUEST:
                peer_req->w.cb = w_e_end_rsdata_req;
                fault_type = DRBD_FAULT_RS_RD;
@@ -3083,7 +3083,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold
                        rv =  1;
                        break;
                }
-               /* Else fall through - to one of the other strategies... */
+               fallthrough;    /* to one of the other strategies */
        case ASB_DISCARD_OLDER_PRI:
                if (self == 0 && peer == 1) {
                        rv = 1;
@@ -3096,7 +3096,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold
                /* Else fall through to one of the other strategies... */
                drbd_warn(device, "Discard younger/older primary did not find a decision\n"
                     "Using discard-least-changes instead\n");
-               /* fall through */
+               fallthrough;
        case ASB_DISCARD_ZERO_CHG:
                if (ch_peer == 0 && ch_self == 0) {
                        rv = test_bit(RESOLVE_CONFLICTS, &peer_device->connection->flags)
@@ -3108,7 +3108,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold
                }
                if (after_sb_0p == ASB_DISCARD_ZERO_CHG)
                        break;
-               /* else, fall through */
+               fallthrough;
        case ASB_DISCARD_LEAST_CHG:
                if      (ch_self < ch_peer)
                        rv = -1;
@@ -3608,7 +3608,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_peer_device *peer_device,
                switch (rr_conflict) {
                case ASB_CALL_HELPER:
                        drbd_khelper(device, "pri-lost");
-                       /* fall through */
+                       fallthrough;
                case ASB_DISCONNECT:
                        drbd_err(device, "I shall become SyncTarget, but I am primary!\n");
                        return C_MASK;
index 674be09b2da94af5534212f1ecde6a33898ff14e..5c975af9c15fb89d7b78ec16dfee8f6bad962611 100644 (file)
@@ -611,7 +611,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
                drbd_set_out_of_sync(device, req->i.sector, req->i.size);
                drbd_report_io_error(device, req);
                __drbd_chk_io_error(device, DRBD_READ_ERROR);
-               /* fall through. */
+               fallthrough;
        case READ_AHEAD_COMPLETED_WITH_ERROR:
                /* it is legal to fail read-ahead, no __drbd_chk_io_error in that case. */
                mod_rq_state(req, m, RQ_LOCAL_PENDING, RQ_LOCAL_COMPLETED);
@@ -836,7 +836,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
                        } /* else: FIXME can this happen? */
                        break;
                }
-               /* else, fall through - to BARRIER_ACKED */
+               fallthrough;    /* to BARRIER_ACKED */
 
        case BARRIER_ACKED:
                /* barrier ack for READ requests does not make sense */
index 09079aee8dc43056ab4780339f1e87697c76dc13..a563b023458a8b2e5a931fd822dc4b7c7b29e2ad 100644 (file)
@@ -1680,7 +1680,7 @@ static void recal_interrupt(void)
                        clear_bit(FD_DISK_NEWCHANGE_BIT,
                                  &drive_state[current_drive].flags);
                        drive_state[current_drive].select_date = jiffies;
-                       /* fall through */
+                       fallthrough;
                default:
                        debugt(__func__, "default");
                        /* Recalibrate moves the head by at
@@ -3592,7 +3592,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
                if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)
                        return -EINTR;
                process_fd_request();
-               /* fall through */
+               fallthrough;
        case FDGETDRVSTAT:
                outparam = &drive_state[drive];
                break;
index 2f137d6ce169d581a144870744d39a3faeafd089..d3394191e16825267b222fff6e03f979bbf12f31 100644 (file)
@@ -878,6 +878,7 @@ static void loop_config_discard(struct loop_device *lo)
        struct file *file = lo->lo_backing_file;
        struct inode *inode = file->f_mapping->host;
        struct request_queue *q = lo->lo_queue;
+       u32 granularity, max_discard_sectors;
 
        /*
         * If the backing device is a block device, mirror its zeroing
@@ -890,11 +891,10 @@ static void loop_config_discard(struct loop_device *lo)
                struct request_queue *backingq;
 
                backingq = bdev_get_queue(inode->i_bdev);
-               blk_queue_max_discard_sectors(q,
-                       backingq->limits.max_write_zeroes_sectors);
 
-               blk_queue_max_write_zeroes_sectors(q,
-                       backingq->limits.max_write_zeroes_sectors);
+               max_discard_sectors = backingq->limits.max_write_zeroes_sectors;
+               granularity = backingq->limits.discard_granularity ?:
+                       queue_physical_block_size(backingq);
 
        /*
         * We use punch hole to reclaim the free space used by the
@@ -903,23 +903,26 @@ static void loop_config_discard(struct loop_device *lo)
         * useful information.
         */
        } else if (!file->f_op->fallocate || lo->lo_encrypt_key_size) {
-               q->limits.discard_granularity = 0;
-               q->limits.discard_alignment = 0;
-               blk_queue_max_discard_sectors(q, 0);
-               blk_queue_max_write_zeroes_sectors(q, 0);
+               max_discard_sectors = 0;
+               granularity = 0;
 
        } else {
-               q->limits.discard_granularity = inode->i_sb->s_blocksize;
-               q->limits.discard_alignment = 0;
-
-               blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
-               blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9);
+               max_discard_sectors = UINT_MAX >> 9;
+               granularity = inode->i_sb->s_blocksize;
        }
 
-       if (q->limits.max_write_zeroes_sectors)
+       if (max_discard_sectors) {
+               q->limits.discard_granularity = granularity;
+               blk_queue_max_discard_sectors(q, max_discard_sectors);
+               blk_queue_max_write_zeroes_sectors(q, max_discard_sectors);
                blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
-       else
+       } else {
+               q->limits.discard_granularity = 0;
+               blk_queue_max_discard_sectors(q, 0);
+               blk_queue_max_write_zeroes_sectors(q, 0);
                blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q);
+       }
+       q->limits.discard_alignment = 0;
 }
 
 static void loop_unprepare_queue(struct loop_device *lo)
@@ -1111,8 +1114,6 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
        mapping = file->f_mapping;
        inode = mapping->host;
 
-       size = get_loop_size(lo, file);
-
        if ((config->info.lo_flags & ~LOOP_CONFIGURE_SETTABLE_FLAGS) != 0) {
                error = -EINVAL;
                goto out_unlock;
@@ -1162,6 +1163,8 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
        loop_update_rotational(lo);
        loop_update_dio(lo);
        loop_sysfs_init(lo);
+
+       size = get_loop_size(lo, file);
        loop_set_size(lo, size);
 
        set_blocksize(bdev, S_ISBLK(inode->i_mode) ?
@@ -1719,7 +1722,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
        case LOOP_SET_BLOCK_SIZE:
                if (!(mode & FMODE_WRITE) && !capable(CAP_SYS_ADMIN))
                        return -EPERM;
-               /* Fall through */
+               fallthrough;
        default:
                err = lo_simple_ioctl(lo, cmd, arg);
                break;
@@ -1867,7 +1870,7 @@ static int lo_compat_ioctl(struct block_device *bdev, fmode_t mode,
        case LOOP_SET_STATUS64:
        case LOOP_CONFIGURE:
                arg = (unsigned long) compat_ptr(arg);
-               /* fall through */
+               fallthrough;
        case LOOP_SET_FD:
        case LOOP_CHANGE_FD:
        case LOOP_SET_BLOCK_SIZE:
index 3ff4054d6834d25f2b8afae4e99d5e2db2994f4e..edf8b632e3d27b4b907a52dd55e41e3a6b8a03ef 100644 (file)
@@ -1363,6 +1363,8 @@ static void nbd_set_cmd_timeout(struct nbd_device *nbd, u64 timeout)
        nbd->tag_set.timeout = timeout * HZ;
        if (timeout)
                blk_queue_rq_timeout(nbd->disk->queue, timeout * HZ);
+       else
+               blk_queue_rq_timeout(nbd->disk->queue, 30 * HZ);
 }
 
 /* Must be called with config_lock held */
index 47a9dad880af2aac70567889f13dc42680be9a0c..d74443a9c8fa233d8fa7870b4d326e7595ac747c 100644 (file)
@@ -1147,7 +1147,7 @@ static int null_handle_rq(struct nullb_cmd *cmd)
                len = bvec.bv_len;
                err = null_transfer(nullb, bvec.bv_page, len, bvec.bv_offset,
                                     op_is_write(req_op(rq)), sector,
-                                    req_op(rq) & REQ_FUA);
+                                    rq->cmd_flags & REQ_FUA);
                if (err) {
                        spin_unlock_irq(&nullb->lock);
                        return err;
index c0967507d085e4e3cbc188a79e48db52470db1d0..a7af4f27b7c3f11eb3205a6d0bebcd2661bad7d5 100644 (file)
@@ -440,7 +440,7 @@ static void run_fsm(void)
                                pd_claimed = 1;
                                if (!pi_schedule_claimed(pi_current, run_fsm))
                                        return;
-                               /* fall through */
+                               fallthrough;
                        case 1:
                                pd_claimed = 2;
                                pi_current->proto->connect(pi_current);
@@ -465,7 +465,7 @@ static void run_fsm(void)
                                if (stop)
                                        return;
                                }
-                               /* fall through */
+                               fallthrough;
                        case Hold:
                                schedule_fsm();
                                return;
index 4becc1efe775fc761f44c2762878a34122d53e79..1034e445680c5621e6e6bf0a5183fcfc81b658e6 100644 (file)
@@ -2641,7 +2641,7 @@ static int pkt_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
                 */
                if (pd->refcnt == 1)
                        pkt_lock_door(pd, 0);
-               /* fall through */
+               fallthrough;
        /*
         * forward selected CDROM ioctls to CD-ROM, for UDF
         */
index d9c0e7d154f9f116b15f2065524eab4fa2e059aa..e77eaab5cf23ed1192be0b9bbebb32fb238a136d 100644 (file)
@@ -3293,7 +3293,7 @@ again:
        case __RBD_OBJ_COPYUP_OBJECT_MAPS:
                if (!pending_result_dec(&obj_req->pending, result))
                        return false;
-               /* fall through */
+               fallthrough;
        case RBD_OBJ_COPYUP_OBJECT_MAPS:
                if (*result) {
                        rbd_warn(rbd_dev, "snap object map update failed: %d",
@@ -3312,7 +3312,7 @@ again:
        case __RBD_OBJ_COPYUP_WRITE_OBJECT:
                if (!pending_result_dec(&obj_req->pending, result))
                        return false;
-               /* fall through */
+               fallthrough;
        case RBD_OBJ_COPYUP_WRITE_OBJECT:
                return true;
        default:
@@ -3399,7 +3399,7 @@ again:
        case __RBD_OBJ_WRITE_COPYUP:
                if (!rbd_obj_advance_copyup(obj_req, result))
                        return false;
-               /* fall through */
+               fallthrough;
        case RBD_OBJ_WRITE_COPYUP:
                if (*result) {
                        rbd_warn(rbd_dev, "copyup failed: %d", *result);
@@ -3592,7 +3592,7 @@ again:
        case __RBD_IMG_OBJECT_REQUESTS:
                if (!pending_result_dec(&img_req->pending, result))
                        return false;
-               /* fall through */
+               fallthrough;
        case RBD_IMG_OBJECT_REQUESTS:
                return true;
        default:
@@ -5120,6 +5120,9 @@ static ssize_t rbd_config_info_show(struct device *dev,
 {
        struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
 
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
        return sprintf(buf, "%s\n", rbd_dev->config_info);
 }
 
@@ -5231,6 +5234,9 @@ static ssize_t rbd_image_refresh(struct device *dev,
        struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
        int ret;
 
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
        ret = rbd_dev_refresh(rbd_dev);
        if (ret)
                return ret;
@@ -7059,6 +7065,9 @@ static ssize_t do_rbd_add(struct bus_type *bus,
        struct rbd_client *rbdc;
        int rc;
 
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
        if (!try_module_get(THIS_MODULE))
                return -ENODEV;
 
@@ -7209,6 +7218,9 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
        bool force = false;
        int ret;
 
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
        dev_id = -1;
        opt_buf[0] = '\0';
        sscanf(buf, "%d %5s", &dev_id, opt_buf);
index 0fb94843a495f96566ce159639e5d8faf1cbf7ca..e1bc8b4cd5929000b97a4b2172df285e649c0485 100644 (file)
@@ -148,7 +148,8 @@ static int process_rdma(struct rtrs_srv *sess,
        /* Generate bio with pages pointing to the rdma buffer */
        bio = rnbd_bio_map_kern(data, sess_dev->rnbd_dev->ibd_bio_set, datalen, GFP_KERNEL);
        if (IS_ERR(bio)) {
-               rnbd_srv_err(sess_dev, "Failed to generate bio, err: %ld\n", PTR_ERR(bio));
+               err = PTR_ERR(bio);
+               rnbd_srv_err(sess_dev, "Failed to generate bio, err: %d\n", err);
                goto sess_dev_put;
        }
 
index 7e261224ff1065d267b5fe4b6885c03c13462dc2..8799e3bab0677ba4b47d814860a361c89f10d0f3 100644 (file)
@@ -425,7 +425,7 @@ static void card_state_change(struct rsxx_cardinfo *card,
                 * Fall through so the DMA devices can be attached and
                 * the user can attempt to pull off their data.
                 */
-               /* fall through */
+               fallthrough;
        case CARD_STATE_GOOD:
                st = rsxx_get_card_size8(card, &card->size8);
                if (st)
index 3a476dc1d14f57b5fceee13550bf9f6dacbf5590..ae6454c24594f9eb81b568b33d29951f4a2eaba6 100644 (file)
@@ -1436,7 +1436,7 @@ static void skd_resolve_req_exception(struct skd_device *skdev,
                        blk_mq_requeue_request(req, true);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case SKD_CHECK_STATUS_REPORT_ERROR:
        default:
index 63b213e00b37525767a70e4e9f6b2c33324941a3..b2e48dac1ebdb88308d59a27cefdf2df853c3dfd 100644 (file)
@@ -126,16 +126,31 @@ static int virtblk_setup_discard_write_zeroes(struct request *req, bool unmap)
        if (!range)
                return -ENOMEM;
 
-       __rq_for_each_bio(bio, req) {
-               u64 sector = bio->bi_iter.bi_sector;
-               u32 num_sectors = bio->bi_iter.bi_size >> SECTOR_SHIFT;
-
-               range[n].flags = cpu_to_le32(flags);
-               range[n].num_sectors = cpu_to_le32(num_sectors);
-               range[n].sector = cpu_to_le64(sector);
-               n++;
+       /*
+        * Single max discard segment means multi-range discard isn't
+        * supported, and block layer only runs contiguity merge like
+        * normal RW request. So we can't reply on bio for retrieving
+        * each range info.
+        */
+       if (queue_max_discard_segments(req->q) == 1) {
+               range[0].flags = cpu_to_le32(flags);
+               range[0].num_sectors = cpu_to_le32(blk_rq_sectors(req));
+               range[0].sector = cpu_to_le64(blk_rq_pos(req));
+               n = 1;
+       } else {
+               __rq_for_each_bio(bio, req) {
+                       u64 sector = bio->bi_iter.bi_sector;
+                       u32 num_sectors = bio->bi_iter.bi_size >> SECTOR_SHIFT;
+
+                       range[n].flags = cpu_to_le32(flags);
+                       range[n].num_sectors = cpu_to_le32(num_sectors);
+                       range[n].sector = cpu_to_le64(sector);
+                       n++;
+               }
        }
 
+       WARN_ON_ONCE(n != segments);
+
        req->special_vec.bv_page = virt_to_page(range);
        req->special_vec.bv_offset = offset_in_page(range);
        req->special_vec.bv_len = sizeof(*range) * segments;
index c2f71265af4b57fb7341fccc510b76211a609d35..adfc9352351dfbc4d48794b17d9d4ff3e886efd3 100644 (file)
@@ -1260,7 +1260,7 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
                break;
        case BLKIF_OP_WRITE_BARRIER:
                drain = true;
-               /* fall through */
+               fallthrough;
        case BLKIF_OP_FLUSH_DISKCACHE:
                ring->st_f_req++;
                operation = REQ_OP_WRITE;
index 42944d41aea0385440b0bf67d3762ad4f904ba28..b9aa5d1ac10b7ffcf0809501500719c2610f25f6 100644 (file)
@@ -843,7 +843,7 @@ static void frontend_changed(struct xenbus_device *dev,
                xenbus_switch_state(dev, XenbusStateClosed);
                if (xenbus_dev_is_online(dev))
                        break;
-               /* fall through */
+               fallthrough;
                /* if not online */
        case XenbusStateUnknown:
                /* implies xen_blkif_disconnect() via xen_blkbk_remove() */
index 3bb3dd8da9b0c101ecedef262966e5eb56f51549..91de2e0755aec49fb4a12b3c76eb1a60a3710ad5 100644 (file)
@@ -1403,7 +1403,6 @@ static enum blk_req_status blkif_rsp_to_req_status(int rsp)
        case BLKIF_RSP_EOPNOTSUPP:
                return REQ_EOPNOTSUPP;
        case BLKIF_RSP_ERROR:
-               /* Fallthrough. */
        default:
                return REQ_ERROR;
        }
@@ -1643,7 +1642,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
                                info->feature_flush = 0;
                                xlvbd_flush(info);
                        }
-                       /* fall through */
+                       fallthrough;
                case BLKIF_OP_READ:
                case BLKIF_OP_WRITE:
                        if (unlikely(bret->status != BLKIF_RSP_OKAY))
@@ -2484,7 +2483,7 @@ static void blkback_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through */
+               fallthrough;
        case XenbusStateClosing:
                if (info)
                        blkfront_closing(info);
index fb5a901fd89e57bb4f69b71c3c715bd418ef2eb2..efb088df1276689bb59136fbd0816a3c74903eef 100644 (file)
@@ -1849,7 +1849,7 @@ static int sysc_clockdomain_init(struct sysc *ddata)
        switch (ddata->nr_clocks) {
        case 2:
                ick = ddata->clocks[SYSC_ICK];
-               /* fallthrough */
+               fallthrough;
        case 1:
                fck = ddata->clocks[SYSC_FCK];
                break;
index 89527bae4602a906bde52ee056bb9acb0306c01a..760d9a9312898bb879fb5222a0dea24e63b7b43d 100644 (file)
@@ -357,7 +357,7 @@ found:
                default:
                        break;
                }
-               /*FALLTHROUGH*/
+               fallthrough;
        default:
                bridge->driver = &ali_generic_bridge;
        }
index d704cef64b64a8c33a0a13b3c5b59be79bd21ce5..055cfe59f519dbc6c75154eadb9f06e529b86406 100644 (file)
@@ -92,8 +92,7 @@ static int ingenic_rng_probe(struct platform_device *pdev)
        priv->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->base)) {
                pr_err("%s: Failed to map RNG registers\n", __func__);
-               ret = PTR_ERR(priv->base);
-               goto err_free_rng;
+               return PTR_ERR(priv->base);
        }
 
        priv->version = (enum ingenic_rng_version)of_device_get_match_data(&pdev->dev);
@@ -106,17 +105,13 @@ static int ingenic_rng_probe(struct platform_device *pdev)
        ret = hwrng_register(&priv->rng);
        if (ret) {
                dev_err(&pdev->dev, "Failed to register hwrng\n");
-               goto err_free_rng;
+               return ret;
        }
 
        platform_set_drvdata(pdev, priv);
 
        dev_info(&pdev->dev, "Ingenic RNG driver registered\n");
        return 0;
-
-err_free_rng:
-       kfree(priv);
-       return ret;
 }
 
 static int ingenic_rng_remove(struct platform_device *pdev)
index ed4dc3b1843e3a06995750deda672b5bb830444a..f292e74bd4a51585dfa27df0d65aa55ad4993728 100644 (file)
@@ -99,7 +99,7 @@ static void kcs_bmc_handle_data(struct kcs_bmc *kcs_bmc)
        switch (kcs_bmc->phase) {
        case KCS_PHASE_WRITE_START:
                kcs_bmc->phase = KCS_PHASE_WRITE_DATA;
-               /* fall through */
+               fallthrough;
 
        case KCS_PHASE_WRITE_DATA:
                if (kcs_bmc->data_in_idx < KCS_MSG_BUFSIZ) {
index bd95aba1f9fe8eb9768b87a8a7fc602ee5adef8d..45932f05fd678f4e0d5524bca5e19262d21c316b 100644 (file)
@@ -734,7 +734,7 @@ static long lp_ioctl(struct file *file, unsigned int cmd,
                        ret = lp_set_timeout32(minor, (void __user *)arg);
                        break;
                }
-               /* fall through - for 64-bit */
+               fallthrough;    /* for 64-bit */
        case LPSETTIMEOUT_NEW:
                ret = lp_set_timeout64(minor, (void __user *)arg);
                break;
@@ -762,7 +762,7 @@ static long lp_compat_ioctl(struct file *file, unsigned int cmd,
                        ret = lp_set_timeout32(minor, (void __user *)arg);
                        break;
                }
-               /* fall through - for x32 mode */
+               fallthrough;    /* for x32 mode */
        case LPSETTIMEOUT_NEW:
                ret = lp_set_timeout64(minor, (void __user *)arg);
                break;
index 687d4af6945d365baebefee5b005eebfb17ad2d9..abd4ffdc8cdebc4ade04d4b77875bd894b063863 100644 (file)
@@ -791,7 +791,7 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig)
        switch (orig) {
        case SEEK_CUR:
                offset += file->f_pos;
-               /* fall through */
+               fallthrough;
        case SEEK_SET:
                /* to avoid userland mistaking f_pos=-9 as -EBADF=-9 */
                if ((unsigned long long)offset >= -MAX_ERRNO) {
index 8206412d25ba7ee326c929e86bc0c97850420ec7..e9f694b368719f40e9c26e4029ccb5ba263f604e 100644 (file)
@@ -286,7 +286,7 @@ static long nvram_misc_ioctl(struct file *file, unsigned int cmd,
 #ifdef CONFIG_PPC
        case OBSOLETE_PMAC_NVRAM_GET_OFFSET:
                pr_warn("nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n");
-               /* fall through */
+               fallthrough;
        case IOC_NVRAM_GET_OFFSET:
                ret = -EINVAL;
 #ifdef CONFIG_PPC_PMAC
index 784f12c72365be0a9e37d62846c5e0fc0bc7e274..ec738f74a026cf5788b9294716ac10307bdf1094 100644 (file)
@@ -5,6 +5,7 @@ config CLK_BCM2711_DVP
        depends on ARCH_BCM2835 ||COMPILE_TEST
        depends on COMMON_CLK
        default ARCH_BCM2835
+       select RESET_CONTROLLER
        select RESET_SIMPLE
        help
          Enable common clock framework support for the Broadcom BCM2711
index 6c35e4bb79404b84e11997190e88ab6a18601dad..0d750433eb42d8b65101d24231103a40f5815aab 100644 (file)
@@ -491,7 +491,7 @@ struct clk *davinci_pll_clk_register(struct device *dev,
                parent_name = postdiv_name;
        }
 
-       pllen = kzalloc(sizeof(*pllout), GFP_KERNEL);
+       pllen = kzalloc(sizeof(*pllen), GFP_KERNEL);
        if (!pllen) {
                ret = -ENOMEM;
                goto err_unregister_postdiv;
index d4c1864e1ee94f7603d1fe3474bf692ba20b2b2b..228d08f5d26fa12b4aecfe0f649123c7f08ff86c 100644 (file)
@@ -420,17 +420,18 @@ static int lpass_core_sc7180_probe(struct platform_device *pdev)
        pm_runtime_enable(&pdev->dev);
        ret = pm_clk_create(&pdev->dev);
        if (ret)
-               return ret;
+               goto disable_pm_runtime;
 
        ret = pm_clk_add(&pdev->dev, "iface");
        if (ret < 0) {
                dev_err(&pdev->dev, "failed to acquire iface clock\n");
-               goto disable_pm_runtime;
+               goto destroy_pm_clk;
        }
 
+       ret = -EINVAL;
        clk_probe = of_device_get_match_data(&pdev->dev);
        if (!clk_probe)
-               return -EINVAL;
+               goto destroy_pm_clk;
 
        ret = clk_probe(pdev);
        if (ret)
index d7243c09cc843a7ebd1e15a5f1bf926a4bf5faca..47d6482dda9dfd8a84db7029dc9b329e436afad6 100644 (file)
@@ -137,7 +137,7 @@ PNAME(mux_usb480m_p)                = { "usb480m_phy", "xin24m" };
 PNAME(mux_hdmiphy_p)           = { "hdmiphy_phy", "xin24m" };
 PNAME(mux_aclk_cpu_src_p)      = { "cpll_aclk_cpu", "gpll_aclk_cpu", "hdmiphy_aclk_cpu" };
 
-PNAME(mux_pll_src_4plls_p)     = { "cpll", "gpll", "hdmiphy" "usb480m" };
+PNAME(mux_pll_src_4plls_p)     = { "cpll", "gpll", "hdmiphy", "usb480m" };
 PNAME(mux_pll_src_3plls_p)     = { "cpll", "gpll", "hdmiphy" };
 PNAME(mux_pll_src_2plls_p)     = { "cpll", "gpll" };
 PNAME(mux_sclk_hdmi_cec_p)     = { "cpll", "gpll", "xin24m" };
index 51564fc23c639898486e3579f95458aa5c3906f6..f4086287bb71bbfdcf95bc1798e7a212ebaedb56 100644 (file)
@@ -927,7 +927,7 @@ static const struct samsung_gate_clock exynos4210_gate_clks[] __initconst = {
        GATE(CLK_PCIE, "pcie", "aclk133", GATE_IP_FSYS, 14, 0, 0),
        GATE(CLK_SMMU_PCIE, "smmu_pcie", "aclk133", GATE_IP_FSYS, 18, 0, 0),
        GATE(CLK_MODEMIF, "modemif", "aclk100", GATE_IP_PERIL, 28, 0, 0),
-       GATE(CLK_CHIPID, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0),
+       GATE(CLK_CHIPID, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, CLK_IGNORE_UNUSED, 0),
        GATE(CLK_SYSREG, "sysreg", "aclk100", E4210_GATE_IP_PERIR, 0,
                        CLK_IGNORE_UNUSED, 0),
        GATE(CLK_HDMI_CEC, "hdmi_cec", "aclk100", E4210_GATE_IP_PERIR, 11, 0,
@@ -969,7 +969,7 @@ static const struct samsung_gate_clock exynos4x12_gate_clks[] __initconst = {
                0),
        GATE(CLK_TSADC, "tsadc", "aclk133", E4X12_GATE_BUS_FSYS1, 16, 0, 0),
        GATE(CLK_MIPI_HSI, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0),
-       GATE(CLK_CHIPID, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0),
+       GATE(CLK_CHIPID, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, CLK_IGNORE_UNUSED, 0),
        GATE(CLK_SYSREG, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1,
                        CLK_IGNORE_UNUSED, 0),
        GATE(CLK_HDMI_CEC, "hdmi_cec", "aclk100", E4X12_GATE_IP_PERIR, 11, 0,
index fea33399a632d882c97335dc75c7ed5212f4a751..bd620876544d9187e0da27d43c2ce1e10277aab6 100644 (file)
@@ -1655,6 +1655,11 @@ static void __init exynos5x_clk_init(struct device_node *np,
         * main G3D clock enablement status.
         */
        clk_prepare_enable(__clk_lookup("mout_sw_aclk_g3d"));
+       /*
+        * Keep top BPLL mux enabled permanently to ensure that DRAM operates
+        * properly.
+        */
+       clk_prepare_enable(__clk_lookup("mout_bpll"));
 
        samsung_clk_of_add_provider(np, ctx);
 }
index c1dfc9b34e4e92444273ad2d760b07285036d624..661a8e9bfb9bd230f878f83d78cdb0b5045c7a05 100644 (file)
@@ -209,7 +209,7 @@ static const struct stratix10_perip_cnt_clock s10_main_perip_cnt_clks[] = {
        { STRATIX10_EMAC_B_FREE_CLK, "emacb_free_clk", NULL, emacb_free_mux, ARRAY_SIZE(emacb_free_mux),
          0, 0, 2, 0xB0, 1},
        { STRATIX10_EMAC_PTP_FREE_CLK, "emac_ptp_free_clk", NULL, emac_ptp_free_mux,
-         ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 4, 0xB0, 2},
+         ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 2, 0xB0, 2},
        { STRATIX10_GPIO_DB_FREE_CLK, "gpio_db_free_clk", NULL, gpio_db_free_mux,
          ARRAY_SIZE(gpio_db_free_mux), 0, 0, 0, 0xB0, 3},
        { STRATIX10_SDMMC_FREE_CLK, "sdmmc_free_clk", NULL, sdmmc_free_mux,
index f180c055d33f1268883ae080cf07f20e904011ed..c5cc0a2dac6ff880de18824553701c9d06c5ee5e 100644 (file)
@@ -1611,9 +1611,6 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw)
        unsigned long flags = 0;
        unsigned long input_rate;
 
-       if (clk_pll_is_enabled(hw))
-               return 0;
-
        input_rate = clk_hw_get_rate(clk_hw_get_parent(hw));
 
        if (_get_table_rate(hw, &sel, pll->params->fixed_rate, input_rate))
@@ -1673,7 +1670,7 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw)
        pll_writel(val, PLLE_SS_CTRL, pll);
        udelay(1);
 
-       /* Enable hw control of xusb brick pll */
+       /* Enable HW control of XUSB brick PLL */
        val = pll_readl_misc(pll);
        val &= ~PLLE_MISC_IDDQ_SW_CTRL;
        pll_writel_misc(val, pll);
@@ -1696,7 +1693,7 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw)
        val |= XUSBIO_PLL_CFG0_SEQ_ENABLE;
        pll_writel(val, XUSBIO_PLL_CFG0, pll);
 
-       /* Enable hw control of SATA pll */
+       /* Enable HW control of SATA PLL */
        val = pll_readl(SATA_PLL_CFG0, pll);
        val &= ~SATA_PLL_CFG0_PADPLL_RESET_SWCTL;
        val |= SATA_PLL_CFG0_PADPLL_USE_LOCKDET;
index 352a2c3fc3740794b7ef58d087074aa628315852..51fd0ec2a2d04c8e95b0a396bdcd6d48788367bf 100644 (file)
@@ -12,6 +12,8 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 
+#include "clk.h"
+
 #define CLK_SOURCE_EMC 0x19c
 #define  CLK_SOURCE_EMC_2X_CLK_SRC GENMASK(31, 29)
 #define  CLK_SOURCE_EMC_MC_EMC_SAME_FREQ BIT(16)
index ca798249544d029f25499fb9a1619444d87fe901..85c395df9c00843e92f777c6b2c37a2ac1d15605 100644 (file)
@@ -109,8 +109,10 @@ static int integrator_impd1_clk_probe(struct platform_device *pdev)
 
        for_each_available_child_of_node(np, child) {
                ret = integrator_impd1_clk_spawn(dev, np, child);
-               if (ret)
+               if (ret) {
+                       of_node_put(child);
                        break;
+               }
        }
 
        return ret;
index 1d740a8c42ab32ed9d36dd6d38635d6032a48215..47114c2a7cb5448739c108990cf476403b3f1d4a 100644 (file)
@@ -169,7 +169,7 @@ static int __init h8300_8timer_init(struct device_node *node)
                return PTR_ERR(clk);
        }
 
-       ret = ENXIO;
+       ret = -ENXIO;
        base = of_iomap(node, 0);
        if (!base) {
                pr_err("failed to map registers for clockevent\n");
index 38858e141731ef855047977c3da6b2a69241a2d0..80e9606020307e02621406483bb6f308e418cc70 100644 (file)
@@ -309,7 +309,7 @@ static int ttc_rate_change_clocksource_cb(struct notifier_block *nb,
                /* restore original register value */
                writel_relaxed(ttccs->scale_clk_ctrl_reg_old,
                               ttccs->ttc.base_addr + TTC_CLK_CNTRL_OFFSET);
-               /* fall through */
+               fallthrough;
        default:
                return NOTIFY_DONE;
        }
@@ -392,7 +392,7 @@ static int ttc_rate_change_clockevent_cb(struct notifier_block *nb,
 
                clockevents_update_freq(&ttcce->ce, ndata->new_rate / PRESCALE);
 
-               /* fall through */
+               fallthrough;
        case PRE_RATE_CHANGE:
        case ABORT_RATE_CHANGE:
        default:
index 8eeafa82c03d3df9f9603115b8aed31ece17577b..d17367dee02cce35acf23fa5d040887ff7ea0802 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/of_irq.h>
 #include <linux/smp.h>
+#include <linux/timex.h>
+
+#ifndef CONFIG_RISCV_M_MODE
+#include <asm/clint.h>
+#endif
 
 #define CLINT_IPI_OFF          0
 #define CLINT_TIMER_CMP_OFF    0x4000
@@ -31,6 +36,10 @@ static u64 __iomem *clint_timer_val;
 static unsigned long clint_timer_freq;
 static unsigned int clint_timer_irq;
 
+#ifdef CONFIG_RISCV_M_MODE
+u64 __iomem *clint_time_val;
+#endif
+
 static void clint_send_ipi(const struct cpumask *target)
 {
        unsigned int cpu;
@@ -184,6 +193,14 @@ static int __init clint_timer_init_dt(struct device_node *np)
        clint_timer_val = base + CLINT_TIMER_VAL_OFF;
        clint_timer_freq = riscv_timebase;
 
+#ifdef CONFIG_RISCV_M_MODE
+       /*
+        * Yes, that's an odd naming scheme.  time_val is public, but hopefully
+        * will die in favor of something cleaner.
+        */
+       clint_time_val = clint_timer_val;
+#endif
+
        pr_info("%pOFP: timer running at %ld Hz\n", np, clint_timer_freq);
 
        rc = clocksource_register_hz(&clint_clocksource, clint_timer_freq);
index 80d0939d040b515c043723b150b92f3360900cf0..8d386adbe8009a1061ecf6a62f14ef7b84ede84e 100644 (file)
@@ -28,6 +28,7 @@ static irqreturn_t gx6605s_timer_interrupt(int irq, void *dev)
        void __iomem *base = timer_of_base(to_timer_of(ce));
 
        writel_relaxed(GX6605S_STATUS_CLR, base + TIMER_STATUS);
+       writel_relaxed(0, base + TIMER_INI);
 
        ce->event_handler(ce);
 
index f6fd1c1cc527f9d45232501b1fd77c2649165f85..33b3e8aa2cc50c66eaea9906e593a9ce0259268c 100644 (file)
@@ -69,12 +69,33 @@ static bool dmtimer_systimer_revision1(struct dmtimer_systimer *t)
        return !(tidr >> 16);
 }
 
+static void dmtimer_systimer_enable(struct dmtimer_systimer *t)
+{
+       u32 val;
+
+       if (dmtimer_systimer_revision1(t))
+               val = DMTIMER_TYPE1_ENABLE;
+       else
+               val = DMTIMER_TYPE2_ENABLE;
+
+       writel_relaxed(val, t->base + t->sysc);
+}
+
+static void dmtimer_systimer_disable(struct dmtimer_systimer *t)
+{
+       if (!dmtimer_systimer_revision1(t))
+               return;
+
+       writel_relaxed(DMTIMER_TYPE1_DISABLE, t->base + t->sysc);
+}
+
 static int __init dmtimer_systimer_type1_reset(struct dmtimer_systimer *t)
 {
        void __iomem *syss = t->base + OMAP_TIMER_V1_SYS_STAT_OFFSET;
        int ret;
        u32 l;
 
+       dmtimer_systimer_enable(t);
        writel_relaxed(BIT(1) | BIT(2), t->base + t->ifctrl);
        ret = readl_poll_timeout_atomic(syss, l, l & BIT(0), 100,
                                        DMTIMER_RESET_WAIT);
@@ -88,6 +109,7 @@ static int __init dmtimer_systimer_type2_reset(struct dmtimer_systimer *t)
        void __iomem *sysc = t->base + t->sysc;
        u32 l;
 
+       dmtimer_systimer_enable(t);
        l = readl_relaxed(sysc);
        l |= BIT(0);
        writel_relaxed(l, sysc);
@@ -336,26 +358,6 @@ static int __init dmtimer_systimer_init_clock(struct dmtimer_systimer *t,
        return 0;
 }
 
-static void dmtimer_systimer_enable(struct dmtimer_systimer *t)
-{
-       u32 val;
-
-       if (dmtimer_systimer_revision1(t))
-               val = DMTIMER_TYPE1_ENABLE;
-       else
-               val = DMTIMER_TYPE2_ENABLE;
-
-       writel_relaxed(val, t->base + t->sysc);
-}
-
-static void dmtimer_systimer_disable(struct dmtimer_systimer *t)
-{
-       if (!dmtimer_systimer_revision1(t))
-               return;
-
-       writel_relaxed(DMTIMER_TYPE1_DISABLE, t->base + t->sysc);
-}
-
 static int __init dmtimer_systimer_setup(struct device_node *np,
                                         struct dmtimer_systimer *t)
 {
@@ -409,8 +411,8 @@ static int __init dmtimer_systimer_setup(struct device_node *np,
        t->wakeup = regbase + _OMAP_TIMER_WAKEUP_EN_OFFSET;
        t->ifctrl = regbase + _OMAP_TIMER_IF_CTRL_OFFSET;
 
-       dmtimer_systimer_enable(t);
        dmtimer_systimer_reset(t);
+       dmtimer_systimer_enable(t);
        pr_debug("dmtimer rev %08x sysc %08x\n", readl_relaxed(t->base),
                 readl_relaxed(t->base + t->sysc));
 
index f7b7743ddb947cee00e2d92b8aa576634751ab0a..b7b252c5addf1b1d5113e20a07382f67bbd2e588 100644 (file)
@@ -320,8 +320,8 @@ static int mchp_tc_probe(struct platform_device *pdev)
        }
 
        regmap = syscon_node_to_regmap(np->parent);
-       if (IS_ERR(priv->regmap))
-               return PTR_ERR(priv->regmap);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
 
        /* max. channels number is 2 when in QDEC mode */
        priv->num_channels = of_property_count_u32_elems(np, "reg");
index 02ab56b2a0d8dd69856dc84ce9ed25fb2eebc2d5..47aa90f9a7c2e214de70a4917f4c0968e40a7a25 100644 (file)
@@ -703,8 +703,7 @@ static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf)
        freq = arch_freq_get_on_cpu(policy->cpu);
        if (freq)
                ret = sprintf(buf, "%u\n", freq);
-       else if (cpufreq_driver && cpufreq_driver->setpolicy &&
-                       cpufreq_driver->get)
+       else if (cpufreq_driver->setpolicy && cpufreq_driver->get)
                ret = sprintf(buf, "%u\n", cpufreq_driver->get(policy->cpu));
        else
                ret = sprintf(buf, "%u\n", policy->cur);
index e0220a6fbc69e65a1dd92c47ffe2c3fd91c324fb..a827b000ef51750fb8b33dc5e0bc2e9c69471eb3 100644 (file)
@@ -219,14 +219,13 @@ struct global_params {
  * @epp_policy:                Last saved policy used to set EPP/EPB
  * @epp_default:       Power on default HWP energy performance
  *                     preference/bias
- * @epp_saved:         Saved EPP/EPB during system suspend or CPU offline
- *                     operation
  * @epp_cached         Cached HWP energy-performance preference value
  * @hwp_req_cached:    Cached value of the last HWP Request MSR
  * @hwp_cap_cached:    Cached value of the last HWP Capabilities MSR
  * @last_io_update:    Last time when IO wake flag was set
  * @sched_flags:       Store scheduler flags for possible cross CPU update
  * @hwp_boost_min:     Last HWP boosted min performance
+ * @suspended:         Whether or not the driver has been suspended.
  *
  * This structure stores per CPU instance data for all CPUs.
  */
@@ -258,13 +257,13 @@ struct cpudata {
        s16 epp_powersave;
        s16 epp_policy;
        s16 epp_default;
-       s16 epp_saved;
        s16 epp_cached;
        u64 hwp_req_cached;
        u64 hwp_cap_cached;
        u64 last_io_update;
        unsigned int sched_flags;
        u32 hwp_boost_min;
+       bool suspended;
 };
 
 static struct cpudata **all_cpu_data;
@@ -644,6 +643,8 @@ static int intel_pstate_get_energy_pref_index(struct cpudata *cpu_data, int *raw
 
 static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp)
 {
+       int ret;
+
        /*
         * Use the cached HWP Request MSR value, because in the active mode the
         * register itself may be updated by intel_pstate_hwp_boost_up() or
@@ -659,7 +660,11 @@ static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp)
         * function, so it cannot run in parallel with the update below.
         */
        WRITE_ONCE(cpu->hwp_req_cached, value);
-       return wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value);
+       ret = wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value);
+       if (!ret)
+               cpu->epp_cached = epp;
+
+       return ret;
 }
 
 static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data,
@@ -678,6 +683,14 @@ static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data,
                else if (epp == -EINVAL)
                        epp = epp_values[pref_index - 1];
 
+               /*
+                * To avoid confusion, refuse to set EPP to any values different
+                * from 0 (performance) if the current policy is "performance",
+                * because those values would be overridden.
+                */
+               if (epp > 0 && cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE)
+                       return -EBUSY;
+
                ret = intel_pstate_set_epp(cpu_data, epp);
        } else {
                if (epp == -EINVAL)
@@ -762,10 +775,8 @@ static ssize_t store_energy_performance_preference(
                        cpufreq_stop_governor(policy);
                        ret = intel_pstate_set_epp(cpu, epp);
                        err = cpufreq_start_governor(policy);
-                       if (!ret) {
-                               cpu->epp_cached = epp;
+                       if (!ret)
                                ret = err;
-                       }
                }
        }
 
@@ -825,7 +836,7 @@ static void intel_pstate_get_hwp_max(unsigned int cpu, int *phy_max,
 
        rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap);
        WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap);
-       if (global.no_turbo)
+       if (global.no_turbo || global.turbo_disabled)
                *current_max = HWP_GUARANTEED_PERF(cap);
        else
                *current_max = HWP_HIGHEST_PERF(cap);
@@ -859,12 +870,6 @@ static void intel_pstate_hwp_set(unsigned int cpu)
 
        cpu_data->epp_policy = cpu_data->policy;
 
-       if (cpu_data->epp_saved >= 0) {
-               epp = cpu_data->epp_saved;
-               cpu_data->epp_saved = -EINVAL;
-               goto update_epp;
-       }
-
        if (cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) {
                epp = intel_pstate_get_epp(cpu_data, value);
                cpu_data->epp_powersave = epp;
@@ -891,7 +896,6 @@ static void intel_pstate_hwp_set(unsigned int cpu)
 
                epp = cpu_data->epp_powersave;
        }
-update_epp:
        if (boot_cpu_has(X86_FEATURE_HWP_EPP)) {
                value &= ~GENMASK_ULL(31, 24);
                value |= (u64)epp << 24;
@@ -903,14 +907,24 @@ skip_epp:
        wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);
 }
 
-static void intel_pstate_hwp_force_min_perf(int cpu)
+static void intel_pstate_hwp_offline(struct cpudata *cpu)
 {
-       u64 value;
+       u64 value = READ_ONCE(cpu->hwp_req_cached);
        int min_perf;
 
-       value = all_cpu_data[cpu]->hwp_req_cached;
+       if (boot_cpu_has(X86_FEATURE_HWP_EPP)) {
+               /*
+                * In case the EPP has been set to "performance" by the
+                * active mode "performance" scaling algorithm, replace that
+                * temporary value with the cached EPP one.
+                */
+               value &= ~GENMASK_ULL(31, 24);
+               value |= HWP_ENERGY_PERF_PREFERENCE(cpu->epp_cached);
+               WRITE_ONCE(cpu->hwp_req_cached, value);
+       }
+
        value &= ~GENMASK_ULL(31, 0);
-       min_perf = HWP_LOWEST_PERF(all_cpu_data[cpu]->hwp_cap_cached);
+       min_perf = HWP_LOWEST_PERF(cpu->hwp_cap_cached);
 
        /* Set hwp_max = hwp_min */
        value |= HWP_MAX_PERF(min_perf);
@@ -920,19 +934,7 @@ static void intel_pstate_hwp_force_min_perf(int cpu)
        if (boot_cpu_has(X86_FEATURE_HWP_EPP))
                value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE);
 
-       wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);
-}
-
-static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy)
-{
-       struct cpudata *cpu_data = all_cpu_data[policy->cpu];
-
-       if (!hwp_active)
-               return 0;
-
-       cpu_data->epp_saved = intel_pstate_get_epp(cpu_data, 0);
-
-       return 0;
+       wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value);
 }
 
 #define POWER_CTL_EE_ENABLE    1
@@ -959,8 +961,28 @@ static void set_power_ctl_ee_state(bool input)
 
 static void intel_pstate_hwp_enable(struct cpudata *cpudata);
 
+static void intel_pstate_hwp_reenable(struct cpudata *cpu)
+{
+       intel_pstate_hwp_enable(cpu);
+       wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, READ_ONCE(cpu->hwp_req_cached));
+}
+
+static int intel_pstate_suspend(struct cpufreq_policy *policy)
+{
+       struct cpudata *cpu = all_cpu_data[policy->cpu];
+
+       pr_debug("CPU %d suspending\n", cpu->cpu);
+
+       cpu->suspended = true;
+
+       return 0;
+}
+
 static int intel_pstate_resume(struct cpufreq_policy *policy)
 {
+       struct cpudata *cpu = all_cpu_data[policy->cpu];
+
+       pr_debug("CPU %d resuming\n", cpu->cpu);
 
        /* Only restore if the system default is changed */
        if (power_ctl_ee_state == POWER_CTL_EE_ENABLE)
@@ -968,18 +990,16 @@ static int intel_pstate_resume(struct cpufreq_policy *policy)
        else if (power_ctl_ee_state == POWER_CTL_EE_DISABLE)
                set_power_ctl_ee_state(false);
 
-       if (!hwp_active)
-               return 0;
+       if (cpu->suspended && hwp_active) {
+               mutex_lock(&intel_pstate_limits_lock);
 
-       mutex_lock(&intel_pstate_limits_lock);
+               /* Re-enable HWP, because "online" has not done that. */
+               intel_pstate_hwp_reenable(cpu);
 
-       if (policy->cpu == 0)
-               intel_pstate_hwp_enable(all_cpu_data[policy->cpu]);
+               mutex_unlock(&intel_pstate_limits_lock);
+       }
 
-       all_cpu_data[policy->cpu]->epp_policy = 0;
-       intel_pstate_hwp_set(policy->cpu);
-
-       mutex_unlock(&intel_pstate_limits_lock);
+       cpu->suspended = false;
 
        return 0;
 }
@@ -1428,7 +1448,6 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata)
                wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00);
 
        wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1);
-       cpudata->epp_policy = 0;
        if (cpudata->epp_default == -EINVAL)
                cpudata->epp_default = intel_pstate_get_epp(cpudata, 0);
 }
@@ -2097,25 +2116,31 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 
                all_cpu_data[cpunum] = cpu;
 
-               cpu->epp_default = -EINVAL;
-               cpu->epp_powersave = -EINVAL;
-               cpu->epp_saved = -EINVAL;
-       }
-
-       cpu = all_cpu_data[cpunum];
+               cpu->cpu = cpunum;
 
-       cpu->cpu = cpunum;
+               cpu->epp_default = -EINVAL;
 
-       if (hwp_active) {
-               const struct x86_cpu_id *id;
+               if (hwp_active) {
+                       const struct x86_cpu_id *id;
 
-               intel_pstate_hwp_enable(cpu);
+                       intel_pstate_hwp_enable(cpu);
 
-               id = x86_match_cpu(intel_pstate_hwp_boost_ids);
-               if (id && intel_pstate_acpi_pm_profile_server())
-                       hwp_boost = true;
+                       id = x86_match_cpu(intel_pstate_hwp_boost_ids);
+                       if (id && intel_pstate_acpi_pm_profile_server())
+                               hwp_boost = true;
+               }
+       } else if (hwp_active) {
+               /*
+                * Re-enable HWP in case this happens after a resume from ACPI
+                * S3 if the CPU was offline during the whole system/resume
+                * cycle.
+                */
+               intel_pstate_hwp_reenable(cpu);
        }
 
+       cpu->epp_powersave = -EINVAL;
+       cpu->epp_policy = 0;
+
        intel_pstate_get_cpu_pstates(cpu);
 
        pr_debug("controlling: cpu %d\n", cpunum);
@@ -2296,28 +2321,61 @@ static int intel_pstate_verify_policy(struct cpufreq_policy_data *policy)
        return 0;
 }
 
-static void intel_cpufreq_stop_cpu(struct cpufreq_policy *policy)
+static int intel_pstate_cpu_offline(struct cpufreq_policy *policy)
 {
+       struct cpudata *cpu = all_cpu_data[policy->cpu];
+
+       pr_debug("CPU %d going offline\n", cpu->cpu);
+
+       if (cpu->suspended)
+               return 0;
+
+       /*
+        * If the CPU is an SMT thread and it goes offline with the performance
+        * settings different from the minimum, it will prevent its sibling
+        * from getting to lower performance levels, so force the minimum
+        * performance on CPU offline to prevent that from happening.
+        */
        if (hwp_active)
-               intel_pstate_hwp_force_min_perf(policy->cpu);
+               intel_pstate_hwp_offline(cpu);
        else
-               intel_pstate_set_min_pstate(all_cpu_data[policy->cpu]);
+               intel_pstate_set_min_pstate(cpu);
+
+       intel_pstate_exit_perf_limits(policy);
+
+       return 0;
+}
+
+static int intel_pstate_cpu_online(struct cpufreq_policy *policy)
+{
+       struct cpudata *cpu = all_cpu_data[policy->cpu];
+
+       pr_debug("CPU %d going online\n", cpu->cpu);
+
+       intel_pstate_init_acpi_perf_limits(policy);
+
+       if (hwp_active) {
+               /*
+                * Re-enable HWP and clear the "suspended" flag to let "resume"
+                * know that it need not do that.
+                */
+               intel_pstate_hwp_reenable(cpu);
+               cpu->suspended = false;
+       }
+
+       return 0;
 }
 
 static void intel_pstate_stop_cpu(struct cpufreq_policy *policy)
 {
-       pr_debug("CPU %d exiting\n", policy->cpu);
+       pr_debug("CPU %d stopping\n", policy->cpu);
 
        intel_pstate_clear_update_util_hook(policy->cpu);
-       if (hwp_active)
-               intel_pstate_hwp_save_state(policy);
-
-       intel_cpufreq_stop_cpu(policy);
 }
 
 static int intel_pstate_cpu_exit(struct cpufreq_policy *policy)
 {
-       intel_pstate_exit_perf_limits(policy);
+       pr_debug("CPU %d exiting\n", policy->cpu);
 
        policy->fast_switch_possible = false;
 
@@ -2378,6 +2436,12 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy)
         */
        policy->policy = CPUFREQ_POLICY_POWERSAVE;
 
+       if (hwp_active) {
+               struct cpudata *cpu = all_cpu_data[policy->cpu];
+
+               cpu->epp_cached = intel_pstate_get_epp(cpu, 0);
+       }
+
        return 0;
 }
 
@@ -2385,11 +2449,13 @@ static struct cpufreq_driver intel_pstate = {
        .flags          = CPUFREQ_CONST_LOOPS,
        .verify         = intel_pstate_verify_policy,
        .setpolicy      = intel_pstate_set_policy,
-       .suspend        = intel_pstate_hwp_save_state,
+       .suspend        = intel_pstate_suspend,
        .resume         = intel_pstate_resume,
        .init           = intel_pstate_cpu_init,
        .exit           = intel_pstate_cpu_exit,
        .stop_cpu       = intel_pstate_stop_cpu,
+       .offline        = intel_pstate_cpu_offline,
+       .online         = intel_pstate_cpu_online,
        .update_limits  = intel_pstate_update_limits,
        .name           = "intel_pstate",
 };
@@ -2585,7 +2651,7 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy)
                policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY_HWP;
                rdmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value);
                WRITE_ONCE(cpu->hwp_req_cached, value);
-               cpu->epp_cached = (value & GENMASK_ULL(31, 24)) >> 24;
+               cpu->epp_cached = intel_pstate_get_epp(cpu, value);
        } else {
                turbo_max = cpu->pstate.turbo_pstate;
                policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY;
@@ -2644,7 +2710,10 @@ static struct cpufreq_driver intel_cpufreq = {
        .fast_switch    = intel_cpufreq_fast_switch,
        .init           = intel_cpufreq_cpu_init,
        .exit           = intel_cpufreq_cpu_exit,
-       .stop_cpu       = intel_cpufreq_stop_cpu,
+       .offline        = intel_pstate_cpu_offline,
+       .online         = intel_pstate_cpu_online,
+       .suspend        = intel_pstate_suspend,
+       .resume         = intel_pstate_resume,
        .update_limits  = intel_pstate_update_limits,
        .name           = "intel_cpufreq",
 };
@@ -2667,9 +2736,6 @@ static void intel_pstate_driver_cleanup(void)
        }
        put_online_cpus();
 
-       if (intel_pstate_driver == &intel_pstate)
-               intel_pstate_sysfs_hide_hwp_dynamic_boost();
-
        intel_pstate_driver = NULL;
 }
 
@@ -2695,14 +2761,6 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver)
        return 0;
 }
 
-static int intel_pstate_unregister_driver(void)
-{
-       cpufreq_unregister_driver(intel_pstate_driver);
-       intel_pstate_driver_cleanup();
-
-       return 0;
-}
-
 static ssize_t intel_pstate_show_status(char *buf)
 {
        if (!intel_pstate_driver)
@@ -2714,20 +2772,23 @@ static ssize_t intel_pstate_show_status(char *buf)
 
 static int intel_pstate_update_status(const char *buf, size_t size)
 {
-       int ret;
+       if (size == 3 && !strncmp(buf, "off", size)) {
+               if (!intel_pstate_driver)
+                       return -EINVAL;
+
+               if (hwp_active)
+                       return -EBUSY;
 
-       if (size == 3 && !strncmp(buf, "off", size))
-               return intel_pstate_driver ?
-                       intel_pstate_unregister_driver() : -EINVAL;
+               cpufreq_unregister_driver(intel_pstate_driver);
+               intel_pstate_driver_cleanup();
+       }
 
        if (size == 6 && !strncmp(buf, "active", size)) {
                if (intel_pstate_driver) {
                        if (intel_pstate_driver == &intel_pstate)
                                return 0;
 
-                       ret = intel_pstate_unregister_driver();
-                       if (ret)
-                               return ret;
+                       cpufreq_unregister_driver(intel_pstate_driver);
                }
 
                return intel_pstate_register_driver(&intel_pstate);
@@ -2738,9 +2799,8 @@ static int intel_pstate_update_status(const char *buf, size_t size)
                        if (intel_pstate_driver == &intel_cpufreq)
                                return 0;
 
-                       ret = intel_pstate_unregister_driver();
-                       if (ret)
-                               return ret;
+                       cpufreq_unregister_driver(intel_pstate_driver);
+                       intel_pstate_sysfs_hide_hwp_dynamic_boost();
                }
 
                return intel_pstate_register_driver(&intel_cpufreq);
index bb61677c11c7142c1d5b41d8a1855846fb1b007d..ef0a3216a3862393b5d41128f0766af9d1515380 100644 (file)
@@ -129,7 +129,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
                        return speedstep_get_frequency(SPEEDSTEP_CPU_PCORE);
                case 0x0D: /* Pentium M (Dothan) */
                        p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
-                       /* fall through */
+                       fallthrough;
                case 0x09: /* Pentium M (Banias) */
                        return speedstep_get_frequency(SPEEDSTEP_CPU_PM);
                }
index 5c4f8f07c5a62a9682a48a162b858b34d2c412a4..a13a2d1e444ed6e62ff357927f1912b6d0408131 100644 (file)
@@ -366,7 +366,7 @@ enum speedstep_processor speedstep_detect_processor(void)
                        } else
                                return SPEEDSTEP_CPU_PIII_C;
                }
-               /* fall through */
+               fallthrough;
        default:
                return 0;
        }
index bae527e507e017821f1f5b424186773375f1339c..e1d931c457a732de79a7af61fa55e9a31dff7088 100644 (file)
@@ -56,9 +56,11 @@ struct read_counters_work {
 
 static struct workqueue_struct *read_counters_wq;
 
-static enum cluster get_cpu_cluster(u8 cpu)
+static void get_cpu_cluster(void *cluster)
 {
-       return MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 1);
+       u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
+
+       *((uint32_t *)cluster) = MPIDR_AFFINITY_LEVEL(mpidr, 1);
 }
 
 /*
@@ -186,8 +188,10 @@ static unsigned int tegra194_get_speed(u32 cpu)
 static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
 {
        struct tegra194_cpufreq_data *data = cpufreq_get_driver_data();
-       int cl = get_cpu_cluster(policy->cpu);
        u32 cpu;
+       u32 cl;
+
+       smp_call_function_single(policy->cpu, get_cpu_cluster, &cl, true);
 
        if (cl >= data->num_clusters)
                return -EINVAL;
index ab0de27539ad4e2e855efd88a609b689343276ed..8f9fdd864391a697daa33c74a8af118d1c0de4e0 100644 (file)
@@ -86,11 +86,11 @@ static unsigned long dra7_efuse_xlate(struct ti_cpufreq_data *opp_data,
        case DRA76_EFUSE_HAS_PLUS_MPU_OPP:
        case DRA76_EFUSE_HAS_ALL_MPU_OPP:
                calculated_efuse |= DRA76_EFUSE_PLUS_MPU_OPP;
-               /* Fall through */
+               fallthrough;
        case DRA7_EFUSE_HAS_ALL_MPU_OPP:
        case DRA7_EFUSE_HAS_HIGH_MPU_OPP:
                calculated_efuse |= DRA7_EFUSE_HIGH_MPU_OPP;
-               /* Fall through */
+               fallthrough;
        case DRA7_EFUSE_HAS_OD_MPU_OPP:
                calculated_efuse |= DRA7_EFUSE_OD_MPU_OPP;
        }
index 74463841805f2ecb8784699f08ae1a62475ceffb..d928b37718bdecc7e0b3c8c4057195d26b903538 100644 (file)
@@ -66,7 +66,7 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
                return -1;
 
        /* Do runtime PM to manage a hierarchical CPU toplogy. */
-       pm_runtime_put_sync_suspend(pd_dev);
+       RCU_NONIDLE(pm_runtime_put_sync_suspend(pd_dev));
 
        state = psci_get_domain_state();
        if (!state)
@@ -74,7 +74,7 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
 
        ret = psci_cpu_suspend_enter(state) ? -1 : idx;
 
-       pm_runtime_get_sync(pd_dev);
+       RCU_NONIDLE(pm_runtime_get_sync(pd_dev));
 
        cpu_pm_exit();
 
index ff6d99e923a49e44440c598cf3edfc8ec60881f8..a2b5c6f60cf0e568cdd6b13a5fd396c4bba4b879 100644 (file)
@@ -361,7 +361,10 @@ static void __init fixup_cede0_latency(void)
        for (i = 0; i < nr_xcede_records; i++) {
                struct xcede_latency_record *record = &payload->records[i];
                u64 latency_tb = be64_to_cpu(record->latency_ticks);
-               u64 latency_us = tb_to_ns(latency_tb) / NSEC_PER_USEC;
+               u64 latency_us = DIV_ROUND_UP_ULL(tb_to_ns(latency_tb), NSEC_PER_USEC);
+
+               if (latency_us == 0)
+                       pr_warn("cpuidle: xcede record %d has an unrealistic latency of 0us.\n", i);
 
                if (latency_us < min_latency_us)
                        min_latency_us = latency_us;
@@ -378,10 +381,14 @@ static void __init fixup_cede0_latency(void)
         * Perform the fix-up.
         */
        if (min_latency_us < dedicated_states[1].exit_latency) {
-               u64 cede0_latency = min_latency_us - 1;
+               /*
+                * We set a minimum of 1us wakeup latency for cede0 to
+                * distinguish it from snooze
+                */
+               u64 cede0_latency = 1;
 
-               if (cede0_latency <= 0)
-                       cede0_latency = min_latency_us;
+               if (min_latency_us > cede0_latency)
+                       cede0_latency = min_latency_us - 1;
 
                dedicated_states[1].exit_latency = cede0_latency;
                dedicated_states[1].target_residency = 10 * (cede0_latency);
index 87197319ab0694663033789ffdabe11f79ce23a5..29e84687f3c395adf515d124299b4627d96b71dd 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/suspend.h>
 #include <linux/tick.h>
+#include <linux/mmu_context.h>
 #include <trace/events/power.h>
 
 #include "cpuidle.h"
@@ -137,29 +138,25 @@ static void enter_s2idle_proper(struct cpuidle_driver *drv,
                                struct cpuidle_device *dev, int index)
 {
        ktime_t time_start, time_end;
+       struct cpuidle_state *target_state = &drv->states[index];
 
        time_start = ns_to_ktime(local_clock());
 
-       /*
-        * trace_suspend_resume() called by tick_freeze() for the last CPU
-        * executing it contains RCU usage regarded as invalid in the idle
-        * context, so tell RCU about that.
-        */
-       RCU_NONIDLE(tick_freeze());
+       tick_freeze();
        /*
         * The state used here cannot be a "coupled" one, because the "coupled"
         * cpuidle mechanism enables interrupts and doing that with timekeeping
         * suspended is generally unsafe.
         */
        stop_critical_timings();
-       drv->states[index].enter_s2idle(dev, drv, index);
-       WARN_ON(!irqs_disabled());
-       /*
-        * timekeeping_resume() that will be called by tick_unfreeze() for the
-        * first CPU executing it calls functions containing RCU read-side
-        * critical sections, so tell RCU about that.
-        */
-       RCU_NONIDLE(tick_unfreeze());
+       if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
+               rcu_idle_enter();
+       target_state->enter_s2idle(dev, drv, index);
+       if (WARN_ON_ONCE(!irqs_disabled()))
+               local_irq_disable();
+       if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
+               rcu_idle_exit();
+       tick_unfreeze();
        start_critical_timings();
 
        time_end = ns_to_ktime(local_clock());
@@ -225,19 +222,26 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
                broadcast = false;
        }
 
+       if (target_state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
+               leave_mm(dev->cpu);
+
        /* Take note of the planned idle state. */
        sched_idle_set_state(target_state);
 
-       trace_cpu_idle_rcuidle(index, dev->cpu);
+       trace_cpu_idle(index, dev->cpu);
        time_start = ns_to_ktime(local_clock());
 
        stop_critical_timings();
+       if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
+               rcu_idle_enter();
        entered_state = target_state->enter(dev, drv, index);
+       if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
+               rcu_idle_exit();
        start_critical_timings();
 
        sched_clock_idle_wakeup_event();
        time_end = ns_to_ktime(local_clock());
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
+       trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
 
        /* The cpu is no longer idle or about to enter idle. */
        sched_idle_set_state(NULL);
index aa3a4ed07a66696587d9ed6682d4bd9dba956af0..52a9b7cf6576f97b23e709029deac470ee54748f 100644 (file)
@@ -873,6 +873,9 @@ config CRYPTO_DEV_SA2UL
        select CRYPTO_AES
        select CRYPTO_AES_ARM64
        select CRYPTO_ALGAPI
+       select CRYPTO_SHA1
+       select CRYPTO_SHA256
+       select CRYPTO_SHA512
        select HW_RANDOM
        select SG_SPLIT
        help
index 1a46eeddf0824249128506fd90e8719054973ac4..809c3033ca74897e93a06ce1808f91652ee76209 100644 (file)
@@ -2310,7 +2310,7 @@ static int artpec6_crypto_prepare_submit_hash(struct ahash_request *req)
 
        case ARTPEC6_CRYPTO_PREPARE_HASH_NO_START:
                ret = 0;
-               /* Fallthrough */
+               fallthrough;
 
        default:
                artpec6_crypto_common_destroy(&req_ctx->common);
index dc5fda522719834c57722d2b848c87874bcf88a6..4fe7898c85615a7d8d9dabddc0e6a933368e8463 100644 (file)
@@ -90,11 +90,11 @@ static int setup_sgio_components(struct cpt_vf *cptvf, struct buf_ptr *list,
        case 3:
                sg_ptr->u.s.len2 = cpu_to_be16(list[i * 4 + 2].size);
                sg_ptr->ptr2 = cpu_to_be64(list[i * 4 + 2].dma_addr);
-               /* Fall through */
+               fallthrough;
        case 2:
                sg_ptr->u.s.len1 = cpu_to_be16(list[i * 4 + 1].size);
                sg_ptr->ptr1 = cpu_to_be64(list[i * 4 + 1].dma_addr);
-               /* Fall through */
+               fallthrough;
        case 1:
                sg_ptr->u.s.len0 = cpu_to_be16(list[i * 4 + 0].size);
                sg_ptr->ptr0 = cpu_to_be64(list[i * 4 + 0].dma_addr);
index 91dee616d15e71e39f7f17f566eb9f47cb993392..c5cce024886ace0eea398ebb0fa2ac8f2779e60e 100644 (file)
@@ -135,7 +135,7 @@ static int chcr_ktls_update_connection_state(struct chcr_ktls_info *tx_info,
                        break;
                /* update to the next state and also initialize TCB */
                tx_info->connection_state = new_state;
-               /* FALLTHRU */
+               fallthrough;
        case KTLS_CONN_ACT_OPEN_RPL:
                /* if we are stuck in this state, means tcb init might not
                 * received by HW, try sending it again.
@@ -150,7 +150,7 @@ static int chcr_ktls_update_connection_state(struct chcr_ktls_info *tx_info,
                        break;
                /* update to the next state and check if l2t_state is valid  */
                tx_info->connection_state = new_state;
-               /* FALLTHRU */
+               fallthrough;
        case KTLS_CONN_SET_TCB_RPL:
                /* Check if l2t state is valid, then move to ready state. */
                if (cxgb4_check_l2t_valid(tx_info->l2te)) {
index cbc3d7869ebe49772a85272167ff7c4a6be6ac71..c80baf1ad90b2f0d3ec4cfd4a7cf3a94b1fe5d5c 100644 (file)
@@ -140,11 +140,11 @@ static inline int setup_sgio_components(struct pci_dev *pdev,
        case 3:
                sg_ptr->u.s.len2 = cpu_to_be16(list[i * 4 + 2].size);
                sg_ptr->ptr2 = cpu_to_be64(list[i * 4 + 2].dma_addr);
-               /* Fall through */
+               fallthrough;
        case 2:
                sg_ptr->u.s.len1 = cpu_to_be16(list[i * 4 + 1].size);
                sg_ptr->ptr1 = cpu_to_be64(list[i * 4 + 1].dma_addr);
-               /* Fall through */
+               fallthrough;
        case 1:
                sg_ptr->u.s.len0 = cpu_to_be16(list[i * 4 + 0].size);
                sg_ptr->ptr0 = cpu_to_be64(list[i * 4 + 0].dma_addr);
index 1c8ca151a9635af4c95dc73d74d5adf514462fdc..ec9b390276d6fb10df3c66d045a229d73f8612e8 100644 (file)
@@ -131,9 +131,10 @@ static int adf_put_admin_msg_sync(struct adf_accel_dev *accel_dev, u32 ae,
        memcpy(admin->virt_addr + offset, in, ADF_ADMINMSG_LEN);
        ADF_CSR_WR(mailbox, mb_offset, 1);
 
-       ret = readl_poll_timeout(mailbox + mb_offset, status,
-                                status == 0, ADF_ADMIN_POLL_DELAY_US,
-                                ADF_ADMIN_POLL_TIMEOUT_US);
+       ret = read_poll_timeout(ADF_CSR_RD, status, status == 0,
+                               ADF_ADMIN_POLL_DELAY_US,
+                               ADF_ADMIN_POLL_TIMEOUT_US, true,
+                               mailbox, mb_offset);
        if (ret < 0) {
                /* Response timeout */
                dev_err(&GET_DEV(accel_dev),
index 519fd5acf713bb022cc1ad0e479e1b10457b016d..8b090b7ae8c6b6b8cdef2eab47253f444396845d 100644 (file)
@@ -340,7 +340,7 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)
                /* VF is newer than PF and decides whether it is compatible */
                if (accel_dev->vf.pf_version >= hw_data->min_iov_compat_ver)
                        break;
-               /* fall through */
+               fallthrough;
        case ADF_PF2VF_VF_INCOMPATIBLE:
                dev_err(&GET_DEV(accel_dev),
                        "PF (vers %d) and VF (vers %d) are not compatible\n",
index bff759e2f8112965661707f336777cea4a5f1fc5..00c615f9f9a839a0b9782956755e44a0c6ec124d 100644 (file)
@@ -752,7 +752,7 @@ static int qat_uclo_init_reg(struct icp_qat_fw_loader_handle *handle,
        case ICP_GPA_ABS:
        case ICP_GPB_ABS:
                ctx_mask = 0;
-               /* fall through */
+               fallthrough;
        case ICP_GPA_REL:
        case ICP_GPB_REL:
                return qat_hal_init_gpr(handle, ae, ctx_mask, reg_type,
@@ -762,7 +762,7 @@ static int qat_uclo_init_reg(struct icp_qat_fw_loader_handle *handle,
        case ICP_SR_RD_ABS:
        case ICP_DR_RD_ABS:
                ctx_mask = 0;
-               /* fall through */
+               fallthrough;
        case ICP_SR_REL:
        case ICP_DR_REL:
        case ICP_SR_RD_REL:
@@ -772,7 +772,7 @@ static int qat_uclo_init_reg(struct icp_qat_fw_loader_handle *handle,
        case ICP_SR_WR_ABS:
        case ICP_DR_WR_ABS:
                ctx_mask = 0;
-               /* fall through */
+               fallthrough;
        case ICP_SR_WR_REL:
        case ICP_DR_WR_REL:
                return qat_hal_init_wr_xfer(handle, ae, ctx_mask, reg_type,
index f22f6fa612b379efb674383e8470c3e526d9f5e9..9866c2a5e9a70133ce110fdc8187e8a25f279715 100644 (file)
@@ -314,17 +314,17 @@ void cryp_save_device_context(struct cryp_device_data *device_data,
        case CRYP_KEY_SIZE_256:
                ctx->key_4_l = readl_relaxed(&src_reg->key_4_l);
                ctx->key_4_r = readl_relaxed(&src_reg->key_4_r);
-               /* Fall through */
+               fallthrough;
 
        case CRYP_KEY_SIZE_192:
                ctx->key_3_l = readl_relaxed(&src_reg->key_3_l);
                ctx->key_3_r = readl_relaxed(&src_reg->key_3_r);
-               /* Fall through */
+               fallthrough;
 
        case CRYP_KEY_SIZE_128:
                ctx->key_2_l = readl_relaxed(&src_reg->key_2_l);
                ctx->key_2_r = readl_relaxed(&src_reg->key_2_r);
-               /* Fall through */
+               fallthrough;
 
        default:
                ctx->key_1_l = readl_relaxed(&src_reg->key_1_l);
@@ -364,17 +364,17 @@ void cryp_restore_device_context(struct cryp_device_data *device_data,
        case CRYP_KEY_SIZE_256:
                writel_relaxed(ctx->key_4_l, &reg->key_4_l);
                writel_relaxed(ctx->key_4_r, &reg->key_4_r);
-               /* Fall through */
+               fallthrough;
 
        case CRYP_KEY_SIZE_192:
                writel_relaxed(ctx->key_3_l, &reg->key_3_l);
                writel_relaxed(ctx->key_3_r, &reg->key_3_r);
-               /* Fall through */
+               fallthrough;
 
        case CRYP_KEY_SIZE_128:
                writel_relaxed(ctx->key_2_l, &reg->key_2_l);
                writel_relaxed(ctx->key_2_r, &reg->key_2_r);
-               /* Fall through */
+               fallthrough;
 
        default:
                writel_relaxed(ctx->key_1_l, &reg->key_1_l);
index 4c0af2eb7e19648aecf4489eebd08a60d7d2205d..1e89513f3c5962928f65200548a0a8d59ff0e81e 100644 (file)
@@ -429,7 +429,7 @@ int dev_dax_probe(struct device *dev)
                return -EBUSY;
        }
 
-       dev_dax->pgmap.type = MEMORY_DEVICE_DEVDAX;
+       dev_dax->pgmap.type = MEMORY_DEVICE_GENERIC;
        addr = devm_memremap_pages(dev, &dev_dax->pgmap);
        if (IS_ERR(addr))
                return PTR_ERR(addr);
index c82cbcb6420289f8cf529394ef1138158d32fb4c..e84070b5546362a7a05da0fa4784cc6f46a6476f 100644 (file)
@@ -85,6 +85,12 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev,
                return false;
        }
 
+       if (!dax_dev) {
+               pr_debug("%s: error: dax unsupported by block device\n",
+                               bdevname(bdev, buf));
+               return false;
+       }
+
        err = bdev_dax_pgoff(bdev, start, PAGE_SIZE, &pgoff);
        if (err) {
                pr_info("%s: error: unaligned partition for dax\n",
@@ -319,11 +325,15 @@ EXPORT_SYMBOL_GPL(dax_direct_access);
 bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
                int blocksize, sector_t start, sector_t len)
 {
+       if (!dax_dev)
+               return false;
+
        if (!dax_alive(dax_dev))
                return false;
 
        return dax_dev->ops->dax_supported(dax_dev, bdev, blocksize, start, len);
 }
+EXPORT_SYMBOL_GPL(dax_supported);
 
 size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
                size_t bytes, struct iov_iter *i)
index 561d91b2d3bf577f3fb6fd34ced8fc7fc8e2ef7c..071b59fe84d2eabebcdbd2ab298c9ac3e256e8cc 100644 (file)
@@ -1766,20 +1766,23 @@ static int devfreq_summary_show(struct seq_file *s, void *data)
        struct devfreq *p_devfreq = NULL;
        unsigned long cur_freq, min_freq, max_freq;
        unsigned int polling_ms;
+       unsigned int timer;
 
-       seq_printf(s, "%-30s %-30s %-15s %10s %12s %12s %12s\n",
+       seq_printf(s, "%-30s %-30s %-15s %-10s %10s %12s %12s %12s\n",
                        "dev",
                        "parent_dev",
                        "governor",
+                       "timer",
                        "polling_ms",
                        "cur_freq_Hz",
                        "min_freq_Hz",
                        "max_freq_Hz");
-       seq_printf(s, "%30s %30s %15s %10s %12s %12s %12s\n",
+       seq_printf(s, "%30s %30s %15s %10s %10s %12s %12s %12s\n",
                        "------------------------------",
                        "------------------------------",
                        "---------------",
                        "----------",
+                       "----------",
                        "------------",
                        "------------",
                        "------------");
@@ -1803,13 +1806,15 @@ static int devfreq_summary_show(struct seq_file *s, void *data)
                cur_freq = devfreq->previous_freq;
                get_freq_range(devfreq, &min_freq, &max_freq);
                polling_ms = devfreq->profile->polling_ms;
+               timer = devfreq->profile->timer;
                mutex_unlock(&devfreq->lock);
 
                seq_printf(s,
-                       "%-30s %-30s %-15s %10d %12ld %12ld %12ld\n",
+                       "%-30s %-30s %-15s %-10s %10d %12ld %12ld %12ld\n",
                        dev_name(&devfreq->dev),
                        p_devfreq ? dev_name(&p_devfreq->dev) : "null",
                        devfreq->governor_name,
+                       polling_ms ? timer_name[timer] : "null",
                        polling_ms,
                        cur_freq,
                        min_freq,
index e94a27804c209a28aaf724afd3d89b1675328746..dedd39de736752c3a1b36ed422bcaf1b941396fe 100644 (file)
@@ -836,7 +836,8 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
        rate = clk_round_rate(tegra->emc_clock, ULONG_MAX);
        if (rate < 0) {
                dev_err(&pdev->dev, "Failed to round clock rate: %ld\n", rate);
-               return rate;
+               err = rate;
+               goto disable_clk;
        }
 
        tegra->max_freq = rate / KHZ;
@@ -897,6 +898,7 @@ remove_opps:
        dev_pm_opp_remove_all_dynamic(&pdev->dev);
 
        reset_control_reset(tegra->reset);
+disable_clk:
        clk_disable_unprepare(tegra->clock);
 
        return err;
index 1699a8e309ef0d41d4ce7b8ab54c704b19ad2111..844967f98866a5749bf54367f98131c7df9d5370 100644 (file)
@@ -59,6 +59,8 @@ static void dma_buf_release(struct dentry *dentry)
        struct dma_buf *dmabuf;
 
        dmabuf = dentry->d_fsdata;
+       if (unlikely(!dmabuf))
+               return;
 
        BUG_ON(dmabuf->vmapping_counter);
 
@@ -316,9 +318,9 @@ out:
  * name of the dma-buf if the same piece of memory is used for multiple
  * purpose between different devices.
  *
- * @dmabuf [in]     dmabuf buffer that will be renamed.
- * @buf:   [in]     A piece of userspace memory that contains the name of
- *                  the dma-buf.
+ * @dmabuf: [in]     dmabuf buffer that will be renamed.
+ * @buf:    [in]     A piece of userspace memory that contains the name of
+ *                   the dma-buf.
  *
  * Returns 0 on success. If the dma-buf buffer is already attached to
  * devices, return -EBUSY.
index 3d123502ff12a8fb7845c9bf3d4193768f3836da..7d129e68ac70116b1c7169e4176a981d292bd2f4 100644 (file)
@@ -222,6 +222,7 @@ EXPORT_SYMBOL(dma_fence_chain_ops);
  * @chain: the chain node to initialize
  * @prev: the previous fence
  * @fence: the current fence
+ * @seqno: the sequence number to use for the fence chain
  *
  * Initialize a new chain node and either start a new chain or add the node to
  * the existing chain of the previous fence.
index 35f4804ea4afaa6ac90146b827c99edab7568783..235f1396f968606ddfee61110490de4e16463df4 100644 (file)
@@ -135,11 +135,13 @@ static void acpi_dma_parse_csrt(struct acpi_device *adev, struct acpi_dma *adma)
                if (ret < 0) {
                        dev_warn(&adev->dev,
                                 "error in parsing resource group\n");
-                       return;
+                       break;
                }
 
                grp = (struct acpi_csrt_group *)((void *)grp + grp->length);
        }
+
+       acpi_put_table((struct acpi_table_header *)csrt);
 }
 
 /**
index 9adc7a2fa3d3b597a864b63c3d14c38f3cb7c220..a24882ba37643db58ba982a53e1da00d6873ffbb 100644 (file)
@@ -1767,7 +1767,7 @@ static u32 pl08x_memcpy_cctl(struct pl08x_driver_data *pl08x)
        default:
                dev_err(&pl08x->adev->dev,
                        "illegal burst size for memcpy, set to 1\n");
-               /* Fall through */
+               fallthrough;
        case PL08X_BURST_SZ_1:
                cctl |= PL080_BSIZE_1 << PL080_CONTROL_SB_SIZE_SHIFT |
                        PL080_BSIZE_1 << PL080_CONTROL_DB_SIZE_SHIFT;
@@ -1806,7 +1806,7 @@ static u32 pl08x_memcpy_cctl(struct pl08x_driver_data *pl08x)
        default:
                dev_err(&pl08x->adev->dev,
                        "illegal bus width for memcpy, set to 8 bits\n");
-               /* Fall through */
+               fallthrough;
        case PL08X_BUS_WIDTH_8_BITS:
                cctl |= PL080_WIDTH_8BIT << PL080_CONTROL_SWIDTH_SHIFT |
                        PL080_WIDTH_8BIT << PL080_CONTROL_DWIDTH_SHIFT;
@@ -1850,7 +1850,7 @@ static u32 pl08x_ftdmac020_memcpy_cctl(struct pl08x_driver_data *pl08x)
        default:
                dev_err(&pl08x->adev->dev,
                        "illegal bus width for memcpy, set to 8 bits\n");
-               /* Fall through */
+               fallthrough;
        case PL08X_BUS_WIDTH_8_BITS:
                cctl |= PL080_WIDTH_8BIT << FTDMAC020_LLI_SRC_WIDTH_SHIFT |
                        PL080_WIDTH_8BIT << FTDMAC020_LLI_DST_WIDTH_SHIFT;
@@ -2612,7 +2612,7 @@ static int pl08x_of_probe(struct amba_device *adev,
        switch (val) {
        default:
                dev_err(&adev->dev, "illegal burst size for memcpy, set to 1\n");
-               /* Fall through */
+               fallthrough;
        case 1:
                pd->memcpy_burst_size = PL08X_BURST_SZ_1;
                break;
@@ -2647,7 +2647,7 @@ static int pl08x_of_probe(struct amba_device *adev,
        switch (val) {
        default:
                dev_err(&adev->dev, "illegal bus width for memcpy, set to 8 bits\n");
-               /* Fall through */
+               fallthrough;
        case 8:
                pd->memcpy_bus_width = PL08X_BUS_WIDTH_8_BITS;
                break;
index 45bbcd6146fd23643ed0022d0d553cd68c8e8138..a2cf25c6e3b35603d14a1c7545e137c2a3a3072f 100644 (file)
@@ -1650,13 +1650,17 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
                return NULL;
 
        dmac_pdev = of_find_device_by_node(dma_spec->np);
+       if (!dmac_pdev)
+               return NULL;
 
        dma_cap_zero(mask);
        dma_cap_set(DMA_SLAVE, mask);
 
        atslave = kmalloc(sizeof(*atslave), GFP_KERNEL);
-       if (!atslave)
+       if (!atslave) {
+               put_device(&dmac_pdev->dev);
                return NULL;
+       }
 
        atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW;
        /*
@@ -1685,8 +1689,11 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
        atslave->dma_dev = &dmac_pdev->dev;
 
        chan = dma_request_channel(mask, at_dma_filter, atslave);
-       if (!chan)
+       if (!chan) {
+               put_device(&dmac_pdev->dev);
+               kfree(atslave);
                return NULL;
+       }
 
        atchan = to_at_dma_chan(chan);
        atchan->per_if = dma_spec->args[0] & 0xff;
index 448f663da89c69e7bd0b4d9bfa135174a28e0bc0..8beed91428bd61bacc8467f16cfb5892d39649ba 100644 (file)
@@ -879,24 +879,11 @@ static int jz4780_dma_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       ret = platform_get_irq(pdev, 0);
-       if (ret < 0)
-               return ret;
-
-       jzdma->irq = ret;
-
-       ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev),
-                         jzdma);
-       if (ret) {
-               dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq);
-               return ret;
-       }
-
        jzdma->clk = devm_clk_get(dev, NULL);
        if (IS_ERR(jzdma->clk)) {
                dev_err(dev, "failed to get clock\n");
                ret = PTR_ERR(jzdma->clk);
-               goto err_free_irq;
+               return ret;
        }
 
        clk_prepare_enable(jzdma->clk);
@@ -949,10 +936,23 @@ static int jz4780_dma_probe(struct platform_device *pdev)
                jzchan->vchan.desc_free = jz4780_dma_desc_free;
        }
 
+       ret = platform_get_irq(pdev, 0);
+       if (ret < 0)
+               goto err_disable_clk;
+
+       jzdma->irq = ret;
+
+       ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev),
+                         jzdma);
+       if (ret) {
+               dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq);
+               goto err_disable_clk;
+       }
+
        ret = dmaenginem_async_device_register(dd);
        if (ret) {
                dev_err(dev, "failed to register device\n");
-               goto err_disable_clk;
+               goto err_free_irq;
        }
 
        /* Register with OF DMA helpers. */
@@ -960,17 +960,17 @@ static int jz4780_dma_probe(struct platform_device *pdev)
                                         jzdma);
        if (ret) {
                dev_err(dev, "failed to register OF DMA controller\n");
-               goto err_disable_clk;
+               goto err_free_irq;
        }
 
        dev_info(dev, "JZ4780 DMA controller initialised\n");
        return 0;
 
-err_disable_clk:
-       clk_disable_unprepare(jzdma->clk);
-
 err_free_irq:
        free_irq(jzdma->irq, jzdma);
+
+err_disable_clk:
+       clk_disable_unprepare(jzdma->clk);
        return ret;
 }
 
index 45d4d92e91dbf39f1e3380b2368f71d28d7961cc..a819611b8892c23f45ea414a004dc2b9f66e00e7 100644 (file)
@@ -129,6 +129,7 @@ struct dmatest_params {
  * @nr_channels:       number of channels under test
  * @lock:              access protection to the fields of this structure
  * @did_init:          module has been initialized completely
+ * @last_error:                test has faced configuration issues
  */
 static struct dmatest_info {
        /* Test parameters */
@@ -137,6 +138,7 @@ static struct dmatest_info {
        /* Internal state */
        struct list_head        channels;
        unsigned int            nr_channels;
+       int                     last_error;
        struct mutex            lock;
        bool                    did_init;
 } test_info = {
@@ -1184,10 +1186,22 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp)
                return ret;
        } else if (dmatest_run) {
                if (!is_threaded_test_pending(info)) {
-                       pr_info("No channels configured, continue with any\n");
-                       if (!is_threaded_test_run(info))
-                               stop_threaded_test(info);
-                       add_threaded_test(info);
+                       /*
+                        * We have nothing to run. This can be due to:
+                        */
+                       ret = info->last_error;
+                       if (ret) {
+                               /* 1) Misconfiguration */
+                               pr_err("Channel misconfigured, can't continue\n");
+                               mutex_unlock(&info->lock);
+                               return ret;
+                       } else {
+                               /* 2) We rely on defaults */
+                               pr_info("No channels configured, continue with any\n");
+                               if (!is_threaded_test_run(info))
+                                       stop_threaded_test(info);
+                               add_threaded_test(info);
+                       }
                }
                start_threaded_tests(info);
        } else {
@@ -1204,7 +1218,7 @@ static int dmatest_chan_set(const char *val, const struct kernel_param *kp)
        struct dmatest_info *info = &test_info;
        struct dmatest_chan *dtc;
        char chan_reset_val[20];
-       int ret = 0;
+       int ret;
 
        mutex_lock(&info->lock);
        ret = param_set_copystring(val, kp);
@@ -1259,12 +1273,14 @@ static int dmatest_chan_set(const char *val, const struct kernel_param *kp)
                goto add_chan_err;
        }
 
+       info->last_error = ret;
        mutex_unlock(&info->lock);
 
        return ret;
 
 add_chan_err:
        param_set_copystring(chan_reset_val, kp);
+       info->last_error = ret;
        mutex_unlock(&info->lock);
 
        return ret;
index ed430ad9b3dd8e1e4f096d11c9bfe1cfe6f91726..b971505b87152398cd76a16a8fb3a05fb9767c89 100644 (file)
@@ -405,7 +405,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer)
                        if (xfer->cyclic) {
                                burst->dar = xfer->xfer.cyclic.paddr;
                        } else {
-                               burst->dar = sg_dma_address(sg);
+                               burst->dar = dst_addr;
                                /* Unlike the typical assumption by other
                                 * drivers/IPs the peripheral memory isn't
                                 * a FIFO memory, in this case, it's a
@@ -413,14 +413,13 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer)
                                 * and destination addresses are increased
                                 * by the same portion (data length)
                                 */
-                               src_addr += sg_dma_len(sg);
                        }
                } else {
                        burst->dar = dst_addr;
                        if (xfer->cyclic) {
                                burst->sar = xfer->xfer.cyclic.paddr;
                        } else {
-                               burst->sar = sg_dma_address(sg);
+                               burst->sar = src_addr;
                                /* Unlike the typical assumption by other
                                 * drivers/IPs the peripheral memory isn't
                                 * a FIFO memory, in this case, it's a
@@ -428,12 +427,14 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer)
                                 * and destination addresses are increased
                                 * by the same portion (data length)
                                 */
-                               dst_addr += sg_dma_len(sg);
                        }
                }
 
-               if (!xfer->cyclic)
+               if (!xfer->cyclic) {
+                       src_addr += sg_dma_len(sg);
+                       dst_addr += sg_dma_len(sg);
                        sg = sg_next(sg);
+               }
        }
 
        return vchan_tx_prep(&chan->vc, &desc->vd, xfer->flags);
index ad72b3f42ffa06d413b7d2f5a73a5faa00458a71..e342cf52d2966b4dfc62f69a9473826ece5cf1f0 100644 (file)
@@ -1163,7 +1163,7 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev,
        switch (chan->feature & FSL_DMA_IP_MASK) {
        case FSL_DMA_IP_85XX:
                chan->toggle_ext_pause = fsl_chan_toggle_ext_pause;
-               /* Fall through */
+               fallthrough;
        case FSL_DMA_IP_83XX:
                chan->toggle_ext_start = fsl_chan_toggle_ext_start;
                chan->set_src_loop_size = fsl_chan_set_src_loop_size;
index 56f18ae99233282e52ba9fc3865ff0945b3bd921..308bed0a560acdf6016f3438f3c9e4e26c5ddebb 100644 (file)
@@ -205,10 +205,10 @@ struct fsldma_chan {
 #else
 static u64 fsl_ioread64(const u64 __iomem *addr)
 {
-       u32 fsl_addr = lower_32_bits(addr);
-       u64 fsl_addr_hi = (u64)in_le32((u32 *)(fsl_addr + 1)) << 32;
+       u32 val_lo = in_le32((u32 __iomem *)addr);
+       u32 val_hi = in_le32((u32 __iomem *)addr + 1);
 
-       return fsl_addr_hi | in_le32((u32 *)fsl_addr);
+       return ((u64)val_hi << 32) + val_lo;
 }
 
 static void fsl_iowrite64(u64 val, u64 __iomem *addr)
@@ -219,10 +219,10 @@ static void fsl_iowrite64(u64 val, u64 __iomem *addr)
 
 static u64 fsl_ioread64be(const u64 __iomem *addr)
 {
-       u32 fsl_addr = lower_32_bits(addr);
-       u64 fsl_addr_hi = (u64)in_be32((u32 *)fsl_addr) << 32;
+       u32 val_hi = in_be32((u32 __iomem *)addr);
+       u32 val_lo = in_be32((u32 __iomem *)addr + 1);
 
-       return fsl_addr_hi | in_be32((u32 *)(fsl_addr + 1));
+       return ((u64)val_hi << 32) + val_lo;
 }
 
 static void fsl_iowrite64be(u64 val, u64 __iomem *addr)
index 14b45853aa5fcee31900c51321e5d8b534c54355..b75d699160bfad03d1ceed9702be81ec295e0b1d 100644 (file)
@@ -410,10 +410,27 @@ int idxd_device_enable(struct idxd_device *idxd)
        return 0;
 }
 
+void idxd_device_wqs_clear_state(struct idxd_device *idxd)
+{
+       int i;
+
+       lockdep_assert_held(&idxd->dev_lock);
+
+       for (i = 0; i < idxd->max_wqs; i++) {
+               struct idxd_wq *wq = &idxd->wqs[i];
+
+               if (wq->state == IDXD_WQ_ENABLED) {
+                       idxd_wq_disable_cleanup(wq);
+                       wq->state = IDXD_WQ_DISABLED;
+               }
+       }
+}
+
 int idxd_device_disable(struct idxd_device *idxd)
 {
        struct device *dev = &idxd->pdev->dev;
        u32 status;
+       unsigned long flags;
 
        if (!idxd_is_enabled(idxd)) {
                dev_dbg(dev, "Device is not enabled\n");
@@ -429,13 +446,22 @@ int idxd_device_disable(struct idxd_device *idxd)
                return -ENXIO;
        }
 
+       spin_lock_irqsave(&idxd->dev_lock, flags);
+       idxd_device_wqs_clear_state(idxd);
        idxd->state = IDXD_DEV_CONF_READY;
+       spin_unlock_irqrestore(&idxd->dev_lock, flags);
        return 0;
 }
 
 void idxd_device_reset(struct idxd_device *idxd)
 {
+       unsigned long flags;
+
        idxd_cmd_exec(idxd, IDXD_CMD_RESET_DEVICE, 0, NULL);
+       spin_lock_irqsave(&idxd->dev_lock, flags);
+       idxd_device_wqs_clear_state(idxd);
+       idxd->state = IDXD_DEV_CONF_READY;
+       spin_unlock_irqrestore(&idxd->dev_lock, flags);
 }
 
 /* Device configuration bits */
index b5142556cc4e8648867d0d8162e1f835916801d3..1e9e6991f543d76325e46ccf0d1f6ce83c644de5 100644 (file)
 #include "idxd.h"
 #include "registers.h"
 
-void idxd_device_wqs_clear_state(struct idxd_device *idxd)
-{
-       int i;
-
-       lockdep_assert_held(&idxd->dev_lock);
-       for (i = 0; i < idxd->max_wqs; i++) {
-               struct idxd_wq *wq = &idxd->wqs[i];
-
-               wq->state = IDXD_WQ_DISABLED;
-       }
-}
-
 static void idxd_device_reinit(struct work_struct *work)
 {
        struct idxd_device *idxd = container_of(work, struct idxd_device, work);
index 5c0fb3134825f56ce02af12738eabcbdbfcbbacf..88717506c1f6b0453edaba53e526641ec4384170 100644 (file)
@@ -556,7 +556,7 @@ static int imxdma_xfer_desc(struct imxdma_desc *d)
                 * We fall-through here intentionally, since a 2D transfer is
                 * similar to MEMCPY just adding the 2D slot configuration.
                 */
-               /* Fall through */
+               fallthrough;
        case IMXDMA_DESC_MEMCPY:
                imx_dmav1_writel(imxdma, d->src, DMA_SAR(imxdmac->channel));
                imx_dmav1_writel(imxdma, d->dest, DMA_DAR(imxdmac->channel));
index c499c9578f0097d4f00c3ef215a7f3e80fe0f555..d44eabb6f5ebd6800bf70eba800c4b0f0d7bad47 100644 (file)
@@ -496,7 +496,7 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt,
                }
                hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = edcr;
                src_cnt = 24;
-               /* fall through */
+               fallthrough;
        case 17 ... 24:
                if (!u_desc_ctrl.field.blk_ctrl) {
                        hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = 0;
@@ -510,7 +510,7 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt,
                }
                hw_desc->src_edc[AAU_EDCR1_IDX].e_desc_ctrl = edcr;
                src_cnt = 16;
-               /* fall through */
+               fallthrough;
        case 9 ... 16:
                if (!u_desc_ctrl.field.blk_ctrl)
                        u_desc_ctrl.field.blk_ctrl = 0x2; /* use EDCR0 */
@@ -522,7 +522,7 @@ iop3xx_desc_init_xor(struct iop3xx_desc_aau *hw_desc, int src_cnt,
                }
                hw_desc->src_edc[AAU_EDCR0_IDX].e_desc_ctrl = edcr;
                src_cnt = 8;
-               /* fall through */
+               fallthrough;
        case 2 ... 8:
                shift = 1;
                for (i = 0; i < src_cnt; i++) {
@@ -602,19 +602,19 @@ iop_desc_init_null_xor(struct iop_adma_desc_slot *desc, int src_cnt,
        case 25 ... 32:
                u_desc_ctrl.field.blk_ctrl = 0x3; /* use EDCR[2:0] */
                hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = 0;
-               /* fall through */
+               fallthrough;
        case 17 ... 24:
                if (!u_desc_ctrl.field.blk_ctrl) {
                        hw_desc->src_edc[AAU_EDCR2_IDX].e_desc_ctrl = 0;
                        u_desc_ctrl.field.blk_ctrl = 0x3; /* use EDCR[2:0] */
                }
                hw_desc->src_edc[AAU_EDCR1_IDX].e_desc_ctrl = 0;
-               /* fall through */
+               fallthrough;
        case 9 ... 16:
                if (!u_desc_ctrl.field.blk_ctrl)
                        u_desc_ctrl.field.blk_ctrl = 0x2; /* use EDCR0 */
                hw_desc->src_edc[AAU_EDCR0_IDX].e_desc_ctrl = 0;
-               /* fall through */
+               fallthrough;
        case 1 ... 8:
                if (!u_desc_ctrl.field.blk_ctrl && src_cnt > 4)
                        u_desc_ctrl.field.blk_ctrl = 0x1; /* use mini-desc */
index 74df621402e106ef276e2756615dd9b90810b17c..ca4e0930207a03a88a9e65756425495239b8ddd1 100644 (file)
@@ -483,7 +483,7 @@ static size_t nbpf_xfer_size(struct nbpf_device *nbpf,
 
        default:
                pr_warn("%s(): invalid bus width %u\n", __func__, width);
-               /* fall through */
+               fallthrough;
        case DMA_SLAVE_BUSWIDTH_1_BYTE:
                size = burst;
        }
index 863f2aaf5c8f7fa037f5303c2cf1c4af4bb5f5d4..8a4f608904b984c65bf4211aaffb4fcd9fc37b4b 100644 (file)
@@ -71,12 +71,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec,
                return NULL;
 
        chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target);
-       if (chan) {
-               chan->router = ofdma->dma_router;
-               chan->route_data = route_data;
-       } else {
+       if (IS_ERR_OR_NULL(chan)) {
                ofdma->dma_router->route_free(ofdma->dma_router->dev,
                                              route_data);
+       } else {
+               chan->router = ofdma->dma_router;
+               chan->route_data = route_data;
        }
 
        /*
index 2c508ee672b9084b7f6d333ea08732b8bc7da45d..5274a0704d96085ba6c24e4288f27dbec440c623 100644 (file)
@@ -1061,16 +1061,16 @@ static bool _start(struct pl330_thread *thrd)
 
                if (_state(thrd) == PL330_STATE_KILLING)
                        UNTIL(thrd, PL330_STATE_STOPPED)
-               /* fall through */
+               fallthrough;
 
        case PL330_STATE_FAULTING:
                _stop(thrd);
-               /* fall through */
+               fallthrough;
 
        case PL330_STATE_KILLING:
        case PL330_STATE_COMPLETING:
                UNTIL(thrd, PL330_STATE_STOPPED)
-               /* fall through */
+               fallthrough;
 
        case PL330_STATE_STOPPED:
                return _trigger(thrd);
@@ -1121,7 +1121,6 @@ static u32 _emit_load(unsigned int dry_run, u8 buf[],
 
        switch (direction) {
        case DMA_MEM_TO_MEM:
-               /* fall through */
        case DMA_MEM_TO_DEV:
                off += _emit_LD(dry_run, &buf[off], cond);
                break;
@@ -1155,7 +1154,6 @@ static inline u32 _emit_store(unsigned int dry_run, u8 buf[],
 
        switch (direction) {
        case DMA_MEM_TO_MEM:
-               /* fall through */
        case DMA_DEV_TO_MEM:
                off += _emit_ST(dry_run, &buf[off], cond);
                break;
@@ -1216,7 +1214,6 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
 
        switch (pxs->desc->rqtype) {
        case DMA_MEM_TO_DEV:
-               /* fall through */
        case DMA_DEV_TO_MEM:
                off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, cyc,
                        cond);
@@ -1266,7 +1263,6 @@ static int _dregs(struct pl330_dmac *pl330, unsigned int dry_run, u8 buf[],
 
        switch (pxs->desc->rqtype) {
        case DMA_MEM_TO_DEV:
-               /* fall through */
        case DMA_DEV_TO_MEM:
                off += _emit_MOV(dry_run, &buf[off], CCR, dregs_ccr);
                off += _ldst_peripheral(pl330, dry_run, &buf[off], pxs, 1,
@@ -2801,6 +2797,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
        while (burst != (1 << desc->rqcfg.brst_size))
                desc->rqcfg.brst_size++;
 
+       desc->rqcfg.brst_len = get_burst_len(desc, len);
        /*
         * If burst size is smaller than bus width then make sure we only
         * transfer one at a time to avoid a burst stradling an MFIFO entry.
@@ -2808,7 +2805,6 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
        if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width)
                desc->rqcfg.brst_len = 1;
 
-       desc->rqcfg.brst_len = get_burst_len(desc, len);
        desc->bytes_requested = len;
 
        desc->txd.flags = flags;
index 2deeaab078a46f0119dd19c9adce9d2642e8d274..788d696323bbed133e935093585d9e70743e92fb 100644 (file)
@@ -383,7 +383,7 @@ static dma_async_tx_callback __ld_cleanup(struct shdma_chan *schan, bool all)
                        switch (desc->mark) {
                        case DESC_COMPLETED:
                                desc->mark = DESC_WAITING;
-                               /* Fall through */
+                               fallthrough;
                        case DESC_WAITING:
                                if (head_acked)
                                        async_tx_ack(&desc->async_tx);
index c14e6cb105cd80ed1464313d692cb7545bb3008e..d86dba0fd8e6b6cc2da03fe69d524308dbc9b446 100644 (file)
@@ -2059,9 +2059,9 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl,
                        return NULL;
                }
 
-               cppi5_tr_init(&tr_req[i].flags, CPPI5_TR_TYPE1, false, false,
-                             CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
-               cppi5_tr_csf_set(&tr_req[i].flags, CPPI5_TR_CSF_SUPR_EVT);
+               cppi5_tr_init(&tr_req[tr_idx].flags, CPPI5_TR_TYPE1, false,
+                             false, CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
+               cppi5_tr_csf_set(&tr_req[tr_idx].flags, CPPI5_TR_CSF_SUPR_EVT);
 
                tr_req[tr_idx].addr = sg_addr;
                tr_req[tr_idx].icnt0 = tr0_cnt0;
@@ -3101,14 +3101,14 @@ static struct udma_match_data am654_main_data = {
        .psil_base = 0x1000,
        .enable_memcpy_support = true,
        .statictr_z_mask = GENMASK(11, 0),
-       .rchan_oes_offset = 0x2000,
+       .rchan_oes_offset = 0x200,
 };
 
 static struct udma_match_data am654_mcu_data = {
        .psil_base = 0x6000,
        .enable_memcpy_support = false,
        .statictr_z_mask = GENMASK(11, 0),
-       .rchan_oes_offset = 0x2000,
+       .rchan_oes_offset = 0x200,
 };
 
 static struct udma_match_data j721e_main_data = {
index 6262f6370c5dea9c7b7d83855e1e313ef9e50d0c..fcc08bbf6945f7ace4108f9537694fdba89f1a96 100644 (file)
@@ -3375,7 +3375,7 @@ static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt)
                        pvt->ops = &family_types[F17_M70H_CPUS].ops;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case 0x18:
                fam_type        = &family_types[F17_CPUS];
                pvt->ops        = &family_types[F17_CPUS].ops;
index da60c29468a7cf48575ed1d8000963732ceb5728..94d1e3165052757bc106603af97448841134123d 100644 (file)
@@ -55,6 +55,8 @@ static DEFINE_SPINLOCK(ghes_lock);
 static bool __read_mostly force_load;
 module_param(force_load, bool, 0);
 
+static bool system_scanned;
+
 /* Memory Device - Type 17 of SMBIOS spec */
 struct memdev_dmi_entry {
        u8 type;
@@ -225,14 +227,12 @@ static void enumerate_dimms(const struct dmi_header *dh, void *arg)
 
 static void ghes_scan_system(void)
 {
-       static bool scanned;
-
-       if (scanned)
+       if (system_scanned)
                return;
 
        dmi_walk(enumerate_dimms, &ghes_hw);
 
-       scanned = true;
+       system_scanned = true;
 }
 
 void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
@@ -508,6 +508,7 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev)
                if (!force_load && idx < 0)
                        return -ENODEV;
        } else {
+               force_load = true;
                idx = 0;
        }
 
@@ -629,8 +630,14 @@ void ghes_edac_unregister(struct ghes *ghes)
        struct mem_ctl_info *mci;
        unsigned long flags;
 
+       if (!force_load)
+               return;
+
        mutex_lock(&ghes_reg_mutex);
 
+       system_scanned = false;
+       memset(&ghes_hw, 0, sizeof(struct ghes_hw_desc));
+
        if (!refcount_dec_and_test(&ghes_refcount))
                goto unlock;
 
index b8fc4b84fd8672b174804b00cf79f25a58a9ac8c..928f63a374c78cdc98d89ceefa5e543ce368351a 100644 (file)
@@ -198,7 +198,7 @@ static int apl_rd_reg(int port, int off, int op, void *data, size_t sz, char *na
        switch (sz) {
        case 8:
                ret = _apl_rd_reg(port, off + 4, op, (u32 *)(data + 4));
-               /* fall through */
+               fallthrough;
        case 4:
                ret |= _apl_rd_reg(port, off, op, (u32 *)data);
                pnd2_printk(KERN_DEBUG, "%s=%x%08x ret=%d\n", name,
index b785e936244f530eafc35ed1b804822eaf99ef6a..80db43a22069802992f0b01214df6564acbd662a 100644 (file)
@@ -957,7 +957,7 @@ static void set_broadcast_channel(struct fw_device *device, int generation)
                                device->bc_implemented = BC_IMPLEMENTED;
                                break;
                        }
-                       /* else, fall through - to case address error */
+                       fallthrough;    /* to case address error */
                case RCODE_ADDRESS_ERROR:
                        device->bc_implemented = BC_UNIMPLEMENTED;
                }
index 185b0b78b3d68c8d9e8b8135d3841a728602b109..af70e74f9a7e1ad21a54ee45fa968b063eadc04d 100644 (file)
@@ -277,7 +277,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
                        if ((data[0] & bit) == (data[1] & bit))
                                continue;
 
-                       /* fall through - It's a 1394-1995 IRM, retry. */
+                       fallthrough;    /* It's a 1394-1995 IRM, retry */
                default:
                        if (retry) {
                                retry--;
index 94a13fca82673b4036052378b398a239a0c57ace..ec68ed27b0a5f5c72091ea5ae56c5b74088672f2 100644 (file)
@@ -54,7 +54,7 @@ static u32 *count_ports(u32 *sid, int *total_port_count, int *child_port_count)
                switch (port_type) {
                case SELFID_PORT_CHILD:
                        (*child_port_count)++;
-                       /* fall through */
+                       fallthrough;
                case SELFID_PORT_PARENT:
                case SELFID_PORT_NCONN:
                        (*total_port_count)++;
index 439d918bbaafaafcbe6cf38dda01b856d66d5f42..ac487c96bb717f9e76f2a6d092c6ff0af8515dd2 100644 (file)
@@ -1097,14 +1097,14 @@ static void handle_registers(struct fw_card *card, struct fw_request *request,
                        rcode = RCODE_ADDRESS_ERROR;
                        break;
                }
-               /* else fall through */
+               fallthrough;
 
        case CSR_NODE_IDS:
                /*
                 * per IEEE 1394-2008 8.3.22.3, not IEEE 1394.1-2004 3.2.8
                 * and 9.6, but interoperable with IEEE 1394.1-2004 bridges
                 */
-               /* fall through */
+               fallthrough;
 
        case CSR_STATE_CLEAR:
        case CSR_STATE_SET:
index 7dde21b18b04c672516ceb14aaa1cc606ff17bcc..020cb15a4d8fccf3705616544275df560c8923a5 100644 (file)
@@ -1495,7 +1495,7 @@ static int handle_at_packet(struct context *context,
                        packet->ack = RCODE_GENERATION;
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        default:
                packet->ack = RCODE_SEND_ERROR;
@@ -3054,7 +3054,7 @@ static int ohci_start_iso(struct fw_iso_context *base,
 
        case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
                control |= IR_CONTEXT_BUFFER_FILL|IR_CONTEXT_MULTI_CHANNEL_MODE;
-               /* fall through */
+               fallthrough;
        case FW_ISO_CONTEXT_RECEIVE:
                index = ctx - ohci->ir_context_list;
                match = (tags << 28) | (sync << 8) | ctx->base.channel;
index 35dccc88ac0af7413e7af1431bc2f1b5eee55265..15a47539dc5638206fb326789868a92a3bd381ff 100644 (file)
@@ -84,7 +84,7 @@ static int __init efibc_init(void)
 {
        int ret;
 
-       if (!efi_enabled(EFI_RUNTIME_SERVICES))
+       if (!efivars_kobject() || !efivar_supports_writes())
                return -ENODEV;
 
        ret = register_reboot_notifier(&efibc_reboot_notifier);
index e97a9c9d010c82d67951f81b78807c661ec54594..21ae0c48232a118bac79cc4a7783eb30700b4478 100644 (file)
@@ -16,9 +16,9 @@
 
 /* Exported for use by lib/test_firmware.c only */
 LIST_HEAD(efi_embedded_fw_list);
-EXPORT_SYMBOL_GPL(efi_embedded_fw_list);
-
-static bool checked_for_fw;
+EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_list, TEST_FIRMWARE);
+bool efi_embedded_fw_checked;
+EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_checked, TEST_FIRMWARE);
 
 static const struct dmi_system_id * const embedded_fw_table[] = {
 #ifdef CONFIG_TOUCHSCREEN_DMI
@@ -116,14 +116,14 @@ void __init efi_check_for_embedded_firmwares(void)
                }
        }
 
-       checked_for_fw = true;
+       efi_embedded_fw_checked = true;
 }
 
 int efi_get_embedded_fw(const char *name, const u8 **data, size_t *size)
 {
        struct efi_embedded_fw *iter, *fw = NULL;
 
-       if (!checked_for_fw) {
+       if (!efi_embedded_fw_checked) {
                pr_warn("Warning %s called while we did not check for embedded fw\n",
                        __func__);
                return -ENOENT;
index 53cee17d011584f5621e3ab42ed7d094cbba9934..722af9ee53d65d26fd72a059cc661536d5a0a97a 100644 (file)
@@ -64,22 +64,6 @@ struct ti_sci_xfers_info {
        spinlock_t xfer_lock;
 };
 
-/**
- * struct ti_sci_rm_type_map - Structure representing TISCI Resource
- *                             management representation of dev_ids.
- * @dev_id:    TISCI device ID
- * @type:      Corresponding id as identified by TISCI RM.
- *
- * Note: This is used only as a work around for using RM range apis
- *     for AM654 SoC. For future SoCs dev_id will be used as type
- *     for RM range APIs. In order to maintain ABI backward compatibility
- *     type is not being changed for AM654 SoC.
- */
-struct ti_sci_rm_type_map {
-       u32 dev_id;
-       u16 type;
-};
-
 /**
  * struct ti_sci_desc - Description of SoC integration
  * @default_host_id:   Host identifier representing the compute entity
@@ -87,14 +71,12 @@ struct ti_sci_rm_type_map {
  * @max_msgs: Maximum number of messages that can be pending
  *               simultaneously in the system
  * @max_msg_size: Maximum size of data per message that can be handled.
- * @rm_type_map: RM resource type mapping structure.
  */
 struct ti_sci_desc {
        u8 default_host_id;
        int max_rx_timeout_ms;
        int max_msgs;
        int max_msg_size;
-       struct ti_sci_rm_type_map *rm_type_map;
 };
 
 /**
@@ -1710,33 +1692,6 @@ fail:
        return ret;
 }
 
-static int ti_sci_get_resource_type(struct ti_sci_info *info, u16 dev_id,
-                                   u16 *type)
-{
-       struct ti_sci_rm_type_map *rm_type_map = info->desc->rm_type_map;
-       bool found = false;
-       int i;
-
-       /* If map is not provided then assume dev_id is used as type */
-       if (!rm_type_map) {
-               *type = dev_id;
-               return 0;
-       }
-
-       for (i = 0; rm_type_map[i].dev_id; i++) {
-               if (rm_type_map[i].dev_id == dev_id) {
-                       *type = rm_type_map[i].type;
-                       found = true;
-                       break;
-               }
-       }
-
-       if (!found)
-               return -EINVAL;
-
-       return 0;
-}
-
 /**
  * ti_sci_get_resource_range - Helper to get a range of resources assigned
  *                            to a host. Resource is uniquely identified by
@@ -1760,7 +1715,6 @@ static int ti_sci_get_resource_range(const struct ti_sci_handle *handle,
        struct ti_sci_xfer *xfer;
        struct ti_sci_info *info;
        struct device *dev;
-       u16 type;
        int ret = 0;
 
        if (IS_ERR(handle))
@@ -1780,15 +1734,9 @@ static int ti_sci_get_resource_range(const struct ti_sci_handle *handle,
                return ret;
        }
 
-       ret = ti_sci_get_resource_type(info, dev_id, &type);
-       if (ret) {
-               dev_err(dev, "rm type lookup failed for %u\n", dev_id);
-               goto fail;
-       }
-
        req = (struct ti_sci_msg_req_get_resource_range *)xfer->xfer_buf;
        req->secondary_host = s_host;
-       req->type = type & MSG_RM_RESOURCE_TYPE_MASK;
+       req->type = dev_id & MSG_RM_RESOURCE_TYPE_MASK;
        req->subtype = subtype & MSG_RM_RESOURCE_SUBTYPE_MASK;
 
        ret = ti_sci_do_xfer(info, xfer);
@@ -3260,61 +3208,50 @@ u32 ti_sci_get_num_resources(struct ti_sci_resource *res)
 EXPORT_SYMBOL_GPL(ti_sci_get_num_resources);
 
 /**
- * devm_ti_sci_get_of_resource() - Get a TISCI resource assigned to a device
+ * devm_ti_sci_get_resource_sets() - Get a TISCI resources assigned to a device
  * @handle:    TISCI handle
  * @dev:       Device pointer to which the resource is assigned
  * @dev_id:    TISCI device id to which the resource is assigned
- * @of_prop:   property name by which the resource are represented
+ * @sub_types: Array of sub_types assigned corresponding to device
+ * @sets:      Number of sub_types
  *
  * Return: Pointer to ti_sci_resource if all went well else appropriate
  *        error pointer.
  */
-struct ti_sci_resource *
-devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
-                           struct device *dev, u32 dev_id, char *of_prop)
+static struct ti_sci_resource *
+devm_ti_sci_get_resource_sets(const struct ti_sci_handle *handle,
+                             struct device *dev, u32 dev_id, u32 *sub_types,
+                             u32 sets)
 {
        struct ti_sci_resource *res;
        bool valid_set = false;
-       u32 resource_subtype;
        int i, ret;
 
        res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL);
        if (!res)
                return ERR_PTR(-ENOMEM);
 
-       ret = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
-                                             sizeof(u32));
-       if (ret < 0) {
-               dev_err(dev, "%s resource type ids not available\n", of_prop);
-               return ERR_PTR(ret);
-       }
-       res->sets = ret;
-
+       res->sets = sets;
        res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc),
                                 GFP_KERNEL);
        if (!res->desc)
                return ERR_PTR(-ENOMEM);
 
        for (i = 0; i < res->sets; i++) {
-               ret = of_property_read_u32_index(dev_of_node(dev), of_prop, i,
-                                                &resource_subtype);
-               if (ret)
-                       return ERR_PTR(-EINVAL);
-
                ret = handle->ops.rm_core_ops.get_range(handle, dev_id,
-                                                       resource_subtype,
+                                                       sub_types[i],
                                                        &res->desc[i].start,
                                                        &res->desc[i].num);
                if (ret) {
                        dev_dbg(dev, "dev = %d subtype %d not allocated for this host\n",
-                               dev_id, resource_subtype);
+                               dev_id, sub_types[i]);
                        res->desc[i].start = 0;
                        res->desc[i].num = 0;
                        continue;
                }
 
                dev_dbg(dev, "dev = %d, subtype = %d, start = %d, num = %d\n",
-                       dev_id, resource_subtype, res->desc[i].start,
+                       dev_id, sub_types[i], res->desc[i].start,
                        res->desc[i].num);
 
                valid_set = true;
@@ -3332,6 +3269,62 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
        return ERR_PTR(-EINVAL);
 }
 
+/**
+ * devm_ti_sci_get_of_resource() - Get a TISCI resource assigned to a device
+ * @handle:    TISCI handle
+ * @dev:       Device pointer to which the resource is assigned
+ * @dev_id:    TISCI device id to which the resource is assigned
+ * @of_prop:   property name by which the resource are represented
+ *
+ * Return: Pointer to ti_sci_resource if all went well else appropriate
+ *        error pointer.
+ */
+struct ti_sci_resource *
+devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
+                           struct device *dev, u32 dev_id, char *of_prop)
+{
+       struct ti_sci_resource *res;
+       u32 *sub_types;
+       int sets;
+
+       sets = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
+                                              sizeof(u32));
+       if (sets < 0) {
+               dev_err(dev, "%s resource type ids not available\n", of_prop);
+               return ERR_PTR(sets);
+       }
+
+       sub_types = kcalloc(sets, sizeof(*sub_types), GFP_KERNEL);
+       if (!sub_types)
+               return ERR_PTR(-ENOMEM);
+
+       of_property_read_u32_array(dev_of_node(dev), of_prop, sub_types, sets);
+       res = devm_ti_sci_get_resource_sets(handle, dev, dev_id, sub_types,
+                                           sets);
+
+       kfree(sub_types);
+       return res;
+}
+EXPORT_SYMBOL_GPL(devm_ti_sci_get_of_resource);
+
+/**
+ * devm_ti_sci_get_resource() - Get a resource range assigned to the device
+ * @handle:    TISCI handle
+ * @dev:       Device pointer to which the resource is assigned
+ * @dev_id:    TISCI device id to which the resource is assigned
+ * @suub_type: TISCI resource subytpe representing the resource.
+ *
+ * Return: Pointer to ti_sci_resource if all went well else appropriate
+ *        error pointer.
+ */
+struct ti_sci_resource *
+devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
+                        u32 dev_id, u32 sub_type)
+{
+       return devm_ti_sci_get_resource_sets(handle, dev, dev_id, &sub_type, 1);
+}
+EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource);
+
 static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
                                void *cmd)
 {
@@ -3352,17 +3345,6 @@ static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = {
        /* Limited by MBOX_TX_QUEUE_LEN. K2G can handle upto 128 messages! */
        .max_msgs = 20,
        .max_msg_size = 64,
-       .rm_type_map = NULL,
-};
-
-static struct ti_sci_rm_type_map ti_sci_am654_rm_type_map[] = {
-       {.dev_id = 56, .type = 0x00b}, /* GIC_IRQ */
-       {.dev_id = 179, .type = 0x000}, /* MAIN_NAV_UDMASS_IA0 */
-       {.dev_id = 187, .type = 0x009}, /* MAIN_NAV_RA */
-       {.dev_id = 188, .type = 0x006}, /* MAIN_NAV_UDMAP */
-       {.dev_id = 194, .type = 0x007}, /* MCU_NAV_UDMAP */
-       {.dev_id = 195, .type = 0x00a}, /* MCU_NAV_RA */
-       {.dev_id = 0, .type = 0x000}, /* end of table */
 };
 
 /* Description for AM654 */
@@ -3373,7 +3355,6 @@ static const struct ti_sci_desc ti_sci_pmmc_am654_desc = {
        /* Limited by MBOX_TX_QUEUE_LEN. K2G can handle upto 128 messages! */
        .max_msgs = 20,
        .max_msg_size = 60,
-       .rm_type_map = ti_sci_am654_rm_type_map,
 };
 
 static const struct of_device_id ti_sci_of_match[] = {
index a0eb00c024f62d12d331764b7676b7e70dbc896f..64e54f8c30d2d6f4371d8f1fc6ce16d54b4abae0 100644 (file)
@@ -345,16 +345,16 @@ static int aspeed_sgpio_set_type(struct irq_data *d, unsigned int type)
        switch (type & IRQ_TYPE_SENSE_MASK) {
        case IRQ_TYPE_EDGE_BOTH:
                type2 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_EDGE_RISING:
                type0 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_EDGE_FALLING:
                handler = handle_edge_irq;
                break;
        case IRQ_TYPE_LEVEL_HIGH:
                type0 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_LEVEL_LOW:
                type1 |= bit;
                handler = handle_level_irq;
index d07bf2c3f1369bbe4b4d45c9bdcbe421c65b604c..e44d5de2a1201a1ecce4d6d9985c473dcc071a26 100644 (file)
@@ -611,16 +611,16 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type)
        switch (type & IRQ_TYPE_SENSE_MASK) {
        case IRQ_TYPE_EDGE_BOTH:
                type2 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_EDGE_RISING:
                type0 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_EDGE_FALLING:
                handler = handle_edge_irq;
                break;
        case IRQ_TYPE_LEVEL_HIGH:
                type0 |= bit;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_LEVEL_LOW:
                type1 |= bit;
                handler = handle_level_irq;
index 53fae02c40ad8299c7230e6792771924ce991314..d5359341cc6b2f6c4444ae1aec4cc08cdef0758c 100644 (file)
@@ -129,7 +129,7 @@ static int ath79_gpio_irq_set_type(struct irq_data *data,
 
        case IRQ_TYPE_LEVEL_HIGH:
                polarity |= mask;
-               /* fall through */
+               fallthrough;
        case IRQ_TYPE_LEVEL_LOW:
                type |= mask;
                break;
index 8c97577740100914242bbf5cdc56aca8ca61163a..ad61daf6c2125f9a54cc6696f8f3add5818da96e 100644 (file)
@@ -617,14 +617,12 @@ static int sprd_eic_probe(struct platform_device *pdev)
                sprd_eic->chip.free = sprd_eic_free;
                sprd_eic->chip.set_config = sprd_eic_set_config;
                sprd_eic->chip.set = sprd_eic_set;
-               /* fall-through */
+               fallthrough;
        case SPRD_EIC_ASYNC:
-               /* fall-through */
        case SPRD_EIC_SYNC:
                sprd_eic->chip.get = sprd_eic_get;
                break;
        case SPRD_EIC_LATCH:
-               /* fall-through */
        default:
                break;
        }
index 6c48809d0505b35bdb455eb23d96981cb28c8e04..b0155d6007c81a3ee3fc71fc73c309f299667876 100644 (file)
@@ -308,7 +308,7 @@ static void stmpe_dbg_show_one(struct seq_file *s,
                        if (ret < 0)
                                return;
                        edge_det = !!(ret & mask);
-                       /* fall through */
+                       fallthrough;
                case STMPE1801:
                        rise_reg = stmpe->regs[STMPE_IDX_GPRER_LSB + bank];
                        fall_reg = stmpe->regs[STMPE_IDX_GPFER_LSB + bank];
@@ -321,7 +321,7 @@ static void stmpe_dbg_show_one(struct seq_file *s,
                        if (ret < 0)
                                return;
                        fall = !!(ret & mask);
-                       /* fall through */
+                       fallthrough;
                case STMPE801:
                case STMPE1600:
                        irqen_reg = stmpe->regs[STMPE_IDX_IEGPIOR_LSB + bank];
index 9276051663dade53683f3d1cd6065f949f3db537..54ca3c18b291cafe75021e3e0ae4437ea60bcac2 100644 (file)
@@ -1264,7 +1264,7 @@ static int acpi_gpio_package_count(const union acpi_object *obj)
                switch (element->type) {
                case ACPI_TYPE_LOCAL_REFERENCE:
                        element += 3;
-                       /* Fallthrough */
+                       fallthrough;
                case ACPI_TYPE_INTEGER:
                        element++;
                        count++;
index 7e59e473a190103e82568ffd72b20d5526a838fe..cdea1338c8dc019d1dd8f7d5bb40fa91b53b2862 100644 (file)
@@ -152,7 +152,7 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev,
                dev_warn(adev->dev,
                         "Invalid sdma engine id (%d), using engine id 0\n",
                         engine_id);
-               /* fall through */
+               fallthrough;
        case 0:
                sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0,
                                mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL;
index eb7cfe87042ee3ae74d4cd0928b8e502a5be4b90..d0b8d0d341af5398e38a3d2d007b5c681a85f48c 100644 (file)
@@ -80,8 +80,6 @@ MODULE_FIRMWARE("amdgpu/renoir_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/navi10_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/navi14_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/navi12_gpu_info.bin");
-MODULE_FIRMWARE("amdgpu/sienna_cichlid_gpu_info.bin");
-MODULE_FIRMWARE("amdgpu/navy_flounder_gpu_info.bin");
 
 #define AMDGPU_RESUME_MS               2000
 
@@ -1600,6 +1598,8 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
        case CHIP_CARRIZO:
        case CHIP_STONEY:
        case CHIP_VEGA20:
+       case CHIP_SIENNA_CICHLID:
+       case CHIP_NAVY_FLOUNDER:
        default:
                return 0;
        case CHIP_VEGA10:
@@ -1631,12 +1631,6 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
        case CHIP_NAVI12:
                chip_name = "navi12";
                break;
-       case CHIP_SIENNA_CICHLID:
-               chip_name = "sienna_cichlid";
-               break;
-       case CHIP_NAVY_FLOUNDER:
-               chip_name = "navy_flounder";
-               break;
        }
 
        snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_gpu_info.bin", chip_name);
index d761729651998684d8a5407067a98a1e5bce09ad..44c1f6e00635c8013c22964d508ed5481256972f 100644 (file)
@@ -297,7 +297,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
           take the current one */
        if (active && !adev->have_disp_power_ref) {
                adev->have_disp_power_ref = true;
-               goto out;
+               return ret;
        }
        /* if we have no active crtcs, then drop the power ref
           we got before */
index 26127c7d2f32d6ccabc5d65fee42907493367519..321032d3a51a265a49e7bfa11e86b8c77726a1e1 100644 (file)
@@ -1044,8 +1044,16 @@ static const struct pci_device_id pciidlist[] = {
        {0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
 
        /* Navi12 */
-       {0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12|AMD_EXP_HW_SUPPORT},
-       {0x1002, 0x7362, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12|AMD_EXP_HW_SUPPORT},
+       {0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12},
+       {0x1002, 0x7362, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12},
+
+       /* Sienna_Cichlid */
+       {0x1002, 0x73A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73AB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73AE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73BF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
 
        {0, 0, 0}
 };
index 0047da06041f2038fede7205cc7e703ec865adc0..414548064648edbbdf1db0161275aad63b112cd2 100644 (file)
@@ -179,6 +179,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
                case CHIP_VEGA20:
                case CHIP_ARCTURUS:
                case CHIP_SIENNA_CICHLID:
+               case CHIP_NAVY_FLOUNDER:
                        /* enable runpm if runpm=1 */
                        if (amdgpu_runtime_pm > 0)
                                adev->runpm = true;
@@ -678,8 +679,12 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                 * in the bitfields */
                if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK)
                        se_num = 0xffffffff;
+               else if (se_num >= AMDGPU_GFX_MAX_SE)
+                       return -EINVAL;
                if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK)
                        sh_num = 0xffffffff;
+               else if (sh_num >= AMDGPU_GFX_MAX_SH_PER_SE)
+                       return -EINVAL;
 
                if (info->read_mmr_reg.count > 128)
                        return -EINVAL;
index 7fe564275457f661edcdf148f4430b4666080e55..06757681b2cecc28bc3888aca376f03506a4cd72 100644 (file)
@@ -178,7 +178,7 @@ static int psp_sw_init(void *handle)
                return ret;
        }
 
-       if (adev->asic_type == CHIP_NAVI10) {
+       if (adev->asic_type == CHIP_NAVI10 || adev->asic_type == CHIP_SIENNA_CICHLID) {
                ret= psp_sysfs_init(adev);
                if (ret) {
                        return ret;
@@ -522,8 +522,7 @@ static int psp_asd_load(struct psp_context *psp)
         * add workaround to bypass it for sriov now.
         * TODO: add version check to make it common
         */
-       if (amdgpu_sriov_vf(psp->adev) ||
-           (psp->adev->asic_type == CHIP_NAVY_FLOUNDER))
+       if (amdgpu_sriov_vf(psp->adev) || !psp->asd_fw)
                return 0;
 
        cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
index e11c5d69843dbabc42a2784c798541b24441d465..978bae73139800ccc88823aff04bd176064279cc 100644 (file)
@@ -1076,6 +1076,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
 
 release_sg:
        kfree(ttm->sg);
+       ttm->sg = NULL;
        return r;
 }
 
index 65997ffaed4566ced592e4d828fd13fe34006017..f73ce97212339a1a19fc013cc3b212dc6f6a781a 100644 (file)
@@ -3595,6 +3595,9 @@ static void gfx_v10_0_check_gfxoff_flag(struct amdgpu_device *adev)
                if (!gfx_v10_0_navi10_gfxoff_should_enable(adev))
                        adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
                break;
+       case CHIP_NAVY_FLOUNDER:
+               adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
+               break;
        default:
                break;
        }
@@ -7263,10 +7266,8 @@ static void gfx_v10_0_update_medium_grain_clock_gating(struct amdgpu_device *ade
                def = data = RREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE);
                data &= ~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |
                          RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK |
-                         RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK);
-
-               /* only for Vega10 & Raven1 */
-               data |= RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK;
+                         RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK |
+                         RLC_CGTT_MGCG_OVERRIDE__ENABLE_CGTS_LEGACY_MASK);
 
                if (def != data)
                        WREG32_SOC15(GC, 0, mmRLC_CGTT_MGCG_OVERRIDE, data);
index 33f1c4a46ebe0b35f74c25a7173bfdbfa11543f4..88f63d7ea3712fc49d75a6a6b04aff9f4dd253d7 100644 (file)
@@ -3250,7 +3250,7 @@ static void gfx_v8_0_tiling_mode_table_init(struct amdgpu_device *adev)
                dev_warn(adev->dev,
                         "Unknown chip type (%d) in function gfx_v8_0_tiling_mode_table_init() falling through to CHIP_CARRIZO\n",
                         adev->asic_type);
-               /* fall through */
+               fallthrough;
 
        case CHIP_CARRIZO:
                modearray[0] = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
index 6e4f3ff4810f1475c9e8860c479ac53c43a26451..b67ba38a195f723d1cc3ca0cf320e8a3524659b4 100644 (file)
@@ -1297,7 +1297,7 @@ static void gmc_v9_0_init_golden_registers(struct amdgpu_device *adev)
        case CHIP_VEGA10:
                if (amdgpu_sriov_vf(adev))
                        break;
-               /* fall through */
+               fallthrough;
        case CHIP_VEGA20:
                soc15_program_register_sequence(adev,
                                                golden_settings_mmhub_1_0_0,
index da8024c2826eced6c8097bfb79d2c7ec3a4c2039..ca11253e787cac8949d8edd066897bb29f510830 100644 (file)
@@ -364,6 +364,7 @@ nv_asic_reset_method(struct amdgpu_device *adev)
 
        switch (adev->asic_type) {
        case CHIP_SIENNA_CICHLID:
+       case CHIP_NAVY_FLOUNDER:
                return AMD_RESET_METHOD_MODE1;
        default:
                if (smu_baco_is_support(smu))
index e16874f30d5dc11bc2021d24c81e31dcb18e043f..6c5d9612abcb6dea02e46b36bd20f79267a02ced 100644 (file)
@@ -58,7 +58,7 @@ MODULE_FIRMWARE("amdgpu/arcturus_ta.bin");
 MODULE_FIRMWARE("amdgpu/sienna_cichlid_sos.bin");
 MODULE_FIRMWARE("amdgpu/sienna_cichlid_ta.bin");
 MODULE_FIRMWARE("amdgpu/navy_flounder_sos.bin");
-MODULE_FIRMWARE("amdgpu/navy_flounder_asd.bin");
+MODULE_FIRMWARE("amdgpu/navy_flounder_ta.bin");
 
 /* address block */
 #define smnMP1_FIRMWARE_FLAGS          0x3010024
index ea914b256ebd6c41a0d8c11751eddd6974655a62..b5986d19dc08b576a832ffb807b8f38482323d0b 100644 (file)
@@ -6196,7 +6196,7 @@ static void si_request_link_speed_change_before_state_change(struct amdgpu_devic
                        si_pi->force_pcie_gen = AMDGPU_PCIE_GEN2;
                        if (current_link_speed == AMDGPU_PCIE_GEN2)
                                break;
-                       /* fall through */
+                       fallthrough;
                case AMDGPU_PCIE_GEN2:
                        if (amdgpu_acpi_pcie_performance_request(adev, PCIE_PERF_REQ_PECI_GEN2, false) == 0)
                                break;
index 63e5547cfb16d8a0264c923030fc430bde120afa..3a805eaf6f11e8825752f903fa6a69934156cc13 100644 (file)
@@ -746,18 +746,18 @@ static void vcn_v3_0_disable_clock_gating(struct amdgpu_device *adev, int inst)
                | UVD_SUVD_CGC_GATE__IME_HEVC_MASK
                | UVD_SUVD_CGC_GATE__EFC_MASK
                | UVD_SUVD_CGC_GATE__SAOE_MASK
-               | 0x08000000
+               | UVD_SUVD_CGC_GATE__SRE_AV1_MASK
                | UVD_SUVD_CGC_GATE__FBC_PCLK_MASK
                | UVD_SUVD_CGC_GATE__FBC_CCLK_MASK
-               | 0x40000000
+               | UVD_SUVD_CGC_GATE__SCM_AV1_MASK
                | UVD_SUVD_CGC_GATE__SMPA_MASK);
        WREG32_SOC15(VCN, inst, mmUVD_SUVD_CGC_GATE, data);
 
        data = RREG32_SOC15(VCN, inst, mmUVD_SUVD_CGC_GATE2);
        data |= (UVD_SUVD_CGC_GATE2__MPBE0_MASK
                | UVD_SUVD_CGC_GATE2__MPBE1_MASK
-               | 0x00000004
-               | 0x00000008
+               | UVD_SUVD_CGC_GATE2__SIT_AV1_MASK
+               | UVD_SUVD_CGC_GATE2__SDB_AV1_MASK
                | UVD_SUVD_CGC_GATE2__MPC1_MASK);
        WREG32_SOC15(VCN, inst, mmUVD_SUVD_CGC_GATE2, data);
 
@@ -776,8 +776,8 @@ static void vcn_v3_0_disable_clock_gating(struct amdgpu_device *adev, int inst)
                | UVD_SUVD_CGC_CTRL__SMPA_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPBE0_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPBE1_MODE_MASK
-               | 0x00008000
-               | 0x00010000
+               | UVD_SUVD_CGC_CTRL__SIT_AV1_MODE_MASK
+               | UVD_SUVD_CGC_CTRL__SDB_AV1_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPC1_MODE_MASK
                | UVD_SUVD_CGC_CTRL__FBC_PCLK_MASK
                | UVD_SUVD_CGC_CTRL__FBC_CCLK_MASK);
@@ -892,8 +892,8 @@ static void vcn_v3_0_enable_clock_gating(struct amdgpu_device *adev, int inst)
                | UVD_SUVD_CGC_CTRL__SMPA_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPBE0_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPBE1_MODE_MASK
-               | 0x00008000
-               | 0x00010000
+               | UVD_SUVD_CGC_CTRL__SIT_AV1_MODE_MASK
+               | UVD_SUVD_CGC_CTRL__SDB_AV1_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPC1_MODE_MASK
                | UVD_SUVD_CGC_CTRL__FBC_PCLK_MASK
                | UVD_SUVD_CGC_CTRL__FBC_CCLK_MASK);
index e0e60b0d0669ebcfce6a33fba36691e2323c103b..0f4508b4903e70facd21d91424b68fe7a16a4a17 100644 (file)
@@ -1216,6 +1216,8 @@ static int stop_cpsch(struct device_queue_manager *dqm)
        dqm->sched_running = false;
        dqm_unlock(dqm);
 
+       pm_release_ib(&dqm->packets);
+
        kfd_gtt_sa_free(dqm->dev, dqm->fence_mem);
        pm_uninit(&dqm->packets, hanging);
 
@@ -1326,7 +1328,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
        if (q->properties.is_active) {
                increment_queue_count(dqm, q->properties.type);
 
-               retval = execute_queues_cpsch(dqm,
+               execute_queues_cpsch(dqm,
                                KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0);
        }
 
index df9338257ae0d1a2fa734ba2a4cac6ab2a82166a..4ba8b54a2695658c0b80061bfcde161dd07b93d4 100644 (file)
@@ -2834,12 +2834,18 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
                                    &dm_atomic_state_funcs);
 
        r = amdgpu_display_modeset_create_props(adev);
-       if (r)
+       if (r) {
+               dc_release_state(state->context);
+               kfree(state);
                return r;
+       }
 
        r = amdgpu_dm_audio_init(adev);
-       if (r)
+       if (r) {
+               dc_release_state(state->context);
+               kfree(state);
                return r;
+       }
 
        return 0;
 }
@@ -2856,6 +2862,8 @@ static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm)
 #if defined(CONFIG_ACPI)
        struct amdgpu_dm_backlight_caps caps;
 
+       memset(&caps, 0, sizeof(caps));
+
        if (dm->backlight_caps.caps_valid)
                return;
 
@@ -2894,51 +2902,50 @@ static int set_backlight_via_aux(struct dc_link *link, uint32_t brightness)
        return rc ? 0 : 1;
 }
 
-static u32 convert_brightness(const struct amdgpu_dm_backlight_caps *caps,
-                             const uint32_t user_brightness)
+static int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps,
+                               unsigned *min, unsigned *max)
 {
-       u32 min, max, conversion_pace;
-       u32 brightness = user_brightness;
-
        if (!caps)
-               goto out;
+               return 0;
 
-       if (!caps->aux_support) {
-               max = caps->max_input_signal;
-               min = caps->min_input_signal;
-               /*
-                * The brightness input is in the range 0-255
-                * It needs to be rescaled to be between the
-                * requested min and max input signal
-                * It also needs to be scaled up by 0x101 to
-                * match the DC interface which has a range of
-                * 0 to 0xffff
-                */
-               conversion_pace = 0x101;
-               brightness =
-                       user_brightness
-                       * conversion_pace
-                       * (max - min)
-                       / AMDGPU_MAX_BL_LEVEL
-                       + min * conversion_pace;
+       if (caps->aux_support) {
+               // Firmware limits are in nits, DC API wants millinits.
+               *max = 1000 * caps->aux_max_input_signal;
+               *min = 1000 * caps->aux_min_input_signal;
        } else {
-               /* TODO
-                * We are doing a linear interpolation here, which is OK but
-                * does not provide the optimal result. We probably want
-                * something close to the Perceptual Quantizer (PQ) curve.
-                */
-               max = caps->aux_max_input_signal;
-               min = caps->aux_min_input_signal;
-
-               brightness = (AMDGPU_MAX_BL_LEVEL - user_brightness) * min
-                              + user_brightness * max;
-               // Multiple the value by 1000 since we use millinits
-               brightness *= 1000;
-               brightness = DIV_ROUND_CLOSEST(brightness, AMDGPU_MAX_BL_LEVEL);
+               // Firmware limits are 8-bit, PWM control is 16-bit.
+               *max = 0x101 * caps->max_input_signal;
+               *min = 0x101 * caps->min_input_signal;
        }
+       return 1;
+}
+
+static u32 convert_brightness_from_user(const struct amdgpu_dm_backlight_caps *caps,
+                                       uint32_t brightness)
+{
+       unsigned min, max;
+
+       if (!get_brightness_range(caps, &min, &max))
+               return brightness;
+
+       // Rescale 0..255 to min..max
+       return min + DIV_ROUND_CLOSEST((max - min) * brightness,
+                                      AMDGPU_MAX_BL_LEVEL);
+}
+
+static u32 convert_brightness_to_user(const struct amdgpu_dm_backlight_caps *caps,
+                                     uint32_t brightness)
+{
+       unsigned min, max;
+
+       if (!get_brightness_range(caps, &min, &max))
+               return brightness;
 
-out:
-       return brightness;
+       if (brightness < min)
+               return 0;
+       // Rescale min..max to 0..255
+       return DIV_ROUND_CLOSEST(AMDGPU_MAX_BL_LEVEL * (brightness - min),
+                                max - min);
 }
 
 static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
@@ -2954,7 +2961,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd)
 
        link = (struct dc_link *)dm->backlight_link;
 
-       brightness = convert_brightness(&caps, bd->props.brightness);
+       brightness = convert_brightness_from_user(&caps, bd->props.brightness);
        // Change brightness based on AUX property
        if (caps.aux_support)
                return set_backlight_via_aux(link, brightness);
@@ -2971,7 +2978,7 @@ static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
 
        if (ret == DC_ERROR_UNEXPECTED)
                return bd->props.brightness;
-       return ret;
+       return convert_brightness_to_user(&dm->backlight_caps, ret);
 }
 
 static const struct backlight_ops amdgpu_dm_backlight_ops = {
@@ -5271,19 +5278,6 @@ static void dm_crtc_helper_disable(struct drm_crtc *crtc)
 {
 }
 
-static bool does_crtc_have_active_cursor(struct drm_crtc_state *new_crtc_state)
-{
-       struct drm_device *dev = new_crtc_state->crtc->dev;
-       struct drm_plane *plane;
-
-       drm_for_each_plane_mask(plane, dev, new_crtc_state->plane_mask) {
-               if (plane->type == DRM_PLANE_TYPE_CURSOR)
-                       return true;
-       }
-
-       return false;
-}
-
 static int count_crtc_active_planes(struct drm_crtc_state *new_crtc_state)
 {
        struct drm_atomic_state *state = new_crtc_state->state;
@@ -5347,19 +5341,20 @@ static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc,
                return ret;
        }
 
-       /* In some use cases, like reset, no stream is attached */
-       if (!dm_crtc_state->stream)
-               return 0;
-
        /*
-        * We want at least one hardware plane enabled to use
-        * the stream with a cursor enabled.
+        * We require the primary plane to be enabled whenever the CRTC is, otherwise
+        * drm_mode_cursor_universal may end up trying to enable the cursor plane while all other
+        * planes are disabled, which is not supported by the hardware. And there is legacy
+        * userspace which stops using the HW cursor altogether in response to the resulting EINVAL.
         */
-       if (state->enable && state->active &&
-           does_crtc_have_active_cursor(state) &&
-           dm_crtc_state->active_planes == 0)
+       if (state->enable &&
+           !(state->plane_mask & drm_plane_mask(crtc->primary)))
                return -EINVAL;
 
+       /* In some use cases, like reset, no stream is attached */
+       if (!dm_crtc_state->stream)
+               return 0;
+
        if (dc_validate_stream(dc, dm_crtc_state->stream) == DC_OK)
                return 0;
 
index 694c5bc93665b6378b90f2a8f597cb76a753873a..c2cd184f0bbd4b9f3baacda407a64e0bd22a87e7 100644 (file)
@@ -604,7 +604,7 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, struct
        int i = 0;
 
        hdcp_work = kcalloc(max_caps, sizeof(*hdcp_work), GFP_KERNEL);
-       if (hdcp_work == NULL)
+       if (ZERO_OR_NULL_PTR(hdcp_work))
                return NULL;
 
        hdcp_work->srm = kcalloc(PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE, sizeof(*hdcp_work->srm), GFP_KERNEL);
index e85b58f0f41663f844d013dd7faefe4a84bc9b42..336aaa09be46eef336bbc56f7adbad04c01eab30 100644 (file)
@@ -67,7 +67,7 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
        result = dc_link_aux_transfer_raw(TO_DM_AUX(aux)->ddc_service, &payload,
                                      &operation_result);
 
-       if (payload.write)
+       if (payload.write && result >= 0)
                result = msg->size;
 
        if (result < 0)
index c664404a75d4ff13c4bdd1cd84042f990a645e16..21a3073c8929e5576eed2ce67d3cf9dabb1cf6d3 100644 (file)
@@ -94,6 +94,15 @@ int rn_get_active_display_cnt_wa(
        return display_count;
 }
 
+void rn_set_low_power_state(struct clk_mgr *clk_mgr_base)
+{
+       struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+
+       rn_vbios_smu_set_dcn_low_power_state(clk_mgr, DCN_PWR_STATE_LOW_POWER);
+       /* update power state */
+       clk_mgr_base->clks.pwr_state = DCN_PWR_STATE_LOW_POWER;
+}
+
 void rn_update_clocks(struct clk_mgr *clk_mgr_base,
                        struct dc_state *context,
                        bool safe_to_lower)
@@ -516,6 +525,7 @@ static struct clk_mgr_funcs dcn21_funcs = {
        .init_clocks = rn_init_clocks,
        .enable_pme_wa = rn_enable_pme_wa,
        .are_clock_states_equal = rn_are_clock_states_equal,
+       .set_low_power_state = rn_set_low_power_state,
        .notify_wm_ranges = rn_notify_wm_ranges,
        .notify_link_rate_change = rn_notify_link_rate_change,
 };
@@ -773,7 +783,6 @@ void rn_clk_mgr_construct(
        } else {
                struct clk_log_info log_info = {0};
 
-               clk_mgr->smu_ver = rn_vbios_smu_get_smu_version(clk_mgr);
                clk_mgr->periodic_retraining_disabled = rn_vbios_smu_is_periodic_retraining_disabled(clk_mgr);
 
                /* SMU Version 55.51.0 and up no longer have an issue
index 117d8aaf2a9bf693336cb8aec20f6d518735782d..437d1a7a16fe7aa2807a0d5c9439c3955c30bf7a 100644 (file)
@@ -763,6 +763,7 @@ static bool detect_dp(struct dc_link *link,
                sink_caps->signal = dp_passive_dongle_detection(link->ddc,
                                                                sink_caps,
                                                                audio_support);
+               link->dpcd_caps.dongle_type = sink_caps->dongle_type;
        }
 
        return true;
@@ -3286,10 +3287,10 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)
                core_link_set_avmute(pipe_ctx, true);
        }
 
-       dc->hwss.blank_stream(pipe_ctx);
 #if defined(CONFIG_DRM_AMD_DC_HDCP)
        update_psp_stream_config(pipe_ctx, true);
 #endif
+       dc->hwss.blank_stream(pipe_ctx);
 
        if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
                deallocate_mst_payload(pipe_ctx);
index 9bc03f26efdafd29123aeb34418e135d14eca227..b2be6ad5101de408acaa6bd602ab1b1d63f7235f 100644 (file)
@@ -4409,9 +4409,9 @@ bool dc_link_get_backlight_level_nits(struct dc_link *link,
                        link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT))
                return false;
 
-       if (!core_link_read_dpcd(link, DP_SOURCE_BACKLIGHT_CURRENT_PEAK,
+       if (core_link_read_dpcd(link, DP_SOURCE_BACKLIGHT_CURRENT_PEAK,
                        dpcd_backlight_get.raw,
-                       sizeof(union dpcd_source_backlight_get)))
+                       sizeof(union dpcd_source_backlight_get)) != DC_OK)
                return false;
 
        *backlight_millinits_avg =
@@ -4450,9 +4450,9 @@ bool dc_link_read_default_bl_aux(struct dc_link *link, uint32_t *backlight_milli
                link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT))
                return false;
 
-       if (!core_link_read_dpcd(link, DP_SOURCE_BACKLIGHT_LEVEL,
+       if (core_link_read_dpcd(link, DP_SOURCE_BACKLIGHT_LEVEL,
                (uint8_t *) backlight_millinits,
-               sizeof(uint32_t)))
+               sizeof(uint32_t)) != DC_OK)
                return false;
 
        return true;
index 633442bc7ef268bd094e75ae9a8583700b1d86aa..d9888f316da6e1ff267e2ddde97e958477e5be49 100644 (file)
@@ -233,7 +233,7 @@ struct dc_stream_state {
        union stream_update_flags update_flags;
 };
 
-#define ABM_LEVEL_IMMEDIATE_DISABLE 0xFFFFFFFF
+#define ABM_LEVEL_IMMEDIATE_DISABLE 255
 
 struct dc_stream_update {
        struct dc_stream_state *stream;
index a643927e272bdae2eeae61eede89a70087677d5e..fa643ec5a8760cbbeeb15ff4044281aec96d485e 100644 (file)
@@ -1450,33 +1450,42 @@ void dcn10_init_hw(struct dc *dc)
 void dcn10_power_down_on_boot(struct dc *dc)
 {
        int i = 0;
+       struct dc_link *edp_link;
 
-       if (dc->config.power_down_display_on_boot) {
-               struct dc_link *edp_link = get_edp_link(dc);
-
-               if (edp_link &&
-                               edp_link->link_enc->funcs->is_dig_enabled &&
-                               edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
-                               dc->hwseq->funcs.edp_backlight_control &&
-                               dc->hwss.power_down &&
-                               dc->hwss.edp_power_control) {
-                       dc->hwseq->funcs.edp_backlight_control(edp_link, false);
-                       dc->hwss.power_down(dc);
-                       dc->hwss.edp_power_control(edp_link, false);
-               } else {
-                       for (i = 0; i < dc->link_count; i++) {
-                               struct dc_link *link = dc->links[i];
-
-                               if (link->link_enc->funcs->is_dig_enabled &&
-                                               link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
-                                               dc->hwss.power_down) {
-                                       dc->hwss.power_down(dc);
-                                       break;
-                               }
+       if (!dc->config.power_down_display_on_boot)
+               return;
+
+       edp_link = get_edp_link(dc);
+       if (edp_link &&
+                       edp_link->link_enc->funcs->is_dig_enabled &&
+                       edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
+                       dc->hwseq->funcs.edp_backlight_control &&
+                       dc->hwss.power_down &&
+                       dc->hwss.edp_power_control) {
+               dc->hwseq->funcs.edp_backlight_control(edp_link, false);
+               dc->hwss.power_down(dc);
+               dc->hwss.edp_power_control(edp_link, false);
+       } else {
+               for (i = 0; i < dc->link_count; i++) {
+                       struct dc_link *link = dc->links[i];
 
+                       if (link->link_enc->funcs->is_dig_enabled &&
+                                       link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
+                                       dc->hwss.power_down) {
+                               dc->hwss.power_down(dc);
+                               break;
                        }
+
                }
        }
+
+       /*
+        * Call update_clocks with empty context
+        * to send DISPLAY_OFF
+        * Otherwise DISPLAY_OFF may not be asserted
+        */
+       if (dc->clk_mgr->funcs->set_low_power_state)
+               dc->clk_mgr->funcs->set_low_power_state(dc->clk_mgr);
 }
 
 void dcn10_reset_hw_ctx_wrap(
index 17d5cb422025e13dfb237d2ef6979364c2b10cde..8939541ad7afc52328c5e0a699a0bdcccb519ecd 100644 (file)
@@ -1213,6 +1213,7 @@ static enum dc_status dcn10_validate_global(struct dc *dc, struct dc_state *cont
        bool video_large = false;
        bool desktop_large = false;
        bool dcc_disabled = false;
+       bool mpo_enabled = false;
 
        for (i = 0; i < context->stream_count; i++) {
                if (context->stream_status[i].plane_count == 0)
@@ -1221,6 +1222,9 @@ static enum dc_status dcn10_validate_global(struct dc *dc, struct dc_state *cont
                if (context->stream_status[i].plane_count > 2)
                        return DC_FAIL_UNSUPPORTED_1;
 
+               if (context->stream_status[i].plane_count > 1)
+                       mpo_enabled = true;
+
                for (j = 0; j < context->stream_status[i].plane_count; j++) {
                        struct dc_plane_state *plane =
                                context->stream_status[i].plane_states[j];
@@ -1244,6 +1248,10 @@ static enum dc_status dcn10_validate_global(struct dc *dc, struct dc_state *cont
                }
        }
 
+       /* Disable MPO in multi-display configurations. */
+       if (context->stream_count > 1 && mpo_enabled)
+               return DC_FAIL_UNSUPPORTED_1;
+
        /*
         * Workaround: On DCN10 there is UMC issue that causes underflow when
         * playing 4k video on 4k desktop with video downscaled and single channel
index 9140b3fc767ab7fa61c232b4d2a03441898a55e4..f31f48dd0da29f9247d8e479aa08d52eaf118d27 100644 (file)
@@ -409,8 +409,8 @@ static struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv14_soc = {
                        },
                },
        .num_states = 5,
-       .sr_exit_time_us = 8.6,
-       .sr_enter_plus_exit_time_us = 10.9,
+       .sr_exit_time_us = 11.6,
+       .sr_enter_plus_exit_time_us = 13.9,
        .urgent_latency_us = 4.0,
        .urgent_latency_pixel_data_only_us = 4.0,
        .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,
index 025637a83c3ba4ed4b4d088faf2dfa0f53e10b47..bd2a068f986354ee7c9f5d1730b821d9f86cbfbf 100644 (file)
@@ -31,9 +31,21 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \
        dcn30_dio_link_encoder.o dcn30_resource.o
 
 
-CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4
-
+ifdef CONFIG_X86
 CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse
+endif
+
+ifdef CONFIG_PPC64
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -maltivec
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -maltivec
+endif
+
+ifdef CONFIG_ARM64
+CFLAGS_REMOVE_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mgeneral-regs-only
+CFLAGS_REMOVE_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mgeneral-regs-only
+endif
+
 ifdef CONFIG_CC_IS_GCC
 ifeq ($(call cc-ifversion, -lt, 0701, y), y)
 IS_OLD_GCC = 1
@@ -45,8 +57,10 @@ ifdef IS_OLD_GCC
 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
 # (8B stack alignment).
 CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o += -mpreferred-stack-boundary=4
 else
 CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o += -msse2
 endif
 
 AMD_DAL_DCN30 = $(addprefix $(AMDDALPATH)/dc/dcn30/,$(DCN30))
index 5994d2a33c40be33f43414b3391fe76803c6a8c1..947d6106f3413be62f8349faf82b8659d014386a 100644 (file)
@@ -230,6 +230,8 @@ struct clk_mgr_funcs {
 
        int (*get_dp_ref_clk_frequency)(struct clk_mgr *clk_mgr);
 
+       void (*set_low_power_state)(struct clk_mgr *clk_mgr);
+
        void (*init_clocks)(struct clk_mgr *clk_mgr);
 
        void (*enable_pme_wa) (struct clk_mgr *clk_mgr);
index d3192b9d0c3d8fb209a938bc1e0c795f8e13d944..47f8ee2832ff09716a623c8919f20840f60debf5 100644 (file)
@@ -27,7 +27,7 @@
 #define MOD_HDCP_LOG_H_
 
 #ifdef CONFIG_DRM_AMD_DC_HDCP
-#define HDCP_LOG_ERR(hdcp, ...) DRM_WARN(__VA_ARGS__)
+#define HDCP_LOG_ERR(hdcp, ...) DRM_DEBUG_KMS(__VA_ARGS__)
 #define HDCP_LOG_VER(hdcp, ...) DRM_DEBUG_KMS(__VA_ARGS__)
 #define HDCP_LOG_FSM(hdcp, ...) DRM_DEBUG_KMS(__VA_ARGS__)
 #define HDCP_LOG_TOP(hdcp, ...) pr_debug("[HDCP_TOP]:"__VA_ARGS__)
index fb1161dd7ea809d2c2e69201589a485233276188..3a367a5968ae19c5e297a7337dacf0c04e5ec397 100644 (file)
@@ -88,7 +88,7 @@ enum mod_hdcp_status mod_hdcp_add_display_to_topology(struct mod_hdcp *hdcp,
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        if (!psp->dtm_context.dtm_initialized) {
-               DRM_ERROR("Failed to add display topology, DTM TA is not initialized.");
+               DRM_INFO("Failed to add display topology, DTM TA is not initialized.");
                display->state = MOD_HDCP_DISPLAY_INACTIVE;
                return MOD_HDCP_STATUS_FAILURE;
        }
index 1116779252e650d3718cae5e0ec5756fcea819b8..e245e912535e5b6ac11fb026bec1c112d8e29f9a 100644 (file)
 #define mmDB_STENCIL_WRITE_BASE_DEFAULT                                          0x00000000
 #define mmDB_RESERVED_REG_1_DEFAULT                                              0x00000000
 #define mmDB_RESERVED_REG_3_DEFAULT                                              0x00000000
+#define mmDB_VRS_OVERRIDE_CNTL_DEFAULT                                           0x00000000
 #define mmDB_Z_READ_BASE_HI_DEFAULT                                              0x00000000
 #define mmDB_STENCIL_READ_BASE_HI_DEFAULT                                        0x00000000
 #define mmDB_Z_WRITE_BASE_HI_DEFAULT                                             0x00000000
 #define mmPA_SU_OVER_RASTERIZATION_CNTL_DEFAULT                                  0x00000000
 #define mmPA_STEREO_CNTL_DEFAULT                                                 0x00000000
 #define mmPA_STATE_STEREO_X_DEFAULT                                              0x00000000
+#define mmPA_CL_VRS_CNTL_DEFAULT                                                 0x00000000
 #define mmPA_SU_POINT_SIZE_DEFAULT                                               0x00000000
 #define mmPA_SU_POINT_MINMAX_DEFAULT                                             0x00000000
 #define mmPA_SU_LINE_CNTL_DEFAULT                                                0x00000000
index 05d1b0a5f6d25f4259cd3f0d8366f16e2939ea44..644a9fa71bb2a98b326ff7f7c35be4c76363e110 100644 (file)
 #define mmDB_RESERVED_REG_1_BASE_IDX                                                                   1
 #define mmDB_RESERVED_REG_3                                                                            0x0017
 #define mmDB_RESERVED_REG_3_BASE_IDX                                                                   1
+#define mmDB_VRS_OVERRIDE_CNTL                                                                         0x0019
+#define mmDB_VRS_OVERRIDE_CNTL_BASE_IDX                                                                1
 #define mmDB_Z_READ_BASE_HI                                                                            0x001a
 #define mmDB_Z_READ_BASE_HI_BASE_IDX                                                                   1
 #define mmDB_STENCIL_READ_BASE_HI                                                                      0x001b
 #define mmPA_STEREO_CNTL_BASE_IDX                                                                      1
 #define mmPA_STATE_STEREO_X                                                                            0x0211
 #define mmPA_STATE_STEREO_X_BASE_IDX                                                                   1
+#define mmPA_CL_VRS_CNTL                                                                               0x0212
+#define mmPA_CL_VRS_CNTL_BASE_IDX                                                                      1
 #define mmPA_SU_POINT_SIZE                                                                             0x0280
 #define mmPA_SU_POINT_SIZE_BASE_IDX                                                                    1
 #define mmPA_SU_POINT_MINMAX                                                                           0x0281
index aac57f714cf1650b85125223a6d5f643f6ebf818..2e449fcff893e84bb42b3a9b620457063cd96136 100644 (file)
 #define DB_EXCEPTION_CONTROL__AUTO_FLUSH_HTILE__SHIFT                                                         0x3
 #define DB_EXCEPTION_CONTROL__AUTO_FLUSH_QUAD__SHIFT                                                          0x4
 #define DB_EXCEPTION_CONTROL__FORCE_SUMMARIZE__SHIFT                                                          0x8
+#define DB_EXCEPTION_CONTROL__FORCE_VRS_RATE_FINE__SHIFT                                                      0x10
 #define DB_EXCEPTION_CONTROL__DTAG_WATERMARK__SHIFT                                                           0x18
 #define DB_EXCEPTION_CONTROL__EARLY_Z_PANIC_DISABLE_MASK                                                      0x00000001L
 #define DB_EXCEPTION_CONTROL__LATE_Z_PANIC_DISABLE_MASK                                                       0x00000002L
 #define DB_EXCEPTION_CONTROL__AUTO_FLUSH_HTILE_MASK                                                           0x00000008L
 #define DB_EXCEPTION_CONTROL__AUTO_FLUSH_QUAD_MASK                                                            0x00000010L
 #define DB_EXCEPTION_CONTROL__FORCE_SUMMARIZE_MASK                                                            0x00000F00L
+#define DB_EXCEPTION_CONTROL__FORCE_VRS_RATE_FINE_MASK                                                        0x00FF0000L
 #define DB_EXCEPTION_CONTROL__DTAG_WATERMARK_MASK                                                             0x7F000000L
 //DB_DFSM_CONFIG
 #define DB_DFSM_CONFIG__BYPASS_DFSM__SHIFT                                                                    0x0
 #define CB_HW_CONTROL_3__DISABLE_NACK_PROCESSING_CM__SHIFT                                                    0x18
 #define CB_HW_CONTROL_3__DISABLE_NACK_COLOR_RD_WR_OPT__SHIFT                                                  0x19
 #define CB_HW_CONTROL_3__DISABLE_BLENDER_CLOCK_GATING__SHIFT                                                  0x1a
+#define CB_HW_CONTROL_3__DISABLE_DCC_VRS_OPT__SHIFT                                                           0x1c
 #define CB_HW_CONTROL_3__DISABLE_FMASK_NOFETCH_OPT__SHIFT                                                     0x1e
 #define CB_HW_CONTROL_3__DISABLE_FMASK_NOFETCH_OPT_BC__SHIFT                                                  0x1f
 #define CB_HW_CONTROL_3__DISABLE_SLOW_MODE_EMPTY_HALF_QUAD_KILL_MASK                                          0x00000001L
 #define CB_HW_CONTROL_3__DISABLE_NACK_PROCESSING_CM_MASK                                                      0x01000000L
 #define CB_HW_CONTROL_3__DISABLE_NACK_COLOR_RD_WR_OPT_MASK                                                    0x02000000L
 #define CB_HW_CONTROL_3__DISABLE_BLENDER_CLOCK_GATING_MASK                                                    0x04000000L
+#define CB_HW_CONTROL_3__DISABLE_DCC_VRS_OPT_MASK                                                             0x10000000L
 #define CB_HW_CONTROL_3__DISABLE_FMASK_NOFETCH_OPT_MASK                                                       0x40000000L
 #define CB_HW_CONTROL_3__DISABLE_FMASK_NOFETCH_OPT_BC_MASK                                                    0x80000000L
 //CB_HW_CONTROL
 #define CB_HW_CONTROL__ALLOW_MRT_WITH_DUAL_SOURCE__SHIFT                                                      0x0
+#define CB_HW_CONTROL__DISABLE_VRS_FILLRATE_OPTIMIZATION__SHIFT                                               0x1
 #define CB_HW_CONTROL__DISABLE_FILLRATE_OPT_FIX_WITH_CFC__SHIFT                                               0x3
 #define CB_HW_CONTROL__DISABLE_POST_DCC_WITH_CFC_FIX__SHIFT                                                   0x4
+#define CB_HW_CONTROL__DISABLE_COMPRESS_1FRAG_WHEN_VRS_RATE_HINT_EN__SHIFT                                    0x5
 #define CB_HW_CONTROL__RMI_CREDITS__SHIFT                                                                     0x6
 #define CB_HW_CONTROL__CHICKEN_BITS__SHIFT                                                                    0xc
 #define CB_HW_CONTROL__DISABLE_FMASK_MULTI_MGCG_DOMAINS__SHIFT                                                0xf
 #define CB_HW_CONTROL__DISABLE_CC_IB_SERIALIZER_STATE_OPT__SHIFT                                              0x1e
 #define CB_HW_CONTROL__DISABLE_PIXEL_IN_QUAD_FIX_FOR_LINEAR_SURFACE__SHIFT                                    0x1f
 #define CB_HW_CONTROL__ALLOW_MRT_WITH_DUAL_SOURCE_MASK                                                        0x00000001L
+#define CB_HW_CONTROL__DISABLE_VRS_FILLRATE_OPTIMIZATION_MASK                                                 0x00000002L
 #define CB_HW_CONTROL__DISABLE_FILLRATE_OPT_FIX_WITH_CFC_MASK                                                 0x00000008L
 #define CB_HW_CONTROL__DISABLE_POST_DCC_WITH_CFC_FIX_MASK                                                     0x00000010L
+#define CB_HW_CONTROL__DISABLE_COMPRESS_1FRAG_WHEN_VRS_RATE_HINT_EN_MASK                                      0x00000020L
 #define CB_HW_CONTROL__RMI_CREDITS_MASK                                                                       0x00000FC0L
 #define CB_HW_CONTROL__CHICKEN_BITS_MASK                                                                      0x00007000L
 #define CB_HW_CONTROL__DISABLE_FMASK_MULTI_MGCG_DOMAINS_MASK                                                  0x00008000L
 #define DB_RENDER_OVERRIDE2__PRESERVE_SRESULTS__SHIFT                                                         0x16
 #define DB_RENDER_OVERRIDE2__DISABLE_FAST_PASS__SHIFT                                                         0x17
 #define DB_RENDER_OVERRIDE2__ALLOW_PARTIAL_RES_HIER_KILL__SHIFT                                               0x19
+#define DB_RENDER_OVERRIDE2__FORCE_VRS_RATE_FINE__SHIFT                                                       0x1a
 #define DB_RENDER_OVERRIDE2__CENTROID_COMPUTATION_MODE__SHIFT                                                 0x1b
 #define DB_RENDER_OVERRIDE2__PARTIAL_SQUAD_LAUNCH_CONTROL_MASK                                                0x00000003L
 #define DB_RENDER_OVERRIDE2__PARTIAL_SQUAD_LAUNCH_COUNTDOWN_MASK                                              0x0000001CL
 #define DB_RENDER_OVERRIDE2__PRESERVE_SRESULTS_MASK                                                           0x00400000L
 #define DB_RENDER_OVERRIDE2__DISABLE_FAST_PASS_MASK                                                           0x00800000L
 #define DB_RENDER_OVERRIDE2__ALLOW_PARTIAL_RES_HIER_KILL_MASK                                                 0x02000000L
+#define DB_RENDER_OVERRIDE2__FORCE_VRS_RATE_FINE_MASK                                                         0x04000000L
 #define DB_RENDER_OVERRIDE2__CENTROID_COMPUTATION_MODE_MASK                                                   0x18000000L
 //DB_HTILE_DATA_BASE
 #define DB_HTILE_DATA_BASE__BASE_256B__SHIFT                                                                  0x0
 //DB_RESERVED_REG_3
 #define DB_RESERVED_REG_3__FIELD_1__SHIFT                                                                     0x0
 #define DB_RESERVED_REG_3__FIELD_1_MASK                                                                       0x003FFFFFL
+//DB_VRS_OVERRIDE_CNTL
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_COMBINER_MODE__SHIFT                                          0x0
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_X__SHIFT                                                      0x4
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_Y__SHIFT                                                      0x6
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_COMBINER_MODE_MASK                                            0x00000007L
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_X_MASK                                                        0x00000030L
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_Y_MASK                                                        0x000000C0L
 //DB_Z_READ_BASE_HI
 #define DB_Z_READ_BASE_HI__BASE_HI__SHIFT                                                                     0x0
 #define DB_Z_READ_BASE_HI__BASE_HI_MASK                                                                       0x000000FFL
 #define PA_CL_VS_OUT_CNTL__VS_OUT_MISC_SIDE_BUS_ENA__SHIFT                                                    0x18
 #define PA_CL_VS_OUT_CNTL__USE_VTX_GS_CUT_FLAG__SHIFT                                                         0x19
 #define PA_CL_VS_OUT_CNTL__USE_VTX_LINE_WIDTH__SHIFT                                                          0x1b
+#define PA_CL_VS_OUT_CNTL__USE_VTX_VRS_RATE__SHIFT                                                            0x1c
 #define PA_CL_VS_OUT_CNTL__BYPASS_VTX_RATE_COMBINER__SHIFT                                                    0x1d
 #define PA_CL_VS_OUT_CNTL__BYPASS_PRIM_RATE_COMBINER__SHIFT                                                   0x1e
 #define PA_CL_VS_OUT_CNTL__CLIP_DIST_ENA_0_MASK                                                               0x00000001L
 #define PA_CL_VS_OUT_CNTL__VS_OUT_MISC_SIDE_BUS_ENA_MASK                                                      0x01000000L
 #define PA_CL_VS_OUT_CNTL__USE_VTX_GS_CUT_FLAG_MASK                                                           0x02000000L
 #define PA_CL_VS_OUT_CNTL__USE_VTX_LINE_WIDTH_MASK                                                            0x08000000L
+#define PA_CL_VS_OUT_CNTL__USE_VTX_VRS_RATE_MASK                                                              0x10000000L
 #define PA_CL_VS_OUT_CNTL__BYPASS_VTX_RATE_COMBINER_MASK                                                      0x20000000L
 #define PA_CL_VS_OUT_CNTL__BYPASS_PRIM_RATE_COMBINER_MASK                                                     0x40000000L
 //PA_CL_NANINF_CNTL
 //PA_STATE_STEREO_X
 #define PA_STATE_STEREO_X__STEREO_X_OFFSET__SHIFT                                                             0x0
 #define PA_STATE_STEREO_X__STEREO_X_OFFSET_MASK                                                               0xFFFFFFFFL
+//PA_CL_VRS_CNTL
+#define PA_CL_VRS_CNTL__VERTEX_RATE_COMBINER_MODE__SHIFT                                                      0x0
+#define PA_CL_VRS_CNTL__PRIMITIVE_RATE_COMBINER_MODE__SHIFT                                                   0x3
+#define PA_CL_VRS_CNTL__HTILE_RATE_COMBINER_MODE__SHIFT                                                       0x6
+#define PA_CL_VRS_CNTL__SAMPLE_ITER_COMBINER_MODE__SHIFT                                                      0x9
+#define PA_CL_VRS_CNTL__EXPOSE_VRS_PIXELS_MASK__SHIFT                                                         0xd
+#define PA_CL_VRS_CNTL__CMASK_RATE_HINT_FORCE_ZERO__SHIFT                                                     0xe
+#define PA_CL_VRS_CNTL__VERTEX_RATE_COMBINER_MODE_MASK                                                        0x00000007L
+#define PA_CL_VRS_CNTL__PRIMITIVE_RATE_COMBINER_MODE_MASK                                                     0x00000038L
+#define PA_CL_VRS_CNTL__HTILE_RATE_COMBINER_MODE_MASK                                                         0x000001C0L
+#define PA_CL_VRS_CNTL__SAMPLE_ITER_COMBINER_MODE_MASK                                                        0x00000E00L
+#define PA_CL_VRS_CNTL__EXPOSE_VRS_PIXELS_MASK_MASK                                                           0x00002000L
+#define PA_CL_VRS_CNTL__CMASK_RATE_HINT_FORCE_ZERO_MASK                                                       0x00004000L
 //PA_SU_POINT_SIZE
 #define PA_SU_POINT_SIZE__HEIGHT__SHIFT                                                                       0x0
 #define PA_SU_POINT_SIZE__WIDTH__SHIFT                                                                        0x10
 #define DB_HTILE_SURFACE__DST_OUTSIDE_ZERO_TO_ONE__SHIFT                                                      0x10
 #define DB_HTILE_SURFACE__RESERVED_FIELD_6__SHIFT                                                             0x11
 #define DB_HTILE_SURFACE__PIPE_ALIGNED__SHIFT                                                                 0x12
+#define DB_HTILE_SURFACE__VRS_HTILE_ENCODING__SHIFT                                                           0x13
 #define DB_HTILE_SURFACE__RESERVED_FIELD_1_MASK                                                               0x00000001L
 #define DB_HTILE_SURFACE__FULL_CACHE_MASK                                                                     0x00000002L
 #define DB_HTILE_SURFACE__RESERVED_FIELD_2_MASK                                                               0x00000004L
 #define DB_HTILE_SURFACE__DST_OUTSIDE_ZERO_TO_ONE_MASK                                                        0x00010000L
 #define DB_HTILE_SURFACE__RESERVED_FIELD_6_MASK                                                               0x00020000L
 #define DB_HTILE_SURFACE__PIPE_ALIGNED_MASK                                                                   0x00040000L
+#define DB_HTILE_SURFACE__VRS_HTILE_ENCODING_MASK                                                             0x00180000L
 //DB_SRESULTS_COMPARE_STATE0
 #define DB_SRESULTS_COMPARE_STATE0__COMPAREFUNC0__SHIFT                                                       0x0
 #define DB_SRESULTS_COMPARE_STATE0__COMPAREVALUE0__SHIFT                                                      0x4
 #define CB_COLOR0_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR0_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR0_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR0_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR0_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR0_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR0_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR0_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR0_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR0_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR0_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR1_ATTRIB3
 #define CB_COLOR1_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR1_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR1_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR1_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR1_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR1_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR1_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR1_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR1_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR1_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR1_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR1_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR1_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR2_ATTRIB3
 #define CB_COLOR2_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR2_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR2_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR2_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR2_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR2_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR2_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR2_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR2_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR2_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR2_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR2_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR2_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR3_ATTRIB3
 #define CB_COLOR3_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR3_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR3_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR3_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR3_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR3_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR3_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR3_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR3_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR3_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR3_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR3_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR3_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR4_ATTRIB3
 #define CB_COLOR4_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR4_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR4_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR4_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR4_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR4_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR4_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR4_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR4_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR4_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR4_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR4_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR4_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR5_ATTRIB3
 #define CB_COLOR5_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR5_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR5_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR5_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR5_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR5_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR5_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR5_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR5_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR5_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR5_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR5_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR5_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR6_ATTRIB3
 #define CB_COLOR6_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR6_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR6_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR6_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR6_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR6_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR6_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR6_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR6_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR6_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR6_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR6_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR6_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR7_ATTRIB3
 #define CB_COLOR7_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR7_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR7_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR7_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR7_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR7_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR7_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR7_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR7_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR7_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR7_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR7_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR7_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 
 
 // addressBlock: gc_gfxudec
index c0efd90808f2334d57eab8e328aae7b38dfd7902..58cf7adb9d5453403066fe16b6621344cb28f1cb 100644 (file)
 #define VCN_FEATURES__HAS_MJPEG2_IDCT_DEC__SHIFT                                                              0x7
 #define VCN_FEATURES__HAS_SCLR_DEC__SHIFT                                                                     0x8
 #define VCN_FEATURES__HAS_VP9_DEC__SHIFT                                                                      0x9
+#define VCN_FEATURES__HAS_AV1_DEC__SHIFT                                                                      0xa
 #define VCN_FEATURES__HAS_EFC_ENC__SHIFT                                                                      0xb
 #define VCN_FEATURES__HAS_EFC_HDR2SDR_ENC__SHIFT                                                              0xc
 #define VCN_FEATURES__HAS_DUAL_MJPEG_DEC__SHIFT                                                               0xd
 #define VCN_FEATURES__HAS_MJPEG2_IDCT_DEC_MASK                                                                0x00000080L
 #define VCN_FEATURES__HAS_SCLR_DEC_MASK                                                                       0x00000100L
 #define VCN_FEATURES__HAS_VP9_DEC_MASK                                                                        0x00000200L
+#define VCN_FEATURES__HAS_AV1_DEC_MASK                                                                        0x00000400L
 #define VCN_FEATURES__HAS_EFC_ENC_MASK                                                                        0x00000800L
 #define VCN_FEATURES__HAS_EFC_HDR2SDR_ENC_MASK                                                                0x00001000L
 #define VCN_FEATURES__HAS_DUAL_MJPEG_DEC_MASK                                                                 0x00002000L
 #define UVD_SUVD_CGC_GATE__IME_HEVC__SHIFT                                                                    0x18
 #define UVD_SUVD_CGC_GATE__EFC__SHIFT                                                                         0x19
 #define UVD_SUVD_CGC_GATE__SAOE__SHIFT                                                                        0x1a
+#define UVD_SUVD_CGC_GATE__SRE_AV1__SHIFT                                                                     0x1b
 #define UVD_SUVD_CGC_GATE__FBC_PCLK__SHIFT                                                                    0x1c
 #define UVD_SUVD_CGC_GATE__FBC_CCLK__SHIFT                                                                    0x1d
+#define UVD_SUVD_CGC_GATE__SCM_AV1__SHIFT                                                                     0x1e
 #define UVD_SUVD_CGC_GATE__SMPA__SHIFT                                                                        0x1f
 #define UVD_SUVD_CGC_GATE__SRE_MASK                                                                           0x00000001L
 #define UVD_SUVD_CGC_GATE__SIT_MASK                                                                           0x00000002L
 #define UVD_SUVD_CGC_GATE__IME_HEVC_MASK                                                                      0x01000000L
 #define UVD_SUVD_CGC_GATE__EFC_MASK                                                                           0x02000000L
 #define UVD_SUVD_CGC_GATE__SAOE_MASK                                                                          0x04000000L
+#define UVD_SUVD_CGC_GATE__SRE_AV1_MASK                                                                       0x08000000L
 #define UVD_SUVD_CGC_GATE__FBC_PCLK_MASK                                                                      0x10000000L
 #define UVD_SUVD_CGC_GATE__FBC_CCLK_MASK                                                                      0x20000000L
+#define UVD_SUVD_CGC_GATE__SCM_AV1_MASK                                                                       0x40000000L
 #define UVD_SUVD_CGC_GATE__SMPA_MASK                                                                          0x80000000L
 //UVD_SUVD_CGC_STATUS
 #define UVD_SUVD_CGC_STATUS__SRE_VCLK__SHIFT                                                                  0x0
 #define UVD_SUVD_CGC_STATUS__IME_HEVC_DCLK__SHIFT                                                             0x1b
 #define UVD_SUVD_CGC_STATUS__EFC_DCLK__SHIFT                                                                  0x1c
 #define UVD_SUVD_CGC_STATUS__SAOE_DCLK__SHIFT                                                                 0x1d
+#define UVD_SUVD_CGC_STATUS__SRE_AV1_VCLK__SHIFT                                                              0x1e
+#define UVD_SUVD_CGC_STATUS__SCM_AV1_DCLK__SHIFT                                                              0x1f
 #define UVD_SUVD_CGC_STATUS__SRE_VCLK_MASK                                                                    0x00000001L
 #define UVD_SUVD_CGC_STATUS__SRE_DCLK_MASK                                                                    0x00000002L
 #define UVD_SUVD_CGC_STATUS__SIT_DCLK_MASK                                                                    0x00000004L
 #define UVD_SUVD_CGC_STATUS__IME_HEVC_DCLK_MASK                                                               0x08000000L
 #define UVD_SUVD_CGC_STATUS__EFC_DCLK_MASK                                                                    0x10000000L
 #define UVD_SUVD_CGC_STATUS__SAOE_DCLK_MASK                                                                   0x20000000L
+#define UVD_SUVD_CGC_STATUS__SRE_AV1_VCLK_MASK                                                                0x40000000L
+#define UVD_SUVD_CGC_STATUS__SCM_AV1_DCLK_MASK                                                                0x80000000L
 //UVD_SUVD_CGC_CTRL
 #define UVD_SUVD_CGC_CTRL__SRE_MODE__SHIFT                                                                    0x0
 #define UVD_SUVD_CGC_CTRL__SIT_MODE__SHIFT                                                                    0x1
 #define UVD_SUVD_CGC_CTRL__SMPA_MODE__SHIFT                                                                   0xc
 #define UVD_SUVD_CGC_CTRL__MPBE0_MODE__SHIFT                                                                  0xd
 #define UVD_SUVD_CGC_CTRL__MPBE1_MODE__SHIFT                                                                  0xe
+#define UVD_SUVD_CGC_CTRL__SIT_AV1_MODE__SHIFT                                                                0xf
+#define UVD_SUVD_CGC_CTRL__SDB_AV1_MODE__SHIFT                                                                0x10
 #define UVD_SUVD_CGC_CTRL__MPC1_MODE__SHIFT                                                                   0x11
 #define UVD_SUVD_CGC_CTRL__FBC_PCLK__SHIFT                                                                    0x1c
 #define UVD_SUVD_CGC_CTRL__FBC_CCLK__SHIFT                                                                    0x1d
 #define UVD_SUVD_CGC_CTRL__SMPA_MODE_MASK                                                                     0x00001000L
 #define UVD_SUVD_CGC_CTRL__MPBE0_MODE_MASK                                                                    0x00002000L
 #define UVD_SUVD_CGC_CTRL__MPBE1_MODE_MASK                                                                    0x00004000L
+#define UVD_SUVD_CGC_CTRL__SIT_AV1_MODE_MASK                                                                  0x00008000L
+#define UVD_SUVD_CGC_CTRL__SDB_AV1_MODE_MASK                                                                  0x00010000L
 #define UVD_SUVD_CGC_CTRL__MPC1_MODE_MASK                                                                     0x00020000L
 #define UVD_SUVD_CGC_CTRL__FBC_PCLK_MASK                                                                      0x10000000L
 #define UVD_SUVD_CGC_CTRL__FBC_CCLK_MASK                                                                      0x20000000L
 #define UVD_SUVD_CGC_STATUS2__SMPA_VCLK__SHIFT                                                                0x0
 #define UVD_SUVD_CGC_STATUS2__SMPA_DCLK__SHIFT                                                                0x1
 #define UVD_SUVD_CGC_STATUS2__MPBE1_DCLK__SHIFT                                                               0x3
+#define UVD_SUVD_CGC_STATUS2__SIT_AV1_DCLK__SHIFT                                                             0x4
+#define UVD_SUVD_CGC_STATUS2__SDB_AV1_DCLK__SHIFT                                                             0x5
 #define UVD_SUVD_CGC_STATUS2__MPC1_DCLK__SHIFT                                                                0x6
 #define UVD_SUVD_CGC_STATUS2__MPC1_SCLK__SHIFT                                                                0x7
 #define UVD_SUVD_CGC_STATUS2__MPC1_VCLK__SHIFT                                                                0x8
 #define UVD_SUVD_CGC_STATUS2__SMPA_VCLK_MASK                                                                  0x00000001L
 #define UVD_SUVD_CGC_STATUS2__SMPA_DCLK_MASK                                                                  0x00000002L
 #define UVD_SUVD_CGC_STATUS2__MPBE1_DCLK_MASK                                                                 0x00000008L
+#define UVD_SUVD_CGC_STATUS2__SIT_AV1_DCLK_MASK                                                               0x00000010L
+#define UVD_SUVD_CGC_STATUS2__SDB_AV1_DCLK_MASK                                                               0x00000020L
 #define UVD_SUVD_CGC_STATUS2__MPC1_DCLK_MASK                                                                  0x00000040L
 #define UVD_SUVD_CGC_STATUS2__MPC1_SCLK_MASK                                                                  0x00000080L
 #define UVD_SUVD_CGC_STATUS2__MPC1_VCLK_MASK                                                                  0x00000100L
 //UVD_SUVD_CGC_GATE2
 #define UVD_SUVD_CGC_GATE2__MPBE0__SHIFT                                                                      0x0
 #define UVD_SUVD_CGC_GATE2__MPBE1__SHIFT                                                                      0x1
+#define UVD_SUVD_CGC_GATE2__SIT_AV1__SHIFT                                                                    0x2
+#define UVD_SUVD_CGC_GATE2__SDB_AV1__SHIFT                                                                    0x3
 #define UVD_SUVD_CGC_GATE2__MPC1__SHIFT                                                                       0x4
 #define UVD_SUVD_CGC_GATE2__MPBE0_MASK                                                                        0x00000001L
 #define UVD_SUVD_CGC_GATE2__MPBE1_MASK                                                                        0x00000002L
+#define UVD_SUVD_CGC_GATE2__SIT_AV1_MASK                                                                      0x00000004L
+#define UVD_SUVD_CGC_GATE2__SDB_AV1_MASK                                                                      0x00000008L
 #define UVD_SUVD_CGC_GATE2__MPC1_MASK                                                                         0x00000010L
 //UVD_SUVD_INT_STATUS2
 #define UVD_SUVD_INT_STATUS2__SMPA_FUNC_INT__SHIFT                                                            0x0
 #define UVD_SUVD_INT_STATUS2__SMPA_ERR_INT__SHIFT                                                             0x5
+#define UVD_SUVD_INT_STATUS2__SDB_AV1_FUNC_INT__SHIFT                                                         0x6
+#define UVD_SUVD_INT_STATUS2__SDB_AV1_ERR_INT__SHIFT                                                          0xb
 #define UVD_SUVD_INT_STATUS2__SMPA_FUNC_INT_MASK                                                              0x0000001FL
 #define UVD_SUVD_INT_STATUS2__SMPA_ERR_INT_MASK                                                               0x00000020L
+#define UVD_SUVD_INT_STATUS2__SDB_AV1_FUNC_INT_MASK                                                           0x000007C0L
+#define UVD_SUVD_INT_STATUS2__SDB_AV1_ERR_INT_MASK                                                            0x00000800L
 //UVD_SUVD_INT_EN2
 #define UVD_SUVD_INT_EN2__SMPA_FUNC_INT_EN__SHIFT                                                             0x0
 #define UVD_SUVD_INT_EN2__SMPA_ERR_INT_EN__SHIFT                                                              0x5
+#define UVD_SUVD_INT_EN2__SDB_AV1_FUNC_INT_EN__SHIFT                                                          0x6
+#define UVD_SUVD_INT_EN2__SDB_AV1_ERR_INT_EN__SHIFT                                                           0xb
 #define UVD_SUVD_INT_EN2__SMPA_FUNC_INT_EN_MASK                                                               0x0000001FL
 #define UVD_SUVD_INT_EN2__SMPA_ERR_INT_EN_MASK                                                                0x00000020L
+#define UVD_SUVD_INT_EN2__SDB_AV1_FUNC_INT_EN_MASK                                                            0x000007C0L
+#define UVD_SUVD_INT_EN2__SDB_AV1_ERR_INT_EN_MASK                                                             0x00000800L
 //UVD_SUVD_INT_ACK2
 #define UVD_SUVD_INT_ACK2__SMPA_FUNC_INT_ACK__SHIFT                                                           0x0
 #define UVD_SUVD_INT_ACK2__SMPA_ERR_INT_ACK__SHIFT                                                            0x5
+#define UVD_SUVD_INT_ACK2__SDB_AV1_FUNC_INT_ACK__SHIFT                                                        0x6
+#define UVD_SUVD_INT_ACK2__SDB_AV1_ERR_INT_ACK__SHIFT                                                         0xb
 #define UVD_SUVD_INT_ACK2__SMPA_FUNC_INT_ACK_MASK                                                             0x0000001FL
 #define UVD_SUVD_INT_ACK2__SMPA_ERR_INT_ACK_MASK                                                              0x00000020L
+#define UVD_SUVD_INT_ACK2__SDB_AV1_FUNC_INT_ACK_MASK                                                          0x000007C0L
+#define UVD_SUVD_INT_ACK2__SDB_AV1_ERR_INT_ACK_MASK                                                           0x00000800L
 
 
 // addressBlock: uvd0_ecpudec
index 0826625573dcea21e57e913ba778f3d1b9b382b3..8dc5abb6931e9b3fb83ac7d9a00536ffcfb0b880 100644 (file)
@@ -479,17 +479,6 @@ static int smu_late_init(void *handle)
                return ret;
        }
 
-       /*
-        * Set initialized values (get from vbios) to dpm tables context such as
-        * gfxclk, memclk, dcefclk, and etc. And enable the DPM feature for each
-        * type of clks.
-        */
-       ret = smu_set_default_dpm_table(smu);
-       if (ret) {
-               dev_err(adev->dev, "Failed to setup default dpm clock tables!\n");
-               return ret;
-       }
-
        ret = smu_populate_umd_state_clk(smu);
        if (ret) {
                dev_err(adev->dev, "Failed to populate UMD state clocks!\n");
@@ -984,6 +973,17 @@ static int smu_smc_hw_setup(struct smu_context *smu)
                return ret;
        }
 
+       /*
+        * Set initialized values (get from vbios) to dpm tables context such as
+        * gfxclk, memclk, dcefclk, and etc. And enable the DPM feature for each
+        * type of clks.
+        */
+       ret = smu_set_default_dpm_table(smu);
+       if (ret) {
+               dev_err(adev->dev, "Failed to setup default dpm clock tables!\n");
+               return ret;
+       }
+
        ret = smu_notify_display_change(smu);
        if (ret)
                return ret;
@@ -1126,7 +1126,7 @@ static int smu_disable_dpms(struct smu_context *smu)
         */
        if (smu->uploading_custom_pp_table &&
            (adev->asic_type >= CHIP_NAVI10) &&
-           (adev->asic_type <= CHIP_NAVI12))
+           (adev->asic_type <= CHIP_NAVY_FLOUNDER))
                return 0;
 
        /*
@@ -1211,7 +1211,9 @@ static int smu_hw_fini(void *handle)
 int smu_reset(struct smu_context *smu)
 {
        struct amdgpu_device *adev = smu->adev;
-       int ret = 0;
+       int ret;
+
+       amdgpu_gfx_off_ctrl(smu->adev, false);
 
        ret = smu_hw_fini(adev);
        if (ret)
@@ -1222,8 +1224,12 @@ int smu_reset(struct smu_context *smu)
                return ret;
 
        ret = smu_late_init(adev);
+       if (ret)
+               return ret;
 
-       return ret;
+       amdgpu_gfx_off_ctrl(smu->adev, true);
+
+       return 0;
 }
 
 static int smu_suspend(void *handle)
index fb962b9ceffb8422d2aba7ae9fa11cf51d78ae61..9582b38162f0908c606e419d4ff86063571171a4 100644 (file)
@@ -1840,10 +1840,14 @@ static bool arcturus_is_dpm_running(struct smu_context *smu)
 {
        int ret = 0;
        uint32_t feature_mask[2];
-       unsigned long feature_enabled;
+       uint64_t feature_enabled;
+
        ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
-       feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
-                          ((uint64_t)feature_mask[1] << 32));
+       if (ret)
+               return false;
+
+       feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
+
        return !!(feature_enabled & SMC_DPM_FEATURE);
 }
 
index c9cfe90a29471c6590b34b228711ae98c5e06658..43f7adff6cb74c974d413004c81bda12a7c42166 100644 (file)
@@ -204,8 +204,7 @@ static int smu10_set_min_deep_sleep_dcefclk(struct pp_hwmgr *hwmgr, uint32_t clo
 {
        struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
 
-       if (smu10_data->need_min_deep_sleep_dcefclk &&
-               smu10_data->deep_sleep_dcefclk != clock) {
+       if (clock && smu10_data->deep_sleep_dcefclk != clock) {
                smu10_data->deep_sleep_dcefclk = clock;
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                        PPSMC_MSG_SetMinDeepSleepDcefclk,
@@ -219,8 +218,7 @@ static int smu10_set_hard_min_dcefclk_by_freq(struct pp_hwmgr *hwmgr, uint32_t c
 {
        struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
 
-       if (smu10_data->dcf_actual_hard_min_freq &&
-               smu10_data->dcf_actual_hard_min_freq != clock) {
+       if (clock && smu10_data->dcf_actual_hard_min_freq != clock) {
                smu10_data->dcf_actual_hard_min_freq = clock;
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                        PPSMC_MSG_SetHardMinDcefclkByFreq,
@@ -234,8 +232,7 @@ static int smu10_set_hard_min_fclk_by_freq(struct pp_hwmgr *hwmgr, uint32_t cloc
 {
        struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
 
-       if (smu10_data->f_actual_hard_min_freq &&
-               smu10_data->f_actual_hard_min_freq != clock) {
+       if (clock && smu10_data->f_actual_hard_min_freq != clock) {
                smu10_data->f_actual_hard_min_freq = clock;
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                        PPSMC_MSG_SetHardMinFclkByFreq,
@@ -566,6 +563,8 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
        struct smu10_hwmgr *data = hwmgr->backend;
        uint32_t min_sclk = hwmgr->display_config->min_core_set_clock;
        uint32_t min_mclk = hwmgr->display_config->min_mem_set_clock/100;
+       uint32_t index_fclk = data->clock_vol_info.vdd_dep_on_fclk->count - 1;
+       uint32_t index_socclk = data->clock_vol_info.vdd_dep_on_socclk->count - 1;
 
        if (hwmgr->smu_version < 0x1E3700) {
                pr_info("smu firmware version too old, can not set dpm level\n");
@@ -679,13 +678,13 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetHardMinFclkByFreq,
                                                hwmgr->display_config->num_display > 3 ?
-                                               SMU10_UMD_PSTATE_PEAK_FCLK :
+                                               data->clock_vol_info.vdd_dep_on_fclk->entries[0].clk :
                                                min_mclk,
                                                NULL);
 
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetHardMinSocclkByFreq,
-                                               SMU10_UMD_PSTATE_MIN_SOCCLK,
+                                               data->clock_vol_info.vdd_dep_on_socclk->entries[0].clk,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetHardMinVcn,
@@ -698,11 +697,11 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetSoftMaxFclkByFreq,
-                                               SMU10_UMD_PSTATE_PEAK_FCLK,
+                                               data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetSoftMaxSocclkByFreq,
-                                               SMU10_UMD_PSTATE_PEAK_SOCCLK,
+                                               data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetSoftMaxVcn,
index ffe05b7cc1f0ae0a566c389443a94b20b7178cae..4a3b64aa21ceb12dc63877954f9994845bbdbba1 100644 (file)
@@ -3581,7 +3581,8 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx,
        case AMDGPU_PP_SENSOR_GPU_POWER:
                return smu7_get_gpu_power(hwmgr, (uint32_t *)value);
        case AMDGPU_PP_SENSOR_VDDGFX:
-               if ((data->vr_config & 0xff) == 0x2)
+               if ((data->vr_config & VRCONF_VDDGFX_MASK) ==
+                   (VR_SVI2_PLANE_2 << VRCONF_VDDGFX_SHIFT))
                        val_vid = PHM_READ_INDIRECT_FIELD(hwmgr->device,
                                        CGS_IND_REG__SMC, PWR_SVI2_STATUS, PLANE2_VID);
                else
index 468bdd6f669733afaf2b5465256b134f64c13f99..952cd3d7240e38905a05c4e5565b8a1c3e50b27c 100644 (file)
@@ -363,17 +363,29 @@ int vega10_thermal_get_temperature(struct pp_hwmgr *hwmgr)
 static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
                struct PP_TemperatureRange *range)
 {
+       struct phm_ppt_v2_information *pp_table_info =
+               (struct phm_ppt_v2_information *)(hwmgr->pptable);
+       struct phm_tdp_table *tdp_table = pp_table_info->tdp_table;
        struct amdgpu_device *adev = hwmgr->adev;
-       int low = VEGA10_THERMAL_MINIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
-       int high = VEGA10_THERMAL_MAXIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       int low = VEGA10_THERMAL_MINIMUM_ALERT_TEMP;
+       int high = VEGA10_THERMAL_MAXIMUM_ALERT_TEMP;
        uint32_t val;
 
-       if (low < range->min)
-               low = range->min;
-       if (high > range->max)
-               high = range->max;
+       /* compare them in unit celsius degree */
+       if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)
+               low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+
+       /*
+        * As a common sense, usSoftwareShutdownTemp should be bigger
+        * than ThotspotLimit. For any invalid usSoftwareShutdownTemp,
+        * we will just use the max possible setting VEGA10_THERMAL_MAXIMUM_ALERT_TEMP
+        * to avoid false alarms.
+        */
+       if ((tdp_table->usSoftwareShutdownTemp >
+            range->hotspot_crit_max / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)) {
+               if (high > tdp_table->usSoftwareShutdownTemp)
+                       high = tdp_table->usSoftwareShutdownTemp;
+       }
 
        if (low > high)
                return -EINVAL;
@@ -382,8 +394,8 @@ static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
 
        val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, MAX_IH_CREDIT, 5);
        val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1);
-       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
-       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
+       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, high);
+       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, low);
        val &= (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK) &
                        (~THM_THERMAL_INT_CTRL__THERM_INTH_MASK_MASK) &
                        (~THM_THERMAL_INT_CTRL__THERM_INTL_MASK_MASK);
index c15b9756025d9c523bb789195b98784bc3c5b51d..7ace439dcde7ace6313a54d296b8247391c17349 100644 (file)
@@ -170,17 +170,18 @@ int vega12_thermal_get_temperature(struct pp_hwmgr *hwmgr)
 static int vega12_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
                struct PP_TemperatureRange *range)
 {
+       struct phm_ppt_v3_information *pptable_information =
+               (struct phm_ppt_v3_information *)hwmgr->pptable;
        struct amdgpu_device *adev = hwmgr->adev;
-       int low = VEGA12_THERMAL_MINIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
-       int high = VEGA12_THERMAL_MAXIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       int low = VEGA12_THERMAL_MINIMUM_ALERT_TEMP;
+       int high = VEGA12_THERMAL_MAXIMUM_ALERT_TEMP;
        uint32_t val;
 
-       if (low < range->min)
-               low = range->min;
-       if (high > range->max)
-               high = range->max;
+       /* compare them in unit celsius degree */
+       if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)
+               low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       if (high > pptable_information->us_software_shutdown_temp)
+               high = pptable_information->us_software_shutdown_temp;
 
        if (low > high)
                return -EINVAL;
@@ -189,8 +190,8 @@ static int vega12_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
 
        val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, MAX_IH_CREDIT, 5);
        val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1);
-       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
-       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
+       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, high);
+       val = REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, low);
        val = val & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK);
 
        WREG32_SOC15(THM, 0, mmTHM_THERMAL_INT_CTRL, val);
index 7add2f60f49c4094ffac2603858e8a9d3b8712dd..364162ddaa9c672d023531166f7f8d3683e6d1b8 100644 (file)
@@ -240,17 +240,18 @@ int vega20_thermal_get_temperature(struct pp_hwmgr *hwmgr)
 static int vega20_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
                struct PP_TemperatureRange *range)
 {
+       struct phm_ppt_v3_information *pptable_information =
+               (struct phm_ppt_v3_information *)hwmgr->pptable;
        struct amdgpu_device *adev = hwmgr->adev;
-       int low = VEGA20_THERMAL_MINIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
-       int high = VEGA20_THERMAL_MAXIMUM_ALERT_TEMP *
-                       PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       int low = VEGA20_THERMAL_MINIMUM_ALERT_TEMP;
+       int high = VEGA20_THERMAL_MAXIMUM_ALERT_TEMP;
        uint32_t val;
 
-       if (low < range->min)
-               low = range->min;
-       if (high > range->max)
-               high = range->max;
+       /* compare them in unit celsius degree */
+       if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)
+               low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       if (high > pptable_information->us_software_shutdown_temp)
+               high = pptable_information->us_software_shutdown_temp;
 
        if (low > high)
                return -EINVAL;
@@ -259,8 +260,8 @@ static int vega20_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
 
        val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, MAX_IH_CREDIT, 5);
        val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, THERM_IH_HW_ENA, 1);
-       val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, (high / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
-       val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, (low / PP_TEMPERATURE_UNITS_PER_CENTIGRADES));
+       val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTH, high);
+       val = CGS_REG_SET_FIELD(val, THM_THERMAL_INT_CTRL, DIG_THERM_INTL, low);
        val = val & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK);
 
        WREG32_SOC15(THM, 0, mmTHM_THERMAL_INT_CTRL, val);
index 9f62af9abd23289f88fb9a2800a40c8f3f69d04c..3d5eae956a23d085bb8eaf205d7680f65d45ee07 100644 (file)
@@ -1331,10 +1331,14 @@ static bool navi10_is_dpm_running(struct smu_context *smu)
 {
        int ret = 0;
        uint32_t feature_mask[2];
-       unsigned long feature_enabled;
+       uint64_t feature_enabled;
+
        ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
-       feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
-                          ((uint64_t)feature_mask[1] << 32));
+       if (ret)
+               return false;
+
+       feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
+
        return !!(feature_enabled & SMC_DPM_FEATURE);
 }
 
index dbb676c482fde957fcaf86c2cfcefadafb4a8b24..15263cf210d5cc76c2f04ddcfc466f38278fed29 100644 (file)
@@ -232,14 +232,16 @@ static int renoir_get_profiling_clk_mask(struct smu_context *smu,
                        *sclk_mask = 0;
        } else if (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) {
                if (mclk_mask)
-                       *mclk_mask = 0;
+                       /* mclk levels are in reverse order */
+                       *mclk_mask = NUM_MEMCLK_DPM_LEVELS - 1;
        } else if (level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {
                if(sclk_mask)
                        /* The sclk as gfxclk and has three level about max/min/current */
                        *sclk_mask = 3 - 1;
 
                if(mclk_mask)
-                       *mclk_mask = NUM_MEMCLK_DPM_LEVELS - 1;
+                       /* mclk levels are in reverse order */
+                       *mclk_mask = 0;
 
                if(soc_mask)
                        *soc_mask = NUM_SOCCLK_DPM_LEVELS - 1;
@@ -333,7 +335,7 @@ static int renoir_get_dpm_ultimate_freq(struct smu_context *smu,
                case SMU_UCLK:
                case SMU_FCLK:
                case SMU_MCLK:
-                       ret = renoir_get_dpm_clk_limited(smu, clk_type, 0, min);
+                       ret = renoir_get_dpm_clk_limited(smu, clk_type, NUM_MEMCLK_DPM_LEVELS - 1, min);
                        if (ret)
                                goto failed;
                        break;
index 3865dbed5f935b89237107b8235c5be49f170396..61f4ddae262ddf98cae84b994fedc58ca678ca18 100644 (file)
@@ -68,7 +68,8 @@
        FEATURE_MASK(FEATURE_DPM_LINK_BIT)       | \
        FEATURE_MASK(FEATURE_DPM_SOCCLK_BIT)     | \
        FEATURE_MASK(FEATURE_DPM_FCLK_BIT)       | \
-       FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT))
+       FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT)    | \
+       FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT))
 
 #define SMU_11_0_7_GFX_BUSY_THRESHOLD 15
 
@@ -95,6 +96,7 @@ static struct cmn2asic_msg_mapping sienna_cichlid_message_map[SMU_MSG_MAX_COUNT]
        MSG_MAP(TransferTableSmu2Dram,          PPSMC_MSG_TransferTableSmu2Dram,       0),
        MSG_MAP(TransferTableDram2Smu,          PPSMC_MSG_TransferTableDram2Smu,       0),
        MSG_MAP(UseDefaultPPTable,              PPSMC_MSG_UseDefaultPPTable,           0),
+       MSG_MAP(RunDcBtc,                       PPSMC_MSG_RunDcBtc,                    0),
        MSG_MAP(EnterBaco,                      PPSMC_MSG_EnterBaco,                   0),
        MSG_MAP(SetSoftMinByFreq,               PPSMC_MSG_SetSoftMinByFreq,            0),
        MSG_MAP(SetSoftMaxByFreq,               PPSMC_MSG_SetSoftMaxByFreq,            0),
@@ -228,6 +230,7 @@ sienna_cichlid_get_allowed_feature_mask(struct smu_context *smu,
 
        *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT)
                                | FEATURE_MASK(FEATURE_DPM_FCLK_BIT)
+                               | FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT)
                                | FEATURE_MASK(FEATURE_DS_SOCCLK_BIT)
                                | FEATURE_MASK(FEATURE_DS_DCEFCLK_BIT)
                                | FEATURE_MASK(FEATURE_DS_FCLK_BIT)
@@ -775,7 +778,7 @@ static int sienna_cichlid_dpm_set_vcn_enable(struct smu_context *smu, bool enabl
                        ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 0, NULL);
                        if (ret)
                                return ret;
-                       if (adev->asic_type == CHIP_SIENNA_CICHLID) {
+                       if (adev->vcn.num_vcn_inst > 1) {
                                ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn,
                                                                  0x10000, NULL);
                                if (ret)
@@ -787,7 +790,7 @@ static int sienna_cichlid_dpm_set_vcn_enable(struct smu_context *smu, bool enabl
                        ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerDownVcn, 0, NULL);
                        if (ret)
                                return ret;
-                       if (adev->asic_type == CHIP_SIENNA_CICHLID) {
+                       if (adev->vcn.num_vcn_inst > 1) {
                                ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerDownVcn,
                                                                  0x10000, NULL);
                                if (ret)
@@ -1146,10 +1149,14 @@ static bool sienna_cichlid_is_dpm_running(struct smu_context *smu)
 {
        int ret = 0;
        uint32_t feature_mask[2];
-       unsigned long feature_enabled;
+       uint64_t feature_enabled;
+
        ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
-       feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
-                          ((uint64_t)feature_mask[1] << 32));
+       if (ret)
+               return false;
+
+       feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
+
        return !!(feature_enabled & SMC_DPM_FEATURE);
 }
 
@@ -1732,6 +1739,11 @@ static int sienna_cichlid_get_dpm_ultimate_freq(struct smu_context *smu,
        return ret;
 }
 
+static int sienna_cichlid_run_btc(struct smu_context *smu)
+{
+       return smu_cmn_send_smc_msg(smu, SMU_MSG_RunDcBtc, NULL);
+}
+
 static bool sienna_cichlid_is_baco_supported(struct smu_context *smu)
 {
        struct amdgpu_device *adev = smu->adev;
@@ -2719,6 +2731,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
        .mode1_reset = smu_v11_0_mode1_reset,
        .get_dpm_ultimate_freq = sienna_cichlid_get_dpm_ultimate_freq,
        .set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range,
+       .run_btc = sienna_cichlid_run_btc,
        .get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
        .set_pp_feature_mask = smu_cmn_set_pp_feature_mask,
 };
index c18169aa59ce5bd117a1d82ac2ac00dd5af8ca31..e4d1f3d66ef4888fe4a9d2add1fe240db14731d0 100644 (file)
@@ -37,6 +37,7 @@
 #include "cgs_common.h"
 #include "atombios.h"
 #include "pppcielanes.h"
+#include "smu7_smumgr.h"
 
 #include "smu/smu_7_0_1_d.h"
 #include "smu/smu_7_0_1_sh_mask.h"
@@ -2948,6 +2949,7 @@ const struct pp_smumgr_func ci_smu_funcs = {
        .request_smu_load_specific_fw = NULL,
        .send_msg_to_smc = ci_send_msg_to_smc,
        .send_msg_to_smc_with_parameter = ci_send_msg_to_smc_with_parameter,
+       .get_argument = smu7_get_argument,
        .download_pptable_settings = NULL,
        .upload_pptable_settings = NULL,
        .get_offsetof = ci_get_offsetof,
index ca570b1354787a94e46e501967aeacc077b4cc2a..e9de542f9b7c5ef4837be8442b32fe4a8fde1604 100644 (file)
@@ -532,7 +532,7 @@ static int malidp500_enable_memwrite(struct malidp_hw_device *hwdev,
                malidp_hw_write(hwdev, lower_32_bits(addrs[1]), base + MALIDP_MW_P2_PTR_LOW);
                malidp_hw_write(hwdev, upper_32_bits(addrs[1]), base + MALIDP_MW_P2_PTR_HIGH);
                malidp_hw_write(hwdev, pitches[1], base + MALIDP_MW_P2_STRIDE);
-               /* fall through */
+               fallthrough;
        case 1:
                malidp_hw_write(hwdev, lower_32_bits(addrs[0]), base + MALIDP_MW_P1_PTR_LOW);
                malidp_hw_write(hwdev, upper_32_bits(addrs[0]), base + MALIDP_MW_P1_PTR_HIGH);
@@ -869,7 +869,7 @@ static int malidp550_enable_memwrite(struct malidp_hw_device *hwdev,
                malidp_hw_write(hwdev, lower_32_bits(addrs[1]), base + MALIDP_MW_P2_PTR_LOW);
                malidp_hw_write(hwdev, upper_32_bits(addrs[1]), base + MALIDP_MW_P2_PTR_HIGH);
                malidp_hw_write(hwdev, pitches[1], base + MALIDP_MW_P2_STRIDE);
-               /* fall through */
+               fallthrough;
        case 1:
                malidp_hw_write(hwdev, lower_32_bits(addrs[0]), base + MALIDP_MW_P1_PTR_LOW);
                malidp_hw_write(hwdev, upper_32_bits(addrs[0]), base + MALIDP_MW_P1_PTR_HIGH);
@@ -1324,7 +1324,7 @@ static irqreturn_t malidp_se_irq(int irq, void *arg)
                        break;
                case MW_RESTART:
                        drm_writeback_signal_completion(&malidp->mw_connector, 0);
-                       /* fall through - to a new start */
+                       fallthrough;    /* to a new start */
                case MW_START:
                        /* writeback started, need to emulate one-shot mode */
                        hw->disable_memwrite(hwdev);
index dd12b55d57a241ec437e2c7d0e78d2525f95814e..6a9fba051d136c9fc54e8ac1c4333c8408e6b25a 100644 (file)
@@ -238,7 +238,7 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)
                                        ast->dp501_fw_addr = NULL;
                                }
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 0x0c:
                        ast->tx_chip_type = AST_TX_DP501;
                }
index ce94f797d090f3cef01db72ef64665db54e8213e..66b67402f1acd57dcf367b8e742b8c5ea45aae23 100644 (file)
@@ -409,7 +409,6 @@ static bool nwl_dsi_read_packet(struct nwl_dsi *dsi, u32 status)
 
                switch (data_type) {
                case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE:
-                       fallthrough;
                case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE:
                        if (xfer->msg->rx_len > 1) {
                                /* read second byte */
@@ -418,7 +417,6 @@ static bool nwl_dsi_read_packet(struct nwl_dsi *dsi, u32 status)
                        }
                        fallthrough;
                case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE:
-                       fallthrough;
                case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE:
                        if (xfer->msg->rx_len > 0) {
                                /* read first byte */
index d7e65c8694153474f0e3818bed7761ac967a3e50..9fef6413741dcbd674d78cae5d5478aa0bb63ce0 100644 (file)
@@ -61,10 +61,10 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
        switch (hparms->channels) {
        case 7 ... 8:
                conf0 |= HDMI_AUD_CONF0_I2S_EN3;
-               /* Fall-thru */
+               fallthrough;
        case 5 ... 6:
                conf0 |= HDMI_AUD_CONF0_I2S_EN2;
-               /* Fall-thru */
+               fallthrough;
        case 3 ... 4:
                conf0 |= HDMI_AUD_CONF0_I2S_EN1;
                /* Fall-thru */
index 86b9f0f87a14bbf8325d0169bbcb3b1283131c94..5b6e19ecbc84e111e350245b17904d91cc273d6c 100644 (file)
@@ -604,13 +604,13 @@ static void ti_sn_bridge_read_valid_rates(struct ti_sn_bridge *pdata,
                DRM_DEV_ERROR(pdata->dev,
                              "Unexpected max rate (%#x); assuming 5.4 GHz\n",
                              (int)dpcd_val);
-               /* fall through */
+               fallthrough;
        case DP_LINK_BW_5_4:
                rate_valid[7] = 1;
-               /* fall through */
+               fallthrough;
        case DP_LINK_BW_2_7:
                rate_valid[4] = 1;
-               /* fall through */
+               fallthrough;
        case DP_LINK_BW_1_62:
                rate_valid[1] = 1;
                break;
index f68c69a45752a232ecc79f763617cdca6fd25608..9e1ad493e68919aed1d6d9154f52e77e82f06e59 100644 (file)
@@ -34,6 +34,7 @@
 #include <drm/drm_bridge.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_device.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_self_refresh_helper.h>
@@ -3106,7 +3107,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
        if (ret)
                DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret);
 
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
 }
 EXPORT_SYMBOL(drm_atomic_helper_shutdown);
 
@@ -3246,7 +3247,7 @@ struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev)
        }
 
 unlock:
-       DRM_MODESET_LOCK_ALL_END(ctx, err);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, err);
        if (err)
                return ERR_PTR(err);
 
@@ -3327,7 +3328,7 @@ int drm_atomic_helper_resume(struct drm_device *dev,
 
        err = drm_atomic_helper_commit_duplicated_state(state, &ctx);
 
-       DRM_MODESET_LOCK_ALL_END(ctx, err);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, err);
        drm_atomic_state_put(state);
 
        return err;
index a0735fbc144b2aa26386230a0a74ba800afb7e4d..7a01d0918861cc83de536907e70b7b8e7c798553 100644 (file)
@@ -537,7 +537,7 @@ int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
        switch (map->type) {
        case _DRM_REGISTERS:
                iounmap(map->handle);
-               /* FALLTHROUGH */
+               fallthrough;
        case _DRM_FRAME_BUFFER:
                arch_phys_wc_del(map->mtrr);
                break;
index c93123ff7c2186beead154597b21ba58f81c93c9..138ff34b31db53aaf4cfc90f0fc198a7ce51de64 100644 (file)
@@ -294,7 +294,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
                                     crtc->gamma_size, &ctx);
 
 out:
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
        return ret;
 
 }
index 283bcc4362ca5870acfd8563adb225a708ea0821..aecdd7ea26dc844c427091edc5a72aa81c1f3308 100644 (file)
@@ -588,7 +588,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        if (crtc_req->mode_valid && !drm_lease_held(file_priv, plane->base.id))
                return -EACCES;
 
-       mutex_lock(&crtc->dev->mode_config.mutex);
        DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx,
                                   DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
 
@@ -756,8 +755,7 @@ out:
        fb = NULL;
        mode = NULL;
 
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
-       mutex_unlock(&crtc->dev->mode_config.mutex);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
 
        return ret;
 }
index a3c82e726057a610bb7eeed5bb063fec89a4e203..092c8c9859114e4b2f030396947a4cee61523bbc 100644 (file)
@@ -492,7 +492,7 @@ int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
                case DP_DS_16BPC:
                        return 16;
                }
-               /* fall through */
+               fallthrough;
        default:
                return 0;
        }
index b23cb2fec3f35f8b8eaa231b6a13267e7041cab7..67dd72ea200e07215b0cd3571b92313a05510e17 100644 (file)
@@ -5040,8 +5040,8 @@ int drm_dp_mst_add_affected_dsc_crtcs(struct drm_atomic_state *state, struct drm
 
                crtc = conn_state->crtc;
 
-               if (WARN_ON(!crtc))
-                       return -EINVAL;
+               if (!crtc)
+                       continue;
 
                if (!drm_dp_mst_dsc_aux_for_port(pos->port))
                        continue;
index 901b078abf40c5d7bf1819e6f6cd4ac256c4f774..db05f386a709e8d9cd5edc305455fb31e6e25128 100644 (file)
@@ -428,7 +428,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 out_unref:
        drm_mode_object_put(obj);
 out:
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
        return ret;
 }
 
@@ -470,7 +470,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
                break;
        }
        drm_property_change_valid_put(prop, ref);
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
 
        return ret;
 }
index 14b6f7638728c3ebd1c19ae628dfd34acc553386..501b4fe55a3dbc038652d49c3115baed38da459c 100644 (file)
@@ -1930,7 +1930,7 @@ void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
        default:
                WARN(1, "Invalid aspect ratio (0%x) on mode\n",
                     in->picture_aspect_ratio);
-               /* fall through */
+               fallthrough;
        case HDMI_PICTURE_ASPECT_NONE:
                out->flags |= DRM_MODE_FLAG_PIC_AR_NONE;
                break;
index b7b90b3a2e389a3f623c9e14c5edd126e6712a16..affe1cfed0098024a3b0b8674495deae4de597b3 100644 (file)
@@ -792,7 +792,7 @@ static int setplane_internal(struct drm_plane *plane,
                                          crtc_x, crtc_y, crtc_w, crtc_h,
                                          src_x, src_y, src_w, src_h, &ctx);
 
-       DRM_MODESET_LOCK_ALL_END(ctx, ret);
+       DRM_MODESET_LOCK_ALL_END(plane->dev, ctx, ret);
 
        return ret;
 }
index d5a4cd85a0f6dcb82fcd4a4d6bf304761c571e01..c6404b8d067f10279221dad7eb925a1650ae7534 100644 (file)
@@ -337,9 +337,16 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
 
                gpu->identity.model = gpu_read(gpu, VIVS_HI_CHIP_MODEL);
                gpu->identity.revision = gpu_read(gpu, VIVS_HI_CHIP_REV);
-               gpu->identity.product_id = gpu_read(gpu, VIVS_HI_CHIP_PRODUCT_ID);
                gpu->identity.customer_id = gpu_read(gpu, VIVS_HI_CHIP_CUSTOMER_ID);
-               gpu->identity.eco_id = gpu_read(gpu, VIVS_HI_CHIP_ECO_ID);
+
+               /*
+                * Reading these two registers on GC600 rev 0x19 result in a
+                * unhandled fault: external abort on non-linefetch
+                */
+               if (!etnaviv_is_model_rev(gpu, GC600, 0x19)) {
+                       gpu->identity.product_id = gpu_read(gpu, VIVS_HI_CHIP_PRODUCT_ID);
+                       gpu->identity.eco_id = gpu_read(gpu, VIVS_HI_CHIP_ECO_ID);
+               }
 
                /*
                 * !!!! HACK ALERT !!!!
index 4e3e95dce6d876151863ffb16cf0a52b5f7110e2..cd46c882269cc959070822de22ea9a61d09cf544 100644 (file)
@@ -89,12 +89,15 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
        u32 dma_addr;
        int change;
 
+       /* block scheduler */
+       drm_sched_stop(&gpu->sched, sched_job);
+
        /*
         * If the GPU managed to complete this jobs fence, the timout is
         * spurious. Bail out.
         */
        if (dma_fence_is_signaled(submit->out_fence))
-               return;
+               goto out_no_timeout;
 
        /*
         * If the GPU is still making forward progress on the front-end (which
@@ -105,12 +108,9 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
        change = dma_addr - gpu->hangcheck_dma_addr;
        if (change < 0 || change > 16) {
                gpu->hangcheck_dma_addr = dma_addr;
-               return;
+               goto out_no_timeout;
        }
 
-       /* block scheduler */
-       drm_sched_stop(&gpu->sched, sched_job);
-
        if(sched_job)
                drm_sched_increase_karma(sched_job);
 
@@ -120,6 +120,7 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
 
        drm_sched_resubmit_jobs(&gpu->sched);
 
+out_no_timeout:
        /* restart scheduler after GPU is usable again */
        drm_sched_start(&gpu->sched, true);
 }
index 7a6f6df5e9540abbde6cc7d4ace49733fccdf965..b38e9b592b8a539134c83fda1c5b5d572f221f21 100644 (file)
@@ -987,10 +987,10 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi,
        switch (length) {
        case 3:
                reg |= payload[2] << 16;
-               /* Fall through */
+               fallthrough;
        case 2:
                reg |= payload[1] << 8;
-               /* Fall through */
+               fallthrough;
        case 1:
                reg |= payload[0];
                exynos_dsi_write(dsi, DSIM_PAYLOAD_REG, reg);
@@ -1038,7 +1038,7 @@ static void exynos_dsi_read_from_fifo(struct exynos_dsi *dsi,
                                payload[1] = reg >> 16;
                                ++xfer->rx_done;
                        }
-                       /* Fall through */
+                       fallthrough;
                case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE:
                case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE:
                        payload[0] = reg >> 8;
@@ -1082,10 +1082,10 @@ static void exynos_dsi_read_from_fifo(struct exynos_dsi *dsi,
                switch (length) {
                case 3:
                        payload[2] = (reg >> 16) & 0xff;
-                       /* Fall through */
+                       fallthrough;
                case 2:
                        payload[1] = (reg >> 8) & 0xff;
-                       /* Fall through */
+                       fallthrough;
                case 1:
                        payload[0] = reg & 0xff;
                }
index 56a2b47e1af79fd254e992abdd4d256fbd0dbe3e..5147f5929be720d0f3bfb6d9337f5584cf7a749f 100644 (file)
@@ -92,7 +92,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
        offset = fbi->var.xoffset * fb->format->cpp[0];
        offset += fbi->var.yoffset * fb->pitches[0];
 
-       fbi->screen_base = exynos_gem->kvaddr + offset;
+       fbi->screen_buffer = exynos_gem->kvaddr + offset;
        fbi->screen_size = size;
        fbi->fix.smem_len = size;
 
index 7445748288da93723010b3f3466df539bf6d402d..74e926abeff0c1fd95f1830757a406e772bee578 100644 (file)
@@ -40,7 +40,7 @@ struct exynos_drm_gem {
        unsigned int            flags;
        unsigned long           size;
        void                    *cookie;
-       void __iomem            *kvaddr;
+       void                    *kvaddr;
        dma_addr_t              dma_addr;
        unsigned long           dma_attrs;
        struct sg_table         *sgt;
index 86fac677fe69b6594507c212e2485fd128e22740..3c6d9f3913d562c3270c226043ef0bd0998f1245 100644 (file)
@@ -101,19 +101,19 @@ static void fsl_dcu_drm_plane_atomic_update(struct drm_plane *plane,
                break;
        case DRM_FORMAT_ARGB8888:
                alpha = DCU_LAYER_AB_WHOLE_FRAME;
-               /* fall-through */
+               fallthrough;
        case DRM_FORMAT_XRGB8888:
                bpp = FSL_DCU_ARGB8888;
                break;
        case DRM_FORMAT_ARGB4444:
                alpha = DCU_LAYER_AB_WHOLE_FRAME;
-               /* fall-through */
+               fallthrough;
        case DRM_FORMAT_XRGB4444:
                bpp = FSL_DCU_ARGB4444;
                break;
        case DRM_FORMAT_ARGB1555:
                alpha = DCU_LAYER_AB_WHOLE_FRAME;
-               /* fall-through */
+               fallthrough;
        case DRM_FORMAT_XRGB1555:
                bpp = FSL_DCU_ARGB1555;
                break;
index 8c55f5bee9ab6a71f8d8b376d5c5cdb88efe34d9..f4053dd6bde9028e7d4fd4297e913b167e5b626c 100644 (file)
@@ -712,7 +712,7 @@ gen11_dsi_configure_transcoder(struct intel_encoder *encoder,
                        switch (intel_dsi->pixel_format) {
                        default:
                                MISSING_CASE(intel_dsi->pixel_format);
-                               /* fallthrough */
+                               fallthrough;
                        case MIPI_DSI_FMT_RGB565:
                                tmp |= PIX_FMT_RGB565;
                                break;
@@ -739,7 +739,7 @@ gen11_dsi_configure_transcoder(struct intel_encoder *encoder,
                        switch (intel_dsi->video_mode_format) {
                        default:
                                MISSING_CASE(intel_dsi->video_mode_format);
-                               /* fallthrough */
+                               fallthrough;
                        case VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS:
                                tmp |= VIDEO_MODE_SYNC_EVENT;
                                break;
@@ -792,7 +792,7 @@ gen11_dsi_configure_transcoder(struct intel_encoder *encoder,
                switch (pipe) {
                default:
                        MISSING_CASE(pipe);
-                       /* fallthrough */
+                       fallthrough;
                case PIPE_A:
                        tmp |= TRANS_DDI_EDP_INPUT_A_ON;
                        break;
index c53c85d38fa5277e46e501ea3958bd17272bae8f..a0a41ec5c341908a9c53bb260c1c6cfba127cc4e 100644 (file)
@@ -905,7 +905,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
                        drm_dbg_kms(&dev_priv->drm,
                                    "VBT tp1 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n",
                                    psr_table->tp1_wakeup_time);
-                       /* fallthrough */
+                       fallthrough;
                case 2:
                        dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
                        break;
@@ -925,7 +925,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
                        drm_dbg_kms(&dev_priv->drm,
                                    "VBT tp2_tp3 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n",
                                    psr_table->tp2_tp3_wakeup_time);
-                       /* fallthrough */
+                       fallthrough;
                case 2:
                        dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 2500;
                break;
@@ -1775,7 +1775,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv,
                switch (child->hdmi_max_data_rate) {
                default:
                        MISSING_CASE(child->hdmi_max_data_rate);
-                       /* fall through */
+                       fallthrough;
                case HDMI_MAX_DATA_RATE_PLATFORM:
                        max_tmds_clock = 0;
                        break;
index bb91dace304ad978302e6206387178f151cd5b68..91a8161e7c05114143b2979155d66b1600a5dbc4 100644 (file)
@@ -326,7 +326,7 @@ static void pnv_get_cdclk(struct drm_i915_private *dev_priv,
        default:
                drm_err(&dev_priv->drm,
                        "Unknown pnv display core clock 0x%04x\n", gcfgc);
-               /* fall through */
+               fallthrough;
        case GC_DISPLAY_CLOCK_133_MHZ_PNV:
                cdclk_config->cdclk = 133333;
                break;
@@ -766,7 +766,7 @@ static void bdw_set_cdclk(struct drm_i915_private *dev_priv,
        switch (cdclk) {
        default:
                MISSING_CASE(cdclk);
-               /* fall through */
+               fallthrough;
        case 337500:
                val |= LCPLL_CLK_FREQ_337_5_BDW;
                break;
@@ -1042,7 +1042,7 @@ static void skl_set_cdclk(struct drm_i915_private *dev_priv,
                drm_WARN_ON(&dev_priv->drm,
                            cdclk != dev_priv->cdclk.hw.bypass);
                drm_WARN_ON(&dev_priv->drm, vco != 0);
-               /* fall through */
+               fallthrough;
        case 308571:
        case 337500:
                freq_select = CDCLK_FREQ_337_308;
@@ -1333,7 +1333,7 @@ static void icl_readout_refclk(struct drm_i915_private *dev_priv,
        switch (dssm) {
        default:
                MISSING_CASE(dssm);
-               /* fall through */
+               fallthrough;
        case ICL_DSSM_CDCLK_PLL_REFCLK_24MHz:
                cdclk_config->ref = 24000;
                break;
@@ -1561,7 +1561,7 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
                drm_WARN_ON(&dev_priv->drm,
                            cdclk != dev_priv->cdclk.hw.bypass);
                drm_WARN_ON(&dev_priv->drm, vco != 0);
-               /* fall through */
+               fallthrough;
        case 2:
                divider = BXT_CDCLK_CD2X_DIV_SEL_1;
                break;
index eccaa79cb4a9d97f36ebcdab1226616153e24a17..157d8c8c605a1c0d3caca74e7026906a81459bdc 100644 (file)
@@ -52,7 +52,7 @@ cnl_get_procmon_ref_values(struct drm_i915_private *dev_priv, enum phy phy)
        switch (val & (PROCESS_INFO_MASK | VOLTAGE_INFO_MASK)) {
        default:
                MISSING_CASE(val);
-               /* fall through */
+               fallthrough;
        case VOLTAGE_INFO_0_85V | PROCESS_INFO_DOT_0:
                procmon = &cnl_procmon_values[PROCMON_0_85V_DOT_0];
                break;
@@ -258,7 +258,7 @@ static bool phy_is_master(struct drm_i915_private *dev_priv, enum phy phy)
 static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
                                       enum phy phy)
 {
-       bool ret;
+       bool ret = true;
        u32 expected_val = 0;
 
        if (!icl_combo_phy_enabled(dev_priv, phy))
@@ -276,7 +276,7 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
                                     DCC_MODE_SELECT_CONTINUOSLY);
        }
 
-       ret = cnl_verify_procmon_ref_values(dev_priv, phy);
+       ret &= cnl_verify_procmon_ref_values(dev_priv, phy);
 
        if (phy_is_master(dev_priv, phy)) {
                ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy),
@@ -320,7 +320,7 @@ void intel_combo_phy_power_up_lanes(struct drm_i915_private *dev_priv,
                        break;
                default:
                        MISSING_CASE(lane_count);
-                       /* fall-through */
+                       fallthrough;
                case 4:
                        lane_mask = PWR_UP_ALL_LANES;
                        break;
@@ -337,7 +337,7 @@ void intel_combo_phy_power_up_lanes(struct drm_i915_private *dev_priv,
                        break;
                default:
                        MISSING_CASE(lane_count);
-                       /* fall-through */
+                       fallthrough;
                case 4:
                        lane_mask = PWR_UP_ALL_LANES;
                        break;
index 2c484b55bcdf7a333fa406be658f6c00221d7e69..a49ff3a1a63cab4660201bdc784a6b70acefb107 100644 (file)
@@ -1888,7 +1888,7 @@ static void intel_ddi_get_encoder_pipes(struct intel_encoder *encoder,
                switch (tmp & TRANS_DDI_EDP_INPUT_MASK) {
                default:
                        MISSING_CASE(tmp & TRANS_DDI_EDP_INPUT_MASK);
-                       /* fallthrough */
+                       fallthrough;
                case TRANS_DDI_EDP_INPUT_A_ON:
                case TRANS_DDI_EDP_INPUT_A_ONOFF:
                        *pipe_mask = BIT(PIPE_A);
@@ -4268,7 +4268,7 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
                        pipe_config->hdmi_scrambling = true;
                if (temp & TRANS_DDI_HIGH_TMDS_CHAR_RATE)
                        pipe_config->hdmi_high_tmds_clock_ratio = true;
-               /* fall through */
+               fallthrough;
        case TRANS_DDI_MODE_SELECT_DVI:
                pipe_config->output_types |= BIT(INTEL_OUTPUT_HDMI);
                pipe_config->lane_count = 4;
index b2ec3a5141cca62264a8751731f09660a4bf438d..b18c5ac2934dcb19e27fc38f667bf38b180a337e 100644 (file)
@@ -2029,12 +2029,12 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane)
        case I915_FORMAT_MOD_Y_TILED_CCS:
                if (is_ccs_plane(fb, color_plane))
                        return 128;
-               /* fall through */
+               fallthrough;
        case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
        case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                if (is_ccs_plane(fb, color_plane))
                        return 64;
-               /* fall through */
+               fallthrough;
        case I915_FORMAT_MOD_Y_TILED:
                if (IS_GEN(dev_priv, 2) || HAS_128_BYTE_Y_TILING(dev_priv))
                        return 128;
@@ -2043,7 +2043,7 @@ intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane)
        case I915_FORMAT_MOD_Yf_TILED_CCS:
                if (is_ccs_plane(fb, color_plane))
                        return 128;
-               /* fall through */
+               fallthrough;
        case I915_FORMAT_MOD_Yf_TILED:
                switch (cpp) {
                case 1:
@@ -2185,7 +2185,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
        case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                if (is_semiplanar_uv_plane(fb, color_plane))
                        return intel_tile_row_size(fb, color_plane);
-               /* Fall-through */
+               fallthrough;
        case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
                return 16 * 1024;
        case I915_FORMAT_MOD_Y_TILED_CCS:
@@ -2194,7 +2194,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
                if (INTEL_GEN(dev_priv) >= 12 &&
                    is_semiplanar_uv_plane(fb, color_plane))
                        return intel_tile_row_size(fb, color_plane);
-               /* Fall-through */
+               fallthrough;
        case I915_FORMAT_MOD_Yf_TILED:
                return 1 * 1024 * 1024;
        default:
@@ -6211,7 +6211,7 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
        case DRM_FORMAT_ARGB16161616F:
                if (INTEL_GEN(dev_priv) >= 11)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                drm_dbg_kms(&dev_priv->drm,
                            "[PLANE:%d:%s] FB:%d unsupported scaling format 0x%x\n",
@@ -10896,7 +10896,7 @@ static void hsw_get_ddi_pll(struct drm_i915_private *dev_priv, enum port port,
                break;
        default:
                MISSING_CASE(ddi_pll_sel);
-               /* fall through */
+               fallthrough;
        case PORT_CLK_SEL_NONE:
                return;
        }
@@ -10956,10 +10956,10 @@ static bool hsw_get_transcoder_state(struct intel_crtc *crtc,
                        drm_WARN(dev, 1,
                                 "unknown pipe linked to transcoder %s\n",
                                 transcoder_name(panel_transcoder));
-                       /* fall through */
+                       fallthrough;
                case TRANS_DDI_EDP_INPUT_A_ONOFF:
                        force_thru = true;
-                       /* fall through */
+                       fallthrough;
                case TRANS_DDI_EDP_INPUT_A_ON:
                        trans_pipe = PIPE_A;
                        break;
@@ -13183,7 +13183,7 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
                case INTEL_OUTPUT_DDI:
                        if (drm_WARN_ON(dev, !HAS_DDI(to_i915(dev))))
                                break;
-                       /* else, fall through */
+                       fallthrough;
                case INTEL_OUTPUT_DP:
                case INTEL_OUTPUT_HDMI:
                case INTEL_OUTPUT_EDP:
@@ -14956,12 +14956,6 @@ static int intel_atomic_check(struct drm_device *dev,
        if (dev_priv->wm.distrust_bios_wm)
                any_ms = true;
 
-       if (any_ms) {
-               ret = intel_modeset_checks(state);
-               if (ret)
-                       goto fail;
-       }
-
        intel_fbc_choose_crtc(dev_priv, state);
        ret = calc_watermark_data(state);
        if (ret)
@@ -14976,6 +14970,10 @@ static int intel_atomic_check(struct drm_device *dev,
                goto fail;
 
        if (any_ms) {
+               ret = intel_modeset_checks(state);
+               if (ret)
+                       goto fail;
+
                ret = intel_modeset_calc_cdclk(state);
                if (ret)
                        return ret;
index aeb6ee395cce5180ea0f3a88e441fa58f408286e..afa7a378b31d8da22387ffdd3aca403502606561 100644 (file)
@@ -892,7 +892,7 @@ static int hsw_ddi_wrpll_get_freq(struct drm_i915_private *dev_priv,
                        refclk = dev_priv->dpll.ref_clks.nssc;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case WRPLL_REF_PCH_SSC:
                /*
                 * We could calculate spread here, but our checking
@@ -2977,7 +2977,7 @@ static bool icl_calc_tbt_pll(struct intel_crtc_state *crtc_state,
                switch (dev_priv->dpll.ref_clks.nssc) {
                default:
                        MISSING_CASE(dev_priv->dpll.ref_clks.nssc);
-                       /* fall-through */
+                       fallthrough;
                case 19200:
                        *pll_params = tgl_tbt_pll_19_2MHz_values;
                        break;
@@ -2992,7 +2992,7 @@ static bool icl_calc_tbt_pll(struct intel_crtc_state *crtc_state,
                switch (dev_priv->dpll.ref_clks.nssc) {
                default:
                        MISSING_CASE(dev_priv->dpll.ref_clks.nssc);
-                       /* fall-through */
+                       fallthrough;
                case 19200:
                case 38400:
                        *pll_params = icl_tbt_pll_19_2MHz_values;
@@ -3120,7 +3120,7 @@ static bool icl_mg_pll_find_divisors(int clock_khz, bool is_dp, bool use_ssc,
                        switch (div1) {
                        default:
                                MISSING_CASE(div1);
-                               /* fall through */
+                               fallthrough;
                        case 2:
                                hsdiv = MG_CLKTOP2_HSCLKCTL_HSDIV_RATIO_2;
                                break;
index 89a4d294822d5528da26cebfd4e6893ba41c0d02..1a0d49af2a0862791f214b3912949e61d451af1a 100644 (file)
@@ -336,8 +336,10 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector,
 
                /* Fill up the empty slots in sha_text and write it out */
                sha_empty = sizeof(sha_text) - sha_leftovers;
-               for (j = 0; j < sha_empty; j++)
-                       sha_text |= ksv[j] << ((sizeof(sha_text) - j - 1) * 8);
+               for (j = 0; j < sha_empty; j++) {
+                       u8 off = ((sizeof(sha_text) - j - 1 - sha_leftovers) * 8);
+                       sha_text |= ksv[j] << off;
+               }
 
                ret = intel_write_sha_text(dev_priv, sha_text);
                if (ret < 0)
@@ -435,7 +437,7 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector,
                /* Write 32 bits of text */
                intel_de_write(dev_priv, HDCP_REP_CTL,
                               rep_ctl | HDCP_SHA1_TEXT_32);
-               sha_text |= bstatus[0] << 24 | bstatus[1] << 16;
+               sha_text |= bstatus[0] << 8 | bstatus[1];
                ret = intel_write_sha_text(dev_priv, sha_text);
                if (ret < 0)
                        return ret;
@@ -450,17 +452,29 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector,
                                return ret;
                        sha_idx += sizeof(sha_text);
                }
+
+               /*
+                * Terminate the SHA-1 stream by hand. For the other leftover
+                * cases this is appended by the hardware.
+                */
+               intel_de_write(dev_priv, HDCP_REP_CTL,
+                              rep_ctl | HDCP_SHA1_TEXT_32);
+               sha_text = DRM_HDCP_SHA1_TERMINATOR << 24;
+               ret = intel_write_sha_text(dev_priv, sha_text);
+               if (ret < 0)
+                       return ret;
+               sha_idx += sizeof(sha_text);
        } else if (sha_leftovers == 3) {
-               /* Write 32 bits of text */
+               /* Write 32 bits of text (filled from LSB) */
                intel_de_write(dev_priv, HDCP_REP_CTL,
                               rep_ctl | HDCP_SHA1_TEXT_32);
-               sha_text |= bstatus[0] << 24;
+               sha_text |= bstatus[0];
                ret = intel_write_sha_text(dev_priv, sha_text);
                if (ret < 0)
                        return ret;
                sha_idx += sizeof(sha_text);
 
-               /* Write 8 bits of text, 24 bits of M0 */
+               /* Write 8 bits of text (filled from LSB), 24 bits of M0 */
                intel_de_write(dev_priv, HDCP_REP_CTL,
                               rep_ctl | HDCP_SHA1_TEXT_8);
                ret = intel_write_sha_text(dev_priv, bstatus[1]);
@@ -781,6 +795,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
        struct intel_hdcp *hdcp = &connector->hdcp;
        enum port port = dig_port->base.port;
        enum transcoder cpu_transcoder = hdcp->cpu_transcoder;
+       u32 repeater_ctl;
        int ret;
 
        drm_dbg_kms(&dev_priv->drm, "[%s:%d] HDCP is being disabled...\n",
@@ -796,6 +811,11 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
                return -ETIMEDOUT;
        }
 
+       repeater_ctl = intel_hdcp_get_repeater_ctl(dev_priv, cpu_transcoder,
+                                                  port);
+       intel_de_write(dev_priv, HDCP_REP_CTL,
+                      intel_de_read(dev_priv, HDCP_REP_CTL) & ~repeater_ctl);
+
        ret = hdcp->shim->toggle_signalling(dig_port, false);
        if (ret) {
                drm_err(&dev_priv->drm, "Failed to disable HDCP signalling\n");
index bbde3b12c3113cc83885bdc18851bbe0fba5979d..4072d7062efd656dd9b75651fa629ad70408825b 100644 (file)
@@ -229,7 +229,7 @@ int intel_pch_panel_fitting(struct intel_crtc_state *crtc_state,
        case DRM_MODE_SCALE_NONE:
                WARN_ON(adjusted_mode->crtc_hdisplay != crtc_state->pipe_src_w);
                WARN_ON(adjusted_mode->crtc_vdisplay != crtc_state->pipe_src_h);
-               /* fall through */
+               fallthrough;
        case DRM_MODE_SCALE_FULLSCREEN:
                x = y = 0;
                width = adjusted_mode->crtc_hdisplay;
index 2da4388e15403d00d8b04cea2c86810e7bbddd7b..5e9fb349c829266b662516d3371b47f1653f294b 100644 (file)
@@ -1531,7 +1531,7 @@ static void intel_sdvo_pre_enable(struct intel_atomic_state *state,
        default:
                drm_WARN(&dev_priv->drm, 1,
                         "unknown pixel multiplier specified\n");
-               /* fall through */
+               fallthrough;
        case 1: rate = SDVO_CLOCK_RATE_MULT_1X; break;
        case 2: rate = SDVO_CLOCK_RATE_MULT_2X; break;
        case 4: rate = SDVO_CLOCK_RATE_MULT_4X; break;
@@ -2549,19 +2549,19 @@ intel_sdvo_guess_ddc_bus(struct intel_sdvo *sdvo)
        switch (sdvo->controlled_output) {
        case SDVO_OUTPUT_LVDS1:
                mask |= SDVO_OUTPUT_LVDS1;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_LVDS0:
                mask |= SDVO_OUTPUT_LVDS0;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_TMDS1:
                mask |= SDVO_OUTPUT_TMDS1;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_TMDS0:
                mask |= SDVO_OUTPUT_TMDS0;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_RGB1:
                mask |= SDVO_OUTPUT_RGB1;
-               /* fall through */
+               fallthrough;
        case SDVO_OUTPUT_RGB0:
                mask |= SDVO_OUTPUT_RGB0;
                break;
index d03860fef2d7908db8e2500ac56e66f495787b5e..c89f5f7ccb06ea56cdf998ee58b04e915646ccc6 100644 (file)
@@ -2147,7 +2147,7 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
                case DRM_FORMAT_RGB565:
                        if (INTEL_GEN(dev_priv) >= 11)
                                break;
-                       /* fall through */
+                       fallthrough;
                case DRM_FORMAT_C8:
                case DRM_FORMAT_XRGB16161616F:
                case DRM_FORMAT_XBGR16161616F:
@@ -2702,7 +2702,7 @@ static bool g4x_sprite_format_mod_supported(struct drm_plane *_plane,
                if (modifier == DRM_FORMAT_MOD_LINEAR ||
                    modifier == I915_FORMAT_MOD_X_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
@@ -2733,7 +2733,7 @@ static bool snb_sprite_format_mod_supported(struct drm_plane *_plane,
                if (modifier == DRM_FORMAT_MOD_LINEAR ||
                    modifier == I915_FORMAT_MOD_X_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
@@ -2768,7 +2768,7 @@ static bool vlv_sprite_format_mod_supported(struct drm_plane *_plane,
                if (modifier == DRM_FORMAT_MOD_LINEAR ||
                    modifier == I915_FORMAT_MOD_X_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
@@ -2801,7 +2801,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
        case DRM_FORMAT_ABGR8888:
                if (is_ccs_modifier(modifier))
                        return true;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_RGB565:
        case DRM_FORMAT_XRGB2101010:
        case DRM_FORMAT_XBGR2101010:
@@ -2819,7 +2819,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
        case DRM_FORMAT_XVYU2101010:
                if (modifier == I915_FORMAT_MOD_Yf_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_C8:
        case DRM_FORMAT_XBGR16161616F:
        case DRM_FORMAT_ABGR16161616F:
@@ -2834,7 +2834,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
                    modifier == I915_FORMAT_MOD_X_TILED ||
                    modifier == I915_FORMAT_MOD_Y_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
@@ -2860,7 +2860,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
        case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
                if (!gen12_plane_supports_mc_ccs(dev_priv, plane->id))
                        return false;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_MOD_LINEAR:
        case I915_FORMAT_MOD_X_TILED:
        case I915_FORMAT_MOD_Y_TILED:
@@ -2877,7 +2877,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
        case DRM_FORMAT_ABGR8888:
                if (is_ccs_modifier(modifier))
                        return true;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_YUYV:
        case DRM_FORMAT_YVYU:
        case DRM_FORMAT_UYVY:
@@ -2889,7 +2889,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
        case DRM_FORMAT_P016:
                if (modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS)
                        return true;
-               /* fall through */
+               fallthrough;
        case DRM_FORMAT_RGB565:
        case DRM_FORMAT_XRGB2101010:
        case DRM_FORMAT_XBGR2101010:
@@ -2910,7 +2910,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
                    modifier == I915_FORMAT_MOD_X_TILED ||
                    modifier == I915_FORMAT_MOD_Y_TILED)
                        return true;
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
index 5b5dc86a5737584fabec9c3312a21e7bea020200..8f67aef18b2da34f36eed452546ca042e786bcf9 100644 (file)
@@ -159,7 +159,7 @@ int intel_tc_port_fia_max_lane_count(struct intel_digital_port *dig_port)
        switch (lane_mask) {
        default:
                MISSING_CASE(lane_mask);
-               /* fall-through */
+               fallthrough;
        case 0x1:
        case 0x2:
        case 0x4:
index d0bdb6d447ed4a98af2b94ffa1a59b2135314813..ef755dd5e68fc3b638a69ddec93b30c6337c0cd8 100644 (file)
@@ -439,29 +439,36 @@ static bool __cancel_engine(struct intel_engine_cs *engine)
        return __reset_engine(engine);
 }
 
-static struct intel_engine_cs *__active_engine(struct i915_request *rq)
+static bool
+__active_engine(struct i915_request *rq, struct intel_engine_cs **active)
 {
        struct intel_engine_cs *engine, *locked;
+       bool ret = false;
 
        /*
         * Serialise with __i915_request_submit() so that it sees
         * is-banned?, or we know the request is already inflight.
+        *
+        * Note that rq->engine is unstable, and so we double
+        * check that we have acquired the lock on the final engine.
         */
        locked = READ_ONCE(rq->engine);
        spin_lock_irq(&locked->active.lock);
        while (unlikely(locked != (engine = READ_ONCE(rq->engine)))) {
                spin_unlock(&locked->active.lock);
-               spin_lock(&engine->active.lock);
                locked = engine;
+               spin_lock(&locked->active.lock);
        }
 
-       engine = NULL;
-       if (i915_request_is_active(rq) && rq->fence.error != -EIO)
-               engine = rq->engine;
+       if (!i915_request_completed(rq)) {
+               if (i915_request_is_active(rq) && rq->fence.error != -EIO)
+                       *active = locked;
+               ret = true;
+       }
 
        spin_unlock_irq(&locked->active.lock);
 
-       return engine;
+       return ret;
 }
 
 static struct intel_engine_cs *active_engine(struct intel_context *ce)
@@ -472,17 +479,16 @@ static struct intel_engine_cs *active_engine(struct intel_context *ce)
        if (!ce->timeline)
                return NULL;
 
-       mutex_lock(&ce->timeline->mutex);
-       list_for_each_entry_reverse(rq, &ce->timeline->requests, link) {
-               if (i915_request_completed(rq))
-                       break;
+       rcu_read_lock();
+       list_for_each_entry_rcu(rq, &ce->timeline->requests, link) {
+               if (i915_request_is_active(rq) && i915_request_completed(rq))
+                       continue;
 
                /* Check with the backend if the request is inflight */
-               engine = __active_engine(rq);
-               if (engine)
+               if (__active_engine(rq, &engine))
                        break;
        }
-       mutex_unlock(&ce->timeline->mutex);
+       rcu_read_unlock();
 
        return engine;
 }
@@ -713,6 +719,7 @@ __create_context(struct drm_i915_private *i915)
        ctx->i915 = i915;
        ctx->sched.priority = I915_USER_PRIORITY(I915_PRIORITY_NORMAL);
        mutex_init(&ctx->mutex);
+       INIT_LIST_HEAD(&ctx->link);
 
        spin_lock_init(&ctx->stale.lock);
        INIT_LIST_HEAD(&ctx->stale.engines);
@@ -740,10 +747,6 @@ __create_context(struct drm_i915_private *i915)
        for (i = 0; i < ARRAY_SIZE(ctx->hang_timestamp); i++)
                ctx->hang_timestamp[i] = jiffies - CONTEXT_FAST_HANG_JIFFIES;
 
-       spin_lock(&i915->gem.contexts.lock);
-       list_add_tail(&ctx->link, &i915->gem.contexts.list);
-       spin_unlock(&i915->gem.contexts.lock);
-
        return ctx;
 
 err_free:
@@ -931,6 +934,7 @@ static int gem_context_register(struct i915_gem_context *ctx,
                                struct drm_i915_file_private *fpriv,
                                u32 *id)
 {
+       struct drm_i915_private *i915 = ctx->i915;
        struct i915_address_space *vm;
        int ret;
 
@@ -949,8 +953,16 @@ static int gem_context_register(struct i915_gem_context *ctx,
        /* And finally expose ourselves to userspace via the idr */
        ret = xa_alloc(&fpriv->context_xa, id, ctx, xa_limit_32b, GFP_KERNEL);
        if (ret)
-               put_pid(fetch_and_zero(&ctx->pid));
+               goto err_pid;
+
+       spin_lock(&i915->gem.contexts.lock);
+       list_add_tail(&ctx->link, &i915->gem.contexts.list);
+       spin_unlock(&i915->gem.contexts.lock);
+
+       return 0;
 
+err_pid:
+       put_pid(fetch_and_zero(&ctx->pid));
        return ret;
 }
 
index 6b4ec66cb558dca8b893d8b3d13d7622a5ce1073..446e76e95c381714740312406356efa7613fcc5f 100644 (file)
@@ -45,6 +45,13 @@ struct eb_vma_array {
        struct eb_vma vma[];
 };
 
+enum {
+       FORCE_CPU_RELOC = 1,
+       FORCE_GTT_RELOC,
+       FORCE_GPU_RELOC,
+#define DBG_FORCE_RELOC 0 /* choose one of the above! */
+};
+
 #define __EXEC_OBJECT_HAS_PIN          BIT(31)
 #define __EXEC_OBJECT_HAS_FENCE                BIT(30)
 #define __EXEC_OBJECT_NEEDS_MAP                BIT(29)
@@ -253,6 +260,8 @@ struct i915_execbuffer {
         */
        struct reloc_cache {
                struct drm_mm_node node; /** temporary GTT binding */
+               unsigned long vaddr; /** Current kmap address */
+               unsigned long page; /** Currently mapped page index */
                unsigned int gen; /** Cached value of INTEL_GEN */
                bool use_64bit_reloc : 1;
                bool has_llc : 1;
@@ -596,6 +605,23 @@ eb_add_vma(struct i915_execbuffer *eb,
        }
 }
 
+static inline int use_cpu_reloc(const struct reloc_cache *cache,
+                               const struct drm_i915_gem_object *obj)
+{
+       if (!i915_gem_object_has_struct_page(obj))
+               return false;
+
+       if (DBG_FORCE_RELOC == FORCE_CPU_RELOC)
+               return true;
+
+       if (DBG_FORCE_RELOC == FORCE_GTT_RELOC)
+               return false;
+
+       return (cache->has_llc ||
+               obj->cache_dirty ||
+               obj->cache_level != I915_CACHE_NONE);
+}
+
 static int eb_reserve_vma(const struct i915_execbuffer *eb,
                          struct eb_vma *ev,
                          u64 pin_flags)
@@ -926,6 +952,8 @@ relocation_target(const struct drm_i915_gem_relocation_entry *reloc,
 static void reloc_cache_init(struct reloc_cache *cache,
                             struct drm_i915_private *i915)
 {
+       cache->page = -1;
+       cache->vaddr = 0;
        /* Must be a variable in the struct to allow GCC to unroll. */
        cache->gen = INTEL_GEN(i915);
        cache->has_llc = HAS_LLC(i915);
@@ -937,6 +965,25 @@ static void reloc_cache_init(struct reloc_cache *cache,
        cache->target = NULL;
 }
 
+static inline void *unmask_page(unsigned long p)
+{
+       return (void *)(uintptr_t)(p & PAGE_MASK);
+}
+
+static inline unsigned int unmask_flags(unsigned long p)
+{
+       return p & ~PAGE_MASK;
+}
+
+#define KMAP 0x4 /* after CLFLUSH_FLAGS */
+
+static inline struct i915_ggtt *cache_to_ggtt(struct reloc_cache *cache)
+{
+       struct drm_i915_private *i915 =
+               container_of(cache, struct i915_execbuffer, reloc_cache)->i915;
+       return &i915->ggtt;
+}
+
 #define RELOC_TAIL 4
 
 static int reloc_gpu_chain(struct reloc_cache *cache)
@@ -1049,6 +1096,181 @@ static int reloc_gpu_flush(struct reloc_cache *cache)
        return err;
 }
 
+static void reloc_cache_reset(struct reloc_cache *cache)
+{
+       void *vaddr;
+
+       if (!cache->vaddr)
+               return;
+
+       vaddr = unmask_page(cache->vaddr);
+       if (cache->vaddr & KMAP) {
+               if (cache->vaddr & CLFLUSH_AFTER)
+                       mb();
+
+               kunmap_atomic(vaddr);
+               i915_gem_object_finish_access((struct drm_i915_gem_object *)cache->node.mm);
+       } else {
+               struct i915_ggtt *ggtt = cache_to_ggtt(cache);
+
+               intel_gt_flush_ggtt_writes(ggtt->vm.gt);
+               io_mapping_unmap_atomic((void __iomem *)vaddr);
+
+               if (drm_mm_node_allocated(&cache->node)) {
+                       ggtt->vm.clear_range(&ggtt->vm,
+                                            cache->node.start,
+                                            cache->node.size);
+                       mutex_lock(&ggtt->vm.mutex);
+                       drm_mm_remove_node(&cache->node);
+                       mutex_unlock(&ggtt->vm.mutex);
+               } else {
+                       i915_vma_unpin((struct i915_vma *)cache->node.mm);
+               }
+       }
+
+       cache->vaddr = 0;
+       cache->page = -1;
+}
+
+static void *reloc_kmap(struct drm_i915_gem_object *obj,
+                       struct reloc_cache *cache,
+                       unsigned long page)
+{
+       void *vaddr;
+
+       if (cache->vaddr) {
+               kunmap_atomic(unmask_page(cache->vaddr));
+       } else {
+               unsigned int flushes;
+               int err;
+
+               err = i915_gem_object_prepare_write(obj, &flushes);
+               if (err)
+                       return ERR_PTR(err);
+
+               BUILD_BUG_ON(KMAP & CLFLUSH_FLAGS);
+               BUILD_BUG_ON((KMAP | CLFLUSH_FLAGS) & PAGE_MASK);
+
+               cache->vaddr = flushes | KMAP;
+               cache->node.mm = (void *)obj;
+               if (flushes)
+                       mb();
+       }
+
+       vaddr = kmap_atomic(i915_gem_object_get_dirty_page(obj, page));
+       cache->vaddr = unmask_flags(cache->vaddr) | (unsigned long)vaddr;
+       cache->page = page;
+
+       return vaddr;
+}
+
+static void *reloc_iomap(struct drm_i915_gem_object *obj,
+                        struct reloc_cache *cache,
+                        unsigned long page)
+{
+       struct i915_ggtt *ggtt = cache_to_ggtt(cache);
+       unsigned long offset;
+       void *vaddr;
+
+       if (cache->vaddr) {
+               intel_gt_flush_ggtt_writes(ggtt->vm.gt);
+               io_mapping_unmap_atomic((void __force __iomem *) unmask_page(cache->vaddr));
+       } else {
+               struct i915_vma *vma;
+               int err;
+
+               if (i915_gem_object_is_tiled(obj))
+                       return ERR_PTR(-EINVAL);
+
+               if (use_cpu_reloc(cache, obj))
+                       return NULL;
+
+               i915_gem_object_lock(obj);
+               err = i915_gem_object_set_to_gtt_domain(obj, true);
+               i915_gem_object_unlock(obj);
+               if (err)
+                       return ERR_PTR(err);
+
+               vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0,
+                                              PIN_MAPPABLE |
+                                              PIN_NONBLOCK /* NOWARN */ |
+                                              PIN_NOEVICT);
+               if (IS_ERR(vma)) {
+                       memset(&cache->node, 0, sizeof(cache->node));
+                       mutex_lock(&ggtt->vm.mutex);
+                       err = drm_mm_insert_node_in_range
+                               (&ggtt->vm.mm, &cache->node,
+                                PAGE_SIZE, 0, I915_COLOR_UNEVICTABLE,
+                                0, ggtt->mappable_end,
+                                DRM_MM_INSERT_LOW);
+                       mutex_unlock(&ggtt->vm.mutex);
+                       if (err) /* no inactive aperture space, use cpu reloc */
+                               return NULL;
+               } else {
+                       cache->node.start = vma->node.start;
+                       cache->node.mm = (void *)vma;
+               }
+       }
+
+       offset = cache->node.start;
+       if (drm_mm_node_allocated(&cache->node)) {
+               ggtt->vm.insert_page(&ggtt->vm,
+                                    i915_gem_object_get_dma_address(obj, page),
+                                    offset, I915_CACHE_NONE, 0);
+       } else {
+               offset += page << PAGE_SHIFT;
+       }
+
+       vaddr = (void __force *)io_mapping_map_atomic_wc(&ggtt->iomap,
+                                                        offset);
+       cache->page = page;
+       cache->vaddr = (unsigned long)vaddr;
+
+       return vaddr;
+}
+
+static void *reloc_vaddr(struct drm_i915_gem_object *obj,
+                        struct reloc_cache *cache,
+                        unsigned long page)
+{
+       void *vaddr;
+
+       if (cache->page == page) {
+               vaddr = unmask_page(cache->vaddr);
+       } else {
+               vaddr = NULL;
+               if ((cache->vaddr & KMAP) == 0)
+                       vaddr = reloc_iomap(obj, cache, page);
+               if (!vaddr)
+                       vaddr = reloc_kmap(obj, cache, page);
+       }
+
+       return vaddr;
+}
+
+static void clflush_write32(u32 *addr, u32 value, unsigned int flushes)
+{
+       if (unlikely(flushes & (CLFLUSH_BEFORE | CLFLUSH_AFTER))) {
+               if (flushes & CLFLUSH_BEFORE) {
+                       clflushopt(addr);
+                       mb();
+               }
+
+               *addr = value;
+
+               /*
+                * Writes to the same cacheline are serialised by the CPU
+                * (including clflush). On the write path, we only require
+                * that it hits memory in an orderly fashion and place
+                * mb barriers at the start and end of the relocation phase
+                * to ensure ordering of clflush wrt to the system.
+                */
+               if (flushes & CLFLUSH_AFTER)
+                       clflushopt(addr);
+       } else
+               *addr = value;
+}
+
 static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma)
 {
        struct drm_i915_gem_object *obj = vma->obj;
@@ -1214,6 +1436,17 @@ static u32 *reloc_gpu(struct i915_execbuffer *eb,
        return cmd;
 }
 
+static inline bool use_reloc_gpu(struct i915_vma *vma)
+{
+       if (DBG_FORCE_RELOC == FORCE_GPU_RELOC)
+               return true;
+
+       if (DBG_FORCE_RELOC)
+               return false;
+
+       return !dma_resv_test_signaled_rcu(vma->resv, true);
+}
+
 static unsigned long vma_phys_addr(struct i915_vma *vma, u32 offset)
 {
        struct page *page;
@@ -1228,10 +1461,10 @@ static unsigned long vma_phys_addr(struct i915_vma *vma, u32 offset)
        return addr + offset_in_page(offset);
 }
 
-static int __reloc_entry_gpu(struct i915_execbuffer *eb,
-                            struct i915_vma *vma,
-                            u64 offset,
-                            u64 target_addr)
+static bool __reloc_entry_gpu(struct i915_execbuffer *eb,
+                             struct i915_vma *vma,
+                             u64 offset,
+                             u64 target_addr)
 {
        const unsigned int gen = eb->reloc_cache.gen;
        unsigned int len;
@@ -1247,7 +1480,7 @@ static int __reloc_entry_gpu(struct i915_execbuffer *eb,
 
        batch = reloc_gpu(eb, vma, len);
        if (IS_ERR(batch))
-               return PTR_ERR(batch);
+               return false;
 
        addr = gen8_canonical_addr(vma->node.start + offset);
        if (gen >= 8) {
@@ -1296,21 +1529,55 @@ static int __reloc_entry_gpu(struct i915_execbuffer *eb,
                *batch++ = target_addr;
        }
 
-       return 0;
+       return true;
+}
+
+static bool reloc_entry_gpu(struct i915_execbuffer *eb,
+                           struct i915_vma *vma,
+                           u64 offset,
+                           u64 target_addr)
+{
+       if (eb->reloc_cache.vaddr)
+               return false;
+
+       if (!use_reloc_gpu(vma))
+               return false;
+
+       return __reloc_entry_gpu(eb, vma, offset, target_addr);
 }
 
 static u64
-relocate_entry(struct i915_execbuffer *eb,
-              struct i915_vma *vma,
+relocate_entry(struct i915_vma *vma,
               const struct drm_i915_gem_relocation_entry *reloc,
+              struct i915_execbuffer *eb,
               const struct i915_vma *target)
 {
        u64 target_addr = relocation_target(reloc, target);
-       int err;
-
-       err = __reloc_entry_gpu(eb, vma, reloc->offset, target_addr);
-       if (err)
-               return err;
+       u64 offset = reloc->offset;
+
+       if (!reloc_entry_gpu(eb, vma, offset, target_addr)) {
+               bool wide = eb->reloc_cache.use_64bit_reloc;
+               void *vaddr;
+
+repeat:
+               vaddr = reloc_vaddr(vma->obj,
+                                   &eb->reloc_cache,
+                                   offset >> PAGE_SHIFT);
+               if (IS_ERR(vaddr))
+                       return PTR_ERR(vaddr);
+
+               GEM_BUG_ON(!IS_ALIGNED(offset, sizeof(u32)));
+               clflush_write32(vaddr + offset_in_page(offset),
+                               lower_32_bits(target_addr),
+                               eb->reloc_cache.vaddr);
+
+               if (wide) {
+                       offset += sizeof(u32);
+                       target_addr >>= 32;
+                       wide = false;
+                       goto repeat;
+               }
+       }
 
        return target->node.start | UPDATE;
 }
@@ -1375,7 +1642,8 @@ eb_relocate_entry(struct i915_execbuffer *eb,
         * If the relocation already has the right value in it, no
         * more work needs to be done.
         */
-       if (gen8_canonical_addr(target->vma->node.start) == reloc->presumed_offset)
+       if (!DBG_FORCE_RELOC &&
+           gen8_canonical_addr(target->vma->node.start) == reloc->presumed_offset)
                return 0;
 
        /* Check that the relocation address is valid... */
@@ -1407,7 +1675,7 @@ eb_relocate_entry(struct i915_execbuffer *eb,
        ev->flags &= ~EXEC_OBJECT_ASYNC;
 
        /* and update the user's relocation entry */
-       return relocate_entry(eb, ev->vma, reloc, target->vma);
+       return relocate_entry(ev->vma, reloc, eb, target->vma);
 }
 
 static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
@@ -1445,8 +1713,10 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
                 * this is bad and so lockdep complains vehemently.
                 */
                copied = __copy_from_user(r, urelocs, count * sizeof(r[0]));
-               if (unlikely(copied))
-                       return -EFAULT;
+               if (unlikely(copied)) {
+                       remain = -EFAULT;
+                       goto out;
+               }
 
                remain -= count;
                do {
@@ -1454,7 +1724,8 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
 
                        if (likely(offset == 0)) {
                        } else if ((s64)offset < 0) {
-                               return (int)offset;
+                               remain = (int)offset;
+                               goto out;
                        } else {
                                /*
                                 * Note that reporting an error now
@@ -1484,8 +1755,9 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
                } while (r++, --count);
                urelocs += ARRAY_SIZE(stack);
        } while (remain);
-
-       return 0;
+out:
+       reloc_cache_reset(&eb->reloc_cache);
+       return remain;
 }
 
 static int eb_relocate(struct i915_execbuffer *eb)
@@ -2392,7 +2664,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
        eb.i915 = i915;
        eb.file = file;
        eb.args = args;
-       if (!(args->flags & I915_EXEC_NO_RELOC))
+       if (DBG_FORCE_RELOC || !(args->flags & I915_EXEC_NO_RELOC))
                args->flags |= __EXEC_HAS_RELOC;
 
        eb.exec = exec;
index b23368529a409cabe1dc092b887f96369c934754..753f82d87a3168e1b8a01afb86173e6ff70baf3c 100644 (file)
@@ -209,7 +209,7 @@ static vm_fault_t i915_error_to_vmf_fault(int err)
        switch (err) {
        default:
                WARN_ONCE(err, "unhandled error in %s: %i\n", __func__, err);
-               /* fallthrough */
+               fallthrough;
        case -EIO: /* shmemfs failure from swap device */
        case -EFAULT: /* purged object */
        case -ENODEV: /* bad object, how did you get here! */
index e5b9276d254c01d054c5c94ea9acdeb2b578c72a..9cf4ad78ece6ef6e926aabd01d9155e06b2bb9c4 100644 (file)
@@ -258,6 +258,10 @@ struct page *
 i915_gem_object_get_page(struct drm_i915_gem_object *obj,
                         unsigned int n);
 
+struct page *
+i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj,
+                              unsigned int n);
+
 dma_addr_t
 i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj,
                                    unsigned long n,
index 7050519c87a4f53ed788b65bd03ddf3edab385dd..e8a083743e09276920a009dab4a6eeea79138cc9 100644 (file)
@@ -276,7 +276,7 @@ static void *i915_gem_object_map(struct drm_i915_gem_object *obj,
        switch (type) {
        default:
                MISSING_CASE(type);
-               /* fallthrough - to use PAGE_KERNEL anyway */
+               fallthrough;    /* to use PAGE_KERNEL anyway */
        case I915_MAP_WB:
                pgprot = PAGE_KERNEL;
                break;
@@ -548,6 +548,20 @@ i915_gem_object_get_page(struct drm_i915_gem_object *obj, unsigned int n)
        return nth_page(sg_page(sg), offset);
 }
 
+/* Like i915_gem_object_get_page(), but mark the returned page dirty */
+struct page *
+i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj,
+                              unsigned int n)
+{
+       struct page *page;
+
+       page = i915_gem_object_get_page(obj, n);
+       if (!obj->mm.dirty)
+               set_page_dirty(page);
+
+       return page;
+}
+
 dma_addr_t
 i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj,
                                    unsigned long n,
index e0f21f12d3ce4a7bbf9b80b2518e47bd4f956f27..0be5e86833371b16d6a532d83f1a3eb0e37c03f8 100644 (file)
@@ -249,7 +249,7 @@ static void vlv_get_stolen_reserved(struct drm_i915_private *i915,
        switch (reg_val & GEN7_STOLEN_RESERVED_SIZE_MASK) {
        default:
                MISSING_CASE(reg_val & GEN7_STOLEN_RESERVED_SIZE_MASK);
-               /* fall through */
+               fallthrough;
        case GEN7_STOLEN_RESERVED_1M:
                *size = 1024 * 1024;
                break;
@@ -416,7 +416,7 @@ static int i915_gem_init_stolen(struct drm_i915_private *i915)
        case 4:
                if (!IS_G4X(i915))
                        break;
-               /* fall through */
+               fallthrough;
        case 5:
                g4x_get_stolen_reserved(i915, uncore,
                                        &reserved_base, &reserved_size);
@@ -445,7 +445,7 @@ static int i915_gem_init_stolen(struct drm_i915_private *i915)
                break;
        default:
                MISSING_CASE(INTEL_GEN(i915));
-               /* fall-through */
+               fallthrough;
        case 11:
        case 12:
                icl_get_stolen_reserved(i915, uncore,
index 2c2bf24140c97279cae7368cf0842fcf427fed74..12b30075134a81b5cd137bb1ad0268a6da05f1b6 100644 (file)
@@ -596,14 +596,6 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)
                                      GFP_KERNEL |
                                      __GFP_NORETRY |
                                      __GFP_NOWARN);
-               /*
-                * Using __get_user_pages_fast() with a read-only
-                * access is questionable. A read-only page may be
-                * COW-broken, and then this might end up giving
-                * the wrong side of the COW..
-                *
-                * We may or may not care.
-                */
                if (pvec) {
                        /* defer to worker if malloc fails */
                        if (!i915_gem_object_is_readonly(obj))
index 57c14d3340cde50d456b3d123ca7392556a797ff..a49016f8ee0dc0bce31bdc99c88729f448f32988 100644 (file)
@@ -37,14 +37,20 @@ static int __igt_gpu_reloc(struct i915_execbuffer *eb,
                return err;
 
        /* 8-Byte aligned */
-       err = __reloc_entry_gpu(eb, vma, offsets[0] * sizeof(u32), 0);
-       if (err)
+       if (!__reloc_entry_gpu(eb, vma,
+                              offsets[0] * sizeof(u32),
+                              0)) {
+               err = -EIO;
                goto unpin_vma;
+       }
 
        /* !8-Byte aligned */
-       err = __reloc_entry_gpu(eb, vma, offsets[1] * sizeof(u32), 1);
-       if (err)
+       if (!__reloc_entry_gpu(eb, vma,
+                              offsets[1] * sizeof(u32),
+                              1)) {
+               err = -EIO;
                goto unpin_vma;
+       }
 
        /* Skip to the end of the cmd page */
        i = PAGE_SIZE / sizeof(u32) - RELOC_TAIL - 1;
@@ -54,9 +60,12 @@ static int __igt_gpu_reloc(struct i915_execbuffer *eb,
        eb->reloc_cache.rq_size += i;
 
        /* Force batch chaining */
-       err = __reloc_entry_gpu(eb, vma, offsets[2] * sizeof(u32), 2);
-       if (err)
+       if (!__reloc_entry_gpu(eb, vma,
+                              offsets[2] * sizeof(u32),
+                              2)) {
+               err = -EIO;
                goto unpin_vma;
+       }
 
        GEM_BUG_ON(!eb->reloc_cache.rq);
        rq = i915_request_get(eb->reloc_cache.rq);
index dd1a42c4d344ee70630a3f3b190e5e093933dc0f..26087dd7978245a639a522bdba8b0e212f72e227 100644 (file)
@@ -213,7 +213,7 @@ u32 intel_engine_context_size(struct intel_gt *gt, u8 class)
                break;
        default:
                MISSING_CASE(class);
-               /* fall through */
+               fallthrough;
        case VIDEO_DECODE_CLASS:
        case VIDEO_ENHANCEMENT_CLASS:
        case COPY_ENGINE_CLASS:
index 62979ea591f05b88917b686ba17cc5e1b39bbc01..99e28d9021e8129928b24c9f7d4eee17855bf7a7 100644 (file)
@@ -1437,7 +1437,7 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma)
        switch (vma->ggtt_view.type) {
        default:
                GEM_BUG_ON(vma->ggtt_view.type);
-               /* fall through */
+               fallthrough;
        case I915_GGTT_VIEW_NORMAL:
                vma->pages = vma->obj->mm.pages;
                return 0;
index 24322ef08aa40e3d5cb368cd7136445908fe3094..9eeaca957a7e21ebe2371f99fd6182b34e98087e 100644 (file)
@@ -2060,6 +2060,14 @@ static inline void clear_ports(struct i915_request **ports, int count)
        memset_p((void **)ports, NULL, count);
 }
 
+static inline void
+copy_ports(struct i915_request **dst, struct i915_request **src, int count)
+{
+       /* A memcpy_p() would be very useful here! */
+       while (count--)
+               WRITE_ONCE(*dst++, *src++); /* avoid write tearing */
+}
+
 static void execlists_dequeue(struct intel_engine_cs *engine)
 {
        struct intel_engine_execlists * const execlists = &engine->execlists;
@@ -2648,10 +2656,9 @@ static void process_csb(struct intel_engine_cs *engine)
 
                        /* switch pending to inflight */
                        GEM_BUG_ON(!assert_pending_valid(execlists, "promote"));
-                       memcpy(execlists->inflight,
-                              execlists->pending,
-                              execlists_num_ports(execlists) *
-                              sizeof(*execlists->pending));
+                       copy_ports(execlists->inflight,
+                                  execlists->pending,
+                                  execlists_num_ports(execlists));
                        smp_wmb(); /* complete the seqlock */
                        WRITE_ONCE(execlists->active, execlists->inflight);
 
index 94915f668715d754ead2fca46900ae3483b78ff0..898593ca48898d9c543be2c691ee4c3cab8a2f0e 100644 (file)
@@ -100,7 +100,7 @@ static void set_hwsp(struct intel_engine_cs *engine, u32 offset)
                 */
                default:
                        GEM_BUG_ON(engine->id);
-                       /* fallthrough */
+                       fallthrough;
                case RCS0:
                        hwsp = RENDER_HWS_PGA_GEN7;
                        break;
index 63bba7b4bb2fbe00f8d09a3a47da4891bec221fc..05f3bc98d242d38fe813db1d5562555016d64c20 100644 (file)
@@ -1226,7 +1226,7 @@ static int handle_g2v_notification(struct intel_vgpu *vgpu, int notification)
        switch (notification) {
        case VGT_G2V_PPGTT_L3_PAGE_TABLE_CREATE:
                root_entry_type = GTT_TYPE_PPGTT_ROOT_L3_ENTRY;
-               /* fall through */
+               fallthrough;
        case VGT_G2V_PPGTT_L4_PAGE_TABLE_CREATE:
                mm = intel_vgpu_get_ppgtt_mm(vgpu, root_entry_type, pdps);
                return PTR_ERR_OR_ZERO(mm);
index 8fa9b31a248401ffc28a0b862827e3da6c4f2fa0..f6d7e33c7099e7976bd7388858af2b869657757e 100644 (file)
@@ -368,6 +368,7 @@ void intel_gvt_destroy_idle_vgpu(struct intel_vgpu *vgpu)
 static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
                struct intel_vgpu_creation_params *param)
 {
+       struct drm_i915_private *dev_priv = gvt->gt->i915;
        struct intel_vgpu *vgpu;
        int ret;
 
@@ -436,7 +437,10 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
        if (ret)
                goto out_clean_sched_policy;
 
-       ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_D);
+       if (IS_BROADWELL(dev_priv))
+               ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_B);
+       else
+               ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_D);
        if (ret)
                goto out_clean_sched_policy;
 
index 372354d33f55210d322422f0e193e319d2ec9522..5ac4a999f05a6ebb58ff9a8092d2a474416f97c7 100644 (file)
@@ -1204,6 +1204,12 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj,
        return dst;
 }
 
+static inline bool cmd_desc_is(const struct drm_i915_cmd_descriptor * const desc,
+                              const u32 cmd)
+{
+       return desc->cmd.value == (cmd & desc->cmd.mask);
+}
+
 static bool check_cmd(const struct intel_engine_cs *engine,
                      const struct drm_i915_cmd_descriptor *desc,
                      const u32 *cmd, u32 length)
@@ -1242,19 +1248,19 @@ static bool check_cmd(const struct intel_engine_cs *engine,
                         * allowed mask/value pair given in the whitelist entry.
                         */
                        if (reg->mask) {
-                               if (desc->cmd.value == MI_LOAD_REGISTER_MEM) {
+                               if (cmd_desc_is(desc, MI_LOAD_REGISTER_MEM)) {
                                        DRM_DEBUG("CMD: Rejected LRM to masked register 0x%08X\n",
                                                  reg_addr);
                                        return false;
                                }
 
-                               if (desc->cmd.value == MI_LOAD_REGISTER_REG) {
+                               if (cmd_desc_is(desc, MI_LOAD_REGISTER_REG)) {
                                        DRM_DEBUG("CMD: Rejected LRR to masked register 0x%08X\n",
                                                  reg_addr);
                                        return false;
                                }
 
-                               if (desc->cmd.value == MI_LOAD_REGISTER_IMM(1) &&
+                               if (cmd_desc_is(desc, MI_LOAD_REGISTER_IMM(1)) &&
                                    (offset + 2 > length ||
                                     (cmd[offset + 1] & reg->mask) != reg->value)) {
                                        DRM_DEBUG("CMD: Rejected LRI to masked register 0x%08X\n",
@@ -1478,7 +1484,7 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine,
                        break;
                }
 
-               if (desc->cmd.value == MI_BATCH_BUFFER_START) {
+               if (cmd_desc_is(desc, MI_BATCH_BUFFER_START)) {
                        ret = check_bbstart(cmd, offset, length, batch_length,
                                            batch_addr, shadow_addr,
                                            jump_whitelist);
index 6a3a2ce0b394789e0f25ed9bf04b0af305b20951..3e6cbb0d1150ebe8999ca6b0609adacff0413d43 100644 (file)
@@ -1159,7 +1159,7 @@ static void engine_record_registers(struct intel_engine_coredump *ee)
                        switch (engine->id) {
                        default:
                                MISSING_CASE(engine->id);
-                               /* fall through */
+                               fallthrough;
                        case RCS0:
                                mmio = RENDER_HWS_PGA_GEN7;
                                break;
index 056994224c6bc4c82f7b2afeab0f6114b72de993..69c0fa20eba17b031b40073e63250715bbab02be 100644 (file)
@@ -474,7 +474,7 @@ config_status(struct drm_i915_private *i915, u64 config)
                if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
                        /* Requires a mutex for sampling! */
                        return -ENODEV;
-               /* Fall-through. */
+               fallthrough;
        case I915_PMU_REQUESTED_FREQUENCY:
                if (INTEL_GEN(i915) < 6)
                        return -ENODEV;
index 0b2fe55e6194573409582e56b263d40c028cea6c..781a6783affe920f29bfe9fe39f6dbe8da64047b 100644 (file)
@@ -388,17 +388,38 @@ static bool __request_in_flight(const struct i915_request *signal)
         * As we know that there are always preemption points between
         * requests, we know that only the currently executing request
         * may be still active even though we have cleared the flag.
-        * However, we can't rely on our tracking of ELSP[0] to known
+        * However, we can't rely on our tracking of ELSP[0] to know
         * which request is currently active and so maybe stuck, as
         * the tracking maybe an event behind. Instead assume that
         * if the context is still inflight, then it is still active
         * even if the active flag has been cleared.
+        *
+        * To further complicate matters, if there a pending promotion, the HW
+        * may either perform a context switch to the second inflight execlists,
+        * or it may switch to the pending set of execlists. In the case of the
+        * latter, it may send the ACK and we process the event copying the
+        * pending[] over top of inflight[], _overwriting_ our *active. Since
+        * this implies the HW is arbitrating and not struck in *active, we do
+        * not worry about complete accuracy, but we do require no read/write
+        * tearing of the pointer [the read of the pointer must be valid, even
+        * as the array is being overwritten, for which we require the writes
+        * to avoid tearing.]
+        *
+        * Note that the read of *execlists->active may race with the promotion
+        * of execlists->pending[] to execlists->inflight[], overwritting
+        * the value at *execlists->active. This is fine. The promotion implies
+        * that we received an ACK from the HW, and so the context is not
+        * stuck -- if we do not see ourselves in *active, the inflight status
+        * is valid. If instead we see ourselves being copied into *active,
+        * we are inflight and may signal the callback.
         */
        if (!intel_context_inflight(signal->context))
                return false;
 
        rcu_read_lock();
-       for (port = __engine_active(signal->engine); (rq = *port); port++) {
+       for (port = __engine_active(signal->engine);
+            (rq = READ_ONCE(*port)); /* may race with promotion of pending[] */
+            port++) {
                if (rq->context == signal->context) {
                        inflight = i915_seqno_passed(rq->fence.seqno,
                                                     signal->fence.seqno);
index 295b9829e2da519f8ff2933305dc76c2d7898a2a..4cd2038cbe35990c0a2e1a4d790dded6ec8d69b3 100644 (file)
@@ -164,9 +164,13 @@ static void __i915_sw_fence_wake_up_all(struct i915_sw_fence *fence,
 
                do {
                        list_for_each_entry_safe(pos, next, &x->head, entry) {
-                               pos->func(pos,
-                                         TASK_NORMAL, fence->error,
-                                         &extra);
+                               int wake_flags;
+
+                               wake_flags = fence->error;
+                               if (pos->func == autoremove_wake_function)
+                                       wake_flags = 0;
+
+                               pos->func(pos, TASK_NORMAL, wake_flags, &extra);
                        }
 
                        if (list_empty(&extra))
index f127e633f7ca816b40fccb64d6a7f3ac4aad44a8..397c313a8b6929da9a8ad360484a8566ae365850 100644 (file)
@@ -118,11 +118,11 @@ static struct dev_pm_domain pm_domain = {
 
 struct drm_i915_private *mock_gem_device(void)
 {
-       struct drm_i915_private *i915;
-       struct pci_dev *pdev;
 #if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
-       struct dev_iommu iommu;
+       static struct dev_iommu fake_iommu = { .priv = (void *)-1 };
 #endif
+       struct drm_i915_private *i915;
+       struct pci_dev *pdev;
        int err;
 
        pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
@@ -141,10 +141,8 @@ struct drm_i915_private *mock_gem_device(void)
        dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
 
 #if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
-       /* HACK HACK HACK to disable iommu for the fake device; force identity mapping */
-       memset(&iommu, 0, sizeof(iommu));
-       iommu.priv = (void *)-1;
-       pdev->dev.iommu = &iommu;
+       /* HACK to disable iommu for the fake device; force identity mapping */
+       pdev->dev.iommu = &fake_iommu;
 #endif
 
        pci_set_drvdata(pdev, i915);
index 6776ebb3246d4d8c4f1ca1402a778e1e3d2c9183..8a4235d9d9f1e7bf622f286242c6d19798dfc211 100644 (file)
@@ -447,7 +447,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
                if (fb->pitches[1] != fb->pitches[2])
                        return -EINVAL;
 
-               /* fall-through */
+               fallthrough;
        case DRM_FORMAT_NV12:
        case DRM_FORMAT_NV16:
                ubo = drm_plane_state_to_ubo(state);
index ada990a7f911ad88fcbd61ca5d1bf5ada232f127..b7074161ccf038da9f0a93ac36fd2b472378f1f0 100644 (file)
@@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d)
        component_unbind_all(priv->dev, &priv->drm);
 }
 
-static int ingenic_drm_bind(struct device *dev)
+static int ingenic_drm_bind(struct device *dev, bool has_components)
 {
        struct platform_device *pdev = to_platform_device(dev);
        const struct jz_soc_info *soc_info;
@@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev)
                        return ret;
                }
 
-               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
+               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) {
                        ret = component_bind_all(dev, drm);
                        if (ret) {
                                if (ret != -EPROBE_DEFER)
@@ -939,6 +939,11 @@ err_pixclk_disable:
        return ret;
 }
 
+static int ingenic_drm_bind_with_components(struct device *dev)
+{
+       return ingenic_drm_bind(dev, true);
+}
+
 static int compare_of(struct device *dev, void *data)
 {
        return dev->of_node == data;
@@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device *dev)
 }
 
 static const struct component_master_ops ingenic_master_ops = {
-       .bind = ingenic_drm_bind,
+       .bind = ingenic_drm_bind_with_components,
        .unbind = ingenic_drm_unbind,
 };
 
@@ -968,16 +973,15 @@ static int ingenic_drm_probe(struct platform_device *pdev)
        struct device_node *np;
 
        if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
-               return ingenic_drm_bind(dev);
+               return ingenic_drm_bind(dev, false);
 
        /* IPU is at port address 8 */
        np = of_graph_get_remote_node(dev->of_node, 8, 0);
-       if (!np) {
-               dev_err(dev, "Unable to get IPU node\n");
-               return -EINVAL;
-       }
+       if (!np)
+               return ingenic_drm_bind(dev, false);
 
        drm_of_component_match_add(dev, &match, compare_of, np);
+       of_node_put(np);
 
        return component_master_add_with_match(dev, &ingenic_master_ops, match);
 }
index 3fc5511330b9fd9a3ccb869718c5afe146d633d9..4d29568be3f53ed88637efa83e6f386d312e5f1f 100644 (file)
@@ -831,13 +831,19 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
                        drm_crtc_index(&mtk_crtc->base));
                mtk_crtc->cmdq_client = NULL;
        }
-       ret = of_property_read_u32_index(priv->mutex_node,
-                                        "mediatek,gce-events",
-                                        drm_crtc_index(&mtk_crtc->base),
-                                        &mtk_crtc->cmdq_event);
-       if (ret)
-               dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n",
-                       drm_crtc_index(&mtk_crtc->base));
+
+       if (mtk_crtc->cmdq_client) {
+               ret = of_property_read_u32_index(priv->mutex_node,
+                                                "mediatek,gce-events",
+                                                drm_crtc_index(&mtk_crtc->base),
+                                                &mtk_crtc->cmdq_event);
+               if (ret) {
+                       dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n",
+                               drm_crtc_index(&mtk_crtc->base));
+                       cmdq_mbox_destroy(mtk_crtc->cmdq_client);
+                       mtk_crtc->cmdq_client = NULL;
+               }
+       }
 #endif
        return 0;
 }
index 57c88de9a3293447e70965c6628258f7c9f31e05..526648885b97efe57d260da08ac69d883083e8d7 100644 (file)
@@ -496,6 +496,7 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
 #if IS_REACHABLE(CONFIG_MTK_CMDQ)
        if (of_address_to_resource(node, 0, &res) != 0) {
                dev_err(dev, "Missing reg in %s node\n", node->full_name);
+               put_device(&larb_pdev->dev);
                return -EINVAL;
        }
        comp->regs_pa = res.start;
index 040a8f393fe24da31e6bcee0f6fe69c6668d6318..2d982740b1a4c5bde1d2be99c2aa495a5a1d949a 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "mtk_drm_crtc.h"
 #include "mtk_drm_ddp.h"
-#include "mtk_drm_ddp.h"
 #include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 #include "mtk_drm_gem.h"
@@ -165,7 +164,7 @@ static int mtk_drm_kms_init(struct drm_device *drm)
 
        ret = drmm_mode_config_init(drm);
        if (ret)
-               return ret;
+               goto put_mutex_dev;
 
        drm->mode_config.min_width = 64;
        drm->mode_config.min_height = 64;
@@ -182,7 +181,7 @@ static int mtk_drm_kms_init(struct drm_device *drm)
 
        ret = component_bind_all(drm->dev, drm);
        if (ret)
-               return ret;
+               goto put_mutex_dev;
 
        /*
         * We currently support two fixed data streams, each optional,
@@ -229,7 +228,7 @@ static int mtk_drm_kms_init(struct drm_device *drm)
        }
        if (!dma_dev->dma_parms) {
                ret = -ENOMEM;
-               goto err_component_unbind;
+               goto put_dma_dev;
        }
 
        ret = dma_set_max_seg_size(dma_dev, (unsigned int)DMA_BIT_MASK(32));
@@ -256,9 +255,12 @@ static int mtk_drm_kms_init(struct drm_device *drm)
 err_unset_dma_parms:
        if (private->dma_parms_allocated)
                dma_dev->dma_parms = NULL;
+put_dma_dev:
+       put_device(private->dma_dev);
 err_component_unbind:
        component_unbind_all(drm->dev, drm);
-
+put_mutex_dev:
+       put_device(private->mutex_dev);
        return ret;
 }
 
@@ -544,8 +546,13 @@ err_pm:
        pm_runtime_disable(dev);
 err_node:
        of_node_put(private->mutex_node);
-       for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
+       for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) {
                of_node_put(private->comp_node[i]);
+               if (private->ddp_comp[i]) {
+                       put_device(private->ddp_comp[i]->larb_dev);
+                       private->ddp_comp[i] = NULL;
+               }
+       }
        return ret;
 }
 
index 16fd99dcdacf8316ba598600c43578ae7120d42b..80b7a082e87404837272c42e1d965467aaa99235 100644 (file)
@@ -466,14 +466,13 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi)
        horizontal_sync_active_byte = (vm->hsync_len * dsi_tmp_buf_bpp - 10);
 
        if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
-               horizontal_backporch_byte =
-                       (vm->hback_porch * dsi_tmp_buf_bpp - 10);
+               horizontal_backporch_byte = vm->hback_porch * dsi_tmp_buf_bpp;
        else
-               horizontal_backporch_byte = ((vm->hback_porch + vm->hsync_len) *
-                       dsi_tmp_buf_bpp - 10);
+               horizontal_backporch_byte = (vm->hback_porch + vm->hsync_len) *
+                                           dsi_tmp_buf_bpp;
 
        data_phy_cycles = timing->lpx + timing->da_hs_prepare +
-                         timing->da_hs_zero + timing->da_hs_exit + 3;
+                         timing->da_hs_zero + timing->da_hs_exit;
 
        if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) {
                if ((vm->hfront_porch + vm->hback_porch) * dsi_tmp_buf_bpp >
index f2e9b429960b98954fa3540d43f842995c7f87bb..a97725680d4ea43e8d4b61ac6eb80071667a6e34 100644 (file)
@@ -1507,25 +1507,30 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
                dev_err(dev,
                        "Failed to get system configuration registers: %d\n",
                        ret);
-               return ret;
+               goto put_device;
        }
        hdmi->sys_regmap = regmap;
 
        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        hdmi->regs = devm_ioremap_resource(dev, mem);
-       if (IS_ERR(hdmi->regs))
-               return PTR_ERR(hdmi->regs);
+       if (IS_ERR(hdmi->regs)) {
+               ret = PTR_ERR(hdmi->regs);
+               goto put_device;
+       }
 
        remote = of_graph_get_remote_node(np, 1, 0);
-       if (!remote)
-               return -EINVAL;
+       if (!remote) {
+               ret = -EINVAL;
+               goto put_device;
+       }
 
        if (!of_device_is_compatible(remote, "hdmi-connector")) {
                hdmi->next_bridge = of_drm_find_bridge(remote);
                if (!hdmi->next_bridge) {
                        dev_err(dev, "Waiting for external bridge\n");
                        of_node_put(remote);
-                       return -EPROBE_DEFER;
+                       ret = -EPROBE_DEFER;
+                       goto put_device;
                }
        }
 
@@ -1534,7 +1539,8 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
                dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n",
                        remote);
                of_node_put(remote);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto put_device;
        }
        of_node_put(remote);
 
@@ -1542,10 +1548,14 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
        of_node_put(i2c_np);
        if (!hdmi->ddc_adpt) {
                dev_err(dev, "Failed to get ddc i2c adapter by node\n");
-               return -EINVAL;
+               ret = -EINVAL;
+               goto put_device;
        }
 
        return 0;
+put_device:
+       put_device(hdmi->cec_dev);
+       return ret;
 }
 
 /*
index f12e0271f16655fae972a331c7e7fdd9eb6c59e8..ffc6b584dbf85d82b778b37ebc3b0a069063ea08 100644 (file)
@@ -205,7 +205,7 @@ static int meson_g12a_afbcd_pixel_fmt(u64 modifier, uint32_t format)
                /* YTR is forbidden for non XBGR formats */
                if (modifier & AFBC_FORMAT_MOD_YTR)
                        return -EINVAL;
-       /* fall through */
+               fallthrough;
        case DRM_FORMAT_XBGR8888:
        case DRM_FORMAT_ABGR8888:
                return MAFBC_FMT_RGBA8888;
index a8bcc70644dff5878d132c70137b74c78c3d1348..1ffbbecafa22ba9532f7ab5a77f11084ae8b73ad 100644 (file)
@@ -654,7 +654,7 @@ static void meson_overlay_atomic_update(struct drm_plane *plane,
                         priv->viu.vd1_addr2,
                         priv->viu.vd1_stride2,
                         priv->viu.vd1_height2);
-       /* fallthrough */
+               fallthrough;
        case 2:
                gem = drm_fb_cma_get_gem_obj(fb, 1);
                priv->viu.vd1_addr1 = gem->paddr + fb->offsets[1];
@@ -666,7 +666,7 @@ static void meson_overlay_atomic_update(struct drm_plane *plane,
                         priv->viu.vd1_addr1,
                         priv->viu.vd1_stride1,
                         priv->viu.vd1_height1);
-       /* fallthrough */
+               fallthrough;
        case 1:
                gem = drm_fb_cma_get_gem_obj(fb, 0);
                priv->viu.vd1_addr0 = gem->paddr + fb->offsets[0];
index 6021f8d9efd1fbb0230ee921da3a9cdac3095ef1..48fa49f69d6d0a2180afecdcd7327de5344b398e 100644 (file)
@@ -164,6 +164,11 @@ static int a2xx_hw_init(struct msm_gpu *gpu)
        if (ret)
                return ret;
 
+       gpu_write(gpu, REG_AXXX_CP_RB_CNTL,
+               MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
+
+       gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova));
+
        /* NOTE: PM4/micro-engine firmware registers look to be the same
         * for a2xx and a3xx.. we could possibly push that part down to
         * adreno_gpu base class.  Or push both PM4 and PFP but
index 0a5ea9f56cb886aba890fffe00c414942cf15a4b..f6471145a7a607db4984242fdee8aa1d2e5332fc 100644 (file)
@@ -211,6 +211,16 @@ static int a3xx_hw_init(struct msm_gpu *gpu)
        if (ret)
                return ret;
 
+       /*
+        * Use the default ringbuffer size and block size but disable the RPTR
+        * shadow
+        */
+       gpu_write(gpu, REG_AXXX_CP_RB_CNTL,
+               MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
+
+       /* Set the ringbuffer address */
+       gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova));
+
        /* setup access protection: */
        gpu_write(gpu, REG_A3XX_CP_PROTECT_CTRL, 0x00000007);
 
index b9b26b2bf9c548d38b81347fb745d811ccf20db4..9547536006254721ed1e0f9963830c0f3867a276 100644 (file)
@@ -267,6 +267,16 @@ static int a4xx_hw_init(struct msm_gpu *gpu)
        if (ret)
                return ret;
 
+       /*
+        * Use the default ringbuffer size and block size but disable the RPTR
+        * shadow
+        */
+       gpu_write(gpu, REG_A4XX_CP_RB_CNTL,
+               MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
+
+       /* Set the ringbuffer address */
+       gpu_write(gpu, REG_A4XX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova));
+
        /* Load PM4: */
        ptr = (uint32_t *)(adreno_gpu->fw[ADRENO_FW_PM4]->data);
        len = adreno_gpu->fw[ADRENO_FW_PM4]->size / 4;
index 9e63a190642cc490d25e8b55e7fbb738d39311ab..91726da82ed67a28634c2044975b0852fc5212b3 100644 (file)
@@ -59,7 +59,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
                case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
                        if (priv->lastctx == ctx)
                                break;
-                       /* fall-thru */
+                       fallthrough;
                case MSM_SUBMIT_CMD_BUF:
                        /* copy commands into RB: */
                        obj = submit->bos[submit->cmd[i].idx].obj;
@@ -150,7 +150,7 @@ static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
                case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
                        if (priv->lastctx == ctx)
                                break;
-                       /* fall-thru */
+                       fallthrough;
                case MSM_SUBMIT_CMD_BUF:
                        OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3);
                        OUT_RING(ring, lower_32_bits(submit->cmd[i].iova));
@@ -703,8 +703,6 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
        if (ret)
                return ret;
 
-       a5xx_preempt_hw_init(gpu);
-
        if (!adreno_is_a510(adreno_gpu))
                a5xx_gpmu_ucode_init(gpu);
 
@@ -712,6 +710,15 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
        if (ret)
                return ret;
 
+       /* Set the ringbuffer address */
+       gpu_write64(gpu, REG_A5XX_CP_RB_BASE, REG_A5XX_CP_RB_BASE_HI,
+               gpu->rb[0]->iova);
+
+       gpu_write(gpu, REG_A5XX_CP_RB_CNTL,
+               MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
+
+       a5xx_preempt_hw_init(gpu);
+
        /* Disable the interrupts through the initial bringup stage */
        gpu_write(gpu, REG_A5XX_RBBM_INT_0_MASK, A5XX_INT_MASK);
 
@@ -1511,7 +1518,8 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
 
        check_speed_bin(&pdev->dev);
 
-       ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 4);
+       /* Restricting nr_rings to 1 to temporarily disable preemption */
+       ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1);
        if (ret) {
                a5xx_destroy(&(a5xx_gpu->base.base));
                return ERR_PTR(ret);
index 54868d4e3958f318dc67dd48506c04a41969a49e..1e5b1a15a70f02e80c4ea3c981ff555c877d2b2b 100644 (file)
@@ -31,6 +31,7 @@ struct a5xx_gpu {
        struct msm_ringbuffer *next_ring;
 
        struct drm_gem_object *preempt_bo[MSM_GPU_MAX_RINGS];
+       struct drm_gem_object *preempt_counters_bo[MSM_GPU_MAX_RINGS];
        struct a5xx_preempt_record *preempt[MSM_GPU_MAX_RINGS];
        uint64_t preempt_iova[MSM_GPU_MAX_RINGS];
 
index 9cf9353a7ff11334a04f1ca229ebc7d2a7976328..9f3fe177b00e935ec908fe80ea28f95cf1d27753 100644 (file)
@@ -226,19 +226,31 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu,
        struct adreno_gpu *adreno_gpu = &a5xx_gpu->base;
        struct msm_gpu *gpu = &adreno_gpu->base;
        struct a5xx_preempt_record *ptr;
-       struct drm_gem_object *bo = NULL;
-       u64 iova = 0;
+       void *counters;
+       struct drm_gem_object *bo = NULL, *counters_bo = NULL;
+       u64 iova = 0, counters_iova = 0;
 
        ptr = msm_gem_kernel_new(gpu->dev,
                A5XX_PREEMPT_RECORD_SIZE + A5XX_PREEMPT_COUNTER_SIZE,
-               MSM_BO_UNCACHED, gpu->aspace, &bo, &iova);
+               MSM_BO_UNCACHED | MSM_BO_MAP_PRIV, gpu->aspace, &bo, &iova);
 
        if (IS_ERR(ptr))
                return PTR_ERR(ptr);
 
+       /* The buffer to store counters needs to be unprivileged */
+       counters = msm_gem_kernel_new(gpu->dev,
+               A5XX_PREEMPT_COUNTER_SIZE,
+               MSM_BO_UNCACHED, gpu->aspace, &counters_bo, &counters_iova);
+       if (IS_ERR(counters)) {
+               msm_gem_kernel_put(bo, gpu->aspace, true);
+               return PTR_ERR(counters);
+       }
+
        msm_gem_object_set_name(bo, "preempt");
+       msm_gem_object_set_name(counters_bo, "preempt_counters");
 
        a5xx_gpu->preempt_bo[ring->id] = bo;
+       a5xx_gpu->preempt_counters_bo[ring->id] = counters_bo;
        a5xx_gpu->preempt_iova[ring->id] = iova;
        a5xx_gpu->preempt[ring->id] = ptr;
 
@@ -249,7 +261,7 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu,
        ptr->data = 0;
        ptr->cntl = MSM_GPU_RB_CNTL_DEFAULT;
        ptr->rptr_addr = rbmemptr(ring, rptr);
-       ptr->counter = iova + A5XX_PREEMPT_RECORD_SIZE;
+       ptr->counter = counters_iova;
 
        return 0;
 }
@@ -260,8 +272,11 @@ void a5xx_preempt_fini(struct msm_gpu *gpu)
        struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu);
        int i;
 
-       for (i = 0; i < gpu->nr_rings; i++)
+       for (i = 0; i < gpu->nr_rings; i++) {
                msm_gem_kernel_put(a5xx_gpu->preempt_bo[i], gpu->aspace, true);
+               msm_gem_kernel_put(a5xx_gpu->preempt_counters_bo[i],
+                       gpu->aspace, true);
+       }
 }
 
 void a5xx_preempt_init(struct msm_gpu *gpu)
index b67b38c8fadf73a6834acf77e2a0ae1baf8dc74d..e1c7bcd1b1eb7bcdaec33785a5eb0b33f57e4142 100644 (file)
@@ -133,7 +133,7 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp)
 
        if (!gmu->legacy) {
                a6xx_hfi_set_freq(gmu, perf_index);
-               icc_set_bw(gpu->icc_path, 0, MBps_to_icc(7216));
+               dev_pm_opp_set_bw(&gpu->pdev->dev, opp);
                pm_runtime_put(gmu->dev);
                return;
        }
@@ -157,11 +157,7 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp)
        if (ret)
                dev_err(gmu->dev, "GMU set GPU frequency error: %d\n", ret);
 
-       /*
-        * Eventually we will want to scale the path vote with the frequency but
-        * for now leave it at max so that the performance is nominal.
-        */
-       icc_set_bw(gpu->icc_path, 0, MBps_to_icc(7216));
+       dev_pm_opp_set_bw(&gpu->pdev->dev, opp);
        pm_runtime_put(gmu->dev);
 }
 
@@ -204,6 +200,16 @@ static int a6xx_gmu_start(struct a6xx_gmu *gmu)
 {
        int ret;
        u32 val;
+       u32 mask, reset_val;
+
+       val = gmu_read(gmu, REG_A6XX_GMU_CM3_DTCM_START + 0xff8);
+       if (val <= 0x20010004) {
+               mask = 0xffffffff;
+               reset_val = 0xbabeface;
+       } else {
+               mask = 0x1ff;
+               reset_val = 0x100;
+       }
 
        gmu_write(gmu, REG_A6XX_GMU_CM3_SYSRESET, 1);
 
@@ -215,7 +221,7 @@ static int a6xx_gmu_start(struct a6xx_gmu *gmu)
        gmu_write(gmu, REG_A6XX_GMU_CM3_SYSRESET, 0);
 
        ret = gmu_poll_timeout(gmu, REG_A6XX_GMU_CM3_FW_INIT_RESULT, val,
-               val == 0xbabeface, 100, 10000);
+               (val & mask) == reset_val, 100, 10000);
 
        if (ret)
                DRM_DEV_ERROR(gmu->dev, "GMU firmware initialization timed out\n");
@@ -602,7 +608,7 @@ static void a6xx_gmu_power_config(struct a6xx_gmu *gmu)
                gmu_rmw(gmu, REG_A6XX_GMU_PWR_COL_INTER_FRAME_CTRL, 0,
                        A6XX_GMU_PWR_COL_INTER_FRAME_CTRL_IFPC_ENABLE |
                        A6XX_GMU_PWR_COL_INTER_FRAME_CTRL_HM_POWER_COLLAPSE_ENABLE);
-               /* Fall through */
+               fallthrough;
        case GMU_IDLE_STATE_SPTP:
                gmu_write(gmu, REG_A6XX_GMU_PWR_COL_SPTPRAC_HYST,
                        GMU_PWR_COL_HYST);
@@ -845,10 +851,24 @@ static void a6xx_gmu_set_initial_freq(struct msm_gpu *gpu, struct a6xx_gmu *gmu)
        if (IS_ERR_OR_NULL(gpu_opp))
                return;
 
+       gmu->freq = 0; /* so a6xx_gmu_set_freq() doesn't exit early */
        a6xx_gmu_set_freq(gpu, gpu_opp);
        dev_pm_opp_put(gpu_opp);
 }
 
+static void a6xx_gmu_set_initial_bw(struct msm_gpu *gpu, struct a6xx_gmu *gmu)
+{
+       struct dev_pm_opp *gpu_opp;
+       unsigned long gpu_freq = gmu->gpu_freqs[gmu->current_perf_index];
+
+       gpu_opp = dev_pm_opp_find_freq_exact(&gpu->pdev->dev, gpu_freq, true);
+       if (IS_ERR_OR_NULL(gpu_opp))
+               return;
+
+       dev_pm_opp_set_bw(&gpu->pdev->dev, gpu_opp);
+       dev_pm_opp_put(gpu_opp);
+}
+
 int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 {
        struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
@@ -882,7 +902,7 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
        }
 
        /* Set the bus quota to a reasonable value for boot */
-       icc_set_bw(gpu->icc_path, 0, MBps_to_icc(3072));
+       a6xx_gmu_set_initial_bw(gpu, gmu);
 
        /* Enable the GMU interrupt */
        gmu_write(gmu, REG_A6XX_GMU_AO_HOST_INTERRUPT_CLR, ~0);
@@ -1051,7 +1071,7 @@ int a6xx_gmu_stop(struct a6xx_gpu *a6xx_gpu)
                a6xx_gmu_shutdown(gmu);
 
        /* Remove the bus vote */
-       icc_set_bw(gpu->icc_path, 0, 0);
+       dev_pm_opp_set_bw(&gpu->pdev->dev, NULL);
 
        /*
         * Make sure the GX domain is off before turning off the GMU (CX)
index c5a3e4d4c0078527225e6263b6ebbe06f0e162b4..66a95e22b7b3d523b5dca63bfc12595707b98c4d 100644 (file)
@@ -117,7 +117,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
                case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
                        if (priv->lastctx == ctx)
                                break;
-                       /* fall-thru */
+                       fallthrough;
                case MSM_SUBMIT_CMD_BUF:
                        OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3);
                        OUT_RING(ring, lower_32_bits(submit->cmd[i].iova));
@@ -678,7 +678,8 @@ static int a6xx_hw_init(struct msm_gpu *gpu)
                        A6XX_PROTECT_RDONLY(0x980, 0x4));
        gpu_write(gpu, REG_A6XX_CP_PROTECT(25), A6XX_PROTECT_RW(0xa630, 0x0));
 
-       if (adreno_is_a650(adreno_gpu)) {
+       /* Enable expanded apriv for targets that support it */
+       if (gpu->hw_apriv) {
                gpu_write(gpu, REG_A6XX_CP_APRIV_CNTL,
                        (1 << 6) | (1 << 5) | (1 << 3) | (1 << 2) | (1 << 1));
        }
@@ -694,6 +695,13 @@ static int a6xx_hw_init(struct msm_gpu *gpu)
        if (ret)
                goto out;
 
+       /* Set the ringbuffer address */
+       gpu_write64(gpu, REG_A6XX_CP_RB_BASE, REG_A6XX_CP_RB_BASE_HI,
+               gpu->rb[0]->iova);
+
+       gpu_write(gpu, REG_A6XX_CP_RB_CNTL,
+               MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
+
        /* Always come up on rb 0 */
        a6xx_gpu->cur_ring = gpu->rb[0];
 
@@ -1056,6 +1064,9 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
        adreno_gpu->registers = NULL;
        adreno_gpu->reg_offsets = a6xx_register_offsets;
 
+       if (adreno_is_a650(adreno_gpu))
+               adreno_gpu->base.hw_apriv = true;
+
        ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1);
        if (ret) {
                a6xx_destroy(&(a6xx_gpu->base.base));
index 959656ad69871b95e8438cdb5dd2d6c83d364b4e..b12f5b4a1bea9109545b2c700b26df72577c87eb 100644 (file)
@@ -938,7 +938,8 @@ struct msm_gpu_state *a6xx_gpu_state_get(struct msm_gpu *gpu)
                msm_gem_kernel_put(dumper.bo, gpu->aspace, true);
        }
 
-       a6xx_get_debugbus(gpu, a6xx_state);
+       if (snapshot_debugbus)
+               a6xx_get_debugbus(gpu, a6xx_state);
 
        return  &a6xx_state->base;
 }
index 846fd5b54c2302b55210b47c9a7323600ad6463d..2fb58b7098e4befe3623cb9381c231da6e9c4ee8 100644 (file)
@@ -372,7 +372,7 @@ static const struct a6xx_indexed_registers {
        u32 data;
        u32 count;
 } a6xx_indexed_reglist[] = {
-       { "CP_SEQ_STAT", REG_A6XX_CP_SQE_STAT_ADDR,
+       { "CP_SQE_STAT", REG_A6XX_CP_SQE_STAT_ADDR,
                REG_A6XX_CP_SQE_STAT_DATA, 0x33 },
        { "CP_DRAW_STATE", REG_A6XX_CP_DRAW_STATE_ADDR,
                REG_A6XX_CP_DRAW_STATE_DATA, 0x100 },
index 4e84f3c76f4f5e2de84d4d076da724e5c65fa31a..9eeb46bf2a5dccb3784ad14a7832713402e9e953 100644 (file)
@@ -14,6 +14,10 @@ bool hang_debug = false;
 MODULE_PARM_DESC(hang_debug, "Dump registers when hang is detected (can be slow!)");
 module_param_named(hang_debug, hang_debug, bool, 0600);
 
+bool snapshot_debugbus = false;
+MODULE_PARM_DESC(snapshot_debugbus, "Include debugbus sections in GPU devcoredump (if not fused off)");
+module_param_named(snapshot_debugbus, snapshot_debugbus, bool, 0600);
+
 static const struct adreno_info gpulist[] = {
        {
                .rev   = ADRENO_REV(2, 0, 0, 0),
index e23641a5ec841c9ad997052c207b3739428b4177..862dd35b27d3dcc7451c883465ff9445bf7c36ce 100644 (file)
@@ -396,30 +396,10 @@ int adreno_hw_init(struct msm_gpu *gpu)
                ring->next = ring->start;
 
                /* reset completed fence seqno: */
-               ring->memptrs->fence = ring->seqno;
+               ring->memptrs->fence = ring->fctx->completed_fence;
                ring->memptrs->rptr = 0;
        }
 
-       /*
-        * Setup REG_CP_RB_CNTL.  The same value is used across targets (with
-        * the excpetion of A430 that disables the RPTR shadow) - the cacluation
-        * for the ringbuffer size and block size is moved to msm_gpu.h for the
-        * pre-processor to deal with and the A430 variant is ORed in here
-        */
-       adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_CNTL,
-               MSM_GPU_RB_CNTL_DEFAULT |
-               (adreno_is_a430(adreno_gpu) ? AXXX_CP_RB_CNTL_NO_UPDATE : 0));
-
-       /* Setup ringbuffer address - use ringbuffer[0] for GPU init */
-       adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_BASE,
-               REG_ADRENO_CP_RB_BASE_HI, gpu->rb[0]->iova);
-
-       if (!adreno_is_a430(adreno_gpu)) {
-               adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_RPTR_ADDR,
-                       REG_ADRENO_CP_RB_RPTR_ADDR_HI,
-                       rbmemptr(gpu->rb[0], rptr));
-       }
-
        return 0;
 }
 
@@ -427,11 +407,8 @@ int adreno_hw_init(struct msm_gpu *gpu)
 static uint32_t get_rptr(struct adreno_gpu *adreno_gpu,
                struct msm_ringbuffer *ring)
 {
-       if (adreno_is_a430(adreno_gpu))
-               return ring->memptrs->rptr = adreno_gpu_read(
-                       adreno_gpu, REG_ADRENO_CP_RB_RPTR);
-       else
-               return ring->memptrs->rptr;
+       return ring->memptrs->rptr = adreno_gpu_read(
+               adreno_gpu, REG_ADRENO_CP_RB_RPTR);
 }
 
 struct msm_ringbuffer *adreno_active_ring(struct msm_gpu *gpu)
@@ -474,7 +451,7 @@ void adreno_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
                        /* ignore if there has not been a ctx switch: */
                        if (priv->lastctx == ctx)
                                break;
-                       /* fall-thru */
+                       fallthrough;
                case MSM_SUBMIT_CMD_BUF:
                        OUT_PKT3(ring, adreno_is_a4xx(adreno_gpu) ?
                                CP_INDIRECT_BUFFER_PFE : CP_INDIRECT_BUFFER_PFD, 2);
index 99bb468f5f245ef4f0b2473d56628e2daed4b4bc..e55abae365b5a3e0b7cc1c7cbab7da0b5ae5dc2b 100644 (file)
@@ -21,6 +21,8 @@
 #define REG_SKIP ~0
 #define REG_ADRENO_SKIP(_offset) [_offset] = REG_SKIP
 
+extern bool snapshot_debugbus;
+
 /**
  * adreno_regs: List of registers that are used in across all
  * 3D devices. Each device type has different offset value for the same
index f272a8d0f95b20f26bfb39781b0f65b7b092ef36..c2729f71e2fa7386c38170fab8edf81a0bef5606 100644 (file)
@@ -827,7 +827,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
 {
        struct dpu_crtc *dpu_crtc;
        struct drm_encoder *encoder;
-       bool request_bandwidth;
+       bool request_bandwidth = false;
 
        if (!crtc) {
                DPU_ERROR("invalid crtc\n");
index a97f6d2e5a089c925ce7abb6362c77effb02051d..bd6def436c657961fe880ddae0b5602a8c3de373 100644 (file)
@@ -599,7 +599,10 @@ static int dpu_encoder_virt_atomic_check(
        dpu_kms = to_dpu_kms(priv->kms);
        mode = &crtc_state->mode;
        adj_mode = &crtc_state->adjusted_mode;
-       global_state = dpu_kms_get_existing_global_state(dpu_kms);
+       global_state = dpu_kms_get_global_state(crtc_state->state);
+       if (IS_ERR(global_state))
+               return PTR_ERR(global_state);
+
        trace_dpu_enc_atomic_check(DRMID(drm_enc));
 
        /* perform atomic check on the first physical encoder (master) */
@@ -625,12 +628,15 @@ static int dpu_encoder_virt_atomic_check(
        /* Reserve dynamic resources now. */
        if (!ret) {
                /*
-                * Avoid reserving resources when mode set is pending. Topology
-                * info may not be available to complete reservation.
+                * Release and Allocate resources on every modeset
+                * Dont allocate when active is false.
                 */
                if (drm_atomic_crtc_needs_modeset(crtc_state)) {
-                       ret = dpu_rm_reserve(&dpu_kms->rm, global_state,
-                                       drm_enc, crtc_state, topology);
+                       dpu_rm_release(global_state, drm_enc);
+
+                       if (!crtc_state->active_changed || crtc_state->active)
+                               ret = dpu_rm_reserve(&dpu_kms->rm, global_state,
+                                               drm_enc, crtc_state, topology);
                }
        }
 
@@ -1181,7 +1187,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
        struct dpu_encoder_virt *dpu_enc = NULL;
        struct msm_drm_private *priv;
        struct dpu_kms *dpu_kms;
-       struct dpu_global_state *global_state;
        int i = 0;
 
        if (!drm_enc) {
@@ -1200,7 +1205,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
 
        priv = drm_enc->dev->dev_private;
        dpu_kms = to_dpu_kms(priv->kms);
-       global_state = dpu_kms_get_existing_global_state(dpu_kms);
 
        trace_dpu_enc_disable(DRMID(drm_enc));
 
@@ -1230,8 +1234,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
 
        DPU_DEBUG_ENC(dpu_enc, "encoder disabled\n");
 
-       dpu_rm_release(global_state, drm_enc);
-
        mutex_unlock(&dpu_enc->enc_lock);
 }
 
index 33f6c56f01edac0172b6964b4f778e1bf872b762..29e373d2e7b5dcb08c36ae41e0d615108ccf6ea4 100644 (file)
@@ -866,9 +866,9 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
                crtc_state = drm_atomic_get_new_crtc_state(state->state,
                                                           state->crtc);
 
-       min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxdwnscale);
+       min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxupscale);
        ret = drm_atomic_helper_check_plane_state(state, crtc_state, min_scale,
-                                         pdpu->pipe_sblk->maxupscale << 16,
+                                         pdpu->pipe_sblk->maxdwnscale << 16,
                                          true, true);
        if (ret) {
                DPU_DEBUG_PLANE(pdpu, "Check plane state failed (%d)\n", ret);
index 5ccfad794c6a5b9551158f669ecbc01393a0a1bd..561bfa48841c33ced37e2b0a032f146acd4f6641 100644 (file)
@@ -27,6 +27,34 @@ int msm_atomic_prepare_fb(struct drm_plane *plane,
        return msm_framebuffer_prepare(new_state->fb, kms->aspace);
 }
 
+/*
+ * Helpers to control vblanks while we flush.. basically just to ensure
+ * that vblank accounting is switched on, so we get valid seqn/timestamp
+ * on pageflip events (if requested)
+ */
+
+static void vblank_get(struct msm_kms *kms, unsigned crtc_mask)
+{
+       struct drm_crtc *crtc;
+
+       for_each_crtc_mask(kms->dev, crtc, crtc_mask) {
+               if (!crtc->state->active)
+                       continue;
+               drm_crtc_vblank_get(crtc);
+       }
+}
+
+static void vblank_put(struct msm_kms *kms, unsigned crtc_mask)
+{
+       struct drm_crtc *crtc;
+
+       for_each_crtc_mask(kms->dev, crtc, crtc_mask) {
+               if (!crtc->state->active)
+                       continue;
+               drm_crtc_vblank_put(crtc);
+       }
+}
+
 static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)
 {
        unsigned crtc_mask = BIT(crtc_idx);
@@ -44,6 +72,8 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)
 
        kms->funcs->enable_commit(kms);
 
+       vblank_get(kms, crtc_mask);
+
        /*
         * Flush hardware updates:
         */
@@ -58,6 +88,8 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)
        kms->funcs->wait_flush(kms, crtc_mask);
        trace_msm_atomic_wait_flush_finish(crtc_mask);
 
+       vblank_put(kms, crtc_mask);
+
        mutex_lock(&kms->commit_lock);
        kms->funcs->complete_commit(kms, crtc_mask);
        mutex_unlock(&kms->commit_lock);
@@ -221,6 +253,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
         */
        kms->pending_crtc_mask &= ~crtc_mask;
 
+       vblank_get(kms, crtc_mask);
+
        /*
         * Flush hardware updates:
         */
@@ -235,6 +269,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
        kms->funcs->wait_flush(kms, crtc_mask);
        trace_msm_atomic_wait_flush_finish(crtc_mask);
 
+       vblank_put(kms, crtc_mask);
+
        mutex_lock(&kms->commit_lock);
        kms->funcs->complete_commit(kms, crtc_mask);
        mutex_unlock(&kms->commit_lock);
index 7d641c7e3514a7b653a29cece75896c800ca6417..79333842f70a1ff574d8e47137f7bf1af91cbcd3 100644 (file)
@@ -1320,6 +1320,13 @@ static int msm_pdev_remove(struct platform_device *pdev)
        return 0;
 }
 
+static void msm_pdev_shutdown(struct platform_device *pdev)
+{
+       struct drm_device *drm = platform_get_drvdata(pdev);
+
+       drm_atomic_helper_shutdown(drm);
+}
+
 static const struct of_device_id dt_match[] = {
        { .compatible = "qcom,mdp4", .data = (void *)KMS_MDP4 },
        { .compatible = "qcom,mdss", .data = (void *)KMS_MDP5 },
@@ -1332,6 +1339,7 @@ MODULE_DEVICE_TABLE(of, dt_match);
 static struct platform_driver msm_platform_driver = {
        .probe      = msm_pdev_probe,
        .remove     = msm_pdev_remove,
+       .shutdown   = msm_pdev_shutdown,
        .driver     = {
                .name   = "msm",
                .of_match_table = dt_match,
index d5645472b25da4a1f445ea2316f5c35ac0f01201..57ddc9438351e994eed19b4ad9d3f8cb9a6dd825 100644 (file)
@@ -908,7 +908,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
 
        memptrs = msm_gem_kernel_new(drm,
                sizeof(struct msm_rbmemptrs) * nr_rings,
-               MSM_BO_UNCACHED, gpu->aspace, &gpu->memptrs_bo,
+               check_apriv(gpu, MSM_BO_UNCACHED), gpu->aspace, &gpu->memptrs_bo,
                &memptrs_iova);
 
        if (IS_ERR(memptrs)) {
index 0db117a7339b6959a979a31ccbd4f2b3b0adcc9f..37cffac4cbe3428fbd91c2700d8ea957c328db81 100644 (file)
@@ -15,6 +15,7 @@
 #include "msm_drv.h"
 #include "msm_fence.h"
 #include "msm_ringbuffer.h"
+#include "msm_gem.h"
 
 struct msm_gem_submit;
 struct msm_gpu_perfcntr;
@@ -139,6 +140,8 @@ struct msm_gpu {
        } devfreq;
 
        struct msm_gpu_state *crashstate;
+       /* True if the hardware supports expanded apriv (a650 and newer) */
+       bool hw_apriv;
 };
 
 /* It turns out that all targets use the same ringbuffer size */
@@ -327,4 +330,12 @@ static inline void msm_gpu_crashstate_put(struct msm_gpu *gpu)
        mutex_unlock(&gpu->dev->struct_mutex);
 }
 
+/*
+ * Simple macro to semi-cleanly add the MAP_PRIV flag for targets that can
+ * support expanded privileges
+ */
+#define check_apriv(gpu, flags) \
+       (((gpu)->hw_apriv ? MSM_BO_MAP_PRIV : 0) | (flags))
+
+
 #endif /* __MSM_GPU_H__ */
index e397c44cc01120e6e1829942696a02ddb3a8e28a..935bf9b1d94188cba556a0e5dfca389ba008f126 100644 (file)
@@ -27,7 +27,8 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
        ring->id = id;
 
        ring->start = msm_gem_kernel_new(gpu->dev, MSM_GPU_RINGBUFFER_SZ,
-               MSM_BO_WC, gpu->aspace, &ring->bo, &ring->iova);
+               check_apriv(gpu, MSM_BO_WC | MSM_BO_GPU_READONLY),
+               gpu->aspace, &ring->bo, &ring->iova);
 
        if (IS_ERR(ring->start)) {
                ret = PTR_ERR(ring->start);
index ad1f09a143aa48711470a8da2ef7c630755996a2..248edf69e1683170f2bab46941e4b539d79fa6a4 100644 (file)
@@ -50,7 +50,10 @@ core507d_update(struct nv50_core *core, u32 *interlock, bool ntfy)
                                        interlock[NV50_DISP_INTERLOCK_OVLY] |
                  NVDEF(NV507D, UPDATE, NOT_DRIVER_FRIENDLY, FALSE) |
                  NVDEF(NV507D, UPDATE, NOT_DRIVER_UNFRIENDLY, FALSE) |
-                 NVDEF(NV507D, UPDATE, INHIBIT_INTERRUPTS, FALSE));
+                 NVDEF(NV507D, UPDATE, INHIBIT_INTERRUPTS, FALSE),
+
+                               SET_NOTIFIER_CONTROL,
+                 NVDEF(NV507D, SET_NOTIFIER_CONTROL, NOTIFY, DISABLE));
 
        return PUSH_KICK(push);
 }
index 9afe9a87bde0c6963caa0d916ee48c0fc7aef0b7..814e5bd97446026fa2e663b6427426b014b69729 100644 (file)
@@ -6,7 +6,7 @@
 #include "disp.h"
 #include "head.h"
 
-#include <nvif/push507c.h>
+#include <nvif/pushc37b.h>
 
 #include <nvhw/class/clc37d.h>
 
index e7874877da8583a07983816825e8b5257ef7dbea..1ed24207000119291e1edf0e71a140c453082708 100644 (file)
@@ -257,6 +257,12 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp,
        dmac->push->end = dmac->push->bgn;
        dmac->max = 0x1000/4 - 1;
 
+       /* EVO channels are affected by a HW bug where the last 12 DWORDs
+        * of the push buffer aren't able to be used safely.
+        */
+       if (disp->oclass < GV100_DISP)
+               dmac->max -= 12;
+
        args->pushbuf = nvif_handle(&dmac->_push.mem.object);
 
        ret = nv50_chan_create(device, disp, oclass, head, data, size,
index 889467f13fd9c71c0dd8145faf7770113d509966..7917bead4845de6795c117016896dd5bb74edc7d 100644 (file)
@@ -20,6 +20,6 @@
         PUSH_ASSERT(!((o) & ~DRF_SMASK(NV507C_DMA_JUMP_OFFSET)), "offset"); \
        PUSH_DATA__((p), NVDEF(NV507C, DMA, OPCODE, JUMP) |                 \
                         NVVAL(NV507C, DMA, JUMP_OFFSET, (o) >> 2),         \
-                   "jump 0x%08x - %s", (u32)(o), __func__);                \
+                   " jump 0x%08x - %s", (u32)(o), __func__);               \
 } while(0)
 #endif
index e0817934ee163479521226ab22e476660d6d4fe5..bd12eae0cb31424a153bcab85f9d785e1fedeab0 100644 (file)
@@ -597,7 +597,7 @@ static void venc_bridge_mode_set(struct drm_bridge *bridge,
        switch (venc_mode) {
        default:
                WARN_ON_ONCE(1);
-               /* Fall-through */
+               fallthrough;
        case VENC_MODE_PAL:
                venc->config = &venc_config_pal_trm;
                break;
index 6d40914675dade9dddfee9f634907cc79e84fb41..328a4a74f534e0685babecfac49a3ee312d5fa12 100644 (file)
@@ -451,11 +451,12 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc,
        if (omap_state->manually_updated)
                return;
 
-       spin_lock_irq(&crtc->dev->event_lock);
        drm_crtc_vblank_on(crtc);
+
        ret = drm_crtc_vblank_get(crtc);
        WARN_ON(ret != 0);
 
+       spin_lock_irq(&crtc->dev->event_lock);
        omap_crtc_arm_event(crtc);
        spin_unlock_irq(&crtc->dev->event_lock);
 }
index ba20c6f037198c2a41894481a19cd815b9d9a48c..886e9959496fe51f373a62f7ba580a662e635b4e 100644 (file)
@@ -4856,7 +4856,7 @@ static void ci_request_link_speed_change_before_state_change(struct radeon_devic
                        pi->force_pcie_gen = RADEON_PCIE_GEN2;
                        if (current_link_speed == RADEON_PCIE_GEN2)
                                break;
-                       /* fall through */
+                       fallthrough;
                case RADEON_PCIE_GEN2:
                        if (radeon_acpi_pcie_performance_request(rdev, PCIE_PERF_REQ_PECI_GEN2, false) == 0)
                                break;
index 3b7ead5be5bfe1230df6a078c0f92e42615e6d99..73f67bf222e1648894f58224f1f72b6a2dc4016c 100644 (file)
@@ -820,7 +820,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                                          ((idx_value >> 21) & 0xF));
                                return -EINVAL;
                        }
-                       /* Fall through. */
+                       fallthrough;
                case 6:
                        track->cb[i].cpp = 4;
                        break;
@@ -971,7 +971,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
                                return -EINVAL;
                        }
                        /* The same rules apply as for DXT3/5. */
-                       /* Fall through. */
+                       fallthrough;
                case R300_TX_FORMAT_DXT3:
                case R300_TX_FORMAT_DXT5:
                        track->textures[i].cpp = 1;
index 1d4c04e0a44949bf4f33178fc2626d57d747f915..50b89b6d9a6ce628411c8c8658fe7ba1bf5b9d5a 100644 (file)
@@ -115,7 +115,7 @@ void r420_pipes_init(struct radeon_device *rdev)
        default:
                /* force to 1 pipe */
                num_pipes = 1;
-               /* fall through */
+               fallthrough;
        case 1:
                tmp = (0 << 1);
                break;
index 49e8266461f85222fc0550c60547127e0fe38fbd..390a9621604ae0f08e032fd9ef6849a2ca58e681 100644 (file)
@@ -487,7 +487,7 @@ static int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)
                                return -EINVAL;
                        }
                }
-               /* fall through */
+               fallthrough;
        case V_0280A0_CLEAR_ENABLE:
        {
                uint32_t block_max = G_028100_CMASK_BLOCK_MAX(track->cb_color_mask[i]);
@@ -1535,7 +1535,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p,  u32 idx,
                break;
        case V_038000_SQ_TEX_DIM_2D_ARRAY_MSAA:
                is_array = true;
-               /* fall through */
+               fallthrough;
        case V_038000_SQ_TEX_DIM_2D_MSAA:
                array_check.nsamples = 1 << llevel;
                llevel = 0;
index 1ad5c3b86b640e67372d32033b7d9857166aad0f..57fb3eb3a4b45a0af9864625503cd49426cf05ef 100644 (file)
@@ -454,7 +454,7 @@ static int radeon_uvd_validate_codec(struct radeon_cs_parser *p,
                if (p->rdev->family >= CHIP_PALM)
                        return 0;
 
-               /* fall through */
+               fallthrough;
        default:
                DRM_ERROR("UVD codec not supported by hardware %d!\n",
                          stream_type);
index a167e1c36d2432719e1f3032d8e97577a074bc66..d1c73e9db889aee87b6af7dddb3b99b5f86c1511 100644 (file)
@@ -5744,7 +5744,7 @@ static void si_request_link_speed_change_before_state_change(struct radeon_devic
                        si_pi->force_pcie_gen = RADEON_PCIE_GEN2;
                        if (current_link_speed == RADEON_PCIE_GEN2)
                                break;
-                       /* fall through */
+                       fallthrough;
                case RADEON_PCIE_GEN2:
                        if (radeon_acpi_pcie_performance_request(rdev, PCIE_PERF_REQ_PECI_GEN2, false) == 0)
                                break;
index f858d8d063476becf391f79a7aef06e3fb48f30a..800721153d51a2a404c121834d20236d992c65d6 100644 (file)
@@ -219,7 +219,7 @@ done:
                        WREG32(RS_DQ_RD_RET_CONF, 0x3f);
                        WREG32(MC_CONFIG, 0x1f);
 
-                       /* fall through */
+                       fallthrough;
                case CHIP_RV670:
                case CHIP_RV635:
 
index a2ac25c11c90384ad73d377ec4ed314b2ada0467..e0d40ae67d54240e90e7a6499f2cb595bf70662f 100644 (file)
@@ -306,7 +306,7 @@ static int savage_dispatch_dma_prim(drm_savage_private_t * dev_priv,
        case SAVAGE_PRIM_TRILIST_201:
                reorder = 1;
                prim = SAVAGE_PRIM_TRILIST;
-               /* fall through */
+               fallthrough;
        case SAVAGE_PRIM_TRILIST:
                if (n % 3 != 0) {
                        DRM_ERROR("wrong number of vertices %u in TRILIST\n",
@@ -444,7 +444,7 @@ static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv,
        case SAVAGE_PRIM_TRILIST_201:
                reorder = 1;
                prim = SAVAGE_PRIM_TRILIST;
-               /* fall through */
+               fallthrough;
        case SAVAGE_PRIM_TRILIST:
                if (n % 3 != 0) {
                        DRM_ERROR("wrong number of vertices %u in TRILIST\n",
@@ -566,7 +566,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv,
        case SAVAGE_PRIM_TRILIST_201:
                reorder = 1;
                prim = SAVAGE_PRIM_TRILIST;
-               /* fall through */
+               fallthrough;
        case SAVAGE_PRIM_TRILIST:
                if (n % 3 != 0) {
                        DRM_ERROR("wrong number of indices %u in TRILIST\n", n);
@@ -705,7 +705,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv,
        case SAVAGE_PRIM_TRILIST_201:
                reorder = 1;
                prim = SAVAGE_PRIM_TRILIST;
-               /* fall through */
+               fallthrough;
        case SAVAGE_PRIM_TRILIST:
                if (n % 3 != 0) {
                        DRM_ERROR("wrong number of indices %u in TRILIST\n", n);
@@ -1066,7 +1066,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_
                                ret = -EINVAL;
                                goto done;
                        }
-                       /* fall through */
+                       fallthrough;
                case SAVAGE_CMD_DMA_PRIM:
                case SAVAGE_CMD_VB_PRIM:
                        if (!first_draw_cmd)
index 008f07923bbc9f385f28bf02d61e574f8284aa67..38a558768e5311318be452425b6bbadfb023e44c 100644 (file)
@@ -850,13 +850,13 @@ static int hdmi_audio_configure(struct sti_hdmi *hdmi)
        switch (info->channels) {
        case 8:
                audio_cfg |= HDMI_AUD_CFG_CH78_VALID;
-               /* fall through */
+               fallthrough;
        case 6:
                audio_cfg |= HDMI_AUD_CFG_CH56_VALID;
-               /* fall through */
+               fallthrough;
        case 4:
                audio_cfg |= HDMI_AUD_CFG_CH34_VALID | HDMI_AUD_CFG_8CH;
-               /* fall through */
+               fallthrough;
        case 2:
                audio_cfg |= HDMI_AUD_CFG_CH12_VALID;
                break;
index 072ea113e6be5567e65337fefafb7a43ab2a9a7b..ed5d866178028a3d75bb13543b6f318c1ed8a7ca 100644 (file)
@@ -589,8 +589,7 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine,
 
        /* We can't have an alpha plane at the lowest position */
        if (!backend->quirks->supports_lowest_plane_alpha &&
-           (plane_states[0]->fb->format->has_alpha ||
-           (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE)))
+           (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE))
                return -EINVAL;
 
        for (i = 1; i < num_planes; i++) {
@@ -995,7 +994,6 @@ static const struct sun4i_backend_quirks sun6i_backend_quirks = {
 
 static const struct sun4i_backend_quirks sun7i_backend_quirks = {
        .needs_output_muxing = true,
-       .supports_lowest_plane_alpha = true,
 };
 
 static const struct sun4i_backend_quirks sun8i_a33_backend_quirks = {
index 359b56e43b83c564e48e062c2f12a1524f20485f..e40c542254f6bb62fca28ea75dfef3e8bc1237d2 100644 (file)
@@ -195,7 +195,7 @@ void sun4i_tcon_set_status(struct sun4i_tcon *tcon,
        switch (encoder->encoder_type) {
        case DRM_MODE_ENCODER_LVDS:
                is_lvds = true;
-               /* Fallthrough */
+               fallthrough;
        case DRM_MODE_ENCODER_DSI:
        case DRM_MODE_ENCODER_NONE:
                channel = 0;
@@ -342,7 +342,7 @@ static void sun4i_tcon0_mode_set_dithering(struct sun4i_tcon *tcon,
                /* R and B components are only 5 bits deep */
                val |= SUN4I_TCON0_FRM_CTL_MODE_R;
                val |= SUN4I_TCON0_FRM_CTL_MODE_B;
-               /* Fall through */
+               fallthrough;
        case MEDIA_BUS_FMT_RGB666_1X18:
        case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
                /* Fall through: enable dithering */
@@ -1433,14 +1433,18 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon,
        if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) &&
            encoder->encoder_type == DRM_MODE_ENCODER_TMDS) {
                ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id);
-               if (ret)
+               if (ret) {
+                       put_device(&pdev->dev);
                        return ret;
+               }
        }
 
        if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP)) {
                ret = sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id);
-               if (ret)
+               if (ret) {
+                       put_device(&pdev->dev);
                        return ret;
+               }
        }
 
        return 0;
index aa67cb037e9d10a417e932ea9abc7fca68fdb30f..de8a11abd66a5fc0effc25baea5599bcdd187256 100644 (file)
@@ -889,7 +889,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi,
        regmap_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(0),
                     sun6i_dsi_dcs_build_pkt_hdr(dsi, msg));
 
-       bounce = kzalloc(msg->tx_len + sizeof(crc), GFP_KERNEL);
+       bounce = kzalloc(ALIGN(msg->tx_len + sizeof(crc), 4), GFP_KERNEL);
        if (!bounce)
                return -ENOMEM;
 
@@ -900,7 +900,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi,
        memcpy((u8 *)bounce + msg->tx_len, &crc, sizeof(crc));
        len += sizeof(crc);
 
-       regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, len);
+       regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, DIV_ROUND_UP(len, 4));
        regmap_write(dsi->regs, SUN6I_DSI_CMD_CTL_REG, len + 4 - 1);
        kfree(bounce);
 
@@ -1027,7 +1027,7 @@ static ssize_t sun6i_dsi_transfer(struct mipi_dsi_host *host,
                        ret = sun6i_dsi_dcs_read(dsi, msg);
                        break;
                }
-               /* Else, fall through */
+               fallthrough;
 
        default:
                ret = -EINVAL;
index f42441b1b14ddfcc4bd8e82423365514b373d982..a55a38ad849c1304df484f0d234d182a79a8708a 100644 (file)
@@ -12,7 +12,7 @@ struct sun8i_mixer;
 
 /* VI channel CSC units offsets */
 #define CCSC00_OFFSET 0xAA050
-#define CCSC01_OFFSET 0xFA000
+#define CCSC01_OFFSET 0xFA050
 #define CCSC10_OFFSET 0xA0000
 #define CCSC11_OFFSET 0xF0000
 
index cc4fb916318f300695b86b4ccd4be8cfd7c2b943..c3304028e3dcd199a037e0cb78de3274044a4ca4 100644 (file)
@@ -307,7 +307,7 @@ static struct regmap_config sun8i_mixer_regmap_config = {
        .reg_bits       = 32,
        .val_bits       = 32,
        .reg_stride     = 4,
-       .max_register   = 0xbfffc, /* guessed */
+       .max_register   = 0xffffc, /* guessed */
 };
 
 static int sun8i_mixer_of_get_id(struct device_node *node)
index 22c8c5375d0db8d0c53f96a6c56092914497cac4..c0147af6a84060d6c0156889d56f1a7a2dc50f31 100644 (file)
@@ -211,7 +211,7 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel,
        return 0;
 }
 
-static bool sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format)
+static u32 sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format)
 {
        if (!format->is_yuv)
                return SUN8I_CSC_MODE_OFF;
index 9a0b3240bc5823d0af0edca13f7f0611d25cd204..424ad60b4f388c1e5f492ac26457849fa11bb7b1 100644 (file)
@@ -135,7 +135,7 @@ static inline u32 compute_dda_inc(unsigned int in, unsigned int out, bool v,
 
                default:
                        WARN_ON_ONCE(1);
-                       /* fallthrough */
+                       fallthrough;
                case 4:
                        max = 4;
                        break;
index 1856962411c779d698f4d88933a819097741c9e9..518220bd092a646330544fc494ac9cfc51bd8e92 100644 (file)
@@ -386,7 +386,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)
                case DRM_FORMAT_XBGR8888:
                case DRM_FORMAT_XRGB8888:
                        reg |= LCDC_V2_TFT_24BPP_UNPACK;
-                       /* fallthrough */
+                       fallthrough;
                case DRM_FORMAT_BGR888:
                case DRM_FORMAT_RGB888:
                        reg |= LCDC_V2_TFT_24BPP_MODE;
index 33526c5df0e8ca1286216d47e272a64aa7b0b8ef..4732dcc80e119a0b37ca8dd90b4c28f2a6ff45c5 100644 (file)
@@ -525,7 +525,7 @@ int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,
                        if (unlikely(ret != 0))
                                return ret;
                }
-               /* fall through */
+               fallthrough;
        case TTM_PL_TT:
                ret = ttm_bo_vm_access_kmap(bo, offset, buf, len, write);
                break;
index d733bbc4ac0e5d95f55b1d4cefae688854541eea..17ff24d999d18296b4c1b03bf1a700144fcbdaa5 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/version.h>
 #include <linux/dma-buf.h>
 #include <linux/of_graph.h>
+#include <linux/delay.h>
 
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_fourcc.h>
@@ -130,9 +131,25 @@ static void tve200_display_enable(struct drm_simple_display_pipe *pipe,
        struct drm_connector *connector = priv->connector;
        u32 format = fb->format->format;
        u32 ctrl1 = 0;
+       int retries;
 
        clk_prepare_enable(priv->clk);
 
+       /* Reset the TVE200 and wait for it to come back online */
+       writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4);
+       for (retries = 0; retries < 5; retries++) {
+               usleep_range(30000, 50000);
+               if (readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET)
+                       continue;
+               else
+                       break;
+       }
+       if (retries == 5 &&
+           readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET) {
+               dev_err(drm->dev, "can't get hardware out of reset\n");
+               return;
+       }
+
        /* Function 1 */
        ctrl1 |= TVE200_CTRL_CSMODE;
        /* Interlace mode for CCIR656: parameterize? */
@@ -230,8 +247,9 @@ static void tve200_display_disable(struct drm_simple_display_pipe *pipe)
 
        drm_crtc_vblank_off(crtc);
 
-       /* Disable and Power Down */
+       /* Disable put into reset and Power Down */
        writel(0, priv->regs + TVE200_CTRL);
+       writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4);
 
        clk_disable_unprepare(priv->clk);
 }
@@ -279,6 +297,8 @@ static int tve200_display_enable_vblank(struct drm_simple_display_pipe *pipe)
        struct drm_device *drm = crtc->dev;
        struct tve200_drm_dev_private *priv = drm->dev_private;
 
+       /* Clear any IRQs and enable */
+       writel(0xFF, priv->regs + TVE200_INT_CLR);
        writel(TVE200_INT_V_STATUS, priv->regs + TVE200_INT_EN);
        return 0;
 }
index 15a11cd4de256a94cb528cc5a4d2770b7726af0b..6339c6f0f571f816cbb7bea79155ae93bde7c35c 100644 (file)
@@ -1117,6 +1117,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *hdmi)
        card->num_links = 1;
        card->name = "vc4-hdmi";
        card->dev = dev;
+       card->owner = THIS_MODULE;
 
        /*
         * Be careful, snd_soc_register_card() calls dev_set_drvdata() and
index 551fa31629afb8a8eec8aa76c1d3e89bff252cec..5771bb53ce6a51ac8a120bb2997c3433fade337f 100644 (file)
@@ -179,21 +179,21 @@ via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg)
        switch (vsg->state) {
        case dr_via_device_mapped:
                via_unmap_blit_from_device(pdev, vsg);
-               /* fall through */
+               fallthrough;
        case dr_via_desc_pages_alloc:
                for (i = 0; i < vsg->num_desc_pages; ++i) {
                        if (vsg->desc_pages[i] != NULL)
                                free_page((unsigned long)vsg->desc_pages[i]);
                }
                kfree(vsg->desc_pages);
-               /* fall through */
+               fallthrough;
        case dr_via_pages_locked:
                unpin_user_pages_dirty_lock(vsg->pages, vsg->num_pages,
                                           (vsg->direction == DMA_FROM_DEVICE));
-               /* fall through */
+               fallthrough;
        case dr_via_pages_alloc:
                vfree(vsg->pages);
-               /* fall through */
+               fallthrough;
        default:
                vsg->state = dr_via_sg_init;
        }
index af55b334be2fd87631ac94225429fd34282e3e68..afd0f9200f9084ebf180c5db44d1fd6f4e28b72c 100644 (file)
@@ -97,9 +97,6 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc)
 static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc,
                                          struct drm_crtc_state *old_state)
 {
-       struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
-
-       output->enabled = true;
 }
 
 static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc,
@@ -111,7 +108,6 @@ static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc,
 
        virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0);
        virtio_gpu_notify(vgdev);
-       output->enabled = false;
 }
 
 static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
@@ -123,6 +119,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
 static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
                                         struct drm_crtc_state *old_state)
 {
+       struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
+
+       /*
+        * virtio-gpu can't do modeset and plane update operations
+        * independent from each other.  So the actual modeset happens
+        * in the plane update callback, and here we just check
+        * whenever we must force the modeset.
+        */
+       if (drm_atomic_crtc_needs_modeset(crtc->state)) {
+               output->needs_modeset = true;
+       }
 }
 
 static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
index 9ff9f4ac0522ac66b6526175fd40bb75521d44da..fbc04272db4f0f9b5514b5c61eb4e1c5d3c92352 100644 (file)
@@ -137,7 +137,7 @@ struct virtio_gpu_output {
        struct edid *edid;
        int cur_x;
        int cur_y;
-       bool enabled;
+       bool needs_modeset;
 };
 #define drm_crtc_to_virtio_gpu_output(x) \
        container_of(x, struct virtio_gpu_output, crtc)
index e83651b7747d5a64d6e7b748dbae4e68bbec5bcc..842f8b61aa89708d67939ed144444b16e6b1cbac 100644 (file)
@@ -151,7 +151,13 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev,
        if (ret < 0)
                return -EINVAL;
 
-       shmem->pages = drm_gem_shmem_get_pages_sgt(&bo->base.base);
+       /*
+        * virtio_gpu uses drm_gem_shmem_get_sg_table instead of
+        * drm_gem_shmem_get_pages_sgt because virtio has it's own set of
+        * dma-ops. This is discouraged for other drivers, but should be fine
+        * since virtio_gpu doesn't support dma-buf import from other devices.
+        */
+       shmem->pages = drm_gem_shmem_get_sg_table(&bo->base.base);
        if (!shmem->pages) {
                drm_gem_shmem_unpin(&bo->base.base);
                return -EINVAL;
index 52d24179bcecc52851c286652f935a620d47b426..6a311cd934403914e87ae3b0b2acafcbe40c4032 100644 (file)
@@ -142,7 +142,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
        if (WARN_ON(!output))
                return;
 
-       if (!plane->state->fb || !output->enabled) {
+       if (!plane->state->fb || !output->crtc.state->active) {
                DRM_DEBUG("nofb\n");
                virtio_gpu_cmd_set_scanout(vgdev, output->index, 0,
                                           plane->state->src_w >> 16,
@@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
            plane->state->src_w != old_state->src_w ||
            plane->state->src_h != old_state->src_h ||
            plane->state->src_x != old_state->src_x ||
-           plane->state->src_y != old_state->src_y) {
+           plane->state->src_y != old_state->src_y ||
+           output->needs_modeset) {
+               output->needs_modeset = false;
                DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n",
                          bo->hw_res_handle,
                          plane->state->crtc_w, plane->state->crtc_h,
index 4a76fc7114adcfb528ad06a9ad5840e8a60f5a38..f8bdd4ea294a6695ac074564b58eb9456af94bf4 100644 (file)
@@ -55,7 +55,7 @@ static int vmw_gmrid_man_get_node(struct ttm_mem_type_manager *man,
 
        id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL);
        if (id < 0)
-               return (id != -ENOMEM ? 0 : id);
+               return id;
 
        spin_lock(&gman->lock);
 
index b7c816ba71663b61de1e25dfed8033b6fcedd1fd..c8b9335bccd8d8fccfbdf40cdff7096ce6448bb5 100644 (file)
@@ -95,7 +95,7 @@ found_unlock:
                mem->start = node->start;
        }
 
-       return 0;
+       return ret;
 }
 
 
index 013c9e0e412cdca93d973772f5166686ff693cba..cc93a8c9547bcc76814294713ae1c8910b30ca75 100644 (file)
@@ -649,9 +649,7 @@ static void displback_changed(struct xenbus_device *xb_dev,
 
        switch (backend_state) {
        case XenbusStateReconfiguring:
-               /* fall through */
        case XenbusStateReconfigured:
-               /* fall through */
        case XenbusStateInitialised:
                break;
 
@@ -701,7 +699,6 @@ static void displback_changed(struct xenbus_device *xb_dev,
                break;
 
        case XenbusStateUnknown:
-               /* fall through */
        case XenbusStateClosed:
                if (xb_dev->state == XenbusStateClosed)
                        break;
index 39ff95b75357ddafc5daac2d0110b2adef7bffd6..534daf37c97ed8bbb133b13f27a91908c83001bc 100644 (file)
@@ -18,6 +18,7 @@
 #include <drm/drm_probe_helper.h>
 
 #include <xen/balloon.h>
+#include <xen/xen.h>
 
 #include "xen_drm_front.h"
 #include "xen_drm_front_gem.h"
@@ -99,8 +100,8 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size)
                 * allocate ballooned pages which will be used to map
                 * grant references provided by the backend
                 */
-               ret = alloc_xenballooned_pages(xen_obj->num_pages,
-                                              xen_obj->pages);
+               ret = xen_alloc_unpopulated_pages(xen_obj->num_pages,
+                                                 xen_obj->pages);
                if (ret < 0) {
                        DRM_ERROR("Cannot allocate %zu ballooned pages: %d\n",
                                  xen_obj->num_pages, ret);
@@ -152,8 +153,8 @@ void xen_drm_front_gem_free_object_unlocked(struct drm_gem_object *gem_obj)
        } else {
                if (xen_obj->pages) {
                        if (xen_obj->be_alloc) {
-                               free_xenballooned_pages(xen_obj->num_pages,
-                                                       xen_obj->pages);
+                               xen_free_unpopulated_pages(xen_obj->num_pages,
+                                                          xen_obj->pages);
                                gem_free_pages_array(xen_obj);
                        } else {
                                drm_gem_put_pages(&xen_obj->base,
index aa6cd889bd119f726531a23cc2392a352f901334..b52c6cdfc0b872d68dacd591ddfa294ed148d979 100644 (file)
@@ -2,6 +2,7 @@ config DRM_ZYNQMP_DPSUB
        tristate "ZynqMP DisplayPort Controller Driver"
        depends on ARCH_ZYNQMP || COMPILE_TEST
        depends on COMMON_CLK && DRM && OF
+       depends on DMADEVICES
        select DMA_ENGINE
        select DRM_GEM_CMA_HELPER
        select DRM_KMS_CMA_HELPER
index dbcc167219318f5145b5da058fd9994399af8c72..34b4075a6a8e531701a0fd43e708b3caec419106 100644 (file)
@@ -141,7 +141,7 @@ static int ipu_bus_format_to_map(u32 fmt)
        switch (fmt) {
        default:
                WARN_ON(1);
-               /* fall-through */
+               fallthrough;
        case MEDIA_BUS_FMT_RGB888_1X24:
                return IPU_DC_MAP_RGB24;
        case MEDIA_BUS_FMT_RGB565_1X16:
index 359616e3efbbb244e633b4a37ae6361c30abf19f..d2ecc9c4525548c5ae4f1f1a54de70d61c52a91d 100644 (file)
@@ -1597,6 +1597,17 @@ static void hid_output_field(const struct hid_device *hid,
        }
 }
 
+/*
+ * Compute the size of a report.
+ */
+static size_t hid_compute_report_size(struct hid_report *report)
+{
+       if (report->size)
+               return ((report->size - 1) >> 3) + 1;
+
+       return 0;
+}
+
 /*
  * Create a report. 'data' has to be allocated using
  * hid_alloc_report_buf() so that it has proper size.
@@ -1609,7 +1620,7 @@ void hid_output_report(struct hid_report *report, __u8 *data)
        if (report->id > 0)
                *data++ = report->id;
 
-       memset(data, 0, ((report->size - 1) >> 3) + 1);
+       memset(data, 0, hid_compute_report_size(report));
        for (n = 0; n < report->maxfield; n++)
                hid_output_field(report->device, report->field[n], data);
 }
@@ -1739,7 +1750,7 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
                csize--;
        }
 
-       rsize = ((report->size - 1) >> 3) + 1;
+       rsize = hid_compute_report_size(report);
 
        if (report_enum->numbered && rsize >= HID_MAX_BUFFER_SIZE)
                rsize = HID_MAX_BUFFER_SIZE - 1;
index 4ff3bc1d25e23fe91b4d8460e4ab13d934ea14c2..28d671c5e0cac27e06ae9a73d464f1fa0bcd188a 100644 (file)
@@ -321,7 +321,7 @@ static const struct kernel_param_ops cougar_g6_is_space_ops = {
 };
 module_param_cb(g6_is_space, &cougar_g6_is_space_ops, &g6_is_space, 0644);
 
-static struct hid_device_id cougar_id_table[] = {
+static const struct hid_device_id cougar_id_table[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
                         USB_DEVICE_ID_COUGAR_500K_GAMING_KEYBOARD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
index 45c4f888b7c4e61b9adf8f3c2101f337ae14870c..dae193749d443490390255df260fda27edc3e531 100644 (file)
@@ -188,6 +188,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)
        ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER);
        if (ret) {
                hid_err(hdev, "Failed to init elan MT slots: %d\n", ret);
+               input_free_device(input);
                return ret;
        }
 
@@ -198,6 +199,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)
        if (ret) {
                hid_err(hdev, "Failed to register elan input device: %d\n",
                        ret);
+               input_mt_destroy_slots(input);
                input_free_device(input);
                return ret;
        }
index 6221888aae99fd402e788b4c7c857d1581f7c6c4..74fc1df6e3c2726135791dd4a19063bc52fb23cf 100644 (file)
 #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
 #define USB_DEVICE_ID_LENOVO_X1_COVER  0x6085
 #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D     0x608d
+#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019     0x6019
+#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E     0x602e
+#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6093     0x6093
 
 #define USB_VENDOR_ID_LG               0x1fd2
 #define USB_DEVICE_ID_LG_MULTITOUCH    0x0064
 #define USB_DEVICE_ID_MS_POWER_COVER     0x07da
 #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd
 #define USB_DEVICE_ID_MS_PIXART_MOUSE    0x00cb
+#define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS      0x02e0
 
 #define USB_VENDOR_ID_MOJO             0x8282
 #define USB_DEVICE_ID_RETRO_ADAPTER    0x3201
 #define USB_DEVICE_ID_SAITEK_RAT9      0x0cfa
 #define USB_DEVICE_ID_SAITEK_MMO7      0x0cd0
 #define USB_DEVICE_ID_SAITEK_X52       0x075c
+#define USB_DEVICE_ID_SAITEK_X52_2     0x0255
+#define USB_DEVICE_ID_SAITEK_X52_PRO   0x0762
 
 #define USB_VENDOR_ID_SAMSUNG          0x0419
 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE        0x0001
index b8eabf206e7439908830e4c6d7218127ec5a73e8..88e19996427e63aad2ac1816c7f1a7039dc69921 100644 (file)
@@ -1132,6 +1132,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
        }
 
 mapped:
+       /* Mapping failed, bail out */
+       if (!bit)
+               return;
+
        if (device->driver->input_mapped &&
            device->driver->input_mapped(device, hidinput, field, usage,
                                         &bit, &max) < 0) {
index ef0cbcd7540d564e91e8f70c03aa947a410ce1c9..fcaf8466e627d51da31c781bbbc2f820c80b405d 100644 (file)
@@ -680,7 +680,7 @@ static int lg_g15_register_led(struct lg_g15_data *g15, int i)
                         * but it does have a separate power-on (reset) value.
                         */
                        g15->leds[i].cdev.name = "g15::power_on_backlight_val";
-                       /* fall through */
+                       fallthrough;
                case LG_G15_KBD_BRIGHTNESS:
                        g15->leds[i].cdev.brightness_set_blocking =
                                lg_g510_kbd_led_set;
index a78c13cc9f470f555a9a63553ef187cbc8e2d041..38ee25a813b9e2bec38c44ed2d6486ff5a5fb54c 100644 (file)
@@ -844,7 +844,7 @@ static void logi_dj_recv_queue_notification(struct dj_receiver_dev *djrcv_dev,
                        workitem.type = WORKITEM_TYPE_EMPTY;
                        break;
                }
-               /* fall-through */
+               fallthrough;
        case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED:
                workitem.quad_id_msb =
                        dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB];
index 9a4fc7dffb14d551689b0b5e7ea5eefcfeaa4625..aea46e5220082acae14b78097bb27d4a13b84f65 100644 (file)
@@ -29,7 +29,7 @@ static __u8 *macally_report_fixup(struct hid_device *hdev, __u8 *rdesc,
        return rdesc;
 }
 
-static struct hid_device_id macally_id_table[] = {
+static const struct hid_device_id macally_id_table[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_SOLID_YEAR,
                         USB_DEVICE_ID_MACALLY_IKEY_KEYBOARD) },
        { }
index 2d8b589201a4e80c7d2dc7c4a6df35344840bd9a..071fd093a5f4e139893ccf53befe23f14b8bf974 100644 (file)
@@ -163,16 +163,13 @@ static int ms_surface_dial_quirk(struct hid_input *hi, struct hid_field *field,
 {
        switch (usage->hid & HID_USAGE_PAGE) {
        case 0xff070000:
-               /* fall-through */
        case HID_UP_DIGITIZER:
                /* ignore those axis */
                return -1;
        case HID_UP_GENDESK:
                switch (usage->hid) {
                case HID_GD_X:
-                       /* fall-through */
                case HID_GD_Y:
-                       /* fall-through */
                case HID_GD_RFKILL_BTN:
                        /* ignore those axis */
                        return -1;
@@ -451,6 +448,8 @@ static const struct hid_device_id ms_devices[] = {
                .driver_data = MS_SURFACE_DIAL },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER),
                .driver_data = MS_QUIRK_FF },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS),
+               .driver_data = MS_QUIRK_FF },
        { }
 };
 MODULE_DEVICE_TABLE(hid, ms_devices);
index 3f94b4954225b38ea6fa4bea9194bebb1ab8b383..e3152155c4b85de7bac90441f821712a6cc9fbe2 100644 (file)
@@ -856,6 +856,8 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
                        code = BTN_0  + ((usage->hid - 1) & HID_USAGE);
 
                hid_map_usage(hi, usage, bit, max, EV_KEY, code);
+               if (!*bit)
+                       return -1;
                input_set_capability(hi->input, EV_KEY, code);
                return 1;
 
index c242150d35a3afa7f5c4ffcd85003e6073dbf550..7a2be0205dfd12a81a82e963893ca664512bb526 100644 (file)
@@ -105,6 +105,9 @@ static const struct hid_device_id hid_quirks[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M406XE), HID_QUIRK_MULTI_INPUT },
        { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6093), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C007), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS), HID_QUIRK_NOGET },
@@ -147,6 +150,8 @@ static const struct hid_device_id hid_quirks[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_RETROUSB, USB_DEVICE_ID_RETROUSB_SNES_RETROPORT), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
        { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD), HID_QUIRK_BADPAD },
        { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
+       { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
+       { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_PRO), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
        { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS },
        { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS },
        { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET },
index 8cffa84c9650318cdb3fa8beac4011ac592f16b4..7f41213d5ae3430be88e7ac499c39f68daa9ae52 100644 (file)
@@ -428,7 +428,6 @@ static void rmi_report(struct hid_device *hid, struct hid_report *report)
 
        switch (report->id) {
        case RMI_READ_DATA_REPORT_ID:
-               /* fall-through */
        case RMI_ATTN_REPORT_ID:
                return;
        }
index 1a6e600197d0ba99bb5284385953609686bd867c..2ff4c8e366ff2fc10f0cd909d88147078a5de778 100644 (file)
@@ -780,7 +780,7 @@ static void kone_keep_values_up_to_date(struct kone_device *kone,
        case kone_mouse_event_switch_profile:
                kone->actual_dpi = kone->profiles[event->value - 1].
                                startup_dpi;
-               /* fall through */
+               fallthrough;
        case kone_mouse_event_osd_profile:
                kone->actual_profile = event->value;
                break;
index 78a364ae2f68580913c2e0e589cc9156ca4b8140..7d20d1fcf8d208f32bda368e7b33b516c76606a0 100644 (file)
@@ -974,7 +974,7 @@ int uclogic_params_init(struct uclogic_params *params,
                        }
                        break;
                }
-               /* FALL THROUGH */
+               fallthrough;
        case VID_PID(USB_VENDOR_ID_HUION,
                     USB_DEVICE_ID_HUION_TABLET):
        case VID_PID(USB_VENDOR_ID_HUION,
index 679e142fc850c992f3f417513164a38405788676..e484c3618decafc1925b2343bfd6c2f462c139ba 100644 (file)
@@ -1672,7 +1672,6 @@ static ssize_t wiimote_ext_show(struct device *dev,
        case WIIMOTE_EXT_GUITAR:
                return sprintf(buf, "guitar\n");
        case WIIMOTE_EXT_UNKNOWN:
-               /* fallthrough */
        default:
                return sprintf(buf, "unknown\n");
        }
@@ -1722,7 +1721,6 @@ static ssize_t wiimote_dev_show(struct device *dev,
        case WIIMOTE_DEV_PENDING:
                return sprintf(buf, "pending\n");
        case WIIMOTE_DEV_UNKNOWN:
-               /* fallthrough */
        default:
                return sprintf(buf, "unknown\n");
        }
index 294c84e136d72686842516c9422ece66739b724e..dbd04492825d473a354d114085d3870b71de805e 100644 (file)
@@ -420,6 +420,19 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
                dev_err(&client->dev, "failed to change power setting.\n");
 
 set_pwr_exit:
+
+       /*
+        * The HID over I2C specification states that if a DEVICE needs time
+        * after the PWR_ON request, it should utilise CLOCK stretching.
+        * However, it has been observered that the Windows driver provides a
+        * 1ms sleep between the PWR_ON and RESET requests.
+        * According to Goodix Windows even waits 60 ms after (other?)
+        * PWR_ON requests. Testing has confirmed that several devices
+        * will not work properly without a delay after a PWR_ON request.
+        */
+       if (!ret && power_state == I2C_HID_PWR_ON)
+               msleep(60);
+
        return ret;
 }
 
@@ -441,15 +454,6 @@ static int i2c_hid_hwreset(struct i2c_client *client)
        if (ret)
                goto out_unlock;
 
-       /*
-        * The HID over I2C specification states that if a DEVICE needs time
-        * after the PWR_ON request, it should utilise CLOCK stretching.
-        * However, it has been observered that the Windows driver provides a
-        * 1ms sleep between the PWR_ON and RESET requests and that some devices
-        * rely on this.
-        */
-       usleep_range(1000, 5000);
-
        i2c_hid_dbg(ihid, "resetting...\n");
 
        ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0);
index 492dd641a25df2225c2d61915e4e7ab6c5a95e12..17a29ee0ac6c23346e2502df0130dc9a50d89db1 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/wait.h>
 #include <linux/workqueue.h>
 #include <linux/string.h>
-#include <linux/timekeeping.h>
 
 #include <linux/usb.h>
 
@@ -96,18 +95,6 @@ static int hid_start_in(struct hid_device *hid)
                                set_bit(HID_NO_BANDWIDTH, &usbhid->iofl);
                } else {
                        clear_bit(HID_NO_BANDWIDTH, &usbhid->iofl);
-
-                       if (test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
-                               /*
-                                * In case events are generated while nobody was
-                                * listening, some are released when the device
-                                * is re-opened. Wait 50 msec for the queue to
-                                * empty before allowing events to go through
-                                * hid.
-                                */
-                               usbhid->input_start_time =
-                                       ktime_add_ms(ktime_get_coarse(), 50);
-                       }
                }
        }
        spin_unlock_irqrestore(&usbhid->lock, flags);
@@ -293,23 +280,20 @@ static void hid_irq_in(struct urb *urb)
                if (!test_bit(HID_OPENED, &usbhid->iofl))
                        break;
                usbhid_mark_busy(usbhid);
-               if (test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
-                       if (ktime_before(ktime_get_coarse(),
-                                        usbhid->input_start_time))
-                               break;
-                       clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
+               if (!test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
+                       hid_input_report(urb->context, HID_INPUT_REPORT,
+                                        urb->transfer_buffer,
+                                        urb->actual_length, 1);
+                       /*
+                        * autosuspend refused while keys are pressed
+                        * because most keyboards don't wake up when
+                        * a key is released
+                        */
+                       if (hid_check_keys_pressed(hid))
+                               set_bit(HID_KEYS_PRESSED, &usbhid->iofl);
+                       else
+                               clear_bit(HID_KEYS_PRESSED, &usbhid->iofl);
                }
-               hid_input_report(urb->context, HID_INPUT_REPORT,
-                                urb->transfer_buffer, urb->actual_length, 1);
-               /*
-                * autosuspend refused while keys are pressed
-                * because most keyboards don't wake up when
-                * a key is released
-                */
-               if (hid_check_keys_pressed(hid))
-                       set_bit(HID_KEYS_PRESSED, &usbhid->iofl);
-               else
-                       clear_bit(HID_KEYS_PRESSED, &usbhid->iofl);
                break;
        case -EPIPE:            /* stall */
                usbhid_mark_busy(usbhid);
@@ -736,6 +720,17 @@ static int usbhid_open(struct hid_device *hid)
 
        usb_autopm_put_interface(usbhid->intf);
 
+       /*
+        * In case events are generated while nobody was listening,
+        * some are released when the device is re-opened.
+        * Wait 50 msec for the queue to empty before allowing events
+        * to go through hid.
+        */
+       if (res == 0)
+               msleep(50);
+
+       clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
+
  Done:
        mutex_unlock(&usbhid->mutex);
        return res;
index 4140dea693e90988d80bac6129458499fb2d03af..45e0b1c75cb1129e5fdf7896c5c6264be169e3cd 100644 (file)
@@ -519,12 +519,16 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
 
                switch (cmd) {
                case HIDIOCGUSAGE:
+                       if (uref->usage_index >= field->report_count)
+                               goto inval;
                        uref->value = field->value[uref->usage_index];
                        if (copy_to_user(user_arg, uref, sizeof(*uref)))
                                goto fault;
                        goto goodreturn;
 
                case HIDIOCSUSAGE:
+                       if (uref->usage_index >= field->report_count)
+                               goto inval;
                        field->value[uref->usage_index] = uref->value;
                        goto goodreturn;
 
@@ -781,7 +785,6 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                break;
 
        case HIDIOCGUCODE:
-               /* fall through */
        case HIDIOCGUSAGE:
        case HIDIOCSUSAGE:
        case HIDIOCGUSAGES:
index c6ad684d099a10d7f7328ca1e0dbe93c7c0ef3f1..75fe85d3d27a0a25d6f5aad7123bcf527ae13261 100644 (file)
@@ -13,7 +13,6 @@
 
 #include <linux/types.h>
 #include <linux/slab.h>
-#include <linux/ktime.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
 #include <linux/timer.h>
@@ -84,7 +83,6 @@ struct usbhid_device {
        struct mutex mutex;                                             /* start/stop/open/close */
        spinlock_t lock;                                                /* fifo spinlock */
        unsigned long iofl;                                             /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
-       ktime_t input_start_time;                                       /* When to start handling input */
        struct timer_list io_retry;                                     /* Retry timer */
        unsigned long stop_retry;                                       /* Time to give up, in jiffies */
        unsigned int retry_delay;                                       /* Delay length in ms */
index 1c96809b51c909431255eb912d04156d7f5fd8aa..83dfec327c422b974c20de2b38be2ba97d989dee 100644 (file)
@@ -341,7 +341,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom)
 
                        case 2: /* Mouse with wheel */
                                input_report_key(input, BTN_MIDDLE, data[1] & 0x04);
-                               /* fall through */
+                               fallthrough;
 
                        case 3: /* Mouse without wheel */
                                wacom->tool[0] = BTN_TOOL_MOUSE;
@@ -1201,7 +1201,7 @@ static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len)
        case 0x04:
                wacom_intuos_bt_process_data(wacom, data + i);
                i += 10;
-               /* fall through */
+               fallthrough;
        case 0x03:
                wacom_intuos_bt_process_data(wacom, data + i);
                i += 10;
@@ -2148,7 +2148,7 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field
                for (i = 0; i < wacom->led.count; i++)
                        wacom_update_led(wacom, features->numbered_buttons,
                                         value, i);
-                /* fall through*/
+               fallthrough;
        default:
                do_report = true;
                break;
@@ -3602,14 +3602,14 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
        switch (features->type) {
        case GRAPHIRE_BT:
                __clear_bit(ABS_MISC, input_dev->absbit);
-               /* fall through */
+               fallthrough;
 
        case WACOM_MO:
        case WACOM_G4:
                input_set_abs_params(input_dev, ABS_DISTANCE, 0,
                                              features->distance_max,
                                              features->distance_fuzz, 0);
-               /* fall through */
+               fallthrough;
 
        case GRAPHIRE:
                input_set_capability(input_dev, EV_REL, REL_WHEEL);
@@ -3649,7 +3649,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
        case INTUOS4S:
                input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
                input_abs_set_res(input_dev, ABS_Z, 287);
-               /* fall through */
+               fallthrough;
 
        case INTUOS:
                wacom_setup_intuos(wacom_wac);
@@ -3682,7 +3682,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
        case TABLETPC:
        case TABLETPCE:
                __clear_bit(ABS_MISC, input_dev->absbit);
-               /* fall through */
+               fallthrough;
 
        case DTUS:
        case DTUSX:
@@ -3696,7 +3696,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
 
        case PTU:
                __set_bit(BTN_STYLUS2, input_dev->keybit);
-               /* fall through */
+               fallthrough;
 
        case PENPARTNER:
                __set_bit(BTN_TOOL_PEN, input_dev->keybit);
@@ -3799,7 +3799,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
                input_abs_set_res(input_dev, ABS_MT_POSITION_X, 40);
                input_abs_set_res(input_dev, ABS_MT_POSITION_Y, 40);
 
-               /* fall through */
+               fallthrough;
 
        case INTUOS5:
        case INTUOS5L:
@@ -3817,7 +3817,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
                input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0);
                input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0);
                input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0);
-               /* fall through */
+               fallthrough;
 
        case WACOM_27QHDT:
                if (wacom_wac->shared->touch->product == 0x32C ||
@@ -3826,14 +3826,14 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
                        __set_bit(SW_MUTE_DEVICE, input_dev->swbit);
                        wacom_wac->shared->has_mute_touch_switch = true;
                }
-               /* fall through */
+               fallthrough;
 
        case MTSCREEN:
        case MTTPC:
        case MTTPC_B:
        case TABLETPC2FG:
                input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT);
-               /*fall through */
+               fallthrough;
 
        case TABLETPC:
        case TABLETPCE:
@@ -3843,7 +3843,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
        case INTUOSHT2:
                input_dev->evbit[0] |= BIT_MASK(EV_SW);
                __set_bit(SW_MUTE_DEVICE, input_dev->swbit);
-               /* fall through */
+               fallthrough;
 
        case BAMBOO_PT:
        case BAMBOO_TOUCH:
@@ -4099,7 +4099,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
 
                __set_bit(KEY_BUTTONCONFIG, input_dev->keybit);
                __set_bit(KEY_INFO, input_dev->keybit);
-               /* fall through */
+               fallthrough;
 
        case WACOM_21UX2:
        case WACOM_BEE:
@@ -4115,7 +4115,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
        case INTUOS3:
        case INTUOS3L:
                input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
-               /* fall through */
+               fallthrough;
 
        case INTUOS3S:
                input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
@@ -4139,7 +4139,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
                 * ID_INPUT_TABLET to be set.
                 */
                __set_bit(BTN_STYLUS, input_dev->keybit);
-               /* fall through */
+               fallthrough;
 
        case INTUOS4:
        case INTUOS4L:
index 365b5d5967accf1d69d79bb8dc3c685d827b7725..96d0eccca3aa74a5871b386f5dc369735e58745b 100644 (file)
@@ -291,7 +291,7 @@ static void ssip_set_rxstate(struct ssi_protocol *ssi, unsigned int state)
                /* CMT speech workaround */
                if (atomic_read(&ssi->tx_usecnt))
                        break;
-               /* Else, fall through */
+               fallthrough;
        case RECEIVING:
                mod_timer(&ssi->keep_alive, jiffies +
                                                msecs_to_jiffies(SSIP_KATOUT));
@@ -466,7 +466,7 @@ static void ssip_keep_alive(struct timer_list *t)
                case SEND_READY:
                        if (atomic_read(&ssi->tx_usecnt) == 0)
                                break;
-                       /* Fall through */
+                       fallthrough;
                        /*
                         * Workaround for cmt-speech in that case
                         * we relay on audio timers.
@@ -668,7 +668,7 @@ static void ssip_rx_bootinforeq(struct hsi_client *cl, u32 cmd)
        case ACTIVE:
                dev_err(&cl->device, "Boot info req on active state\n");
                ssip_error(cl);
-               /* Fall through */
+               fallthrough;
        case INIT:
        case HANDSHAKE:
                spin_lock_bh(&ssi->lock);
index 4bc4a201f0f6c2186c667a583e98409cfe08ddb4..fa69b94debd9b584d4b5041b23cb31439dae2f10 100644 (file)
@@ -296,7 +296,7 @@ static int ssi_clk_event(struct notifier_block *nb, unsigned long event,
                break;
        case ABORT_RATE_CHANGE:
                dev_dbg(&ssi->device, "abort rate change\n");
-               /* Fall through */
+               fallthrough;
        case POST_RATE_CHANGE:
                dev_dbg(&ssi->device, "post rate change (%lu -> %lu)\n",
                        clk_data->old_rate, clk_data->new_rate);
index 591106cf58fc086c5a683da02ab8bd4204fbb069..1d44bb635bb8450eece2e5f655314475ce33f896 100644 (file)
@@ -731,7 +731,7 @@ static void vmbus_wait_for_unload(void)
        void *page_addr;
        struct hv_message *msg;
        struct vmbus_channel_message_header *hdr;
-       u32 message_type;
+       u32 message_type, i;
 
        /*
         * CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was
@@ -741,8 +741,11 @@ static void vmbus_wait_for_unload(void)
         * functional and vmbus_unload_response() will complete
         * vmbus_connection.unload_event. If not, the last thing we can do is
         * read message pages for all CPUs directly.
+        *
+        * Wait no more than 10 seconds so that the panic path can't get
+        * hung forever in case the response message isn't seen.
         */
-       while (1) {
+       for (i = 0; i < 1000; i++) {
                if (completion_done(&vmbus_connection.unload_event))
                        break;
 
index e74b144b8f3d40be819f59b0d13bc1181d8bdcb5..754d35a25a1cc184bfe9aec0543e79be9633ae47 100644 (file)
@@ -354,7 +354,7 @@ static void process_ib_ipinfo(void *in_msg, void *out_msg, int op)
 
                out->body.kvp_ip_val.dhcp_enabled = in->kvp_ip_val.dhcp_enabled;
 
-               /* fallthrough */
+               fallthrough;
 
        case KVP_OP_GET_IP_INFO:
                utf16s_to_utf8s((wchar_t *)in->kvp_ip_val.adapter_id,
index 92ee0fe4c919ec7171c76e15d96e532334cf7396..a4e8d96513c22ed5b06c6944108e71f5857b9e4d 100644 (file)
@@ -282,26 +282,52 @@ static struct {
        spinlock_t                      lock;
 } host_ts;
 
-static struct timespec64 hv_get_adj_host_time(void)
+static inline u64 reftime_to_ns(u64 reftime)
 {
-       struct timespec64 ts;
-       u64 newtime, reftime;
+       return (reftime - WLTIMEDELTA) * 100;
+}
+
+/*
+ * Hard coded threshold for host timesync delay: 600 seconds
+ */
+static const u64 HOST_TIMESYNC_DELAY_THRESH = 600 * (u64)NSEC_PER_SEC;
+
+static int hv_get_adj_host_time(struct timespec64 *ts)
+{
+       u64 newtime, reftime, timediff_adj;
        unsigned long flags;
+       int ret = 0;
 
        spin_lock_irqsave(&host_ts.lock, flags);
        reftime = hv_read_reference_counter();
-       newtime = host_ts.host_time + (reftime - host_ts.ref_time);
-       ts = ns_to_timespec64((newtime - WLTIMEDELTA) * 100);
+
+       /*
+        * We need to let the caller know that last update from host
+        * is older than the max allowable threshold. clock_gettime()
+        * and PTP ioctl do not have a documented error that we could
+        * return for this specific case. Use ESTALE to report this.
+        */
+       timediff_adj = reftime - host_ts.ref_time;
+       if (timediff_adj * 100 > HOST_TIMESYNC_DELAY_THRESH) {
+               pr_warn_once("TIMESYNC IC: Stale time stamp, %llu nsecs old\n",
+                            (timediff_adj * 100));
+               ret = -ESTALE;
+       }
+
+       newtime = host_ts.host_time + timediff_adj;
+       *ts = ns_to_timespec64(reftime_to_ns(newtime));
        spin_unlock_irqrestore(&host_ts.lock, flags);
 
-       return ts;
+       return ret;
 }
 
 static void hv_set_host_time(struct work_struct *work)
 {
-       struct timespec64 ts = hv_get_adj_host_time();
 
-       do_settimeofday64(&ts);
+       struct timespec64 ts;
+
+       if (!hv_get_adj_host_time(&ts))
+               do_settimeofday64(&ts);
 }
 
 /*
@@ -361,10 +387,23 @@ static void timesync_onchannelcallback(void *context)
        struct ictimesync_ref_data *refdata;
        u8 *time_txf_buf = util_timesynch.recv_buffer;
 
-       vmbus_recvpacket(channel, time_txf_buf,
-                        HV_HYP_PAGE_SIZE, &recvlen, &requestid);
+       /*
+        * Drain the ring buffer and use the last packet to update
+        * host_ts
+        */
+       while (1) {
+               int ret = vmbus_recvpacket(channel, time_txf_buf,
+                                          HV_HYP_PAGE_SIZE, &recvlen,
+                                          &requestid);
+               if (ret) {
+                       pr_warn_once("TimeSync IC pkt recv failed (Err: %d)\n",
+                                    ret);
+                       break;
+               }
+
+               if (!recvlen)
+                       break;
 
-       if (recvlen > 0) {
                icmsghdrp = (struct icmsg_hdr *)&time_txf_buf[
                                sizeof(struct vmbuspipe_hdr)];
 
@@ -622,9 +661,7 @@ static int hv_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
 
 static int hv_ptp_gettime(struct ptp_clock_info *info, struct timespec64 *ts)
 {
-       *ts = hv_get_adj_host_time();
-
-       return 0;
+       return hv_get_adj_host_time(ts);
 }
 
 static struct ptp_clock_info ptp_hyperv_info = {
index 910b6e90866cae242f5c26037341e91732a5fb6c..946d0aba101f4adb16fc7a3412e7456e9715443d 100644 (file)
@@ -2382,7 +2382,10 @@ static int vmbus_bus_suspend(struct device *dev)
        if (atomic_read(&vmbus_connection.nr_chan_close_on_suspend) > 0)
                wait_for_completion(&vmbus_connection.ready_for_suspend_event);
 
-       WARN_ON(atomic_read(&vmbus_connection.nr_chan_fixup_on_resume) != 0);
+       if (atomic_read(&vmbus_connection.nr_chan_fixup_on_resume) != 0) {
+               pr_err("Can not suspend due to a previous failed resuming\n");
+               return -EBUSY;
+       }
 
        mutex_lock(&vmbus_connection.channel_mutex);
 
@@ -2456,7 +2459,9 @@ static int vmbus_bus_resume(struct device *dev)
 
        vmbus_request_offers();
 
-       wait_for_completion(&vmbus_connection.ready_for_resume_event);
+       if (wait_for_completion_timeout(
+               &vmbus_connection.ready_for_resume_event, 10 * HZ) == 0)
+               pr_err("Some vmbus device is missing after suspending?\n");
 
        /* Reset the event for the next suspend. */
        reinit_completion(&vmbus_connection.ready_for_suspend_event);
index 319a0519ebdb0f44a675cd241a85a114b2b8dc7f..208813158bb405539044480fe13c921d0247be1d 100644 (file)
@@ -435,7 +435,7 @@ static const char *voltage_label(struct adt7462_data *data, int which)
                case 3:
                        return "+1.5V";
                }
-               /* fall through */
+               fallthrough;
        case 2:
                if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
                        return "+12V3";
@@ -493,7 +493,7 @@ static const char *voltage_label(struct adt7462_data *data, int which)
                case 3:
                        return "+1.5";
                }
-               /* fall through */
+               fallthrough;
        case 11:
                if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
                                        ADT7462_PIN28_VOLT &&
@@ -531,7 +531,7 @@ static int voltage_multiplier(struct adt7462_data *data, int which)
                case 3:
                        return 7800;
                }
-               /* fall through */
+               fallthrough;
        case 2:
                if (!(data->pin_cfg[1] & ADT7462_PIN22_INPUT))
                        return 62500;
@@ -589,7 +589,7 @@ static int voltage_multiplier(struct adt7462_data *data, int which)
                case 3:
                        return 7800;
                }
-               /* fall through */
+               fallthrough;
        case 11:
        case 12:
                if (data->pin_cfg[3] >> ADT7462_PIN28_SHIFT ==
index 31661840931577e54cc75e654ec6b4f86af630c0..a18887990f4a2120c45c0d2ef744df7353b54fc8 100644 (file)
@@ -753,15 +753,18 @@ static ssize_t applesmc_light_show(struct device *dev,
        }
 
        ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length);
+       if (ret)
+               goto out;
        /* newer macbooks report a single 10-bit bigendian value */
        if (data_length == 10) {
                left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
                goto out;
        }
        left = buffer[2];
+
+       ret = applesmc_read_key(LIGHT_SENSOR_RIGHT_KEY, buffer, data_length);
        if (ret)
                goto out;
-       ret = applesmc_read_key(LIGHT_SENSOR_RIGHT_KEY, buffer, data_length);
        right = buffer[2];
 
 out:
@@ -810,12 +813,11 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,
                  to_index(attr));
 
        ret = applesmc_read_key(newkey, buffer, 2);
-       speed = ((buffer[0] << 8 | buffer[1]) >> 2);
-
        if (ret)
                return ret;
-       else
-               return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", speed);
+
+       speed = ((buffer[0] << 8 | buffer[1]) >> 2);
+       return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", speed);
 }
 
 static ssize_t applesmc_store_fan_speed(struct device *dev,
@@ -851,12 +853,11 @@ static ssize_t applesmc_show_fan_manual(struct device *dev,
        u8 buffer[2];
 
        ret = applesmc_read_key(FANS_MANUAL, buffer, 2);
-       manual = ((buffer[0] << 8 | buffer[1]) >> to_index(attr)) & 0x01;
-
        if (ret)
                return ret;
-       else
-               return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", manual);
+
+       manual = ((buffer[0] << 8 | buffer[1]) >> to_index(attr)) & 0x01;
+       return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", manual);
 }
 
 static ssize_t applesmc_store_fan_manual(struct device *dev,
@@ -872,10 +873,11 @@ static ssize_t applesmc_store_fan_manual(struct device *dev,
                return -EINVAL;
 
        ret = applesmc_read_key(FANS_MANUAL, buffer, 2);
-       val = (buffer[0] << 8 | buffer[1]);
        if (ret)
                goto out;
 
+       val = (buffer[0] << 8 | buffer[1]);
+
        if (input)
                val = val | (0x01 << to_index(attr));
        else
@@ -951,13 +953,12 @@ static ssize_t applesmc_key_count_show(struct device *dev,
        u32 count;
 
        ret = applesmc_read_key(KEY_COUNT_KEY, buffer, 4);
-       count = ((u32)buffer[0]<<24) + ((u32)buffer[1]<<16) +
-                                               ((u32)buffer[2]<<8) + buffer[3];
-
        if (ret)
                return ret;
-       else
-               return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", count);
+
+       count = ((u32)buffer[0]<<24) + ((u32)buffer[1]<<16) +
+                                               ((u32)buffer[2]<<8) + buffer[3];
+       return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", count);
 }
 
 static ssize_t applesmc_key_at_index_read_show(struct device *dev,
index cf0962f7a02033a9f3112f9e0df241399a538fa9..e9c0bbc2caa95636411a069c2debbca451656bad 100644 (file)
@@ -406,10 +406,10 @@ static int emc1403_probe(struct i2c_client *client,
        switch (id->driver_data) {
        case emc1404:
                data->groups[2] = &emc1404_group;
-               /* fall through */
+               fallthrough;
        case emc1403:
                data->groups[1] = &emc1403_group;
-               /* fall through */
+               fallthrough;
        case emc1402:
                data->groups[0] = &emc1402_group;
        }
index d09deb409de7a0b4a918c02c0a5d7cbede17fa14..4dec793fd07d576caa8c9ae5b4ff1b38ad9a6f1b 100644 (file)
@@ -1285,7 +1285,7 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev)
                                data->pwm_auto_point_pwm[nr][0] =
                                        f71882fg_read8(data,
                                                F71882FG_REG_POINT_PWM(nr, 0));
-                               /* Fall through */
+                               fallthrough;
                        case f71862fg:
                                data->pwm_auto_point_pwm[nr][1] =
                                        f71882fg_read8(data,
@@ -2442,7 +2442,7 @@ static int f71882fg_probe(struct platform_device *pdev)
                case f71869a:
                        /* These always have signed auto point temps */
                        data->auto_point_temp_signed = 1;
-                       /* Fall through - to select correct fan/pwm reg bank! */
+                       fallthrough;    /* to select correct fan/pwm reg bank! */
                case f71889fg:
                case f71889ed:
                case f71889a:
index 3dfe2ca2f8c89cad51f015516f2224a9e3d7092b..c6d4567f395205da803451431ca380bce5240c80 100644 (file)
@@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
        case mode_temperature:
                if (tmp > 0x8000)
                        tmp -= 0xffff;
+               tmp *= 100; /* convert to millidegrees celsius */
                break;
        case mode_voltage_raw:
                tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION));
index eb72e390844ecddf10db5b9b5b765e2560d96a81..6d1175a5183264e8f4ef39e9e86ce6510fd65c35 100644 (file)
@@ -96,7 +96,7 @@ int vid_from_reg(int val, u8 vrm)
                val &= 0x1f;
                if (val == 0x1f)
                        return 0;
-                               /* fall through */
+               fallthrough;
        case 25:                /* AMD NPT 0Fh */
                val &= 0x3f;
                return (val < 32) ? 1550 - 25 * val
@@ -122,7 +122,7 @@ int vid_from_reg(int val, u8 vrm)
 
        case 84:                /* VRM 8.4 */
                val &= 0x0f;
-                               /* fall through */
+               fallthrough;
        case 82:                /* VRM 8.2 */
                val &= 0x1f;
                return val == 0x1f ? 0 :
index 7fc5b065ad8b238aabacae137025b7506e0f89d2..81e155692aba57631fc2f26a7584908156681a18 100644 (file)
@@ -352,7 +352,7 @@ static int ina3221_read_curr(struct device *dev, u32 attr,
                if (ret)
                        return ret;
 
-               /* fall through */
+               fallthrough;
        case hwmon_curr_crit:
        case hwmon_curr_max:
                if (!resistance_uo)
index 750b08713dee50434afc2ac0da80a1bd8ec9e81d..5bd15622a85f942ea7eefbf1b80124640bb368c7 100644 (file)
@@ -2669,7 +2669,7 @@ static void pwm_update_registers(struct nct6775_data *data, int nr)
        case thermal_cruise:
                nct6775_write_value(data, data->REG_TARGET[nr],
                                    data->target_temp[nr]);
-               /* fall through  */
+               fallthrough;
        default:
                reg = nct6775_read_value(data, data->REG_FAN_MODE[nr]);
                reg = (reg & ~data->tolerance_mask) |
index b0425694f702252e250e28e7b57aded40a5b6017..242ff8bee78dd718405210800e9086c67faac77f 100644 (file)
@@ -231,7 +231,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel,
                if (ret < 0)
                        return ret;
                cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
-               if (cnt == 0x1fff)
+               if (cnt == 0 || cnt == 0x1fff)
                        rpm = 0;
                else
                        rpm = 1350000 / cnt;
@@ -243,7 +243,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel,
                if (ret < 0)
                        return ret;
                cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
-               if (cnt == 0x1fff)
+               if (cnt == 0 || cnt == 0x1fff)
                        rpm = 0;
                else
                        rpm = 1350000 / cnt;
index 30e18eb60da79eb61ba9194a056de8a2198311ad..a71777990d49606a57b1f7ced79bf0e154bb1987 100644 (file)
@@ -752,7 +752,7 @@ static int occ_setup_sensor_attrs(struct occ *occ)
        switch (sensors->freq.version) {
        case 2:
                show_freq = occ_show_freq_2;
-               /* fall through */
+               fallthrough;
        case 1:
                num_attrs += (sensors->freq.num_sensors * 2);
                break;
@@ -763,7 +763,7 @@ static int occ_setup_sensor_attrs(struct occ *occ)
        switch (sensors->power.version) {
        case 2:
                show_power = occ_show_power_2;
-               /* fall through */
+               fallthrough;
        case 1:
                num_attrs += (sensors->power.num_sensors * 4);
                break;
@@ -781,7 +781,7 @@ static int occ_setup_sensor_attrs(struct occ *occ)
                break;
        case 3:
                show_caps = occ_show_caps_3;
-               /* fall through */
+               fallthrough;
        case 2:
                num_attrs += (sensors->caps.num_sensors * 8);
                break;
index 0c622711ef7e0e926a20980961e98322d7663d9e..58aa95a3c010cd81139ee037a68d88b63c1ae712 100644 (file)
@@ -67,6 +67,7 @@ enum variants {
        raa_dmpvr1_2rail,
        raa_dmpvr2_1rail,
        raa_dmpvr2_2rail,
+       raa_dmpvr2_2rail_nontc,
        raa_dmpvr2_3rail,
        raa_dmpvr2_hv,
 };
@@ -241,6 +242,10 @@ static int isl68137_probe(struct i2c_client *client,
                info->pages = 1;
                info->read_word_data = raa_dmpvr2_read_word_data;
                break;
+       case raa_dmpvr2_2rail_nontc:
+               info->func[0] &= ~PMBUS_HAVE_TEMP;
+               info->func[1] &= ~PMBUS_HAVE_TEMP;
+               fallthrough;
        case raa_dmpvr2_2rail:
                info->pages = 2;
                info->read_word_data = raa_dmpvr2_read_word_data;
@@ -304,7 +309,7 @@ static const struct i2c_device_id raa_dmpvr_id[] = {
        {"raa228000", raa_dmpvr2_hv},
        {"raa228004", raa_dmpvr2_hv},
        {"raa228006", raa_dmpvr2_hv},
-       {"raa228228", raa_dmpvr2_2rail},
+       {"raa228228", raa_dmpvr2_2rail_nontc},
        {"raa229001", raa_dmpvr2_2rail},
        {"raa229004", raa_dmpvr2_2rail},
        {}
index e1d10a6b7f7c058e2972c27dd75fd74baa6b9ee5..a07b97400cba3571691cc6637a0721a18197daed 100644 (file)
@@ -1213,7 +1213,7 @@ temp_type_store(struct device *dev, struct device_attribute *devattr,
        case W83781D_DEFAULT_BETA:
                dev_warn(dev, "Sensor type %d is deprecated, please use 4 "
                         "instead\n", W83781D_DEFAULT_BETA);
-               /* fall through */
+               fallthrough;
        case 4:         /* thermistor */
                tmp = w83627hf_read_value(data, W83781D_REG_SCFG1);
                w83627hf_write_value(data, W83781D_REG_SCFG1,
index 015f1ea319669eff7932daf49456a6638b9a7add..d833a4f16c47b85f15fc8b340d036c5ce25823de 100644 (file)
@@ -814,7 +814,7 @@ store_sensor(struct device *dev, struct device_attribute *da,
                dev_warn(dev,
                         "Sensor type %d is deprecated, please use 4 instead\n",
                         W83781D_DEFAULT_BETA);
-               /* fall through */
+               fallthrough;
        case 4:         /* thermistor */
                tmp = w83781d_read_value(data, W83781D_REG_SCFG1);
                w83781d_write_value(data, W83781D_REG_SCFG1,
index 44f68b965aec300f0e0b481d88b2426031d4334f..6d52b530b429dc899ca248b8e6beffbd88c35aad 100644 (file)
@@ -2127,7 +2127,7 @@ static void w83795_apply_temp_config(struct w83795_data *data, u8 config,
                if (temp_chan >= 4)
                        break;
                data->temp_mode |= 1 << temp_chan;
-               /* fall through */
+               fallthrough;
        case 0x3: /* Thermistor */
                data->has_temp |= 1 << temp_chan;
                break;
index 96544b348c273fe3ede7ac5e40547afd8b4322bc..7e642fb3ed15cc1713b0dbb7ffcbc9e93ab84404 100644 (file)
@@ -346,10 +346,10 @@ static void debug_init_arch_data(void *info)
        switch (mode) {
        case EDDEVID_IMPL_FULL:
                drvdata->edvidsr_present = true;
-               /* Fall through */
+               fallthrough;
        case EDDEVID_IMPL_EDPCSR_EDCIDSR:
                drvdata->edcidsr_present = true;
-               /* Fall through */
+               fallthrough;
        case EDDEVID_IMPL_EDPCSR:
                /*
                 * In ARM DDI 0487A.k, the EDDEVID1.PCSROffset is used to
index 6d7d2169bfb26738a14bc4df8d4c79e406943635..96425e818fc20f86f26878fb8a3c76054716dc79 100644 (file)
@@ -1382,7 +1382,6 @@ static int etm4_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd,
                                return NOTIFY_BAD;
                break;
        case CPU_PM_EXIT:
-               /* fallthrough */
        case CPU_PM_ENTER_FAILED:
                if (drvdata->state_needs_restore)
                        etm4_cpu_restore(drvdata);
index 7040d583bed9e958d066539a277fec558dfee904..9ca3aaafcfbc272ff4e2db133cf2b031e87ec1be 100644 (file)
@@ -84,9 +84,7 @@ u32 tmc_get_memwidth_mask(struct tmc_drvdata *drvdata)
         */
        switch (drvdata->memwidth) {
        case TMC_MEM_INTF_WIDTH_32BITS:
-       /* fallthrough */
        case TMC_MEM_INTF_WIDTH_64BITS:
-       /* fallthrough */
        case TMC_MEM_INTF_WIDTH_128BITS:
                mask = GENMASK(31, 4);
                break;
index a1529f571491d991aec1513ce007758077ca96b0..9ca8c4e045f8b6c95099d04a2131fe5955cb278d 100644 (file)
@@ -84,11 +84,11 @@ static ssize_t notrace sth_stm_packet(struct stm_data *stm_data,
        /* Global packets (GERR, XSYNC, TRIG) are sent with register writes */
        case STP_PACKET_GERR:
                reg += 4;
-               /* fall through */
+               fallthrough;
 
        case STP_PACKET_XSYNC:
                reg += 8;
-               /* fall through */
+               fallthrough;
 
        case STP_PACKET_TRIG:
                if (flags & STP_PACKET_TIMESTAMPED)
index 710fbef9a9c2099f50a6d44a6ff583f4ae10cf43..384af88e58adaeb99cce13cb7f21cef812607280 100644 (file)
@@ -41,8 +41,22 @@ static void pca_reset(struct i2c_algo_pca_data *adap)
                pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IPRESET);
                pca_outw(adap, I2C_PCA_IND, 0xA5);
                pca_outw(adap, I2C_PCA_IND, 0x5A);
+
+               /*
+                * After a reset we need to re-apply any configuration
+                * (calculated in pca_init) to get the bus in a working state.
+                */
+               pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IMODE);
+               pca_outw(adap, I2C_PCA_IND, adap->bus_settings.mode);
+               pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_ISCLL);
+               pca_outw(adap, I2C_PCA_IND, adap->bus_settings.tlow);
+               pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_ISCLH);
+               pca_outw(adap, I2C_PCA_IND, adap->bus_settings.thi);
+
+               pca_set_con(adap, I2C_PCA_CON_ENSIO);
        } else {
                adap->reset_chip(adap->data);
+               pca_set_con(adap, I2C_PCA_CON_ENSIO | adap->bus_settings.clock_freq);
        }
 }
 
@@ -423,13 +437,14 @@ static int pca_init(struct i2c_adapter *adap)
                                " Use the nominal frequency.\n", adap->name);
                }
 
-               pca_reset(pca_data);
-
                clock = pca_clock(pca_data);
                printk(KERN_INFO "%s: Clock frequency is %dkHz\n",
                     adap->name, freqs[clock]);
 
-               pca_set_con(pca_data, I2C_PCA_CON_ENSIO | clock);
+               /* Store settings as these will be needed when the PCA chip is reset */
+               pca_data->bus_settings.clock_freq = clock;
+
+               pca_reset(pca_data);
        } else {
                int clock;
                int mode;
@@ -496,19 +511,15 @@ static int pca_init(struct i2c_adapter *adap)
                        thi = tlow * min_thi / min_tlow;
                }
 
+               /* Store settings as these will be needed when the PCA chip is reset */
+               pca_data->bus_settings.mode = mode;
+               pca_data->bus_settings.tlow = tlow;
+               pca_data->bus_settings.thi = thi;
+
                pca_reset(pca_data);
 
                printk(KERN_INFO
                     "%s: Clock frequency is %dHz\n", adap->name, clock * 100);
-
-               pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_IMODE);
-               pca_outw(pca_data, I2C_PCA_IND, mode);
-               pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_ISCLL);
-               pca_outw(pca_data, I2C_PCA_IND, tlow);
-               pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_ISCLH);
-               pca_outw(pca_data, I2C_PCA_IND, thi);
-
-               pca_set_con(pca_data, I2C_PCA_CON_ENSIO);
        }
        udelay(500); /* 500 us for oscillator to stabilise */
 
index 31268074c4221e287bf933e593540e261cce97de..724bf30600d609539a455648ed3fb24d42431c2c 100644 (file)
@@ -69,6 +69,7 @@
  * These share bit definitions, so use the same values for the enable &
  * status bits.
  */
+#define ASPEED_I2CD_INTR_RECV_MASK                     0xf000ffff
 #define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT                        BIT(14)
 #define ASPEED_I2CD_INTR_BUS_RECOVER_DONE              BIT(13)
 #define ASPEED_I2CD_INTR_SLAVE_MATCH                   BIT(7)
@@ -604,6 +605,7 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id)
        writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE,
               bus->base + ASPEED_I2C_INTR_STS_REG);
        readl(bus->base + ASPEED_I2C_INTR_STS_REG);
+       irq_received &= ASPEED_I2CD_INTR_RECV_MASK;
        irq_remaining = irq_received;
 
 #if IS_ENABLED(CONFIG_I2C_SLAVE)
index 688e92818821463fa97869059d54e071ef45de36..d8295b1c379d1b947fefde1e6a7ab5a6faebc395 100644 (file)
@@ -720,7 +720,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c,
 
                        /* mark the last byte */
                        if (!process_call && (i == msg->len - 1))
-                               val |= 1 << M_TX_WR_STATUS_SHIFT;
+                               val |= BIT(M_TX_WR_STATUS_SHIFT);
 
                        iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val);
                }
@@ -738,7 +738,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c,
                 */
                addr = i2c_8bit_addr_from_msg(msg);
                /* mark it the last byte out */
-               val = addr | (1 << M_TX_WR_STATUS_SHIFT);
+               val = addr | BIT(M_TX_WR_STATUS_SHIFT);
                iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val);
        }
 
index e32ef3f01fe8b841170c00750f7afc77b6adc6e1..ebb4c0b03057de4811440a8c09bcb45d5ee1055c 100644 (file)
@@ -1709,6 +1709,16 @@ static inline int i801_acpi_probe(struct i801_priv *priv) { return 0; }
 static inline void i801_acpi_remove(struct i801_priv *priv) { }
 #endif
 
+static unsigned char i801_setup_hstcfg(struct i801_priv *priv)
+{
+       unsigned char hstcfg = priv->original_hstcfg;
+
+       hstcfg &= ~SMBHSTCFG_I2C_EN;    /* SMBus timing */
+       hstcfg |= SMBHSTCFG_HST_EN;
+       pci_write_config_byte(priv->pci_dev, SMBHSTCFG, hstcfg);
+       return hstcfg;
+}
+
 static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
        unsigned char temp;
@@ -1830,14 +1840,10 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
                return err;
        }
 
-       pci_read_config_byte(priv->pci_dev, SMBHSTCFG, &temp);
-       priv->original_hstcfg = temp;
-       temp &= ~SMBHSTCFG_I2C_EN;      /* SMBus timing */
-       if (!(temp & SMBHSTCFG_HST_EN)) {
+       pci_read_config_byte(priv->pci_dev, SMBHSTCFG, &priv->original_hstcfg);
+       temp = i801_setup_hstcfg(priv);
+       if (!(priv->original_hstcfg & SMBHSTCFG_HST_EN))
                dev_info(&dev->dev, "Enabling SMBus device\n");
-               temp |= SMBHSTCFG_HST_EN;
-       }
-       pci_write_config_byte(priv->pci_dev, SMBHSTCFG, temp);
 
        if (temp & SMBHSTCFG_SMB_SMI_EN) {
                dev_dbg(&dev->dev, "SMBus using interrupt SMI#\n");
@@ -1952,10 +1958,9 @@ static void i801_shutdown(struct pci_dev *dev)
 #ifdef CONFIG_PM_SLEEP
 static int i801_suspend(struct device *dev)
 {
-       struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct i801_priv *priv = pci_get_drvdata(pci_dev);
+       struct i801_priv *priv = dev_get_drvdata(dev);
 
-       pci_write_config_byte(pci_dev, SMBHSTCFG, priv->original_hstcfg);
+       pci_write_config_byte(priv->pci_dev, SMBHSTCFG, priv->original_hstcfg);
        return 0;
 }
 
@@ -1963,6 +1968,7 @@ static int i801_resume(struct device *dev)
 {
        struct i801_priv *priv = dev_get_drvdata(dev);
 
+       i801_setup_hstcfg(priv);
        i801_enable_host_notify(&priv->adapter);
 
        return 0;
index efc14041d45b3edce56e4046ef64a8db208285c2..0cbdfbe605b55ebdcb3cb25e1ccac224ad9fabe2 100644 (file)
@@ -681,8 +681,8 @@ static int mtk_i2c_calculate_speed(struct mtk_i2c *i2c, unsigned int clk_src,
        unsigned int cnt_mul;
        int ret = -EINVAL;
 
-       if (target_speed > I2C_MAX_FAST_MODE_PLUS_FREQ)
-               target_speed = I2C_MAX_FAST_MODE_PLUS_FREQ;
+       if (target_speed > I2C_MAX_HIGH_SPEED_MODE_FREQ)
+               target_speed = I2C_MAX_HIGH_SPEED_MODE_FREQ;
 
        max_step_cnt = mtk_i2c_max_step_cnt(target_speed);
        base_step_cnt = max_step_cnt;
@@ -759,7 +759,7 @@ static int mtk_i2c_set_speed(struct mtk_i2c *i2c, unsigned int parent_clk)
        for (clk_div = 1; clk_div <= max_clk_div; clk_div++) {
                clk_src = parent_clk / clk_div;
 
-               if (target_speed > I2C_MAX_FAST_MODE_FREQ) {
+               if (target_speed > I2C_MAX_FAST_MODE_PLUS_FREQ) {
                        /* Set master code speed register */
                        ret = mtk_i2c_calculate_speed(i2c, clk_src,
                                                      I2C_MAX_FAST_MODE_FREQ,
index 9587347447f0f488ed1c8381f6e80eca16a6d055..c4b08a9244614d00bb3d5edb4049beaebd1e8646 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/of_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
+#include <linux/dma/mxs-dma.h>
 
 #define DRIVER_NAME "mxs-i2c"
 
@@ -200,7 +201,8 @@ static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap,
                dma_map_sg(i2c->dev, &i2c->sg_io[0], 1, DMA_TO_DEVICE);
                desc = dmaengine_prep_slave_sg(i2c->dmach, &i2c->sg_io[0], 1,
                                        DMA_MEM_TO_DEV,
-                                       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+                                       DMA_PREP_INTERRUPT |
+                                       MXS_DMA_CTRL_WAIT4END);
                if (!desc) {
                        dev_err(i2c->dev,
                                "Failed to get DMA data write descriptor.\n");
@@ -228,7 +230,8 @@ static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap,
                dma_map_sg(i2c->dev, &i2c->sg_io[1], 1, DMA_FROM_DEVICE);
                desc = dmaengine_prep_slave_sg(i2c->dmach, &i2c->sg_io[1], 1,
                                        DMA_DEV_TO_MEM,
-                                       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+                                       DMA_PREP_INTERRUPT |
+                                       MXS_DMA_CTRL_WAIT4END);
                if (!desc) {
                        dev_err(i2c->dev,
                                "Failed to get DMA data write descriptor.\n");
@@ -260,7 +263,8 @@ static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap,
                dma_map_sg(i2c->dev, i2c->sg_io, 2, DMA_TO_DEVICE);
                desc = dmaengine_prep_slave_sg(i2c->dmach, i2c->sg_io, 2,
                                        DMA_MEM_TO_DEV,
-                                       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+                                       DMA_PREP_INTERRUPT |
+                                       MXS_DMA_CTRL_WAIT4END);
                if (!desc) {
                        dev_err(i2c->dev,
                                "Failed to get DMA data write descriptor.\n");
index 75f07138a6fa25d19463c659dc3c7e886daf4dee..dfcf04e1967f1743db35b82a7c62532a1d57ac36 100644 (file)
@@ -2093,8 +2093,12 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
                }
        }
 
-       /* Adaptive TimeOut: astimated time in usec + 100% margin */
-       timeout_usec = (2 * 10000 / bus->bus_freq) * (2 + nread + nwrite);
+       /*
+        * Adaptive TimeOut: estimated time in usec + 100% margin:
+        * 2: double the timeout for clock stretching case
+        * 9: bits per transaction (including the ack/nack)
+        */
+       timeout_usec = (2 * 9 * USEC_PER_SEC / bus->bus_freq) * (2 + nread + nwrite);
        timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec));
        if (nwrite >= 32 * 1024 || nread >= 32 * 1024) {
                dev_err(bus->dev, "i2c%d buffer too big\n", bus->num);
index 175c590b93b76cbd72b8270ced91a78dad14ddae..12ac4212aded893fac85613c507454f3c1ebc506 100644 (file)
@@ -1425,7 +1425,6 @@ omap_i2c_probe(struct platform_device *pdev)
                major = OMAP_I2C_REV_SCHEME_0_MAJOR(omap->rev);
                break;
        case OMAP_I2C_SCHEME_1:
-               /* FALLTHROUGH */
        default:
                omap->regs = (u8 *)reg_map_ip_v2;
                rev = (rev << 16) |
index 1c4c9bb06a0bfbff9ac054c21d56808dacdf0fe6..6eb0f50c5d2878d73e1395bfe0c8e209bceb7c07 100644 (file)
@@ -125,7 +125,7 @@ static int i2c_opal_smbus_xfer(struct i2c_adapter *adap, u16 addr,
        case I2C_SMBUS_BYTE:
                req.buffer_ra = cpu_to_be64(__pa(&data->byte));
                req.size = cpu_to_be32(1);
-               /* Fall through */
+               fallthrough;
        case I2C_SMBUS_QUICK:
                req.type = (read_write == I2C_SMBUS_READ) ?
                        OPAL_I2C_RAW_READ : OPAL_I2C_RAW_WRITE;
index 9e883474db8ceb3894c3fd789d4671e3379e5439..c7c543483b08caebb5395829d88434b7db15e100 100644 (file)
@@ -590,6 +590,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
        /* master sent stop */
        if (ssr_filtered & SSR) {
                i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value);
+               rcar_i2c_write(priv, ICSCR, SIE | SDBS); /* clear our NACK */
                rcar_i2c_write(priv, ICSIER, SAR);
                rcar_i2c_write(priv, ICSSR, ~SSR & 0xff);
        }
index 2ade99b105b91e263aa14e0463a1098e844b25ce..e627d7b2790f75c5656bc9ef58afa823e8cbefbf 100644 (file)
@@ -276,16 +276,6 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap)
                dev_warn(&adap->dev, "failed to enumerate I2C slaves\n");
 }
 
-const struct acpi_device_id *
-i2c_acpi_match_device(const struct acpi_device_id *matches,
-                     struct i2c_client *client)
-{
-       if (!(client && matches))
-               return NULL;
-
-       return acpi_match_device(matches, &client->dev);
-}
-
 static const struct acpi_device_id i2c_acpi_force_400khz_device_ids[] = {
        /*
         * These Silead touchscreen controllers only work at 400KHz, for
index 34a9609f256daca9854f76458b69a7e4f091a98d..573b5da145d1eb18d1066f9cf612366fceaf0191 100644 (file)
@@ -480,7 +480,7 @@ static int i2c_device_probe(struct device *dev)
         * or ACPI ID table is supplied for the probing device.
         */
        if (!driver->id_table &&
-           !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
+           !acpi_driver_match_device(dev, dev->driver) &&
            !i2c_of_match_device(dev->driver->of_match_table, client)) {
                status = -ENODEV;
                goto put_sync_adapter;
@@ -1464,8 +1464,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 
        /* create pre-declared device nodes */
        of_i2c_register_devices(adap);
-       i2c_acpi_register_devices(adap);
        i2c_acpi_install_space_handler(adap);
+       i2c_acpi_register_devices(adap);
 
        if (adap->nr < __i2c_first_dynamic_bus_num)
                i2c_scan_static_board_info(adap);
index 94ff1693b3913f4b0717c03420a0e56a2d4666a3..8ce261167a2d3d9d7f7a8f87979a79fe62351cd6 100644 (file)
@@ -59,20 +59,11 @@ static inline int __i2c_check_suspended(struct i2c_adapter *adap)
 }
 
 #ifdef CONFIG_ACPI
-const struct acpi_device_id *
-i2c_acpi_match_device(const struct acpi_device_id *matches,
-                     struct i2c_client *client);
 void i2c_acpi_register_devices(struct i2c_adapter *adap);
 
 int i2c_acpi_get_irq(struct i2c_client *client);
 #else /* CONFIG_ACPI */
 static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { }
-static inline const struct acpi_device_id *
-i2c_acpi_match_device(const struct acpi_device_id *matches,
-                     struct i2c_client *client)
-{
-       return NULL;
-}
 
 static inline int i2c_acpi_get_irq(struct i2c_client *client)
 {
index 5c5306cd50ec3bdefe4e32e61d9df1c0677a538d..8513bd353c052b1b89405aff3d4bae918d3b0c1d 100644 (file)
@@ -603,7 +603,7 @@ static int dw_i3c_master_bus_init(struct i3c_master_controller *m)
                ret = dw_i2c_clk_cfg(master);
                if (ret)
                        return ret;
-               /* fall through */
+               fallthrough;
        case I3C_BUS_MODE_PURE:
                ret = dw_i3c_clk_cfg(master);
                if (ret)
index fd3b5da44619b39852f7f538e3a40d70654c9569..50c9a41467c881e7966d41f390e1359333daac9c 100644 (file)
@@ -575,14 +575,14 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive)
                if (!HPT370_ALLOW_ATA100_5 ||
                    check_in_drive_list(drive, bad_ata100_5))
                        return ATA_UDMA4;
-               /* fall through */
+               fallthrough;
        case HPT372 :
        case HPT372A:
        case HPT372N:
        case HPT374 :
                if (ata_id_is_sata(drive->id))
                        mask &= ~0x0e;
-               /* fall through */
+               fallthrough;
        default:
                return mask;
        }
@@ -602,7 +602,7 @@ static u8 hpt3xx_mdma_filter(ide_drive_t *drive)
        case HPT374 :
                if (ata_id_is_sata(drive->id))
                        return 0x00;
-               /* fall through */
+               fallthrough;
        default:
                return 0x07;
        }
index 7f17f830398884ec5bd03c2f4e5cee0b60af4934..212bb2d8bf346a9309c206b7faae6086d2045b06 100644 (file)
@@ -350,7 +350,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
                 */
                if (scsi_req(rq)->cmd[0] == GPCMD_START_STOP_UNIT)
                        break;
-               /* fall-through */
+               fallthrough;
        case DATA_PROTECT:
                /*
                 * No point in retrying after an illegal request or data
@@ -750,7 +750,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
        case REQ_OP_DRV_IN:
        case REQ_OP_DRV_OUT:
                expiry = ide_cd_expiry;
-               /*FALLTHRU*/
+               fallthrough;
        default:
                timeout = ATAPI_WAIT_PC;
                break;
index 1fe1f9d37a511c27c17f3376ff300b788269af04..af7503b47dbe3296d491cb2b246f82f0b9456e75 100644 (file)
@@ -428,7 +428,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
                                 * (maintains previous driver behaviour)
                                 */
                                break;
-                       /* fall through */
+                       fallthrough;
                case CAPACITY_CURRENT:
                        /* Normal Zip/LS-120 disks */
                        if (memcmp(cap_desc, &floppy->cap_desc, 8))
index e867129466b058c4095aacb813f7c3fee6b3a7dd..1ddc45a04418cde357f71819b1e6a9318c35787c 100644 (file)
@@ -143,7 +143,7 @@ static void ide_classify_atapi_dev(ide_drive_t *drive)
                }
                /* Early cdrom models used zero */
                type = ide_cdrom;
-               /* fall through */
+               fallthrough;
        case ide_cdrom:
                drive->dev_flags |= IDE_DFLAG_REMOVABLE;
 #ifdef CONFIG_PPC
index a26f85ab58a95e813e79c03acfb672792af8ed13..d016cbe68cba17419ba279dc74dd041a8d11e288 100644 (file)
@@ -129,7 +129,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
                        return pre_task_out_intr(drive, cmd);
                }
                handler = task_pio_intr;
-               /* fall through */
+               fallthrough;
        case ATA_PROT_NODATA:
                if (handler == NULL)
                        handler = task_no_data_intr;
@@ -141,7 +141,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
                hwif->expiry = dma_ops->dma_timer_expiry;
                ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD);
                dma_ops->dma_start(drive);
-               /* fall through */
+               fallthrough;
        default:
                return ide_started;
        }
@@ -579,10 +579,10 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
                        goto abort;
                }
                cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
-               /* fall through */
+               fallthrough;
        case TASKFILE_OUT:
                cmd.protocol = ATA_PROT_PIO;
-               /* fall through */
+               fallthrough;
        case TASKFILE_OUT_DMAQ:
        case TASKFILE_OUT_DMA:
                cmd.tf_flags |= IDE_TFLAG_WRITE;
@@ -598,10 +598,10 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
                        goto abort;
                }
                cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
-               /* fall through */
+               fallthrough;
        case TASKFILE_IN:
                cmd.protocol = ATA_PROT_PIO;
-               /* fall through */
+               fallthrough;
        case TASKFILE_IN_DMAQ:
        case TASKFILE_IN_DMA:
                nsect = taskin / SECTOR_SIZE;
index 024bc7ba49ee5e8198b49a2f510ff05d0be70840..1a700bef6c565c2f5187e1b5a69a29c8b2d9882e 100644 (file)
@@ -494,7 +494,7 @@ static int init_chipset_sis5513(struct pci_dev *dev)
                pci_read_config_byte(dev, 0x09, &reg);
                if ((reg & 0x0f) != 0x00)
                        pci_write_config_byte(dev, 0x09, reg&0xf0);
-               /* fall through */
+               fallthrough;
        case ATA_16:
                /* force per drive recovery and active timings
                   needed on ATA_33 and below chips */
index 8e0fb1a5bdbd1e4fe81e6dfdef653d65f4bc28af..9a810e4a794603a1b28f86e7969d178e2463c447 100644 (file)
@@ -89,14 +89,6 @@ static unsigned int mwait_substates __initdata;
  */
 #define CPUIDLE_FLAG_ALWAYS_ENABLE     BIT(15)
 
-/*
- * Set this flag for states where the HW flushes the TLB for us
- * and so we don't need cross-calls to keep it consistent.
- * If this flag is set, SW flushes the TLB, so even if the
- * HW doesn't do the flushing, this flag is safe to use.
- */
-#define CPUIDLE_FLAG_TLB_FLUSHED       BIT(16)
-
 /*
  * MWAIT takes an 8-bit "hint" in EAX "suggesting"
  * the C-state (top nibble) and sub-state (bottom nibble)
@@ -131,14 +123,6 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
        unsigned long eax = flg2MWAIT(state->flags);
        unsigned long ecx = 1; /* break on interrupt flag */
        bool tick;
-       int cpu = smp_processor_id();
-
-       /*
-        * leave_mm() to avoid costly and often unnecessary wakeups
-        * for flushing the user TLB's associated with the active mm.
-        */
-       if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
-               leave_mm(cpu);
 
        if (!static_cpu_has(X86_FEATURE_ARAT)) {
                /*
index 24864d9dfab5d09e274c5d9529676af300f58c78..48435865fdaf34387b563b9ce025e00fddedcc0b 100644 (file)
@@ -189,6 +189,14 @@ struct bmc150_accel_data {
        struct mutex mutex;
        u8 fifo_mode, watermark;
        s16 buffer[8];
+       /*
+        * Ensure there is sufficient space and correct alignment for
+        * the timestamp if enabled
+        */
+       struct {
+               __le16 channels[3];
+               s64 ts __aligned(8);
+       } scan;
        u8 bw_bits;
        u32 slope_dur;
        u32 slope_thres;
@@ -922,15 +930,16 @@ static int __bmc150_accel_fifo_flush(struct iio_dev *indio_dev,
         * now.
         */
        for (i = 0; i < count; i++) {
-               u16 sample[8];
                int j, bit;
 
                j = 0;
                for_each_set_bit(bit, indio_dev->active_scan_mask,
                                 indio_dev->masklength)
-                       memcpy(&sample[j++], &buffer[i * 3 + bit], 2);
+                       memcpy(&data->scan.channels[j++], &buffer[i * 3 + bit],
+                              sizeof(data->scan.channels[0]));
 
-               iio_push_to_buffers_with_timestamp(indio_dev, sample, tstamp);
+               iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
+                                                  tstamp);
 
                tstamp += sample_period;
        }
index 66b2e4cf24cfab91f1a5a559d5f52fd97a58ce3b..0e18b92e20992a69fca70ffe585236f78e6cff8c 100644 (file)
@@ -209,14 +209,20 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p)
        const struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct kxsd9_state *st = iio_priv(indio_dev);
+       /*
+        * Ensure correct positioning and alignment of timestamp.
+        * No need to zero initialize as all elements written.
+        */
+       struct {
+               __be16 chan[4];
+               s64 ts __aligned(8);
+       } hw_values;
        int ret;
-       /* 4 * 16bit values AND timestamp */
-       __be16 hw_values[8];
 
        ret = regmap_bulk_read(st->map,
                               KXSD9_REG_X,
-                              &hw_values,
-                              8);
+                              hw_values.chan,
+                              sizeof(hw_values.chan));
        if (ret) {
                dev_err(st->dev,
                        "error reading data\n");
@@ -224,7 +230,7 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p)
        }
 
        iio_push_to_buffers_with_timestamp(indio_dev,
-                                          hw_values,
+                                          &hw_values,
                                           iio_get_time_ns(indio_dev));
        iio_trigger_notify_done(indio_dev->trig);
 
index 7e99bcb3398dff1356fbb8094f40eaa4d4437054..922bd38ff6ea971dcfb1e543314cb7969ba8b4e9 100644 (file)
 
 struct mma7455_data {
        struct regmap *regmap;
+       /*
+        * Used to reorganize data.  Will ensure correct alignment of
+        * the timestamp if present
+        */
+       struct {
+               __le16 channels[3];
+               s64 ts __aligned(8);
+       } scan;
 };
 
 static int mma7455_drdy(struct mma7455_data *mma7455)
@@ -82,19 +90,19 @@ static irqreturn_t mma7455_trigger_handler(int irq, void *p)
        struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct mma7455_data *mma7455 = iio_priv(indio_dev);
-       u8 buf[16]; /* 3 x 16-bit channels + padding + ts */
        int ret;
 
        ret = mma7455_drdy(mma7455);
        if (ret)
                goto done;
 
-       ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, buf,
-                              sizeof(__le16) * 3);
+       ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL,
+                              mma7455->scan.channels,
+                              sizeof(mma7455->scan.channels));
        if (ret)
                goto done;
 
-       iio_push_to_buffers_with_timestamp(indio_dev, buf,
+       iio_push_to_buffers_with_timestamp(indio_dev, &mma7455->scan,
                                           iio_get_time_ns(indio_dev));
 
 done:
index ba27f86731314dc770048160430265d05332db7c..853febc294885e0ae5a2a92c76c526bd2e9b4158 100644 (file)
@@ -110,6 +110,12 @@ struct mma8452_data {
        int sleep_val;
        struct regulator *vdd_reg;
        struct regulator *vddio_reg;
+
+       /* Ensure correct alignment of time stamp when present */
+       struct {
+               __be16 channels[3];
+               s64 ts __aligned(8);
+       } buffer;
 };
 
  /**
@@ -1091,14 +1097,13 @@ static irqreturn_t mma8452_trigger_handler(int irq, void *p)
        struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct mma8452_data *data = iio_priv(indio_dev);
-       u8 buffer[16]; /* 3 16-bit channels + padding + ts */
        int ret;
 
-       ret = mma8452_read(data, (__be16 *)buffer);
+       ret = mma8452_read(data, data->buffer.channels);
        if (ret < 0)
                goto done;
 
-       iio_push_to_buffers_with_timestamp(indio_dev, buffer,
+       iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer,
                                           iio_get_time_ns(indio_dev));
 
 done:
@@ -1580,7 +1585,7 @@ static int mma8452_probe(struct i2c_client *client,
        case FXLS8471_DEVICE_ID:
                if (ret == data->chip_info->chip_id)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                ret = -ENODEV;
                goto disable_regulators;
index 66d9cc07315735f45a716b3dcda0f45804b889d4..d94dc800b8422ef7d8d2bbb086805a9659619adb 100644 (file)
@@ -865,6 +865,8 @@ config ROCKCHIP_SARADC
        tristate "Rockchip SARADC driver"
        depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST)
        depends on RESET_CONTROLLER
+       select IIO_BUFFER
+       select IIO_TRIGGERED_BUFFER
        help
          Say yes here to build support for the SARADC found in SoCs from
          Rockchip.
index 7fdc5d2d1d35c152cb4d3f5fe6484a6a381a0c68..1bb987a4acbabc7b1c41f8e411323fb9d8813297 100644 (file)
@@ -484,7 +484,7 @@ static int ab8500_gpadc_read(struct ab8500_gpadc *gpadc,
                        delay_max = 10000; /* large range optimises sleepmode */
                        break;
                }
-               /* Fall through */
+               fallthrough;
        default:
                ctrl1 |= AB8500_GPADC_CTRL1_BUF_ENA;
                break;
index 84a1733e5913f438c53538cb18817d6283fb18cd..64c3cc3823110239c534d35302ba621dfcae3895 100644 (file)
@@ -690,7 +690,7 @@ static void cpcap_adc_phase(struct cpcap_adc_request *req)
                break;
        case CPCAP_ADC_BATTI_PI17:
                index = req->bank_index;
-               /* fallthrough */
+               fallthrough;
        default:
                req->result += conv_tbl[index].cal_offset;
                req->result += conv_tbl[index].align_offset;
index 5ed63e8742923fa6a053904be7eeedfb1c1951c1..b573ec60a8b8fea1d1773709b22f2318aecca1a6 100644 (file)
@@ -146,6 +146,11 @@ struct ina2xx_chip_info {
        int range_vbus; /* Bus voltage maximum in V */
        int pga_gain_vshunt; /* Shunt voltage PGA gain */
        bool allow_async_readout;
+       /* data buffer needs space for channel data and timestamp */
+       struct {
+               u16 chan[4];
+               u64 ts __aligned(8);
+       } scan;
 };
 
 static const struct ina2xx_config ina2xx_config[] = {
@@ -738,8 +743,6 @@ static int ina2xx_conversion_ready(struct iio_dev *indio_dev)
 static int ina2xx_work_buffer(struct iio_dev *indio_dev)
 {
        struct ina2xx_chip_info *chip = iio_priv(indio_dev);
-       /* data buffer needs space for channel data and timestap */
-       unsigned short data[4 + sizeof(s64)/sizeof(short)];
        int bit, ret, i = 0;
        s64 time;
 
@@ -758,10 +761,10 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
                if (ret < 0)
                        return ret;
 
-               data[i++] = val;
+               chip->scan.chan[i++] = val;
        }
 
-       iio_push_to_buffers_with_timestamp(indio_dev, data, time);
+       iio_push_to_buffers_with_timestamp(indio_dev, &chip->scan, time);
 
        return 0;
 };
index 01b20e420ac4563719ab3ab623611f7f33a5aa85..6efb0b43d9389eec57f0dc345ffa54f8587f8b61 100644 (file)
@@ -36,6 +36,11 @@ struct max1118 {
        struct spi_device *spi;
        struct mutex lock;
        struct regulator *reg;
+       /* Ensure natural alignment of buffer elements */
+       struct {
+               u8 channels[2];
+               s64 ts __aligned(8);
+       } scan;
 
        u8 data ____cacheline_aligned;
 };
@@ -166,7 +171,6 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p)
        struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct max1118 *adc = iio_priv(indio_dev);
-       u8 data[16] = { }; /* 2x 8-bit ADC data + padding + 8 bytes timestamp */
        int scan_index;
        int i = 0;
 
@@ -184,10 +188,10 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p)
                        goto out;
                }
 
-               data[i] = ret;
+               adc->scan.channels[i] = ret;
                i++;
        }
-       iio_push_to_buffers_with_timestamp(indio_dev, data,
+       iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan,
                                           iio_get_time_ns(indio_dev));
 out:
        mutex_unlock(&adc->lock);
index 5f1706d1c3c08a66fdc45f6e2d4f73691f6f99c3..da353dcb1e9d4988aeec45731f5a6b26acbf8d82 100644 (file)
@@ -96,16 +96,12 @@ static int mcp3422_update_config(struct mcp3422 *adc, u8 newconfig)
 {
        int ret;
 
-       mutex_lock(&adc->lock);
-
        ret = i2c_master_send(adc->i2c, &newconfig, 1);
        if (ret > 0) {
                adc->config = newconfig;
                ret = 0;
        }
 
-       mutex_unlock(&adc->lock);
-
        return ret;
 }
 
@@ -138,6 +134,8 @@ static int mcp3422_read_channel(struct mcp3422 *adc,
        u8 config;
        u8 req_channel = channel->channel;
 
+       mutex_lock(&adc->lock);
+
        if (req_channel != MCP3422_CHANNEL(adc->config)) {
                config = adc->config;
                config &= ~MCP3422_CHANNEL_MASK;
@@ -145,12 +143,18 @@ static int mcp3422_read_channel(struct mcp3422 *adc,
                config &= ~MCP3422_PGA_MASK;
                config |= MCP3422_PGA_VALUE(adc->pga[req_channel]);
                ret = mcp3422_update_config(adc, config);
-               if (ret < 0)
+               if (ret < 0) {
+                       mutex_unlock(&adc->lock);
                        return ret;
+               }
                msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]);
        }
 
-       return mcp3422_read(adc, value, &config);
+       ret = mcp3422_read(adc, value, &config);
+
+       mutex_unlock(&adc->lock);
+
+       return ret;
 }
 
 static int mcp3422_read_raw(struct iio_dev *iio,
index 93c2252c0b89017f9d39bbd9f4faf6fbb526baf0..1a9189ba69aecec180d66e2528000f87ae1de418 100644 (file)
@@ -707,7 +707,7 @@ static int meson_sar_adc_temp_sensor_init(struct iio_dev *indio_dev)
        size_t read_len;
        int ret;
 
-       temperature_calib = devm_nvmem_cell_get(&indio_dev->dev,
+       temperature_calib = devm_nvmem_cell_get(indio_dev->dev.parent,
                                                "temperature_calib");
        if (IS_ERR(temperature_calib)) {
                ret = PTR_ERR(temperature_calib);
index 9426f70a800598c0f4010708f332e8e5410a6c13..cf63983a54d99b6610fa939c06f3185a2a8f3a6a 100644 (file)
@@ -33,6 +33,12 @@ struct adc081c {
 
        /* 8, 10 or 12 */
        int bits;
+
+       /* Ensure natural alignment of buffer elements */
+       struct {
+               u16 channel;
+               s64 ts __aligned(8);
+       } scan;
 };
 
 #define REG_CONV_RES 0x00
@@ -128,14 +134,13 @@ static irqreturn_t adc081c_trigger_handler(int irq, void *p)
        struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct adc081c *data = iio_priv(indio_dev);
-       u16 buf[8]; /* 2 bytes data + 6 bytes padding + 8 bytes timestamp */
        int ret;
 
        ret = i2c_smbus_read_word_swapped(data->i2c, REG_CONV_RES);
        if (ret < 0)
                goto out;
-       buf[0] = ret;
-       iio_push_to_buffers_with_timestamp(indio_dev, buf,
+       data->scan.channel = ret;
+       iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
                                           iio_get_time_ns(indio_dev));
 out:
        iio_trigger_notify_done(indio_dev->trig);
index 9017e1e24273b3bb9fae7a2442164546b2e82bae..dfba34834a575f9d64d338e3ecb9a027673dc131 100644 (file)
@@ -26,6 +26,11 @@ struct adc084s021 {
        struct spi_transfer spi_trans;
        struct regulator *reg;
        struct mutex lock;
+       /* Buffer used to align data */
+       struct {
+               __be16 channels[4];
+               s64 ts __aligned(8);
+       } scan;
        /*
         * DMA (thus cache coherency maintenance) requires the
         * transfer buffers to live in their own cache line.
@@ -141,14 +146,13 @@ static irqreturn_t adc084s021_buffer_trigger_handler(int irq, void *pollfunc)
        struct iio_poll_func *pf = pollfunc;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct adc084s021 *adc = iio_priv(indio_dev);
-       __be16 data[8] = {0}; /* 4 * 16-bit words of data + 8 bytes timestamp */
 
        mutex_lock(&adc->lock);
 
-       if (adc084s021_adc_conversion(adc, &data) < 0)
+       if (adc084s021_adc_conversion(adc, adc->scan.channels) < 0)
                dev_err(&adc->spi->dev, "Failed to read data\n");
 
-       iio_push_to_buffers_with_timestamp(indio_dev, data,
+       iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan,
                                           iio_get_time_ns(indio_dev));
        mutex_unlock(&adc->lock);
        iio_trigger_notify_done(indio_dev->trig);
index f42ab112986ec0aa04f9ae43a7676aa1f7cd57b1..9fef39bcf997b90be945c25942489aa6f2842333 100644 (file)
@@ -316,6 +316,7 @@ static const struct iio_chan_spec ads1115_channels[] = {
        IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP),
 };
 
+#ifdef CONFIG_PM
 static int ads1015_set_power_state(struct ads1015_data *data, bool on)
 {
        int ret;
@@ -333,6 +334,15 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on)
        return ret < 0 ? ret : 0;
 }
 
+#else /* !CONFIG_PM */
+
+static int ads1015_set_power_state(struct ads1015_data *data, bool on)
+{
+       return 0;
+}
+
+#endif /* !CONFIG_PM */
+
 static
 int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
 {
index 2b007e7568b21b72d51a47614e7498269cc14c18..60dd87e96f5f8b0049f9b3af4e7be6e82b3b0ab8 100644 (file)
@@ -78,6 +78,11 @@ struct ccs811_data {
        struct iio_trigger *drdy_trig;
        struct gpio_desc *wakeup_gpio;
        bool drdy_trig_on;
+       /* Ensures correct alignment of timestamp if present */
+       struct {
+               s16 channels[2];
+               s64 ts __aligned(8);
+       } scan;
 };
 
 static const struct iio_chan_spec ccs811_channels[] = {
@@ -327,17 +332,17 @@ static irqreturn_t ccs811_trigger_handler(int irq, void *p)
        struct iio_dev *indio_dev = pf->indio_dev;
        struct ccs811_data *data = iio_priv(indio_dev);
        struct i2c_client *client = data->client;
-       s16 buf[8]; /* s16 eCO2 + s16 TVOC + padding + 8 byte timestamp */
        int ret;
 
-       ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, 4,
-                                           (u8 *)&buf);
+       ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA,
+                                           sizeof(data->scan.channels),
+                                           (u8 *)data->scan.channels);
        if (ret != 4) {
                dev_err(&client->dev, "cannot read sensor data\n");
                goto err;
        }
 
-       iio_push_to_buffers_with_timestamp(indio_dev, buf,
+       iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
                                           iio_get_time_ns(indio_dev));
 
 err:
index 5a29e32c295fc9c3e60ced52121e02e3463bdf7f..2ea9a5c4d84629c14f92ee2698726b7ea18d3e78 100644 (file)
@@ -118,7 +118,7 @@ static int sps30_do_cmd(struct sps30_state *state, u16 cmd, u8 *data, int size)
        case SPS30_READ_AUTO_CLEANING_PERIOD:
                buf[0] = SPS30_AUTO_CLEANING_PERIOD >> 8;
                buf[1] = (u8)(SPS30_AUTO_CLEANING_PERIOD & 0xff);
-               /* fall through */
+               fallthrough;
        case SPS30_READ_DATA_READY_FLAG:
        case SPS30_READ_DATA:
        case SPS30_READ_SERIAL:
index ea480c1d4349ec0789044cb8dc398a2883078422..1bc6efa47316351571d6a233ec0c802e6b4b87b5 100644 (file)
@@ -72,10 +72,13 @@ static void get_default_min_max_freq(enum motionsensor_type type,
 
        switch (type) {
        case MOTIONSENSE_TYPE_ACCEL:
-       case MOTIONSENSE_TYPE_GYRO:
                *min_freq = 12500;
                *max_freq = 100000;
                break;
+       case MOTIONSENSE_TYPE_GYRO:
+               *min_freq = 25000;
+               *max_freq = 100000;
+               break;
        case MOTIONSENSE_TYPE_MAG:
                *min_freq = 5000;
                *max_freq = 25000;
index cc4875660a69f4889233eb7ae6346221592913cb..1fd75c02a7cd7248444f3abc8bc3ad5953e3f7bd 100644 (file)
@@ -220,7 +220,6 @@ static int ad5592r_set_channel_modes(struct ad5592r_state *st)
                        break;
 
                case CH_MODE_UNUSED:
-                       /* fall-through */
                default:
                        switch (st->channel_offstate[i]) {
                        case CH_OFFSTATE_OUT_TRISTATE:
@@ -237,7 +236,6 @@ static int ad5592r_set_channel_modes(struct ad5592r_state *st)
                                break;
 
                        case CH_OFFSTATE_PULLDOWN:
-                               /* fall-through */
                        default:
                                pulldown |= BIT(i);
                                break;
index b3835fb6b86266a85a6a5be4736b351369978ba4..1a9609eda5c5ca047cfb32ff0be569af98c43282 100644 (file)
@@ -74,11 +74,12 @@ static int dpot_dac_read_raw(struct iio_dev *indio_dev,
                case IIO_VAL_INT:
                        /*
                         * Convert integer scale to fractional scale by
-                        * setting the denominator (val2) to one, and...
+                        * setting the denominator (val2) to one...
                         */
                        *val2 = 1;
                        ret = IIO_VAL_FRACTIONAL;
-                       /* fall through */
+                       /* ...and fall through. Say it again for GCC. */
+                       fallthrough;
                case IIO_VAL_FRACTIONAL:
                        *val *= regulator_get_voltage(dac->vref) / 1000;
                        *val2 *= dac->max_ohms;
index 9b47d9472a4fde84325fabb0b5cc1b22e5fe82f5..d9b2ed80882a43a7bd78f4af80522916bccbb43e 100644 (file)
@@ -273,10 +273,10 @@ static int max30102_read_measurement(struct max30102_data *data,
        switch (measurements) {
        case 3:
                MAX30102_COPY_DATA(2);
-               /* fall through */
+               fallthrough;
        case 2:
                MAX30102_COPY_DATA(1);
-               /* fall through */
+               fallthrough;
        case 1:
                MAX30102_COPY_DATA(0);
                break;
index c539dfa3b8d3ed06f6c848ad5f3b431efe7108e1..319b64b2fd8879ea6b113050540e9f963738b8a3 100644 (file)
@@ -97,11 +97,11 @@ int __adis_write_reg(struct adis *adis, unsigned int reg,
                adis->tx[9] = (value >> 24) & 0xff;
                adis->tx[6] = ADIS_WRITE_REG(reg + 2);
                adis->tx[7] = (value >> 16) & 0xff;
-               /* fall through */
+               fallthrough;
        case 2:
                adis->tx[4] = ADIS_WRITE_REG(reg + 1);
                adis->tx[5] = (value >> 8) & 0xff;
-               /* fall through */
+               fallthrough;
        case 1:
                adis->tx[2] = ADIS_WRITE_REG(reg);
                adis->tx[3] = value & 0xff;
@@ -191,7 +191,7 @@ int __adis_read_reg(struct adis *adis, unsigned int reg,
                adis->tx[2] = ADIS_READ_REG(reg + 2);
                adis->tx[3] = 0;
                spi_message_add_tail(&xfers[1], &msg);
-               /* fall through */
+               fallthrough;
        case 2:
                adis->tx[4] = ADIS_READ_REG(reg);
                adis->tx[5] = 0;
index 606d5e61c5759970689db730f4a240c786458263..cdcd16f19500a28bff6960e426b82e6b5f1a5bc5 100644 (file)
@@ -599,7 +599,7 @@ static ssize_t __iio_format_value(char *buf, size_t len, unsigned int type,
                return scnprintf(buf, len, "%d", vals[0]);
        case IIO_VAL_INT_PLUS_MICRO_DB:
                scale_db = true;
-               /* fall through */
+               fallthrough;
        case IIO_VAL_INT_PLUS_MICRO:
                if (vals[1] < 0)
                        return scnprintf(buf, len, "-%d.%06u%s", abs(vals[0]),
@@ -918,7 +918,7 @@ static ssize_t iio_write_channel_info(struct device *dev,
                        break;
                case IIO_VAL_INT_PLUS_MICRO_DB:
                        scale_db = true;
-                       /* fall through */
+                       fallthrough;
                case IIO_VAL_INT_PLUS_MICRO:
                        fract_mult = 100000;
                        break;
index 4bac0646398d569752d869dbe5e342265ad2e39c..b4323d2db0b19b53a9405de2e3d54a875f7059e4 100644 (file)
@@ -1243,13 +1243,16 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
        struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct ltr501_data *data = iio_priv(indio_dev);
-       u16 buf[8];
+       struct {
+               u16 channels[3];
+               s64 ts __aligned(8);
+       } scan;
        __le16 als_buf[2];
        u8 mask = 0;
        int j = 0;
        int ret, psdata;
 
-       memset(buf, 0, sizeof(buf));
+       memset(&scan, 0, sizeof(scan));
 
        /* figure out which data needs to be ready */
        if (test_bit(0, indio_dev->active_scan_mask) ||
@@ -1268,9 +1271,9 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
                if (ret < 0)
                        return ret;
                if (test_bit(0, indio_dev->active_scan_mask))
-                       buf[j++] = le16_to_cpu(als_buf[1]);
+                       scan.channels[j++] = le16_to_cpu(als_buf[1]);
                if (test_bit(1, indio_dev->active_scan_mask))
-                       buf[j++] = le16_to_cpu(als_buf[0]);
+                       scan.channels[j++] = le16_to_cpu(als_buf[0]);
        }
 
        if (mask & LTR501_STATUS_PS_RDY) {
@@ -1278,10 +1281,10 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
                                       &psdata, 2);
                if (ret < 0)
                        goto done;
-               buf[j++] = psdata & LTR501_PS_DATA_MASK;
+               scan.channels[j++] = psdata & LTR501_PS_DATA_MASK;
        }
 
-       iio_push_to_buffers_with_timestamp(indio_dev, buf,
+       iio_push_to_buffers_with_timestamp(indio_dev, &scan,
                                           iio_get_time_ns(indio_dev));
 
 done:
index aa8ed1e3e89a5165f50402674148c0e7191699a4..b8e721bced5bae12d1816cb75933215c767c7bb0 100644 (file)
 struct max44000_data {
        struct mutex lock;
        struct regmap *regmap;
+       /* Ensure naturally aligned timestamp */
+       struct {
+               u16 channels[2];
+               s64 ts __aligned(8);
+       } scan;
 };
 
 /* Default scale is set to the minimum of 0.03125 or 1 / (1 << 5) lux */
@@ -488,7 +493,6 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p)
        struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct max44000_data *data = iio_priv(indio_dev);
-       u16 buf[8]; /* 2x u16 + padding + 8 bytes timestamp */
        int index = 0;
        unsigned int regval;
        int ret;
@@ -498,17 +502,17 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p)
                ret = max44000_read_alsval(data);
                if (ret < 0)
                        goto out_unlock;
-               buf[index++] = ret;
+               data->scan.channels[index++] = ret;
        }
        if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) {
                ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, &regval);
                if (ret < 0)
                        goto out_unlock;
-               buf[index] = regval;
+               data->scan.channels[index] = regval;
        }
        mutex_unlock(&data->lock);
 
-       iio_push_to_buffers_with_timestamp(indio_dev, buf,
+       iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
                                           iio_get_time_ns(indio_dev));
        iio_trigger_notify_done(indio_dev->trig);
        return IRQ_HANDLED;
index 155faaea8c72faafb7d8be6659c20c33f7bb242f..8f5f857c2e7d9ecdc67964e3c1412367e740837a 100644 (file)
@@ -1042,7 +1042,7 @@ static int si1145_initialize(struct si1145_data *data)
                                                SI1145_LED_CURRENT_45mA);
                if (ret < 0)
                        return ret;
-               /* fallthrough */
+               fallthrough;
        case 2:
                ret = i2c_smbus_write_byte_data(client,
                                                SI1145_REG_PS_LED21,
index 6a8ae145f0c00050c8943bb30d1eea3f8545796d..cbb44e401c0a9e176ea76b1b437c174f2b93d631 100644 (file)
@@ -499,7 +499,7 @@ static int ak8974_detect(struct ak8974 *ak8974)
        switch (whoami) {
        case AK8974_WHOAMI_VALUE_AMI306:
                name = "ami306";
-               /* fall-through */
+               fallthrough;
        case AK8974_WHOAMI_VALUE_AMI305:
                ret = regmap_read(ak8974->map, AMI305_VER, &fw);
                if (ret)
index 03d71f7961772879074b4c6cf355a1f144d77e28..623766ff800b64b3f9db434dfa4ed00a93c53b10 100644 (file)
@@ -366,6 +366,12 @@ struct ak8975_data {
        struct iio_mount_matrix orientation;
        struct regulator        *vdd;
        struct regulator        *vid;
+
+       /* Ensure natural alignment of timestamp */
+       struct {
+               s16 channels[3];
+               s64 ts __aligned(8);
+       } scan;
 };
 
 /* Enable attached power regulator if any. */
@@ -793,7 +799,6 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev)
        const struct i2c_client *client = data->client;
        const struct ak_def *def = data->def;
        int ret;
-       s16 buff[8]; /* 3 x 16 bits axis values + 1 aligned 64 bits timestamp */
        __le16 fval[3];
 
        mutex_lock(&data->lock);
@@ -816,12 +821,13 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev)
        mutex_unlock(&data->lock);
 
        /* Clamp to valid range. */
-       buff[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range);
-       buff[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range);
-       buff[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range);
+       data->scan.channels[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range);
+       data->scan.channels[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range);
+       data->scan.channels[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range);
 
-       iio_push_to_buffers_with_timestamp(indio_dev, buff,
+       iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
                                           iio_get_time_ns(indio_dev));
+
        return;
 
 unlock:
index 654564c452489cbe62b6f6f1eacac10452896916..ad4b1fb2607aabd6a13e574c730f01c223034f50 100644 (file)
@@ -40,6 +40,11 @@ struct mb1232_data {
         */
        struct completion       ranging;
        int                     irqnr;
+       /* Ensure correct alignment of data to push to IIO buffer */
+       struct {
+               s16 distance;
+               s64 ts __aligned(8);
+       } scan;
 };
 
 static irqreturn_t mb1232_handle_irq(int irq, void *dev_id)
@@ -113,17 +118,13 @@ static irqreturn_t mb1232_trigger_handler(int irq, void *p)
        struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct mb1232_data *data = iio_priv(indio_dev);
-       /*
-        * triggered buffer
-        * 16-bit channel + 48-bit padding + 64-bit timestamp
-        */
-       s16 buffer[8] = { 0 };
 
-       buffer[0] = mb1232_read_distance(data);
-       if (buffer[0] < 0)
+       data->scan.distance = mb1232_read_distance(data);
+       if (data->scan.distance < 0)
                goto err;
 
-       iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp);
+       iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
+                                          pf->timestamp);
 
 err:
        iio_trigger_notify_done(indio_dev->trig);
index dc0558b23158a015f2420308c0b0bc32c45b8ff4..fbc28f1a8b9291f69e7372b1ef576e72eae71325 100644 (file)
@@ -3034,7 +3034,7 @@ static int cm_rej_handler(struct cm_work *work)
        case IB_CM_REP_SENT:
        case IB_CM_MRA_REP_RCVD:
                ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg);
-               /* fall through */
+               fallthrough;
        case IB_CM_REQ_RCVD:
        case IB_CM_MRA_REQ_SENT:
                if (IBA_GET(CM_REJ_REASON, rej_msg) == IB_CM_REJ_STALE_CONN)
@@ -3044,7 +3044,7 @@ static int cm_rej_handler(struct cm_work *work)
                break;
        case IB_CM_DREQ_SENT:
                ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg);
-               /* fall through */
+               fallthrough;
        case IB_CM_REP_RCVD:
        case IB_CM_MRA_REP_SENT:
                cm_enter_timewait(cm_id_priv);
@@ -3058,7 +3058,7 @@ static int cm_rej_handler(struct cm_work *work)
                        cm_enter_timewait(cm_id_priv);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
                         __func__, be32_to_cpu(cm_id_priv->id.local_id),
@@ -3116,7 +3116,7 @@ int ib_send_cm_mra(struct ib_cm_id *cm_id,
                        msg_response = CM_MSG_RESPONSE_OTHER;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
                         __func__, be32_to_cpu(cm_id_priv->id.local_id),
@@ -3227,7 +3227,7 @@ static int cm_mra_handler(struct cm_work *work)
        case IB_CM_MRA_REP_RCVD:
                atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES].
                                counter[CM_MRA_COUNTER]);
-               /* fall through */
+               fallthrough;
        default:
                pr_debug("%s local_id %d, cm_id_priv->id.state: %d\n",
                         __func__, be32_to_cpu(cm_id_priv->id.local_id),
@@ -4214,7 +4214,7 @@ static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv,
                                qp_attr->retry_cnt = cm_id_priv->retry_count;
                                qp_attr->rnr_retry = cm_id_priv->rnr_retry_count;
                                qp_attr->max_rd_atomic = cm_id_priv->initiator_depth;
-                               /* fall through */
+                               fallthrough;
                        case IB_QPT_XRC_TGT:
                                *qp_attr_mask |= IB_QP_TIMEOUT;
                                qp_attr->timeout = cm_id_priv->av.timeout;
index 26de0dab60bbba00e7896d1d8261213baa1af843..7f0e91e92968da394c720bfcc5e2d20b4e3675e0 100644 (file)
@@ -1985,7 +1985,8 @@ static int cma_ib_handler(struct ib_cm_id *cm_id,
                event.event = RDMA_CM_EVENT_ESTABLISHED;
                break;
        case IB_CM_DREQ_ERROR:
-               event.status = -ETIMEDOUT; /* fall through */
+               event.status = -ETIMEDOUT;
+               fallthrough;
        case IB_CM_DREQ_RECEIVED:
        case IB_CM_DREP_RECEIVED:
                if (!cma_comp_exch(id_priv, RDMA_CM_CONNECT,
index 513825e424bffa57efe7a4f47f327961b5e7ba1f..a92fc3f90bb5b37985f17bc0e22b10267cfb17bf 100644 (file)
@@ -379,7 +379,7 @@ static int ib_alloc_cqs(struct ib_device *dev, unsigned int nr_cqes,
 {
        LIST_HEAD(tmp_list);
        unsigned int nr_cqs, i;
-       struct ib_cq *cq;
+       struct ib_cq *cq, *n;
        int ret;
 
        if (poll_ctx > IB_POLL_LAST_POOL_TYPE) {
@@ -412,7 +412,7 @@ static int ib_alloc_cqs(struct ib_device *dev, unsigned int nr_cqes,
        return 0;
 
 out_free_cqs:
-       list_for_each_entry(cq, &tmp_list, pool_entry) {
+       list_for_each_entry_safe(cq, n, &tmp_list, pool_entry) {
                cq->shared = false;
                ib_free_cq(cq);
        }
index c36b4d2b61e0c044088f18c3a2df287666db1864..23ee65a9185fff57105cf0082310b0761ecdd68b 100644 (file)
@@ -1285,6 +1285,8 @@ static void disable_device(struct ib_device *device)
                remove_client_context(device, cid);
        }
 
+       ib_cq_pool_destroy(device);
+
        /* Pairs with refcount_set in enable_device */
        ib_device_put(device);
        wait_for_completion(&device->unreg_completion);
@@ -1328,6 +1330,8 @@ static int enable_device_and_get(struct ib_device *device)
                        goto out;
        }
 
+       ib_cq_pool_init(device);
+
        down_read(&clients_rwsem);
        xa_for_each_marked (&clients, index, client, CLIENT_REGISTERED) {
                ret = add_client_context(device, client);
@@ -1400,7 +1404,6 @@ int ib_register_device(struct ib_device *device, const char *name)
                goto dev_cleanup;
        }
 
-       ib_cq_pool_init(device);
        ret = enable_device_and_get(device);
        dev_set_uevent_suppress(&device->dev, false);
        /* Mark for userspace that device is ready */
@@ -1455,7 +1458,6 @@ static void __ib_unregister_device(struct ib_device *ib_dev)
                goto out;
 
        disable_device(ib_dev);
-       ib_cq_pool_destroy(ib_dev);
 
        /* Expedite removing unregistered pointers from the hash table */
        free_netdevs(ib_dev);
index 614cff89fc719116cd6ec52fd2f2c0acc3713cb2..13f43ab7220b05ac3438869810a4ddf99e723294 100644 (file)
@@ -510,7 +510,6 @@ struct ib_send_wr *rdma_rw_ctx_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
        switch (ctx->type) {
        case RDMA_RW_SIG_MR:
        case RDMA_RW_MR:
-               /* fallthrough */
                for (i = 0; i < ctx->nr_ops; i++) {
                        rdma_rw_update_lkey(&ctx->reg[i],
                                ctx->reg[i].wr.wr.opcode !=
index d03dacaef78805ddcb35d8f97e8417528fe9cc58..1d184ea05eba1cd7071bb09e35306d34a0f66e47 100644 (file)
@@ -794,7 +794,7 @@ static void ucma_copy_ib_route(struct rdma_ucm_query_route_resp *resp,
        case 2:
                ib_copy_path_rec_to_user(&resp->ib_route[1],
                                         &route->path_rec[1]);
-               /* fall through */
+               fallthrough;
        case 1:
                ib_copy_path_rec_to_user(&resp->ib_route[0],
                                         &route->path_rec[0]);
@@ -820,7 +820,7 @@ static void ucma_copy_iboe_route(struct rdma_ucm_query_route_resp *resp,
        case 2:
                ib_copy_path_rec_to_user(&resp->ib_route[1],
                                         &route->path_rec[1]);
-               /* fall through */
+               fallthrough;
        case 1:
                ib_copy_path_rec_to_user(&resp->ib_route[0],
                                         &route->path_rec[0]);
index ef04a261097fca2a6e2927496b2a728c1d8f6653..e47c5949013f3ada403dee00378ef413c4edb6ef 100644 (file)
@@ -259,7 +259,7 @@ static int uverbs_process_attr(struct bundle_priv *pbundle,
                        return -EOPNOTSUPP;
 
                e->ptr_attr.enum_id = uattr->attr_data.enum_data.elem_id;
-       /* fall through */
+               fallthrough;
        case UVERBS_ATTR_TYPE_PTR_IN:
                /* Ensure that any data provided by userspace beyond the known
                 * struct is zero. Userspace that knows how to use some future
@@ -271,7 +271,7 @@ static int uverbs_process_attr(struct bundle_priv *pbundle,
                    !uverbs_is_attr_cleared(uattr, val_spec->u.ptr.len))
                        return -EOPNOTSUPP;
 
-       /* fall through */
+               fallthrough;
        case UVERBS_ATTR_TYPE_PTR_OUT:
                if (uattr->len < val_spec->u.ptr.min_len ||
                    (!val_spec->zero_trailing &&
index 3096e73797b775f706c4d257fd140024c9031ebe..307886737646ea73d37af36170a75987cb83ca02 100644 (file)
@@ -1801,7 +1801,7 @@ int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width)
 
        dev_put(netdev);
 
-       if (!rc) {
+       if (!rc && lksettings.base.speed != (u32)SPEED_UNKNOWN) {
                netdev_speed = lksettings.base.speed;
        } else {
                netdev_speed = SPEED_1000;
index 3f18efc0c29744507d3119bc81438b58f3aa067f..1d7a9ca5240c5b121bcccb0973b7e70038f4e562 100644 (file)
@@ -752,12 +752,6 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp)
        gsi_sqp = rdev->gsi_ctx.gsi_sqp;
        gsi_sah = rdev->gsi_ctx.gsi_sah;
 
-       /* remove from active qp list */
-       mutex_lock(&rdev->qp_lock);
-       list_del(&gsi_sqp->list);
-       mutex_unlock(&rdev->qp_lock);
-       atomic_dec(&rdev->qp_count);
-
        ibdev_dbg(&rdev->ibdev, "Destroy the shadow AH\n");
        bnxt_qplib_destroy_ah(&rdev->qplib_res,
                              &gsi_sah->qplib_ah,
@@ -772,6 +766,12 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp)
        }
        bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp);
 
+       /* remove from active qp list */
+       mutex_lock(&rdev->qp_lock);
+       list_del(&gsi_sqp->list);
+       mutex_unlock(&rdev->qp_lock);
+       atomic_dec(&rdev->qp_count);
+
        kfree(rdev->gsi_ctx.sqp_tbl);
        kfree(gsi_sah);
        kfree(gsi_sqp);
@@ -792,11 +792,6 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)
        unsigned int flags;
        int rc;
 
-       mutex_lock(&rdev->qp_lock);
-       list_del(&qp->list);
-       mutex_unlock(&rdev->qp_lock);
-       atomic_dec(&rdev->qp_count);
-
        bnxt_qplib_flush_cqn_wq(&qp->qplib_qp);
 
        rc = bnxt_qplib_destroy_qp(&rdev->qplib_res, &qp->qplib_qp);
@@ -819,6 +814,11 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)
                        goto sh_fail;
        }
 
+       mutex_lock(&rdev->qp_lock);
+       list_del(&qp->list);
+       mutex_unlock(&rdev->qp_lock);
+       atomic_dec(&rdev->qp_count);
+
        ib_umem_release(qp->rumem);
        ib_umem_release(qp->sumem);
 
@@ -2657,7 +2657,7 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr,
                        default:
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case IB_WR_SEND_WITH_INV:
                        rc = bnxt_re_build_send_wqe(qp, wr, &wqe);
                        break;
@@ -3264,6 +3264,19 @@ static void bnxt_re_process_res_rawqp1_wc(struct ib_wc *wc,
        wc->wc_flags |= IB_WC_GRH;
 }
 
+static bool bnxt_re_check_if_vlan_valid(struct bnxt_re_dev *rdev,
+                                       u16 vlan_id)
+{
+       /*
+        * Check if the vlan is configured in the host.  If not configured, it
+        * can be a transparent VLAN. So dont report the vlan id.
+        */
+       if (!__vlan_find_dev_deep_rcu(rdev->netdev,
+                                     htons(ETH_P_8021Q), vlan_id))
+               return false;
+       return true;
+}
+
 static bool bnxt_re_is_vlan_pkt(struct bnxt_qplib_cqe *orig_cqe,
                                u16 *vid, u8 *sl)
 {
@@ -3332,9 +3345,11 @@ static void bnxt_re_process_res_shadow_qp_wc(struct bnxt_re_qp *gsi_sqp,
        wc->src_qp = orig_cqe->src_qp;
        memcpy(wc->smac, orig_cqe->smac, ETH_ALEN);
        if (bnxt_re_is_vlan_pkt(orig_cqe, &vlan_id, &sl)) {
-               wc->vlan_id = vlan_id;
-               wc->sl = sl;
-               wc->wc_flags |= IB_WC_WITH_VLAN;
+               if (bnxt_re_check_if_vlan_valid(rdev, vlan_id)) {
+                       wc->vlan_id = vlan_id;
+                       wc->sl = sl;
+                       wc->wc_flags |= IB_WC_WITH_VLAN;
+               }
        }
        wc->port_num = 1;
        wc->vendor_err = orig_cqe->status;
index 17ac8b7c571047ea866ffae28d82e86f43b21977..53aee5a42ab85074d356d9f4aa7ee86a421a8687 100644 (file)
@@ -1009,7 +1009,6 @@ static void bnxt_re_free_res(struct bnxt_re_dev *rdev)
 static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev)
 {
        struct bnxt_re_ring_attr rattr = {};
-       struct bnxt_qplib_ctx *qplib_ctx;
        int num_vec_created = 0;
        int rc = 0, i;
        u8 type;
@@ -1032,13 +1031,11 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev)
        if (rc)
                goto dealloc_res;
 
-       qplib_ctx = &rdev->qplib_ctx;
        for (i = 0; i < rdev->num_msix - 1; i++) {
                struct bnxt_qplib_nq *nq;
 
                nq = &rdev->nq[i];
-               nq->hwq.max_elements = (qplib_ctx->cq_count +
-                                       qplib_ctx->srqc_count + 2);
+               nq->hwq.max_elements = BNXT_QPLIB_NQE_MAX_CNT;
                rc = bnxt_qplib_alloc_nq(&rdev->qplib_res, &rdev->nq[i]);
                if (rc) {
                        ibdev_err(&rdev->ibdev, "Alloc Failed NQ%d rc:%#x",
index 117b42349a283683c7ea006628a93f71ee42e9dd..f78da54a0bc50fc9814c346c216db1ea23387508 100644 (file)
@@ -818,6 +818,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
        u16 cmd_flags = 0;
        u32 qp_flags = 0;
        u8 pg_sz_lvl;
+       u32 tbl_indx;
        int rc;
 
        RCFW_CMD_PREP(req, CREATE_QP1, cmd_flags);
@@ -907,8 +908,9 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
                rq->dbinfo.db = qp->dpi->dbr;
                rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size);
        }
-       rcfw->qp_tbl[qp->id].qp_id = qp->id;
-       rcfw->qp_tbl[qp->id].qp_handle = (void *)qp;
+       tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
+       rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
+       rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp;
 
        return 0;
 
@@ -935,10 +937,10 @@ static void bnxt_qplib_init_psn_ptr(struct bnxt_qplib_qp *qp, int size)
 
        sq = &qp->sq;
        hwq = &sq->hwq;
+       /* First psn entry */
        fpsne = (u64)bnxt_qplib_get_qe(hwq, hwq->depth, &psn_pg);
        if (!IS_ALIGNED(fpsne, PAGE_SIZE))
-               indx_pad = ALIGN(fpsne, PAGE_SIZE) / size;
-
+               indx_pad = (fpsne & ~PAGE_MASK) / size;
        hwq->pad_pgofft = indx_pad;
        hwq->pad_pg = (u64 *)psn_pg;
        hwq->pad_stride = size;
@@ -959,6 +961,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
        u16 cmd_flags = 0;
        u32 qp_flags = 0;
        u8 pg_sz_lvl;
+       u32 tbl_indx;
        u16 nsge;
 
        RCFW_CMD_PREP(req, CREATE_QP, cmd_flags);
@@ -1111,8 +1114,9 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
                rq->dbinfo.db = qp->dpi->dbr;
                rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size);
        }
-       rcfw->qp_tbl[qp->id].qp_id = qp->id;
-       rcfw->qp_tbl[qp->id].qp_handle = (void *)qp;
+       tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
+       rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
+       rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp;
 
        return 0;
 fail:
@@ -1457,10 +1461,12 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
        struct cmdq_destroy_qp req;
        struct creq_destroy_qp_resp resp;
        u16 cmd_flags = 0;
+       u32 tbl_indx;
        int rc;
 
-       rcfw->qp_tbl[qp->id].qp_id = BNXT_QPLIB_QP_ID_INVALID;
-       rcfw->qp_tbl[qp->id].qp_handle = NULL;
+       tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
+       rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID;
+       rcfw->qp_tbl[tbl_indx].qp_handle = NULL;
 
        RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags);
 
@@ -1468,8 +1474,8 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
        rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
                                          (void *)&resp, NULL, 0);
        if (rc) {
-               rcfw->qp_tbl[qp->id].qp_id = qp->id;
-               rcfw->qp_tbl[qp->id].qp_handle = qp;
+               rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
+               rcfw->qp_tbl[tbl_indx].qp_handle = qp;
                return rc;
        }
 
@@ -1779,7 +1785,7 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
 
                        break;
                }
-               /* fall thru */
+               fallthrough;
        case BNXT_QPLIB_SWQE_TYPE_SEND_WITH_IMM:
        case BNXT_QPLIB_SWQE_TYPE_SEND_WITH_INV:
        {
index 4e211162acee2ff167378eb3485f104befc5b398..f7736e34ac64c9c2ad4e69dd26f6a991e19ea6dc 100644 (file)
@@ -307,14 +307,15 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
        __le16  mcookie;
        u16 cookie;
        int rc = 0;
-       u32 qp_id;
+       u32 qp_id, tbl_indx;
 
        pdev = rcfw->pdev;
        switch (qp_event->event) {
        case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION:
                err_event = (struct creq_qp_error_notification *)qp_event;
                qp_id = le32_to_cpu(err_event->xid);
-               qp = rcfw->qp_tbl[qp_id].qp_handle;
+               tbl_indx = map_qp_id_to_tbl_indx(qp_id, rcfw);
+               qp = rcfw->qp_tbl[tbl_indx].qp_handle;
                dev_dbg(&pdev->dev, "Received QP error notification\n");
                dev_dbg(&pdev->dev,
                        "qpid 0x%x, req_err=0x%x, resp_err=0x%x\n",
@@ -615,8 +616,9 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
 
        cmdq->bmap_size = bmap_size;
 
-       rcfw->qp_tbl_size = qp_tbl_sz;
-       rcfw->qp_tbl = kcalloc(qp_tbl_sz, sizeof(struct bnxt_qplib_qp_node),
+       /* Allocate one extra to hold the QP1 entries */
+       rcfw->qp_tbl_size = qp_tbl_sz + 1;
+       rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node),
                               GFP_KERNEL);
        if (!rcfw->qp_tbl)
                goto fail;
index 157387636d004432a4b5b1780f2a79dab22ab381..5f2f0a5a3560ff89902a04d3390f303c161e7e4a 100644 (file)
@@ -216,4 +216,9 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw);
 int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
                         struct bnxt_qplib_ctx *ctx, int is_virtfn);
 void bnxt_qplib_mark_qp_error(void *qp_handle);
+static inline u32 map_qp_id_to_tbl_indx(u32 qid, struct bnxt_qplib_rcfw *rcfw)
+{
+       /* Last index of the qp_tbl is for QP1 ie. qp_tbl_size - 1*/
+       return (qid == 1) ? rcfw->qp_tbl_size - 1 : qid % rcfw->qp_tbl_size - 2;
+}
 #endif /* __BNXT_QPLIB_RCFW_H__ */
index 4cd475ea97a24e1064585e338bceedb22676cbca..64d44f51db4b6cbf0e080cdb74aa5d9832a63c02 100644 (file)
@@ -149,7 +149,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
        attr->max_inline_data = le32_to_cpu(sb->max_inline_data);
        attr->l2_db_size = (sb->l2_db_space_size + 1) *
                            (0x01 << RCFW_DBR_BASE_PAGE_SHIFT);
-       attr->max_sgid = le32_to_cpu(sb->max_gid);
+       attr->max_sgid = BNXT_QPLIB_NUM_GIDS_SUPPORTED;
 
        bnxt_qplib_query_version(rcfw, attr->fw_ver);
 
index 6404f0da10517a5040be2f0965f9d3701d7bb104..967890cd81f271a5dec23af0818469146fd18b2e 100644 (file)
@@ -47,6 +47,7 @@
 struct bnxt_qplib_dev_attr {
 #define FW_VER_ARR_LEN                 4
        u8                              fw_ver[FW_VER_ARR_LEN];
+#define BNXT_QPLIB_NUM_GIDS_SUPPORTED  256
        u16                             max_sgid;
        u16                             max_mrw;
        u32                             max_qp;
index 77bc02a9228eef385652601720d6f5f3cf31bbb8..1f288c73ccfc26db9a52d3b0d74eafc654f87127 100644 (file)
@@ -2885,7 +2885,7 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb)
        case MORIBUND:
        case CLOSING:
                stop_ep_timer(ep);
-               /*FALLTHROUGH*/
+               fallthrough;
        case FPDU_MODE:
                if (ep->com.qp && ep->com.qp->srq) {
                        srqidx = ABORT_RSS_SRQIDX_G(
@@ -3759,7 +3759,7 @@ static void active_ofld_conn_reply(struct c4iw_dev *dev, struct sk_buff *skb,
                        send_fw_act_open_req(ep, atid);
                        return;
                }
-               /* fall through */
+               fallthrough;
        case FW_EADDRINUSE:
                set_bit(ACT_RETRY_INUSE, &ep->com.history);
                if (ep->retry_count++ < ACT_OPEN_RETRY_COUNT) {
index ac48012c992f1d24beeabc955ef4d84922c7e4e6..cbddb20c61216e2facea737301c3edb9e46e9f47 100644 (file)
@@ -1165,7 +1165,7 @@ int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
                                break;
                        }
                        fw_flags |= FW_RI_RDMA_WRITE_WITH_IMMEDIATE;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case IB_WR_RDMA_WRITE:
                        fw_opcode = FW_RI_RDMA_WRITE_WR;
                        swsqe->opcode = FW_RI_RDMA_WRITE;
index b12e4665c9ab1be2c8d80ff9b64010b46747dbb8..4a4ec23978579bc31faa553eaf18140200621881 100644 (file)
@@ -209,7 +209,6 @@ static inline void jcopy(u8 *dest, const u8 *src, u32 n)
                fallthrough;
        case 1:
                *dest++ = *src++;
-               /* fall through */
        }
 }
 
index fa7a5ff498c73bfd851030db4bfda3b010aca81b..a3b95805c154e66e7a359934a3e4983f37f1912d 100644 (file)
@@ -2443,7 +2443,7 @@ static void i40iw_handle_rst_pkt(struct i40iw_cm_node *cm_node,
        case I40IW_CM_STATE_FIN_WAIT1:
        case I40IW_CM_STATE_LAST_ACK:
                cm_node->cm_id->rem_ref(cm_node->cm_id);
-               /* fall through */
+               fallthrough;
        case I40IW_CM_STATE_TIME_WAIT:
                cm_node->state = I40IW_CM_STATE_CLOSED;
                i40iw_rem_ref_cm_node(cm_node);
index 688f196672215ee4b6c5384443218bb50cc48286..86d3f8aff329c12097125e8b27bf8abf76b056ef 100644 (file)
@@ -1964,7 +1964,6 @@ static enum i40iw_status_code i40iw_sc_get_next_aeqe(struct i40iw_sc_aeq *aeq,
                info->out_rdrsp = true;
                break;
        case I40IW_AE_SOURCE_RSVD:
-               /* fallthrough */
        default:
                break;
        }
@@ -3762,14 +3761,14 @@ static enum i40iw_status_code cqp_sds_wqe_fill(struct i40iw_sc_cqp *cqp,
                                        LS_64(1, I40IW_CQPSQ_UPESD_ENTRY_VALID)));
 
                set_64bit_val(wqe, 56, info->entry[2].data);
-               /* fallthrough */
+               fallthrough;
        case 2:
                set_64bit_val(wqe, 32,
                              (LS_64(info->entry[1].cmd, I40IW_CQPSQ_UPESD_SDCMD) |
                                        LS_64(1, I40IW_CQPSQ_UPESD_ENTRY_VALID)));
 
                set_64bit_val(wqe, 40, info->entry[1].data);
-               /* fallthrough */
+               fallthrough;
        case 1:
                set_64bit_val(wqe, 0,
                              LS_64(info->entry[0].cmd, I40IW_CQPSQ_UPESD_SDCMD));
index ae8b97c3066575388c6d3381b0d76f03b5eb8910..e1085634b8d9df2820ee72268db8c14bff3ae4d6 100644 (file)
@@ -353,7 +353,6 @@ void i40iw_process_aeq(struct i40iw_device *iwdev)
                                i40iw_cm_disconn(iwqp);
                        break;
                case I40IW_AE_BAD_CLOSE:
-                       /* fall through */
                case I40IW_AE_RESET_SENT:
                        i40iw_next_iw_state(iwqp, I40IW_QP_STATE_ERROR, 1, 0, 0);
                        i40iw_cm_disconn(iwqp);
@@ -413,7 +412,7 @@ void i40iw_process_aeq(struct i40iw_device *iwdev)
                case I40IW_AE_UDA_XMIT_DGRAM_TOO_LONG:
                case I40IW_AE_UDA_XMIT_DGRAM_TOO_SHORT:
                        ctx_info->err_rq_idx_valid = false;
-                       /* fall through */
+                       fallthrough;
                default:
                        if (!info->sq && ctx_info->err_rq_idx_valid) {
                                ctx_info->err_rq_idx = info->wqe_idx;
index 9c96ece5e7f33b48634a44c4d708f774704c4c9f..58a433135a0386ba6091e7bbee9935d9f6fb5e24 100644 (file)
@@ -1489,36 +1489,35 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev)
                iwdev->iw_status = 0;
                i40iw_port_ibevent(iwdev);
                i40iw_destroy_rdma_device(iwdev->iwibdev);
-               /* fallthrough */
+               fallthrough;
        case IP_ADDR_REGISTERED:
                if (!iwdev->reset)
                        i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx);
-               /* fallthrough */
-               /* fallthrough */
+               fallthrough;
        case PBLE_CHUNK_MEM:
                i40iw_destroy_pble_pool(dev, iwdev->pble_rsrc);
-               /* fallthrough */
+               fallthrough;
        case CEQ_CREATED:
                i40iw_dele_ceqs(iwdev);
-               /* fallthrough */
+               fallthrough;
        case AEQ_CREATED:
                i40iw_destroy_aeq(iwdev);
-               /* fallthrough */
+               fallthrough;
        case IEQ_CREATED:
                i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_IEQ, iwdev->reset);
-               /* fallthrough */
+               fallthrough;
        case ILQ_CREATED:
                i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_ILQ, iwdev->reset);
-               /* fallthrough */
+               fallthrough;
        case CCQ_CREATED:
                i40iw_destroy_ccq(iwdev);
-               /* fallthrough */
+               fallthrough;
        case HMC_OBJS_CREATED:
                i40iw_del_hmc_objects(dev, dev->hmc_info, true, iwdev->reset);
-               /* fallthrough */
+               fallthrough;
        case CQP_CREATED:
                i40iw_destroy_cqp(iwdev, true);
-               /* fallthrough */
+               fallthrough;
        case INITIAL_STATE:
                i40iw_cleanup_cm_core(&iwdev->cm_core);
                if (iwdev->vsi.pestat) {
@@ -1528,7 +1527,6 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev)
                i40iw_del_init_mem(iwdev);
                break;
        case INVALID_STATE:
-               /* fallthrough */
        default:
                i40iw_pr_err("bad init_state = %d\n", iwdev->init_state);
                break;
index d9c7ae6a7030b46fdbbce064806ec31852dcbde6..924be4b03c9a0ee16d50787153c69b039870c0dc 100644 (file)
@@ -814,13 +814,13 @@ void i40iw_puda_dele_resources(struct i40iw_sc_vsi *vsi,
        switch (rsrc->completion) {
        case PUDA_HASH_CRC_COMPLETE:
                i40iw_free_hash_desc(rsrc->hash_desc);
-               /* fall through */
+               fallthrough;
        case PUDA_QP_CREATED:
                if (!reset)
                        i40iw_puda_free_qp(rsrc);
 
                i40iw_free_dma_mem(dev->hw, &rsrc->qpmem);
-               /* fallthrough */
+               fallthrough;
        case PUDA_CQ_CREATED:
                if (!reset)
                        i40iw_puda_free_cq(rsrc);
index 016524683e17eb8801a4f1da38dd8d860378c063..e07fb37af0865d60a1539d4a411be843f7f47ca2 100644 (file)
@@ -190,9 +190,8 @@ int i40iw_inetaddr_event(struct notifier_block *notifier,
        switch (event) {
        case NETDEV_DOWN:
                action = I40IW_ARP_DELETE;
-               /* Fall through */
+               fallthrough;
        case NETDEV_UP:
-               /* Fall through */
        case NETDEV_CHANGEADDR:
 
                /* Just skip if no need to handle ARP cache */
@@ -247,9 +246,8 @@ int i40iw_inet6addr_event(struct notifier_block *notifier,
        switch (event) {
        case NETDEV_DOWN:
                action = I40IW_ARP_DELETE;
-               /* Fall through */
+               fallthrough;
        case NETDEV_UP:
-               /* Fall through */
        case NETDEV_CHANGEADDR:
                i40iw_manage_arp_cache(iwdev,
                                       netdev->dev_addr,
@@ -344,7 +342,7 @@ int i40iw_netdevice_event(struct notifier_block *notifier,
        switch (event) {
        case NETDEV_DOWN:
                iwdev->iw_status = 0;
-               /* Fall through */
+               fallthrough;
        case NETDEV_UP:
                i40iw_port_ibevent(iwdev);
                break;
index 6957e4f3404b10e78df64f1623fe22f3d2c5f2c6..b51339328a51eff1f153362f4479c29c301309e9 100644 (file)
@@ -810,7 +810,7 @@ void i40iw_hw_modify_qp(struct i40iw_device *iwdev, struct i40iw_qp *iwqp,
        case I40IW_QP_STATE_RTS:
                if (iwqp->iwarp_state == I40IW_QP_STATE_IDLE)
                        i40iw_send_reset(iwqp->cm_node);
-               /* fall through */
+               fallthrough;
        case I40IW_QP_STATE_IDLE:
        case I40IW_QP_STATE_TERMINATE:
        case I40IW_QP_STATE_CLOSING:
@@ -2144,7 +2144,6 @@ static int i40iw_post_send(struct ib_qp *ibqp,
 
                switch (ib_wr->opcode) {
                case IB_WR_SEND:
-                       /* fall-through */
                case IB_WR_SEND_WITH_INV:
                        if (ib_wr->opcode == IB_WR_SEND) {
                                if (ib_wr->send_flags & IB_SEND_SOLICITED)
@@ -2201,7 +2200,7 @@ static int i40iw_post_send(struct ib_qp *ibqp,
                        break;
                case IB_WR_RDMA_READ_WITH_INV:
                        inv_stag = true;
-                       /* fall-through*/
+                       fallthrough;
                case IB_WR_RDMA_READ:
                        if (ib_wr->num_sge > I40IW_MAX_SGE_RD) {
                                err = -EINVAL;
index f8b936b76dcdfd66fce2e3490ac8922c80f77897..8a3436994f809750be5352aab3adf9c180a35d3b 100644 (file)
@@ -765,13 +765,13 @@ repoll:
                switch (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) {
                case MLX4_OPCODE_RDMA_WRITE_IMM:
                        wc->wc_flags |= IB_WC_WITH_IMM;
-                       /* fall through */
+                       fallthrough;
                case MLX4_OPCODE_RDMA_WRITE:
                        wc->opcode    = IB_WC_RDMA_WRITE;
                        break;
                case MLX4_OPCODE_SEND_IMM:
                        wc->wc_flags |= IB_WC_WITH_IMM;
-                       /* fall through */
+                       fallthrough;
                case MLX4_OPCODE_SEND:
                case MLX4_OPCODE_SEND_INVAL:
                        wc->opcode    = IB_WC_SEND;
index 5e7910a517daefefb91635b92d43e5cf81c4e821..bd4f975e7f9acaff5f940a1d36b63399fa904e33 100644 (file)
@@ -784,7 +784,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
        props->ip_gids = true;
        props->gid_tbl_len      = mdev->dev->caps.gid_table_len[port];
        props->max_msg_sz       = mdev->dev->caps.max_msg_sz;
-       props->pkey_tbl_len     = 1;
+       if (mdev->dev->caps.pkey_table_len[port])
+               props->pkey_tbl_len = 1;
        props->max_mtu          = IB_MTU_4096;
        props->max_vl_num       = 2;
        props->state            = IB_PORT_DOWN;
index d844831179cf7c200e7d9ce15493b63557ad0193..5e4ec9786081cf3a42dfe2f51532b3d6f4ee581b 100644 (file)
@@ -944,7 +944,7 @@ int mlx4_ib_mcg_multiplex_handler(struct ib_device *ibdev, int port,
        switch (sa_mad->mad_hdr.method) {
        case IB_MGMT_METHOD_SET:
                may_create = 1;
-               /* fall through */
+               fallthrough;
        case IB_SA_METHOD_DELETE:
                req = kzalloc(sizeof *req, GFP_KERNEL);
                if (!req)
index f9ca6e000a8146e0404e794c7cbb7493c426f944..2975f350b9fd1076f2eafb3c2f0f3e5c423ab4d1 100644 (file)
@@ -1578,12 +1578,12 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
                pd = to_mxrcd(init_attr->xrcd)->pd;
                xrcdn = to_mxrcd(init_attr->xrcd)->xrcdn;
                init_attr->send_cq = to_mxrcd(init_attr->xrcd)->cq;
-               /* fall through */
+               fallthrough;
        case IB_QPT_XRC_INI:
                if (!(to_mdev(pd->device)->dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC))
                        return ERR_PTR(-ENOSYS);
                init_attr->recv_cq = init_attr->send_cq;
-               /* fall through */
+               fallthrough;
        case IB_QPT_RC:
        case IB_QPT_UC:
        case IB_QPT_RAW_PACKET:
@@ -1592,7 +1592,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
                        return ERR_PTR(-ENOMEM);
                qp->pri.vid = 0xFFFF;
                qp->alt.vid = 0xFFFF;
-               /* fall through */
+               fallthrough;
        case IB_QPT_UD:
        {
                err = create_qp_common(pd, init_attr, udata, 0, &qp);
index 0133ebb8d740e855a7f4e6718a80b159f135f38e..dceb0eb2bed1621e5530a5d55a2d301b7e8e04af 100644 (file)
@@ -121,13 +121,13 @@ static void handle_good_req(struct ib_wc *wc, struct mlx5_cqe64 *cqe,
        switch (be32_to_cpu(cqe->sop_drop_qpn) >> 24) {
        case MLX5_OPCODE_RDMA_WRITE_IMM:
                wc->wc_flags |= IB_WC_WITH_IMM;
-               /* fall through */
+               fallthrough;
        case MLX5_OPCODE_RDMA_WRITE:
                wc->opcode    = IB_WC_RDMA_WRITE;
                break;
        case MLX5_OPCODE_SEND_IMM:
                wc->wc_flags |= IB_WC_WITH_IMM;
-               /* fall through */
+               fallthrough;
        case MLX5_OPCODE_SEND:
        case MLX5_OPCODE_SEND_INVAL:
                wc->opcode    = IB_WC_SEND;
index 454ce5de2de7174437ba31b9733a19770367a075..9bb9bb058932f1b36fd441b3b96407af4ac0ccc0 100644 (file)
@@ -250,9 +250,8 @@ int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
                if (MLX5_CAP_GEN(dev->mdev, vport_counters) &&
                    method == IB_MGMT_METHOD_GET)
                        return process_pma_cmd(dev, port_num, in, out);
-               /* fallthrough */
+               fallthrough;
        case MLX5_IB_VENDOR_CLASS1:
-               /* fallthrough */
        case MLX5_IB_VENDOR_CLASS2:
        case IB_MGMT_CLASS_CONG_MGMT: {
                if (method != IB_MGMT_METHOD_GET &&
index fbc45a5e76c5c6f6a55021938fcaa76f7e521c64..d60d63221b14d9224535f9d8dac42d1d5d7c288a 100644 (file)
@@ -2872,7 +2872,7 @@ static void mlx5_ib_handle_event(struct work_struct *_work)
                break;
        case MLX5_EVENT_TYPE_GENERAL_EVENT:
                handle_general_event(ibdev, work->param, &ibev);
-               /* fall through */
+               fallthrough;
        default:
                goto out;
        }
index 59fce5fac7a3342ef4d3ae07a3a62440b1328380..5758dbe640451cbe0d0df216d20930d4f175081a 100644 (file)
@@ -416,7 +416,7 @@ static int sq_overhead(struct ib_qp_init_attr *attr)
        switch (attr->qp_type) {
        case IB_QPT_XRC_INI:
                size += sizeof(struct mlx5_wqe_xrc_seg);
-               /* fall through */
+               fallthrough;
        case IB_QPT_RC:
                size += sizeof(struct mlx5_wqe_ctrl_seg) +
                        max(sizeof(struct mlx5_wqe_atomic_seg) +
@@ -441,7 +441,7 @@ static int sq_overhead(struct ib_qp_init_attr *attr)
                if (attr->create_flags & IB_QP_CREATE_IPOIB_UD_LSO)
                        size += sizeof(struct mlx5_wqe_eth_pad) +
                                sizeof(struct mlx5_wqe_eth_seg);
-               /* fall through */
+               fallthrough;
        case IB_QPT_SMI:
        case MLX5_IB_QPT_HW_GSI:
                size += sizeof(struct mlx5_wqe_ctrl_seg) +
index 0823c0bc7e73a94861079f02ca4f3681a2ca9faa..f051f4e06b539c791c1d7211a7c5a5c95efe3a9d 100644 (file)
@@ -115,7 +115,7 @@ static u8 ib_rate_to_memfree(u8 req_rate, u8 cur_rate)
        switch ((cur_rate - 1) / req_rate) {
        case 0:  return MTHCA_RATE_MEMFREE_FULL;
        case 1:  return MTHCA_RATE_MEMFREE_HALF;
-       case 2:  /* fall through */
+       case 2:
        case 3:  return MTHCA_RATE_MEMFREE_QUARTER;
        default: return MTHCA_RATE_MEMFREE_EIGHTH;
        }
index 6cdbec13756af5ac7741202fcf38cc54ed5d6dbe..c1751c9a0f625c92b97f60010417f3c8857b7172 100644 (file)
@@ -2134,7 +2134,7 @@ int ocrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
                case IB_WR_SEND_WITH_IMM:
                        hdr->cw |= (OCRDMA_FLAG_IMM << OCRDMA_WQE_FLAGS_SHIFT);
                        hdr->immdt = ntohl(wr->ex.imm_data);
-                       /* fall through */
+                       fallthrough;
                case IB_WR_SEND:
                        hdr->cw |= (OCRDMA_SEND << OCRDMA_WQE_OPCODE_SHIFT);
                        ocrdma_build_send(qp, hdr, wr);
@@ -2148,7 +2148,7 @@ int ocrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
                case IB_WR_RDMA_WRITE_WITH_IMM:
                        hdr->cw |= (OCRDMA_FLAG_IMM << OCRDMA_WQE_FLAGS_SHIFT);
                        hdr->immdt = ntohl(wr->ex.imm_data);
-                       /* fall through */
+                       fallthrough;
                case IB_WR_RDMA_WRITE:
                        hdr->cw |= (OCRDMA_WRITE << OCRDMA_WQE_OPCODE_SHIFT);
                        status = ocrdma_build_write(qp, hdr, wr);
index 4ce4e2eef6ccdb4ba12ce193197126483e807360..b49bef94637e5020dd2d5e64347ea306c80000a1 100644 (file)
@@ -3528,7 +3528,7 @@ static int __qedr_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
                break;
        case IB_WR_RDMA_READ_WITH_INV:
                SET_FIELD2(wqe->flags, RDMA_SQ_RDMA_WQE_1ST_READ_INV_FLG, 1);
-               /* fallthrough -- same is identical to RDMA READ */
+               fallthrough;    /* same is identical to RDMA READ */
 
        case IB_WR_RDMA_READ:
                wqe->req_type = RDMA_SQ_REQ_TYPE_RDMA_RD;
index ca5ea734e3d0465527aeaa42522b5575a745fd88..44150be215bf22d196a02cad5156b98b6614f3f0 100644 (file)
@@ -2973,11 +2973,11 @@ static u32 qib_6120_iblink_state(u64 ibcs)
                state = IB_PORT_ARMED;
                break;
        case IB_6120_L_STATE_ACTIVE:
-               /* fall through */
        case IB_6120_L_STATE_ACT_DEFER:
                state = IB_PORT_ACTIVE;
                break;
-       default: /* fall through */
+       default:
+               fallthrough;
        case IB_6120_L_STATE_DOWN:
                state = IB_PORT_DOWN;
                break;
index ea3ddb05cbadfec3c58ce32f252587388091af7a..0a6f26d4cb31004c9091118104483d17f4353d30 100644 (file)
@@ -3586,11 +3586,11 @@ static u32 qib_7220_iblink_state(u64 ibcs)
                state = IB_PORT_ARMED;
                break;
        case IB_7220_L_STATE_ACTIVE:
-               /* fall through */
        case IB_7220_L_STATE_ACT_DEFER:
                state = IB_PORT_ACTIVE;
                break;
-       default: /* fall through */
+       default:
+               fallthrough;
        case IB_7220_L_STATE_DOWN:
                state = IB_PORT_DOWN;
                break;
index 8bcbc884e5b613a7e77b13be9ebae2f70cc9f354..a10eab89aee4992002210ef7d479837c8fcbe335 100644 (file)
@@ -5508,11 +5508,11 @@ static u32 qib_7322_iblink_state(u64 ibcs)
                state = IB_PORT_ARMED;
                break;
        case IB_7322_L_STATE_ACTIVE:
-               /* fall through */
        case IB_7322_L_STATE_ACT_DEFER:
                state = IB_PORT_ACTIVE;
                break;
-       default: /* fall through */
+       default:
+               fallthrough;
        case IB_7322_L_STATE_DOWN:
                state = IB_PORT_DOWN;
                break;
@@ -6533,7 +6533,7 @@ static int qib_init_7322_variables(struct qib_devdata *dd)
                                    "Invalid num_vls %u, using 4 VLs\n",
                                    qib_num_cfg_vls);
                        qib_num_cfg_vls = 4;
-                       /* fall through */
+                       fallthrough;
                case 4:
                        ppd->vls_supported = IB_VL_VL0_3;
                        break;
index 79bb83222e8d13f74dd097f566bf39045bf2f72a..e7789e724f561c4a4009844650e765be1ea53f49 100644 (file)
@@ -433,7 +433,7 @@ static int check_mkey(struct qib_ibport *ibp, struct ib_smp *smp, int mad_flags)
                        /* Bad mkey not a violation below level 2 */
                        if (ibp->rvp.mkeyprot < 2)
                                break;
-                       /* fall through */
+                       fallthrough;
                case IB_MGMT_METHOD_SET:
                case IB_MGMT_METHOD_TRAP_REPRESS:
                        if (ibp->rvp.mkey_violations != 0xFFFF)
@@ -828,7 +828,7 @@ static int subn_set_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
        case IB_PORT_NOP:
                if (lstate == 0)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case IB_PORT_DOWN:
                if (lstate == 0)
                        lstate = QIB_IB_LINKDOWN_ONLY;
@@ -1928,7 +1928,7 @@ static int process_subn(struct ib_device *ibdev, int mad_flags,
                                ret = IB_MAD_RESULT_SUCCESS;
                                goto bail;
                        }
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        smp->status |= IB_SMP_UNSUP_METH_ATTR;
                        ret = reply(smp);
@@ -1962,7 +1962,7 @@ static int process_subn(struct ib_device *ibdev, int mad_flags,
                                ret = IB_MAD_RESULT_SUCCESS;
                                goto bail;
                        }
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        smp->status |= IB_SMP_UNSUP_METH_ATTR;
                        ret = reply(smp);
@@ -2322,7 +2322,7 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
                        ret = cc_get_congestion_control_table(ccp, ibdev, port);
                        goto bail;
 
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        ccp->status |= IB_SMP_UNSUP_METH_ATTR;
                        ret = reply((struct ib_smp *) ccp);
@@ -2339,7 +2339,7 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
                        ret = cc_set_congestion_control_table(ccp, ibdev, port);
                        goto bail;
 
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        ccp->status |= IB_SMP_UNSUP_METH_ATTR;
                        ret = reply((struct ib_smp *) ccp);
index aaf7438258fac80cb1bfa3c139fbc65f47037245..3915e5b4a9bc10a458cc7c1d9b4aae2fd5991d89 100644 (file)
@@ -83,7 +83,7 @@ static int qib_make_rc_ack(struct qib_ibdev *dev, struct rvt_qp *qp,
                        rvt_put_mr(e->rdma_sge.mr);
                        e->rdma_sge.mr = NULL;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(ATOMIC_ACKNOWLEDGE):
                /*
                 * We can increment the tail pointer now that the last
@@ -92,7 +92,7 @@ static int qib_make_rc_ack(struct qib_ibdev *dev, struct rvt_qp *qp,
                 */
                if (++qp->s_tail_ack_queue > QIB_MAX_RDMA_ATOMIC)
                        qp->s_tail_ack_queue = 0;
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_ONLY):
        case OP(ACKNOWLEDGE):
                /* Check for no next entry in the queue. */
@@ -149,7 +149,7 @@ static int qib_make_rc_ack(struct qib_ibdev *dev, struct rvt_qp *qp,
 
        case OP(RDMA_READ_RESPONSE_FIRST):
                qp->s_ack_state = OP(RDMA_READ_RESPONSE_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_READ_RESPONSE_MIDDLE):
                qp->s_cur_sge = &qp->s_ack_rdma_sge;
                qp->s_rdma_mr = qp->s_ack_rdma_sge.sge.mr;
@@ -471,10 +471,10 @@ no_flow_control:
                 * See qib_restart_rc().
                 */
                qp->s_len = restart_sge(&qp->s_sge, wqe, qp->s_psn, pmtu);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_FIRST):
                qp->s_state = OP(SEND_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_MIDDLE):
                bth2 = qp->s_psn++ & QIB_PSN_MASK;
                ss = &qp->s_sge;
@@ -510,10 +510,10 @@ no_flow_control:
                 * See qib_restart_rc().
                 */
                qp->s_len = restart_sge(&qp->s_sge, wqe, qp->s_psn, pmtu);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_WRITE_FIRST):
                qp->s_state = OP(RDMA_WRITE_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_WRITE_MIDDLE):
                bth2 = qp->s_psn++ & QIB_PSN_MASK;
                ss = &qp->s_sge;
@@ -1807,7 +1807,7 @@ void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr,
                if (!ret)
                        goto rnr_nak;
                qp->r_rcv_len = 0;
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_MIDDLE):
        case OP(RDMA_WRITE_MIDDLE):
 send_middle:
@@ -1839,7 +1839,7 @@ send_middle:
                qp->r_rcv_len = 0;
                if (opcode == OP(SEND_ONLY))
                        goto no_immediate_data;
-               /* fall through -- for SEND_ONLY_WITH_IMMEDIATE */
+               fallthrough;    /* for SEND_ONLY_WITH_IMMEDIATE */
        case OP(SEND_LAST_WITH_IMMEDIATE):
 send_last_imm:
                wc.ex.imm_data = ohdr->u.imm_data;
index 99e11c347130e7364d6b5f807988f29da00e9334..8f8d6173665682a45814802a01ef137d299a45cf 100644 (file)
@@ -763,7 +763,7 @@ void __qib_sdma_process_event(struct qib_pportdata *ppd,
                         * bringing the link up with traffic active on
                         * 7220, e.g. */
                        ss->go_s99_running = 1;
-                       /* fall through -- and start dma engine */
+                       fallthrough;    /* and start dma engine */
                case qib_sdma_event_e10_go_hw_start:
                        /* This reference means the state machine is started */
                        sdma_get(&ppd->sdma_state);
index e17b91e2c22a91022930dc6cbbc896500bf6663a..554af4273a131218d0b6b3a42fd2d5833d0de356 100644 (file)
@@ -161,7 +161,7 @@ int qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags)
 
        case OP(SEND_FIRST):
                qp->s_state = OP(SEND_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_MIDDLE):
                len = qp->s_len;
                if (len > pmtu) {
@@ -185,7 +185,7 @@ int qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags)
 
        case OP(RDMA_WRITE_FIRST):
                qp->s_state = OP(RDMA_WRITE_MIDDLE);
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_WRITE_MIDDLE):
                len = qp->s_len;
                if (len > pmtu) {
@@ -351,7 +351,7 @@ send_first:
                        goto no_immediate_data;
                else if (opcode == OP(SEND_ONLY_WITH_IMMEDIATE))
                        goto send_last_imm;
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(SEND_MIDDLE):
                /* Check for invalid length PMTU or posted rwqe len. */
                if (unlikely(tlen != (hdrsize + pmtu + 4)))
@@ -440,7 +440,7 @@ rdma_first:
                        wc.ex.imm_data = ohdr->u.rc.imm_data;
                        goto rdma_last_imm;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case OP(RDMA_WRITE_MIDDLE):
                /* Check for invalid length PMTU or posted rwqe len. */
                if (unlikely(tlen != (hdrsize + pmtu + 4)))
index 7acf9ba5358a417b493b5ad3515d29efcda7202d..f6c01bad5a74f5315f07bce97d4e932550899390 100644 (file)
@@ -237,7 +237,7 @@ static void qib_qp_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr,
        case IB_QPT_GSI:
                if (ib_qib_disable_sma)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case IB_QPT_UD:
                qib_ud_rcv(ibp, hdr, has_grh, data, tlen, qp);
                break;
index afcc2abcf55c0680f148230e9bcd0598a579f706..9a8f2a9507be078057e57b577ffad6ea7216236f 100644 (file)
@@ -238,7 +238,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
                        ret = -EINVAL;
                        goto err_qp;
                }
-               /* fall through */
+               fallthrough;
        case IB_QPT_RC:
        case IB_QPT_UD:
                qp = kzalloc(sizeof(*qp), GFP_KERNEL);
index 332a8ba94b81b0c5e00b8f6d569181c0b249a274..ee48befc8978619b477cfa7325d66be1f622773f 100644 (file)
@@ -1111,7 +1111,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
                if (init_attr->port_num == 0 ||
                    init_attr->port_num > ibpd->device->phys_port_cnt)
                        return ERR_PTR(-EINVAL);
-               /* fall through */
+               fallthrough;
        case IB_QPT_UC:
        case IB_QPT_RC:
        case IB_QPT_UD:
index 907203afbd99431cc900ae9d334d132f03666a46..77f2c7cd1216c5fff07a087f742dc6e749b7953d 100644 (file)
@@ -40,6 +40,8 @@ MODULE_AUTHOR("Bob Pearson, Frank Zago, John Groves, Kamal Heib");
 MODULE_DESCRIPTION("Soft RDMA transport");
 MODULE_LICENSE("Dual BSD/GPL");
 
+bool rxe_initialized;
+
 /* free resources for a rxe device all objects created for this device must
  * have been destroyed
  */
@@ -315,6 +317,7 @@ static int __init rxe_module_init(void)
                return err;
 
        rdma_link_register(&rxe_link_ops);
+       rxe_initialized = true;
        pr_info("loaded\n");
        return 0;
 }
@@ -326,6 +329,7 @@ static void __exit rxe_module_exit(void)
        rxe_net_exit();
        rxe_cache_exit();
 
+       rxe_initialized = false;
        pr_info("unloaded\n");
 }
 
index fb07eed9e4028345a02aac983269241012de2fae..cae1b0a24c850d694fd7ddbcf14dad98b689c972 100644 (file)
@@ -67,6 +67,8 @@
 
 #define RXE_ROCE_V2_SPORT              (0xc000)
 
+extern bool rxe_initialized;
+
 static inline u32 rxe_crc32(struct rxe_dev *rxe,
                            u32 crc, void *next, size_t len)
 {
index 4bc88708b355885b3f429e75af0dc3cb1975cd90..7b4df0028388cb82278b65274ff6b50abde52c76 100644 (file)
@@ -282,7 +282,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp,
                if ((syn & AETH_TYPE_MASK) != AETH_ACK)
                        return COMPST_ERROR;
 
-               /* fall through */
+               fallthrough;
                /* (IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE doesn't have an AETH)
                 */
        case IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE:
index cdd811a45120f4e5a5b274895c84d6759f200a8e..ce24144de16a96fd33f8fba7ebe7950bbdda341f 100644 (file)
@@ -205,6 +205,7 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
                        vaddr = page_address(sg_page_iter_page(&sg_iter));
                        if (!vaddr) {
                                pr_warn("null vaddr\n");
+                               ib_umem_release(umem);
                                err = -ENOMEM;
                                goto err1;
                        }
index ccda5f5a3bc0aad81915936e2c1d4e349de60e86..2af31d421bfc3a79c15e5845924978f405f5620e 100644 (file)
@@ -61,6 +61,11 @@ static int rxe_param_set_add(const char *val, const struct kernel_param *kp)
        struct net_device *ndev;
        struct rxe_dev *exists;
 
+       if (!rxe_initialized) {
+               pr_err("Module parameters are not supported, use rdma link add or rxe_cfg\n");
+               return -EAGAIN;
+       }
+
        len = sanitize_arg(val, intf, sizeof(intf));
        if (!len) {
                pr_err("add: invalid interface name\n");
index 08f05ac5f5d526f94d48f5b68ae9512463c4bd15..ecdac3f8fcc9f2137624e25f5aba7e418368a7e9 100644 (file)
@@ -71,7 +71,7 @@ void rxe_do_task(unsigned long data)
 
        case TASK_STATE_BUSY:
                task->state = TASK_STATE_ARMED;
-               /* fall through */
+               fallthrough;
        case TASK_STATE_ARMED:
                spin_unlock_irqrestore(&task->state_lock, flags);
                return;
index bb61e534e468221ae7413c7833a0492d31bdfcaf..8522e9a3e9140b509605f1751d6dfa20cfbe3878 100644 (file)
@@ -540,7 +540,7 @@ static void init_send_wr(struct rxe_qp *qp, struct rxe_send_wr *wr,
                switch (wr->opcode) {
                case IB_WR_RDMA_WRITE_WITH_IMM:
                        wr->ex.imm_data = ibwr->ex.imm_data;
-                       /* fall through */
+                       fallthrough;
                case IB_WR_RDMA_READ:
                case IB_WR_RDMA_WRITE:
                        wr->wr.rdma.remote_addr = rdma_wr(ibwr)->remote_addr;
@@ -1056,7 +1056,7 @@ static ssize_t parent_show(struct device *device,
        struct rxe_dev *rxe =
                rdma_device_to_drv_device(device, struct rxe_dev, ib_dev);
 
-       return snprintf(buf, 16, "%s\n", rxe_parent_name(rxe, 1));
+       return scnprintf(buf, PAGE_SIZE, "%s\n", rxe_parent_name(rxe, 1));
 }
 
 static DEVICE_ATTR_RO(parent);
index 1662216be66df2614ffd0ae26f8ec480218f8b3f..66764f7ef072adc730d0c76e57968af03a66634a 100644 (file)
@@ -1224,12 +1224,10 @@ static void siw_cm_llp_data_ready(struct sock *sk)
 
        switch (cep->state) {
        case SIW_EPSTATE_RDMA_MODE:
-               /* fall through */
        case SIW_EPSTATE_LISTENING:
                break;
 
        case SIW_EPSTATE_AWAIT_MPAREQ:
-               /* fall through */
        case SIW_EPSTATE_AWAIT_MPAREP:
                siw_cm_queue_work(cep, SIW_CM_WORK_READ_MPAHDR);
                break;
index 857be5a7d0bddc71de7ec2f2fd9f4db492455086..4bd1f1f84057bd1977af05bb48c5077d0c865aef 100644 (file)
@@ -1215,7 +1215,7 @@ static int siw_rdmap_complete(struct siw_qp *qp, int error)
        case RDMAP_SEND_SE:
        case RDMAP_SEND_SE_INVAL:
                wqe->rqe.flags |= SIW_WQE_SOLICITED;
-               /* Fall through */
+               fallthrough;
 
        case RDMAP_SEND:
        case RDMAP_SEND_INVAL:
@@ -1386,7 +1386,7 @@ int siw_tcp_rx_data(read_descriptor_t *rd_desc, struct sk_buff *skb,
                         * DDP segment.
                         */
                        qp->rx_fpdu->first_ddp_seg = 0;
-                       /* Fall through */
+                       fallthrough;
 
                case SIW_GET_DATA_START:
                        /*
index 9f53aa4feb8782c0880120da0e26fe545e24f46e..d19d8325588b5cee9f3574a291432962e1551ad5 100644 (file)
@@ -1042,7 +1042,7 @@ next_wqe:
                case SIW_OP_SEND_REMOTE_INV:
                case SIW_OP_WRITE:
                        siw_wqe_put_mem(wqe, tx_type);
-                       /* Fall through */
+                       fallthrough;
 
                case SIW_OP_INVAL_STAG:
                case SIW_OP_REG_MR:
@@ -1128,7 +1128,7 @@ next_wqe:
                case SIW_OP_READ:
                case SIW_OP_READ_LOCAL_INV:
                        siw_wqe_put_mem(wqe, tx_type);
-                       /* Fall through */
+                       fallthrough;
 
                case SIW_OP_INVAL_STAG:
                case SIW_OP_REG_MR:
index 9bf0fa30df28c9f76480bfcdf2b20846fe409864..7c41fb040f7c6fb5ae6ee4c8b0496e705f6e8916 100644 (file)
@@ -512,13 +512,13 @@ static int ipoib_cm_rx_handler(struct ib_cm_id *cm_id,
                return ipoib_cm_req_handler(cm_id, event);
        case IB_CM_DREQ_RECEIVED:
                ib_send_cm_drep(cm_id, NULL, 0);
-               /* Fall through */
+               fallthrough;
        case IB_CM_REJ_RECEIVED:
                p = cm_id->context;
                priv = ipoib_priv(p->dev);
                if (ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE))
                        ipoib_warn(priv, "unable to move qp to error state\n");
-               /* Fall through */
+               fallthrough;
        default:
                return 0;
        }
index 752581a8627bd07a2e10c477337252f8a27496d5..ab75b7f745d41573e3c4ea2dc6e5531e548aa667 100644 (file)
@@ -502,7 +502,7 @@ static struct net_device *ipoib_get_net_dev_by_params(
        default:
                dev_warn_ratelimited(&dev->dev,
                                     "duplicate IP address detected\n");
-               /* Fall through */
+               fallthrough;
        case 1:
                return net_dev;
        }
index 699e075ae1b366e69ef39bd44c21893ba01c162c..2f3ebc0a75d92466456ab8948b50e723ab45f870 100644 (file)
@@ -711,7 +711,7 @@ static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *eve
        case RDMA_CM_EVENT_REJECTED:
                iser_info("Connection rejected: %s\n",
                         rdma_reject_msg(cma_id, event->status));
-               /* FALLTHROUGH */
+               fallthrough;
        case RDMA_CM_EVENT_ADDR_ERROR:
        case RDMA_CM_EVENT_ROUTE_ERROR:
        case RDMA_CM_EVENT_CONNECT_ERROR:
index 61e2f7fc513d060a4386fb6f7bd11e476a9d9889..695f701dc43d9016b91331bd518c36721965dd83 100644 (file)
@@ -140,15 +140,15 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn)
        rx_desc = isert_conn->rx_descs;
 
        for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++)  {
-               dma_addr = ib_dma_map_single(ib_dev, (void *)rx_desc,
-                                       ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
+               dma_addr = ib_dma_map_single(ib_dev, rx_desc->buf,
+                                       ISER_RX_SIZE, DMA_FROM_DEVICE);
                if (ib_dma_mapping_error(ib_dev, dma_addr))
                        goto dma_map_fail;
 
                rx_desc->dma_addr = dma_addr;
 
                rx_sg = &rx_desc->rx_sg;
-               rx_sg->addr = rx_desc->dma_addr;
+               rx_sg->addr = rx_desc->dma_addr + isert_get_hdr_offset(rx_desc);
                rx_sg->length = ISER_RX_PAYLOAD_SIZE;
                rx_sg->lkey = device->pd->local_dma_lkey;
                rx_desc->rx_cqe.done = isert_recv_done;
@@ -160,7 +160,7 @@ dma_map_fail:
        rx_desc = isert_conn->rx_descs;
        for (j = 0; j < i; j++, rx_desc++) {
                ib_dma_unmap_single(ib_dev, rx_desc->dma_addr,
-                                   ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
+                                   ISER_RX_SIZE, DMA_FROM_DEVICE);
        }
        kfree(isert_conn->rx_descs);
        isert_conn->rx_descs = NULL;
@@ -181,7 +181,7 @@ isert_free_rx_descriptors(struct isert_conn *isert_conn)
        rx_desc = isert_conn->rx_descs;
        for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++)  {
                ib_dma_unmap_single(ib_dev, rx_desc->dma_addr,
-                                   ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
+                                   ISER_RX_SIZE, DMA_FROM_DEVICE);
        }
 
        kfree(isert_conn->rx_descs);
@@ -299,10 +299,9 @@ isert_free_login_buf(struct isert_conn *isert_conn)
                            ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE);
        kfree(isert_conn->login_rsp_buf);
 
-       ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma,
-                           ISER_RX_PAYLOAD_SIZE,
-                           DMA_FROM_DEVICE);
-       kfree(isert_conn->login_req_buf);
+       ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr,
+                           ISER_RX_SIZE, DMA_FROM_DEVICE);
+       kfree(isert_conn->login_desc);
 }
 
 static int
@@ -311,25 +310,25 @@ isert_alloc_login_buf(struct isert_conn *isert_conn,
 {
        int ret;
 
-       isert_conn->login_req_buf = kzalloc(sizeof(*isert_conn->login_req_buf),
+       isert_conn->login_desc = kzalloc(sizeof(*isert_conn->login_desc),
                        GFP_KERNEL);
-       if (!isert_conn->login_req_buf)
+       if (!isert_conn->login_desc)
                return -ENOMEM;
 
-       isert_conn->login_req_dma = ib_dma_map_single(ib_dev,
-                               isert_conn->login_req_buf,
-                               ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
-       ret = ib_dma_mapping_error(ib_dev, isert_conn->login_req_dma);
+       isert_conn->login_desc->dma_addr = ib_dma_map_single(ib_dev,
+                               isert_conn->login_desc->buf,
+                               ISER_RX_SIZE, DMA_FROM_DEVICE);
+       ret = ib_dma_mapping_error(ib_dev, isert_conn->login_desc->dma_addr);
        if (ret) {
-               isert_err("login_req_dma mapping error: %d\n", ret);
-               isert_conn->login_req_dma = 0;
-               goto out_free_login_req_buf;
+               isert_err("login_desc dma mapping error: %d\n", ret);
+               isert_conn->login_desc->dma_addr = 0;
+               goto out_free_login_desc;
        }
 
        isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL);
        if (!isert_conn->login_rsp_buf) {
                ret = -ENOMEM;
-               goto out_unmap_login_req_buf;
+               goto out_unmap_login_desc;
        }
 
        isert_conn->login_rsp_dma = ib_dma_map_single(ib_dev,
@@ -346,11 +345,11 @@ isert_alloc_login_buf(struct isert_conn *isert_conn,
 
 out_free_login_rsp_buf:
        kfree(isert_conn->login_rsp_buf);
-out_unmap_login_req_buf:
-       ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma,
-                           ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
-out_free_login_req_buf:
-       kfree(isert_conn->login_req_buf);
+out_unmap_login_desc:
+       ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr,
+                           ISER_RX_SIZE, DMA_FROM_DEVICE);
+out_free_login_desc:
+       kfree(isert_conn->login_desc);
        return ret;
 }
 
@@ -476,7 +475,7 @@ isert_connect_release(struct isert_conn *isert_conn)
        if (isert_conn->qp)
                isert_destroy_qp(isert_conn);
 
-       if (isert_conn->login_req_buf)
+       if (isert_conn->login_desc)
                isert_free_login_buf(isert_conn);
 
        isert_device_put(device);
@@ -664,8 +663,8 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
        case RDMA_CM_EVENT_ESTABLISHED:
                isert_connected_handler(cma_id);
                break;
-       case RDMA_CM_EVENT_ADDR_CHANGE:    /* FALLTHRU */
-       case RDMA_CM_EVENT_DISCONNECTED:   /* FALLTHRU */
+       case RDMA_CM_EVENT_ADDR_CHANGE:
+       case RDMA_CM_EVENT_DISCONNECTED:
        case RDMA_CM_EVENT_TIMEWAIT_EXIT:  /* FALLTHRU */
                ret = isert_disconnected_handler(cma_id, event->event);
                break;
@@ -684,7 +683,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
        case RDMA_CM_EVENT_REJECTED:
                isert_info("Connection rejected: %s\n",
                           rdma_reject_msg(cma_id, event->status));
-               /* fall through */
+               fallthrough;
        case RDMA_CM_EVENT_UNREACHABLE:
        case RDMA_CM_EVENT_CONNECT_ERROR:
                ret = isert_connect_error(cma_id);
@@ -862,17 +861,18 @@ isert_login_post_recv(struct isert_conn *isert_conn)
        int ret;
 
        memset(&sge, 0, sizeof(struct ib_sge));
-       sge.addr = isert_conn->login_req_dma;
+       sge.addr = isert_conn->login_desc->dma_addr +
+               isert_get_hdr_offset(isert_conn->login_desc);
        sge.length = ISER_RX_PAYLOAD_SIZE;
        sge.lkey = isert_conn->device->pd->local_dma_lkey;
 
        isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n",
                sge.addr, sge.length, sge.lkey);
 
-       isert_conn->login_req_buf->rx_cqe.done = isert_login_recv_done;
+       isert_conn->login_desc->rx_cqe.done = isert_login_recv_done;
 
        memset(&rx_wr, 0, sizeof(struct ib_recv_wr));
-       rx_wr.wr_cqe = &isert_conn->login_req_buf->rx_cqe;
+       rx_wr.wr_cqe = &isert_conn->login_desc->rx_cqe;
        rx_wr.sg_list = &sge;
        rx_wr.num_sge = 1;
 
@@ -949,7 +949,7 @@ post_send:
 static void
 isert_rx_login_req(struct isert_conn *isert_conn)
 {
-       struct iser_rx_desc *rx_desc = isert_conn->login_req_buf;
+       struct iser_rx_desc *rx_desc = isert_conn->login_desc;
        int rx_buflen = isert_conn->login_req_len;
        struct iscsi_conn *conn = isert_conn->conn;
        struct iscsi_login *login = conn->conn_login;
@@ -961,7 +961,7 @@ isert_rx_login_req(struct isert_conn *isert_conn)
 
        if (login->first_request) {
                struct iscsi_login_req *login_req =
-                       (struct iscsi_login_req *)&rx_desc->iscsi_header;
+                       (struct iscsi_login_req *)isert_get_iscsi_hdr(rx_desc);
                /*
                 * Setup the initial iscsi_login values from the leading
                 * login request PDU.
@@ -980,13 +980,13 @@ isert_rx_login_req(struct isert_conn *isert_conn)
                login->tsih             = be16_to_cpu(login_req->tsih);
        }
 
-       memcpy(&login->req[0], (void *)&rx_desc->iscsi_header, ISCSI_HDR_LEN);
+       memcpy(&login->req[0], isert_get_iscsi_hdr(rx_desc), ISCSI_HDR_LEN);
 
        size = min(rx_buflen, MAX_KEY_VALUE_PAIRS);
        isert_dbg("Using login payload size: %d, rx_buflen: %d "
                  "MAX_KEY_VALUE_PAIRS: %d\n", size, rx_buflen,
                  MAX_KEY_VALUE_PAIRS);
-       memcpy(login->req_buf, &rx_desc->data[0], size);
+       memcpy(login->req_buf, isert_get_data(rx_desc), size);
 
        if (login->first_request) {
                complete(&isert_conn->login_comp);
@@ -1051,14 +1051,15 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn,
        if (imm_data_len != data_len) {
                sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE));
                sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents,
-                                   &rx_desc->data[0], imm_data_len);
+                                   isert_get_data(rx_desc), imm_data_len);
                isert_dbg("Copy Immediate sg_nents: %u imm_data_len: %d\n",
                          sg_nents, imm_data_len);
        } else {
                sg_init_table(&isert_cmd->sg, 1);
                cmd->se_cmd.t_data_sg = &isert_cmd->sg;
                cmd->se_cmd.t_data_nents = 1;
-               sg_set_buf(&isert_cmd->sg, &rx_desc->data[0], imm_data_len);
+               sg_set_buf(&isert_cmd->sg, isert_get_data(rx_desc),
+                               imm_data_len);
                isert_dbg("Transfer Immediate imm_data_len: %d\n",
                          imm_data_len);
        }
@@ -1127,9 +1128,9 @@ isert_handle_iscsi_dataout(struct isert_conn *isert_conn,
        }
        isert_dbg("Copying DataOut: sg_start: %p, sg_off: %u "
                  "sg_nents: %u from %p %u\n", sg_start, sg_off,
-                 sg_nents, &rx_desc->data[0], unsol_data_len);
+                 sg_nents, isert_get_data(rx_desc), unsol_data_len);
 
-       sg_copy_from_buffer(sg_start, sg_nents, &rx_desc->data[0],
+       sg_copy_from_buffer(sg_start, sg_nents, isert_get_data(rx_desc),
                            unsol_data_len);
 
        rc = iscsit_check_dataout_payload(cmd, hdr, false);
@@ -1188,7 +1189,7 @@ isert_handle_text_cmd(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd
        }
        cmd->text_in_ptr = text_in;
 
-       memcpy(cmd->text_in_ptr, &rx_desc->data[0], payload_length);
+       memcpy(cmd->text_in_ptr, isert_get_data(rx_desc), payload_length);
 
        return iscsit_process_text_cmd(conn, cmd, hdr);
 }
@@ -1198,7 +1199,7 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc,
                uint32_t read_stag, uint64_t read_va,
                uint32_t write_stag, uint64_t write_va)
 {
-       struct iscsi_hdr *hdr = &rx_desc->iscsi_header;
+       struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc);
        struct iscsi_conn *conn = isert_conn->conn;
        struct iscsi_cmd *cmd;
        struct isert_cmd *isert_cmd;
@@ -1296,8 +1297,8 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc)
        struct isert_conn *isert_conn = wc->qp->qp_context;
        struct ib_device *ib_dev = isert_conn->cm_id->device;
        struct iser_rx_desc *rx_desc = cqe_to_rx_desc(wc->wr_cqe);
-       struct iscsi_hdr *hdr = &rx_desc->iscsi_header;
-       struct iser_ctrl *iser_ctrl = &rx_desc->iser_header;
+       struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc);
+       struct iser_ctrl *iser_ctrl = isert_get_iser_hdr(rx_desc);
        uint64_t read_va = 0, write_va = 0;
        uint32_t read_stag = 0, write_stag = 0;
 
@@ -1311,7 +1312,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc)
        rx_desc->in_use = true;
 
        ib_dma_sync_single_for_cpu(ib_dev, rx_desc->dma_addr,
-                       ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
+                       ISER_RX_SIZE, DMA_FROM_DEVICE);
 
        isert_dbg("DMA: 0x%llx, iSCSI opcode: 0x%02x, ITT: 0x%08x, flags: 0x%02x dlen: %d\n",
                 rx_desc->dma_addr, hdr->opcode, hdr->itt, hdr->flags,
@@ -1346,7 +1347,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc)
                        read_stag, read_va, write_stag, write_va);
 
        ib_dma_sync_single_for_device(ib_dev, rx_desc->dma_addr,
-                       ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
+                       ISER_RX_SIZE, DMA_FROM_DEVICE);
 }
 
 static void
@@ -1360,8 +1361,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc)
                return;
        }
 
-       ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_req_dma,
-                       ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
+       ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_desc->dma_addr,
+                       ISER_RX_SIZE, DMA_FROM_DEVICE);
 
        isert_conn->login_req_len = wc->byte_len - ISER_HEADERS_LEN;
 
@@ -1376,8 +1377,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc)
        complete(&isert_conn->login_req_comp);
        mutex_unlock(&isert_conn->mutex);
 
-       ib_dma_sync_single_for_device(ib_dev, isert_conn->login_req_dma,
-                               ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
+       ib_dma_sync_single_for_device(ib_dev, isert_conn->login_desc->dma_addr,
+                               ISER_RX_SIZE, DMA_FROM_DEVICE);
 }
 
 static void
@@ -1470,7 +1471,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd, bool comp_err)
                        transport_generic_free_cmd(&cmd->se_cmd, 0);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                iscsit_release_cmd(cmd);
                break;
@@ -1648,7 +1649,7 @@ isert_do_control_comp(struct work_struct *work)
        switch (cmd->i_state) {
        case ISTATE_SEND_TASKMGTRSP:
                iscsit_tmr_post_handler(cmd, cmd->conn);
-               /* fall through */
+               fallthrough;
        case ISTATE_SEND_REJECT:
        case ISTATE_SEND_TEXTRSP:
                cmd->i_state = ISTATE_SENT_STATUS;
index c55f7d9bfced60cb51e67201fb74d5770b9f681d..7fee4a65e181abe61a387adcaa8342f4cc10c4d0 100644 (file)
                                ISERT_MAX_TX_MISC_PDUS  + \
                                ISERT_MAX_RX_MISC_PDUS)
 
-#define ISER_RX_PAD_SIZE       (ISCSI_DEF_MAX_RECV_SEG_LEN + 4096 - \
-               (ISER_RX_PAYLOAD_SIZE + sizeof(u64) + sizeof(struct ib_sge) + \
-                sizeof(struct ib_cqe) + sizeof(bool)))
+/*
+ * RX size is default of 8k plus headers, but data needs to align to
+ * 512 boundary, so use 1024 to have the extra space for alignment.
+ */
+#define ISER_RX_SIZE           (ISCSI_DEF_MAX_RECV_SEG_LEN + 1024)
 
 /* Maximum support is 16MB I/O size */
 #define ISCSI_ISER_MAX_SG_TABLESIZE    4096
@@ -81,21 +83,41 @@ enum iser_conn_state {
 };
 
 struct iser_rx_desc {
-       struct iser_ctrl iser_header;
-       struct iscsi_hdr iscsi_header;
-       char            data[ISCSI_DEF_MAX_RECV_SEG_LEN];
+       char            buf[ISER_RX_SIZE];
        u64             dma_addr;
        struct ib_sge   rx_sg;
        struct ib_cqe   rx_cqe;
        bool            in_use;
-       char            pad[ISER_RX_PAD_SIZE];
-} __packed;
+};
 
 static inline struct iser_rx_desc *cqe_to_rx_desc(struct ib_cqe *cqe)
 {
        return container_of(cqe, struct iser_rx_desc, rx_cqe);
 }
 
+static void *isert_get_iser_hdr(struct iser_rx_desc *desc)
+{
+       return PTR_ALIGN(desc->buf + ISER_HEADERS_LEN, 512) - ISER_HEADERS_LEN;
+}
+
+static size_t isert_get_hdr_offset(struct iser_rx_desc *desc)
+{
+       return isert_get_iser_hdr(desc) - (void *)desc->buf;
+}
+
+static void *isert_get_iscsi_hdr(struct iser_rx_desc *desc)
+{
+       return isert_get_iser_hdr(desc) + sizeof(struct iser_ctrl);
+}
+
+static void *isert_get_data(struct iser_rx_desc *desc)
+{
+       void *data = isert_get_iser_hdr(desc) + ISER_HEADERS_LEN;
+
+       WARN_ON((uintptr_t)data & 511);
+       return data;
+}
+
 struct iser_tx_desc {
        struct iser_ctrl iser_header;
        struct iscsi_hdr iscsi_header;
@@ -142,9 +164,8 @@ struct isert_conn {
        u32                     responder_resources;
        u32                     initiator_depth;
        bool                    pi_support;
-       struct iser_rx_desc     *login_req_buf;
+       struct iser_rx_desc     *login_desc;
        char                    *login_rsp_buf;
-       u64                     login_req_dma;
        int                     login_req_len;
        u64                     login_rsp_dma;
        struct iser_rx_desc     *rx_descs;
index 874a8eb7638c217d79c43d078dc3e7f727401dfa..4933085a864a250bb6c870516cbc579420c253a8 100644 (file)
@@ -547,7 +547,6 @@ static void vema_get(struct opa_vnic_vema_port *port,
                vema_get_mac_entries(port, recvd_mad, rsp_mad);
                break;
        case OPA_EM_ATTR_IFACE_UCAST_MACS:
-               /* fall through */
        case OPA_EM_ATTR_IFACE_MCAST_MACS:
                vema_get_mac_list(port, recvd_mad, rsp_mad, attr_id);
                break;
index 3d7877534bcc9d9cc33ab6f6605598ee3435d07b..cf6a2be61695dc56b8a3be5e54ea7016800dc875 100644 (file)
@@ -152,13 +152,6 @@ static struct attribute_group rtrs_srv_stats_attr_group = {
        .attrs = rtrs_srv_stats_attrs,
 };
 
-static void rtrs_srv_dev_release(struct device *dev)
-{
-       struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
-
-       kfree(srv);
-}
-
 static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
 {
        struct rtrs_srv *srv = sess->srv;
@@ -172,7 +165,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
                goto unlock;
        }
        srv->dev.class = rtrs_dev_class;
-       srv->dev.release = rtrs_srv_dev_release;
        err = dev_set_name(&srv->dev, "%s", sess->s.sessname);
        if (err)
                goto unlock;
@@ -182,16 +174,16 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
         * sysfs files are created
         */
        dev_set_uevent_suppress(&srv->dev, true);
-       err = device_register(&srv->dev);
+       err = device_add(&srv->dev);
        if (err) {
-               pr_err("device_register(): %d\n", err);
+               pr_err("device_add(): %d\n", err);
                goto put;
        }
        srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj);
        if (!srv->kobj_paths) {
                err = -ENOMEM;
                pr_err("kobject_create_and_add(): %d\n", err);
-               device_unregister(&srv->dev);
+               device_del(&srv->dev);
                goto unlock;
        }
        dev_set_uevent_suppress(&srv->dev, false);
@@ -216,7 +208,7 @@ rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
                kobject_del(srv->kobj_paths);
                kobject_put(srv->kobj_paths);
                mutex_unlock(&srv->paths_mutex);
-               device_unregister(&srv->dev);
+               device_del(&srv->dev);
        } else {
                mutex_unlock(&srv->paths_mutex);
        }
index a219bd1bdbc26525b3144356c1bc76080e67a273..28f6414dfa3dc444856590463123a1242338e534 100644 (file)
@@ -1319,6 +1319,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess)
        return sess->cur_cq_vector;
 }
 
+static void rtrs_srv_dev_release(struct device *dev)
+{
+       struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
+
+       kfree(srv);
+}
+
 static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx,
                                     const uuid_t *paths_uuid)
 {
@@ -1336,6 +1343,8 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx,
        uuid_copy(&srv->paths_uuid, paths_uuid);
        srv->queue_depth = sess_queue_depth;
        srv->ctx = ctx;
+       device_initialize(&srv->dev);
+       srv->dev.release = rtrs_srv_dev_release;
 
        srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks),
                              GFP_KERNEL);
index e78c4c768990934d979b21d1e73c1efc399e1eb4..76ffdec5c183f1d4fcd2635134143e6c19c2e4a6 100644 (file)
@@ -102,12 +102,12 @@ static irqreturn_t fsia6b_serio_irq(struct serio *serio,
                                        input_report_key(fsia6b->dev,
                                                         sw_id++,
                                                         sw_state == 0);
-                                       /* fall-through */
+                                       fallthrough;
                                case '2':
                                        input_report_key(fsia6b->dev,
                                                         sw_id++,
                                                         sw_state == 1);
-                                       /* fall-through */
+                                       fallthrough;
                                case '1':
                                        input_report_key(fsia6b->dev,
                                                         sw_id++,
index 88df68cc4ac656f8166f57a327119703f2ea0190..d37645e496ff17838d443699d549e42ec0f5d4c7 100644 (file)
@@ -885,7 +885,6 @@ static int gc_setup_pad(struct gc *gc, int idx, int pad_type)
 
        case GC_MULTI:
                input_set_capability(input_dev, EV_KEY, BTN_TRIGGER);
-               /* fall through */
                break;
 
        case GC_PSX:
index 3eefee2ee2a12a27464ce94fbd7eb9032de1fc78..854d5e7587241024c4bdd08398402db16c88b7be 100644 (file)
 #include "trackpoint.h"
 
 static const char * const trackpoint_variants[] = {
-       [TP_VARIANT_IBM]        = "IBM",
-       [TP_VARIANT_ALPS]       = "ALPS",
-       [TP_VARIANT_ELAN]       = "Elan",
-       [TP_VARIANT_NXP]        = "NXP",
+       [TP_VARIANT_IBM]                = "IBM",
+       [TP_VARIANT_ALPS]               = "ALPS",
+       [TP_VARIANT_ELAN]               = "Elan",
+       [TP_VARIANT_NXP]                = "NXP",
+       [TP_VARIANT_JYT_SYNAPTICS]      = "JYT_Synaptics",
+       [TP_VARIANT_SYNAPTICS]          = "Synaptics",
 };
 
 /*
index 5cb93ed260856101765b4df8f35629440f7c0973..eb5412904fe0750320769040441b58bb7f6a5856 100644 (file)
  * 0x01 was the original IBM trackpoint, others implement very limited
  * subset of trackpoint features.
  */
-#define TP_VARIANT_IBM         0x01
-#define TP_VARIANT_ALPS                0x02
-#define TP_VARIANT_ELAN                0x03
-#define TP_VARIANT_NXP         0x04
+#define TP_VARIANT_IBM                 0x01
+#define TP_VARIANT_ALPS                        0x02
+#define TP_VARIANT_ELAN                        0x03
+#define TP_VARIANT_NXP                 0x04
+#define TP_VARIANT_JYT_SYNAPTICS       0x05
+#define TP_VARIANT_SYNAPTICS           0x06
 
 /*
  * Commands
index 7d7f737027264eb8cf33c45e815c155de3149ea6..37fb9aa88f9c37a72af55f1c7d35f04ee316d9c3 100644 (file)
@@ -548,6 +548,14 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"),
                },
        },
+       {
+               /* Entroware Proteus */
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Entroware"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"),
+                       DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"),
+               },
+       },
        { }
 };
 
@@ -676,6 +684,14 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "33474HU"),
                },
        },
+       {
+               /* Entroware Proteus */
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Entroware"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"),
+                       DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"),
+               },
+       },
        { }
 };
 
index 959c1d82aa662cd5db70857fc8feefc8efb57708..1cedb45ba49702e03bb94106f67ff540fab62326 100644 (file)
@@ -213,7 +213,7 @@ static void wacom_handle_model_response(struct wacom *wacom)
                case 0x3731: /* PL-710 */
                        wacom->res_x = 2540;
                        wacom->res_y = 2540;
-                       /* fall through */
+                       fallthrough;
                case 0x3535: /* PL-550 */
                case 0x3830: /* PL-800 */
                        wacom->extra_z_bits = 2;
index 6b71b0aff1152f0f50c4bad8a8b6343ccfbc3c0b..98f17fa3a8926e2e02d7e9c0bba3090291905cec 100644 (file)
@@ -477,7 +477,7 @@ static int mxt_lookup_bootloader_address(struct mxt_data *data, bool retry)
                        bootloader = appmode - 0x24;
                        break;
                }
-               /* Fall through - for normal case */
+               fallthrough;    /* for normal case */
        case 0x4c:
        case 0x4d:
        case 0x5a:
index 607d1aeb595d7fcf765725bd20508bf56529aad0..bb1699e0d3c78260c4b3807b550df6b907c815ff 100644 (file)
@@ -290,7 +290,7 @@ static int wm831x_ts_probe(struct platform_device *pdev)
                default:
                        dev_err(&pdev->dev, "Unsupported ISEL setting: %d\n",
                                pdata->isel);
-                       /* Fall through */
+                       fallthrough;
                case 200:
                case 0:
                        wm831x_set_bits(wm831x, WM831X_TOUCH_CONTROL_2,
index befd111049c0e36748c326711df5741ab5b2be7e..cf07491b7415be7363f253d28259e60f8a834735 100644 (file)
@@ -55,12 +55,18 @@ static int icc_summary_show(struct seq_file *s, void *data)
 
                        icc_summary_show_one(s, n);
                        hlist_for_each_entry(r, &n->req_list, req_node) {
+                               u32 avg_bw = 0, peak_bw = 0;
+
                                if (!r->dev)
                                        continue;
 
+                               if (r->enabled) {
+                                       avg_bw = r->avg_bw;
+                                       peak_bw = r->peak_bw;
+                               }
+
                                seq_printf(s, "  %-27s %12u %12u %12u\n",
-                                          dev_name(r->dev), r->tag, r->avg_bw,
-                                          r->peak_bw);
+                                          dev_name(r->dev), r->tag, avg_bw, peak_bw);
                        }
                }
        }
index a3d2ef1d9903746e67768332872ac09376ba1b0b..609db9c95fd7a1c37c50ffd3bf25e1c2956c6a8c 100644 (file)
@@ -52,8 +52,20 @@ static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b)
                return 1;
 }
 
+static u64 bcm_div(u64 num, u32 base)
+{
+       /* Ensure that small votes aren't lost. */
+       if (num && num < base)
+               return 1;
+
+       do_div(num, base);
+
+       return num;
+}
+
 static void bcm_aggregate(struct qcom_icc_bcm *bcm)
 {
+       struct qcom_icc_node *node;
        size_t i, bucket;
        u64 agg_avg[QCOM_ICC_NUM_BUCKETS] = {0};
        u64 agg_peak[QCOM_ICC_NUM_BUCKETS] = {0};
@@ -61,22 +73,21 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm)
 
        for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) {
                for (i = 0; i < bcm->num_nodes; i++) {
-                       temp = bcm->nodes[i]->sum_avg[bucket] * bcm->aux_data.width;
-                       do_div(temp, bcm->nodes[i]->buswidth * bcm->nodes[i]->channels);
+                       node = bcm->nodes[i];
+                       temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width,
+                                      node->buswidth * node->channels);
                        agg_avg[bucket] = max(agg_avg[bucket], temp);
 
-                       temp = bcm->nodes[i]->max_peak[bucket] * bcm->aux_data.width;
-                       do_div(temp, bcm->nodes[i]->buswidth);
+                       temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width,
+                                      node->buswidth);
                        agg_peak[bucket] = max(agg_peak[bucket], temp);
                }
 
                temp = agg_avg[bucket] * 1000ULL;
-               do_div(temp, bcm->aux_data.unit);
-               bcm->vote_x[bucket] = temp;
+               bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit);
 
                temp = agg_peak[bucket] * 1000ULL;
-               do_div(temp, bcm->aux_data.unit);
-               bcm->vote_y[bucket] = temp;
+               bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
        }
 
        if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
index 1f061d91e0b84972352418b131e92656c72ffb8e..626b97d0dd21a9fd62013841ed343acaff27171d 100644 (file)
@@ -10,7 +10,7 @@ config AMD_IOMMU
        select IOMMU_API
        select IOMMU_IOVA
        select IOMMU_DMA
-       depends on X86_64 && PCI && ACPI
+       depends on X86_64 && PCI && ACPI && HAVE_CMPXCHG_DOUBLE
        help
          With this option you can enable support for AMD IOMMU hardware in
          your system. An IOMMU is a hardware component which provides
index 958050c213f98849239efac787bc329269d8cea8..1ba6b4cc56e803d4316a925ff5be88cdefb83fbe 100644 (file)
@@ -1103,25 +1103,6 @@ static int __init add_early_maps(void)
        return 0;
 }
 
-/*
- * Reads the device exclusion range from ACPI and initializes the IOMMU with
- * it
- */
-static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
-{
-       if (!(m->flags & IVMD_FLAG_EXCL_RANGE))
-               return;
-
-       /*
-        * Treat per-device exclusion ranges as r/w unity-mapped regions
-        * since some buggy BIOSes might lead to the overwritten exclusion
-        * range (exclusion_start and exclusion_length members). This
-        * happens when there are multiple exclusion ranges (IVMD entries)
-        * defined in ACPI table.
-        */
-       m->flags = (IVMD_FLAG_IW | IVMD_FLAG_IR | IVMD_FLAG_UNITY_MAP);
-}
-
 /*
  * Takes a pointer to an AMD IOMMU entry in the ACPI table and
  * initializes the hardware and our data structures with it.
@@ -1511,7 +1492,14 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h)
                        iommu->mmio_phys_end = MMIO_REG_END_OFFSET;
                else
                        iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET;
-               if (((h->efr_attr & (0x1 << IOMMU_FEAT_GASUP_SHIFT)) == 0))
+
+               /*
+                * Note: GA (128-bit IRTE) mode requires cmpxchg16b supports.
+                * GAM also requires GA mode. Therefore, we need to
+                * check cmpxchg16b support before enabling it.
+                */
+               if (!boot_cpu_has(X86_FEATURE_CX16) ||
+                   ((h->efr_attr & (0x1 << IOMMU_FEAT_GASUP_SHIFT)) == 0))
                        amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY;
                break;
        case 0x11:
@@ -1520,8 +1508,18 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h)
                        iommu->mmio_phys_end = MMIO_REG_END_OFFSET;
                else
                        iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET;
-               if (((h->efr_reg & (0x1 << IOMMU_EFR_GASUP_SHIFT)) == 0))
+
+               /*
+                * Note: GA (128-bit IRTE) mode requires cmpxchg16b supports.
+                * XT, GAM also requires GA mode. Therefore, we need to
+                * check cmpxchg16b support before enabling them.
+                */
+               if (!boot_cpu_has(X86_FEATURE_CX16) ||
+                   ((h->efr_reg & (0x1 << IOMMU_EFR_GASUP_SHIFT)) == 0)) {
                        amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY;
+                       break;
+               }
+
                /*
                 * Note: Since iommu_update_intcapxt() leverages
                 * the IOMMU MMIO access to MSI capability block registers
@@ -2056,30 +2054,6 @@ static void __init free_unity_maps(void)
        }
 }
 
-/* called when we find an exclusion range definition in ACPI */
-static int __init init_exclusion_range(struct ivmd_header *m)
-{
-       int i;
-
-       switch (m->type) {
-       case ACPI_IVMD_TYPE:
-               set_device_exclusion_range(m->devid, m);
-               break;
-       case ACPI_IVMD_TYPE_ALL:
-               for (i = 0; i <= amd_iommu_last_bdf; ++i)
-                       set_device_exclusion_range(i, m);
-               break;
-       case ACPI_IVMD_TYPE_RANGE:
-               for (i = m->devid; i <= m->aux; ++i)
-                       set_device_exclusion_range(i, m);
-               break;
-       default:
-               break;
-       }
-
-       return 0;
-}
-
 /* called for unity map ACPI definition */
 static int __init init_unity_map_range(struct ivmd_header *m)
 {
@@ -2090,9 +2064,6 @@ static int __init init_unity_map_range(struct ivmd_header *m)
        if (e == NULL)
                return -ENOMEM;
 
-       if (m->flags & IVMD_FLAG_EXCL_RANGE)
-               init_exclusion_range(m);
-
        switch (m->type) {
        default:
                kfree(e);
@@ -2116,6 +2087,16 @@ static int __init init_unity_map_range(struct ivmd_header *m)
        e->address_end = e->address_start + PAGE_ALIGN(m->range_length);
        e->prot = m->flags >> 1;
 
+       /*
+        * Treat per-device exclusion ranges as r/w unity-mapped regions
+        * since some buggy BIOSes might lead to the overwritten exclusion
+        * range (exclusion_start and exclusion_length members). This
+        * happens when there are multiple exclusion ranges (IVMD entries)
+        * defined in ACPI table.
+        */
+       if (m->flags & IVMD_FLAG_EXCL_RANGE)
+               e->prot = (IVMD_FLAG_IW | IVMD_FLAG_IR) >> 1;
+
        DUMP_printk("%s devid_start: %02x:%02x.%x devid_end: %02x:%02x.%x"
                    " range_start: %016llx range_end: %016llx flags: %x\n", s,
                    PCI_BUS_NUM(e->devid_start), PCI_SLOT(e->devid_start),
@@ -2258,7 +2239,7 @@ static void iommu_enable_ga(struct amd_iommu *iommu)
        switch (amd_iommu_guest_ir) {
        case AMD_IOMMU_GUEST_IR_VAPIC:
                iommu_feature_enable(iommu, CONTROL_GAM_EN);
-               /* Fall through */
+               fallthrough;
        case AMD_IOMMU_GUEST_IR_LEGACY_GA:
                iommu_feature_enable(iommu, CONTROL_GA_EN);
                iommu->irte_ops = &irte_128_ops;
index ba9f3dbc5b94796adb199006390bdbcad8741963..10e4200d355204d51ac988477874b3c2be2976c3 100644 (file)
@@ -2659,7 +2659,12 @@ static int amd_iommu_def_domain_type(struct device *dev)
        if (!dev_data)
                return 0;
 
-       if (dev_data->iommu_v2)
+       /*
+        * Do not identity map IOMMUv2 capable devices when memory encryption is
+        * active, because some of those devices (AMD GPUs) don't have the
+        * encryption bit in their DMA-mask and require remapping.
+        */
+       if (!mem_encrypt_active() && dev_data->iommu_v2)
                return IOMMU_DOMAIN_IDENTITY;
 
        return 0;
@@ -3292,6 +3297,7 @@ out:
 static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte,
                          struct amd_ir_data *data)
 {
+       bool ret;
        struct irq_remap_table *table;
        struct amd_iommu *iommu;
        unsigned long flags;
@@ -3309,10 +3315,18 @@ static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte,
 
        entry = (struct irte_ga *)table->table;
        entry = &entry[index];
-       entry->lo.fields_remap.valid = 0;
-       entry->hi.val = irte->hi.val;
-       entry->lo.val = irte->lo.val;
-       entry->lo.fields_remap.valid = 1;
+
+       ret = cmpxchg_double(&entry->lo.val, &entry->hi.val,
+                            entry->lo.val, entry->hi.val,
+                            irte->lo.val, irte->hi.val);
+       /*
+        * We use cmpxchg16 to atomically update the 128-bit IRTE,
+        * and it cannot be updated by the hardware or other processors
+        * behind us, so the return value of cmpxchg16 should be the
+        * same as the old value.
+        */
+       WARN_ON(!ret);
+
        if (data)
                data->ref = entry;
 
@@ -3826,14 +3840,18 @@ int amd_iommu_activate_guest_mode(void *data)
 {
        struct amd_ir_data *ir_data = (struct amd_ir_data *)data;
        struct irte_ga *entry = (struct irte_ga *) ir_data->entry;
+       u64 valid;
 
        if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) ||
            !entry || entry->lo.fields_vapic.guest_mode)
                return 0;
 
+       valid = entry->lo.fields_vapic.valid;
+
        entry->lo.val = 0;
        entry->hi.val = 0;
 
+       entry->lo.fields_vapic.valid       = valid;
        entry->lo.fields_vapic.guest_mode  = 1;
        entry->lo.fields_vapic.ga_log_intr = 1;
        entry->hi.fields.ga_root_ptr       = ir_data->ga_root_ptr;
@@ -3850,14 +3868,18 @@ int amd_iommu_deactivate_guest_mode(void *data)
        struct amd_ir_data *ir_data = (struct amd_ir_data *)data;
        struct irte_ga *entry = (struct irte_ga *) ir_data->entry;
        struct irq_cfg *cfg = ir_data->cfg;
+       u64 valid;
 
        if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) ||
            !entry || !entry->lo.fields_vapic.guest_mode)
                return 0;
 
+       valid = entry->lo.fields_remap.valid;
+
        entry->lo.val = 0;
        entry->hi.val = 0;
 
+       entry->lo.fields_remap.valid       = valid;
        entry->lo.fields_remap.dm          = apic->irq_dest_mode;
        entry->lo.fields_remap.int_type    = apic->irq_delivery_mode;
        entry->hi.fields.vector            = cfg->vector;
index c259108ab6dd78fcb0514fd8d6f03240dc21b7d2..0d175aed1d92fb4203fbebf09c4d2fd1854bf871 100644 (file)
@@ -737,6 +737,13 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids)
 
        might_sleep();
 
+       /*
+        * When memory encryption is active the device is likely not in a
+        * direct-mapped domain. Forbid using IOMMUv2 functionality for now.
+        */
+       if (mem_encrypt_active())
+               return -ENODEV;
+
        if (!amd_iommu_v2_supported())
                return -ENODEV;
 
index 7196207be7eab29d118588cefa3e8ff1f44c1863..c192544e874b1799d425ecf030a48c4b08053079 100644 (file)
@@ -903,7 +903,7 @@ static int arm_smmu_cmdq_build_cmd(u64 *cmd, struct arm_smmu_cmdq_ent *ent)
                break;
        case CMDQ_OP_CFGI_CD:
                cmd[0] |= FIELD_PREP(CMDQ_CFGI_0_SSID, ent->cfgi.ssid);
-               /* Fallthrough */
+               fallthrough;
        case CMDQ_OP_CFGI_STE:
                cmd[0] |= FIELD_PREP(CMDQ_CFGI_0_SID, ent->cfgi.sid);
                cmd[1] |= FIELD_PREP(CMDQ_CFGI_1_LEAF, ent->cfgi.leaf);
@@ -936,7 +936,7 @@ static int arm_smmu_cmdq_build_cmd(u64 *cmd, struct arm_smmu_cmdq_ent *ent)
                break;
        case CMDQ_OP_TLBI_NH_ASID:
                cmd[0] |= FIELD_PREP(CMDQ_TLBI_0_ASID, ent->tlbi.asid);
-               /* Fallthrough */
+               fallthrough;
        case CMDQ_OP_TLBI_S12_VMALL:
                cmd[0] |= FIELD_PREP(CMDQ_TLBI_0_VMID, ent->tlbi.vmid);
                break;
@@ -1036,7 +1036,6 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu)
                 */
                return;
        case CMDQ_ERR_CERROR_ILL_IDX:
-               /* Fallthrough */
        default:
                break;
        }
@@ -3758,7 +3757,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
        switch (FIELD_GET(IDR0_STALL_MODEL, reg)) {
        case IDR0_STALL_MODEL_FORCE:
                smmu->features |= ARM_SMMU_FEAT_STALL_FORCE;
-               /* Fallthrough */
+               fallthrough;
        case IDR0_STALL_MODEL_STALL:
                smmu->features |= ARM_SMMU_FEAT_STALLS;
        }
@@ -3778,7 +3777,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
        switch (FIELD_GET(IDR0_TTF, reg)) {
        case IDR0_TTF_AARCH32_64:
                smmu->ias = 40;
-               /* Fallthrough */
+               fallthrough;
        case IDR0_TTF_AARCH64:
                break;
        default:
@@ -3875,7 +3874,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
        default:
                dev_info(smmu->dev,
                        "unknown output address size. Truncating to 48-bit\n");
-               /* Fallthrough */
+               fallthrough;
        case IDR5_OAS_48_BIT:
                smmu->oas = 48;
        }
index bad3c0ce10cb2f208803210938dfcbfc5e159e7f..de324b4eedfe9cbce4fa712ab421806061213b2f 100644 (file)
@@ -1295,13 +1295,17 @@ static int exynos_iommu_of_xlate(struct device *dev,
                return -ENODEV;
 
        data = platform_get_drvdata(sysmmu);
-       if (!data)
+       if (!data) {
+               put_device(&sysmmu->dev);
                return -ENODEV;
+       }
 
        if (!owner) {
                owner = kzalloc(sizeof(*owner), GFP_KERNEL);
-               if (!owner)
+               if (!owner) {
+                       put_device(&sysmmu->dev);
                        return -ENOMEM;
+               }
 
                INIT_LIST_HEAD(&owner->controllers);
                mutex_init(&owner->rpm_lock);
index e9864e52b0e96a5af1e2cff060996430cab1218f..2239c211178b667e01f6a653bc52c7347f5d818b 100644 (file)
@@ -123,29 +123,29 @@ static inline unsigned int level_to_offset_bits(int level)
        return (level - 1) * LEVEL_STRIDE;
 }
 
-static inline int pfn_level_offset(unsigned long pfn, int level)
+static inline int pfn_level_offset(u64 pfn, int level)
 {
        return (pfn >> level_to_offset_bits(level)) & LEVEL_MASK;
 }
 
-static inline unsigned long level_mask(int level)
+static inline u64 level_mask(int level)
 {
-       return -1UL << level_to_offset_bits(level);
+       return -1ULL << level_to_offset_bits(level);
 }
 
-static inline unsigned long level_size(int level)
+static inline u64 level_size(int level)
 {
-       return 1UL << level_to_offset_bits(level);
+       return 1ULL << level_to_offset_bits(level);
 }
 
-static inline unsigned long align_to_level(unsigned long pfn, int level)
+static inline u64 align_to_level(u64 pfn, int level)
 {
        return (pfn + level_size(level) - 1) & level_mask(level);
 }
 
 static inline unsigned long lvl_to_nr_pages(unsigned int lvl)
 {
-       return  1 << min_t(int, (lvl - 1) * LEVEL_STRIDE, MAX_AGAW_PFN_WIDTH);
+       return 1UL << min_t(int, (lvl - 1) * LEVEL_STRIDE, MAX_AGAW_PFN_WIDTH);
 }
 
 /* VT-d pages must always be _smaller_ than MM pages. Otherwise things
@@ -364,7 +364,6 @@ static int iommu_skip_te_disable;
 int intel_iommu_gfx_mapped;
 EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped);
 
-#define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1))
 #define DEFER_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-2))
 struct device_domain_info *get_domain_info(struct device *dev)
 {
@@ -374,8 +373,7 @@ struct device_domain_info *get_domain_info(struct device *dev)
                return NULL;
 
        info = dev_iommu_priv_get(dev);
-       if (unlikely(info == DUMMY_DEVICE_DOMAIN_INFO ||
-                    info == DEFER_DEVICE_DOMAIN_INFO))
+       if (unlikely(info == DEFER_DEVICE_DOMAIN_INFO))
                return NULL;
 
        return info;
@@ -742,11 +740,6 @@ struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
        return &context[devfn];
 }
 
-static int iommu_dummy(struct device *dev)
-{
-       return dev_iommu_priv_get(dev) == DUMMY_DEVICE_DOMAIN_INFO;
-}
-
 static bool attach_deferred(struct device *dev)
 {
        return dev_iommu_priv_get(dev) == DEFER_DEVICE_DOMAIN_INFO;
@@ -779,6 +772,53 @@ is_downstream_to_pci_bridge(struct device *dev, struct device *bridge)
        return false;
 }
 
+static bool quirk_ioat_snb_local_iommu(struct pci_dev *pdev)
+{
+       struct dmar_drhd_unit *drhd;
+       u32 vtbar;
+       int rc;
+
+       /* We know that this device on this chipset has its own IOMMU.
+        * If we find it under a different IOMMU, then the BIOS is lying
+        * to us. Hope that the IOMMU for this device is actually
+        * disabled, and it needs no translation...
+        */
+       rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0), 0xb0, &vtbar);
+       if (rc) {
+               /* "can't" happen */
+               dev_info(&pdev->dev, "failed to run vt-d quirk\n");
+               return false;
+       }
+       vtbar &= 0xffff0000;
+
+       /* we know that the this iommu should be at offset 0xa000 from vtbar */
+       drhd = dmar_find_matched_drhd_unit(pdev);
+       if (!drhd || drhd->reg_base_addr - vtbar != 0xa000) {
+               pr_warn_once(FW_BUG "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n");
+               add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
+               return true;
+       }
+
+       return false;
+}
+
+static bool iommu_is_dummy(struct intel_iommu *iommu, struct device *dev)
+{
+       if (!iommu || iommu->drhd->ignored)
+               return true;
+
+       if (dev_is_pci(dev)) {
+               struct pci_dev *pdev = to_pci_dev(dev);
+
+               if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
+                   pdev->device == PCI_DEVICE_ID_INTEL_IOAT_SNB &&
+                   quirk_ioat_snb_local_iommu(pdev))
+                       return true;
+       }
+
+       return false;
+}
+
 struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn)
 {
        struct dmar_drhd_unit *drhd = NULL;
@@ -788,7 +828,7 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn)
        u16 segment = 0;
        int i;
 
-       if (!dev || iommu_dummy(dev))
+       if (!dev)
                return NULL;
 
        if (dev_is_pci(dev)) {
@@ -805,7 +845,7 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn)
                dev = &ACPI_COMPANION(dev)->dev;
 
        rcu_read_lock();
-       for_each_active_iommu(iommu, drhd) {
+       for_each_iommu(iommu, drhd) {
                if (pdev && segment != drhd->segment)
                        continue;
 
@@ -841,6 +881,9 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn)
        }
        iommu = NULL;
  out:
+       if (iommu_is_dummy(iommu, dev))
+               iommu = NULL;
+
        rcu_read_unlock();
 
        return iommu;
@@ -2447,7 +2490,7 @@ struct dmar_domain *find_domain(struct device *dev)
 {
        struct device_domain_info *info;
 
-       if (unlikely(attach_deferred(dev) || iommu_dummy(dev)))
+       if (unlikely(attach_deferred(dev)))
                return NULL;
 
        /* No lock here, assumes no domain exit in normal case */
@@ -2621,7 +2664,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
                }
 
                /* Setup the PASID entry for requests without PASID: */
-               spin_lock(&iommu->lock);
+               spin_lock_irqsave(&iommu->lock, flags);
                if (hw_pass_through && domain_type_is_si(domain))
                        ret = intel_pasid_setup_pass_through(iommu, domain,
                                        dev, PASID_RID2PASID);
@@ -2631,7 +2674,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
                else
                        ret = intel_pasid_setup_second_level(iommu, domain,
                                        dev, PASID_RID2PASID);
-               spin_unlock(&iommu->lock);
+               spin_unlock_irqrestore(&iommu->lock, flags);
                if (ret) {
                        dev_err(dev, "Setup RID2PASID failed\n");
                        dmar_remove_one_dev_info(dev);
@@ -3989,35 +4032,6 @@ static void __init iommu_exit_mempool(void)
        iova_cache_put();
 }
 
-static void quirk_ioat_snb_local_iommu(struct pci_dev *pdev)
-{
-       struct dmar_drhd_unit *drhd;
-       u32 vtbar;
-       int rc;
-
-       /* We know that this device on this chipset has its own IOMMU.
-        * If we find it under a different IOMMU, then the BIOS is lying
-        * to us. Hope that the IOMMU for this device is actually
-        * disabled, and it needs no translation...
-        */
-       rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0), 0xb0, &vtbar);
-       if (rc) {
-               /* "can't" happen */
-               dev_info(&pdev->dev, "failed to run vt-d quirk\n");
-               return;
-       }
-       vtbar &= 0xffff0000;
-
-       /* we know that the this iommu should be at offset 0xa000 from vtbar */
-       drhd = dmar_find_matched_drhd_unit(pdev);
-       if (!drhd || drhd->reg_base_addr - vtbar != 0xa000) {
-               pr_warn_once(FW_BUG "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n");
-               add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
-               dev_iommu_priv_set(&pdev->dev, DUMMY_DEVICE_DOMAIN_INFO);
-       }
-}
-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SNB, quirk_ioat_snb_local_iommu);
-
 static void __init init_no_remapping_devices(void)
 {
        struct dmar_drhd_unit *drhd;
@@ -4049,12 +4063,8 @@ static void __init init_no_remapping_devices(void)
                /* This IOMMU has *only* gfx devices. Either bypass it or
                   set the gfx_mapped flag, as appropriate */
                drhd->gfx_dedicated = 1;
-               if (!dmar_map_gfx) {
+               if (!dmar_map_gfx)
                        drhd->ignored = 1;
-                       for_each_active_dev_scope(drhd->devices,
-                                                 drhd->devices_cnt, i, dev)
-                               dev_iommu_priv_set(dev, DUMMY_DEVICE_DOMAIN_INFO);
-               }
        }
 }
 
@@ -5070,7 +5080,6 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
 
        switch (type) {
        case IOMMU_DOMAIN_DMA:
-       /* fallthrough */
        case IOMMU_DOMAIN_UNMANAGED:
                dmar_domain = alloc_domain(0);
                if (!dmar_domain) {
index 23583b0e66a5e12dc18cbb79dbc1b8ffa6dc7552..8f4ce72570ce34beb8d16c624cd6f7938771ff7d 100644 (file)
@@ -508,12 +508,18 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu)
 
        /* Enable interrupt-remapping */
        iommu->gcmd |= DMA_GCMD_IRE;
-       iommu->gcmd &= ~DMA_GCMD_CFI;  /* Block compatibility-format MSIs */
        writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
-
        IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
                      readl, (sts & DMA_GSTS_IRES), sts);
 
+       /* Block compatibility-format MSIs */
+       if (sts & DMA_GSTS_CFIS) {
+               iommu->gcmd &= ~DMA_GCMD_CFI;
+               writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
+               IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
+                             readl, !(sts & DMA_GSTS_CFIS), sts);
+       }
+
        /*
         * With CFI clear in the Global Command register, we should be
         * protected from dangerous (i.e. compatibility) interrupts
index b4da396cce60401427d4e35a8aa552c3e47e56fc..2bfdd57348443221096a29005ee3a8a63abc0315 100644 (file)
@@ -440,7 +440,7 @@ static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
        default:
                dev_warn(vdev->dev, "unknown resv mem subtype 0x%x\n",
                         mem->subtype);
-               /* Fall-through */
+               fallthrough;
        case VIRTIO_IOMMU_RESV_MEM_T_RESERVED:
                region = iommu_alloc_resv_region(start, size, 0,
                                                 IOMMU_RESV_RESERVED);
index bb70b7177f94e770956a3f079e60ad62f7c9d782..bfc9719dbcdc31c423539c83c9c19517a291eb09 100644 (file)
@@ -425,7 +425,7 @@ config GOLDFISH_PIC
          for Goldfish based virtual platforms.
 
 config QCOM_PDC
-       tristate "QCOM PDC"
+       bool "QCOM PDC"
        depends on ARCH_QCOM
        select IRQ_DOMAIN_HIERARCHY
        help
index 95f097448f9719384763c67819c7e93a074c7779..548de7538632a0491ec438f8f67dd18ef750d940 100644 (file)
@@ -2737,7 +2737,7 @@ static bool allocate_vpe_l2_table(int cpu, u32 id)
        switch (gpsz) {
        default:
                WARN_ON(1);
-               /* fall through */
+               fallthrough;
        case GIC_PAGE_SIZE_4K:
                psz = SZ_4K;
                break;
@@ -2832,7 +2832,7 @@ static int allocate_vpe_l1_table(void)
        switch (gpsz) {
        default:
                gpsz = GIC_PAGE_SIZE_4K;
-               /* fall through */
+               fallthrough;
        case GIC_PAGE_SIZE_4K:
                psz = SZ_4K;
                break;
index 324f280ff606614d5d204ee54194f571f924113b..850842f27beeec8229c973ff2602618ba0ed74d8 100644 (file)
@@ -965,10 +965,10 @@ static void gic_cpu_sys_reg_init(void)
                case 7:
                        write_gicreg(0, ICC_AP0R3_EL1);
                        write_gicreg(0, ICC_AP0R2_EL1);
-               /* Fall through */
+                       fallthrough;
                case 6:
                        write_gicreg(0, ICC_AP0R1_EL1);
-               /* Fall through */
+                       fallthrough;
                case 5:
                case 4:
                        write_gicreg(0, ICC_AP0R0_EL1);
@@ -982,10 +982,10 @@ static void gic_cpu_sys_reg_init(void)
        case 7:
                write_gicreg(0, ICC_AP1R3_EL1);
                write_gicreg(0, ICC_AP1R2_EL1);
-               /* Fall through */
+               fallthrough;
        case 6:
                write_gicreg(0, ICC_AP1R1_EL1);
-               /* Fall through */
+               fallthrough;
        case 5:
        case 4:
                write_gicreg(0, ICC_AP1R0_EL1);
index 4f74c15c475557ab2c2c6dd88634df077109e7d6..7031ef44de4f30c0bdbc3315e1b760dddbb68055 100644 (file)
@@ -259,7 +259,7 @@ static int __init imx_gpcv2_irqchip_init(struct device_node *node,
                case 4:
                        writel_relaxed(~0, reg + GPC_IMR1_CORE2);
                        writel_relaxed(~0, reg + GPC_IMR1_CORE3);
-                       /* fall through */
+                       fallthrough;
                case 2:
                        writel_relaxed(~0, reg + GPC_IMR1_CORE0);
                        writel_relaxed(~0, reg + GPC_IMR1_CORE1);
index 9f3da4260ca658e9a711feeefef1ecc00ce99dde..b61a8901ef72211df72384cd14475267356fa3f4 100644 (file)
@@ -125,7 +125,7 @@ static int __init ingenic_intc_of_init(struct device_node *node,
                irq_reg_writel(gc, IRQ_MSK(32), JZ_REG_INTC_SET_MASK);
        }
 
-       if (request_irq(parent_irq, intc_cascade, 0,
+       if (request_irq(parent_irq, intc_cascade, IRQF_NO_SUSPEND,
                        "SoC intc cascade interrupt", NULL))
                pr_err("Failed to register SoC intc cascade interrupt\n");
        return 0;
index aacfa012c082fb8321cc1c8e0eec546153d87832..215885962bb0abd7e164152d55e2bdb5e80c32e7 100644 (file)
@@ -480,7 +480,7 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int virq,
        case GIC_LOCAL_INT_TIMER:
                /* CONFIG_MIPS_CMP workaround (see __gic_init) */
                map = GIC_MAP_PIN_MAP_TO_PIN | timer_cpu_pin;
-               /* fall-through */
+               fallthrough;
        case GIC_LOCAL_INT_PERFCTR:
        case GIC_LOCAL_INT_FDC:
                /*
index 62a61275aaa315ff39331f9700996f89a387364e..69ba8ce3c17856be68c9330323f59acb00d55f78 100644 (file)
@@ -295,6 +295,4 @@ out_free:
        return ret;
 }
 
-IRQCHIP_PLATFORM_DRIVER_BEGIN(mtk_cirq)
-IRQCHIP_MATCH("mediatek,mtk-cirq", mtk_cirq_of_init)
-IRQCHIP_PLATFORM_DRIVER_END(mtk_cirq)
+IRQCHIP_DECLARE(mtk_cirq, "mediatek,mtk-cirq", mtk_cirq_of_init);
index 7299c5ab4d107819d68d63fa6e18bc53af1cbaba..6ff98b87e5c043344dda7d2214cf67978112ff65 100644 (file)
@@ -231,6 +231,4 @@ out_free_chip:
        kfree(chip_data);
        return ret;
 }
-IRQCHIP_PLATFORM_DRIVER_BEGIN(mtk_sysirq)
-IRQCHIP_MATCH("mediatek,mt6577-sysirq", mtk_sysirq_of_init)
-IRQCHIP_PLATFORM_DRIVER_END(mtk_sysirq)
+IRQCHIP_DECLARE(mtk_sysirq, "mediatek,mt6577-sysirq", mtk_sysirq_of_init);
index 03a36be757d8111234cf534f6215addbdf96e510..0c2c61db26b45dfaf1bb995c89e9cdcdeb276431 100644 (file)
@@ -416,6 +416,16 @@ static void stm32_irq_ack(struct irq_data *d)
        irq_gc_unlock(gc);
 }
 
+/* directly set the target bit without reading first. */
+static inline void stm32_exti_write_bit(struct irq_data *d, u32 reg)
+{
+       struct stm32_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
+       void __iomem *base = chip_data->host_data->base;
+       u32 val = BIT(d->hwirq % IRQS_PER_BANK);
+
+       writel_relaxed(val, base + reg);
+}
+
 static inline u32 stm32_exti_set_bit(struct irq_data *d, u32 reg)
 {
        struct stm32_exti_chip_data *chip_data = irq_data_get_irq_chip_data(d);
@@ -449,9 +459,9 @@ static void stm32_exti_h_eoi(struct irq_data *d)
 
        raw_spin_lock(&chip_data->rlock);
 
-       stm32_exti_set_bit(d, stm32_bank->rpr_ofst);
+       stm32_exti_write_bit(d, stm32_bank->rpr_ofst);
        if (stm32_bank->fpr_ofst != UNDEF_REG)
-               stm32_exti_set_bit(d, stm32_bank->fpr_ofst);
+               stm32_exti_write_bit(d, stm32_bank->fpr_ofst);
 
        raw_spin_unlock(&chip_data->rlock);
 
index b7cc5d6580d8fc89cea3e16d21345c396749176b..d4e97605456bba1c3958fb0affb276227b044114 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/irq.h>
 #include <linux/irqchip.h>
 #include <linux/irqdomain.h>
 #include <linux/interrupt.h>
@@ -83,6 +84,7 @@ struct ti_sci_inta_vint_desc {
  * @vint_mutex:                Mutex to protect vint_list
  * @base:              Base address of the memory mapped IO registers
  * @pdev:              Pointer to platform device.
+ * @ti_sci_id:         TI-SCI device identifier
  */
 struct ti_sci_inta_irq_domain {
        const struct ti_sci_handle *sci;
@@ -93,6 +95,7 @@ struct ti_sci_inta_irq_domain {
        struct mutex vint_mutex;
        void __iomem *base;
        struct platform_device *pdev;
+       u32 ti_sci_id;
 };
 
 #define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \
@@ -128,6 +131,37 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc)
        chained_irq_exit(irq_desc_get_chip(desc), desc);
 }
 
+/**
+ * ti_sci_inta_xlate_irq() - Translate hwirq to parent's hwirq.
+ * @inta:      IRQ domain corresponding to Interrupt Aggregator
+ * @irq:       Hardware irq corresponding to the above irq domain
+ *
+ * Return parent irq number if translation is available else -ENOENT.
+ */
+static int ti_sci_inta_xlate_irq(struct ti_sci_inta_irq_domain *inta,
+                                u16 vint_id)
+{
+       struct device_node *np = dev_of_node(&inta->pdev->dev);
+       u32 base, parent_base, size;
+       const __be32 *range;
+       int len;
+
+       range = of_get_property(np, "ti,interrupt-ranges", &len);
+       if (!range)
+               return vint_id;
+
+       for (len /= sizeof(*range); len >= 3; len -= 3) {
+               base = be32_to_cpu(*range++);
+               parent_base = be32_to_cpu(*range++);
+               size = be32_to_cpu(*range++);
+
+               if (base <= vint_id && vint_id < base + size)
+                       return vint_id - base + parent_base;
+       }
+
+       return -ENOENT;
+}
+
 /**
  * ti_sci_inta_alloc_parent_irq() - Allocate parent irq to Interrupt aggregator
  * @domain:    IRQ domain corresponding to Interrupt Aggregator
@@ -139,30 +173,52 @@ static struct ti_sci_inta_vint_desc *ti_sci_inta_alloc_parent_irq(struct irq_dom
        struct ti_sci_inta_irq_domain *inta = domain->host_data;
        struct ti_sci_inta_vint_desc *vint_desc;
        struct irq_fwspec parent_fwspec;
+       struct device_node *parent_node;
        unsigned int parent_virq;
-       u16 vint_id;
+       u16 vint_id, p_hwirq;
+       int ret;
 
        vint_id = ti_sci_get_free_resource(inta->vint);
        if (vint_id == TI_SCI_RESOURCE_NULL)
                return ERR_PTR(-EINVAL);
 
+       p_hwirq = ti_sci_inta_xlate_irq(inta, vint_id);
+       if (p_hwirq < 0) {
+               ret = p_hwirq;
+               goto free_vint;
+       }
+
        vint_desc = kzalloc(sizeof(*vint_desc), GFP_KERNEL);
-       if (!vint_desc)
-               return ERR_PTR(-ENOMEM);
+       if (!vint_desc) {
+               ret = -ENOMEM;
+               goto free_vint;
+       }
 
        vint_desc->domain = domain;
        vint_desc->vint_id = vint_id;
        INIT_LIST_HEAD(&vint_desc->list);
 
-       parent_fwspec.fwnode = of_node_to_fwnode(of_irq_find_parent(dev_of_node(&inta->pdev->dev)));
-       parent_fwspec.param_count = 2;
-       parent_fwspec.param[0] = inta->pdev->id;
-       parent_fwspec.param[1] = vint_desc->vint_id;
+       parent_node = of_irq_find_parent(dev_of_node(&inta->pdev->dev));
+       parent_fwspec.fwnode = of_node_to_fwnode(parent_node);
+
+       if (of_device_is_compatible(parent_node, "arm,gic-v3")) {
+               /* Parent is GIC */
+               parent_fwspec.param_count = 3;
+               parent_fwspec.param[0] = 0;
+               parent_fwspec.param[1] = p_hwirq - 32;
+               parent_fwspec.param[2] = IRQ_TYPE_LEVEL_HIGH;
+       } else {
+               /* Parent is Interrupt Router */
+               parent_fwspec.param_count = 1;
+               parent_fwspec.param[0] = p_hwirq;
+       }
 
        parent_virq = irq_create_fwspec_mapping(&parent_fwspec);
        if (parent_virq == 0) {
-               kfree(vint_desc);
-               return ERR_PTR(-EINVAL);
+               dev_err(&inta->pdev->dev, "Parent IRQ allocation failed\n");
+               ret = -EINVAL;
+               goto free_vint_desc;
+
        }
        vint_desc->parent_virq = parent_virq;
 
@@ -171,6 +227,11 @@ static struct ti_sci_inta_vint_desc *ti_sci_inta_alloc_parent_irq(struct irq_dom
                                         ti_sci_inta_irq_handler, vint_desc);
 
        return vint_desc;
+free_vint_desc:
+       kfree(vint_desc);
+free_vint:
+       ti_sci_release_resource(inta->vint, vint_id);
+       return ERR_PTR(ret);
 }
 
 /**
@@ -202,7 +263,7 @@ static struct ti_sci_inta_event_desc *ti_sci_inta_alloc_event(struct ti_sci_inta
 
        err = inta->sci->ops.rm_irq_ops.set_event_map(inta->sci,
                                                      dev_id, dev_index,
-                                                     inta->pdev->id,
+                                                     inta->ti_sci_id,
                                                      vint_desc->vint_id,
                                                      event_desc->global_event,
                                                      free_bit);
@@ -299,7 +360,7 @@ static void ti_sci_inta_free_irq(struct ti_sci_inta_event_desc *event_desc,
        inta->sci->ops.rm_irq_ops.free_event_map(inta->sci,
                                                 HWIRQ_TO_DEVID(hwirq),
                                                 HWIRQ_TO_IRQID(hwirq),
-                                                inta->pdev->id,
+                                                inta->ti_sci_id,
                                                 vint_desc->vint_id,
                                                 event_desc->global_event,
                                                 event_desc->vint_bit);
@@ -547,21 +608,21 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = of_property_read_u32(dev->of_node, "ti,sci-dev-id", &pdev->id);
+       ret = of_property_read_u32(dev->of_node, "ti,sci-dev-id", &inta->ti_sci_id);
        if (ret) {
                dev_err(dev, "missing 'ti,sci-dev-id' property\n");
                return -EINVAL;
        }
 
-       inta->vint = devm_ti_sci_get_of_resource(inta->sci, dev, pdev->id,
-                                                "ti,sci-rm-range-vint");
+       inta->vint = devm_ti_sci_get_resource(inta->sci, dev, inta->ti_sci_id,
+                                             TI_SCI_RESASG_SUBTYPE_IA_VINT);
        if (IS_ERR(inta->vint)) {
                dev_err(dev, "VINT resource allocation failed\n");
                return PTR_ERR(inta->vint);
        }
 
-       inta->global_event = devm_ti_sci_get_of_resource(inta->sci, dev, pdev->id,
-                                               "ti,sci-rm-range-global-event");
+       inta->global_event = devm_ti_sci_get_resource(inta->sci, dev, inta->ti_sci_id,
+                                                     TI_SCI_RESASG_SUBTYPE_GLOBAL_EVENT_SEVT);
        if (IS_ERR(inta->global_event)) {
                dev_err(dev, "Global event resource allocation failed\n");
                return PTR_ERR(inta->global_event);
@@ -592,6 +653,8 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
        INIT_LIST_HEAD(&inta->vint_list);
        mutex_init(&inta->vint_mutex);
 
+       dev_info(dev, "Interrupt Aggregator domain %d created\n", pdev->id);
+
        return 0;
 }
 
index 5ea148faf2abc4f27bfca769ae6574b13903ce96..cbc1758228d9e91a98dd2ef8aaa13ff060d85907 100644 (file)
 #include <linux/of_irq.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 
-#define TI_SCI_DEV_ID_MASK     0xffff
-#define TI_SCI_DEV_ID_SHIFT    16
-#define TI_SCI_IRQ_ID_MASK     0xffff
-#define TI_SCI_IRQ_ID_SHIFT    0
-#define HWIRQ_TO_DEVID(hwirq)  (((hwirq) >> (TI_SCI_DEV_ID_SHIFT)) & \
-                                (TI_SCI_DEV_ID_MASK))
-#define HWIRQ_TO_IRQID(hwirq)  ((hwirq) & (TI_SCI_IRQ_ID_MASK))
-#define TO_HWIRQ(dev, index)   ((((dev) & TI_SCI_DEV_ID_MASK) << \
-                                TI_SCI_DEV_ID_SHIFT) | \
-                               ((index) & TI_SCI_IRQ_ID_MASK))
-
 /**
  * struct ti_sci_intr_irq_domain - Structure representing a TISCI based
  *                                Interrupt Router IRQ domain.
  * @sci:       Pointer to TISCI handle
- * @dst_irq:   TISCI resource pointer representing GIC irq controller.
- * @dst_id:    TISCI device ID of the GIC irq controller.
+ * @out_irqs:  TISCI resource pointer representing INTR irqs.
+ * @dev:       Struct device pointer.
+ * @ti_sci_id: TI-SCI device identifier
  * @type:      Specifies the trigger type supported by this Interrupt Router
  */
 struct ti_sci_intr_irq_domain {
        const struct ti_sci_handle *sci;
-       struct ti_sci_resource *dst_irq;
-       u32 dst_id;
+       struct ti_sci_resource *out_irqs;
+       struct device *dev;
+       u32 ti_sci_id;
        u32 type;
 };
 
@@ -70,15 +61,44 @@ static int ti_sci_intr_irq_domain_translate(struct irq_domain *domain,
 {
        struct ti_sci_intr_irq_domain *intr = domain->host_data;
 
-       if (fwspec->param_count != 2)
+       if (fwspec->param_count != 1)
                return -EINVAL;
 
-       *hwirq = TO_HWIRQ(fwspec->param[0], fwspec->param[1]);
+       *hwirq = fwspec->param[0];
        *type = intr->type;
 
        return 0;
 }
 
+/**
+ * ti_sci_intr_xlate_irq() - Translate hwirq to parent's hwirq.
+ * @intr:      IRQ domain corresponding to Interrupt Router
+ * @irq:       Hardware irq corresponding to the above irq domain
+ *
+ * Return parent irq number if translation is available else -ENOENT.
+ */
+static int ti_sci_intr_xlate_irq(struct ti_sci_intr_irq_domain *intr, u32 irq)
+{
+       struct device_node *np = dev_of_node(intr->dev);
+       u32 base, pbase, size, len;
+       const __be32 *range;
+
+       range = of_get_property(np, "ti,interrupt-ranges", &len);
+       if (!range)
+               return irq;
+
+       for (len /= sizeof(*range); len >= 3; len -= 3) {
+               base = be32_to_cpu(*range++);
+               pbase = be32_to_cpu(*range++);
+               size = be32_to_cpu(*range++);
+
+               if (base <= irq && irq < base + size)
+                       return irq - base + pbase;
+       }
+
+       return -ENOENT;
+}
+
 /**
  * ti_sci_intr_irq_domain_free() - Free the specified IRQs from the domain.
  * @domain:    Domain to which the irqs belong
@@ -89,66 +109,76 @@ static void ti_sci_intr_irq_domain_free(struct irq_domain *domain,
                                        unsigned int virq, unsigned int nr_irqs)
 {
        struct ti_sci_intr_irq_domain *intr = domain->host_data;
-       struct irq_data *data, *parent_data;
-       u16 dev_id, irq_index;
+       struct irq_data *data;
+       int out_irq;
 
-       parent_data = irq_domain_get_irq_data(domain->parent, virq);
        data = irq_domain_get_irq_data(domain, virq);
-       irq_index = HWIRQ_TO_IRQID(data->hwirq);
-       dev_id = HWIRQ_TO_DEVID(data->hwirq);
+       out_irq = (uintptr_t)data->chip_data;
 
-       intr->sci->ops.rm_irq_ops.free_irq(intr->sci, dev_id, irq_index,
-                                          intr->dst_id, parent_data->hwirq);
-       ti_sci_release_resource(intr->dst_irq, parent_data->hwirq);
+       intr->sci->ops.rm_irq_ops.free_irq(intr->sci,
+                                          intr->ti_sci_id, data->hwirq,
+                                          intr->ti_sci_id, out_irq);
+       ti_sci_release_resource(intr->out_irqs, out_irq);
        irq_domain_free_irqs_parent(domain, virq, 1);
        irq_domain_reset_irq_data(data);
 }
 
 /**
- * ti_sci_intr_alloc_gic_irq() - Allocate GIC specific IRQ
+ * ti_sci_intr_alloc_parent_irq() - Allocate parent IRQ
  * @domain:    Pointer to the interrupt router IRQ domain
  * @virq:      Corresponding Linux virtual IRQ number
  * @hwirq:     Corresponding hwirq for the IRQ within this IRQ domain
  *
- * Returns 0 if all went well else appropriate error pointer.
+ * Returns parent irq if all went well else appropriate error pointer.
  */
-static int ti_sci_intr_alloc_gic_irq(struct irq_domain *domain,
-                                    unsigned int virq, u32 hwirq)
+static int ti_sci_intr_alloc_parent_irq(struct irq_domain *domain,
+                                       unsigned int virq, u32 hwirq)
 {
        struct ti_sci_intr_irq_domain *intr = domain->host_data;
+       struct device_node *parent_node;
        struct irq_fwspec fwspec;
-       u16 dev_id, irq_index;
-       u16 dst_irq;
-       int err;
-
-       dev_id = HWIRQ_TO_DEVID(hwirq);
-       irq_index = HWIRQ_TO_IRQID(hwirq);
+       u16 out_irq, p_hwirq;
+       int err = 0;
 
-       dst_irq = ti_sci_get_free_resource(intr->dst_irq);
-       if (dst_irq == TI_SCI_RESOURCE_NULL)
+       out_irq = ti_sci_get_free_resource(intr->out_irqs);
+       if (out_irq == TI_SCI_RESOURCE_NULL)
                return -EINVAL;
 
-       fwspec.fwnode = domain->parent->fwnode;
-       fwspec.param_count = 3;
-       fwspec.param[0] = 0;    /* SPI */
-       fwspec.param[1] = dst_irq - 32; /* SPI offset */
-       fwspec.param[2] = intr->type;
+       p_hwirq = ti_sci_intr_xlate_irq(intr, out_irq);
+       if (p_hwirq < 0)
+               goto err_irqs;
+
+       parent_node = of_irq_find_parent(dev_of_node(intr->dev));
+       fwspec.fwnode = of_node_to_fwnode(parent_node);
+
+       if (of_device_is_compatible(parent_node, "arm,gic-v3")) {
+               /* Parent is GIC */
+               fwspec.param_count = 3;
+               fwspec.param[0] = 0;    /* SPI */
+               fwspec.param[1] = p_hwirq - 32; /* SPI offset */
+               fwspec.param[2] = intr->type;
+       } else {
+               /* Parent is Interrupt Router */
+               fwspec.param_count = 1;
+               fwspec.param[0] = p_hwirq;
+       }
 
        err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
        if (err)
                goto err_irqs;
 
-       err = intr->sci->ops.rm_irq_ops.set_irq(intr->sci, dev_id, irq_index,
-                                               intr->dst_id, dst_irq);
+       err = intr->sci->ops.rm_irq_ops.set_irq(intr->sci,
+                                               intr->ti_sci_id, hwirq,
+                                               intr->ti_sci_id, out_irq);
        if (err)
                goto err_msg;
 
-       return 0;
+       return p_hwirq;
 
 err_msg:
        irq_domain_free_irqs_parent(domain, virq, 1);
 err_irqs:
-       ti_sci_release_resource(intr->dst_irq, dst_irq);
+       ti_sci_release_resource(intr->out_irqs, out_irq);
        return err;
 }
 
@@ -168,18 +198,19 @@ static int ti_sci_intr_irq_domain_alloc(struct irq_domain *domain,
        struct irq_fwspec *fwspec = data;
        unsigned long hwirq;
        unsigned int flags;
-       int err;
+       int err, p_hwirq;
 
        err = ti_sci_intr_irq_domain_translate(domain, fwspec, &hwirq, &flags);
        if (err)
                return err;
 
-       err = ti_sci_intr_alloc_gic_irq(domain, virq, hwirq);
-       if (err)
-               return err;
+       p_hwirq = ti_sci_intr_alloc_parent_irq(domain, virq, hwirq);
+       if (p_hwirq < 0)
+               return p_hwirq;
 
        irq_domain_set_hwirq_and_chip(domain, virq, hwirq,
-                                     &ti_sci_intr_irq_chip, NULL);
+                                     &ti_sci_intr_irq_chip,
+                                     (void *)(uintptr_t)p_hwirq);
 
        return 0;
 }
@@ -214,6 +245,7 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
        if (!intr)
                return -ENOMEM;
 
+       intr->dev = dev;
        ret = of_property_read_u32(dev_of_node(dev), "ti,intr-trigger-type",
                                   &intr->type);
        if (ret) {
@@ -230,19 +262,19 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = of_property_read_u32(dev_of_node(dev), "ti,sci-dst-id",
-                                  &intr->dst_id);
+       ret = of_property_read_u32(dev_of_node(dev), "ti,sci-dev-id",
+                                  &intr->ti_sci_id);
        if (ret) {
-               dev_err(dev, "missing 'ti,sci-dst-id' property\n");
+               dev_err(dev, "missing 'ti,sci-dev-id' property\n");
                return -EINVAL;
        }
 
-       intr->dst_irq = devm_ti_sci_get_of_resource(intr->sci, dev,
-                                                   intr->dst_id,
-                                                   "ti,sci-rm-range-girq");
-       if (IS_ERR(intr->dst_irq)) {
+       intr->out_irqs = devm_ti_sci_get_resource(intr->sci, dev,
+                                                 intr->ti_sci_id,
+                                                 TI_SCI_RESASG_SUBTYPE_IR_OUTPUT);
+       if (IS_ERR(intr->out_irqs)) {
                dev_err(dev, "Destination irq resource allocation failed\n");
-               return PTR_ERR(intr->dst_irq);
+               return PTR_ERR(intr->out_irqs);
        }
 
        domain = irq_domain_add_hierarchy(parent_domain, 0, 0, dev_of_node(dev),
@@ -252,6 +284,8 @@ static int ti_sci_intr_irq_domain_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
+       dev_info(dev, "Interrupt Router %d domain created\n", intr->ti_sci_id);
+
        return 0;
 }
 
index bc235db8a4c5bcf246ad2eff6342b40fdb19cc8b..e46036374227297ed9aa1185724df3a735d8bbec 100644 (file)
@@ -455,7 +455,7 @@ static void __init __vic_init(void __iomem *base, int parent_irq, int irq_start,
                return;
        default:
                printk(KERN_WARNING "VIC: unknown vendor, continuing anyways\n");
-               /* fall through */
+               fallthrough;
        case AMBA_VENDOR_ARM:
                break;
        }
index 1bb0e36c2bf3dbd5ee07f9fa1588d956deb60177..d2341153e1814d12623c7b14ea62e939031a7e66 100644 (file)
@@ -52,7 +52,7 @@ int platform_irqchip_probe(struct platform_device *pdev)
         * interrupt controller. The actual initialization callback of this
         * interrupt controller can check for specific domains as necessary.
         */
-       if (par_np && !irq_find_matching_host(np, DOMAIN_BUS_ANY))
+       if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY))
                return -EPROBE_DEFER;
 
        return irq_init_cb(np, par_np);
index c1c5dfad57ccd0d729d578a777b281739cc5201d..6ae9e1f0819da1615f80fbfb6eda00c348b9c256 100644 (file)
 #include <linux/irqdomain.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
-#include <linux/of_irq.h>
 #include <linux/soc/qcom/irq.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
@@ -432,8 +430,4 @@ fail:
        return ret;
 }
 
-IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc)
-IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
-IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc)
-MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");
-MODULE_LICENSE("GPL v2");
+IRQCHIP_DECLARE(qcom_pdc, "qcom,pdc", qcom_pdc_init);
index ecc1ef6c386d8321082ffc7b5dc1afc0fc6714f5..f68569bfef7a711a53b1d9d48ba83c335c8b3fe7 100644 (file)
@@ -348,7 +348,7 @@ modehdlc(struct bchannel *bch, int protocol)
        switch (protocol) {
        case -1: /* used for init */
                bch->state = -1;
-               /* fall through */
+               fallthrough;
        case ISDN_P_NONE:
                if (bch->state == ISDN_P_NONE)
                        break;
index b0d772340e163d85217c2e19165b027c83a8984b..448ded8f9d24e384ae5f6fb11bf44a3a543703d7 100644 (file)
@@ -121,7 +121,6 @@ setup_embedded(struct hfc_multi *hc, struct hm_map *m)
        case HFC_IO_MODE_EMBSD:
                test_and_set_bit(HFC_CHIP_EMBSD, &hc->chip);
                hc->slots = 128; /* required */
-               /* fall through */
                hc->HFC_outb = HFC_outb_embsd;
                hc->HFC_inb = HFC_inb_embsd;
                hc->HFC_inw = HFC_inw_embsd;
index 904a4f4c5ff9eeb032b2b97b237fe923c65f698f..56bd2e9db6ed6a1bfe92173e0c987d0ca527b3b9 100644 (file)
@@ -1280,7 +1280,7 @@ mode_hfcpci(struct bchannel *bch, int bc, int protocol)
        case (-1): /* used for init */
                bch->state = -1;
                bch->nr = bc;
-               /* fall through */
+               fallthrough;
        case (ISDN_P_NONE):
                if (bch->state == ISDN_P_NONE)
                        return 0;
index 4274906f86547f6d9b6cf9288f99233b960678f7..70061991915a5833acd33d6354ba08e60177ee20 100644 (file)
@@ -695,7 +695,7 @@ hfcsusb_setup_bch(struct bchannel *bch, int protocol)
        switch (protocol) {
        case (-1):      /* used for init */
                bch->state = -1;
-               /* fall through */
+               fallthrough;
        case (ISDN_P_NONE):
                if (bch->state == ISDN_P_NONE)
                        return 0; /* already in idle state */
index 9fea16ed3dd86e71d6d752da1be914806073143a..985367e6711d4d8b4a22785f077a72874cac48af 100644 (file)
@@ -397,7 +397,7 @@ int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src, u16 slen,
                                dsize--;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case HDLC_SENDFLAG_ONE:
                        if (hdlc->bit_shift == 8) {
                                hdlc->cbin = hdlc->ffvalue >>
index f4cb29766888457d0c06bdad1af9cda9034af17f..a16c7a2a7f3d0d22bf03713a58640db143440a25 100644 (file)
@@ -875,7 +875,7 @@ release_card(struct inf_hw *card) {
                                release_card(card->sc[i]);
                        card->sc[i] = NULL;
                }
-               /* fall through */
+               fallthrough;
        default:
                pci_disable_device(card->pdev);
                pci_set_drvdata(card->pdev, NULL);
index 11e8c7d8b6e89d361f8709251722f8d2e9c598c1..56943409b60d944a21bb90e8d73b72286be7a16a 100644 (file)
@@ -957,7 +957,7 @@ isar_pump_statev_fax(struct isar_ch *ch, u8 devt) {
                                break;
                        case PCTRL_CMD_FTM:
                                p1 = 2;
-                               /* fall through */
+                               fallthrough;
                        case PCTRL_CMD_FTH:
                                send_mbox(ch->is, dps | ISAR_HIS_PUMPCTRL,
                                          PCTRL_CMD_SILON, 1, &p1);
@@ -1163,7 +1163,7 @@ setup_pump(struct isar_ch *ch) {
                        send_mbox(ch->is, dps | ISAR_HIS_PUMPCFG,
                                  PMOD_DTMF, 1, param);
                }
-               /* fall through */
+               fallthrough;
        case ISDN_P_B_MODEM_ASYNC:
                ctrl = PMOD_DATAMODEM;
                if (test_bit(FLG_ORIGIN, &ch->bch.Flags)) {
@@ -1255,7 +1255,7 @@ setup_iom2(struct isar_ch *ch) {
        case ISDN_P_B_MODEM_ASYNC:
        case ISDN_P_B_T30_FAX:
                cmsb |= IOM_CTRL_RCV;
-               /* fall through */
+               fallthrough;
        case ISDN_P_B_L2DTMF:
                if (test_bit(FLG_DTMFSEND, &ch->bch.Flags))
                        cmsb |= IOM_CTRL_RCV;
@@ -1548,7 +1548,7 @@ isar_l2l1(struct mISDNchannel *ch, struct sk_buff *skb)
                                ich->is->name, hh->id);
                        ret = -EINVAL;
                }
-               /* fall through */
+               fallthrough;
        default:
                pr_info("%s: %s unknown prim(%x,%x)\n",
                        ich->is->name, __func__, hh->prim, hh->id);
index 27aa32914425d5d3b39e5047237c71e2bc5ce486..c2f76f3986134e4dc2f82a49195be0fbd6789314 100644 (file)
@@ -528,7 +528,7 @@ create_l2entity(struct mISDNdevice *dev, struct mISDNchannel *ch,
                rq.protocol = ISDN_P_NT_S0;
                if (dev->Dprotocols & (1 << ISDN_P_NT_E1))
                        rq.protocol = ISDN_P_NT_E1;
-               /* fall through */
+               fallthrough;
        case ISDN_P_LAPD_TE:
                ch->recv = mISDN_queue_message;
                ch->peer = &dev->D.st->own;
index b413bafe93fddd97a9ee85ba29b1007490ad8b49..97c68731406b34d32f469976e38a0ffdab0cbaba 100644 (file)
@@ -301,7 +301,7 @@ void pblk_free_rqd(struct pblk *pblk, struct nvm_rq *rqd, int type)
        switch (type) {
        case PBLK_WRITE:
                kfree(((struct pblk_c_ctx *)nvm_rq_to_pdu(rqd))->lun_bitmap);
-               /* fall through */
+               fallthrough;
        case PBLK_WRITE_INT:
                pool = &pblk->w_rq_pool;
                break;
index 75482eeab2c4da08f7061808ec44d3022686427b..994ba5cb367898060076cdd52a47d043f9380a00 100644 (file)
@@ -881,7 +881,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
                }
                if (hid->name[0])
                        break;
-               /* else fall through */
+               fallthrough;
 
        default:
                pr_info("Trying to register unknown ADB device to input layer.\n");
index 23f1f41c86029092a01d662c1a362552cffa3e04..96684581a25df174b3dc56218a36730e27f246a7 100644 (file)
@@ -852,7 +852,7 @@ int smu_queue_i2c(struct smu_i2c_cmd *cmd)
                break;
        case SMU_I2C_TRANSFER_COMBINED:
                cmd->info.devaddr &= 0xfe;
-               /* fall through */
+               fallthrough;
        case SMU_I2C_TRANSFER_STDSUB:
                if (cmd->info.sublen > 3)
                        return -EINVAL;
index 77fbfd52edcf99d6e3a35d2b9adc9d2b638c6088..c1227bdb57e7f110b32025248431c545da2bd170 100644 (file)
@@ -608,7 +608,7 @@ static void do_journal_discard(struct cache *ca)
                        ca->sb.njournal_buckets;
 
                atomic_set(&ja->discard_in_flight, DISCARD_READY);
-               /* fallthrough */
+               fallthrough;
 
        case DISCARD_READY:
                if (ja->discard_idx == ja->last_idx)
index 62fb917f7a4f08231656b1abb6fa18594012f7ff..ae380bc3992e3c5caaca7945ee4ccc71dae3debe 100644 (file)
@@ -33,27 +33,27 @@ int bch_ ## name ## _h(const char *cp, type *res)           \
        case 'y':                                               \
        case 'z':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'e':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'p':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 't':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'g':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'm':                                               \
                u++;                                            \
-               /* fall through */                              \
+               fallthrough;                                    \
        case 'k':                                               \
                u++;                                            \
                if (e++ == cp)                                  \
                        return -EINVAL;                         \
-               /* fall through */                              \
+               fallthrough;                                    \
        case '\n':                                              \
        case '\0':                                              \
                if (*e == '\n')                                 \
index 151aa95775be2daee11c7721eb62dde28ec702b1..af6d4f898e4c1de8d9b72f053beb454d5617a1e8 100644 (file)
@@ -537,12 +537,16 @@ static int __create_persistent_data_objects(struct dm_cache_metadata *cmd,
                                          CACHE_MAX_CONCURRENT_LOCKS);
        if (IS_ERR(cmd->bm)) {
                DMERR("could not create block manager");
-               return PTR_ERR(cmd->bm);
+               r = PTR_ERR(cmd->bm);
+               cmd->bm = NULL;
+               return r;
        }
 
        r = __open_or_format_metadata(cmd, may_format_device);
-       if (r)
+       if (r) {
                dm_block_manager_destroy(cmd->bm);
+               cmd->bm = NULL;
+       }
 
        return r;
 }
index 14896072125464ea9b3b9123f8b3fe4677bd8616..380386c36921f799a236f8d2701f3314f8b8e4fc 100644 (file)
@@ -739,7 +739,7 @@ static int crypt_iv_eboiv_gen(struct crypt_config *cc, u8 *iv,
        u8 buf[MAX_CIPHER_BLOCKSIZE] __aligned(__alignof__(__le64));
        struct skcipher_request *req;
        struct scatterlist src, dst;
-       struct crypto_wait wait;
+       DECLARE_CRYPTO_WAIT(wait);
        int err;
 
        req = skcipher_request_alloc(any_tfm(cc), GFP_NOIO);
@@ -936,7 +936,7 @@ static int crypt_iv_elephant(struct crypt_config *cc, struct dm_crypt_request *d
        u8 *es, *ks, *data, *data2, *data_offset;
        struct skcipher_request *req;
        struct scatterlist *sg, *sg2, src, dst;
-       struct crypto_wait wait;
+       DECLARE_CRYPTO_WAIT(wait);
        int i, r;
 
        req = skcipher_request_alloc(elephant->tfm, GFP_NOIO);
@@ -1552,7 +1552,7 @@ static blk_status_t crypt_convert(struct crypt_config *cc,
                case -EBUSY:
                        wait_for_completion(&ctx->restart);
                        reinit_completion(&ctx->restart);
-                       /* fall through */
+                       fallthrough;
                /*
                 * The request is queued and processed asynchronously,
                 * completion function kcryptd_async_done() will be called.
index 8c8d940e532efa6d3074ada12550c65cf8778bb8..3fc3757def55ec29466a0ecddf4c197d6586c6de 100644 (file)
@@ -2487,6 +2487,7 @@ next_chunk:
        range.logical_sector = le64_to_cpu(ic->sb->recalc_sector);
        if (unlikely(range.logical_sector >= ic->provided_data_sectors)) {
                if (ic->mode == 'B') {
+                       block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR);
                        DEBUG_print("queue_delayed_work: bitmap_flush_work\n");
                        queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0);
                }
@@ -2564,6 +2565,17 @@ next_chunk:
                goto err;
        }
 
+       if (ic->mode == 'B') {
+               sector_t start, end;
+               start = (range.logical_sector >>
+                        (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) <<
+                       (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
+               end = ((range.logical_sector + range.n_sectors) >>
+                      (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) <<
+                       (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
+               block_bitmap_op(ic, ic->recalc_bitmap, start, end - start, BITMAP_OP_CLEAR);
+       }
+
 advance_and_next:
        cond_resched();
 
index 53645a6f474cb4a344725e0776d42b86e3609113..de4da825ade6083902966590e9e19ec610f548ce 100644 (file)
@@ -1287,17 +1287,25 @@ static void multipath_wait_for_pg_init_completion(struct multipath *m)
 static void flush_multipath_work(struct multipath *m)
 {
        if (m->hw_handler_name) {
-               set_bit(MPATHF_PG_INIT_DISABLED, &m->flags);
-               smp_mb__after_atomic();
+               unsigned long flags;
+
+               if (!atomic_read(&m->pg_init_in_progress))
+                       goto skip;
+
+               spin_lock_irqsave(&m->lock, flags);
+               if (atomic_read(&m->pg_init_in_progress) &&
+                   !test_and_set_bit(MPATHF_PG_INIT_DISABLED, &m->flags)) {
+                       spin_unlock_irqrestore(&m->lock, flags);
 
-               if (atomic_read(&m->pg_init_in_progress))
                        flush_workqueue(kmpath_handlerd);
-               multipath_wait_for_pg_init_completion(m);
+                       multipath_wait_for_pg_init_completion(m);
 
-               clear_bit(MPATHF_PG_INIT_DISABLED, &m->flags);
-               smp_mb__after_atomic();
+                       spin_lock_irqsave(&m->lock, flags);
+                       clear_bit(MPATHF_PG_INIT_DISABLED, &m->flags);
+               }
+               spin_unlock_irqrestore(&m->lock, flags);
        }
-
+skip:
        if (m->queue_mode == DM_TYPE_BIO_BASED)
                flush_work(&m->process_queued_bios);
        flush_work(&m->trigger_event);
@@ -1554,7 +1562,7 @@ static void pg_init_done(void *data, int errors)
        case SCSI_DH_RETRY:
                /* Wait before retrying. */
                delay_retry = true;
-               /* fall through */
+               fallthrough;
        case SCSI_DH_IMM_RETRY:
        case SCSI_DH_RES_TEMP_UNAVAIL:
                if (pg_init_limit_reached(m, pgpath))
index 5edc3079e7c1990409a57551a8116d80919e3fc2..229f461e7def37b4ecf2ca498262358aaebca31d 100644 (file)
@@ -860,10 +860,14 @@ EXPORT_SYMBOL_GPL(dm_table_set_type);
 int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
                        sector_t start, sector_t len, void *data)
 {
-       int blocksize = *(int *) data;
+       int blocksize = *(int *) data, id;
+       bool rc;
 
-       return generic_fsdax_supported(dev->dax_dev, dev->bdev, blocksize,
-                                      start, len);
+       id = dax_read_lock();
+       rc = dax_supported(dev->dax_dev, dev->bdev, blocksize, start, len);
+       dax_read_unlock(id);
+
+       return rc;
 }
 
 /* Check devices support synchronous DAX */
index 76b6b323bf4bd560f1b83eead235ffcaf373ad86..b461836b6d26387551e01be03273047efe01e679 100644 (file)
@@ -739,12 +739,16 @@ static int __create_persistent_data_objects(struct dm_pool_metadata *pmd, bool f
                                          THIN_MAX_CONCURRENT_LOCKS);
        if (IS_ERR(pmd->bm)) {
                DMERR("could not create block manager");
-               return PTR_ERR(pmd->bm);
+               r = PTR_ERR(pmd->bm);
+               pmd->bm = NULL;
+               return r;
        }
 
        r = __open_or_format_metadata(pmd, format_device);
-       if (r)
+       if (r) {
                dm_block_manager_destroy(pmd->bm);
+               pmd->bm = NULL;
+       }
 
        return r;
 }
@@ -954,7 +958,7 @@ int dm_pool_metadata_close(struct dm_pool_metadata *pmd)
        }
 
        pmd_write_lock_in_core(pmd);
-       if (!dm_bm_is_read_only(pmd->bm) && !pmd->fail_io) {
+       if (!pmd->fail_io && !dm_bm_is_read_only(pmd->bm)) {
                r = __commit_transaction(pmd);
                if (r < 0)
                        DMWARN("%s: __commit_transaction() failed, error = %d",
index 86dbe0c8b45c60314b1d5113b4ab7c38d6b6e788..6271d1e741cf7a478abaf691d7b4f115e2c9a678 100644 (file)
@@ -231,6 +231,7 @@ static int persistent_memory_claim(struct dm_writecache *wc)
        pfn_t pfn;
        int id;
        struct page **pages;
+       sector_t offset;
 
        wc->memory_vmapped = false;
 
@@ -245,9 +246,16 @@ static int persistent_memory_claim(struct dm_writecache *wc)
                goto err1;
        }
 
+       offset = get_start_sect(wc->ssd_dev->bdev);
+       if (offset & (PAGE_SIZE / 512 - 1)) {
+               r = -EINVAL;
+               goto err1;
+       }
+       offset >>= PAGE_SHIFT - 9;
+
        id = dax_read_lock();
 
-       da = dax_direct_access(wc->ssd_dev->dax_dev, 0, p, &wc->memory_map, &pfn);
+       da = dax_direct_access(wc->ssd_dev->dax_dev, offset, p, &wc->memory_map, &pfn);
        if (da < 0) {
                wc->memory_map = NULL;
                r = da;
@@ -269,7 +277,7 @@ static int persistent_memory_claim(struct dm_writecache *wc)
                i = 0;
                do {
                        long daa;
-                       daa = dax_direct_access(wc->ssd_dev->dax_dev, i, p - i,
+                       daa = dax_direct_access(wc->ssd_dev->dax_dev, offset + i, p - i,
                                                NULL, &pfn);
                        if (daa <= 0) {
                                r = daa ? daa : -EINVAL;
index 32fa6499739fb928540898d8ca7e5e41119b7c04..6ed05ca65a0f8f0d6bf30e304635300523e680db 100644 (file)
@@ -1021,7 +1021,7 @@ static void clone_endio(struct bio *bio)
                switch (r) {
                case DM_ENDIO_REQUEUE:
                        error = BLK_STS_DM_REQUEUE;
-                       /*FALLTHRU*/
+                       fallthrough;
                case DM_ENDIO_DONE:
                        break;
                case DM_ENDIO_INCOMPLETE:
@@ -1136,15 +1136,16 @@ static bool dm_dax_supported(struct dax_device *dax_dev, struct block_device *bd
 {
        struct mapped_device *md = dax_get_private(dax_dev);
        struct dm_table *map;
+       bool ret = false;
        int srcu_idx;
-       bool ret;
 
        map = dm_get_live_table(md, &srcu_idx);
        if (!map)
-               return false;
+               goto out;
 
        ret = dm_table_supports_dax(map, device_supports_dax, &blocksize);
 
+out:
        dm_put_live_table(md, srcu_idx);
 
        return ret;
@@ -1723,23 +1724,6 @@ out:
        return ret;
 }
 
-static void dm_queue_split(struct mapped_device *md, struct dm_target *ti, struct bio **bio)
-{
-       unsigned len, sector_count;
-
-       sector_count = bio_sectors(*bio);
-       len = min_t(sector_t, max_io_len((*bio)->bi_iter.bi_sector, ti), sector_count);
-
-       if (sector_count > len) {
-               struct bio *split = bio_split(*bio, len, GFP_NOIO, &md->queue->bio_split);
-
-               bio_chain(split, *bio);
-               trace_block_split(md->queue, split, (*bio)->bi_iter.bi_sector);
-               submit_bio_noacct(*bio);
-               *bio = split;
-       }
-}
-
 static blk_qc_t dm_process_bio(struct mapped_device *md,
                               struct dm_table *map, struct bio *bio)
 {
@@ -1760,21 +1744,21 @@ static blk_qc_t dm_process_bio(struct mapped_device *md,
        }
 
        /*
-        * If in ->queue_bio we need to use blk_queue_split(), otherwise
+        * If in ->submit_bio we need to use blk_queue_split(), otherwise
         * queue_limits for abnormal requests (e.g. discard, writesame, etc)
         * won't be imposed.
+        * If called from dm_wq_work() for deferred bio processing, bio
+        * was already handled by following code with previous ->submit_bio.
         */
        if (current->bio_list) {
                if (is_abnormal_io(bio))
                        blk_queue_split(&bio);
-               else
-                       dm_queue_split(md, ti, &bio);
+               /* regular IO is split by __split_and_process_bio */
        }
 
        if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED)
                return __process_bio(md, map, bio, ti);
-       else
-               return __split_and_process_bio(md, map, bio);
+       return __split_and_process_bio(md, map, bio);
 }
 
 static blk_qc_t dm_submit_bio(struct bio *bio)
index 6bbec89976a748d7b57475b05a3b9a95dd180110..2cf973722f59624f478875151169f6bc26f1e58c 100644 (file)
@@ -102,10 +102,10 @@ static int __init md_setup(char *str)
                                pername = "raid0";
                        break;
                }
-               /* FALL THROUGH */
+               fallthrough;
        case 1: /* the first device is numeric */
                str = str1;
-               /* FALL THROUGH */
+               fallthrough;
        case 0:
                md_setup_args[ent].level = LEVEL_NONE;
                pername="super-block";
index d61b524ae440139c891bd9cc970faa440b5adee1..b10c51988c8ee11aa9e388f3de1bd1d6131a0933 100644 (file)
@@ -1433,7 +1433,7 @@ int md_bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long s
                case 0:
                        md_bitmap_file_set_bit(bitmap, offset);
                        md_bitmap_count_page(&bitmap->counts, offset, 1);
-                       /* fall through */
+                       fallthrough;
                case 1:
                        *bmc = 2;
                }
index 749ec268d957d60a7ecb25e6372a633f644d10ec..54c089a50b152e4fa42aee04b973d89095a8ae5d 100644 (file)
@@ -493,7 +493,7 @@ int dm_bm_write_lock(struct dm_block_manager *bm,
        void *p;
        int r;
 
-       if (bm->read_only)
+       if (dm_bm_is_read_only(bm))
                return -EPERM;
 
        p = dm_bufio_read(bm->bufio, b, (struct dm_buffer **) result);
@@ -562,7 +562,7 @@ int dm_bm_write_lock_zero(struct dm_block_manager *bm,
        struct buffer_aux *aux;
        void *p;
 
-       if (bm->read_only)
+       if (dm_bm_is_read_only(bm))
                return -EPERM;
 
        p = dm_bufio_new(bm->bufio, b, (struct dm_buffer **) result);
@@ -602,7 +602,7 @@ EXPORT_SYMBOL_GPL(dm_bm_unlock);
 
 int dm_bm_flush(struct dm_block_manager *bm)
 {
-       if (bm->read_only)
+       if (dm_bm_is_read_only(bm))
                return -EPERM;
 
        return dm_bufio_write_dirty_buffers(bm->bufio);
@@ -616,19 +616,21 @@ void dm_bm_prefetch(struct dm_block_manager *bm, dm_block_t b)
 
 bool dm_bm_is_read_only(struct dm_block_manager *bm)
 {
-       return bm->read_only;
+       return (bm ? bm->read_only : true);
 }
 EXPORT_SYMBOL_GPL(dm_bm_is_read_only);
 
 void dm_bm_set_read_only(struct dm_block_manager *bm)
 {
-       bm->read_only = true;
+       if (bm)
+               bm->read_only = true;
 }
 EXPORT_SYMBOL_GPL(dm_bm_set_read_only);
 
 void dm_bm_set_read_write(struct dm_block_manager *bm)
 {
-       bm->read_only = false;
+       if (bm)
+               bm->read_only = false;
 }
 EXPORT_SYMBOL_GPL(dm_bm_set_read_write);
 
index ef0fd4830803f00c1142ee7feebb55bf91840b26..225380efd1e24fd63ac71da9ca31d93775d4946a 100644 (file)
@@ -4083,7 +4083,7 @@ static void handle_parity_checks5(struct r5conf *conf, struct stripe_head *sh,
                        break;
                }
                dev = &sh->dev[s->failed_num[0]];
-               /* fall through */
+               fallthrough;
        case check_state_compute_result:
                sh->check_state = check_state_idle;
                if (!dev)
@@ -4214,7 +4214,7 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh,
 
                /* we have 2-disk failure */
                BUG_ON(s->failed != 2);
-               /* fall through */
+               fallthrough;
        case check_state_compute_result:
                sh->check_state = check_state_idle;
 
@@ -6514,9 +6514,12 @@ raid5_store_stripe_size(struct mddev  *mddev, const char *page, size_t len)
 
        /*
         * The value should not be bigger than PAGE_SIZE. It requires to
-        * be multiple of DEFAULT_STRIPE_SIZE.
+        * be multiple of DEFAULT_STRIPE_SIZE and the value should be power
+        * of two.
         */
-       if (new % DEFAULT_STRIPE_SIZE != 0 || new > PAGE_SIZE || new == 0)
+       if (new % DEFAULT_STRIPE_SIZE != 0 ||
+                       new > PAGE_SIZE || new == 0 ||
+                       new != roundup_pow_of_two(new))
                return -EINVAL;
 
        err = mddev_lock(mddev);
index 4efe8014445ea1e89476f238d6d083ddaf429313..926d65db6d3e6e526de882005da11edbc4f467ae 100644 (file)
@@ -1199,7 +1199,7 @@ void cec_received_msg_ts(struct cec_adapter *adap,
                        /* Cancel the pending timeout work */
                        if (!cancel_delayed_work(&data->work)) {
                                mutex_unlock(&adap->lock);
-                               flush_scheduled_work();
+                               cancel_delayed_work_sync(&data->work);
                                mutex_lock(&adap->lock);
                        }
                        /*
index 630a75e0eeb16dab7fcec750408f71a775789690..7607b516a7c438368bf1c6ecfbd844b2d9a024fd 100644 (file)
@@ -210,7 +210,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
                tpg->vdownsampling[1] = 1;
                tpg->hdownsampling[1] = 1;
                tpg->planes = 2;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGB332:
        case V4L2_PIX_FMT_RGB565:
        case V4L2_PIX_FMT_RGB565X:
@@ -271,7 +271,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
        case V4L2_PIX_FMT_YUV420M:
        case V4L2_PIX_FMT_YVU420M:
                tpg->buffers = 3;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV420:
        case V4L2_PIX_FMT_YVU420:
                tpg->vdownsampling[1] = 2;
@@ -284,7 +284,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
        case V4L2_PIX_FMT_YUV422M:
        case V4L2_PIX_FMT_YVU422M:
                tpg->buffers = 3;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV422P:
                tpg->vdownsampling[1] = 1;
                tpg->vdownsampling[2] = 1;
@@ -296,7 +296,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
        case V4L2_PIX_FMT_NV16M:
        case V4L2_PIX_FMT_NV61M:
                tpg->buffers = 2;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_NV16:
        case V4L2_PIX_FMT_NV61:
                tpg->vdownsampling[1] = 1;
@@ -308,7 +308,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
        case V4L2_PIX_FMT_NV12M:
        case V4L2_PIX_FMT_NV21M:
                tpg->buffers = 2;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_NV12:
        case V4L2_PIX_FMT_NV21:
                tpg->vdownsampling[1] = 2;
@@ -1275,7 +1275,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_RGB444:
        case V4L2_PIX_FMT_XRGB444:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV444:
        case V4L2_PIX_FMT_ARGB444:
                buf[0][offset] = (g_u_s << 4) | b_v;
@@ -1283,21 +1283,21 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_RGBX444:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGBA444:
                buf[0][offset] = (b_v << 4) | (alpha >> 4);
                buf[0][offset + 1] = (r_y_h << 4) | g_u_s;
                break;
        case V4L2_PIX_FMT_XBGR444:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_ABGR444:
                buf[0][offset] = (g_u_s << 4) | r_y_h;
                buf[0][offset + 1] = (alpha & 0xf0) | b_v;
                break;
        case V4L2_PIX_FMT_BGRX444:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_BGRA444:
                buf[0][offset] = (r_y_h << 4) | (alpha >> 4);
                buf[0][offset + 1] = (b_v << 4) | g_u_s;
@@ -1305,7 +1305,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_RGB555:
        case V4L2_PIX_FMT_XRGB555:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV555:
        case V4L2_PIX_FMT_ARGB555:
                buf[0][offset] = (g_u_s << 5) | b_v;
@@ -1314,7 +1314,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_RGBX555:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGBA555:
                buf[0][offset] = (g_u_s << 6) | (b_v << 1) |
                                 ((alpha & 0x80) >> 7);
@@ -1322,7 +1322,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_XBGR555:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_ABGR555:
                buf[0][offset] = (g_u_s << 5) | r_y_h;
                buf[0][offset + 1] = (alpha & 0x80) | (b_v << 2)
@@ -1330,7 +1330,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_BGRX555:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_BGRA555:
                buf[0][offset] = (g_u_s << 6) | (r_y_h << 1) |
                                 ((alpha & 0x80) >> 7);
@@ -1339,7 +1339,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_RGB555X:
        case V4L2_PIX_FMT_XRGB555X:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_ARGB555X:
                buf[0][offset] = (alpha & 0x80) | (r_y_h << 2) | (g_u_s >> 3);
                buf[0][offset + 1] = (g_u_s << 5) | b_v;
@@ -1366,7 +1366,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_HSV32:
        case V4L2_PIX_FMT_XYUV32:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_YUV32:
        case V4L2_PIX_FMT_ARGB32:
        case V4L2_PIX_FMT_AYUV32:
@@ -1377,7 +1377,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_RGBX32:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGBA32:
                buf[0][offset] = r_y_h;
                buf[0][offset + 1] = g_u_s;
@@ -1388,7 +1388,7 @@ static void gen_twopix(struct tpg_data *tpg,
        case V4L2_PIX_FMT_XBGR32:
        case V4L2_PIX_FMT_VUYX32:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_ABGR32:
        case V4L2_PIX_FMT_VUYA32:
                buf[0][offset] = b_v;
@@ -1398,7 +1398,7 @@ static void gen_twopix(struct tpg_data *tpg,
                break;
        case V4L2_PIX_FMT_BGRX32:
                alpha = 0;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_BGRA32:
                buf[0][offset] = alpha;
                buf[0][offset + 1] = b_v;
index f544d3393e9d6b284656205e01e93d268f96187f..4eab6d81cce170f4c708cd14ed10b017db8cc761 100644 (file)
@@ -721,39 +721,14 @@ int vb2_verify_memory_type(struct vb2_queue *q,
 }
 EXPORT_SYMBOL(vb2_verify_memory_type);
 
-static void set_queue_consistency(struct vb2_queue *q, bool consistent_mem)
-{
-       q->dma_attrs &= ~DMA_ATTR_NON_CONSISTENT;
-
-       if (!vb2_queue_allows_cache_hints(q))
-               return;
-       if (!consistent_mem)
-               q->dma_attrs |= DMA_ATTR_NON_CONSISTENT;
-}
-
-static bool verify_consistency_attr(struct vb2_queue *q, bool consistent_mem)
-{
-       bool queue_is_consistent = !(q->dma_attrs & DMA_ATTR_NON_CONSISTENT);
-
-       if (consistent_mem != queue_is_consistent) {
-               dprintk(q, 1, "memory consistency model mismatch\n");
-               return false;
-       }
-       return true;
-}
-
 int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
-                    unsigned int flags, unsigned int *count)
+                    unsigned int *count)
 {
        unsigned int num_buffers, allocated_buffers, num_planes = 0;
        unsigned plane_sizes[VB2_MAX_PLANES] = { };
-       bool consistent_mem = true;
        unsigned int i;
        int ret;
 
-       if (flags & V4L2_FLAG_MEMORY_NON_CONSISTENT)
-               consistent_mem = false;
-
        if (q->streaming) {
                dprintk(q, 1, "streaming active\n");
                return -EBUSY;
@@ -765,8 +740,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
        }
 
        if (*count == 0 || q->num_buffers != 0 ||
-           (q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory) ||
-           !verify_consistency_attr(q, consistent_mem)) {
+           (q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) {
                /*
                 * We already have buffers allocated, so first check if they
                 * are not in use and can be freed.
@@ -803,7 +777,6 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
        num_buffers = min_t(unsigned int, num_buffers, VB2_MAX_FRAME);
        memset(q->alloc_devs, 0, sizeof(q->alloc_devs));
        q->memory = memory;
-       set_queue_consistency(q, consistent_mem);
 
        /*
         * Ask the driver how many buffers and planes per buffer it requires.
@@ -888,18 +861,14 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
 EXPORT_SYMBOL_GPL(vb2_core_reqbufs);
 
 int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
-                        unsigned int flags, unsigned int *count,
+                        unsigned int *count,
                         unsigned int requested_planes,
                         const unsigned int requested_sizes[])
 {
        unsigned int num_planes = 0, num_buffers, allocated_buffers;
        unsigned plane_sizes[VB2_MAX_PLANES] = { };
-       bool consistent_mem = true;
        int ret;
 
-       if (flags & V4L2_FLAG_MEMORY_NON_CONSISTENT)
-               consistent_mem = false;
-
        if (q->num_buffers == VB2_MAX_FRAME) {
                dprintk(q, 1, "maximum number of buffers already allocated\n");
                return -ENOBUFS;
@@ -912,15 +881,12 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
                }
                memset(q->alloc_devs, 0, sizeof(q->alloc_devs));
                q->memory = memory;
-               set_queue_consistency(q, consistent_mem);
                q->waiting_for_buffers = !q->is_output;
        } else {
                if (q->memory != memory) {
                        dprintk(q, 1, "memory model mismatch\n");
                        return -EINVAL;
                }
-               if (!verify_consistency_attr(q, consistent_mem))
-                       return -EINVAL;
        }
 
        num_buffers = min(*count, VB2_MAX_FRAME - q->num_buffers);
@@ -2581,7 +2547,7 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
        fileio->memory = VB2_MEMORY_MMAP;
        fileio->type = q->type;
        q->fileio = fileio;
-       ret = vb2_core_reqbufs(q, fileio->memory, 0, &fileio->count);
+       ret = vb2_core_reqbufs(q, fileio->memory, &fileio->count);
        if (ret)
                goto err_kfree;
 
@@ -2638,7 +2604,7 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
 
 err_reqbufs:
        fileio->count = 0;
-       vb2_core_reqbufs(q, fileio->memory, 0, &fileio->count);
+       vb2_core_reqbufs(q, fileio->memory, &fileio->count);
 
 err_kfree:
        q->fileio = NULL;
@@ -2658,7 +2624,7 @@ static int __vb2_cleanup_fileio(struct vb2_queue *q)
                vb2_core_streamoff(q, q->type);
                q->fileio = NULL;
                fileio->count = 0;
-               vb2_core_reqbufs(q, fileio->memory, 0, &fileio->count);
+               vb2_core_reqbufs(q, fileio->memory, &fileio->count);
                kfree(fileio);
                dprintk(q, 3, "file io emulator closed\n");
        }
index ec3446cc45b8da8ab9d1a9e2ed7a7ee4612f36e8..7b1b86ec942d7df37c8f45751d08a1c45c67f5dd 100644 (file)
@@ -42,11 +42,6 @@ struct vb2_dc_buf {
        struct dma_buf_attachment       *db_attach;
 };
 
-static inline bool vb2_dc_buffer_consistent(unsigned long attr)
-{
-       return !(attr & DMA_ATTR_NON_CONSISTENT);
-}
-
 /*********************************************/
 /*        scatterlist table functions        */
 /*********************************************/
@@ -341,13 +336,6 @@ static int
 vb2_dc_dmabuf_ops_begin_cpu_access(struct dma_buf *dbuf,
                                   enum dma_data_direction direction)
 {
-       struct vb2_dc_buf *buf = dbuf->priv;
-       struct sg_table *sgt = buf->dma_sgt;
-
-       if (vb2_dc_buffer_consistent(buf->attrs))
-               return 0;
-
-       dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
        return 0;
 }
 
@@ -355,13 +343,6 @@ static int
 vb2_dc_dmabuf_ops_end_cpu_access(struct dma_buf *dbuf,
                                 enum dma_data_direction direction)
 {
-       struct vb2_dc_buf *buf = dbuf->priv;
-       struct sg_table *sgt = buf->dma_sgt;
-
-       if (vb2_dc_buffer_consistent(buf->attrs))
-               return 0;
-
-       dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
        return 0;
 }
 
index 0a40e00f0d7e5c5708ad1129dcc1bdcf8eba98d8..a86fce5d8ea8bfd882ba39e61bee68e831cb064c 100644 (file)
@@ -123,8 +123,7 @@ static void *vb2_dma_sg_alloc(struct device *dev, unsigned long dma_attrs,
        /*
         * NOTE: dma-sg allocates memory using the page allocator directly, so
         * there is no memory consistency guarantee, hence dma-sg ignores DMA
-        * attributes passed from the upper layer. That means that
-        * V4L2_FLAG_MEMORY_NON_CONSISTENT has no effect on dma-sg buffers.
+        * attributes passed from the upper layer.
         */
        buf->pages = kvmalloc_array(buf->num_pages, sizeof(struct page *),
                                    GFP_KERNEL | __GFP_ZERO);
index 30caad27281e1ab220cbb1e75080b28b0fbf3c07..cfe197df970df29e51ea8ca7fb15adee53abc00e 100644 (file)
@@ -722,22 +722,12 @@ static void fill_buf_caps(struct vb2_queue *q, u32 *caps)
 #endif
 }
 
-static void clear_consistency_attr(struct vb2_queue *q,
-                                  int memory,
-                                  unsigned int *flags)
-{
-       if (!q->allow_cache_hints || memory != V4L2_MEMORY_MMAP)
-               *flags &= ~V4L2_FLAG_MEMORY_NON_CONSISTENT;
-}
-
 int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
 {
        int ret = vb2_verify_memory_type(q, req->memory, req->type);
 
        fill_buf_caps(q, &req->capabilities);
-       clear_consistency_attr(q, req->memory, &req->flags);
-       return ret ? ret : vb2_core_reqbufs(q, req->memory,
-                                           req->flags, &req->count);
+       return ret ? ret : vb2_core_reqbufs(q, req->memory, &req->count);
 }
 EXPORT_SYMBOL_GPL(vb2_reqbufs);
 
@@ -769,7 +759,6 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create)
        unsigned i;
 
        fill_buf_caps(q, &create->capabilities);
-       clear_consistency_attr(q, create->memory, &create->flags);
        create->index = q->num_buffers;
        if (create->count == 0)
                return ret != -EBUSY ? ret : 0;
@@ -813,7 +802,6 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create)
                if (requested_sizes[i] == 0)
                        return -EINVAL;
        return ret ? ret : vb2_core_create_bufs(q, create->memory,
-                                               create->flags,
                                                &create->count,
                                                requested_planes,
                                                requested_sizes);
@@ -998,12 +986,11 @@ int vb2_ioctl_reqbufs(struct file *file, void *priv,
        int res = vb2_verify_memory_type(vdev->queue, p->memory, p->type);
 
        fill_buf_caps(vdev->queue, &p->capabilities);
-       clear_consistency_attr(vdev->queue, p->memory, &p->flags);
        if (res)
                return res;
        if (vb2_queue_is_busy(vdev, file))
                return -EBUSY;
-       res = vb2_core_reqbufs(vdev->queue, p->memory, p->flags, &p->count);
+       res = vb2_core_reqbufs(vdev->queue, p->memory, &p->count);
        /* If count == 0, then the owner has released all buffers and he
           is no longer owner of the queue. Otherwise we have a new owner. */
        if (res == 0)
@@ -1021,7 +1008,6 @@ int vb2_ioctl_create_bufs(struct file *file, void *priv,
 
        p->index = vdev->queue->num_buffers;
        fill_buf_caps(vdev->queue, &p->capabilities);
-       clear_consistency_attr(vdev->queue, p->memory, &p->flags);
        /*
         * If count == 0, then just check if memory and type are valid.
         * Any -EBUSY result from vb2_verify_memory_type can be mapped to 0.
index 630509ecee2051831da6011112a23f72b8930849..89620da983bab0fcb0ee8a78f3c0228e1907a3aa 100644 (file)
@@ -546,7 +546,7 @@ static int dvb_net_ule_new_payload(struct dvb_net_ule_handle *h)
                h->priv->ule_sndu_type_1 = 1;
                h->ts_remain -= 1;
                h->from_where += 1;
-               /* fallthrough */
+               fallthrough;
        case 0:
                h->new_ts = 1;
                h->ts += TS_SZ;
index 959d110407a45ceb1f6829c9ec290d910e23b576..6974f1731529437b5ed481f46a38ac237b5926c0 100644 (file)
@@ -342,7 +342,7 @@ int dvb_vb2_reqbufs(struct dvb_vb2_ctx *ctx, struct dmx_requestbuffers *req)
 
        ctx->buf_siz = req->size;
        ctx->buf_cnt = req->count;
-       ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, 0, &req->count);
+       ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, &req->count);
        if (ret) {
                ctx->state = DVB_VB2_STATE_NONE;
                dprintk(1, "[%s] count=%d size=%d errno=%d\n", ctx->name,
index e92542b92d3492430d56fdb9c71837a529d25f4f..da0ff7b44da41aed330693d1d947e1e553856ff5 100644 (file)
@@ -773,7 +773,7 @@ static int bcm3510_init(struct dvb_frontend* fe)
                        deb_info("attempting to download firmware\n");
                        if ((ret = bcm3510_init_cold(st)) < 0)
                                return ret;
-                       /* fall-through */
+                       fallthrough;
                case JDEC_EEPROM_LOAD_WAIT:
                        deb_info("firmware is loaded\n");
                        bcm3510_check_firmware_version(st);
index bc374750529b72f13c70fa8bfcf44175d1282cf4..08a85831e917f301a762fdc4012d951b68ca3c62 100644 (file)
@@ -1693,7 +1693,7 @@ static int dib0090_dc_offset_calibration(struct dib0090_state *state, enum front
                if (state->identity.p1g)
                        state->dc = dc_p1g_table;
 
-               /* fall through */
+               fallthrough;
        case CT_TUNER_STEP_0:
                dprintk("Start/continue DC calibration for %s path\n",
                        (state->dc->i == 1) ? "I" : "Q");
index 0f0480d8576d77264fc8815d4df888972b790c57..a6c2fc4586eb36bda9beea1736960c3297f03473 100644 (file)
@@ -224,7 +224,7 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner)
        switch (c->hierarchy) {
                case HIERARCHY_NONE:
                        deb_setf("hierarchy: none\n");
-                       /* fall through */
+                       fallthrough;
                case HIERARCHY_1:
                        deb_setf("hierarchy: alpha=1\n");
                        wr(DIB3000MB_REG_VIT_ALPHA, DIB3000_ALPHA_1);
index 0a7790c4bad39ce5ac5ebfcff9d3a419f57da8cb..55bee50aa8716e2dccbe5225ca4efde45eefce0a 100644 (file)
@@ -276,7 +276,7 @@ static int dib7000p_set_power_mode(struct dib7000p_state *state, enum dib7000p_p
                if (state->version != SOC7090)
                        reg_1280 &= ~((1 << 11));
                reg_1280 &= ~(1 << 6);
-               /* fall-through */
+               fallthrough;
        case DIB7000P_POWER_INTERFACE_ONLY:
                /* just leave power on the control-interfaces: GPIO and (I2C or SDIO) */
                /* TODO power up either SDIO or I2C */
index 5de016412c42990578b6d1b5b7a911761a37e038..237b9d04c07661ad12fd148fd71555e9b95ec876 100644 (file)
@@ -2306,7 +2306,7 @@ hi_command(struct i2c_device_addr *dev_addr, const struct drxj_hi_cmd *cmd, u16
                        pr_err("error %d\n", rc);
                        goto rw_error;
                }
-               /* fallthrough */
+               fallthrough;
        case SIO_HI_RA_RAM_CMD_BRDCTRL:
                rc = drxj_dap_write_reg16(dev_addr, SIO_HI_RA_RAM_PAR_2__A, cmd->param2, 0);
                if (rc != 0) {
@@ -2318,7 +2318,7 @@ hi_command(struct i2c_device_addr *dev_addr, const struct drxj_hi_cmd *cmd, u16
                        pr_err("error %d\n", rc);
                        goto rw_error;
                }
-               /* fallthrough */
+               fallthrough;
        case SIO_HI_RA_RAM_CMD_NULL:
                /* No parameters */
                break;
@@ -2841,7 +2841,7 @@ ctrl_set_cfg_mpeg_output(struct drx_demod_instance *demod, struct drx_cfg_mpeg_o
                        /* coef = 188/204                          */
                        max_bit_rate =
                            (ext_attr->curr_symbol_rate / 8) * nr_bits * 188;
-                       /* fall-through - as b/c Annex A/C need following settings */
+                       fallthrough;    /* as b/c Annex A/C need following settings */
                case DRX_STANDARD_ITU_B:
                        rc = drxj_dap_write_reg16(dev_addr, FEC_OC_FCT_USAGE__A, FEC_OC_FCT_USAGE__PRE, 0);
                        if (rc != 0) {
@@ -3555,8 +3555,8 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
                if (!ext_attr->has_smatx)
                        return -EIO;
                switch (uio_cfg->mode) {
-               case DRX_UIO_MODE_FIRMWARE_SMA: /* fall through */
-               case DRX_UIO_MODE_FIRMWARE_SAW: /* fall through */
+               case DRX_UIO_MODE_FIRMWARE_SMA:
+               case DRX_UIO_MODE_FIRMWARE_SAW:
                case DRX_UIO_MODE_READWRITE:
                        ext_attr->uio_sma_tx_mode = uio_cfg->mode;
                        break;
@@ -3579,7 +3579,7 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
                if (!ext_attr->has_smarx)
                        return -EIO;
                switch (uio_cfg->mode) {
-               case DRX_UIO_MODE_FIRMWARE0:    /* fall through */
+               case DRX_UIO_MODE_FIRMWARE0:
                case DRX_UIO_MODE_READWRITE:
                        ext_attr->uio_sma_rx_mode = uio_cfg->mode;
                        break;
@@ -3603,7 +3603,7 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
                if (!ext_attr->has_gpio)
                        return -EIO;
                switch (uio_cfg->mode) {
-               case DRX_UIO_MODE_FIRMWARE0:    /* fall through */
+               case DRX_UIO_MODE_FIRMWARE0:
                case DRX_UIO_MODE_READWRITE:
                        ext_attr->uio_gpio_mode = uio_cfg->mode;
                        break;
@@ -3639,7 +3639,7 @@ static int ctrl_set_uio_cfg(struct drx_demod_instance *demod, struct drxuio_cfg
                        }
                        ext_attr->uio_irqn_mode = uio_cfg->mode;
                        break;
-               case DRX_UIO_MODE_FIRMWARE0:    /* fall through */
+               case DRX_UIO_MODE_FIRMWARE0:
                default:
                        return -EINVAL;
                        break;
@@ -4004,31 +4004,36 @@ static int scu_command(struct i2c_device_addr *dev_addr, struct drxjscu_cmd *cmd
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 4:
                rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_3__A, *(cmd->parameter + 3), 0);
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 3:
                rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_2__A, *(cmd->parameter + 2), 0);
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 2:
                rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_1__A, *(cmd->parameter + 1), 0);
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 1:
                rc = drxj_dap_write_reg16(dev_addr, SCU_RAM_PARAM_0__A, *(cmd->parameter + 0), 0);
                if (rc != 0) {
                        pr_err("error %d\n", rc);
                        goto rw_error;
-               }       /* fallthrough */
+               }
+               fallthrough;
        case 0:
                /* do nothing */
                break;
@@ -4068,25 +4073,29 @@ static int scu_command(struct i2c_device_addr *dev_addr, struct drxjscu_cmd *cmd
                        if (rc != 0) {
                                pr_err("error %d\n", rc);
                                goto rw_error;
-                       }       /* fallthrough */
+                       }
+                       fallthrough;
                case 3:
                        rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_2__A, cmd->result + 2, 0);
                        if (rc != 0) {
                                pr_err("error %d\n", rc);
                                goto rw_error;
-                       }       /* fallthrough */
+                       }
+                       fallthrough;
                case 2:
                        rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_1__A, cmd->result + 1, 0);
                        if (rc != 0) {
                                pr_err("error %d\n", rc);
                                goto rw_error;
-                       }       /* fallthrough */
+                       }
+                       fallthrough;
                case 1:
                        rc = drxj_dap_read_reg16(dev_addr, SCU_RAM_PARAM_0__A, cmd->result + 0, 0);
                        if (rc != 0) {
                                pr_err("error %d\n", rc);
                                goto rw_error;
-                       }       /* fallthrough */
+                       }
+                       fallthrough;
                case 0:
                        /* do nothing */
                        break;
@@ -4791,7 +4800,7 @@ set_frequency(struct drx_demod_instance *demod,
                   Sound carrier is already 3Mhz above centre frequency due
                   to tuner setting so now add an extra shift of 1MHz... */
                fm_frequency_shift = 1000;
-               /*fall through */
+               fallthrough;
        case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_NTSC:
        case DRX_STANDARD_PAL_SECAM_BG:
@@ -10475,11 +10484,11 @@ ctrl_set_channel(struct drx_demod_instance *demod, struct drx_channel *channel)
            (standard == DRX_STANDARD_NTSC)) {
                switch (channel->bandwidth) {
                case DRX_BANDWIDTH_6MHZ:
-               case DRX_BANDWIDTH_UNKNOWN:     /* fall through */
+               case DRX_BANDWIDTH_UNKNOWN:
                        channel->bandwidth = DRX_BANDWIDTH_6MHZ;
                        break;
-               case DRX_BANDWIDTH_8MHZ:        /* fall through */
-               case DRX_BANDWIDTH_7MHZ:        /* fall through */
+               case DRX_BANDWIDTH_8MHZ:
+               case DRX_BANDWIDTH_7MHZ:
                default:
                        return -EINVAL;
                }
@@ -10511,10 +10520,10 @@ ctrl_set_channel(struct drx_demod_instance *demod, struct drx_channel *channel)
                }
 
                switch (channel->constellation) {
-               case DRX_CONSTELLATION_QAM16:   /* fall through */
-               case DRX_CONSTELLATION_QAM32:   /* fall through */
-               case DRX_CONSTELLATION_QAM64:   /* fall through */
-               case DRX_CONSTELLATION_QAM128:  /* fall through */
+               case DRX_CONSTELLATION_QAM16:
+               case DRX_CONSTELLATION_QAM32:
+               case DRX_CONSTELLATION_QAM64:
+               case DRX_CONSTELLATION_QAM128:
                case DRX_CONSTELLATION_QAM256:
                        bandwidth_temp = channel->symbolrate * bw_rolloff_factor;
                        bandwidth = bandwidth_temp / 100;
@@ -10628,8 +10637,8 @@ ctrl_set_channel(struct drx_demod_instance *demod, struct drx_channel *channel)
                }
                break;
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                rc = set_qam_channel(demod, channel, tuner_freq_offset);
                if (rc != 0) {
@@ -10820,7 +10829,7 @@ ctrl_lock_status(struct drx_demod_instance *demod, enum drx_lock_status *lock_st
                    SCU_RAM_COMMAND_CMD_DEMOD_GET_LOCK;
                break;
 #endif
-       case DRX_STANDARD_UNKNOWN:      /* fallthrough */
+       case DRX_STANDARD_UNKNOWN:
        default:
                return -EIO;
        }
@@ -10888,8 +10897,8 @@ ctrl_set_standard(struct drx_demod_instance *demod, enum drx_standard *standard)
         */
        switch (prev_standard) {
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                rc = power_down_qam(demod, false);
                if (rc != 0) {
@@ -10908,7 +10917,7 @@ ctrl_set_standard(struct drx_demod_instance *demod, enum drx_standard *standard)
        case DRX_STANDARD_UNKNOWN:
                /* Do nothing */
                break;
-       case DRX_STANDARD_AUTO: /* fallthrough */
+       case DRX_STANDARD_AUTO:
        default:
                return -EINVAL;
        }
@@ -10921,8 +10930,8 @@ ctrl_set_standard(struct drx_demod_instance *demod, enum drx_standard *standard)
 
        switch (*standard) {
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                do {
                        u16 dummy;
@@ -11111,12 +11120,12 @@ ctrl_power_mode(struct drx_demod_instance *demod, enum drx_power_mode *mode)
                                goto rw_error;
                        }
                        break;
-               case DRX_STANDARD_PAL_SECAM_BG: /* fallthrough */
-               case DRX_STANDARD_PAL_SECAM_DK: /* fallthrough */
-               case DRX_STANDARD_PAL_SECAM_I:  /* fallthrough */
-               case DRX_STANDARD_PAL_SECAM_L:  /* fallthrough */
-               case DRX_STANDARD_PAL_SECAM_LP: /* fallthrough */
-               case DRX_STANDARD_NTSC: /* fallthrough */
+               case DRX_STANDARD_PAL_SECAM_BG:
+               case DRX_STANDARD_PAL_SECAM_DK:
+               case DRX_STANDARD_PAL_SECAM_I:
+               case DRX_STANDARD_PAL_SECAM_L:
+               case DRX_STANDARD_PAL_SECAM_LP:
+               case DRX_STANDARD_NTSC:
                case DRX_STANDARD_FM:
                        rc = power_down_atv(demod, ext_attr->standard, true);
                        if (rc != 0) {
@@ -11127,7 +11136,7 @@ ctrl_power_mode(struct drx_demod_instance *demod, enum drx_power_mode *mode)
                case DRX_STANDARD_UNKNOWN:
                        /* Do nothing */
                        break;
-               case DRX_STANDARD_AUTO: /* fallthrough */
+               case DRX_STANDARD_AUTO:
                default:
                        return -EIO;
                }
@@ -11220,8 +11229,8 @@ ctrl_set_cfg_pre_saw(struct drx_demod_instance *demod, struct drxj_cfg_pre_saw *
                ext_attr->vsb_pre_saw_cfg = *pre_saw;
                break;
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                ext_attr->qam_pre_saw_cfg = *pre_saw;
                break;
@@ -11264,10 +11273,10 @@ ctrl_set_cfg_afe_gain(struct drx_demod_instance *demod, struct drxj_cfg_afe_gain
        ext_attr = (struct drxj_data *) demod->my_ext_attr;
 
        switch (afe_gain->standard) {
-       case DRX_STANDARD_8VSB: /* fallthrough */
+       case DRX_STANDARD_8VSB: fallthrough;
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
 #endif
                /* Do nothing */
@@ -11301,8 +11310,8 @@ ctrl_set_cfg_afe_gain(struct drx_demod_instance *demod, struct drxj_cfg_afe_gain
                ext_attr->vsb_pga_cfg = gain * 13 + 140;
                break;
 #ifndef DRXJ_VSB_ONLY
-       case DRX_STANDARD_ITU_A:        /* fallthrough */
-       case DRX_STANDARD_ITU_B:        /* fallthrough */
+       case DRX_STANDARD_ITU_A:
+       case DRX_STANDARD_ITU_B:
        case DRX_STANDARD_ITU_C:
                ext_attr->qam_pga_cfg = gain * 13 + 140;
                break;
index fae6f3763364aac9cf7983d43bf0a6e11ab4fe1b..45f9828639042c04b5e9a7cd2fabbc9e030f184c 100644 (file)
@@ -1512,14 +1512,14 @@ static int SetDeviceTypeId(struct drxd_state *state)
                        switch (deviceId) {
                        case 4:
                                state->diversity = 1;
-                               /* fall through */
+                               fallthrough;
                        case 3:
                        case 7:
                                state->PGA = 1;
                                break;
                        case 6:
                                state->diversity = 1;
-                               /* fall through */
+                               fallthrough;
                        case 5:
                        case 8:
                                break;
@@ -1966,7 +1966,7 @@ static int DRX_Start(struct drxd_state *state, s32 off)
                switch (p->transmission_mode) {
                default:        /* Not set, detect it automatically */
                        operationMode |= SC_RA_RAM_OP_AUTO_MODE__M;
-                       /* fall through - try first guess DRX_FFTMODE_8K */
+                       fallthrough;    /* try first guess DRX_FFTMODE_8K */
                case TRANSMISSION_MODE_8K:
                        transmissionParams |= SC_RA_RAM_OP_PARAM_MODE_8K;
                        if (state->type_A) {
@@ -2139,7 +2139,7 @@ static int DRX_Start(struct drxd_state *state, s32 off)
                switch (p->modulation) {
                default:
                        operationMode |= SC_RA_RAM_OP_AUTO_CONST__M;
-                       /* fall through - try first guess DRX_CONSTELLATION_QAM64 */
+                       fallthrough;    /* try first guess DRX_CONSTELLATION_QAM64 */
                case QAM_64:
                        transmissionParams |= SC_RA_RAM_OP_PARAM_CONST_QAM64;
                        if (state->type_A) {
@@ -2266,7 +2266,7 @@ static int DRX_Start(struct drxd_state *state, s32 off)
                        break;
                default:
                        operationMode |= SC_RA_RAM_OP_AUTO_RATE__M;
-                       /* fall through */
+                       fallthrough;
                case FEC_2_3:
                        transmissionParams |= SC_RA_RAM_OP_PARAM_RATE_2_3;
                        if (state->type_A)
@@ -2301,7 +2301,7 @@ static int DRX_Start(struct drxd_state *state, s32 off)
                switch (p->bandwidth_hz) {
                case 0:
                        p->bandwidth_hz = 8000000;
-                       /* fall through */
+                       fallthrough;
                case 8000000:
                        /* (64/7)*(8/8)*1000000 */
                        bandwidth = DRXD_BANDWIDTH_8MHZ_IN_HZ;
index 0ae9d8c72d8dcaa26de2cbb615198e836bcee590..32f9346deb3e98fbe22a7afc63a4c1667344dfed 100644 (file)
@@ -1756,7 +1756,7 @@ static int setoperation_mode(struct drxk_state *state,
                        goto error;
                state->m_operation_mode = OM_NONE;
                break;
-       case OM_QAM_ITU_A:      /* fallthrough */
+       case OM_QAM_ITU_A:
        case OM_QAM_ITU_C:
                status = mpegts_stop(state);
                if (status < 0)
@@ -1783,7 +1783,7 @@ static int setoperation_mode(struct drxk_state *state,
                if (status < 0)
                        goto error;
                break;
-       case OM_QAM_ITU_A:      /* fallthrough */
+       case OM_QAM_ITU_A:
        case OM_QAM_ITU_C:
                dprintk(1, ": DVB-C Annex %c\n",
                        (state->m_operation_mode == OM_QAM_ITU_A) ? 'A' : 'C');
@@ -2012,7 +2012,7 @@ static int mpegts_dto_setup(struct drxk_state *state,
                fec_oc_rcn_ctl_rate = 0xC00000;
                static_clk = state->m_dvbt_static_clk;
                break;
-       case OM_QAM_ITU_A:      /* fallthrough */
+       case OM_QAM_ITU_A:
        case OM_QAM_ITU_C:
                fec_oc_tmd_mode = 0x0004;
                fec_oc_rcn_ctl_rate = 0xD2B4EE; /* good for >63 Mb/s */
@@ -3249,11 +3249,11 @@ static int dvbt_sc_command(struct drxk_state *state,
        case OFDM_SC_RA_RAM_CMD_SET_PREF_PARAM:
        case OFDM_SC_RA_RAM_CMD_PROGRAM_PARAM:
                status |= write16(state, OFDM_SC_RA_RAM_PARAM1__A, param1);
-               /* fall through - All commands using 1 parameters */
+               fallthrough;    /* All commands using 1 parameters */
        case OFDM_SC_RA_RAM_CMD_SET_ECHO_TIMING:
        case OFDM_SC_RA_RAM_CMD_USER_IO:
                status |= write16(state, OFDM_SC_RA_RAM_PARAM0__A, param0);
-               /* fall through - All commands using 0 parameters */
+               fallthrough;    /* All commands using 0 parameters */
        case OFDM_SC_RA_RAM_CMD_GET_OP_PARAM:
        case OFDM_SC_RA_RAM_CMD_NULL:
                /* Write command */
@@ -3761,7 +3761,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        case TRANSMISSION_MODE_AUTO:
        default:
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_MODE__M;
-               /* fall through - try first guess DRX_FFTMODE_8K */
+               fallthrough;    /* try first guess DRX_FFTMODE_8K */
        case TRANSMISSION_MODE_8K:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_MODE_8K;
                break;
@@ -3775,7 +3775,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        default:
        case GUARD_INTERVAL_AUTO:
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_GUARD__M;
-               /* fall through - try first guess DRX_GUARD_1DIV4 */
+               fallthrough;    /* try first guess DRX_GUARD_1DIV4 */
        case GUARD_INTERVAL_1_4:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_GUARD_4;
                break;
@@ -3798,7 +3798,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_HIER__M;
                /* try first guess SC_RA_RAM_OP_PARAM_HIER_NO */
                /* transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_NO; */
-               /* fall through */
+               fallthrough;
        case HIERARCHY_1:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_A1;
                break;
@@ -3816,7 +3816,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        case QAM_AUTO:
        default:
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_CONST__M;
-               /* fall through - try first guess DRX_CONSTELLATION_QAM64 */
+               fallthrough;    /* try first guess DRX_CONSTELLATION_QAM64 */
        case QAM_64:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_CONST_QAM64;
                break;
@@ -3841,7 +3841,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
                WR16(dev_addr, OFDM_EC_SB_PRIOR__A,
                        OFDM_EC_SB_PRIOR_HI));
                break;
-       case DRX_PRIORITY_UNKNOWN:      /* fall through */
+       case DRX_PRIORITY_UNKNOWN:
        default:
                status = -EINVAL;
                goto error;
@@ -3859,7 +3859,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        case FEC_AUTO:
        default:
                operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_RATE__M;
-               /* fall through - try first guess DRX_CODERATE_2DIV3 */
+               fallthrough;    /* try first guess DRX_CODERATE_2DIV3 */
        case FEC_2_3:
                transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_RATE_2_3;
                break;
@@ -3893,7 +3893,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
        switch (state->props.bandwidth_hz) {
        case 0:
                state->props.bandwidth_hz = 8000000;
-               /* fall through */
+               fallthrough;
        case 8000000:
                bandwidth = DRXK_BANDWIDTH_8MHZ_IN_HZ;
                status = write16(state, OFDM_SC_RA_RAM_SRMM_FIX_FACT_8K__A,
index d3c330e035c45e42a2e84644d6152413313c2022..722576f1732aa733371aee191986995c52be01b6 100644 (file)
@@ -768,7 +768,7 @@ static int lgdt3306a_set_if(struct lgdt3306a_state *state,
        default:
                pr_warn("IF=%d KHz is not supported, 3250 assumed\n",
                        if_freq_khz);
-               /* fallthrough */
+               fallthrough;
        case 3250: /* 3.25Mhz */
                nco1 = 0x34;
                nco2 = 0x00;
index 881897583cf2d88fc6482df6a7158a0f424cbc54..399d5c519027e845b0f757d18dbf00e24b0d1f45 100644 (file)
@@ -201,7 +201,7 @@ static int mt352_set_parameters(struct dvb_frontend *fe)
                        if (op->hierarchy == HIERARCHY_AUTO ||
                            op->hierarchy == HIERARCHY_NONE)
                                break;
-                       /* fall through */
+                       fallthrough;
                default:
                        return -EINVAL;
        }
index 290b9eab099ff756227753f3bc220fb146118f09..4404ace82981ce46b07ba9f15885e78db8ae227b 100644 (file)
@@ -739,7 +739,7 @@ static int get_frontend(struct dvb_frontend *fe,
                default:
                        break;
                }
-               /* Fall through */
+               fallthrough;
        case SYS_DVBS:
                switch ((enum MXL_HYDRA_MODULATION_E)
                        reg_data[DMD_MODULATION_SCHEME_ADDR]) {
index 35a3e47497c272c78188149c623c449b3d78e601..24de1b115158387e298a307ec52b1b5a0c461c95 100644 (file)
@@ -482,7 +482,7 @@ start:
        switch (reg&0xff) {
        case 0x06:
                if (reg & 0x1000) usK = 3 << 24;
-               /* fall through */
+               fallthrough;
        case 0x43: /* QAM64 */
                c = 150204167;
                break;
index 89402916d301f4604c1490ba24275de91f8363b2..c1334d7eb442026ba04b8e45360be262c0c0a67f 100644 (file)
@@ -398,7 +398,7 @@ static int s5h1411_set_if_freq(struct dvb_frontend *fe, int KHz)
        default:
                dprintk("%s(%d KHz) Invalid, defaulting to 5380\n",
                        __func__, KHz);
-               /* fall through */
+               fallthrough;
        case 5380:
        case 44000:
                s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x38, 0x1be4);
index 2fc6aea580f90be3b587290287c35535aa01423d..2a2cf20a73d615093b96453f411df106df5f5616 100644 (file)
@@ -201,7 +201,7 @@ static int zl10353_set_parameters(struct dvb_frontend *fe)
                break;
        default:
                c->bandwidth_hz = 8000000;
-               /* fall through */
+               fallthrough;
        case 8000000:
                zl10353_single_write(fe, MCLK_RATIO, 0x75);
                zl10353_single_write(fe, 0x64, 0x36);
@@ -258,7 +258,7 @@ static int zl10353_set_parameters(struct dvb_frontend *fe)
                if (c->hierarchy == HIERARCHY_AUTO ||
                    c->hierarchy == HIERARCHY_NONE)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index 48ae60a2c6030a049d6499dfbcedbeff43801f86..c7ba76fee599a91c4d7056546523b3b8d93dce9d 100644 (file)
@@ -467,7 +467,7 @@ config VIDEO_VPX3220
 config VIDEO_MAX9286
        tristate "Maxim MAX9286 GMSL deserializer support"
        depends on I2C && I2C_MUX
-       depends on OF
+       depends on OF_GPIO
        select V4L2_FWNODE
        select VIDEO_V4L2_SUBDEV_API
        select MEDIA_CONTROLLER
@@ -741,7 +741,7 @@ config VIDEO_HI556
 config VIDEO_IMX214
        tristate "Sony IMX214 sensor support"
        depends on GPIOLIB && I2C && VIDEO_V4L2
-       depends on V4L2_FWNODE
+       select V4L2_FWNODE
        select MEDIA_CONTROLLER
        select VIDEO_V4L2_SUBDEV_API
        select REGMAP_I2C
index 570a4a09c387a553204ac54697c7bd0bb9c07110..03eee606af91528ca056e18ddce527c0a7c99a86 100644 (file)
@@ -2209,7 +2209,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
                ts2->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
                ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */
                ts2->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
-               /* fall-through */
+               fallthrough;
        case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
                ts1->gen_ctrl_val  = 0xc; /* Serial bus + punctured clock */
                ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
@@ -2370,7 +2370,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
                /* Currently only enabled for the integrated IR controller */
                if (!enable_885_ir)
                        break;
-               /* fall-through */
+               fallthrough;
        case CX23885_BOARD_HAUPPAUGE_HVR1250:
        case CX23885_BOARD_HAUPPAUGE_HVR1800:
        case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE:
index 7cabb9e9ffe21f53ffeb597d4ff415f01ea26110..92fe051c672f603606e4d9abcc2d451683d0cbdc 100644 (file)
@@ -1310,7 +1310,7 @@ static void dvb_input_detach(struct ddb_input *input)
                        dvb_unregister_frontend(dvb->fe2);
                if (dvb->fe)
                        dvb_unregister_frontend(dvb->fe);
-               /* fallthrough */
+               fallthrough;
        case 0x30:
                dvb_module_release(dvb->i2c_client[0]);
                dvb->i2c_client[0] = NULL;
@@ -1321,22 +1321,22 @@ static void dvb_input_detach(struct ddb_input *input)
                        dvb_frontend_detach(dvb->fe);
                dvb->fe = NULL;
                dvb->fe2 = NULL;
-               /* fallthrough */
+               fallthrough;
        case 0x20:
                dvb_net_release(&dvb->dvbnet);
-               /* fallthrough */
+               fallthrough;
        case 0x12:
                dvbdemux->dmx.remove_frontend(&dvbdemux->dmx,
                                              &dvb->hw_frontend);
                dvbdemux->dmx.remove_frontend(&dvbdemux->dmx,
                                              &dvb->mem_frontend);
-               /* fallthrough */
+               fallthrough;
        case 0x11:
                dvb_dmxdev_release(&dvb->dmxdev);
-               /* fallthrough */
+               fallthrough;
        case 0x10:
                dvb_dmx_release(&dvb->demux);
-               /* fallthrough */
+               fallthrough;
        case 0x01:
                break;
        }
@@ -1559,7 +1559,7 @@ static int dvb_input_attach(struct ddb_input *input)
                        osc24 = 0;
                else
                        osc24 = 1;
-               /* fall-through */
+               fallthrough;
        case DDB_TUNER_DVBCT2_SONY_P:
        case DDB_TUNER_DVBC2T2_SONY_P:
        case DDB_TUNER_ISDBT_SONY_P:
@@ -1575,7 +1575,7 @@ static int dvb_input_attach(struct ddb_input *input)
                break;
        case DDB_TUNER_DVBC2T2I_SONY:
                osc24 = 1;
-               /* fall-through */
+               fallthrough;
        case DDB_TUNER_DVBCT2_SONY:
        case DDB_TUNER_DVBC2T2_SONY:
        case DDB_TUNER_ISDBT_SONY:
@@ -2036,7 +2036,7 @@ static int ddb_port_attach(struct ddb_port *port)
                ret = ddb_ci_attach(port, ci_bitrate);
                if (ret < 0)
                        break;
-               /* fall-through */
+               fallthrough;
        case DDB_PORT_LOOP:
                ret = dvb_register_device(port->dvb[0].adap,
                                          &port->dvb[0].dev,
@@ -2432,7 +2432,8 @@ void ddb_ports_init(struct ddb *dev)
                                        ddb_input_init(port, 4 + i, 1, 4 + i);
                                        ddb_output_init(port, i);
                                        break;
-                               } /* fallthrough */
+                               }
+                               fallthrough;
                        case DDB_OCTOPUS:
                                ddb_input_init(port, 2 * i, 0, 2 * i);
                                ddb_input_init(port, 2 * i + 1, 1, 2 * i + 1);
@@ -3417,7 +3418,7 @@ int ddb_exit_ddbridge(int stage, int error)
        default:
        case 2:
                destroy_workqueue(ddb_wq);
-               /* fall-through */
+               fallthrough;
        case 1:
                ddb_class_destroy();
                break;
index 7fb3b1853b87211fcc8cda5d5e03c69435cb4d7d..8944e4bd4638261904f972fc719cf845de4e2187 100644 (file)
@@ -952,7 +952,7 @@ static int meyeioc_sync(struct file *file, void *fh, int *i)
                        mutex_unlock(&meye.lock);
                        return -EINTR;
                }
-               /* fall through */
+               fallthrough;
        case MEYE_BUF_DONE:
                meye.grab_buffer[*i].state = MEYE_BUF_UNUSED;
                if (kfifo_out_locked(&meye.doneq, (unsigned char *)&unused,
index bf36b1e22b6357d8dc639c4e5acb9a0bddca44fd..45228f4f6fc6d9e39fe0bb5abbd03f296ff1a1bd 100644 (file)
@@ -637,7 +637,7 @@ static void gpioirq(unsigned long cookie)
                        iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case DATA_TS_RECORD:
        case DATA_PES_RECORD:
@@ -2176,7 +2176,7 @@ static int frontend_init(struct av7110 *av7110)
                                break;
                        }
                }
-               /* fall-thru */
+                       fallthrough;
 
                case 0x0008: // Hauppauge/TT DVB-T
                        // Grundig 29504-401
index e8a8ec5405e2d2deead16144ef1512ae81ecb162..93ca31e38ddd3949169ee0b1f11eb41ae2f58c9c 100644 (file)
@@ -1107,7 +1107,7 @@ int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc)
                break;
        case OSD_SetRow:
                dc->y1 = dc->y0;
-               /* fall through */
+               fallthrough;
        case OSD_SetBlock:
                ret = OSDSetBlock(av7110, dc->x0, dc->y0, dc->x1, dc->y1, dc->color, dc->data);
                break;
index ec528fae7333bd6943a3a517d9e0e8b68fb21770..30330ed01ce8852bd996ffab1322c9cf733a8dc4 100644 (file)
@@ -182,7 +182,7 @@ int av7110_ipack_instant_repack (const u8 *buf, int count, struct ipack *p)
                        case DSM_CC_STREAM  :
                        case ISO13522_STREAM:
                                p->done = 1;
-                               /* fall through */
+                               fallthrough;
                        case PRIVATE_STREAM1:
                        case VIDEO_STREAM_S ... VIDEO_STREAM_E:
                        case AUDIO_STREAM_S ... AUDIO_STREAM_E:
index 38cac508bd728d2012bc3503b3252f49debc9e69..3cb83005cf09b6c186a081b144ceb2e3657cfab8 100644 (file)
@@ -1226,7 +1226,7 @@ static void frontend_init(struct budget_av *budget_av)
                 * but so far it has been only confirmed for this type
                 */
                budget_av->reinitialise_demod = 1;
-               /* fall through */
+               fallthrough;
        case SUBID_DVBS_KNC1_PLUS:
        case SUBID_DVBS_EASYWATCH_1:
                if (saa->pci->subsystem_vendor == 0x1894) {
index 9c811272abfe73309078c661c88d364522c58fa4..a88711a3ac7fd1ee585ad390cd844d540219f95e 100644 (file)
@@ -613,7 +613,7 @@ static void frontend_init(struct budget *budget)
                        break;
                }
        }
-       /* fall through */
+               fallthrough;
        case 0x1018: // TT Budget-S-1401 (philips tda10086/philips tda8262)
        {
                struct dvb_frontend *fe;
@@ -638,7 +638,7 @@ static void frontend_init(struct budget *budget)
                        break;
                }
        }
-       /* fall through */
+               fallthrough;
 
        case 0x101c: { /* TT S2-1600 */
                        const struct stv6110x_devctl *ctl;
index 36e5f2ff4ef1d213e8c8a16e57f36125eb7e423c..b22dc1d725276f61bf2c47dfff21b00d93d54b3f 100644 (file)
@@ -220,7 +220,7 @@ static void sh_vou_stream_config(struct sh_vou_device *vou_dev)
                break;
        case V4L2_PIX_FMT_RGB565:
                dataswap ^= 1;
-               /* fall through */
+               fallthrough;
        case V4L2_PIX_FMT_RGB565X:
                row_coeff = 2;
                break;
@@ -802,7 +802,7 @@ static u32 sh_vou_ntsc_mode(enum sh_vou_bus_fmt bus_fmt)
        default:
                pr_warn("%s(): Invalid bus-format code %d, using default 8-bit\n",
                        __func__, bus_fmt);
-               /* fall through */
+               fallthrough;
        case SH_VOU_BUS_8BIT:
                return 1;
        case SH_VOU_BUS_16BIT:
index e496083715d213e3aa300f07e6460bf3a5325297..4123405ee0cf765221d4f70cdea9672f85438b99 100644 (file)
@@ -226,7 +226,7 @@ static inline void cal_write_field(struct cal_dev *cal, u32 offset, u32 value,
        u32 val = cal_read(cal, offset);
 
        val &= ~mask;
-       val |= FIELD_PREP(mask, value);
+       val |= (value << __ffs(mask)) & mask;
        cal_write(cal, offset, val);
 }
 
index b203296de9779d57ab2c2bef5c4d34c734c883ca..7e246026388291659e4914ad2ac447a3d4765f4b 100644 (file)
@@ -105,7 +105,8 @@ static inline enum phase_diversity_modes_idx
 si476x_phase_diversity_mode_to_idx(enum si476x_phase_diversity_mode mode)
 {
        switch (mode) {
-       default:                /* FALLTHROUGH */
+       default:
+               fallthrough;
        case SI476X_PHDIV_DISABLED:
                return SI476X_IDX_PHDIV_DISABLED;
        case SI476X_PHDIV_PRIMARY_COMBINING:
index b0303cf0038798b3fd3c57bb0e7ebe3fc06de1ce..c37315226c427ac3e382055e0d3f8057d8ef6870 100644 (file)
@@ -249,7 +249,7 @@ int snd_tea575x_enum_freq_bands(struct snd_tea575x *tea,
                        index = BAND_AM;
                        break;
                }
-               /* Fall through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index 5bb144435c1605a86e484f692b170dddd15b81a6..3fe3edd8087656013846c33d3ac690d4700f542f 100644 (file)
@@ -112,7 +112,7 @@ lirc_mode2_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
        case BPF_FUNC_trace_printk:
                if (perfmon_capable())
                        return bpf_get_trace_printk_proto();
-               /* fall through */
+               fallthrough;
        default:
                return NULL;
        }
index f33b443bfa47b06fe103620fc71aecef3342e8a3..c6cd2e6d8e654d8cb5182f1bb7fc3436d7cdecf5 100644 (file)
@@ -19,8 +19,6 @@ struct gpio_ir {
        struct gpio_desc *gpio;
        unsigned int carrier;
        unsigned int duty_cycle;
-       /* we need a spinlock to hold the cpu while transmitting */
-       spinlock_t lock;
 };
 
 static const struct of_device_id gpio_ir_tx_of_match[] = {
@@ -53,12 +51,11 @@ static int gpio_ir_tx_set_carrier(struct rc_dev *dev, u32 carrier)
 static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf,
                                   uint count)
 {
-       unsigned long flags;
        ktime_t edge;
        s32 delta;
        int i;
 
-       spin_lock_irqsave(&gpio_ir->lock, flags);
+       local_irq_disable();
 
        edge = ktime_get();
 
@@ -72,14 +69,11 @@ static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf,
        }
 
        gpiod_set_value(gpio_ir->gpio, 0);
-
-       spin_unlock_irqrestore(&gpio_ir->lock, flags);
 }
 
 static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf,
                                 uint count)
 {
-       unsigned long flags;
        ktime_t edge;
        /*
         * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on
@@ -95,7 +89,7 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf,
        space = DIV_ROUND_CLOSEST((100 - gpio_ir->duty_cycle) *
                                  (NSEC_PER_SEC / 100), gpio_ir->carrier);
 
-       spin_lock_irqsave(&gpio_ir->lock, flags);
+       local_irq_disable();
 
        edge = ktime_get();
 
@@ -128,19 +122,20 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf,
                        edge = last;
                }
        }
-
-       spin_unlock_irqrestore(&gpio_ir->lock, flags);
 }
 
 static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
                      unsigned int count)
 {
        struct gpio_ir *gpio_ir = dev->priv;
+       unsigned long flags;
 
+       local_irq_save(flags);
        if (gpio_ir->carrier)
                gpio_ir_tx_modulated(gpio_ir, txbuf, count);
        else
                gpio_ir_tx_unmodulated(gpio_ir, txbuf, count);
+       local_irq_restore(flags);
 
        return count;
 }
@@ -176,7 +171,6 @@ static int gpio_ir_tx_probe(struct platform_device *pdev)
 
        gpio_ir->carrier = 38000;
        gpio_ir->duty_cycle = 50;
-       spin_lock_init(&gpio_ir->lock);
 
        rc = devm_rc_register_device(&pdev->dev, rcdev);
        if (rc < 0)
index 95727ca910f715c7918de70a9785988002989dc1..0cda78f72fd800552149549e3b92be33286de909 100644 (file)
@@ -64,7 +64,7 @@ static enum rc6_mode rc6_mode(struct rc6_dec *data)
        case 6:
                if (!data->toggle)
                        return RC6_MODE_6A;
-               /* fall through */
+               fallthrough;
        default:
                return RC6_MODE_UNKNOWN;
        }
index 9fa58d92eb09723ee0196aa883e0d4f02479844f..7d9a7c000c75aa7f839ee675364815d69df44aef 100644 (file)
@@ -102,7 +102,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
                }
 
                data->state = STATE_FINISHED;
-               /* Fall through */
+               fallthrough;
 
        case STATE_FINISHED:
                if (ev.pulse)
index f9616158bcf44a27527394d03742c5543560e249..98681ba10428b4c9587c8432f69bb611a497f70f 100644 (file)
@@ -1726,7 +1726,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
                goto mem_alloc_fail;
 
        ir->pipe_in = pipe;
-       ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_ATOMIC, &ir->dma_in);
+       ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_KERNEL, &ir->dma_in);
        if (!ir->buf_in)
                goto buf_in_alloc_fail;
 
index 7b53066d9d07c2278100d8bf7edf6cf881c25f13..dee8a9f3d80ac26c1cd869113ef364ab2cc18fb1 100644 (file)
@@ -1292,6 +1292,10 @@ static ssize_t store_protocols(struct device *device,
        }
 
        mutex_lock(&dev->lock);
+       if (!dev->registered) {
+               mutex_unlock(&dev->lock);
+               return -ENODEV;
+       }
 
        old_protocols = *current_protocols;
        new_protocols = old_protocols;
@@ -1430,6 +1434,10 @@ static ssize_t store_filter(struct device *device,
                return -EINVAL;
 
        mutex_lock(&dev->lock);
+       if (!dev->registered) {
+               mutex_unlock(&dev->lock);
+               return -ENODEV;
+       }
 
        new_filter = *filter;
        if (fattr->mask)
@@ -1544,6 +1552,10 @@ static ssize_t store_wakeup_protocols(struct device *device,
        int i;
 
        mutex_lock(&dev->lock);
+       if (!dev->registered) {
+               mutex_unlock(&dev->lock);
+               return -ENODEV;
+       }
 
        allowed = dev->allowed_wakeup_protocols;
 
@@ -1601,25 +1613,25 @@ static void rc_dev_release(struct device *device)
        kfree(dev);
 }
 
-#define ADD_HOTPLUG_VAR(fmt, val...)                                   \
-       do {                                                            \
-               int err = add_uevent_var(env, fmt, val);                \
-               if (err)                                                \
-                       return err;                                     \
-       } while (0)
-
 static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env)
 {
        struct rc_dev *dev = to_rc_dev(device);
+       int ret = 0;
 
-       if (dev->rc_map.name)
-               ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name);
-       if (dev->driver_name)
-               ADD_HOTPLUG_VAR("DRV_NAME=%s", dev->driver_name);
-       if (dev->device_name)
-               ADD_HOTPLUG_VAR("DEV_NAME=%s", dev->device_name);
+       mutex_lock(&dev->lock);
 
-       return 0;
+       if (!dev->registered)
+               ret = -ENODEV;
+       if (ret == 0 && dev->rc_map.name)
+               ret = add_uevent_var(env, "NAME=%s", dev->rc_map.name);
+       if (ret == 0 && dev->driver_name)
+               ret = add_uevent_var(env, "DRV_NAME=%s", dev->driver_name);
+       if (ret == 0 && dev->device_name)
+               ret = add_uevent_var(env, "DEV_NAME=%s", dev->device_name);
+
+       mutex_unlock(&dev->lock);
+
+       return ret;
 }
 
 /*
@@ -2011,14 +2023,14 @@ void rc_unregister_device(struct rc_dev *dev)
        del_timer_sync(&dev->timer_keyup);
        del_timer_sync(&dev->timer_repeat);
 
-       rc_free_rx_device(dev);
-
        mutex_lock(&dev->lock);
        if (dev->users && dev->close)
                dev->close(dev);
        dev->registered = false;
        mutex_unlock(&dev->lock);
 
+       rc_free_rx_device(dev);
+
        /*
         * lirc device should be freed with dev->registered = false, so
         * that userspace polling will get notified.
index 8941d73f6611db4a54cda773e0cadcedf0d5fcbd..71928e30dae809310fb7b8a4569194055258e657 100644 (file)
@@ -1994,6 +1994,7 @@ static int vicodec_request_validate(struct media_request *req)
        }
        ctrl = v4l2_ctrl_request_hdl_ctrl_find(hdl,
                                               vicodec_ctrl_stateless_state.id);
+       v4l2_ctrl_request_hdl_put(hdl);
        if (!ctrl) {
                v4l2_info(&ctx->dev->v4l2_dev,
                          "Missing required codec control\n");
index 734a92caad8d0a2a626f78af4106cdc5c98490d6..7b7d9fe4f945338792dba2d20f944ecbd266cd50 100644 (file)
@@ -756,7 +756,7 @@ static int xc5000_set_digital_params(struct dvb_frontend *fe)
                if (!bw)
                        bw = 6000000;
                /* fall to OFDM handling */
-               /* fall through */
+               fallthrough;
        case SYS_DMBTH:
        case SYS_DVBT:
        case SYS_DVBT2:
index 198ddfb8d2b18e1fa12b22afdae24add748032b3..e3234d1690655c3ca744f6803a380e691633c59e 100644 (file)
@@ -525,7 +525,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)
        case USB_SPEED_HIGH:
                info("running at HIGH speed.");
                break;
-       case USB_SPEED_UNKNOWN: /* fall through */
+       case USB_SPEED_UNKNOWN:
        default:
                err("cannot handle USB speed because it is unknown.");
                return -ENODEV;
index 20c50c2d042e6386f9ef2eb3947d73421a4d4af9..e747548ab28695fd2d965a1336edc3dc225b6ec5 100644 (file)
@@ -165,7 +165,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_BRIGHTNESS:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_BRIGHTNESS:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -176,7 +176,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_CONTRAST:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_CONTRAST:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -184,7 +184,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_SATURATION:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_SATURATION:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -195,7 +195,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_GPIO_DATA:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_GPIO_DATA:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -203,7 +203,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_GPIO_DIRECTION:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_GPIO_DIRECTION:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -211,7 +211,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VC_MP_GPIO_DATA:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VC_MP_GPIO_DATA:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -219,7 +219,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VC_MP_GPIO_DIRECTION:
                cmd.buffer.block_data[0] = param;
-               /*fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VC_MP_GPIO_DIRECTION:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -234,7 +234,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_FLICKER_MODES:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_FLICKER_MODES:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -281,7 +281,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_USER_MODE:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_USER_MODE:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -301,7 +301,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_WAKEUP:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_WAKEUP:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -309,7 +309,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_PW_CONTROL:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_PW_CONTROL:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -322,7 +322,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_SYSTEM_CTRL:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_SYSTEM_CTRL:
                cmd.req_mode =
                    CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_SYSTEM;
@@ -331,7 +331,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_SYSTEM_CTRL:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_SYSTEM_CTRL:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -339,7 +339,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VP_EXP_MODES:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VP_EXP_MODES:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -347,7 +347,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_DEVICE_CONFIG:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_DEVICE_CONFIG:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -368,7 +368,7 @@ int cpia2_do_command(struct camera_data *cam,
                break;
        case CPIA2_CMD_SET_VC_CONTROL:
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_VC_CONTROL:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VC;
                cmd.reg_count = 1;
@@ -403,7 +403,7 @@ int cpia2_do_command(struct camera_data *cam,
                                             this register can also affect
                                             flicker modes */
                cmd.buffer.block_data[0] = param;
-               /* fall through */
+               fallthrough;
        case CPIA2_CMD_GET_USER_EFFECTS:
                cmd.req_mode = CAMERAACCESS_TYPE_BLOCK | CAMERAACCESS_VP;
                cmd.reg_count = 1;
@@ -1751,7 +1751,7 @@ int cpia2_set_fps(struct camera_data *cam, int framerate)
                                                    CPIA2_VP_SENSOR_FLAGS_500) {
                                return -EINVAL;
                        }
-                       /* Fall through */
+                       fallthrough;
                case CPIA2_VP_FRAMERATE_15:
                case CPIA2_VP_FRAMERATE_12_5:
                case CPIA2_VP_FRAMERATE_7_5:
index d9f953f2d0882923bfcba1246c532808ba93bc66..425e470b0fd354aa7ea3888557f342b7df0639b5 100644 (file)
@@ -996,7 +996,7 @@ void cx231xx_v4l2_create_entities(struct cx231xx *dev)
                        /* The DVB core will handle it */
                        if (dev->tuner_type == TUNER_ABSENT)
                                continue;
-                       /* fall through */
+                       fallthrough;
                default: /* just to shut up a gcc warning */
                        ent->function = MEDIA_ENT_F_CONN_RF;
                        break;
index 4ef3fa98d20f4d985e8fd1dd4857640508832aa3..52e648e2713aec5d507cb00c6afa7282fca38b0f 100644 (file)
@@ -1659,14 +1659,14 @@ static int dib8096_set_param_override(struct dvb_frontend *fe)
 
        switch (band) {
        default:
-                       deb_info("Warning : Rf frequency  (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
-                       /* fall through */
+               deb_info("Warning : Rf frequency  (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
+               fallthrough;
        case BAND_VHF:
-                       state->dib8000_ops.set_gpio(fe, 3, 0, 1);
-                       break;
+               state->dib8000_ops.set_gpio(fe, 3, 0, 1);
+               break;
        case BAND_UHF:
-                       state->dib8000_ops.set_gpio(fe, 3, 0, 0);
-                       break;
+               state->dib8000_ops.set_gpio(fe, 3, 0, 0);
+               break;
        }
 
        ret = state->set_param_save(fe);
index f96626fe2c0b7088f411f166cf8b7a7d3304f806..a27a6844032528437561278a5816d0fe6513a4e7 100644 (file)
@@ -1886,12 +1886,12 @@ static int dw2102_load_firmware(struct usb_device *dev,
                switch (le16_to_cpu(dev->descriptor.idProduct)) {
                case USB_PID_TEVII_S650:
                        dw2104_properties.rc.core.rc_codes = RC_MAP_TEVII_NEC;
-                       /* fall through */
+                       fallthrough;
                case USB_PID_DW2104:
                        reset = 1;
                        dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1,
                                        DW210X_WRITE_MSG);
-                       /* fall through */
+                       fallthrough;
                case USB_PID_DW3101:
                        reset = 0;
                        dw210x_op_rw(dev, 0xbf, 0x0040, 0, &reset, 0,
@@ -1924,7 +1924,7 @@ static int dw2102_load_firmware(struct usb_device *dev,
                                        break;
                                }
                        }
-                       /* fall through */
+                       fallthrough;
                case 0x2101:
                        dw210x_op_rw(dev, 0xbc, 0x0030, 0, &reset16[0], 2,
                                        DW210X_READ_MSG);
index 593bcf6c3735025de716bf2c4012c406c466c707..a99e82ec9ab60de072215206c7042274ed81d319 100644 (file)
@@ -246,9 +246,6 @@ struct v4l2_format32 {
  * @memory:    buffer memory type
  * @format:    frame format, for which buffers are requested
  * @capabilities: capabilities of this buffer type.
- * @flags:     additional buffer management attributes (ignored unless the
- *             queue has V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS capability and
- *             configured for MMAP streaming I/O).
  * @reserved:  future extensions
  */
 struct v4l2_create_buffers32 {
@@ -257,8 +254,7 @@ struct v4l2_create_buffers32 {
        __u32                   memory; /* enum v4l2_memory */
        struct v4l2_format32    format;
        __u32                   capabilities;
-       __u32                   flags;
-       __u32                   reserved[6];
+       __u32                   reserved[7];
 };
 
 static int __bufsize_v4l2_format(struct v4l2_format32 __user *p32, u32 *size)
@@ -359,8 +355,7 @@ static int get_v4l2_create32(struct v4l2_create_buffers __user *p64,
 {
        if (!access_ok(p32, sizeof(*p32)) ||
            copy_in_user(p64, p32,
-                        offsetof(struct v4l2_create_buffers32, format)) ||
-           assign_in_user(&p64->flags, &p32->flags))
+                        offsetof(struct v4l2_create_buffers32, format)))
                return -EFAULT;
        return __get_v4l2_format32(&p64->format, &p32->format,
                                   aux_buf, aux_space);
@@ -422,7 +417,6 @@ static int put_v4l2_create32(struct v4l2_create_buffers __user *p64,
            copy_in_user(p32, p64,
                         offsetof(struct v4l2_create_buffers32, format)) ||
            assign_in_user(&p32->capabilities, &p64->capabilities) ||
-           assign_in_user(&p32->flags, &p64->flags) ||
            copy_in_user(p32->reserved, p64->reserved, sizeof(p64->reserved)))
                return -EFAULT;
        return __put_v4l2_format32(&p64->format, &p32->format);
index 3f3fbcd60cc6211acf0062de7f5072ba1d81f255..45a2403aa039bc05e697602f11f38517b10fcf2b 100644 (file)
@@ -2200,7 +2200,7 @@ static int check_range(enum v4l2_ctrl_type type,
        case V4L2_CTRL_TYPE_BOOLEAN:
                if (step != 1 || max > 1 || min < 0)
                        return -ERANGE;
-               /* fall through */
+               fallthrough;
        case V4L2_CTRL_TYPE_U8:
        case V4L2_CTRL_TYPE_U16:
        case V4L2_CTRL_TYPE_U32:
index a556880f225a5fb85c0a709d7c7d53222453b988..eeff398fbdcc1722d18161b87209fba15cf7e42c 100644 (file)
@@ -782,7 +782,6 @@ static void v4l_print_frmsizeenum(const void *arg, bool write_only)
                                p->stepwise.step_height);
                break;
        case V4L2_FRMSIZE_TYPE_CONTINUOUS:
-               /* fall through */
        default:
                pr_cont("\n");
                break;
@@ -816,7 +815,6 @@ static void v4l_print_frmivalenum(const void *arg, bool write_only)
                                p->stepwise.step.denominator);
                break;
        case V4L2_FRMIVAL_TYPE_CONTINUOUS:
-               /* fall through */
        default:
                pr_cont("\n");
                break;
@@ -2044,6 +2042,9 @@ static int v4l_reqbufs(const struct v4l2_ioctl_ops *ops,
 
        if (ret)
                return ret;
+
+       CLEAR_AFTER_FIELD(p, capabilities);
+
        return ops->vidioc_reqbufs(file, fh, p);
 }
 
@@ -2083,7 +2084,7 @@ static int v4l_create_bufs(const struct v4l2_ioctl_ops *ops,
        if (ret)
                return ret;
 
-       CLEAR_AFTER_FIELD(create, flags);
+       CLEAR_AFTER_FIELD(create, capabilities);
 
        v4l_sanitize_format(&create->format);
 
@@ -3189,14 +3190,16 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd)
 #ifdef CONFIG_COMPAT_32BIT_TIME
        case VIDIOC_DQEVENT_TIME32: {
                struct v4l2_event *ev = parg;
-               struct v4l2_event_time32 ev32 = {
-                       .type           = ev->type,
-                       .pending        = ev->pending,
-                       .sequence       = ev->sequence,
-                       .timestamp.tv_sec  = ev->timestamp.tv_sec,
-                       .timestamp.tv_nsec = ev->timestamp.tv_nsec,
-                       .id             = ev->id,
-               };
+               struct v4l2_event_time32 ev32;
+
+               memset(&ev32, 0, sizeof(ev32));
+
+               ev32.type       = ev->type;
+               ev32.pending    = ev->pending;
+               ev32.sequence   = ev->sequence;
+               ev32.timestamp.tv_sec   = ev->timestamp.tv_sec;
+               ev32.timestamp.tv_nsec  = ev->timestamp.tv_nsec;
+               ev32.id         = ev->id;
 
                memcpy(&ev32.u, &ev->u, sizeof(ev->u));
                memcpy(&ev32.reserved, &ev->reserved, sizeof(ev->reserved));
@@ -3210,21 +3213,23 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd)
        case VIDIOC_DQBUF_TIME32:
        case VIDIOC_PREPARE_BUF_TIME32: {
                struct v4l2_buffer *vb = parg;
-               struct v4l2_buffer_time32 vb32 = {
-                       .index          = vb->index,
-                       .type           = vb->type,
-                       .bytesused      = vb->bytesused,
-                       .flags          = vb->flags,
-                       .field          = vb->field,
-                       .timestamp.tv_sec       = vb->timestamp.tv_sec,
-                       .timestamp.tv_usec      = vb->timestamp.tv_usec,
-                       .timecode       = vb->timecode,
-                       .sequence       = vb->sequence,
-                       .memory         = vb->memory,
-                       .m.userptr      = vb->m.userptr,
-                       .length         = vb->length,
-                       .request_fd     = vb->request_fd,
-               };
+               struct v4l2_buffer_time32 vb32;
+
+               memset(&vb32, 0, sizeof(vb32));
+
+               vb32.index      = vb->index;
+               vb32.type       = vb->type;
+               vb32.bytesused  = vb->bytesused;
+               vb32.flags      = vb->flags;
+               vb32.field      = vb->field;
+               vb32.timestamp.tv_sec   = vb->timestamp.tv_sec;
+               vb32.timestamp.tv_usec  = vb->timestamp.tv_usec;
+               vb32.timecode   = vb->timecode;
+               vb32.sequence   = vb->sequence;
+               vb32.memory     = vb->memory;
+               vb32.m.userptr  = vb->m.userptr;
+               vb32.length     = vb->length;
+               vb32.request_fd = vb->request_fd;
 
                if (copy_to_user(arg, &vb32, sizeof(vb32)))
                        return -EFAULT;
index 5c91fc3e65b50453a7f1929342502d9a7c3b18ca..606a271bdd2dddfd7b825c018a3da3068bd75b1a 100644 (file)
@@ -354,7 +354,7 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
                break;
        case VIDEOBUF_ERROR:
                b->flags |= V4L2_BUF_FLAG_ERROR;
-               /* fall through */
+               fallthrough;
        case VIDEOBUF_DONE:
                b->flags |= V4L2_BUF_FLAG_DONE;
                break;
index f512cbc7a36c5e8047ba3041f99c3ffe02a53ff5..ca0097664b12506d8a4a59b1d7396731dd2b823e 100644 (file)
@@ -313,7 +313,6 @@ static unsigned long gpmc_get_clk_period(int cs, enum gpmc_clk_domain cd)
                tick_ps *= div;
                break;
        case GPMC_CD_FCLK:
-               /* FALL-THROUGH */
        default:
                break;
        }
index 693ee73eb2912c05abdbfbe4955757cc767c0731..ef03d6fafc5ce8a3d9a6b324264de0ae89a75832 100644 (file)
@@ -441,6 +441,9 @@ static void memstick_check(struct work_struct *work)
        } else if (host->card->stop)
                host->card->stop(host->card);
 
+       if (host->removing)
+               goto out_power_off;
+
        card = memstick_alloc_card(host);
 
        if (!card) {
@@ -545,6 +548,7 @@ EXPORT_SYMBOL(memstick_add_host);
  */
 void memstick_remove_host(struct memstick_host *host)
 {
+       host->removing = 1;
        flush_workqueue(workqueue);
        mutex_lock(&host->lock);
        if (host->card)
index d9ee8e3dc72daa80d517dd022a9cd098abf5aa68..178954228631d8e4b02cbb8409d0c9d70eb6d3c0 100644 (file)
@@ -371,7 +371,7 @@ again:
                        serial mode), then just fall through */
                if (msb_read_int_reg(msb, -1))
                        return 0;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_RP_RECEIVE_INT_REQ_RESULT:
                intreg = mrq->data[0];
@@ -403,7 +403,7 @@ again:
        case MSB_RP_RECEIVE_STATUS_REG:
                msb->regs.status = *(struct ms_status_register *)mrq->data;
                msb->state = MSB_RP_SEND_OOB_READ;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_RP_SEND_OOB_READ:
                if (!msb_read_regs(msb,
@@ -418,7 +418,7 @@ again:
                msb->regs.extra_data =
                        *(struct ms_extra_data_register *) mrq->data;
                msb->state = MSB_RP_SEND_READ_DATA;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_RP_SEND_READ_DATA:
                /* Skip that state if we only read the oob */
@@ -518,7 +518,7 @@ again:
                msb->state = MSB_WB_RECEIVE_INT_REQ;
                if (msb_read_int_reg(msb, -1))
                        return 0;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_WB_RECEIVE_INT_REQ:
                intreg = mrq->data[0];
@@ -549,7 +549,7 @@ again:
 
                msb->int_polling = false;
                msb->state = MSB_WB_SEND_WRITE_DATA;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_WB_SEND_WRITE_DATA:
                sg_init_table(sg, ARRAY_SIZE(sg));
@@ -628,7 +628,7 @@ again:
                msb->state = MSB_SC_RECEIVE_INT_REQ;
                if (msb_read_int_reg(msb, -1))
                        return 0;
-               /* fallthrough */
+               fallthrough;
 
        case MSB_SC_RECEIVE_INT_REQ:
                intreg = mrq->data[0];
index 4a6b866b0291cf91fa86f7f300b2d14633a7e655..e83c3ada9389ea460ac1fe339e6e9a9f28f89e0b 100644 (file)
@@ -255,11 +255,11 @@ static unsigned int jmb38x_ms_write_data(struct jmb38x_ms_host *host,
        case 3:
                host->io_word[0] |= buf[off + 2] << 16;
                host->io_pos++;
-               /* fall through */
+               fallthrough;
        case 2:
                host->io_word[0] |= buf[off + 1] << 8;
                host->io_pos++;
-               /* fall through */
+               fallthrough;
        case 1:
                host->io_word[0] |= buf[off];
                host->io_pos++;
index fc35c74044298a216ad3e56d960a0710b0d89f1e..786e46798da24e9ff0b75ba090eabaffaccad266 100644 (file)
@@ -162,11 +162,11 @@ static unsigned int tifm_ms_write_data(struct tifm_ms *host,
        case 3:
                host->io_word |= buf[off + 2] << 16;
                host->io_pos++;
-               /* fall through */
+               fallthrough;
        case 2:
                host->io_word |= buf[off + 1] << 8;
                host->io_pos++;
-               /* fall through */
+               fallthrough;
        case 1:
                host->io_word |= buf[off];
                host->io_pos++;
index 5216487db4fbeabcb32899b4104ec33dc01dd360..9903e9660a38dc3dc1bba417b1c1a4970a2ae7da 100644 (file)
@@ -642,7 +642,7 @@ mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
                        freereq = 0;
                if (event != MPI_EVENT_EVENT_CHANGE)
                        break;
-               /* fall through */
+               fallthrough;
        case MPI_FUNCTION_CONFIG:
        case MPI_FUNCTION_SAS_IO_UNIT_CONTROL:
                ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
@@ -1887,7 +1887,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
        case MPI_MANUFACTPAGE_DEVICEID_FC939X:
        case MPI_MANUFACTPAGE_DEVICEID_FC949X:
                ioc->errata_flag_1064 = 1;
-               /* fall through */
+               fallthrough;
        case MPI_MANUFACTPAGE_DEVICEID_FC909:
        case MPI_MANUFACTPAGE_DEVICEID_FC929:
        case MPI_MANUFACTPAGE_DEVICEID_FC919:
@@ -1932,7 +1932,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
                        pcixcmd &= 0x8F;
                        pci_write_config_byte(pdev, 0x6a, pcixcmd);
                }
-               /* fall through */
+               fallthrough;
 
        case MPI_MANUFACTPAGE_DEVID_1030_53C1035:
                ioc->bus_type = SPI;
index 6a79cd0ebe2b08bf6df0bc0680221c16c82c4f3d..18b91ea1a353f21c7ec85936cfc6faf51267af4e 100644 (file)
@@ -4326,7 +4326,7 @@ mptsas_hotplug_work(MPT_ADAPTER *ioc, struct fw_event_work *fw_event,
                        }
                }
                mpt_findImVolumes(ioc);
-               /* fall through */
+               fallthrough;
 
        case MPTSAS_ADD_DEVICE:
                memset(&sas_device, 0, sizeof(struct mptsas_devinfo));
index 1491561d2e5c9af2c30a41d7005bd2a25ec90bad..8543f0324d5a820a28991929e7c93bdcf14ba53a 100644 (file)
@@ -784,7 +784,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
                        /*
                         * Allow non-SAS & non-NEXUS_LOSS to drop into below code
                         */
-                       /* Fall through */
+                       fallthrough;
 
                case MPI_IOCSTATUS_SCSI_TASK_TERMINATED:        /* 0x0048 */
                        /* Linux handles an unsolicited DID_RESET better
@@ -881,7 +881,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 
                case MPI_IOCSTATUS_SCSI_DATA_OVERRUN:           /* 0x0044 */
                        scsi_set_resid(sc, 0);
-                       /* Fall through */
+                       fallthrough;
                case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR:        /* 0x0040 */
                case MPI_IOCSTATUS_SUCCESS:                     /* 0x0000 */
                        sc->result = (DID_OK << 16) | scsi_status;
index a9d9c1cdf546b65c551fd827697945dcb41b1006..a5983d515db030822401a4e9b4d79fc6c7086659 100644 (file)
@@ -1515,10 +1515,10 @@ static unsigned long dsiclk_rate(u8 n)
        switch (divsel) {
        case PRCM_DSI_PLLOUT_SEL_PHI_4:
                div *= 2;
-               /* Fall through */
+               fallthrough;
        case PRCM_DSI_PLLOUT_SEL_PHI_2:
                div *= 2;
-               /* Fall through */
+               fallthrough;
        case PRCM_DSI_PLLOUT_SEL_PHI:
                return pll_rate(PRCM_PLLDSI_FREQ, clock_rate(PRCMU_HDMICLK),
                        PLL_RAW) / div;
index af764bc87d7ceba5f7c8869ecc3d44a9591b2fa7..761b4ef3a3810db8ea21a00f8a7a333da1145400 100644 (file)
@@ -136,7 +136,7 @@ static int iqs62x_dev_init(struct iqs62x_core *iqs62x)
                if (val & IQS620_PROX_SETTINGS_4_SAR_EN)
                        iqs62x->ui_sel = IQS62X_UI_SAR1;
 
-               /* fall through */
+               fallthrough;
 
        case IQS621_PROD_NUM:
                ret = regmap_write(iqs62x->regmap, IQS620_GLBL_EVENT_MASK,
@@ -470,7 +470,7 @@ static irqreturn_t iqs62x_irq(int irq, void *context)
                case IQS62X_EVENT_UI_LO:
                        event_data.ui_data = get_unaligned_le16(&event_map[i]);
 
-                       /* fall through */
+                       fallthrough;
 
                case IQS62X_EVENT_UI_HI:
                case IQS62X_EVENT_NONE:
@@ -491,7 +491,7 @@ static irqreturn_t iqs62x_irq(int irq, void *context)
                case IQS62X_EVENT_HYST:
                        event_map[i] <<= iqs62x->dev_desc->hyst_shift;
 
-                       /* fall through */
+                       fallthrough;
 
                case IQS62X_EVENT_WHEEL:
                case IQS62X_EVENT_HALL:
index c3651f06684fa81b2912b7924eaa02b0f35fa824..fc00aaccb5f72979868991c6383ea4b78fa4ed47 100644 (file)
@@ -126,10 +126,6 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev,
        const __be32 *reg;
        u64 of_node_addr;
 
-       /* Skip devices 'disabled' by Device Tree */
-       if (!of_device_is_available(np))
-               return -ENODEV;
-
        /* Skip if OF node has previously been allocated to a device */
        list_for_each_entry(of_entry, &mfd_of_node_list, list)
                if (of_entry->np == np)
@@ -212,6 +208,12 @@ static int mfd_add_device(struct device *parent, int id,
        if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) {
                for_each_child_of_node(parent->of_node, np) {
                        if (of_device_is_compatible(np, cell->of_compatible)) {
+                               /* Ignore 'disabled' devices error free */
+                               if (!of_device_is_available(np)) {
+                                       ret = 0;
+                                       goto fail_alias;
+                               }
+
                                ret = mfd_match_of_node_to_dev(pdev, np, cell);
                                if (ret == -EAGAIN)
                                        continue;
@@ -370,8 +372,6 @@ static int mfd_remove_devices_fn(struct device *dev, void *data)
        regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies,
                                               cell->num_parent_supplies);
 
-       kfree(cell);
-
        platform_device_unregister(pdev);
        return 0;
 }
index 5bef142c483565cdb35da30f9ce388c20f2887cf..111d11fd25aad1f0b6178d9c932e4c550c993d35 100644 (file)
@@ -172,7 +172,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
                                        MXS_LRADC_TOUCHSCREEN_5WIRE;
                                break;
                        }
-                       /* fall through - to an error message for i.MX23 */
+                       fallthrough;    /* to an error message for i.MX23 */
                default:
                        dev_err(&pdev->dev,
                                "Unsupported number of touchscreen wires (%d)\n"
index 1e6431cb853602fc40dbcee8d589c5eca62c9010..2a3a240b4619a1e5abb628d126b361941ebf20f8 100644 (file)
@@ -308,7 +308,7 @@ static int usbhs_runtime_resume(struct device *dev)
                                         i, r);
                                }
                        }
-               /* Fall through - as HSIC mode needs utmi_clk */
+                       fallthrough;    /* as HSIC mode needs utmi_clk */
 
                case OMAP_EHCI_PORT_MODE_TLL:
                        if (!IS_ERR(omap->utmi_clk[i])) {
@@ -344,7 +344,7 @@ static int usbhs_runtime_suspend(struct device *dev)
 
                        if (!IS_ERR(omap->hsic480m_clk[i]))
                                clk_disable_unprepare(omap->hsic480m_clk[i]);
-               /* Fall through - as utmi_clks were used in HSIC mode */
+                       fallthrough;    /* as utmi_clks were used in HSIC mode */
 
                case OMAP_EHCI_PORT_MODE_TLL:
                        if (!IS_ERR(omap->utmi_clk[i]))
index abaab541df19dfaf8a17b9c1822075775c809e55..545196c85b5ca9d9f40743ae54737f6b21cd2be0 100644 (file)
@@ -270,7 +270,7 @@ static void *stuff(unsigned char *dest, const unsigned char *src, size_t n)
                case RAVE_SP_ETX:
                case RAVE_SP_DLE:
                        *dest++ = RAVE_SP_DLE;
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        *dest++ = byte;
                }
@@ -541,7 +541,7 @@ static int rave_sp_receive_buf(struct serdev_device *serdev,
                         * deframer buffer
                         */
 
-                       /* FALLTHROUGH */
+                       fallthrough;
 
                case RAVE_SP_EXPECT_ESCAPED_DATA:
                        if (deframer->length == sizeof(deframer->data)) {
index 75859e492984115fdfab54a9cc5e2024b530e583..df5cebb372a592fce06bd03412375452cecbd658 100644 (file)
@@ -95,7 +95,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
                        break;
                default:
                        pr_err("Failed to retrieve valid hwlock: %d\n", ret);
-                       /* fall-through */
+                       fallthrough;
                case -EPROBE_DEFER:
                        goto err_regmap;
                }
index 2591c21b2b5d84667a8e8a6a03bee4c109721ace..26a23abc053d2cc6ec761b6c37f74a4999ff9cdf 100644 (file)
@@ -692,10 +692,6 @@ static int at24_probe(struct i2c_client *client)
        nvmem_config.word_size = 1;
        nvmem_config.size = byte_len;
 
-       at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
-       if (IS_ERR(at24->nvmem))
-               return PTR_ERR(at24->nvmem);
-
        i2c_set_clientdata(client, at24);
 
        err = regulator_enable(at24->vcc_reg);
@@ -708,6 +704,13 @@ static int at24_probe(struct i2c_client *client)
        pm_runtime_set_active(dev);
        pm_runtime_enable(dev);
 
+       at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
+       if (IS_ERR(at24->nvmem)) {
+               pm_runtime_disable(dev);
+               regulator_disable(at24->vcc_reg);
+               return PTR_ERR(at24->nvmem);
+       }
+
        /*
         * Perform a one-byte test read to verify that the
         * chip is functional.
index cde9a2fc1325065b054bf89363f7b568e15145c9..ed8d38b0992511283b764d507e3afb4ef4cf3712 100644 (file)
@@ -90,10 +90,10 @@ static int at25_ee_read(void *priv, unsigned int offset,
        switch (at25->addrlen) {
        default:        /* case 3 */
                *cp++ = offset >> 16;
-               /* fall through */
+               fallthrough;
        case 2:
                *cp++ = offset >> 8;
-               /* fall through */
+               fallthrough;
        case 1:
        case 0: /* can't happen: for better codegen */
                *cp++ = offset >> 0;
@@ -178,10 +178,10 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)
                switch (at25->addrlen) {
                default:        /* case 3 */
                        *cp++ = offset >> 16;
-                       /* fall through */
+                       fallthrough;
                case 2:
                        *cp++ = offset >> 8;
-                       /* fall through */
+                       fallthrough;
                case 1:
                case 0: /* can't happen: for better codegen */
                        *cp++ = offset >> 0;
@@ -278,7 +278,7 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
                switch (val) {
                case 9:
                        chip->flags |= EE_INSTR_BIT3_IS_ADDR;
-                       /* fall through */
+                       fallthrough;
                case 8:
                        chip->flags |= EE_ADDR1;
                        break;
index 7c38c4f7f9c02b4501787f1a92b054d469a8a527..a8004911c9771ac522290d3523ed6eab195aa2ac 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include <linux/uaccess.h>
 #include <linux/genalloc.h>
 
 static void cb_fini(struct hl_device *hdev, struct hl_cb *cb)
@@ -300,7 +301,7 @@ int hl_cb_mmap(struct hl_fpriv *hpriv, struct vm_area_struct *vma)
        struct hl_device *hdev = hpriv->hdev;
        struct hl_cb *cb;
        phys_addr_t address;
-       u32 handle;
+       u32 handle, user_cb_size;
        int rc;
 
        handle = vma->vm_pgoff;
@@ -314,7 +315,8 @@ int hl_cb_mmap(struct hl_fpriv *hpriv, struct vm_area_struct *vma)
        }
 
        /* Validation check */
-       if ((vma->vm_end - vma->vm_start) != ALIGN(cb->size, PAGE_SIZE)) {
+       user_cb_size = vma->vm_end - vma->vm_start;
+       if (user_cb_size != ALIGN(cb->size, PAGE_SIZE)) {
                dev_err(hdev->dev,
                        "CB mmap failed, mmap size 0x%lx != 0x%x cb size\n",
                        vma->vm_end - vma->vm_start, cb->size);
@@ -322,6 +324,16 @@ int hl_cb_mmap(struct hl_fpriv *hpriv, struct vm_area_struct *vma)
                goto put_cb;
        }
 
+       if (!access_ok((void __user *) (uintptr_t) vma->vm_start,
+                                                       user_cb_size)) {
+               dev_err(hdev->dev,
+                       "user pointer is invalid - 0x%lx\n",
+                       vma->vm_start);
+
+               rc = -EINVAL;
+               goto put_cb;
+       }
+
        spin_lock(&cb->lock);
 
        if (cb->mmap) {
index b9840e368eb576389cfb2747616cbce1a738ae19..2e3fcbc794db4af2b7ec3245f4ab76f0f6b6f54d 100644 (file)
@@ -808,6 +808,14 @@ static int cs_ioctl_signal_wait(struct hl_fpriv *hpriv, enum hl_cs_type cs_type,
 
        /* currently it is guaranteed to have only one chunk */
        chunk = &cs_chunk_array[0];
+
+       if (chunk->queue_index >= hdev->asic_prop.max_queues) {
+               dev_err(hdev->dev, "Queue index %d is invalid\n",
+                       chunk->queue_index);
+               rc = -EINVAL;
+               goto free_cs_chunk_array;
+       }
+
        q_idx = chunk->queue_index;
        hw_queue_prop = &hdev->asic_prop.hw_queues_props[q_idx];
        q_type = hw_queue_prop->type;
index c50c6fc9e905bc38e77ff22da26c6085aaa24957..aa77771635d33fca449c13e8bc7cde97315a3130 100644 (file)
@@ -19,7 +19,7 @@
 static struct dentry *hl_debug_root;
 
 static int hl_debugfs_i2c_read(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr,
-                               u8 i2c_reg, u32 *val)
+                               u8 i2c_reg, long *val)
 {
        struct armcp_packet pkt;
        int rc;
@@ -36,7 +36,7 @@ static int hl_debugfs_i2c_read(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr,
        pkt.i2c_reg = i2c_reg;
 
        rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
-                                               0, (long *) val);
+                                               0, val);
 
        if (rc)
                dev_err(hdev->dev, "Failed to read from I2C, error %d\n", rc);
@@ -827,7 +827,7 @@ static ssize_t hl_i2c_data_read(struct file *f, char __user *buf,
        struct hl_dbg_device_entry *entry = file_inode(f)->i_private;
        struct hl_device *hdev = entry->hdev;
        char tmp_buf[32];
-       u32 val;
+       long val;
        ssize_t rc;
 
        if (*ppos)
@@ -842,7 +842,7 @@ static ssize_t hl_i2c_data_read(struct file *f, char __user *buf,
                return rc;
        }
 
-       sprintf(tmp_buf, "0x%02x\n", val);
+       sprintf(tmp_buf, "0x%02lx\n", val);
        rc = simple_read_from_buffer(buf, count, ppos, tmp_buf,
                        strlen(tmp_buf));
 
@@ -982,7 +982,7 @@ static ssize_t hl_clk_gate_read(struct file *f, char __user *buf,
                return 0;
 
        sprintf(tmp_buf, "0x%llx\n", hdev->clock_gating_mask);
-       rc = simple_read_from_buffer(buf, strlen(tmp_buf) + 1, ppos, tmp_buf,
+       rc = simple_read_from_buffer(buf, count, ppos, tmp_buf,
                        strlen(tmp_buf) + 1);
 
        return rc;
index be16b75bdfdb5bbd0ebb54b550a2a4fcfe36e76e..24b01cce0a3846511f1af5406443296559d8f3f1 100644 (file)
@@ -288,7 +288,7 @@ static int device_early_init(struct hl_device *hdev)
        for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
                snprintf(workq_name, 32, "hl-free-jobs-%u", i);
                hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
-               if (hdev->cq_wq == NULL) {
+               if (hdev->cq_wq[i] == NULL) {
                        dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
                        rc = -ENOMEM;
                        goto free_cq_wq;
@@ -1069,7 +1069,7 @@ again:
                        goto out_err;
                }
 
-               hl_set_max_power(hdev, hdev->max_power);
+               hl_set_max_power(hdev);
        } else {
                rc = hdev->asic_funcs->soft_reset_late_init(hdev);
                if (rc) {
@@ -1318,6 +1318,11 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
                goto out_disabled;
        }
 
+       /* Need to call this again because the max power might change,
+        * depending on card type for certain ASICs
+        */
+       hl_set_max_power(hdev);
+
        /*
         * hl_hwmon_init() must be called after device_late_init(), because only
         * there we get the information from the device about which
index f70302cdab1bde7fa39eba3ad6643e9b8dcc6783..f52bc690dfc5c68601950f878dee136d12ff006b 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/slab.h>
 
+#define FW_FILE_MAX_SIZE       0x1400000 /* maximum size of 20MB */
 /**
  * hl_fw_load_fw_to_device() - Load F/W code to device's memory.
  *
@@ -48,6 +49,14 @@ int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name,
 
        dev_dbg(hdev->dev, "%s firmware size == %zu\n", fw_name, fw_size);
 
+       if (fw_size > FW_FILE_MAX_SIZE) {
+               dev_err(hdev->dev,
+                       "FW file size %zu exceeds maximum of %u bytes\n",
+                       fw_size, FW_FILE_MAX_SIZE);
+               rc = -EINVAL;
+               goto out;
+       }
+
        fw_data = (const u64 *) fw->data;
 
        memcpy_toio(dst, fw_data, fw_size);
index 018d9d67e8e6ac2167107c1e2126411ea3caefad..edbd627b29d25749e6024223afbb1874c6ee69f6 100644 (file)
@@ -1462,6 +1462,8 @@ struct hl_device_idle_busy_ts {
  *                     details.
  * @in_reset: is device in reset flow.
  * @curr_pll_profile: current PLL profile.
+ * @card_type: Various ASICs have several card types. This indicates the card
+ *             type of the current device.
  * @cs_active_cnt: number of active command submissions on this device (active
  *                 means already in H/W queues)
  * @major: habanalabs kernel driver major.
@@ -1566,6 +1568,7 @@ struct hl_device {
        u64                             clock_gating_mask;
        atomic_t                        in_reset;
        enum hl_pll_frequency           curr_pll_profile;
+       enum armcp_card_types           card_type;
        int                             cs_active_cnt;
        u32                             major;
        u32                             high_pll;
@@ -1651,7 +1654,7 @@ struct hl_ioctl_desc {
  *
  * Return: true if the area is inside the valid range, false otherwise.
  */
-static inline bool hl_mem_area_inside_range(u64 address, u32 size,
+static inline bool hl_mem_area_inside_range(u64 address, u64 size,
                                u64 range_start_address, u64 range_end_address)
 {
        u64 end_address = address + size;
@@ -1858,7 +1861,7 @@ int hl_get_pwm_info(struct hl_device *hdev,
 void hl_set_pwm_info(struct hl_device *hdev, int sensor_index, u32 attr,
                        long value);
 u64 hl_get_max_power(struct hl_device *hdev);
-void hl_set_max_power(struct hl_device *hdev, u64 value);
+void hl_set_max_power(struct hl_device *hdev);
 int hl_set_voltage(struct hl_device *hdev,
                        int sensor_index, u32 attr, long value);
 int hl_set_current(struct hl_device *hdev,
index dce9273e557a07aca8a852dff72487c4fa75369d..5ff4688683fd3714e73de42ace61ae7e17f648bf 100644 (file)
@@ -66,6 +66,11 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
        num_pgs = (args->alloc.mem_size + (page_size - 1)) >> page_shift;
        total_size = num_pgs << page_shift;
 
+       if (!total_size) {
+               dev_err(hdev->dev, "Cannot allocate 0 bytes\n");
+               return -EINVAL;
+       }
+
        contiguous = args->flags & HL_MEM_CONTIGUOUS;
 
        if (contiguous) {
@@ -93,7 +98,7 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
        phys_pg_pack->contiguous = contiguous;
 
        phys_pg_pack->pages = kvmalloc_array(num_pgs, sizeof(u64), GFP_KERNEL);
-       if (!phys_pg_pack->pages) {
+       if (ZERO_OR_NULL_PTR(phys_pg_pack->pages)) {
                rc = -ENOMEM;
                goto pages_arr_err;
        }
@@ -683,7 +688,7 @@ static int init_phys_pg_pack_from_userptr(struct hl_ctx *ctx,
 
        phys_pg_pack->pages = kvmalloc_array(total_npages, sizeof(u64),
                                                GFP_KERNEL);
-       if (!phys_pg_pack->pages) {
+       if (ZERO_OR_NULL_PTR(phys_pg_pack->pages)) {
                rc = -ENOMEM;
                goto page_pack_arr_mem_err;
        }
index edcc11d5eaf15a7989501378fa16e771d7d46322..3fc0f497fab349ca6a90256bcc2fcb7dd292b9a0 100644 (file)
@@ -450,7 +450,7 @@ int hl_mmu_init(struct hl_device *hdev)
        hdev->mmu_shadow_hop0 = kvmalloc_array(prop->max_asid,
                                        prop->mmu_hop_table_size,
                                        GFP_KERNEL | __GFP_ZERO);
-       if (!hdev->mmu_shadow_hop0) {
+       if (ZERO_OR_NULL_PTR(hdev->mmu_shadow_hop0)) {
                rc = -ENOMEM;
                goto err_pool_add;
        }
index 7bd3737571f38acabc08581b0246e016e818d970..2770f03b6cbb203b9be410765f70b20e2dd7523a 100644 (file)
@@ -227,7 +227,7 @@ int hl_pci_set_inbound_region(struct hl_device *hdev, u8 region,
        }
 
        /* Point to the specified address */
-       rc = hl_pci_iatu_write(hdev, offset + 0x14,
+       rc |= hl_pci_iatu_write(hdev, offset + 0x14,
                        lower_32_bits(pci_region->addr));
        rc |= hl_pci_iatu_write(hdev, offset + 0x18,
                        upper_32_bits(pci_region->addr));
@@ -369,15 +369,17 @@ int hl_pci_init(struct hl_device *hdev)
        rc = hdev->asic_funcs->init_iatu(hdev);
        if (rc) {
                dev_err(hdev->dev, "Failed to initialize iATU\n");
-               goto disable_device;
+               goto unmap_pci_bars;
        }
 
        rc = hl_pci_set_dma_mask(hdev);
        if (rc)
-               goto disable_device;
+               goto unmap_pci_bars;
 
        return 0;
 
+unmap_pci_bars:
+       hl_pci_bars_unmap(hdev);
 disable_device:
        pci_clear_master(pdev);
        pci_disable_device(pdev);
index b3cb0ac4721c5bb3d74b7d24d9371e97de8df03c..5ae484cc84cd4fa1087d349ffdd99af00c2cd1f0 100644 (file)
@@ -81,7 +81,7 @@ u64 hl_get_max_power(struct hl_device *hdev)
        return result;
 }
 
-void hl_set_max_power(struct hl_device *hdev, u64 value)
+void hl_set_max_power(struct hl_device *hdev)
 {
        struct armcp_packet pkt;
        int rc;
@@ -90,7 +90,7 @@ void hl_set_max_power(struct hl_device *hdev, u64 value)
 
        pkt.ctl = cpu_to_le32(ARMCP_PACKET_MAX_POWER_SET <<
                                ARMCP_PKT_CTL_OPCODE_SHIFT);
-       pkt.value = cpu_to_le64(value);
+       pkt.value = cpu_to_le64(hdev->max_power);
 
        rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
                                                0, NULL);
@@ -316,7 +316,7 @@ static ssize_t max_power_store(struct device *dev,
        }
 
        hdev->max_power = value;
-       hl_set_max_power(hdev, value);
+       hl_set_max_power(hdev);
 
 out:
        return count;
@@ -422,6 +422,7 @@ int hl_sysfs_init(struct hl_device *hdev)
                hdev->pm_mng_profile = PM_AUTO;
        else
                hdev->pm_mng_profile = PM_MANUAL;
+
        hdev->max_power = hdev->asic_prop.max_power_default;
 
        hdev->asic_funcs->add_device_attr(hdev, &hl_dev_clks_attr_group);
index 00a0a7238d81496f2a886eb77c1e02af9187f24e..4009b7df4cafec33ae1dc8bdb7090e18def1224a 100644 (file)
@@ -154,6 +154,29 @@ static const u16 gaudi_packet_sizes[MAX_PACKET_ID] = {
        [PACKET_LOAD_AND_EXE]   = sizeof(struct packet_load_and_exe)
 };
 
+static inline bool validate_packet_id(enum packet_id id)
+{
+       switch (id) {
+       case PACKET_WREG_32:
+       case PACKET_WREG_BULK:
+       case PACKET_MSG_LONG:
+       case PACKET_MSG_SHORT:
+       case PACKET_CP_DMA:
+       case PACKET_REPEAT:
+       case PACKET_MSG_PROT:
+       case PACKET_FENCE:
+       case PACKET_LIN_DMA:
+       case PACKET_NOP:
+       case PACKET_STOP:
+       case PACKET_ARB_POINT:
+       case PACKET_WAIT:
+       case PACKET_LOAD_AND_EXE:
+               return true;
+       default:
+               return false;
+       }
+}
+
 static const char * const
 gaudi_tpc_interrupts_cause[GAUDI_NUM_OF_TPC_INTR_CAUSE] = {
        "tpc_address_exceed_slm",
@@ -433,7 +456,7 @@ static int gaudi_get_fixed_properties(struct hl_device *hdev)
        prop->num_of_events = GAUDI_EVENT_SIZE;
        prop->tpc_enabled_mask = TPC_ENABLED_MASK;
 
-       prop->max_power_default = MAX_POWER_DEFAULT;
+       prop->max_power_default = MAX_POWER_DEFAULT_PCI;
 
        prop->cb_pool_cb_cnt = GAUDI_CB_POOL_CB_CNT;
        prop->cb_pool_cb_size = GAUDI_CB_POOL_CB_SIZE;
@@ -2485,6 +2508,7 @@ static void gaudi_set_clock_gating(struct hl_device *hdev)
 {
        struct gaudi_device *gaudi = hdev->asic_specific;
        u32 qman_offset;
+       bool enable;
        int i;
 
        /* In case we are during debug session, don't enable the clock gate
@@ -2494,46 +2518,43 @@ static void gaudi_set_clock_gating(struct hl_device *hdev)
                return;
 
        for (i = GAUDI_PCI_DMA_1, qman_offset = 0 ; i < GAUDI_HBM_DMA_1 ; i++) {
-               if (!(hdev->clock_gating_mask &
-                                       (BIT_ULL(gaudi_dma_assignment[i]))))
-                       continue;
+               enable = !!(hdev->clock_gating_mask &
+                               (BIT_ULL(gaudi_dma_assignment[i])));
 
                qman_offset = gaudi_dma_assignment[i] * DMA_QMAN_OFFSET;
-               WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset, QMAN_CGM1_PWR_GATE_EN);
+               WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset,
+                               enable ? QMAN_CGM1_PWR_GATE_EN : 0);
                WREG32(mmDMA0_QM_CGM_CFG + qman_offset,
-                               QMAN_UPPER_CP_CGM_PWR_GATE_EN);
+                               enable ? QMAN_UPPER_CP_CGM_PWR_GATE_EN : 0);
        }
 
        for (i = GAUDI_HBM_DMA_1 ; i < GAUDI_DMA_MAX ; i++) {
-               if (!(hdev->clock_gating_mask &
-                                       (BIT_ULL(gaudi_dma_assignment[i]))))
-                       continue;
+               enable = !!(hdev->clock_gating_mask &
+                               (BIT_ULL(gaudi_dma_assignment[i])));
 
                qman_offset = gaudi_dma_assignment[i] * DMA_QMAN_OFFSET;
-               WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset, QMAN_CGM1_PWR_GATE_EN);
+               WREG32(mmDMA0_QM_CGM_CFG1 + qman_offset,
+                               enable ? QMAN_CGM1_PWR_GATE_EN : 0);
                WREG32(mmDMA0_QM_CGM_CFG + qman_offset,
-                               QMAN_COMMON_CP_CGM_PWR_GATE_EN);
+                               enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
        }
 
-       if (hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_0))) {
-               WREG32(mmMME0_QM_CGM_CFG1, QMAN_CGM1_PWR_GATE_EN);
-               WREG32(mmMME0_QM_CGM_CFG, QMAN_COMMON_CP_CGM_PWR_GATE_EN);
-       }
+       enable = !!(hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_0)));
+       WREG32(mmMME0_QM_CGM_CFG1, enable ? QMAN_CGM1_PWR_GATE_EN : 0);
+       WREG32(mmMME0_QM_CGM_CFG, enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
 
-       if (hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_2))) {
-               WREG32(mmMME2_QM_CGM_CFG1, QMAN_CGM1_PWR_GATE_EN);
-               WREG32(mmMME2_QM_CGM_CFG, QMAN_COMMON_CP_CGM_PWR_GATE_EN);
-       }
+       enable = !!(hdev->clock_gating_mask & (BIT_ULL(GAUDI_ENGINE_ID_MME_2)));
+       WREG32(mmMME2_QM_CGM_CFG1, enable ? QMAN_CGM1_PWR_GATE_EN : 0);
+       WREG32(mmMME2_QM_CGM_CFG, enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
 
        for (i = 0, qman_offset = 0 ; i < TPC_NUMBER_OF_ENGINES ; i++) {
-               if (!(hdev->clock_gating_mask &
-                                       (BIT_ULL(GAUDI_ENGINE_ID_TPC_0 + i))))
-                       continue;
+               enable = !!(hdev->clock_gating_mask &
+                               (BIT_ULL(GAUDI_ENGINE_ID_TPC_0 + i)));
 
                WREG32(mmTPC0_QM_CGM_CFG1 + qman_offset,
-                               QMAN_CGM1_PWR_GATE_EN);
+                               enable ? QMAN_CGM1_PWR_GATE_EN : 0);
                WREG32(mmTPC0_QM_CGM_CFG + qman_offset,
-                               QMAN_COMMON_CP_CGM_PWR_GATE_EN);
+                               enable ? QMAN_COMMON_CP_CGM_PWR_GATE_EN : 0);
 
                qman_offset += TPC_QMAN_OFFSET;
        }
@@ -3772,6 +3793,12 @@ static int gaudi_validate_cb(struct hl_device *hdev,
                                PACKET_HEADER_PACKET_ID_MASK) >>
                                        PACKET_HEADER_PACKET_ID_SHIFT);
 
+               if (!validate_packet_id(pkt_id)) {
+                       dev_err(hdev->dev, "Invalid packet id %u\n", pkt_id);
+                       rc = -EINVAL;
+                       break;
+               }
+
                pkt_size = gaudi_packet_sizes[pkt_id];
                cb_parsed_length += pkt_size;
                if (cb_parsed_length > parser->user_cb_size) {
@@ -3995,6 +4022,12 @@ static int gaudi_patch_cb(struct hl_device *hdev,
                                PACKET_HEADER_PACKET_ID_MASK) >>
                                        PACKET_HEADER_PACKET_ID_SHIFT);
 
+               if (!validate_packet_id(pkt_id)) {
+                       dev_err(hdev->dev, "Invalid packet id %u\n", pkt_id);
+                       rc = -EINVAL;
+                       break;
+               }
+
                pkt_size = gaudi_packet_sizes[pkt_id];
                cb_parsed_length += pkt_size;
                if (cb_parsed_length > parser->user_cb_size) {
@@ -5215,7 +5248,7 @@ static int gaudi_extract_ecc_info(struct hl_device *hdev,
        *memory_wrapper_idx = 0xFF;
 
        /* Iterate through memory wrappers, a single bit must be set */
-       for (i = 0 ; i > num_mem_regs ; i++) {
+       for (i = 0 ; i < num_mem_regs ; i++) {
                err_addr += i * 4;
                err_word = RREG32(err_addr);
                if (err_word) {
@@ -6022,6 +6055,15 @@ static int gaudi_armcp_info_get(struct hl_device *hdev)
                strncpy(prop->armcp_info.card_name, GAUDI_DEFAULT_CARD_NAME,
                                CARD_NAME_MAX_LEN);
 
+       hdev->card_type = le32_to_cpu(hdev->asic_prop.armcp_info.card_type);
+
+       if (hdev->card_type == armcp_card_type_pci)
+               prop->max_power_default = MAX_POWER_DEFAULT_PCI;
+       else if (hdev->card_type == armcp_card_type_pmc)
+               prop->max_power_default = MAX_POWER_DEFAULT_PMC;
+
+       hdev->max_power = prop->max_power_default;
+
        return 0;
 }
 
index 5dc99f6f02963495252676d51c55d0af90f7cc43..82137c3f3e2e6415343dc2aa8ccc7f17d7e404df 100644 (file)
@@ -41,7 +41,8 @@
 
 #define GAUDI_MAX_CLK_FREQ             2200000000ull   /* 2200 MHz */
 
-#define MAX_POWER_DEFAULT              200000          /* 200W */
+#define MAX_POWER_DEFAULT_PCI          200000          /* 200W */
+#define MAX_POWER_DEFAULT_PMC          350000          /* 350W */
 
 #define GAUDI_CPU_TIMEOUT_USEC         15000000        /* 15s */
 
index 5673ee49819e6b2cd6ceee9c5dcef28716345cd7..881531d4d9da8540ecf32f4cca6f92f742c78a72 100644 (file)
@@ -527,7 +527,7 @@ static int gaudi_config_etf(struct hl_device *hdev,
 }
 
 static bool gaudi_etr_validate_address(struct hl_device *hdev, u64 addr,
-                                       u32 size, bool *is_host)
+                                       u64 size, bool *is_host)
 {
        struct asic_fixed_properties *prop = &hdev->asic_prop;
        struct gaudi_device *gaudi = hdev->asic_specific;
@@ -539,6 +539,12 @@ static bool gaudi_etr_validate_address(struct hl_device *hdev, u64 addr,
                return false;
        }
 
+       if (addr > (addr + size)) {
+               dev_err(hdev->dev,
+                       "ETR buffer size %llu overflow\n", size);
+               return false;
+       }
+
        /* PMMU and HPMMU addresses are equal, check only one of them */
        if ((gaudi->hw_cap_initialized & HW_CAP_MMU) &&
                hl_mem_area_inside_range(addr, size,
index 85030759b2afed75f71a48109760fa128f175f09..33cd2ae653d23441e1686d48d8df2aa05b1c80e7 100644 (file)
@@ -139,6 +139,25 @@ static u16 goya_packet_sizes[MAX_PACKET_ID] = {
        [PACKET_STOP]           = sizeof(struct packet_stop)
 };
 
+static inline bool validate_packet_id(enum packet_id id)
+{
+       switch (id) {
+       case PACKET_WREG_32:
+       case PACKET_WREG_BULK:
+       case PACKET_MSG_LONG:
+       case PACKET_MSG_SHORT:
+       case PACKET_CP_DMA:
+       case PACKET_MSG_PROT:
+       case PACKET_FENCE:
+       case PACKET_LIN_DMA:
+       case PACKET_NOP:
+       case PACKET_STOP:
+               return true;
+       default:
+               return false;
+       }
+}
+
 static u64 goya_mmu_regs[GOYA_MMU_REGS_NUM] = {
        mmDMA_QM_0_GLBL_NON_SECURE_PROPS,
        mmDMA_QM_1_GLBL_NON_SECURE_PROPS,
@@ -3455,6 +3474,12 @@ static int goya_validate_cb(struct hl_device *hdev,
                                PACKET_HEADER_PACKET_ID_MASK) >>
                                        PACKET_HEADER_PACKET_ID_SHIFT);
 
+               if (!validate_packet_id(pkt_id)) {
+                       dev_err(hdev->dev, "Invalid packet id %u\n", pkt_id);
+                       rc = -EINVAL;
+                       break;
+               }
+
                pkt_size = goya_packet_sizes[pkt_id];
                cb_parsed_length += pkt_size;
                if (cb_parsed_length > parser->user_cb_size) {
@@ -3690,6 +3715,12 @@ static int goya_patch_cb(struct hl_device *hdev,
                                PACKET_HEADER_PACKET_ID_MASK) >>
                                        PACKET_HEADER_PACKET_ID_SHIFT);
 
+               if (!validate_packet_id(pkt_id)) {
+                       dev_err(hdev->dev, "Invalid packet id %u\n", pkt_id);
+                       rc = -EINVAL;
+                       break;
+               }
+
                pkt_size = goya_packet_sizes[pkt_id];
                cb_parsed_length += pkt_size;
                if (cb_parsed_length > parser->user_cb_size) {
index b03912483de0045ef0cb3b7b3bbf794dd82e7428..4027a6a334d7a61bb5df9e7a64912df6a4b60913 100644 (file)
@@ -362,11 +362,17 @@ static int goya_config_etf(struct hl_device *hdev,
 }
 
 static int goya_etr_validate_address(struct hl_device *hdev, u64 addr,
-               u32 size)
+               u64 size)
 {
        struct asic_fixed_properties *prop = &hdev->asic_prop;
        u64 range_start, range_end;
 
+       if (addr > (addr + size)) {
+               dev_err(hdev->dev,
+                       "ETR buffer size %llu overflow\n", size);
+               return false;
+       }
+
        if (hdev->mmu_enable) {
                range_start = prop->dmmu.start_addr;
                range_end = prop->dmmu.end_addr;
index 13ef6b2887fd4246170c854c6562314eed633106..3510c42d24e3133624916e790d23ac5601bf628a 100644 (file)
@@ -378,15 +378,15 @@ enum axi_id {
        ((((y) & RAZWI_INITIATOR_Y_MASK) << RAZWI_INITIATOR_Y_SHIFT) | \
                (((x) & RAZWI_INITIATOR_X_MASK) << RAZWI_INITIATOR_X_SHIFT))
 
-#define RAZWI_INITIATOR_ID_X_Y_TPC0_NIC0       RAZWI_INITIATOR_ID_X_Y(1, 0)
-#define RAZWI_INITIATOR_ID_X_Y_TPC1            RAZWI_INITIATOR_ID_X_Y(2, 0)
-#define RAZWI_INITIATOR_ID_X_Y_MME0_0          RAZWI_INITIATOR_ID_X_Y(3, 0)
-#define RAZWI_INITIATOR_ID_X_Y_MME0_1          RAZWI_INITIATOR_ID_X_Y(4, 0)
-#define RAZWI_INITIATOR_ID_X_Y_MME1_0          RAZWI_INITIATOR_ID_X_Y(5, 0)
-#define RAZWI_INITIATOR_ID_X_Y_MME1_1          RAZWI_INITIATOR_ID_X_Y(6, 0)
-#define RAZWI_INITIATOR_ID_X_Y_TPC2            RAZWI_INITIATOR_ID_X_Y(7, 0)
+#define RAZWI_INITIATOR_ID_X_Y_TPC0_NIC0       RAZWI_INITIATOR_ID_X_Y(1, 1)
+#define RAZWI_INITIATOR_ID_X_Y_TPC1            RAZWI_INITIATOR_ID_X_Y(2, 1)
+#define RAZWI_INITIATOR_ID_X_Y_MME0_0          RAZWI_INITIATOR_ID_X_Y(3, 1)
+#define RAZWI_INITIATOR_ID_X_Y_MME0_1          RAZWI_INITIATOR_ID_X_Y(4, 1)
+#define RAZWI_INITIATOR_ID_X_Y_MME1_0          RAZWI_INITIATOR_ID_X_Y(5, 1)
+#define RAZWI_INITIATOR_ID_X_Y_MME1_1          RAZWI_INITIATOR_ID_X_Y(6, 1)
+#define RAZWI_INITIATOR_ID_X_Y_TPC2            RAZWI_INITIATOR_ID_X_Y(7, 1)
 #define RAZWI_INITIATOR_ID_X_Y_TPC3_PCI_CPU_PSOC \
-                                               RAZWI_INITIATOR_ID_X_Y(8, 0)
+                                               RAZWI_INITIATOR_ID_X_Y(8, 1)
 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_0    RAZWI_INITIATOR_ID_X_Y(0, 1)
 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_S_0    RAZWI_INITIATOR_ID_X_Y(9, 1)
 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_1    RAZWI_INITIATOR_ID_X_Y(0, 2)
@@ -395,14 +395,14 @@ enum axi_id {
 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_0    RAZWI_INITIATOR_ID_X_Y(9, 3)
 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_N_1    RAZWI_INITIATOR_ID_X_Y(0, 4)
 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_1    RAZWI_INITIATOR_ID_X_Y(9, 4)
-#define RAZWI_INITIATOR_ID_X_Y_TPC4_NIC1_NIC2  RAZWI_INITIATOR_ID_X_Y(1, 5)
-#define RAZWI_INITIATOR_ID_X_Y_TPC5            RAZWI_INITIATOR_ID_X_Y(2, 5)
-#define RAZWI_INITIATOR_ID_X_Y_MME2_0          RAZWI_INITIATOR_ID_X_Y(3, 5)
-#define RAZWI_INITIATOR_ID_X_Y_MME2_1          RAZWI_INITIATOR_ID_X_Y(4, 5)
-#define RAZWI_INITIATOR_ID_X_Y_MME3_0          RAZWI_INITIATOR_ID_X_Y(5, 5)
-#define RAZWI_INITIATOR_ID_X_Y_MME3_1          RAZWI_INITIATOR_ID_X_Y(6, 5)
-#define RAZWI_INITIATOR_ID_X_Y_TPC6            RAZWI_INITIATOR_ID_X_Y(7, 5)
-#define RAZWI_INITIATOR_ID_X_Y_TPC7_NIC4_NIC5  RAZWI_INITIATOR_ID_X_Y(8, 5)
+#define RAZWI_INITIATOR_ID_X_Y_TPC4_NIC1_NIC2  RAZWI_INITIATOR_ID_X_Y(1, 6)
+#define RAZWI_INITIATOR_ID_X_Y_TPC5            RAZWI_INITIATOR_ID_X_Y(2, 6)
+#define RAZWI_INITIATOR_ID_X_Y_MME2_0          RAZWI_INITIATOR_ID_X_Y(3, 6)
+#define RAZWI_INITIATOR_ID_X_Y_MME2_1          RAZWI_INITIATOR_ID_X_Y(4, 6)
+#define RAZWI_INITIATOR_ID_X_Y_MME3_0          RAZWI_INITIATOR_ID_X_Y(5, 6)
+#define RAZWI_INITIATOR_ID_X_Y_MME3_1          RAZWI_INITIATOR_ID_X_Y(6, 6)
+#define RAZWI_INITIATOR_ID_X_Y_TPC6            RAZWI_INITIATOR_ID_X_Y(7, 6)
+#define RAZWI_INITIATOR_ID_X_Y_TPC7_NIC4_NIC5  RAZWI_INITIATOR_ID_X_Y(8, 6)
 
 #define PSOC_ETR_AXICTL_PROTCTRLBIT1_SHIFT                           1
 
index d1d3e025ca0e8799e44242831233e5dc23a9c3a1..9ae9669e46eae92d12906d86bcf2ef80c75488aa 100644 (file)
@@ -546,38 +546,46 @@ static int mei_hdcp_verify_mprime(struct device *dev,
                                  struct hdcp_port_data *data,
                                  struct hdcp2_rep_stream_ready *stream_ready)
 {
-       struct wired_cmd_repeater_auth_stream_req_in
-                                       verify_mprime_in = { { 0 } };
+       struct wired_cmd_repeater_auth_stream_req_in *verify_mprime_in;
        struct wired_cmd_repeater_auth_stream_req_out
                                        verify_mprime_out = { { 0 } };
        struct mei_cl_device *cldev;
        ssize_t byte;
+       size_t cmd_size;
 
        if (!dev || !stream_ready || !data)
                return -EINVAL;
 
        cldev = to_mei_cl_device(dev);
 
-       verify_mprime_in.header.api_version = HDCP_API_VERSION;
-       verify_mprime_in.header.command_id = WIRED_REPEATER_AUTH_STREAM_REQ;
-       verify_mprime_in.header.status = ME_HDCP_STATUS_SUCCESS;
-       verify_mprime_in.header.buffer_len =
+       cmd_size = struct_size(verify_mprime_in, streams, data->k);
+       if (cmd_size == SIZE_MAX)
+               return -EINVAL;
+
+       verify_mprime_in = kzalloc(cmd_size, GFP_KERNEL);
+       if (!verify_mprime_in)
+               return -ENOMEM;
+
+       verify_mprime_in->header.api_version = HDCP_API_VERSION;
+       verify_mprime_in->header.command_id = WIRED_REPEATER_AUTH_STREAM_REQ;
+       verify_mprime_in->header.status = ME_HDCP_STATUS_SUCCESS;
+       verify_mprime_in->header.buffer_len =
                        WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN;
 
-       verify_mprime_in.port.integrated_port_type = data->port_type;
-       verify_mprime_in.port.physical_port = (u8)data->fw_ddi;
-       verify_mprime_in.port.attached_transcoder = (u8)data->fw_tc;
+       verify_mprime_in->port.integrated_port_type = data->port_type;
+       verify_mprime_in->port.physical_port = (u8)data->fw_ddi;
+       verify_mprime_in->port.attached_transcoder = (u8)data->fw_tc;
+
+       memcpy(verify_mprime_in->m_prime, stream_ready->m_prime, HDCP_2_2_MPRIME_LEN);
+       drm_hdcp_cpu_to_be24(verify_mprime_in->seq_num_m, data->seq_num_m);
 
-       memcpy(verify_mprime_in.m_prime, stream_ready->m_prime,
-              HDCP_2_2_MPRIME_LEN);
-       drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
-       memcpy(verify_mprime_in.streams, data->streams,
+       memcpy(verify_mprime_in->streams, data->streams,
               array_size(data->k, sizeof(*data->streams)));
 
-       verify_mprime_in.k = cpu_to_be16(data->k);
+       verify_mprime_in->k = cpu_to_be16(data->k);
 
-       byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
-                             sizeof(verify_mprime_in));
+       byte = mei_cldev_send(cldev, (u8 *)verify_mprime_in, cmd_size);
+       kfree(verify_mprime_in);
        if (byte < 0) {
                dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
                return byte;
index 9cc6b2a6cf229cd34fa4661716f164cda69f7188..304d6c833712ae214006ce161f5bbc4f3021536f 100644 (file)
@@ -178,7 +178,7 @@ int scif_close(scif_epd_t epd)
        case SCIFEP_ZOMBIE:
                dev_err(scif_info.mdev.this_device,
                        "SCIFAPI close: zombie state unexpected\n");
-               /* fall through */
+               fallthrough;
        case SCIFEP_DISCONNECTED:
                spin_unlock(&ep->lock);
                scif_unregister_all_windows(epd);
@@ -645,7 +645,7 @@ int __scif_connect(scif_epd_t epd, struct scif_port_id *dst, bool non_block)
                ep->port.port = err;
                ep->port.node = scif_info.nodeid;
                ep->conn_async_state = ASYNC_CONN_IDLE;
-               /* Fall through */
+               fallthrough;
        case SCIFEP_BOUND:
                /*
                 * If a non-blocking connect has been already initiated
index de8f61efaef5cc292f9a519320c5fbefda64396d..2da3b474f4863d4e2e18d91e2072ce05a02b9f66 100644 (file)
@@ -657,7 +657,7 @@ int scif_unregister_window(struct scif_window *window)
                window->unreg_state = OP_IN_PROGRESS;
                send_msg = true;
        }
-               /* fall through */
+               fallthrough;
        case OP_IN_PROGRESS:
        {
                scif_get_window(window, 1);
index f6e600bfac5d23b9f8c8c28d747436227af6fd38..0ea923fe6371b6b9e88b6b8e59e23b46df13774d 100644 (file)
@@ -622,7 +622,7 @@ static int send_noop_message(void *cb, struct gru_message_queue_desc *mqd,
                        break;
                case CBSS_PAGE_OVERFLOW:
                        STAT(mesq_noop_page_overflow);
-                       /* fall through */
+                       fallthrough;
                default:
                        BUG();
                }
@@ -780,7 +780,7 @@ static int send_message_failure(void *cb, struct gru_message_queue_desc *mqd,
                break;
        case CBSS_PAGE_OVERFLOW:
                STAT(mesq_page_overflow);
-               /* fall through */
+               fallthrough;
        default:
                BUG();
        }
index d5e097cd556dbc60cee63277c4650e06d165dc73..8a495dc82f167cd85afd46ffe77b9937464a208f 100644 (file)
@@ -1173,7 +1173,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *_die_args)
                if (!xpc_kdebug_ignore)
                        break;
 
-               /* fall through */
+               fallthrough;
        case DIE_MCA_MONARCH_ENTER:
        case DIE_INIT_MONARCH_ENTER:
                xpc_arch_ops.offline_heartbeat();
@@ -1184,7 +1184,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *_die_args)
                if (!xpc_kdebug_ignore)
                        break;
 
-               /* fall through */
+               fallthrough;
        case DIE_MCA_MONARCH_LEAVE:
        case DIE_INIT_MONARCH_LEAVE:
                xpc_arch_ops.online_heartbeat();
index 21a04bc97d40ae593640371e47845a4d5e25ef8e..099a53bdbb7d84a1d2fcf697a0b23d1b9b5e9b95 100644 (file)
@@ -441,10 +441,10 @@ xpc_discovery(void)
                switch (region_size) {
                case 128:
                        max_regions *= 2;
-                       /* fall through */
+                       fallthrough;
                case 64:
                        max_regions *= 2;
-                       /* fall through */
+                       fallthrough;
                case 32:
                        max_regions *= 2;
                        region_size = 16;
index 98c60f11b76b1046436e7917edc3c83ad56e8474..7791bde81a3684c9dbd8f65284c97583783187a9 100644 (file)
@@ -574,7 +574,7 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
 
                xpc_wakeup_channel_mgr(part);
        }
-               /* fall through */
+               fallthrough;
        case XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV:
                spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
                part_uv->flags |= XPC_P_ENGAGED_UV;
index ce43f7573d80464a5b3af9e2b1795ea109447257..c8fae6611b73bda3a6cd665339021cad2d719fd8 100644 (file)
@@ -191,7 +191,7 @@ int mmc_of_parse(struct mmc_host *host)
        switch (bus_width) {
        case 8:
                host->caps |= MMC_CAP_8_BIT_DATA;
-               /* fall through - Hosts capable of 8-bit can also do 4 bits */
+               fallthrough;    /* Hosts capable of 8-bit can also do 4 bits */
        case 4:
                host->caps |= MMC_CAP_4_BIT_DATA;
                break;
index 93d346c01110df06ebb63191004c51f00b21c213..4c229dd2b6e543d2318d83888e8a9d1798335dd3 100644 (file)
@@ -121,6 +121,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
        struct sg_table sgtable;
        unsigned int nents, left_size, i;
        unsigned int seg_size = card->host->max_seg_size;
+       int err;
 
        WARN_ON(blksz == 0);
 
@@ -170,28 +171,32 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
 
        mmc_set_data_timeout(&data, card);
 
-       mmc_wait_for_req(card->host, &mrq);
+       mmc_pre_req(card->host, &mrq);
 
-       if (nents > 1)
-               sg_free_table(&sgtable);
+       mmc_wait_for_req(card->host, &mrq);
 
        if (cmd.error)
-               return cmd.error;
-       if (data.error)
-               return data.error;
-
-       if (mmc_host_is_spi(card->host)) {
+               err = cmd.error;
+       else if (data.error)
+               err = data.error;
+       else if (mmc_host_is_spi(card->host))
                /* host driver already reported errors */
-       } else {
-               if (cmd.resp[0] & R5_ERROR)
-                       return -EIO;
-               if (cmd.resp[0] & R5_FUNCTION_NUMBER)
-                       return -EINVAL;
-               if (cmd.resp[0] & R5_OUT_OF_RANGE)
-                       return -ERANGE;
-       }
+               err = 0;
+       else if (cmd.resp[0] & R5_ERROR)
+               err = -EIO;
+       else if (cmd.resp[0] & R5_FUNCTION_NUMBER)
+               err = -EINVAL;
+       else if (cmd.resp[0] & R5_OUT_OF_RANGE)
+               err = -ERANGE;
+       else
+               err = 0;
 
-       return 0;
+       mmc_post_req(card->host, &mrq, err);
+
+       if (nents > 1)
+               sg_free_table(&sgtable);
+
+       return err;
 }
 
 int sdio_reset(struct mmc_host *host)
index 9c89a5b780e85f0b0c8a4a70cdb68ca0e0d4faf2..9a34c827c96ef7ae1cb79896c773c0091270e519 100644 (file)
@@ -602,7 +602,7 @@ config MMC_GOLDFISH
 
 config MMC_SPI
        tristate "MMC/SD/SDIO over SPI"
-       depends on SPI_MASTER && HAS_DMA
+       depends on SPI_MASTER
        select CRC7
        select CRC_ITU_T
        help
index 300901415aa20b71781a1411e8eaada05709a7b8..3fc3bbea8536e0470a080ddde11db4817656363f 100644 (file)
@@ -2418,7 +2418,7 @@ static void atmci_get_cap(struct atmel_mci *host)
        case 0x600:
        case 0x500:
                host->caps.has_odd_clk_div = 1;
-               /* Fall through */
+               fallthrough;
        case 0x400:
        case 0x300:
                host->caps.has_dma_conf_reg = 1;
@@ -2426,16 +2426,16 @@ static void atmci_get_cap(struct atmel_mci *host)
                host->caps.has_cfg_reg = 1;
                host->caps.has_cstor_reg = 1;
                host->caps.has_highspeed = 1;
-               /* Fall through */
+               fallthrough;
        case 0x200:
                host->caps.has_rwproof = 1;
                host->caps.need_blksz_mul_4 = 0;
                host->caps.need_notbusy_for_read_ops = 1;
-               /* Fall through */
+               fallthrough;
        case 0x100:
                host->caps.has_bad_data_ordering = 0;
                host->caps.need_reset_after_xfer = 0;
-               /* Fall through */
+               fallthrough;
        case 0x0:
                break;
        default:
index f01fecd75833d8a9f05fee959ce7a39cf290f35e..e50a08bce7efa19e316db2a0150b48b7933ff15c 100644 (file)
@@ -300,7 +300,7 @@ static void mmc_davinci_start_command(struct mmc_davinci_host *host,
                 * then it's harmless for us to allow it.
                 */
                cmd_reg |= MMCCMD_BSYEXP;
-               /* FALLTHROUGH */
+               fallthrough;
        case MMC_RSP_R1:                /* 48 bits, CRC */
                cmd_reg |= MMCCMD_RSPFMT_R1456;
                break;
index 50977ff18074175d5832f8d66fa9499da38daa09..db1a84b2ba612f3f1ca8be7b9bedd222d516eef4 100644 (file)
@@ -238,7 +238,7 @@ static void dw_mci_hs_set_timing(struct dw_mci *host, int timing,
                if (smpl_phase >= USE_DLY_MIN_SMPL &&
                                smpl_phase <= USE_DLY_MAX_SMPL)
                        use_smpl_dly = 1;
-                       /* fallthrough */
+               fallthrough;
        case MMC_TIMING_UHS_SDR50:
                if (smpl_phase >= ENABLE_SHIFT_MIN_SMPL &&
                                smpl_phase <= ENABLE_SHIFT_MAX_SMPL)
index 35ae5737c62267f98fffa78126dce04f2d6b2ccf..0fba940544ca122683c427e5b36765ab7f5b3381 100644 (file)
@@ -2030,7 +2030,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
                        }
 
                        prev_state = state = STATE_SENDING_DATA;
-                       /* fall through */
+                       fallthrough;
 
                case STATE_SENDING_DATA:
                        /*
@@ -2088,7 +2088,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
                        }
                        prev_state = state = STATE_DATA_BUSY;
 
-                       /* fall through */
+                       fallthrough;
 
                case STATE_DATA_BUSY:
                        if (!dw_mci_clear_pending_data_complete(host)) {
@@ -2141,7 +2141,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
                         */
                        prev_state = state = STATE_SENDING_STOP;
 
-                       /* fall through */
+                       fallthrough;
 
                case STATE_SENDING_STOP:
                        if (!dw_mci_clear_pending_cmd_complete(host))
index 447552ac25c4a34386e815390d7fac66b418d99a..81d71010b4742d6b8bfdf6287471903428a714e8 100644 (file)
@@ -739,7 +739,7 @@ static irqreturn_t jz_mmc_irq_worker(int irq, void *devid)
                        break;
 
                jz_mmc_prepare_data_transfer(host);
-               /* fall through */
+               fallthrough;
 
        case JZ4740_MMC_STATE_TRANSFER_DATA:
                if (host->use_dma) {
@@ -774,7 +774,7 @@ static irqreturn_t jz_mmc_irq_worker(int irq, void *devid)
                        break;
                }
                jz4740_mmc_write_irq_reg(host, JZ_MMC_IRQ_DATA_TRAN_DONE);
-               /* fall through */
+               fallthrough;
 
        case JZ4740_MMC_STATE_SEND_STOP:
                if (!req->stop)
index 9b2cf7afc246f9472eb46ae301c5401271cf693c..703d5834f9a526b255adb4bd72c331ef2bd4b166 100644 (file)
@@ -294,7 +294,7 @@ static void meson_mx_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        switch (ios->power_mode) {
        case MMC_POWER_OFF:
                vdd = 0;
-               /* fall through */
+               fallthrough;
        case MMC_POWER_UP:
                if (!IS_ERR(mmc->supply.vmmc)) {
                        host->error = mmc_regulator_set_ocr(mmc,
index 39bb1e30c2d7223602f9d5145f36a6fce1519f6c..18a850f37ddce27e79939e1ce999b1bf1ac087a8 100644 (file)
@@ -1278,6 +1278,52 @@ mmc_spi_detect_irq(int irq, void *mmc)
        return IRQ_HANDLED;
 }
 
+#ifdef CONFIG_HAS_DMA
+static int mmc_spi_dma_alloc(struct mmc_spi_host *host)
+{
+       struct spi_device *spi = host->spi;
+       struct device *dev;
+
+       if (!spi->master->dev.parent->dma_mask)
+               return 0;
+
+       dev = spi->master->dev.parent;
+
+       host->ones_dma = dma_map_single(dev, host->ones, MMC_SPI_BLOCKSIZE,
+                                       DMA_TO_DEVICE);
+       if (dma_mapping_error(dev, host->ones_dma))
+               return -ENOMEM;
+
+       host->data_dma = dma_map_single(dev, host->data, sizeof(*host->data),
+                                       DMA_BIDIRECTIONAL);
+       if (dma_mapping_error(dev, host->data_dma)) {
+               dma_unmap_single(dev, host->ones_dma, MMC_SPI_BLOCKSIZE,
+                                DMA_TO_DEVICE);
+               return -ENOMEM;
+       }
+
+       dma_sync_single_for_cpu(dev, host->data_dma, sizeof(*host->data),
+                               DMA_BIDIRECTIONAL);
+
+       host->dma_dev = dev;
+       return 0;
+}
+
+static void mmc_spi_dma_free(struct mmc_spi_host *host)
+{
+       if (!host->dma_dev)
+               return;
+
+       dma_unmap_single(host->dma_dev, host->ones_dma, MMC_SPI_BLOCKSIZE,
+                        DMA_TO_DEVICE);
+       dma_unmap_single(host->dma_dev, host->data_dma, sizeof(*host->data),
+                        DMA_BIDIRECTIONAL);
+}
+#else
+static inline int mmc_spi_dma_alloc(struct mmc_spi_host *host) { return 0; }
+static inline void mmc_spi_dma_free(struct mmc_spi_host *host) {}
+#endif
+
 static int mmc_spi_probe(struct spi_device *spi)
 {
        void                    *ones;
@@ -1374,23 +1420,9 @@ static int mmc_spi_probe(struct spi_device *spi)
        if (!host->data)
                goto fail_nobuf1;
 
-       if (spi->master->dev.parent->dma_mask) {
-               struct device   *dev = spi->master->dev.parent;
-
-               host->dma_dev = dev;
-               host->ones_dma = dma_map_single(dev, ones,
-                               MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE);
-               if (dma_mapping_error(dev, host->ones_dma))
-                       goto fail_ones_dma;
-               host->data_dma = dma_map_single(dev, host->data,
-                               sizeof(*host->data), DMA_BIDIRECTIONAL);
-               if (dma_mapping_error(dev, host->data_dma))
-                       goto fail_data_dma;
-
-               dma_sync_single_for_cpu(host->dma_dev,
-                               host->data_dma, sizeof(*host->data),
-                               DMA_BIDIRECTIONAL);
-       }
+       status = mmc_spi_dma_alloc(host);
+       if (status)
+               goto fail_dma;
 
        /* setup message for status/busy readback */
        spi_message_init(&host->readback);
@@ -1458,20 +1490,12 @@ static int mmc_spi_probe(struct spi_device *spi)
 fail_add_host:
        mmc_remove_host(mmc);
 fail_glue_init:
-       if (host->dma_dev)
-               dma_unmap_single(host->dma_dev, host->data_dma,
-                               sizeof(*host->data), DMA_BIDIRECTIONAL);
-fail_data_dma:
-       if (host->dma_dev)
-               dma_unmap_single(host->dma_dev, host->ones_dma,
-                               MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE);
-fail_ones_dma:
+       mmc_spi_dma_free(host);
+fail_dma:
        kfree(host->data);
-
 fail_nobuf1:
        mmc_free_host(mmc);
        mmc_spi_put_pdata(spi);
-
 nomem:
        kfree(ones);
        return status;
@@ -1489,13 +1513,7 @@ static int mmc_spi_remove(struct spi_device *spi)
 
        mmc_remove_host(mmc);
 
-       if (host->dma_dev) {
-               dma_unmap_single(host->dma_dev, host->ones_dma,
-                       MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE);
-               dma_unmap_single(host->dma_dev, host->data_dma,
-                       sizeof(*host->data), DMA_BIDIRECTIONAL);
-       }
-
+       mmc_spi_dma_free(host);
        kfree(host->data);
        kfree(host->ones);
 
index 4e2583f69a631a01c6cb9677cfed3118b1ccc900..b0c27944db7f72913845edb3e43527382df7636d 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
+#include <linux/reset.h>
 
 #include <linux/mmc/card.h>
 #include <linux/mmc/core.h>
@@ -419,6 +420,7 @@ struct msdc_host {
        struct pinctrl_state *pins_uhs;
        struct delayed_work req_timeout;
        int irq;                /* host interrupt */
+       struct reset_control *reset;
 
        struct clk *src_clk;    /* msdc source clock */
        struct clk *h_clk;      /* msdc h_clk */
@@ -1592,6 +1594,12 @@ static void msdc_init_hw(struct msdc_host *host)
        u32 val;
        u32 tune_reg = host->dev_comp->pad_tune_reg;
 
+       if (host->reset) {
+               reset_control_assert(host->reset);
+               usleep_range(10, 50);
+               reset_control_deassert(host->reset);
+       }
+
        /* Configure to MMC/SD mode, clock free running */
        sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN);
 
@@ -2390,6 +2398,11 @@ static int msdc_drv_probe(struct platform_device *pdev)
        if (IS_ERR(host->src_clk_cg))
                host->src_clk_cg = NULL;
 
+       host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
+                                                               "hrst");
+       if (IS_ERR(host->reset))
+               return PTR_ERR(host->reset);
+
        host->irq = platform_get_irq(pdev, 0);
        if (host->irq < 0) {
                ret = -EINVAL;
index 15e21894bd44a84ffacd77d1c416e552ed0b99ec..904f5237d8f7e4982a2095a5b9cea76837e3ace7 100644 (file)
@@ -685,7 +685,7 @@ static int renesas_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)
        case HOST_MODE:
                if (host->pdata->flags & TMIO_MMC_HAVE_CBSY)
                        bit = TMIO_STAT_CMD_BUSY;
-               /* fallthrough */
+               fallthrough;
        case CTL_SD_CARD_CLK_CTL:
                return renesas_sdhi_wait_idle(host, bit);
        }
index 48ecbd0b180d87f213f4655711afb500f18b2b15..284cba11e27952aa9fd241f3bd59e548fcc7398f 100644 (file)
@@ -535,6 +535,11 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_qcom_sd = {
        .caps    = MMC_CAP_NONREMOVABLE,
 };
 
+struct amd_sdhci_host {
+       bool    tuned_clock;
+       bool    dll_enabled;
+};
+
 /* AMD sdhci reset dll register. */
 #define SDHCI_AMD_RESET_DLL_REGISTER    0x908
 
@@ -546,39 +551,96 @@ static int amd_select_drive_strength(struct mmc_card *card,
        return MMC_SET_DRIVER_TYPE_A;
 }
 
-static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host)
+static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host, bool enable)
 {
+       struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
+       struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
+
        /* AMD Platform requires dll setting */
        sdhci_writel(host, 0x40003210, SDHCI_AMD_RESET_DLL_REGISTER);
        usleep_range(10, 20);
-       sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER);
+       if (enable)
+               sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER);
+
+       amd_host->dll_enabled = enable;
 }
 
 /*
- * For AMD Platform it is required to disable the tuning
- * bit first controller to bring to HS Mode from HS200
- * mode, later enable to tune to HS400 mode.
+ * The initialization sequence for HS400 is:
+ *     HS->HS200->Perform Tuning->HS->HS400
+ *
+ * The re-tuning sequence is:
+ *     HS400->DDR52->HS->HS200->Perform Tuning->HS->HS400
+ *
+ * The AMD eMMC Controller can only use the tuned clock while in HS200 and HS400
+ * mode. If we switch to a different mode, we need to disable the tuned clock.
+ * If we have previously performed tuning and switch back to HS200 or
+ * HS400, we can re-enable the tuned clock.
+ *
  */
 static void amd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 {
        struct sdhci_host *host = mmc_priv(mmc);
+       struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
+       struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
        unsigned int old_timing = host->timing;
+       u16 val;
 
        sdhci_set_ios(mmc, ios);
-       if (old_timing == MMC_TIMING_MMC_HS200 &&
-           ios->timing == MMC_TIMING_MMC_HS)
-               sdhci_writew(host, 0x9, SDHCI_HOST_CONTROL2);
-       if (old_timing != MMC_TIMING_MMC_HS400 &&
-           ios->timing == MMC_TIMING_MMC_HS400) {
-               sdhci_writew(host, 0x80, SDHCI_HOST_CONTROL2);
-               sdhci_acpi_amd_hs400_dll(host);
+
+       if (old_timing != host->timing && amd_host->tuned_clock) {
+               if (host->timing == MMC_TIMING_MMC_HS400 ||
+                   host->timing == MMC_TIMING_MMC_HS200) {
+                       val = sdhci_readw(host, SDHCI_HOST_CONTROL2);
+                       val |= SDHCI_CTRL_TUNED_CLK;
+                       sdhci_writew(host, val, SDHCI_HOST_CONTROL2);
+               } else {
+                       val = sdhci_readw(host, SDHCI_HOST_CONTROL2);
+                       val &= ~SDHCI_CTRL_TUNED_CLK;
+                       sdhci_writew(host, val, SDHCI_HOST_CONTROL2);
+               }
+
+               /* DLL is only required for HS400 */
+               if (host->timing == MMC_TIMING_MMC_HS400 &&
+                   !amd_host->dll_enabled)
+                       sdhci_acpi_amd_hs400_dll(host, true);
+       }
+}
+
+static int amd_sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
+{
+       int err;
+       struct sdhci_host *host = mmc_priv(mmc);
+       struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
+       struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
+
+       amd_host->tuned_clock = false;
+
+       err = sdhci_execute_tuning(mmc, opcode);
+
+       if (!err && !host->tuning_err)
+               amd_host->tuned_clock = true;
+
+       return err;
+}
+
+static void amd_sdhci_reset(struct sdhci_host *host, u8 mask)
+{
+       struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
+       struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
+
+       if (mask & SDHCI_RESET_ALL) {
+               amd_host->tuned_clock = false;
+               sdhci_acpi_amd_hs400_dll(host, false);
        }
+
+       sdhci_reset(host, mask);
 }
 
 static const struct sdhci_ops sdhci_acpi_ops_amd = {
        .set_clock      = sdhci_set_clock,
        .set_bus_width  = sdhci_set_bus_width,
-       .reset          = sdhci_reset,
+       .reset          = amd_sdhci_reset,
        .set_uhs_signaling = sdhci_set_uhs_signaling,
 };
 
@@ -602,6 +664,7 @@ static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev,
 
        host->mmc_host_ops.select_drive_strength = amd_select_drive_strength;
        host->mmc_host_ops.set_ios = amd_set_ios;
+       host->mmc_host_ops.execute_tuning = amd_sdhci_execute_tuning;
        return 0;
 }
 
@@ -613,6 +676,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_amd_emmc = {
                          SDHCI_QUIRK_32BIT_ADMA_SIZE,
        .quirks2        = SDHCI_QUIRK2_BROKEN_64_BIT_DMA,
        .probe_slot     = sdhci_acpi_emmc_amd_probe_slot,
+       .priv_size      = sizeof(struct amd_sdhci_host),
 };
 
 struct sdhci_acpi_uid_slot {
index a76b4513fbec6b7a6e87a444c275ca19345cb284..d738907a622f7ad01aecd9bafd9cd628d345098c 100644 (file)
@@ -1556,7 +1556,7 @@ static int sdhci_esdhc_imx_probe_nondt(struct platform_device *pdev,
                                "failed to request card-detect gpio!\n");
                        return err;
                }
-               /* fall through */
+               fallthrough;
 
        case ESDHC_CD_CONTROLLER:
                /* we have a working card_detect back */
index 5a33389037cd0c2b7fef1cf61fc6d80909c32c5b..729868abd2dba42a71debbf59e594182137fe119 100644 (file)
@@ -1166,7 +1166,7 @@ static void sdhci_msm_set_cdr(struct sdhci_host *host, bool enable)
 static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
 {
        struct sdhci_host *host = mmc_priv(mmc);
-       int tuning_seq_cnt = 3;
+       int tuning_seq_cnt = 10;
        u8 phase, tuned_phases[16], tuned_phase_cnt = 0;
        int rc;
        struct mmc_ios ios = host->mmc->ios;
@@ -1222,6 +1222,22 @@ retry:
        } while (++phase < ARRAY_SIZE(tuned_phases));
 
        if (tuned_phase_cnt) {
+               if (tuned_phase_cnt == ARRAY_SIZE(tuned_phases)) {
+                       /*
+                        * All phases valid is _almost_ as bad as no phases
+                        * valid.  Probably all phases are not really reliable
+                        * but we didn't detect where the unreliable place is.
+                        * That means we'll essentially be guessing and hoping
+                        * we get a good phase.  Better to try a few times.
+                        */
+                       dev_dbg(mmc_dev(mmc), "%s: All phases valid; try again\n",
+                               mmc_hostname(mmc));
+                       if (--tuning_seq_cnt) {
+                               tuned_phase_cnt = 0;
+                               goto retry;
+                       }
+               }
+
                rc = msm_find_most_appropriate_phase(host, tuned_phases,
                                                     tuned_phase_cnt);
                if (rc < 0)
index 7c73d243dc6ceeb0a1a3b632d2905157372a0793..45881b3099567ded18e0c13f728150153eb9bf6e 100644 (file)
@@ -81,6 +81,7 @@ struct sdhci_esdhc {
        bool quirk_tuning_erratum_type2;
        bool quirk_ignore_data_inhibit;
        bool quirk_delay_before_data_reset;
+       bool quirk_trans_complete_erratum;
        bool in_sw_tuning;
        unsigned int peripheral_clock;
        const struct esdhc_clk_fixup *clk_fixup;
@@ -1177,10 +1178,11 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host,
 
 static u32 esdhc_irq(struct sdhci_host *host, u32 intmask)
 {
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+       struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
        u32 command;
 
-       if (of_find_compatible_node(NULL, NULL,
-                               "fsl,p2020-esdhc")) {
+       if (esdhc->quirk_trans_complete_erratum) {
                command = SDHCI_GET_CMD(sdhci_readw(host,
                                        SDHCI_COMMAND));
                if (command == MMC_WRITE_MULTIPLE_BLOCK &&
@@ -1334,8 +1336,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
                esdhc->clk_fixup = match->data;
        np = pdev->dev.of_node;
 
-       if (of_device_is_compatible(np, "fsl,p2020-esdhc"))
+       if (of_device_is_compatible(np, "fsl,p2020-esdhc")) {
                esdhc->quirk_delay_before_data_reset = true;
+               esdhc->quirk_trans_complete_erratum = true;
+       }
 
        clk = of_clk_get(np, 0);
        if (!IS_ERR(clk)) {
index bb6802448b2f4a9573f083da896a85aa0d225010..914f5184295ff867f75e92aa66bad526c5badd79 100644 (file)
@@ -232,6 +232,14 @@ static void sdhci_pci_dumpregs(struct mmc_host *mmc)
        sdhci_dumpregs(mmc_priv(mmc));
 }
 
+static void sdhci_cqhci_reset(struct sdhci_host *host, u8 mask)
+{
+       if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL) &&
+           host->mmc->cqe_private)
+               cqhci_deactivate(host->mmc);
+       sdhci_reset(host, mask);
+}
+
 /*****************************************************************************\
  *                                                                           *
  * Hardware specific quirk handling                                          *
@@ -718,7 +726,7 @@ static const struct sdhci_ops sdhci_intel_glk_ops = {
        .set_power              = sdhci_intel_set_power,
        .enable_dma             = sdhci_pci_enable_dma,
        .set_bus_width          = sdhci_set_bus_width,
-       .reset                  = sdhci_reset,
+       .reset                  = sdhci_cqhci_reset,
        .set_uhs_signaling      = sdhci_set_uhs_signaling,
        .hw_reset               = sdhci_pci_hw_reset,
        .irq                    = sdhci_cqhci_irq,
@@ -786,7 +794,8 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
 static bool glk_broken_cqhci(struct sdhci_pci_slot *slot)
 {
        return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC &&
-              dmi_match(DMI_BIOS_VENDOR, "LENOVO");
+              (dmi_match(DMI_BIOS_VENDOR, "LENOVO") ||
+               dmi_match(DMI_SYS_VENDOR, "IRBIS"));
 }
 
 static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot)
index 9194bb73e601b73828eef81f72877fe98b140e89..080ced1e63f0ab073a247d9f15017dd22cfe76fd 100644 (file)
@@ -609,7 +609,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
        switch (pdata->max_width) {
        case 8:
                host->mmc->caps |= MMC_CAP_8_BIT_DATA;
-               /* Fall through */
+               fallthrough;
        case 4:
                host->mmc->caps |= MMC_CAP_4_BIT_DATA;
                break;
index a910cb461ed7c1c280027e94bdb51b3a1e3b9caf..bafa2e41c8b6366e77be96a3e612b9a09e7d78fc 100644 (file)
@@ -470,7 +470,7 @@ static int sdhci_sprd_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios)
                break;
 
        default:
-               /* fall-through */
+               fallthrough;
        case MMC_SIGNAL_VOLTAGE_330:
                ret = pinctrl_select_state(sprd_host->pinctrl,
                                           sprd_host->pins_default);
index 0a3f9d024f2ab58f86edf2b7dc78743bb6c1e59d..13fbf70b5fde37478c26a2cdd90d08795f56f0a1 100644 (file)
 #define NVQUIRK_DIS_CARD_CLK_CONFIG_TAP                        BIT(8)
 #define NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING              BIT(9)
 
+/*
+ * NVQUIRK_HAS_TMCLK is for SoC's having separate timeout clock for Tegra
+ * SDMMC hardware data timeout.
+ */
+#define NVQUIRK_HAS_TMCLK                              BIT(10)
+
 /* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */
 #define SDHCI_TEGRA_CQE_BASE_ADDR                      0xF000
 
@@ -140,6 +146,7 @@ struct sdhci_tegra_autocal_offsets {
 struct sdhci_tegra {
        const struct sdhci_tegra_soc_data *soc_data;
        struct gpio_desc *power_gpio;
+       struct clk *tmclk;
        bool ddr_signaling;
        bool pad_calib_required;
        bool pad_control_available;
@@ -1418,7 +1425,6 @@ static const struct sdhci_ops tegra210_sdhci_ops = {
 
 static const struct sdhci_pltfm_data sdhci_tegra210_pdata = {
        .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
-                 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
                  SDHCI_QUIRK_SINGLE_POWER_WRITE |
                  SDHCI_QUIRK_NO_HISPD_BIT |
                  SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
@@ -1434,7 +1440,8 @@ static const struct sdhci_tegra_soc_data soc_data_tegra210 = {
                    NVQUIRK_HAS_PADCALIB |
                    NVQUIRK_DIS_CARD_CLK_CONFIG_TAP |
                    NVQUIRK_ENABLE_SDR50 |
-                   NVQUIRK_ENABLE_SDR104,
+                   NVQUIRK_ENABLE_SDR104 |
+                   NVQUIRK_HAS_TMCLK,
        .min_tap_delay = 106,
        .max_tap_delay = 185,
 };
@@ -1456,7 +1463,6 @@ static const struct sdhci_ops tegra186_sdhci_ops = {
 
 static const struct sdhci_pltfm_data sdhci_tegra186_pdata = {
        .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
-                 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
                  SDHCI_QUIRK_SINGLE_POWER_WRITE |
                  SDHCI_QUIRK_NO_HISPD_BIT |
                  SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
@@ -1473,6 +1479,7 @@ static const struct sdhci_tegra_soc_data soc_data_tegra186 = {
                    NVQUIRK_DIS_CARD_CLK_CONFIG_TAP |
                    NVQUIRK_ENABLE_SDR50 |
                    NVQUIRK_ENABLE_SDR104 |
+                   NVQUIRK_HAS_TMCLK |
                    NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING,
        .min_tap_delay = 84,
        .max_tap_delay = 136,
@@ -1485,7 +1492,8 @@ static const struct sdhci_tegra_soc_data soc_data_tegra194 = {
                    NVQUIRK_HAS_PADCALIB |
                    NVQUIRK_DIS_CARD_CLK_CONFIG_TAP |
                    NVQUIRK_ENABLE_SDR50 |
-                   NVQUIRK_ENABLE_SDR104,
+                   NVQUIRK_ENABLE_SDR104 |
+                   NVQUIRK_HAS_TMCLK,
        .min_tap_delay = 96,
        .max_tap_delay = 139,
 };
@@ -1613,6 +1621,43 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
                goto err_power_req;
        }
 
+       /*
+        * Tegra210 has a separate SDMMC_LEGACY_TM clock used for host
+        * timeout clock and SW can choose TMCLK or SDCLK for hardware
+        * data timeout through the bit USE_TMCLK_FOR_DATA_TIMEOUT of
+        * the register SDHCI_TEGRA_VENDOR_SYS_SW_CTRL.
+        *
+        * USE_TMCLK_FOR_DATA_TIMEOUT bit default is set to 1 and SDMMC uses
+        * 12Mhz TMCLK which is advertised in host capability register.
+        * With TMCLK of 12Mhz provides maximum data timeout period that can
+        * be achieved is 11s better than using SDCLK for data timeout.
+        *
+        * So, TMCLK is set to 12Mhz and kept enabled all the time on SoC's
+        * supporting separate TMCLK.
+        */
+
+       if (soc_data->nvquirks & NVQUIRK_HAS_TMCLK) {
+               clk = devm_clk_get(&pdev->dev, "tmclk");
+               if (IS_ERR(clk)) {
+                       rc = PTR_ERR(clk);
+                       if (rc == -EPROBE_DEFER)
+                               goto err_power_req;
+
+                       dev_warn(&pdev->dev, "failed to get tmclk: %d\n", rc);
+                       clk = NULL;
+               }
+
+               clk_set_rate(clk, 12000000);
+               rc = clk_prepare_enable(clk);
+               if (rc) {
+                       dev_err(&pdev->dev,
+                               "failed to enable tmclk: %d\n", rc);
+                       goto err_power_req;
+               }
+
+               tegra_host->tmclk = clk;
+       }
+
        clk = devm_clk_get(mmc_dev(host->mmc), NULL);
        if (IS_ERR(clk)) {
                rc = PTR_ERR(clk);
@@ -1656,6 +1701,7 @@ err_add_host:
 err_rst_get:
        clk_disable_unprepare(pltfm_host->clk);
 err_clk_get:
+       clk_disable_unprepare(tegra_host->tmclk);
 err_power_req:
 err_parse_dt:
        sdhci_pltfm_free(pdev);
@@ -1673,6 +1719,7 @@ static int sdhci_tegra_remove(struct platform_device *pdev)
        reset_control_assert(tegra_host->rst);
        usleep_range(2000, 4000);
        clk_disable_unprepare(pltfm_host->clk);
+       clk_disable_unprepare(tegra_host->tmclk);
 
        sdhci_pltfm_free(pdev);
 
index e6e9e286cc348932dba57186d4c8efa95320c729..03ce57ef4585886c138e64e2e5b8d5b605ce1aa9 100644 (file)
@@ -527,7 +527,7 @@ static bool xenon_emmc_phy_slow_mode(struct sdhci_host *host,
                        ret = true;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                reg &= ~XENON_TIMING_ADJUST_SLOW_MODE;
                ret = false;
index 3ad394b40eb18cf8a59dca6f5a6c639d32a7c421..592a55a34b58eba8163d5277faecc880460f76f7 100644 (file)
@@ -2825,7 +2825,7 @@ int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
        case MMC_TIMING_UHS_SDR50:
                if (host->flags & SDHCI_SDR50_NEEDS_TUNING)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
 
        default:
                goto out;
index 5987656e0474cd262234dbbb0b85b624a039513a..fd8b72d3e02c9a36c55bc40a647d2dbe8e415158 100644 (file)
@@ -335,7 +335,7 @@ static unsigned int tifm_sd_op_flags(struct mmc_command *cmd)
                break;
        case MMC_RSP_R1B:
                rc |= TIFM_MMCSD_RSP_BUSY;
-               /* fall-through */
+               fallthrough;
        case MMC_RSP_R1:
                rc |= TIFM_MMCSD_RSP_R1;
                break;
index 369b8dee2e3d3f44dadf4379f44fee0557801f61..7666c90054ae937d8de19831271477afa43ae50f 100644 (file)
@@ -1343,7 +1343,7 @@ static int usdhi6_stop_cmd(struct usdhi6_host *host)
                        host->wait = USDHI6_WAIT_FOR_STOP;
                        return 0;
                }
-               /* fall through - Unsupported STOP command. */
+               fallthrough;    /* Unsupported STOP command */
        default:
                dev_err(mmc_dev(host->mmc),
                        "unsupported stop CMD%d for CMD%d\n",
@@ -1691,7 +1691,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
        switch (host->wait) {
        default:
                dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
-               /* fall through - mrq can be NULL, but is impossible. */
+               fallthrough;    /* mrq can be NULL, but is impossible */
        case USDHI6_WAIT_FOR_CMD:
                usdhi6_error_code(host);
                if (mrq)
@@ -1713,7 +1713,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
                        host->offset, data->blocks, data->blksz, data->sg_len,
                        sg_dma_len(sg), sg->offset);
                usdhi6_sg_unmap(host, true);
-               /* fall through - page unmapped in USDHI6_WAIT_FOR_DATA_END. */
+               fallthrough;    /* page unmapped in USDHI6_WAIT_FOR_DATA_END */
        case USDHI6_WAIT_FOR_DATA_END:
                usdhi6_error_code(host);
                data->error = -ETIMEDOUT;
index 65eff4ce6ab1f9055b89a8180fff88156f27b164..0369d98b2d12efe0757196ee651a6e107f1cbeba 100644 (file)
@@ -1907,16 +1907,15 @@ static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 }
 
 /**
- * spi_nor_sr1_bit6_quad_enable() - Set/Unset the Quad Enable BIT(6) in the
- *                                  Status Register 1.
+ * spi_nor_sr1_bit6_quad_enable() - Set the Quad Enable BIT(6) in the Status
+ * Register 1.
  * @nor:       pointer to a 'struct spi_nor'
- * @enable:    true to enable Quad mode, false to disable Quad mode.
  *
  * Bit 6 of the Status Register 1 is the QE bit for Macronix like QSPI memories.
  *
  * Return: 0 on success, -errno otherwise.
  */
-int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor, bool enable)
+int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor)
 {
        int ret;
 
@@ -1924,56 +1923,45 @@ int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor, bool enable)
        if (ret)
                return ret;
 
-       if ((enable && (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)) ||
-           (!enable && !(nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)))
+       if (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)
                return 0;
 
-       if (enable)
-               nor->bouncebuf[0] |= SR1_QUAD_EN_BIT6;
-       else
-               nor->bouncebuf[0] &= ~SR1_QUAD_EN_BIT6;
+       nor->bouncebuf[0] |= SR1_QUAD_EN_BIT6;
 
        return spi_nor_write_sr1_and_check(nor, nor->bouncebuf[0]);
 }
 
 /**
- * spi_nor_sr2_bit1_quad_enable() - set/unset the Quad Enable BIT(1) in the
- *                                  Status Register 2.
+ * spi_nor_sr2_bit1_quad_enable() - set the Quad Enable BIT(1) in the Status
+ * Register 2.
  * @nor:       pointer to a 'struct spi_nor'.
- * @enable:    true to enable Quad mode, false to disable Quad mode.
  *
  * Bit 1 of the Status Register 2 is the QE bit for Spansion like QSPI memories.
  *
  * Return: 0 on success, -errno otherwise.
  */
-int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor, bool enable)
+int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor)
 {
        int ret;
 
        if (nor->flags & SNOR_F_NO_READ_CR)
-               return spi_nor_write_16bit_cr_and_check(nor,
-                                               enable ? SR2_QUAD_EN_BIT1 : 0);
+               return spi_nor_write_16bit_cr_and_check(nor, SR2_QUAD_EN_BIT1);
 
        ret = spi_nor_read_cr(nor, nor->bouncebuf);
        if (ret)
                return ret;
 
-       if ((enable && (nor->bouncebuf[0] & SR2_QUAD_EN_BIT1)) ||
-           (!enable && !(nor->bouncebuf[0] & SR2_QUAD_EN_BIT1)))
+       if (nor->bouncebuf[0] & SR2_QUAD_EN_BIT1)
                return 0;
 
-       if (enable)
-               nor->bouncebuf[0] |= SR2_QUAD_EN_BIT1;
-       else
-               nor->bouncebuf[0] &= ~SR2_QUAD_EN_BIT1;
+       nor->bouncebuf[0] |= SR2_QUAD_EN_BIT1;
 
        return spi_nor_write_16bit_cr_and_check(nor, nor->bouncebuf[0]);
 }
 
 /**
- * spi_nor_sr2_bit7_quad_enable() - set/unset QE bit in Status Register 2.
+ * spi_nor_sr2_bit7_quad_enable() - set QE bit in Status Register 2.
  * @nor:       pointer to a 'struct spi_nor'
- * @enable:    true to enable Quad mode, false to disable Quad mode.
  *
  * Set the Quad Enable (QE) bit in the Status Register 2.
  *
@@ -1983,7 +1971,7 @@ int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor, bool enable)
  *
  * Return: 0 on success, -errno otherwise.
  */
-int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor, bool enable)
+int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor)
 {
        u8 *sr2 = nor->bouncebuf;
        int ret;
@@ -1993,15 +1981,11 @@ int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor, bool enable)
        ret = spi_nor_read_sr2(nor, sr2);
        if (ret)
                return ret;
-       if ((enable && (*sr2 & SR2_QUAD_EN_BIT7)) ||
-           (!enable && !(*sr2 & SR2_QUAD_EN_BIT7)))
+       if (*sr2 & SR2_QUAD_EN_BIT7)
                return 0;
 
        /* Update the Quad Enable bit. */
-       if (enable)
-               *sr2 |= SR2_QUAD_EN_BIT7;
-       else
-               *sr2 &= ~SR2_QUAD_EN_BIT7;
+       *sr2 |= SR2_QUAD_EN_BIT7;
 
        ret = spi_nor_write_sr2(nor, sr2);
        if (ret)
@@ -2914,13 +2898,12 @@ static int spi_nor_init_params(struct spi_nor *nor)
 }
 
 /**
- * spi_nor_quad_enable() - enable/disable Quad I/O if needed.
+ * spi_nor_quad_enable() - enable Quad I/O if needed.
  * @nor:                pointer to a 'struct spi_nor'
- * @enable:             true to enable Quad mode. false to disable Quad mode.
  *
  * Return: 0 on success, -errno otherwise.
  */
-static int spi_nor_quad_enable(struct spi_nor *nor, bool enable)
+static int spi_nor_quad_enable(struct spi_nor *nor)
 {
        if (!nor->params->quad_enable)
                return 0;
@@ -2929,7 +2912,7 @@ static int spi_nor_quad_enable(struct spi_nor *nor, bool enable)
              spi_nor_get_protocol_width(nor->write_proto) == 4))
                return 0;
 
-       return nor->params->quad_enable(nor, enable);
+       return nor->params->quad_enable(nor);
 }
 
 /**
@@ -2953,7 +2936,7 @@ static int spi_nor_init(struct spi_nor *nor)
 {
        int err;
 
-       err = spi_nor_quad_enable(nor, true);
+       err = spi_nor_quad_enable(nor);
        if (err) {
                dev_dbg(nor->dev, "quad mode not supported\n");
                return err;
@@ -3000,8 +2983,6 @@ void spi_nor_restore(struct spi_nor *nor)
        if (nor->addr_width == 4 && !(nor->flags & SNOR_F_4B_OPCODES) &&
            nor->flags & SNOR_F_BROKEN_RESET)
                nor->params->set_4byte_addr_mode(nor, false);
-
-       spi_nor_quad_enable(nor, false);
 }
 EXPORT_SYMBOL_GPL(spi_nor_restore);
 
index 95aa32f3ceb1884cbe10a0b1ea3e5081dea0f359..6f2f6b27173fd5ce3cd144847f285c2ac2ea99c8 100644 (file)
@@ -198,7 +198,7 @@ struct spi_nor_locking_ops {
  *                      higher index in the array, the higher priority.
  * @erase_map:         the erase map parsed from the SFDP Sector Map Parameter
  *                      Table.
- * @quad_enable:       enables/disables SPI NOR Quad mode.
+ * @quad_enable:       enables SPI NOR quad mode.
  * @set_4byte_addr_mode: puts the SPI NOR in 4 byte addressing mode.
  * @convert_addr:      converts an absolute address into something the flash
  *                      will understand. Particularly useful when pagesize is
@@ -219,7 +219,7 @@ struct spi_nor_flash_parameter {
 
        struct spi_nor_erase_map        erase_map;
 
-       int (*quad_enable)(struct spi_nor *nor, bool enable);
+       int (*quad_enable)(struct spi_nor *nor);
        int (*set_4byte_addr_mode)(struct spi_nor *nor, bool enable);
        u32 (*convert_addr)(struct spi_nor *nor, u32 addr);
        int (*setup)(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps);
@@ -406,9 +406,9 @@ int spi_nor_write_ear(struct spi_nor *nor, u8 ear);
 int spi_nor_wait_till_ready(struct spi_nor *nor);
 int spi_nor_lock_and_prep(struct spi_nor *nor);
 void spi_nor_unlock_and_unprep(struct spi_nor *nor);
-int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor, bool enable);
-int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor, bool enable);
-int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor, bool enable);
+int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor);
+int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor);
+int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor);
 
 int spi_nor_xread_sr(struct spi_nor *nor, u8 *sr);
 ssize_t spi_nor_read_data(struct spi_nor *nor, loff_t from, size_t len,
index 12466b06692c83d3b3eb0a5150b753e54a3140ef..22ed051eb1a4a5c89f3ad1fa8cd46d576ab24564 100644 (file)
@@ -93,7 +93,7 @@ static int adgs1408_probe(struct spi_device *spi)
                        mux->idle_state = idle_state;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                dev_err(dev, "invalid idle-state %d\n", idle_state);
                return -EINVAL;
index 18428e104445f25198325b89025067fd65cbb11b..1c6c27f35ac4bc95d9ab1b635c77d1b77a0ec936 100644 (file)
@@ -301,7 +301,7 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
                        dev->irq = cops_irq(ioaddr, board);
                        if (dev->irq)
                                break;
-                       /* fall through - Once no IRQ found on this port. */
+                       fallthrough;    /* Once no IRQ found on this port */
                case 1:
                        retval = -EINVAL;
                        goto err_out;
index 14a5fb3781453526914bdab493c9b68beaa596b3..98df38fe553ced05b714767d4ad628dcba45819a 100644 (file)
@@ -363,13 +363,13 @@ static int __init arcrimi_setup(char *s)
        switch (ints[0]) {
        default:                /* ERROR */
                pr_err("Too many arguments\n");
-               /* Fall through */
+               fallthrough;
        case 3:         /* Node ID */
                node = ints[3];
-               /* Fall through */
+               fallthrough;
        case 2:         /* IRQ */
                irq = ints[2];
-               /* Fall through */
+               fallthrough;
        case 1:         /* IO address */
                io = ints[1];
        }
index cd27fdc1059b908900fe72d7e23503750dface0a..f983c4ce6b07f186fd2b6cc136df9eabfa7c8df4 100644 (file)
@@ -197,22 +197,22 @@ static int __init com20020isa_setup(char *s)
        switch (ints[0]) {
        default:                /* ERROR */
                pr_info("Too many arguments\n");
-               /* Fall through */
+               fallthrough;
        case 6:         /* Timeout */
                timeout = ints[6];
-               /* Fall through */
+               fallthrough;
        case 5:         /* CKP value */
                clockp = ints[5];
-               /* Fall through */
+               fallthrough;
        case 4:         /* Backplane flag */
                backplane = ints[4];
-               /* Fall through */
+               fallthrough;
        case 3:         /* Node ID */
                node = ints[3];
-               /* Fall through */
+               fallthrough;
        case 2:         /* IRQ */
                irq = ints[2];
-               /* Fall through */
+               fallthrough;
        case 1:         /* IO address */
                io = ints[1];
        }
index 186bbf87bc849f1e3e80180068412de2a5ff1606..cf214b7306715487b84cd2301fca4de1bada6f48 100644 (file)
@@ -363,10 +363,10 @@ static int __init com90io_setup(char *s)
        switch (ints[0]) {
        default:                /* ERROR */
                pr_err("Too many arguments\n");
-               /* Fall through */
+               fallthrough;
        case 2:         /* IRQ */
                irq = ints[2];
-               /* Fall through */
+               fallthrough;
        case 1:         /* IO address */
                io = ints[1];
        }
index bd75d06ad7dfc98c982a3c7f033508a8e398d3ae..3dc3d533cb19a258e72f57d46443b9b52d1b8df7 100644 (file)
@@ -693,13 +693,13 @@ static int __init com90xx_setup(char *s)
        switch (ints[0]) {
        default:                /* ERROR */
                pr_err("Too many arguments\n");
-               /* Fall through */
+               fallthrough;
        case 3:         /* Mem address */
                shmem = ints[3];
-               /* Fall through */
+               fallthrough;
        case 2:         /* IRQ */
                irq = ints[2];
-               /* Fall through */
+               fallthrough;
        case 1:         /* IO address */
                io = ints[1];
        }
index cddaa43a9d527b7c6d151338c636bd429aa0a3e9..aa001b16765ae152e666fb1fa0d2ebd4ef8784e6 100644 (file)
@@ -1149,7 +1149,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
                        port->actor_oper_port_state &= ~LACP_STATE_EXPIRED;
                        port->sm_rx_state = AD_RX_PORT_DISABLED;
 
-                       /* Fall Through */
+                       fallthrough;
                case AD_RX_PORT_DISABLED:
                        port->sm_vars &= ~AD_PORT_MATCHED;
                        break;
@@ -1588,7 +1588,7 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,
                if (__agg_active_ports(curr) < __agg_active_ports(best))
                        return best;
 
-               /*FALLTHROUGH*/
+               fallthrough;
        case BOND_AD_STABLE:
        case BOND_AD_BANDWIDTH:
                if (__get_agg_bandwidth(curr) > __get_agg_bandwidth(best))
index c5d3032dd1a2155f1271c1a8f172ea8454cf153e..42ef25ec0af5b089365c5a0b0378c40c22db1afe 100644 (file)
@@ -2274,7 +2274,7 @@ static int bond_miimon_inspect(struct bonding *bond)
                                             "active " : "backup ") : "",
                                           bond->params.downdelay * bond->params.miimon);
                        }
-                       /*FALLTHRU*/
+                       fallthrough;
                case BOND_LINK_FAIL:
                        if (link_state) {
                                /* recovered before downdelay expired */
@@ -2310,7 +2310,7 @@ static int bond_miimon_inspect(struct bonding *bond)
                                           bond->params.updelay *
                                           bond->params.miimon);
                        }
-                       /*FALLTHRU*/
+                       fallthrough;
                case BOND_LINK_BACK:
                        if (!link_state) {
                                bond_propose_link_state(slave, BOND_LINK_DOWN);
@@ -3322,7 +3322,7 @@ static int bond_slave_netdev_event(unsigned long event,
 
                if (BOND_MODE(bond) == BOND_MODE_8023AD)
                        bond_3ad_adapter_speed_duplex_changed(slave);
-               /* Fallthrough */
+               fallthrough;
        case NETDEV_DOWN:
                /* Refresh slave-array if applicable!
                 * If the setup does not use miimon or arpmon (mode-specific!),
@@ -3760,7 +3760,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
                        return -EINVAL;
 
                mii->phy_id = 0;
-               /* Fall Through */
+               fallthrough;
        case SIOCGMIIREG:
                /* We do this again just in case we were called by SIOCGMIIREG
                 * instead of SIOCGMIIPHY.
index 9df2007b5e56b50e7a5f19368533239c80c78253..38e9f80ed1ef688759c961b7d24ef02dbc61512d 100644 (file)
@@ -898,7 +898,7 @@ static void at91_irq_err_state(struct net_device *dev,
                                CAN_ERR_CRTL_TX_WARNING :
                                CAN_ERR_CRTL_RX_WARNING;
                }
-               /* fall through */
+               fallthrough;
        case CAN_STATE_ERROR_WARNING:
                /*
                 * from: ERROR_ACTIVE, ERROR_WARNING
@@ -948,7 +948,7 @@ static void at91_irq_err_state(struct net_device *dev,
                netdev_dbg(dev, "Error Active\n");
                cf->can_id |= CAN_ERR_PROT;
                cf->data[2] = CAN_ERR_PROT_ACTIVE;
-               /* fall through */
+               fallthrough;
        case CAN_STATE_ERROR_WARNING:
                reg_idr = AT91_IRQ_ERRA | AT91_IRQ_WARN | AT91_IRQ_BOFF;
                reg_ier = AT91_IRQ_ERRP;
index 6ad83a88103950c5eafa6ecab4983ca17673e3f3..9469d4421afe5dfccadcda9f0227cd583e8d06e3 100644 (file)
@@ -659,7 +659,7 @@ static int pciefd_can_probe(struct pciefd_board *pciefd)
                pciefd_can_writereg(priv, CANFD_CLK_SEL_80MHZ,
                                    PCIEFD_REG_CAN_CLK_SEL);
 
-               /* fall through */
+               fallthrough;
        case CANFD_CLK_SEL_80MHZ:
                priv->ucan.can.clock.freq = 80 * 1000 * 1000;
                break;
index d7222ba466225cd423c9974fd65c76dac965ad03..d7c2ec529b8f131f34f7e9bd5c93dc8e3dc8929a 100644 (file)
@@ -150,7 +150,7 @@ static void sp_populate_of(struct sja1000_priv *priv, struct device_node *of)
                priv->read_reg = sp_read_reg16;
                priv->write_reg = sp_write_reg16;
                break;
-       case 1: /* fallthrough */
+       case 1:
        default:
                priv->read_reg = sp_read_reg8;
                priv->write_reg = sp_write_reg8;
index 91cdc0a2b1a740e81aba847551528a7afaed0fef..b4a39f0449ba4be95af334d4c30dcbd84465e7d4 100644 (file)
@@ -153,7 +153,7 @@ static void slc_bump(struct slcan *sl)
        switch (*cmd) {
        case 'r':
                cf.can_id = CAN_RTR_FLAG;
-               /* fallthrough */
+               fallthrough;
        case 't':
                /* store dlc ASCII value and terminate SFF CAN ID string */
                cf.can_dlc = sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN];
@@ -163,7 +163,7 @@ static void slc_bump(struct slcan *sl)
                break;
        case 'R':
                cf.can_id = CAN_RTR_FLAG;
-               /* fallthrough */
+               fallthrough;
        case 'T':
                cf.can_id |= CAN_EFF_FLAG;
                /* store dlc ASCII value and terminate EFF CAN ID string */
index 5009ff29494113956d08d9f0692b2aeb5650c49e..d17608870f2d2f0989151a127236adeca76e7a52 100644 (file)
@@ -864,7 +864,7 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
                        if (new_state >= CAN_STATE_ERROR_WARNING &&
                            new_state <= CAN_STATE_BUS_OFF)
                                priv->can.can_stats.error_warning++;
-                       /* fall through */
+                       fallthrough;
                case CAN_STATE_ERROR_WARNING:
                        if (new_state >= CAN_STATE_ERROR_PASSIVE &&
                            new_state <= CAN_STATE_BUS_OFF)
index d2539c95adb65cc24cc7bdb73a954d721071d1a1..66d0198e7834db52db71ed6369a4c8075f0cc40e 100644 (file)
@@ -415,7 +415,7 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,
                        new_state = CAN_STATE_ERROR_WARNING;
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case CAN_STATE_ERROR_WARNING:
                if (n & PCAN_USB_ERROR_BUS_HEAVY) {
index 0b7766b715fd22a26adaecb6491e69bef7d2798b..d91df34e7fa8800f6931e7d4dade99c05a62dea4 100644 (file)
@@ -345,7 +345,7 @@ static netdev_tx_t peak_usb_ndo_start_xmit(struct sk_buff *skb,
                default:
                        netdev_warn(netdev, "tx urb submitting failed err=%d\n",
                                    err);
-                       /* fall through */
+                       fallthrough;
                case -ENOENT:
                        /* cable unplugged */
                        stats->tx_dropped++;
index 53cb2f72bdd0574b4fe6bcd654dd12cf57179546..1689ab387612062e013bec742ae19927e612b37d 100644 (file)
@@ -133,10 +133,10 @@ static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, int id, ...)
        switch (id) {
        case PCAN_USBPRO_TXMSG8:
                i += 4;
-               /* fall through */
+               fallthrough;
        case PCAN_USBPRO_TXMSG4:
                i += 4;
-               /* fall through */
+               fallthrough;
        case PCAN_USBPRO_TXMSG0:
                *pc++ = va_arg(ap, int);
                *pc++ = va_arg(ap, int);
index 0837ae0e0c5e2193a0e367596c3c9ff1bba830bb..e731db900ee02a43fc15b06ed54553b4253dd8d2 100644 (file)
@@ -1061,7 +1061,7 @@ static void b53_force_port_config(struct b53_device *dev, int port,
        switch (speed) {
        case 2000:
                reg |= PORT_OVERRIDE_SPEED_2000M;
-               /* fallthrough */
+               fallthrough;
        case SPEED_1000:
                reg |= PORT_OVERRIDE_SPEED_1000M;
                break;
index 629bf14128a283ef1deeb089396fb90fff5bb17a..5ae3d9783b68cfb424eae1bced0b571181510d08 100644 (file)
@@ -170,7 +170,7 @@ void b53_serdes_phylink_validate(struct b53_device *dev, int port,
        switch (lane) {
        case 0:
                phylink_set(supported, 2500baseX_Full);
-               /* fallthrough */
+               fallthrough;
        case 1:
                phylink_set(supported, 1000baseX_Full);
                break;
index bafddb35f3a990b02ce0de5613c2b224cfa747c8..5ebff986a1ac74a52e13e592068fec907e55f411 100644 (file)
@@ -566,7 +566,7 @@ static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port,
        switch (state->interface) {
        case PHY_INTERFACE_MODE_RGMII:
                id_mode_dis = 1;
-               /* fallthrough */
+               fallthrough;
        case PHY_INTERFACE_MODE_RGMII_TXID:
                port_mode = EXT_GPHY;
                break;
index 8f1d15ea15d9a75656b8cd2c8055c6337f86b49f..f5779e15237781d9aa857ba8af8489b169a45d79 100644 (file)
@@ -932,11 +932,19 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port)
        ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_ENABLE, true);
 
        if (cpu_port) {
+               if (!p->interface && dev->compat_interface) {
+                       dev_warn(dev->dev,
+                                "Using legacy switch \"phy-mode\" property, because it is missing on port %d node. "
+                                "Please update your device tree.\n",
+                                port);
+                       p->interface = dev->compat_interface;
+               }
+
                /* Configure MII interface for proper network communication. */
                ksz_read8(dev, REG_PORT_5_CTRL_6, &data8);
                data8 &= ~PORT_INTERFACE_TYPE;
                data8 &= ~PORT_GMII_1GPS_MODE;
-               switch (dev->interface) {
+               switch (p->interface) {
                case PHY_INTERFACE_MODE_MII:
                        p->phydev.speed = SPEED_100;
                        break;
@@ -952,11 +960,11 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port)
                default:
                        data8 &= ~PORT_RGMII_ID_IN_ENABLE;
                        data8 &= ~PORT_RGMII_ID_OUT_ENABLE;
-                       if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
-                           dev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+                       if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+                           p->interface == PHY_INTERFACE_MODE_RGMII_RXID)
                                data8 |= PORT_RGMII_ID_IN_ENABLE;
-                       if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
-                           dev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
+                       if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+                           p->interface == PHY_INTERFACE_MODE_RGMII_TXID)
                                data8 |= PORT_RGMII_ID_OUT_ENABLE;
                        data8 |= PORT_GMII_1GPS_MODE;
                        data8 |= PORT_INTERFACE_RGMII;
@@ -1252,7 +1260,7 @@ static int ksz8795_switch_init(struct ksz_device *dev)
        }
 
        /* set the real number of ports */
-       dev->ds->num_ports = dev->port_cnt;
+       dev->ds->num_ports = dev->port_cnt + 1;
 
        return 0;
 }
index dc999406ce866b7d0750be346f60939625070158..2f5506ac7d19179245d75862f0249ff936ffd503 100644 (file)
@@ -1083,7 +1083,7 @@ static phy_interface_t ksz9477_get_interface(struct ksz_device *dev, int port)
                interface = PHY_INTERFACE_MODE_GMII;
                if (gbit)
                        break;
-               /* fall through */
+               fallthrough;
        case 0:
                interface = PHY_INTERFACE_MODE_MII;
                break;
@@ -1208,7 +1208,7 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
 
                /* configure MAC to 1G & RGMII mode */
                ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8);
-               switch (dev->interface) {
+               switch (p->interface) {
                case PHY_INTERFACE_MODE_MII:
                        ksz9477_set_xmii(dev, 0, &data8);
                        ksz9477_set_gbit(dev, false, &data8);
@@ -1229,11 +1229,11 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
                        ksz9477_set_gbit(dev, true, &data8);
                        data8 &= ~PORT_RGMII_ID_IG_ENABLE;
                        data8 &= ~PORT_RGMII_ID_EG_ENABLE;
-                       if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
-                           dev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+                       if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+                           p->interface == PHY_INTERFACE_MODE_RGMII_RXID)
                                data8 |= PORT_RGMII_ID_IG_ENABLE;
-                       if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
-                           dev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
+                       if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+                           p->interface == PHY_INTERFACE_MODE_RGMII_TXID)
                                data8 |= PORT_RGMII_ID_EG_ENABLE;
                        p->phydev.speed = SPEED_1000;
                        break;
@@ -1269,23 +1269,32 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds)
                        dev->cpu_port = i;
                        dev->host_mask = (1 << dev->cpu_port);
                        dev->port_mask |= dev->host_mask;
+                       p = &dev->ports[i];
 
                        /* Read from XMII register to determine host port
                         * interface.  If set specifically in device tree
                         * note the difference to help debugging.
                         */
                        interface = ksz9477_get_interface(dev, i);
-                       if (!dev->interface)
-                               dev->interface = interface;
-                       if (interface && interface != dev->interface)
+                       if (!p->interface) {
+                               if (dev->compat_interface) {
+                                       dev_warn(dev->dev,
+                                                "Using legacy switch \"phy-mode\" property, because it is missing on port %d node. "
+                                                "Please update your device tree.\n",
+                                                i);
+                                       p->interface = dev->compat_interface;
+                               } else {
+                                       p->interface = interface;
+                               }
+                       }
+                       if (interface && interface != p->interface)
                                dev_info(dev->dev,
                                         "use %s instead of %s\n",
-                                         phy_modes(dev->interface),
+                                         phy_modes(p->interface),
                                          phy_modes(interface));
 
                        /* enable cpu port */
                        ksz9477_port_setup(dev, i, true);
-                       p = &dev->ports[dev->cpu_port];
                        p->vid_member = dev->port_mask;
                        p->on = 1;
                }
index 8d53b12d40a8d1e87af3c054e78ed02b1710538d..8e755b50c9c1b3732c374c5b6709716942cc4518 100644 (file)
@@ -388,6 +388,8 @@ int ksz_switch_register(struct ksz_device *dev,
                        const struct ksz_dev_ops *ops)
 {
        phy_interface_t interface;
+       struct device_node *port;
+       unsigned int port_num;
        int ret;
 
        if (dev->pdata)
@@ -421,10 +423,19 @@ int ksz_switch_register(struct ksz_device *dev,
        /* Host port interface will be self detected, or specifically set in
         * device tree.
         */
+       for (port_num = 0; port_num < dev->port_cnt; ++port_num)
+               dev->ports[port_num].interface = PHY_INTERFACE_MODE_NA;
        if (dev->dev->of_node) {
                ret = of_get_phy_mode(dev->dev->of_node, &interface);
                if (ret == 0)
-                       dev->interface = interface;
+                       dev->compat_interface = interface;
+               for_each_available_child_of_node(dev->dev->of_node, port) {
+                       if (of_property_read_u32(port, "reg", &port_num))
+                               continue;
+                       if (port_num >= dev->port_cnt)
+                               return -EINVAL;
+                       of_get_phy_mode(port, &dev->ports[port_num].interface);
+               }
                dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
                                                         "microchip,synclko-125");
        }
index 206838160f4940fe345c62be6a61cc9bad77ade5..cf866e48ff664b649bca703b56180dd099f2ac79 100644 (file)
@@ -39,6 +39,7 @@ struct ksz_port {
        u32 freeze:1;                   /* MIB counter freeze is enabled */
 
        struct ksz_port_mib mib;
+       phy_interface_t interface;
 };
 
 struct ksz_device {
@@ -72,7 +73,7 @@ struct ksz_device {
        int mib_cnt;
        int mib_port_cnt;
        int last_port;                  /* ports after that not used */
-       phy_interface_t interface;
+       phy_interface_t compat_interface;
        u32 regs_size;
        bool phy_errata_9477;
        bool synclko_125;
index 8dcb8a49ab67f750b273fef012c9ce877050b9cd..1aaf47a0da2b35523a8af8b886c532de20d236db 100644 (file)
@@ -566,7 +566,7 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface)
        case P5_INTF_SEL_PHY_P0:
                /* MT7530_P5_MODE_GPHY_P0: 2nd GMAC -> P5 -> P0 */
                val |= MHWTRAP_PHY0_SEL;
-               /* fall through */
+               fallthrough;
        case P5_INTF_SEL_PHY_P4:
                /* MT7530_P5_MODE_GPHY_P4: 2nd GMAC -> P5 -> P4 */
                val &= ~MHWTRAP_P5_MAC_SEL & ~MHWTRAP_P5_DIS;
@@ -1326,14 +1326,17 @@ mt7530_setup(struct dsa_switch *ds)
 
                        if (phy_node->parent == priv->dev->of_node->parent) {
                                ret = of_get_phy_mode(mac_np, &interface);
-                               if (ret && ret != -ENODEV)
+                               if (ret && ret != -ENODEV) {
+                                       of_node_put(mac_np);
                                        return ret;
+                               }
                                id = of_mdio_parse_addr(ds->dev, phy_node);
                                if (id == 0)
                                        priv->p5_intf_sel = P5_INTF_SEL_PHY_P0;
                                if (id == 4)
                                        priv->p5_intf_sel = P5_INTF_SEL_PHY_P4;
                        }
+                       of_node_put(mac_np);
                        of_node_put(phy_node);
                        break;
                }
@@ -1501,7 +1504,7 @@ unsupported:
                phylink_set(mask, 100baseT_Full);
 
                if (state->interface != PHY_INTERFACE_MODE_MII) {
-                       phylink_set(mask, 1000baseT_Half);
+                       /* This switch only supports 1G full-duplex. */
                        phylink_set(mask, 1000baseT_Full);
                        if (port == 5)
                                phylink_set(mask, 1000baseX_Full);
index 7a71c9902e73e82437803fbf50be74c7766221dc..f0dbc05e30a4de50c32c868994c28dd62f1f4b2f 100644 (file)
@@ -875,7 +875,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip,
                break;
        case STATS_TYPE_BANK1:
                reg = bank1_select;
-               /* fall through */
+               fallthrough;
        case STATS_TYPE_BANK0:
                reg |= s->reg | histogram;
                mv88e6xxx_g1_stats_read(chip, reg, &low);
index c69d9592a2b79487186909dd96839c1918c6979d..01427cd084481d80c03c40a952bb86ffff5a8131 100644 (file)
@@ -400,6 +400,7 @@ static int felix_parse_ports_node(struct felix *felix,
                if (err < 0) {
                        dev_err(dev, "Unsupported PHY mode %s on port %d\n",
                                phy_modes(phy_mode), port);
+                       of_node_put(child);
                        return err;
                }
 
@@ -584,7 +585,10 @@ static int felix_setup(struct dsa_switch *ds)
        if (err)
                return err;
 
-       ocelot_init(ocelot);
+       err = ocelot_init(ocelot);
+       if (err)
+               return err;
+
        if (ocelot->ptp) {
                err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
                if (err) {
@@ -639,10 +643,13 @@ static void felix_teardown(struct dsa_switch *ds)
 {
        struct ocelot *ocelot = ds->priv;
        struct felix *felix = ocelot_to_felix(ocelot);
+       int port;
 
        if (felix->info->mdio_bus_free)
                felix->info->mdio_bus_free(ocelot);
 
+       for (port = 0; port < ocelot->num_phys_ports; port++)
+               ocelot_deinit_port(ocelot, port);
        ocelot_deinit_timestamp(ocelot);
        /* stop workqueue thread */
        ocelot_deinit(ocelot);
index 9b720c8ddfc3b20a6c7e7b07b50bd14963714084..6855c94256f8e5fab4a653359f25fdf5bdc79574 100644 (file)
@@ -645,17 +645,17 @@ static struct vcap_field vsc9959_vcap_is2_keys[] = {
        [VCAP_IS2_HK_DIP_EQ_SIP]                = {118,   1},
        /* IP4_TCP_UDP (TYPE=100) */
        [VCAP_IS2_HK_TCP]                       = {119,   1},
-       [VCAP_IS2_HK_L4_SPORT]                  = {120,  16},
-       [VCAP_IS2_HK_L4_DPORT]                  = {136,  16},
+       [VCAP_IS2_HK_L4_DPORT]                  = {120,  16},
+       [VCAP_IS2_HK_L4_SPORT]                  = {136,  16},
        [VCAP_IS2_HK_L4_RNG]                    = {152,   8},
        [VCAP_IS2_HK_L4_SPORT_EQ_DPORT]         = {160,   1},
        [VCAP_IS2_HK_L4_SEQUENCE_EQ0]           = {161,   1},
-       [VCAP_IS2_HK_L4_URG]                    = {162,   1},
-       [VCAP_IS2_HK_L4_ACK]                    = {163,   1},
-       [VCAP_IS2_HK_L4_PSH]                    = {164,   1},
-       [VCAP_IS2_HK_L4_RST]                    = {165,   1},
-       [VCAP_IS2_HK_L4_SYN]                    = {166,   1},
-       [VCAP_IS2_HK_L4_FIN]                    = {167,   1},
+       [VCAP_IS2_HK_L4_FIN]                    = {162,   1},
+       [VCAP_IS2_HK_L4_SYN]                    = {163,   1},
+       [VCAP_IS2_HK_L4_RST]                    = {164,   1},
+       [VCAP_IS2_HK_L4_PSH]                    = {165,   1},
+       [VCAP_IS2_HK_L4_ACK]                    = {166,   1},
+       [VCAP_IS2_HK_L4_URG]                    = {167,   1},
        [VCAP_IS2_HK_L4_1588_DOM]               = {168,   8},
        [VCAP_IS2_HK_L4_1588_VER]               = {176,   4},
        /* IP4_OTHER (TYPE=101) */
index 625b1891d955dae69dc055e2e6e9dffe29dd7327..29df0797ecf52f469a01fa23e4337608143adeba 100644 (file)
@@ -659,17 +659,17 @@ static struct vcap_field vsc9953_vcap_is2_keys[] = {
        [VCAP_IS2_HK_DIP_EQ_SIP]                = {122,   1},
        /* IP4_TCP_UDP (TYPE=100) */
        [VCAP_IS2_HK_TCP]                       = {123,   1},
-       [VCAP_IS2_HK_L4_SPORT]                  = {124,  16},
-       [VCAP_IS2_HK_L4_DPORT]                  = {140,  16},
+       [VCAP_IS2_HK_L4_DPORT]                  = {124,  16},
+       [VCAP_IS2_HK_L4_SPORT]                  = {140,  16},
        [VCAP_IS2_HK_L4_RNG]                    = {156,   8},
        [VCAP_IS2_HK_L4_SPORT_EQ_DPORT]         = {164,   1},
        [VCAP_IS2_HK_L4_SEQUENCE_EQ0]           = {165,   1},
-       [VCAP_IS2_HK_L4_URG]                    = {166,   1},
-       [VCAP_IS2_HK_L4_ACK]                    = {167,   1},
-       [VCAP_IS2_HK_L4_PSH]                    = {168,   1},
-       [VCAP_IS2_HK_L4_RST]                    = {169,   1},
-       [VCAP_IS2_HK_L4_SYN]                    = {170,   1},
-       [VCAP_IS2_HK_L4_FIN]                    = {171,   1},
+       [VCAP_IS2_HK_L4_FIN]                    = {166,   1},
+       [VCAP_IS2_HK_L4_SYN]                    = {167,   1},
+       [VCAP_IS2_HK_L4_RST]                    = {168,   1},
+       [VCAP_IS2_HK_L4_PSH]                    = {169,   1},
+       [VCAP_IS2_HK_L4_ACK]                    = {170,   1},
+       [VCAP_IS2_HK_L4_URG]                    = {171,   1},
        /* IP4_OTHER (TYPE=101) */
        [VCAP_IS2_HK_IP4_L3_PROTO]              = {123,   8},
        [VCAP_IS2_HK_L3_PAYLOAD]                = {131,  56},
@@ -1008,7 +1008,7 @@ static const struct felix_info seville_info_vsc9953 = {
        .vcap_is2_keys          = vsc9953_vcap_is2_keys,
        .vcap_is2_actions       = vsc9953_vcap_is2_actions,
        .vcap                   = vsc9953_vcap_props,
-       .shared_queue_sz        = 128 * 1024,
+       .shared_queue_sz        = 2048 * 1024,
        .num_mact_rows          = 2048,
        .num_ports              = 10,
        .mdio_bus_alloc         = vsc9953_mdio_bus_alloc,
index 8f40fbf70a82b83d33931e1ccc7fc3eadbf6e942..a8c5a934c3d308ac4ee77e65f22d7b07b2756a6b 100644 (file)
@@ -452,13 +452,19 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port,
                                return ret;
 
                        if (vid == vlanmc.vid) {
-                               /* clear VLAN member configurations */
-                               vlanmc.vid = 0;
-                               vlanmc.priority = 0;
-                               vlanmc.member = 0;
-                               vlanmc.untag = 0;
-                               vlanmc.fid = 0;
-
+                               /* Remove this port from the VLAN */
+                               vlanmc.member &= ~BIT(port);
+                               vlanmc.untag &= ~BIT(port);
+                               /*
+                                * If no ports are members of this VLAN
+                                * anymore then clear the whole member
+                                * config so it can be reused.
+                                */
+                               if (!vlanmc.member && vlanmc.untag) {
+                                       vlanmc.vid = 0;
+                                       vlanmc.priority = 0;
+                                       vlanmc.fid = 0;
+                               }
                                ret = smi->ops->set_vlan_mc(smi, i, &vlanmc);
                                if (ret) {
                                        dev_err(smi->dev,
index c3f6f124e5f01ba9508e0dd733db1eae3c44af4e..5a28dfb36ec36acbcc2e0189f045f8a55dd39c38 100644 (file)
@@ -3415,7 +3415,7 @@ static int sja1105_check_device_id(struct sja1105_private *priv)
 
        sja1105_unpack(prod_id, &part_no, 19, 4, SJA1105_SIZE_DEVICE_ID);
 
-       for (match = sja1105_dt_ids; match->compatible; match++) {
+       for (match = sja1105_dt_ids; match->compatible[0]; match++) {
                const struct sja1105_info *info = match->data;
 
                /* Is what's been probed in our match table at all? */
index 139d0120f5114e416e2ef71effba41a50e66e668..667f38c9e4c63051131966e1349cf5774b37d594 100644 (file)
@@ -1259,14 +1259,14 @@ el3_up(struct net_device *dev)
                                        pr_cont("Forcing 3c5x9b full-duplex mode");
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        case 8:
                                /* set full-duplex mode based on eeprom config setting */
                                if ((sw_info & 0x000f) && (sw_info & 0x8000)) {
                                        pr_cont("Setting 3c5x9b full-duplex mode (from EEPROM configuration bit)");
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                /* xcvr=(0 || 4) OR user has an old 3c5x9 non "B" model */
                                pr_cont("Setting 3c5x9/3c5x9B half-duplex mode");
index bd0ada4e81b0f0c7495e6a38173593d08934ffc4..f66e7fb9a2bb9357884389c47cadbe43cf7b9e93 100644 (file)
@@ -1046,7 +1046,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get the address of the PHY in use. */
                data->phy_id = phy;
-               /* fall through */
+               fallthrough;
        case SIOCGMIIREG:               /* Read the specified MII register. */
                {
                        int saved_window;
index 08db4c9da2fa8ab27fe371f7a2551344c659ea43..a00b36f91d9f21b7b77b3663d6bf3d1e83b7aae7 100644 (file)
@@ -610,7 +610,7 @@ static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
     switch (cmd) {
     case SIOCGMIIPHY:
        data->phy_id = info->phy_id;
-       /* Fall through */
+       fallthrough;
     case SIOCGMIIREG:          /* Read MII PHY register. */
        data->val_out = mdio_read(mii_addr, data->phy_id, data->reg_num & 0x1f);
        return 0;
index 645efac6310dde9c9eab6bd128861beed0acece6..164c3ed550bf1bbaa6bb075db68b7dd14e6f747a 100644 (file)
@@ -1108,7 +1108,7 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
     switch (cmd) {
     case SIOCGMIIPHY:
        data->phy_id = info->phy_id;
-       /* fall through */
+       fallthrough;
     case SIOCGMIIREG:          /* Read MII PHY register. */
        data->val_out = mdio_read(mii_addr, data->phy_id, data->reg_num & 0x1f);
        return 0;
index 6234fcd844eead5f8e11f0b9010ce1b3418fd043..696517eae77f0aeae178181c52d4b39021bc16f8 100644 (file)
@@ -1712,13 +1712,13 @@ static bool slic_is_fiber(unsigned short subdev)
 {
        switch (subdev) {
        /* Mojave */
-       case PCI_SUBDEVICE_ID_ALACRITECH_1000X1F: /* fallthrough */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SES1001F: /* fallthrough */
+       case PCI_SUBDEVICE_ID_ALACRITECH_1000X1F:
+       case PCI_SUBDEVICE_ID_ALACRITECH_SES1001F: fallthrough;
        /* Oasis */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2002XF: /* fallthrough */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2001XF: /* fallthrough */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2104EF: /* fallthrough */
-       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2102EF: /* fallthrough */
+       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2002XF:
+       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2001XF:
+       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2104EF:
+       case PCI_SUBDEVICE_ID_ALACRITECH_SEN2102EF:
                return true;
        }
        return false;
index ac86fcae1582d6eac2b1a64ec35fe9fb5c20beeb..8470c836fa188a18446f0d00566cf93791f66394 100644 (file)
@@ -547,7 +547,7 @@ static int acenic_probe_one(struct pci_dev *pdev,
                               ap->name);
                        break;
                }
-               /* Fall through */
+               fallthrough;
        case PCI_VENDOR_ID_SGI:
                printk(KERN_INFO "%s: SGI AceNIC ", ap->name);
                break;
index b6c43b58ed3d4360dd76ca7dc187f96b41f2edb9..960d483e899729781fa4170104f4eb60ef5d1f2f 100644 (file)
@@ -1475,7 +1475,7 @@ static int amd8111e_ioctl(struct net_device *dev , struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = lp->ext_phy_addr;
 
-       /* fallthru */
+               fallthrough;
        case SIOCGMIIREG:
 
                spin_lock_irq(&lp->lock);
index 43294a148f8a765f65800ce1a8534bc0d6af5617..4ba75551cb1794fad6fbe429adad8478d049783b 100644 (file)
@@ -1538,7 +1538,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
        /* PTP v2, UDP, any kind of event packet */
        case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
-               /* Fall through - to PTP v1, UDP, any kind of event packet */
+               fallthrough;    /* to PTP v1, UDP, any kind of event packet */
        case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
@@ -1549,7 +1549,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
        /* PTP v2, UDP, Sync packet */
        case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
-               /* Fall through - to PTP v1, UDP, Sync packet */
+               fallthrough;    /* to PTP v1, UDP, Sync packet */
        case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
@@ -1560,7 +1560,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
        /* PTP v2, UDP, Delay_req packet */
        case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
-               /* Fall through - to PTP v1, UDP, Delay_req packet */
+               fallthrough;    /* to PTP v1, UDP, Delay_req packet */
        case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
index 46c3c1ca38d60c06ea4c90ee26fb709971c71d0d..859ded0c06b050a896cf002ab6ba258e53bacb40 100644 (file)
@@ -166,6 +166,7 @@ enum xgbe_port_mode {
        XGBE_PORT_MODE_10GBASE_T,
        XGBE_PORT_MODE_10GBASE_R,
        XGBE_PORT_MODE_SFP,
+       XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG,
        XGBE_PORT_MODE_MAX,
 };
 
@@ -1634,6 +1635,7 @@ static enum xgbe_mode xgbe_phy_an73_redrv_outcome(struct xgbe_prv_data *pdata)
        if (ad_reg & 0x80) {
                switch (phy_data->port_mode) {
                case XGBE_PORT_MODE_BACKPLANE:
+               case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
                        mode = XGBE_MODE_KR;
                        break;
                default:
@@ -1643,6 +1645,7 @@ static enum xgbe_mode xgbe_phy_an73_redrv_outcome(struct xgbe_prv_data *pdata)
        } else if (ad_reg & 0x20) {
                switch (phy_data->port_mode) {
                case XGBE_PORT_MODE_BACKPLANE:
+               case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
                        mode = XGBE_MODE_KX_1000;
                        break;
                case XGBE_PORT_MODE_1000BASE_X:
@@ -1782,6 +1785,7 @@ static void xgbe_phy_an_advertising(struct xgbe_prv_data *pdata,
 
        switch (phy_data->port_mode) {
        case XGBE_PORT_MODE_BACKPLANE:
+       case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
                XGBE_SET_ADV(dlks, 10000baseKR_Full);
                break;
        case XGBE_PORT_MODE_BACKPLANE_2500:
@@ -1874,6 +1878,7 @@ static enum xgbe_an_mode xgbe_phy_an_mode(struct xgbe_prv_data *pdata)
        switch (phy_data->port_mode) {
        case XGBE_PORT_MODE_BACKPLANE:
                return XGBE_AN_MODE_CL73;
+       case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
        case XGBE_PORT_MODE_BACKPLANE_2500:
                return XGBE_AN_MODE_NONE;
        case XGBE_PORT_MODE_1000BASE_T:
@@ -2156,6 +2161,7 @@ static enum xgbe_mode xgbe_phy_switch_mode(struct xgbe_prv_data *pdata)
 
        switch (phy_data->port_mode) {
        case XGBE_PORT_MODE_BACKPLANE:
+       case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
                return xgbe_phy_switch_bp_mode(pdata);
        case XGBE_PORT_MODE_BACKPLANE_2500:
                return xgbe_phy_switch_bp_2500_mode(pdata);
@@ -2251,6 +2257,7 @@ static enum xgbe_mode xgbe_phy_get_mode(struct xgbe_prv_data *pdata,
 
        switch (phy_data->port_mode) {
        case XGBE_PORT_MODE_BACKPLANE:
+       case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
                return xgbe_phy_get_bp_mode(speed);
        case XGBE_PORT_MODE_BACKPLANE_2500:
                return xgbe_phy_get_bp_2500_mode(speed);
@@ -2426,6 +2433,7 @@ static bool xgbe_phy_use_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode)
 
        switch (phy_data->port_mode) {
        case XGBE_PORT_MODE_BACKPLANE:
+       case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
                return xgbe_phy_use_bp_mode(pdata, mode);
        case XGBE_PORT_MODE_BACKPLANE_2500:
                return xgbe_phy_use_bp_2500_mode(pdata, mode);
@@ -2515,6 +2523,7 @@ static bool xgbe_phy_valid_speed(struct xgbe_prv_data *pdata, int speed)
 
        switch (phy_data->port_mode) {
        case XGBE_PORT_MODE_BACKPLANE:
+       case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
                return xgbe_phy_valid_speed_bp_mode(speed);
        case XGBE_PORT_MODE_BACKPLANE_2500:
                return xgbe_phy_valid_speed_bp_2500_mode(speed);
@@ -2792,6 +2801,7 @@ static bool xgbe_phy_port_mode_mismatch(struct xgbe_prv_data *pdata)
 
        switch (phy_data->port_mode) {
        case XGBE_PORT_MODE_BACKPLANE:
+       case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
                if ((phy_data->port_speeds & XGBE_PHY_PORT_SPEED_1000) ||
                    (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10000))
                        return false;
@@ -2844,6 +2854,7 @@ static bool xgbe_phy_conn_type_mismatch(struct xgbe_prv_data *pdata)
 
        switch (phy_data->port_mode) {
        case XGBE_PORT_MODE_BACKPLANE:
+       case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
        case XGBE_PORT_MODE_BACKPLANE_2500:
                if (phy_data->conn_type == XGBE_CONN_TYPE_BACKPLANE)
                        return false;
@@ -3160,6 +3171,8 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata)
        /* Backplane support */
        case XGBE_PORT_MODE_BACKPLANE:
                XGBE_SET_SUP(lks, Autoneg);
+               fallthrough;
+       case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
                XGBE_SET_SUP(lks, Pause);
                XGBE_SET_SUP(lks, Asym_Pause);
                XGBE_SET_SUP(lks, Backplane);
index 0187dbf3b87dfcdaa2dc1bf39f37a4d4bf47c7a6..54cdafdd067db3d19ac81dd7132e09a13fe86445 100644 (file)
@@ -153,6 +153,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv)
        if (IS_ERR(data->reset_gpio)) {
                error = PTR_ERR(data->reset_gpio);
                dev_err(priv->dev, "Failed to request gpio: %d\n", error);
+               mdiobus_free(bus);
                return error;
        }
 
index dfed9ade6950ca8769f57e7470422822ebf63b7f..0762d5d1a810eb2a63d6fc88004ad94e11a4f4a3 100644 (file)
@@ -2491,8 +2491,10 @@ static int bcm_sysport_probe(struct platform_device *pdev)
        priv->tx_rings = devm_kcalloc(&pdev->dev, txq,
                                      sizeof(struct bcm_sysport_tx_ring),
                                      GFP_KERNEL);
-       if (!priv->tx_rings)
-               return -ENOMEM;
+       if (!priv->tx_rings) {
+               ret = -ENOMEM;
+               goto err_free_netdev;
+       }
 
        priv->is_lite = params->is_lite;
        priv->num_rx_desc_words = params->num_rx_desc_words;
index 34d18302b1a38e179be8615101f979768a1fd4fb..a5fd161ab5ee15f2b5a5aea77abdf49cac41e2d0 100644 (file)
@@ -217,7 +217,7 @@ static int bgmac_probe(struct bcma_device *core)
        /* BCM 471X/535X family */
        case BCMA_CHIP_ID_BCM4716:
                bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-               /* fallthrough */
+               fallthrough;
        case BCMA_CHIP_ID_BCM47162:
                bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL2;
                bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
index 6795b6d95f54d2c1854a396a38376bfbe10a3c22..f37f1c58f3689308082df39fc30ad41dbb4920d9 100644 (file)
@@ -131,7 +131,7 @@ static void bgmac_nicpm_speed_set(struct net_device *net_dev)
        switch (bgmac->net_dev->phydev->speed) {
        default:
                netdev_err(net_dev, "Unsupported speed. Defaulting to 1000Mb\n");
-               /* fall through */
+               fallthrough;
        case SPEED_1000:
                val |= NICPM_IOMUX_CTRL_SPD_1000M << NICPM_IOMUX_CTRL_SPD_SHIFT;
                break;
index c8cc14eadbb4af8ae3816707741d0f4a497ab8ae..3e8a179f39db48c8d7f92ab34703636ac5b07d1d 100644 (file)
@@ -1337,13 +1337,13 @@ bnx2_set_mac_link(struct bnx2 *bp)
                                        val |= BNX2_EMAC_MODE_PORT_MII_10M;
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        case SPEED_100:
                                val |= BNX2_EMAC_MODE_PORT_MII;
                                break;
                        case SPEED_2500:
                                val |= BNX2_EMAC_MODE_25G_MODE;
-                               /* fall through */
+                               fallthrough;
                        case SPEED_1000:
                                val |= BNX2_EMAC_MODE_PORT_GMII;
                                break;
@@ -1995,26 +1995,26 @@ bnx2_remote_phy_event(struct bnx2 *bp)
                switch (speed) {
                        case BNX2_LINK_STATUS_10HALF:
                                bp->duplex = DUPLEX_HALF;
-                               /* fall through */
+                               fallthrough;
                        case BNX2_LINK_STATUS_10FULL:
                                bp->line_speed = SPEED_10;
                                break;
                        case BNX2_LINK_STATUS_100HALF:
                                bp->duplex = DUPLEX_HALF;
-                               /* fall through */
+                               fallthrough;
                        case BNX2_LINK_STATUS_100BASE_T4:
                        case BNX2_LINK_STATUS_100FULL:
                                bp->line_speed = SPEED_100;
                                break;
                        case BNX2_LINK_STATUS_1000HALF:
                                bp->duplex = DUPLEX_HALF;
-                               /* fall through */
+                               fallthrough;
                        case BNX2_LINK_STATUS_1000FULL:
                                bp->line_speed = SPEED_1000;
                                break;
                        case BNX2_LINK_STATUS_2500HALF:
                                bp->duplex = DUPLEX_HALF;
-                               /* fall through */
+                               fallthrough;
                        case BNX2_LINK_STATUS_2500FULL:
                                bp->line_speed = SPEED_2500;
                                break;
@@ -7856,7 +7856,7 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = bp->phy_addr;
 
-               /* fallthru */
+               fallthrough;
        case SIOCGMIIREG: {
                u32 mii_regval;
 
index 1426c691c7c4a416f4f8227ccb0e2d5dbd039107..4e85e7dbc2be310aaecf87bc40af1f41d198946e 100644 (file)
@@ -4712,14 +4712,14 @@ static void bnx2x_sync_link(struct link_params *params,
                        LINK_STATUS_SPEED_AND_DUPLEX_MASK) {
                case LINK_10THD:
                        vars->duplex = DUPLEX_HALF;
-                       /* Fall thru */
+                       fallthrough;
                case LINK_10TFD:
                        vars->line_speed = SPEED_10;
                        break;
 
                case LINK_100TXHD:
                        vars->duplex = DUPLEX_HALF;
-                       /* Fall thru */
+                       fallthrough;
                case LINK_100T4:
                case LINK_100TXFD:
                        vars->line_speed = SPEED_100;
@@ -4727,14 +4727,14 @@ static void bnx2x_sync_link(struct link_params *params,
 
                case LINK_1000THD:
                        vars->duplex = DUPLEX_HALF;
-                       /* Fall thru */
+                       fallthrough;
                case LINK_1000TFD:
                        vars->line_speed = SPEED_1000;
                        break;
 
                case LINK_2500THD:
                        vars->duplex = DUPLEX_HALF;
-                       /* Fall thru */
+                       fallthrough;
                case LINK_2500TFD:
                        vars->line_speed = SPEED_2500;
                        break;
@@ -6339,7 +6339,7 @@ int bnx2x_set_led(struct link_params *params,
                 */
                if (!vars->link_up)
                        break;
-               /* fall through */
+               fallthrough;
        case LED_MODE_ON:
                if (((params->phy[EXT_PHY1].type ==
                          PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) ||
@@ -12508,13 +12508,13 @@ static void bnx2x_phy_def_cfg(struct link_params *params,
        switch (link_config  & PORT_FEATURE_LINK_SPEED_MASK) {
        case PORT_FEATURE_LINK_SPEED_10M_HALF:
                phy->req_duplex = DUPLEX_HALF;
-               /* fall through */
+               fallthrough;
        case PORT_FEATURE_LINK_SPEED_10M_FULL:
                phy->req_line_speed = SPEED_10;
                break;
        case PORT_FEATURE_LINK_SPEED_100M_HALF:
                phy->req_duplex = DUPLEX_HALF;
-               /* fall through */
+               fallthrough;
        case PORT_FEATURE_LINK_SPEED_100M_FULL:
                phy->req_line_speed = SPEED_100;
                break;
index 7f24d2689fdd77efb6204aece5949a8a636d9bf0..3c543dd7a8f306398fd02383aeb9db7354d421c4 100644 (file)
@@ -8600,11 +8600,11 @@ int bnx2x_set_int_mode(struct bnx2x *bp)
                               bp->num_queues,
                               1 + bp->num_cnic_queues);
 
-               /* fall through */
+               fallthrough;
        case BNX2X_INT_MODE_MSI:
                bnx2x_enable_msi(bp);
 
-               /* fall through */
+               fallthrough;
        case BNX2X_INT_MODE_INTX:
                bp->num_ethernet_queues = 1;
                bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues;
index 80d250a6d048e560a0210e0e493040cdc4613c94..e26f4da5a6d7e4bc4d0ac27eeaff1323ac5f24f6 100644 (file)
@@ -3258,7 +3258,7 @@ static int bnx2x_mcast_validate_e2(struct bnx2x *bp,
        /* DEL command deletes all currently configured MACs */
        case BNX2X_MCAST_CMD_DEL:
                o->set_registry_size(o, 0);
-               /* fall through */
+               fallthrough;
 
        /* RESTORE command will restore the entire multicast configuration */
        case BNX2X_MCAST_CMD_RESTORE:
@@ -3592,7 +3592,7 @@ static int bnx2x_mcast_validate_e1(struct bnx2x *bp,
        /* DEL command deletes all currently configured MACs */
        case BNX2X_MCAST_CMD_DEL:
                o->set_registry_size(o, 0);
-               /* fall through */
+               fallthrough;
 
        /* RESTORE command will restore the entire multicast configuration */
        case BNX2X_MCAST_CMD_RESTORE:
index b4476f44e3867adf125a1f598b4c18ecfb64634e..9c2f51f230351f429958ba7de932eaf0f6d8ba9c 100644 (file)
@@ -1809,7 +1809,7 @@ get_vf:
                DP(BNX2X_MSG_IOV, "got VF [%d:%d] RSS update ramrod\n",
                   vf->abs_vfid, qidx);
                bnx2x_vf_handle_rss_update_eqe(bp, vf);
-               /* fall through */
+               fallthrough;
        case EVENT_RING_OPCODE_VF_FLR:
                /* Do nothing for now */
                return 0;
@@ -2207,7 +2207,7 @@ int bnx2x_vf_free(struct bnx2x *bp, struct bnx2x_virtf *vf)
                rc = bnx2x_vf_close(bp, vf);
                if (rc)
                        goto op_err;
-               /* Fall through - to release resources */
+               fallthrough;    /* to release resources */
        case VF_ACQUIRED:
                DP(BNX2X_MSG_IOV, "about to free resources\n");
                bnx2x_vf_free_resc(bp, vf);
index 31fb5a28e1c4f59d944552be2d3f60b7a61c5bda..7b7e8b7883c80948948bcf2836b03cfe962586ed 100644 (file)
@@ -1141,6 +1141,9 @@ static int bnxt_discard_rx(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
 
 static void bnxt_queue_fw_reset_work(struct bnxt *bp, unsigned long delay)
 {
+       if (!(test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)))
+               return;
+
        if (BNXT_PF(bp))
                queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay);
        else
@@ -1157,10 +1160,12 @@ static void bnxt_queue_sp_work(struct bnxt *bp)
 
 static void bnxt_cancel_sp_work(struct bnxt *bp)
 {
-       if (BNXT_PF(bp))
+       if (BNXT_PF(bp)) {
                flush_workqueue(bnxt_pf_wq);
-       else
+       } else {
                cancel_work_sync(&bp->sp_task);
+               cancel_delayed_work_sync(&bp->fw_reset_task);
+       }
 }
 
 static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
@@ -1923,7 +1928,7 @@ u32 bnxt_fw_health_readl(struct bnxt *bp, int reg_idx)
                break;
        case BNXT_FW_HEALTH_REG_TYPE_GRC:
                reg_off = fw_health->mapped_regs[reg_idx];
-               /* fall through */
+               fallthrough;
        case BNXT_FW_HEALTH_REG_TYPE_BAR0:
                val = readl(bp->bar0 + reg_off);
                break;
@@ -1966,11 +1971,11 @@ static int bnxt_async_event_process(struct bnxt *bp,
                }
                set_bit(BNXT_LINK_SPEED_CHNG_SP_EVENT, &bp->sp_event);
        }
-       /* fall through */
+               fallthrough;
        case ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
        case ASYNC_EVENT_CMPL_EVENT_ID_PORT_PHY_CFG_CHANGE:
                set_bit(BNXT_LINK_CFG_CHANGE_SP_EVENT, &bp->sp_event);
-               /* fall through */
+               fallthrough;
        case ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
                set_bit(BNXT_LINK_CHNG_SP_EVENT, &bp->sp_event);
                break;
@@ -3777,6 +3782,7 @@ static int bnxt_hwrm_func_qstat_ext(struct bnxt *bp,
                return -EOPNOTSUPP;
 
        bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QSTATS_EXT, -1, -1);
+       req.fid = cpu_to_le16(0xffff);
        req.flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
        mutex_lock(&bp->hwrm_cmd_lock);
        rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
@@ -3847,7 +3853,7 @@ static void bnxt_init_stats(struct bnxt *bp)
                tx_masks = stats->hw_masks;
                tx_count = sizeof(struct tx_port_stats_ext) / 8;
 
-               flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
+               flags = PORT_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
                rc = bnxt_hwrm_port_qstats_ext(bp, flags);
                if (rc) {
                        mask = (1ULL << 40) - 1;
@@ -4300,7 +4306,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
        u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;
        u16 dst = BNXT_HWRM_CHNL_CHIMP;
 
-       if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
+       if (BNXT_NO_FW_ACCESS(bp))
                return -EBUSY;
 
        if (msg_len > BNXT_HWRM_MAX_REQ_LEN) {
@@ -5718,7 +5724,7 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp,
        struct hwrm_ring_free_output *resp = bp->hwrm_cmd_resp_addr;
        u16 error_code;
 
-       if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
+       if (BNXT_NO_FW_ACCESS(bp))
                return 0;
 
        bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_RING_FREE, cmpl_ring_id, -1);
@@ -6102,6 +6108,21 @@ static int bnxt_get_func_stat_ctxs(struct bnxt *bp)
        return cp + ulp_stat;
 }
 
+/* Check if a default RSS map needs to be setup.  This function is only
+ * used on older firmware that does not require reserving RX rings.
+ */
+static void bnxt_check_rss_tbl_no_rmgr(struct bnxt *bp)
+{
+       struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
+
+       /* The RSS map is valid for RX rings set to resv_rx_rings */
+       if (hw_resc->resv_rx_rings != bp->rx_nr_rings) {
+               hw_resc->resv_rx_rings = bp->rx_nr_rings;
+               if (!netif_is_rxfh_configured(bp->dev))
+                       bnxt_set_dflt_rss_indir_tbl(bp);
+       }
+}
+
 static bool bnxt_need_reserve_rings(struct bnxt *bp)
 {
        struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
@@ -6110,22 +6131,28 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp)
        int rx = bp->rx_nr_rings, stat;
        int vnic = 1, grp = rx;
 
-       if (bp->hwrm_spec_code < 0x10601)
-               return false;
-
-       if (hw_resc->resv_tx_rings != bp->tx_nr_rings)
+       if (hw_resc->resv_tx_rings != bp->tx_nr_rings &&
+           bp->hwrm_spec_code >= 0x10601)
                return true;
 
+       /* Old firmware does not need RX ring reservations but we still
+        * need to setup a default RSS map when needed.  With new firmware
+        * we go through RX ring reservations first and then set up the
+        * RSS map for the successfully reserved RX rings when needed.
+        */
+       if (!BNXT_NEW_RM(bp)) {
+               bnxt_check_rss_tbl_no_rmgr(bp);
+               return false;
+       }
        if ((bp->flags & BNXT_FLAG_RFS) && !(bp->flags & BNXT_FLAG_CHIP_P5))
                vnic = rx + 1;
        if (bp->flags & BNXT_FLAG_AGG_RINGS)
                rx <<= 1;
        stat = bnxt_get_func_stat_ctxs(bp);
-       if (BNXT_NEW_RM(bp) &&
-           (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp ||
-            hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat ||
-            (hw_resc->resv_hw_ring_grps != grp &&
-             !(bp->flags & BNXT_FLAG_CHIP_P5))))
+       if (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp ||
+           hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat ||
+           (hw_resc->resv_hw_ring_grps != grp &&
+            !(bp->flags & BNXT_FLAG_CHIP_P5)))
                return true;
        if ((bp->flags & BNXT_FLAG_CHIP_P5) && BNXT_PF(bp) &&
            hw_resc->resv_irqs != nq)
@@ -6214,6 +6241,9 @@ static int __bnxt_reserve_rings(struct bnxt *bp)
        if (!tx || !rx || !cp || !grp || !vnic || !stat)
                return -ENOMEM;
 
+       if (!netif_is_rxfh_configured(bp->dev))
+               bnxt_set_dflt_rss_indir_tbl(bp);
+
        return rc;
 }
 
@@ -7788,7 +7818,7 @@ static int bnxt_set_tpa(struct bnxt *bp, bool set_tpa)
 
        if (set_tpa)
                tpa_flags = bp->flags & BNXT_FLAG_TPA;
-       else if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
+       else if (BNXT_NO_FW_ACCESS(bp))
                return 0;
        for (i = 0; i < bp->nr_vnics; i++) {
                rc = bnxt_hwrm_vnic_set_tpa(bp, i, tpa_flags);
@@ -8495,9 +8525,6 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
                        rc = bnxt_init_int_mode(bp);
                bnxt_ulp_irq_restart(bp, rc);
        }
-       if (!netif_is_rxfh_configured(bp->dev))
-               bnxt_set_dflt_rss_indir_tbl(bp);
-
        if (rc) {
                netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc);
                return rc;
@@ -9284,16 +9311,17 @@ static ssize_t bnxt_show_temp(struct device *dev,
        struct hwrm_temp_monitor_query_input req = {0};
        struct hwrm_temp_monitor_query_output *resp;
        struct bnxt *bp = dev_get_drvdata(dev);
-       u32 temp = 0;
+       u32 len = 0;
+       int rc;
 
        resp = bp->hwrm_cmd_resp_addr;
        bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1);
        mutex_lock(&bp->hwrm_cmd_lock);
-       if (!_hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT))
-               temp = resp->temp * 1000; /* display millidegree */
+       rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+       if (!rc)
+               len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */
        mutex_unlock(&bp->hwrm_cmd_lock);
-
-       return sprintf(buf, "%u\n", temp);
+       return rc ?: len;
 }
 static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0);
 
@@ -9313,7 +9341,16 @@ static void bnxt_hwmon_close(struct bnxt *bp)
 
 static void bnxt_hwmon_open(struct bnxt *bp)
 {
+       struct hwrm_temp_monitor_query_input req = {0};
        struct pci_dev *pdev = bp->pdev;
+       int rc;
+
+       bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1);
+       rc = hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+       if (rc == -EACCES || rc == -EOPNOTSUPP) {
+               bnxt_hwmon_close(bp);
+               return;
+       }
 
        if (bp->hwmon_dev)
                return;
@@ -9475,15 +9512,15 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
                }
        }
 
-       bnxt_enable_napi(bp);
-       bnxt_debug_dev_init(bp);
-
        rc = bnxt_init_nic(bp, irq_re_init);
        if (rc) {
                netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc);
-               goto open_err;
+               goto open_err_irq;
        }
 
+       bnxt_enable_napi(bp);
+       bnxt_debug_dev_init(bp);
+
        if (link_re_init) {
                mutex_lock(&bp->link_lock);
                rc = bnxt_update_phy_setting(bp);
@@ -9514,10 +9551,6 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
                bnxt_vf_reps_open(bp);
        return 0;
 
-open_err:
-       bnxt_debug_dev_exit(bp);
-       bnxt_disable_napi(bp);
-
 open_err_irq:
        bnxt_del_napi(bp);
 
@@ -9765,7 +9798,7 @@ static int bnxt_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                mdio->phy_id = bp->link_info.phy_addr;
 
-               /* fallthru */
+               fallthrough;
        case SIOCGMIIREG: {
                u16 mii_regval = 0;
 
@@ -11022,7 +11055,7 @@ static void bnxt_fw_reset_writel(struct bnxt *bp, int reg_idx)
                writel(reg_off & BNXT_GRC_BASE_MASK,
                       bp->bar0 + BNXT_GRCPF_REG_WINDOW_BASE_OUT + 4);
                reg_off = (reg_off & BNXT_GRC_OFFSET_MASK) + 0x2000;
-               /* fall through */
+               fallthrough;
        case BNXT_FW_HEALTH_REG_TYPE_BAR0:
                writel(val, bp->bar0 + reg_off);
                break;
@@ -11135,7 +11168,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
                }
                bp->fw_reset_state = BNXT_FW_RESET_STATE_RESET_FW;
        }
-       /* fall through */
+               fallthrough;
        case BNXT_FW_RESET_STATE_RESET_FW:
                bnxt_reset_all(bp);
                bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
@@ -11158,7 +11191,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
                }
                pci_set_master(bp->pdev);
                bp->fw_reset_state = BNXT_FW_RESET_STATE_POLL_FW;
-               /* fall through */
+               fallthrough;
        case BNXT_FW_RESET_STATE_POLL_FW:
                bp->hwrm_cmd_timeout = SHORT_HWRM_CMD_TIMEOUT;
                rc = __bnxt_hwrm_ver_get(bp, true);
@@ -11173,7 +11206,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
                }
                bp->hwrm_cmd_timeout = DFLT_HWRM_CMD_TIMEOUT;
                bp->fw_reset_state = BNXT_FW_RESET_STATE_OPENING;
-               /* fall through */
+               fallthrough;
        case BNXT_FW_RESET_STATE_OPENING:
                while (!rtnl_trylock()) {
                        bnxt_queue_fw_reset_work(bp, HZ / 10);
@@ -11754,6 +11787,10 @@ static void bnxt_remove_one(struct pci_dev *pdev)
        if (BNXT_PF(bp))
                bnxt_sriov_disable(bp);
 
+       clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
+       bnxt_cancel_sp_work(bp);
+       bp->sp_event = 0;
+
        bnxt_dl_fw_reporters_destroy(bp, true);
        if (BNXT_PF(bp))
                devlink_port_type_clear(&bp->dl_port);
@@ -11761,8 +11798,6 @@ static void bnxt_remove_one(struct pci_dev *pdev)
        unregister_netdev(dev);
        bnxt_dl_unregister(bp);
        bnxt_shutdown_tc(bp);
-       bnxt_cancel_sp_work(bp);
-       bp->sp_event = 0;
 
        bnxt_clear_int_mode(bp);
        bnxt_hwrm_func_drv_unrgtr(bp);
@@ -12063,7 +12098,7 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
 static void bnxt_vpd_read_info(struct bnxt *bp)
 {
        struct pci_dev *pdev = bp->pdev;
-       int i, len, pos, ro_size;
+       int i, len, pos, ro_size, size;
        ssize_t vpd_size;
        u8 *vpd_data;
 
@@ -12098,7 +12133,8 @@ static void bnxt_vpd_read_info(struct bnxt *bp)
        if (len + pos > vpd_size)
                goto read_sn;
 
-       strlcpy(bp->board_partno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN));
+       size = min(len, BNXT_VPD_FLD_LEN - 1);
+       memcpy(bp->board_partno, &vpd_data[pos], size);
 
 read_sn:
        pos = pci_vpd_find_info_keyword(vpd_data, i, ro_size,
@@ -12111,7 +12147,8 @@ read_sn:
        if (len + pos > vpd_size)
                goto exit;
 
-       strlcpy(bp->board_serialno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN));
+       size = min(len, BNXT_VPD_FLD_LEN - 1);
+       memcpy(bp->board_serialno, &vpd_data[pos], size);
 exit:
        kfree(vpd_data);
 }
@@ -12200,6 +12237,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (BNXT_CHIP_P5(bp))
                bp->flags |= BNXT_FLAG_CHIP_P5;
 
+       rc = bnxt_alloc_rss_indir_tbl(bp);
+       if (rc)
+               goto init_err_pci_clean;
+
        rc = bnxt_fw_init_one_p2(bp);
        if (rc)
                goto init_err_pci_clean;
@@ -12304,11 +12345,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
         */
        bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
 
-       rc = bnxt_alloc_rss_indir_tbl(bp);
-       if (rc)
-               goto init_err_pci_clean;
-       bnxt_set_dflt_rss_indir_tbl(bp);
-
        if (BNXT_PF(bp)) {
                if (!bnxt_pf_wq) {
                        bnxt_pf_wq =
@@ -12339,6 +12375,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                    (long)pci_resource_start(pdev, 0), dev->dev_addr);
        pcie_print_link_status(pdev);
 
+       pci_save_state(pdev);
        return 0;
 
 init_err_cleanup:
@@ -12536,6 +12573,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
                        "Cannot re-enable PCI device after reset.\n");
        } else {
                pci_set_master(pdev);
+               pci_restore_state(pdev);
+               pci_save_state(pdev);
 
                err = bnxt_hwrm_func_reset(bp);
                if (!err) {
index 5a13eb66bedad9cd9c68e37a3862aa7be726c29b..0ef89dabfd6146f59ce0c186093316ff3e15f39d 100644 (file)
@@ -1737,6 +1737,10 @@ struct bnxt {
 #define BNXT_STATE_FW_FATAL_COND       6
 #define BNXT_STATE_DRV_REGISTERED      7
 
+#define BNXT_NO_FW_ACCESS(bp)                                  \
+       (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) ||    \
+        pci_channel_offline((bp)->pdev))
+
        struct bnxt_irq *irq_tbl;
        int                     total_irqs;
        u8                      mac_addr[ETH_ALEN];
index 64da654f10389b3d70e30417cf9a18fb97e2ed6b..fecdfd875af1c1e27c49064f305c6657cb682ff0 100644 (file)
@@ -472,20 +472,13 @@ static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp)
 static int bnxt_get_num_ring_stats(struct bnxt *bp)
 {
        int rx, tx, cmn;
-       bool sh = false;
-
-       if (bp->flags & BNXT_FLAG_SHARED_RINGS)
-               sh = true;
 
        rx = NUM_RING_RX_HW_STATS + NUM_RING_RX_SW_STATS +
             bnxt_get_num_tpa_ring_stats(bp);
        tx = NUM_RING_TX_HW_STATS;
        cmn = NUM_RING_CMN_SW_STATS;
-       if (sh)
-               return (rx + tx + cmn) * bp->cp_nr_rings;
-       else
-               return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings +
-                      cmn * bp->cp_nr_rings;
+       return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings +
+              cmn * bp->cp_nr_rings;
 }
 
 static int bnxt_get_num_stats(struct bnxt *bp)
@@ -806,7 +799,7 @@ static void bnxt_get_channels(struct net_device *dev,
        int max_tx_sch_inputs;
 
        /* Get the most up-to-date max_tx_sch_inputs. */
-       if (BNXT_NEW_RM(bp))
+       if (netif_running(dev) && BNXT_NEW_RM(bp))
                bnxt_hwrm_func_resc_qcaps(bp, false);
        max_tx_sch_inputs = hw_resc->max_tx_sch_inputs;
 
@@ -1073,7 +1066,7 @@ static int bnxt_grxfh(struct bnxt *bp, struct ethtool_rxnfc *cmd)
                if (bp->rss_hash_cfg & VNIC_RSS_CFG_REQ_HASH_TYPE_UDP_IPV4)
                        cmd->data |= RXH_IP_SRC | RXH_IP_DST |
                                     RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* fall through */
+               fallthrough;
        case SCTP_V4_FLOW:
        case AH_ESP_V4_FLOW:
        case AH_V4_FLOW:
@@ -1092,7 +1085,7 @@ static int bnxt_grxfh(struct bnxt *bp, struct ethtool_rxnfc *cmd)
                if (bp->rss_hash_cfg & VNIC_RSS_CFG_REQ_HASH_TYPE_UDP_IPV6)
                        cmd->data |= RXH_IP_SRC | RXH_IP_DST |
                                     RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* fall through */
+               fallthrough;
        case SCTP_V6_FLOW:
        case AH_ESP_V6_FLOW:
        case AH_V6_FLOW:
@@ -1329,6 +1322,9 @@ static int bnxt_get_regs_len(struct net_device *dev)
        struct bnxt *bp = netdev_priv(dev);
        int reg_len;
 
+       if (!BNXT_PF(bp))
+               return -EOPNOTSUPP;
+
        reg_len = BNXT_PXP_REG_LEN;
 
        if (bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED)
@@ -1795,9 +1791,12 @@ static int bnxt_set_pauseparam(struct net_device *dev,
        if (!BNXT_PHY_CFG_ABLE(bp))
                return -EOPNOTSUPP;
 
+       mutex_lock(&bp->link_lock);
        if (epause->autoneg) {
-               if (!(link_info->autoneg & BNXT_AUTONEG_SPEED))
-                       return -EINVAL;
+               if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {
+                       rc = -EINVAL;
+                       goto pause_exit;
+               }
 
                link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
                if (bp->hwrm_spec_code >= 0x10201)
@@ -1818,11 +1817,11 @@ static int bnxt_set_pauseparam(struct net_device *dev,
        if (epause->tx_pause)
                link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX;
 
-       if (netif_running(dev)) {
-               mutex_lock(&bp->link_lock);
+       if (netif_running(dev))
                rc = bnxt_hwrm_set_pause(bp);
-               mutex_unlock(&bp->link_lock);
-       }
+
+pause_exit:
+       mutex_unlock(&bp->link_lock);
        return rc;
 }
 
@@ -2323,6 +2322,9 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data)
        if (rc != 0)
                return rc;
 
+       if (!dir_entries || !entry_length)
+               return -EIO;
+
        /* Insert 2 bytes of directory info (count and size of entries) */
        if (len < 2)
                return -EINVAL;
@@ -2556,8 +2558,7 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
        struct bnxt *bp = netdev_priv(dev);
        struct ethtool_eee *eee = &bp->eee;
        struct bnxt_link_info *link_info = &bp->link_info;
-       u32 advertising =
-                _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
+       u32 advertising;
        int rc = 0;
 
        if (!BNXT_PHY_CFG_ABLE(bp))
@@ -2566,19 +2567,23 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
        if (!(bp->flags & BNXT_FLAG_EEE_CAP))
                return -EOPNOTSUPP;
 
+       mutex_lock(&bp->link_lock);
+       advertising = _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
        if (!edata->eee_enabled)
                goto eee_ok;
 
        if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {
                netdev_warn(dev, "EEE requires autoneg\n");
-               return -EINVAL;
+               rc = -EINVAL;
+               goto eee_exit;
        }
        if (edata->tx_lpi_enabled) {
                if (bp->lpi_tmr_hi && (edata->tx_lpi_timer > bp->lpi_tmr_hi ||
                                       edata->tx_lpi_timer < bp->lpi_tmr_lo)) {
                        netdev_warn(dev, "Valid LPI timer range is %d and %d microsecs\n",
                                    bp->lpi_tmr_lo, bp->lpi_tmr_hi);
-                       return -EINVAL;
+                       rc = -EINVAL;
+                       goto eee_exit;
                } else if (!bp->lpi_tmr_hi) {
                        edata->tx_lpi_timer = eee->tx_lpi_timer;
                }
@@ -2588,7 +2593,8 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
        } else if (edata->advertised & ~advertising) {
                netdev_warn(dev, "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
                            edata->advertised, advertising);
-               return -EINVAL;
+               rc = -EINVAL;
+               goto eee_exit;
        }
 
        eee->advertised = edata->advertised;
@@ -2600,6 +2606,8 @@ eee_ok:
        if (netif_running(dev))
                rc = bnxt_hwrm_set_link_setting(bp, false, true);
 
+eee_exit:
+       mutex_unlock(&bp->link_lock);
        return rc;
 }
 
index 2704a4709bc7b4ca3db612e8082d3047984d119e..fcc262064766a2d432c9006c7206c2e3fca438cf 100644 (file)
@@ -201,10 +201,10 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* Fall thru */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(bp->dev, xdp_prog, act);
-               /* Fall thru */
+               fallthrough;
        case XDP_DROP:
                bnxt_reuse_rx_data(rxr, cons, page);
                break;
index c5cca63b8571070715d431470323656875548694..84536292b031319cd9fd88896db6360a5440f166 100644 (file)
@@ -3311,7 +3311,7 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info)
        }
        case CNIC_CTL_FCOE_STATS_GET_CMD:
                ulp_type = CNIC_ULP_FCOE;
-               /* fall through */
+               fallthrough;
        case CNIC_CTL_ISCSI_STATS_GET_CMD:
                cnic_hold(dev);
                cnic_copy_ulp_stats(dev, ulp_type);
@@ -4044,7 +4044,7 @@ static void cnic_cm_process_kcqe(struct cnic_dev *dev, struct kcqe *kcqe)
                            l4kcqe->status, l5kcqe->completion_status);
                opcode = L4_KCQE_OPCODE_VALUE_CLOSE_COMP;
        }
-               /* Fall through */
+               fallthrough;
        case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED:
        case L4_KCQE_OPCODE_VALUE_CLOSE_COMP:
        case L4_KCQE_OPCODE_VALUE_RESET_COMP:
index 1fecc25767bd01651c5050b37eb433b00247ec9d..be85dad2e3bc4d0667b7ecd2071a9bfd369634ca 100644 (file)
@@ -1185,10 +1185,10 @@ static void bcmgenet_update_mib_counters(struct bcmgenet_priv *priv)
                        continue;
                case BCMGENET_STAT_RUNT:
                        offset += BCMGENET_STAT_OFFSET;
-                       /* fall through */
+                       fallthrough;
                case BCMGENET_STAT_MIB_TX:
                        offset += BCMGENET_STAT_OFFSET;
-                       /* fall through */
+                       fallthrough;
                case BCMGENET_STAT_MIB_RX:
                        val = bcmgenet_umac_readl(priv,
                                                  UMAC_MIB_START + j + offset);
@@ -1364,7 +1364,7 @@ static int bcmgenet_validate_flow(struct net_device *dev,
        case ETHER_FLOW:
                eth_mask = &cmd->fs.m_u.ether_spec;
                /* don't allow mask which isn't valid */
-               if (VALIDATE_MASK(eth_mask->h_source) ||
+               if (VALIDATE_MASK(eth_mask->h_dest) ||
                    VALIDATE_MASK(eth_mask->h_source) ||
                    VALIDATE_MASK(eth_mask->h_proto)) {
                        netdev_err(dev, "rxnfc: Unsupported mask\n");
index 511d553a4d113126fa5016bad26013fd38f3e41a..6fb6c3556285485a24eca1f6b33228365a50139c 100644 (file)
@@ -192,7 +192,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
        switch (priv->phy_interface) {
        case PHY_INTERFACE_MODE_INTERNAL:
                phy_name = "internal PHY";
-               /* fall through */
+               fallthrough;
        case PHY_INTERFACE_MODE_MOCA:
                /* Irrespective of the actually configured PHY speed (100 or
                 * 1000) GENETv4 only has an internal GPHY so we will just end
index ebff1fc0d8cef5291c7dd05e5654aff849c8adde..5143cdd0eecada87c5827c2de74913a6cc15ce5e 100644 (file)
@@ -715,7 +715,7 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)
        case TG3_APE_LOCK_GPIO:
                if (tg3_asic_rev(tp) == ASIC_REV_5761)
                        return 0;
-               /* fall through */
+               fallthrough;
        case TG3_APE_LOCK_GRC:
        case TG3_APE_LOCK_MEM:
                if (!tp->pci_fn)
@@ -776,7 +776,7 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
        case TG3_APE_LOCK_GPIO:
                if (tg3_asic_rev(tp) == ASIC_REV_5761)
                        return;
-               /* fall through */
+               fallthrough;
        case TG3_APE_LOCK_GRC:
        case TG3_APE_LOCK_MEM:
                if (!tp->pci_fn)
@@ -1586,7 +1586,7 @@ static int tg3_mdio_init(struct tg3 *tp)
                        phydev->dev_flags |= PHY_BRCM_EXT_IBND_RX_ENABLE;
                if (tg3_flag(tp, RGMII_EXT_IBND_TX_EN))
                        phydev->dev_flags |= PHY_BRCM_EXT_IBND_TX_ENABLE;
-               /* fall through */
+               fallthrough;
        case PHY_ID_RTL8211C:
                phydev->interface = PHY_INTERFACE_MODE_RGMII;
                break;
@@ -2114,7 +2114,7 @@ static int tg3_phy_init(struct tg3 *tp)
                        phy_support_asym_pause(phydev);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case PHY_INTERFACE_MODE_MII:
                phy_set_max_speed(phydev, SPEED_100);
                phy_support_asym_pause(phydev);
@@ -4390,7 +4390,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
                                      MII_TG3_DSP_TAP26_RMRXSTO |
                                      MII_TG3_DSP_TAP26_OPCSINPT;
                        tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val);
-                       /* Fall through */
+                       fallthrough;
                case ASIC_REV_5720:
                case ASIC_REV_5762:
                        if (!tg3_phydsp_read(tp, MII_TG3_DSP_CH34TP2, &val))
@@ -4538,7 +4538,7 @@ static int tg3_phy_pull_config(struct tg3 *tp)
                                tp->link_config.speed = SPEED_1000;
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                default:
                        goto done;
                }
@@ -5209,7 +5209,7 @@ static int tg3_fiber_aneg_smachine(struct tg3 *tp,
                if (ap->flags & (MR_AN_ENABLE | MR_RESTART_AN))
                        ap->state = ANEG_STATE_AN_ENABLE;
 
-               /* fall through */
+               fallthrough;
        case ANEG_STATE_AN_ENABLE:
                ap->flags &= ~(MR_AN_COMPLETE | MR_PAGE_RX);
                if (ap->flags & MR_AN_ENABLE) {
@@ -5239,7 +5239,7 @@ static int tg3_fiber_aneg_smachine(struct tg3 *tp,
                ret = ANEG_TIMER_ENAB;
                ap->state = ANEG_STATE_RESTART;
 
-               /* fall through */
+               fallthrough;
        case ANEG_STATE_RESTART:
                delta = ap->cur_time - ap->link_time;
                if (delta > ANEG_STATE_SETTLE_TIME)
@@ -5282,7 +5282,7 @@ static int tg3_fiber_aneg_smachine(struct tg3 *tp,
 
                ap->state = ANEG_STATE_ACK_DETECT;
 
-               /* fall through */
+               fallthrough;
        case ANEG_STATE_ACK_DETECT:
                if (ap->ack_match != 0) {
                        if ((ap->rxconfig & ~ANEG_CFG_ACK) ==
@@ -7221,8 +7221,8 @@ static inline void tg3_reset_task_schedule(struct tg3 *tp)
 
 static inline void tg3_reset_task_cancel(struct tg3 *tp)
 {
-       cancel_work_sync(&tp->reset_task);
-       tg3_flag_clear(tp, RESET_TASK_PENDING);
+       if (test_and_clear_bit(TG3_FLAG_RESET_TASK_PENDING, tp->tg3_flags))
+               cancel_work_sync(&tp->reset_task);
        tg3_flag_clear(tp, TX_RECOVERY_PENDING);
 }
 
@@ -10720,40 +10720,40 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy)
        switch (limit) {
        case 16:
                tw32(MAC_RCV_RULE_15,  0); tw32(MAC_RCV_VALUE_15,  0);
-               /* fall through */
+               fallthrough;
        case 15:
                tw32(MAC_RCV_RULE_14,  0); tw32(MAC_RCV_VALUE_14,  0);
-               /* fall through */
+               fallthrough;
        case 14:
                tw32(MAC_RCV_RULE_13,  0); tw32(MAC_RCV_VALUE_13,  0);
-               /* fall through */
+               fallthrough;
        case 13:
                tw32(MAC_RCV_RULE_12,  0); tw32(MAC_RCV_VALUE_12,  0);
-               /* fall through */
+               fallthrough;
        case 12:
                tw32(MAC_RCV_RULE_11,  0); tw32(MAC_RCV_VALUE_11,  0);
-               /* fall through */
+               fallthrough;
        case 11:
                tw32(MAC_RCV_RULE_10,  0); tw32(MAC_RCV_VALUE_10,  0);
-               /* fall through */
+               fallthrough;
        case 10:
                tw32(MAC_RCV_RULE_9,  0); tw32(MAC_RCV_VALUE_9,  0);
-               /* fall through */
+               fallthrough;
        case 9:
                tw32(MAC_RCV_RULE_8,  0); tw32(MAC_RCV_VALUE_8,  0);
-               /* fall through */
+               fallthrough;
        case 8:
                tw32(MAC_RCV_RULE_7,  0); tw32(MAC_RCV_VALUE_7,  0);
-               /* fall through */
+               fallthrough;
        case 7:
                tw32(MAC_RCV_RULE_6,  0); tw32(MAC_RCV_VALUE_6,  0);
-               /* fall through */
+               fallthrough;
        case 6:
                tw32(MAC_RCV_RULE_5,  0); tw32(MAC_RCV_VALUE_5,  0);
-               /* fall through */
+               fallthrough;
        case 5:
                tw32(MAC_RCV_RULE_4,  0); tw32(MAC_RCV_VALUE_4,  0);
-               /* fall through */
+               fallthrough;
        case 4:
                /* tw32(MAC_RCV_RULE_3,  0); tw32(MAC_RCV_VALUE_3,  0); */
        case 3:
@@ -11209,18 +11209,27 @@ static void tg3_reset_task(struct work_struct *work)
 
        tg3_halt(tp, RESET_KIND_SHUTDOWN, 0);
        err = tg3_init_hw(tp, true);
-       if (err)
+       if (err) {
+               tg3_full_unlock(tp);
+               tp->irq_sync = 0;
+               tg3_napi_enable(tp);
+               /* Clear this flag so that tg3_reset_task_cancel() will not
+                * call cancel_work_sync() and wait forever.
+                */
+               tg3_flag_clear(tp, RESET_TASK_PENDING);
+               dev_close(tp->dev);
                goto out;
+       }
 
        tg3_netif_start(tp);
 
-out:
        tg3_full_unlock(tp);
 
        if (!err)
                tg3_phy_start(tp);
 
        tg3_flag_clear(tp, RESET_TASK_PENDING);
+out:
        rtnl_unlock();
 }
 
@@ -13998,7 +14007,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = tp->phy_addr;
 
-               /* fall through */
+               fallthrough;
        case SIOCGMIIREG: {
                u32 mii_regval;
 
@@ -17136,7 +17145,7 @@ static u32 tg3_calc_dma_bndry(struct tg3 *tp, u32 val)
                                val |= DMA_RWCTRL_WRITE_BNDRY_64_PCIE;
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 128:
                default:
                        val &= ~DMA_RWCTRL_WRITE_BNDRY_DISAB_PCIE;
@@ -17151,28 +17160,28 @@ static u32 tg3_calc_dma_bndry(struct tg3 *tp, u32 val)
                                        DMA_RWCTRL_WRITE_BNDRY_16);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 32:
                        if (goal == BOUNDARY_SINGLE_CACHELINE) {
                                val |= (DMA_RWCTRL_READ_BNDRY_32 |
                                        DMA_RWCTRL_WRITE_BNDRY_32);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 64:
                        if (goal == BOUNDARY_SINGLE_CACHELINE) {
                                val |= (DMA_RWCTRL_READ_BNDRY_64 |
                                        DMA_RWCTRL_WRITE_BNDRY_64);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 128:
                        if (goal == BOUNDARY_SINGLE_CACHELINE) {
                                val |= (DMA_RWCTRL_READ_BNDRY_128 |
                                        DMA_RWCTRL_WRITE_BNDRY_128);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 256:
                        val |= (DMA_RWCTRL_READ_BNDRY_256 |
                                DMA_RWCTRL_WRITE_BNDRY_256);
index 49358d42a0e26760ffaf6337956bb65b6273d595..b9dd06b129454480ce49ad95f8275a508e73a80f 100644 (file)
@@ -321,7 +321,7 @@ bfa_ioc_sm_getattr(struct bfa_ioc *ioc, enum ioc_event event)
        case IOC_E_PFFAILED:
        case IOC_E_HWERROR:
                del_timer(&ioc->ioc_timer);
-               /* fall through */
+               fallthrough;
        case IOC_E_TIMEOUT:
                ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE);
                bfa_fsm_set_state(ioc, bfa_ioc_sm_fail);
@@ -780,7 +780,7 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf *iocpf, enum iocpf_event event)
 
        case IOCPF_E_INITFAIL:
                del_timer(&ioc->iocpf_timer);
-               /* fall through */
+               fallthrough;
 
        case IOCPF_E_TIMEOUT:
                bfa_nw_ioc_hw_sem_release(ioc);
@@ -849,7 +849,7 @@ bfa_iocpf_sm_disabling(struct bfa_iocpf *iocpf, enum iocpf_event event)
 
        case IOCPF_E_FAIL:
                del_timer(&ioc->iocpf_timer);
-               /* fall through*/
+               fallthrough;
 
        case IOCPF_E_TIMEOUT:
                bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL);
index 40107a9bd120f94c5eb99ce1e2db20cf36a233a2..a2c983f56b00eb1a88bed5b420a2a74bf7611d9d 100644 (file)
@@ -1084,7 +1084,7 @@ bna_enet_sm_cfg_wait(struct bna_enet *enet,
 
        case ENET_E_CHLD_STOPPED:
                bna_enet_rx_start(enet);
-               /* Fall through */
+               fallthrough;
        case ENET_E_FWRESP_PAUSE:
                if (enet->flags & BNA_ENET_F_PAUSE_CHANGED) {
                        enet->flags &= ~BNA_ENET_F_PAUSE_CHANGED;
index b5ecbfe13ab09edf812c966ed6d5d89d517f8072..2623a0da468206d21e1081a64e00b4412bec8ff2 100644 (file)
@@ -1636,7 +1636,7 @@ bna_bfi_rx_enet_start(struct bna_rx *rx)
                                                &q1->qpt);
                        cfg_req->q_cfg[i].qs.rx_buffer_size =
                                htons((u16)q1->buffer_size);
-                       /* Fall through */
+                       fallthrough;
 
                case BNA_RXP_SINGLE:
                        /* Large/Single RxQ */
index 6761f404b8aae6c1d8c9e2888de0eb20cc5de394..9179f7b0b900ea037158545d42b625005ecd1426 100644 (file)
@@ -647,8 +647,7 @@ static void macb_mac_link_up(struct phylink_config *config,
                                ctrl |= GEM_BIT(GBE);
                }
 
-               /* We do not support MLO_PAUSE_RX yet */
-               if (tx_pause)
+               if (rx_pause)
                        ctrl |= MACB_BIT(PAE);
 
                macb_set_tx_clk(bp->tx_clk, speed, ndev);
index 31ebf3ee7ec0e117c7afa210564f05da1de3acdb..283918aeb741d59f8260a34c49360932c14f6ac3 100644 (file)
@@ -460,7 +460,7 @@ int gem_set_hwtst(struct net_device *dev, struct ifreq *ifr, int cmd)
        case HWTSTAMP_TX_ONESTEP_SYNC:
                if (gem_ptp_set_one_step_sync(bp, 1) != 0)
                        return -ERANGE;
-               /* fall through */
+               fallthrough;
        case HWTSTAMP_TX_ON:
                tx_bd_control = TSTAMP_ALL_FRAMES;
                break;
index e73bc211779a0967bb130cc85c9a191cfa575d44..8e0ed01e7f038bf174b404b968a1a919460a728e 100644 (file)
@@ -977,15 +977,14 @@ static void octeon_destroy_resources(struct octeon_device *oct)
 
                schedule_timeout_uninterruptible(HZ / 10);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_HOST_OK:
 
-               /* fallthrough */
        case OCT_DEV_CONSOLE_INIT_DONE:
                /* Remove any consoles */
                octeon_remove_consoles(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_IO_QUEUES_DONE:
                if (lio_wait_for_instr_fetch(oct))
                        dev_err(&oct->pci_dev->dev, "IQ had pending instructions\n");
@@ -1027,7 +1026,7 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                octeon_free_sc_done_list(oct);
                octeon_free_sc_zombie_list(oct);
 
-       /* fallthrough */
+               fallthrough;
        case OCT_DEV_INTR_SET_DONE:
                /* Disable interrupts  */
                oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);
@@ -1062,17 +1061,17 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                kfree(oct->irq_name_storage);
                oct->irq_name_storage = NULL;
 
-       /* fallthrough */
+               fallthrough;
        case OCT_DEV_MSIX_ALLOC_VECTOR_DONE:
                if (OCTEON_CN23XX_PF(oct))
                        octeon_free_ioq_vector(oct);
 
-       /* fallthrough */
+               fallthrough;
        case OCT_DEV_MBOX_SETUP_DONE:
                if (OCTEON_CN23XX_PF(oct))
                        oct->fn_list.free_mbox(oct);
 
-       /* fallthrough */
+               fallthrough;
        case OCT_DEV_IN_RESET:
        case OCT_DEV_DROQ_INIT_DONE:
                /* Wait for any pending operations */
@@ -1095,11 +1094,11 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                        }
                }
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_RESP_LIST_INIT_DONE:
                octeon_delete_response_list(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_INSTR_QUEUE_INIT_DONE:
                for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) {
                        if (!(oct->io_qmask.iq & BIT_ULL(i)))
@@ -1110,16 +1109,16 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                if (oct->sriov_info.sriov_enabled)
                        pci_disable_sriov(oct->pci_dev);
 #endif
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_SC_BUFF_POOL_INIT_DONE:
                octeon_free_sc_buffer_pool(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_DISPATCH_INIT_DONE:
                octeon_delete_dispatch_list(oct);
                cancel_delayed_work_sync(&oct->nic_poll_work.work);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_PCI_MAP_DONE:
                refcount = octeon_deregister_device(oct);
 
@@ -1137,13 +1136,13 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                octeon_unmap_pci_barx(oct, 0);
                octeon_unmap_pci_barx(oct, 1);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_PCI_ENABLE_DONE:
                pci_clear_master(oct->pci_dev);
                /* Disable the device, releasing the PCI INT */
                pci_disable_device(oct->pci_dev);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_BEGIN_STATE:
                /* Nothing to be done here either */
                break;
@@ -2168,7 +2167,7 @@ static int liquidio_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (lio->oct_dev->ptp_enable)
                        return hwtstamp_ioctl(netdev, ifr);
-               /* fall through */
+               fallthrough;
        default:
                return -EOPNOTSUPP;
        }
index 90ef21086f271befe92372a0cea2aa1f72dbc4bb..8c5879e31240fd1e2dff04fcaf2741d2edd46007 100644 (file)
@@ -460,9 +460,8 @@ static void octeon_destroy_resources(struct octeon_device *oct)
 
                schedule_timeout_uninterruptible(HZ / 10);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_HOST_OK:
-               /* fallthrough */
        case OCT_DEV_IO_QUEUES_DONE:
                if (lio_wait_for_instr_fetch(oct))
                        dev_err(&oct->pci_dev->dev, "IQ had pending instructions\n");
@@ -504,7 +503,7 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                octeon_free_sc_done_list(oct);
                octeon_free_sc_zombie_list(oct);
 
-       /* fall through */
+               fallthrough;
        case OCT_DEV_INTR_SET_DONE:
                /* Disable interrupts  */
                oct->fn_list.disable_interrupt(oct, OCTEON_ALL_INTR);
@@ -533,15 +532,15 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                else
                        cn23xx_vf_ask_pf_to_do_flr(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_MSIX_ALLOC_VECTOR_DONE:
                octeon_free_ioq_vector(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_MBOX_SETUP_DONE:
                oct->fn_list.free_mbox(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_IN_RESET:
        case OCT_DEV_DROQ_INIT_DONE:
                mdelay(100);
@@ -551,11 +550,11 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                        octeon_delete_droq(oct, i);
                }
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_RESP_LIST_INIT_DONE:
                octeon_delete_response_list(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_INSTR_QUEUE_INIT_DONE:
                for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) {
                        if (!(oct->io_qmask.iq & BIT_ULL(i)))
@@ -563,27 +562,27 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                        octeon_delete_instr_queue(oct, i);
                }
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_SC_BUFF_POOL_INIT_DONE:
                octeon_free_sc_buffer_pool(oct);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_DISPATCH_INIT_DONE:
                octeon_delete_dispatch_list(oct);
                cancel_delayed_work_sync(&oct->nic_poll_work.work);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_PCI_MAP_DONE:
                octeon_unmap_pci_barx(oct, 0);
                octeon_unmap_pci_barx(oct, 1);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_PCI_ENABLE_DONE:
                pci_clear_master(oct->pci_dev);
                /* Disable the device, releasing the PCI INT */
                pci_disable_device(oct->pci_dev);
 
-               /* fallthrough */
+               fallthrough;
        case OCT_DEV_BEGIN_STATE:
                /* Nothing to be done here either */
                break;
index 83dabcffc789a27512f55cf25a4039203a170f90..c7bdac79299ac5ae3697aa49fcde5ca96be5dc6c 100644 (file)
@@ -522,7 +522,7 @@ static int nicvf_get_rss_hash_opts(struct nicvf *nic,
        case SCTP_V4_FLOW:
        case SCTP_V6_FLOW:
                info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* Fall through */
+               fallthrough;
        case IPV4_FLOW:
        case IPV6_FLOW:
                info->data |= RXH_IP_SRC | RXH_IP_DST;
index c1378b5c780cf82fba99364d82118febc38fa229..063e560d9c1b3066a9b0f1cc4448ff84a049a1be 100644 (file)
@@ -594,10 +594,10 @@ static inline bool nicvf_xdp_rx(struct nicvf *nic, struct bpf_prog *prog,
                return true;
        default:
                bpf_warn_invalid_xdp_action(action);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(nic->netdev, prog, action);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                /* Check if it's a recycled page, if not
                 * unmap the DMA mapping.
index 42c6e9379882f78f375236bf43db55432db722ec..387c357e1b8e2ab90eefa16c1b3d92ef48de4c78 100644 (file)
@@ -2543,7 +2543,7 @@ static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
                    !(data->phy_id & 0xe0e0))
                        data->phy_id = mdio_phy_id_c45(data->phy_id >> 8,
                                                       data->phy_id & 0x1f);
-               /* FALLTHRU */
+               fallthrough;
        case SIOCGMIIPHY:
                return mdio_mii_ioctl(&pi->phy.mdio, data, cmd);
        case SIOCCHIOCTL:
index b3e4118a15e700364292aba4c343f3dc67d9e849..9749d1239f58e121aed71e9360913612dd293669 100644 (file)
@@ -136,7 +136,7 @@ again:
                if (e->state == L2T_STATE_STALE)
                        e->state = L2T_STATE_VALID;
                spin_unlock_bh(&e->lock);
-               /* fall through */
+               fallthrough;
        case L2T_STATE_VALID:   /* fast-path, send the packet on */
                return cxgb3_ofld_send(dev, skb);
        case L2T_STATE_RESOLVING:
index 650db92cb11c682d536a2be228b98f9817b8f95e..481498585ead522909d8b19c3a835ac164a07efa 100644 (file)
@@ -1911,13 +1911,16 @@ out:
 static int configure_filter_tcb(struct adapter *adap, unsigned int tid,
                                struct filter_entry *f)
 {
-       if (f->fs.hitcnts)
+       if (f->fs.hitcnts) {
                set_tcb_field(adap, f, tid, TCB_TIMESTAMP_W,
-                             TCB_TIMESTAMP_V(TCB_TIMESTAMP_M) |
+                             TCB_TIMESTAMP_V(TCB_TIMESTAMP_M),
+                             TCB_TIMESTAMP_V(0ULL),
+                             1);
+               set_tcb_field(adap, f, tid, TCB_RTT_TS_RECENT_AGE_W,
                              TCB_RTT_TS_RECENT_AGE_V(TCB_RTT_TS_RECENT_AGE_M),
-                             TCB_TIMESTAMP_V(0ULL) |
                              TCB_RTT_TS_RECENT_AGE_V(0ULL),
                              1);
+       }
 
        if (f->fs.newdmac)
                set_tcb_tflag(adap, f, tid, TF_CCTRL_ECE_S, 1,
index b1a073eea60b2f8fd4fd393cfb73229b40841a6f..a020e84906813f49d619ebe8ecfba335275bb374 100644 (file)
@@ -229,7 +229,7 @@ void cxgb4_free_mps_ref_entries(struct adapter *adap)
 {
        struct mps_entries_ref *mps_entry, *tmp;
 
-       if (!list_empty(&adap->mps_ref))
+       if (list_empty(&adap->mps_ref))
                return;
 
        spin_lock(&adap->mps_ref_lock);
index e3510e9b21f3ceed337f92ede334d50a9efd7c7c..9a6d65243334af17beac881dd124b5a62ce9d9bd 100644 (file)
@@ -62,6 +62,7 @@ static struct thermal_zone_device_ops cxgb4_thermal_ops = {
 int cxgb4_thermal_init(struct adapter *adap)
 {
        struct ch_thermal *ch_thermal = &adap->ch_thermal;
+       char ch_tz_name[THERMAL_NAME_LENGTH];
        int num_trip = CXGB4_NUM_TRIPS;
        u32 param, val;
        int ret;
@@ -82,7 +83,8 @@ int cxgb4_thermal_init(struct adapter *adap)
                ch_thermal->trip_type = THERMAL_TRIP_CRITICAL;
        }
 
-       ch_thermal->tzdev = thermal_zone_device_register("cxgb4", num_trip,
+       snprintf(ch_tz_name, sizeof(ch_tz_name), "cxgb4_%s", adap->name);
+       ch_thermal->tzdev = thermal_zone_device_register(ch_tz_name, num_trip,
                                                         0, adap,
                                                         &cxgb4_thermal_ops,
                                                         NULL, 0, 0);
@@ -105,7 +107,9 @@ int cxgb4_thermal_init(struct adapter *adap)
 
 int cxgb4_thermal_remove(struct adapter *adap)
 {
-       if (adap->ch_thermal.tzdev)
+       if (adap->ch_thermal.tzdev) {
                thermal_zone_device_unregister(adap->ch_thermal.tzdev);
+               adap->ch_thermal.tzdev = NULL;
+       }
        return 0;
 }
index c4864125fe026cd7fc6db8cea20d985e0fede19b..a10a6862a9a465e5abb8ac2120bf88bba5b3d0bd 100644 (file)
@@ -231,7 +231,7 @@ again:
                if (e->state == L2T_STATE_STALE)
                        e->state = L2T_STATE_VALID;
                spin_unlock_bh(&e->lock);
-               /* fall through */
+               fallthrough;
        case L2T_STATE_VALID:     /* fast-path, send the packet on */
                return t4_ofld_send(adap, skb);
        case L2T_STATE_RESOLVING:
index 8a56491bb034145bf75a22bfd0aa2be6b54f98c6..fa3367966f4b5bddd9e88c51aa5c3655add23e10 100644 (file)
@@ -7656,13 +7656,13 @@ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
                switch (nmac) {
                case 5:
                        memcpy(mac + 24, c.nmac3, sizeof(c.nmac3));
-                       /* Fall through */
+                       fallthrough;
                case 4:
                        memcpy(mac + 18, c.nmac2, sizeof(c.nmac2));
-                       /* Fall through */
+                       fallthrough;
                case 3:
                        memcpy(mac + 12, c.nmac1, sizeof(c.nmac1));
-                       /* Fall through */
+                       fallthrough;
                case 2:
                        memcpy(mac + 6,  c.nmac0, sizeof(c.nmac0));
                }
index dbe8ee7e0e212f5ec9d129a0954055c2407dcceb..e2fe78e2e24241f64c8a2fbc4ac7b8fdf7414dff 100644 (file)
@@ -517,7 +517,7 @@ static int fwevtq_handler(struct sge_rspq *rspq, const __be64 *rsp,
                }
                cpl = (void *)p;
        }
-               /* Fall through */
+               fallthrough;
 
        case CPL_SGE_EGR_UPDATE: {
                /*
index 6bc7e7ba38c3df1959df831823f35a1d818c4c55..552d89fdf54a52119ff3dea0021e0933feca3ca6 100644 (file)
@@ -272,7 +272,7 @@ static netdev_features_t enic_features_check(struct sk_buff *skb,
        case ntohs(ETH_P_IPV6):
                if (!(enic->vxlan.flags & ENIC_VXLAN_INNER_IPV6))
                        goto out;
-               /* Fall through */
+               fallthrough;
        case ntohs(ETH_P_IP):
                break;
        default:
index 62e271aea4a500bea276263452854b4e5634f069..ffec0f3dd9578e1d0eb61a9f1bb6fc36522bfc1b 100644 (file)
@@ -2446,8 +2446,8 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
        port->reset = devm_reset_control_get_exclusive(dev, NULL);
        if (IS_ERR(port->reset)) {
                dev_err(dev, "no reset\n");
-               clk_disable_unprepare(port->pclk);
-               return PTR_ERR(port->reset);
+               ret = PTR_ERR(port->reset);
+               goto unprepare;
        }
        reset_control_reset(port->reset);
        usleep_range(100, 500);
@@ -2502,25 +2502,25 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
                                        IRQF_SHARED,
                                        port_names[port->id],
                                        port);
-       if (ret) {
-               clk_disable_unprepare(port->pclk);
-               return ret;
-       }
+       if (ret)
+               goto unprepare;
 
        ret = register_netdev(netdev);
-       if (!ret) {
+       if (ret)
+               goto unprepare;
+
+       netdev_info(netdev,
+                   "irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n",
+                   port->irq, &dmares->start,
+                   &gmacres->start);
+       ret = gmac_setup_phy(netdev);
+       if (ret)
                netdev_info(netdev,
-                           "irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n",
-                           port->irq, &dmares->start,
-                           &gmacres->start);
-               ret = gmac_setup_phy(netdev);
-               if (ret)
-                       netdev_info(netdev,
-                                   "PHY init failed, deferring to ifup time\n");
-               return 0;
-       }
+                           "PHY init failed, deferring to ifup time\n");
+       return 0;
 
-       port->netdev = NULL;
+unprepare:
+       clk_disable_unprepare(port->pclk);
        return ret;
 }
 
index 7f770513826207de3a9a15e39a06ac9b35307a9a..5c6c8c5ec7471a2bd8059ab571daad22f6194fb0 100644 (file)
@@ -385,7 +385,7 @@ static void dm9000_set_io(struct board_info *db, int byte_width)
 
        case 3:
                dev_dbg(db->dev, ": 3 byte IO, falling back to 16bit\n");
-               /* fall through */
+               fallthrough;
        case 2:
                db->dumpblk = dm9000_dumpblk_16bit;
                db->outblk  = dm9000_outblk_16bit;
index cb116b530f5e66c8daa1951caac1e55289a12151..2610efe4f8730c5714391fc2092ea6ca1159af48 100644 (file)
@@ -85,7 +85,7 @@ MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copi
 #define DSL                    CONFIG_DE2104X_DSL
 #endif
 
-#define DE_RX_RING_SIZE                64
+#define DE_RX_RING_SIZE                128
 #define DE_TX_RING_SIZE                64
 #define DE_RING_BYTES          \
                ((sizeof(struct de_desc) * DE_RX_RING_SIZE) +   \
index 0ccd9994ad4574162f26d1cea72e4e5534780cc9..f9dd1aa9f2da399576e5e17775386abe75ed017d 100644 (file)
@@ -3203,7 +3203,7 @@ srom_map_media(struct net_device *dev)
       case SROM_10BASETF:
        if (!lp->params.fdx) return -1;
        lp->fdx = true;
-       /* fall through */
+       fallthrough;
 
       case SROM_10BASET:
        if (lp->params.fdx && !lp->fdx) return -1;
@@ -3225,7 +3225,7 @@ srom_map_media(struct net_device *dev)
       case SROM_100BASETF:
         if (!lp->params.fdx) return -1;
        lp->fdx = true;
-       /* fall through */
+       fallthrough;
 
       case SROM_100BASET:
        if (lp->params.fdx && !lp->fdx) return -1;
@@ -3239,7 +3239,7 @@ srom_map_media(struct net_device *dev)
       case SROM_100BASEFF:
        if (!lp->params.fdx) return -1;
        lp->fdx = true;
-       /* fall through */
+       fallthrough;
 
       case SROM_100BASEF:
        if (lp->params.fdx && !lp->fdx) return -1;
index 9db23527275a376ee7ea0b41309606d42592bedc..3a8659c5da06434eb7add42fa3df0379ff92ad1a 100644 (file)
@@ -911,7 +911,7 @@ static int private_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
                        data->phy_id = 1;
                else
                        return -ENODEV;
-               /* Fall through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                if (data->phy_id == 32 && (tp->flags & HAS_NWAY)) {
index 5dcc66f601444a02d28a619077e460de7c75a273..5a43be327f588aac718506da87af7c34f29ee63f 100644 (file)
@@ -1443,7 +1443,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = ((struct netdev_private *)netdev_priv(dev))->phys[0] & 0x1f;
-               /* Fall Through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                spin_lock_irq(&np->lock);
index d6ed1d9437625bafd4002275cd27cbf032d44eed..99cc1c46fb301a21a542fc6b108ecf04b1c9f89f 100644 (file)
@@ -571,7 +571,7 @@ static u32 convert_to_et_setting(struct be_adapter *adapter, u32 if_speeds)
                                break;
                        }
                }
-               /* fall through */
+               fallthrough;
        case PHY_TYPE_SFP_PLUS_10GB:
        case PHY_TYPE_XFP_10GB:
        case PHY_TYPE_SFP_1GB:
index 43570f4911ea1276275617b21572a2f1b08b4020..fdff3b4723badf787488a14c77cc394da6dac83d 100644 (file)
@@ -945,7 +945,7 @@ static void dpaa_fq_setup(struct dpaa_priv *priv,
                        break;
                case FQ_TYPE_TX_CONF_MQ:
                        priv->conf_fqs[conf_cnt++] = &fq->fq_base;
-                       /* fall through */
+                       fallthrough;
                case FQ_TYPE_TX_CONFIRM:
                        dpaa_setup_ingress(priv, fq, &fq_cbs->tx_defq);
                        break;
index 9db2a02fb53178049f045f872343257d671c233e..1268996b703015a86fbcfa8404ffa9d587ac621c 100644 (file)
@@ -375,7 +375,7 @@ static int dpaa_get_hash_opts(struct net_device *dev,
        case UDP_V6_FLOW:
                if (priv->keygen_in_use)
                        cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* Fall through */
+               fallthrough;
        case IPV4_FLOW:
        case IPV6_FLOW:
        case SCTP_V4_FLOW:
index 457106e761be07151e689907a352b1d512b598cc..cf5383bb83319a5e4bd81c1985835d81acc4ee43 100644 (file)
@@ -376,10 +376,10 @@ static u32 run_xdp(struct dpaa2_eth_priv *priv,
                break;
        default:
                bpf_warn_invalid_xdp_action(xdp_act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(priv->net_dev, xdp_prog, xdp_act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                xdp_release_buf(priv, ch, addr);
                ch->stats.xdp_drop++;
index 3ea51dd9374b13174f78a4a113d35daca922124e..a24b20f769388ed03a4581cf8abea980343012f4 100644 (file)
@@ -66,8 +66,8 @@ struct dpmac_cmd_get_counter {
 };
 
 struct dpmac_rsp_get_counter {
-       u64 pad;
-       u64 counter;
+       __le64 pad;
+       __le64 counter;
 };
 
 #endif /* _FSL_DPMAC_CMD_H */
index 26d5981b798f3529cfade69563730beece501d9c..177334f0adb11d4d65c22bf9db07ab7dcc717a9e 100644 (file)
@@ -1053,7 +1053,6 @@ static int enetc_pf_probe(struct pci_dev *pdev,
 
 err_reg_netdev:
        enetc_teardown_serdes(priv);
-       enetc_mdio_remove(pf);
        enetc_free_msix(priv);
 err_alloc_msix:
        enetc_free_si_resources(priv);
@@ -1061,6 +1060,7 @@ err_alloc_si_res:
        si->ndev = NULL;
        free_netdev(ndev);
 err_alloc_netdev:
+       enetc_mdio_remove(pf);
        enetc_of_put_phy(pf);
 err_map_pf_space:
        enetc_pci_remove(pdev);
index 645764abdaae595b32c9aeee76c85657e0e23d69..bb9887f988411d86ff72c543bd7c1ebb66fe41ba 100644 (file)
@@ -528,7 +528,7 @@ static void setup_sgmii_internal_phy(struct fman_mac *memac,
                case 100:
                        tmp_reg16 |= IF_MODE_SGMII_SPEED_100M;
                break;
-               case 1000: /* fallthrough */
+               case 1000:
                default:
                        tmp_reg16 |= IF_MODE_SGMII_SPEED_1G;
                break;
index c27df153f8959a509d0c8c0e30c95b3ffd49c914..624b2eb6f01decb50dfa0da9b59700820d19a3d6 100644 (file)
@@ -1344,10 +1344,10 @@ int fman_port_config(struct fman_port *port, struct fman_port_params *params)
        switch (port->port_type) {
        case FMAN_PORT_TYPE_RX:
                set_rx_dflt_cfg(port, params);
-               /* fall through */
+               fallthrough;
        case FMAN_PORT_TYPE_TX:
                set_tx_dflt_cfg(port, params, &port->dts_params);
-               /* fall through */
+               fallthrough;
        default:
                set_dflt_cfg(port, params);
        }
index db791f60b884621cb0497e56d21ebd837f45daa6..714b501be7d09f805057f21222d8086900c53dc9 100644 (file)
@@ -1348,7 +1348,7 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
                switch (ugeth->max_speed) {
                case SPEED_10:
                        upsmr |= UCC_GETH_UPSMR_R10M;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case SPEED_100:
                        if (ugeth->phy_interface != PHY_INTERFACE_MODE_RTBI)
                                upsmr |= UCC_GETH_UPSMR_RMM;
index ed3829ae4ef1b596fbcc10b688439afa69c683f7..a769273b36f709a547adebdc1313dc5f3b6b12f5 100644 (file)
@@ -334,7 +334,7 @@ static void hns_dsaf_xge_srst_by_port_acpi(struct dsaf_device *dsaf_dev,
  * bit6-11 for ppe0-5
  * bit12-17 for roce0-5
  * bit18-19 for com/dfx
- * @enable: false - request reset , true - drop reset
+ * @dereset: false - request reset , true - drop reset
  */
 static void
 hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)
@@ -357,7 +357,7 @@ hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)
  * bit6-11 for ppe0-5
  * bit12-17 for roce0-5
  * bit18-19 for com/dfx
- * @enable: false - request reset , true - drop reset
+ * @dereset: false - request reset , true - drop reset
  */
 static void
 hns_dsaf_srst_chns_acpi(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)
index 23f278e46975bf4b58668af1c35567584507422f..22522f8a5299984d60598a680909e13ca25bd7b3 100644 (file)
@@ -2282,8 +2282,10 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
                        priv->enet_ver = AE_VERSION_1;
                else if (acpi_dev_found(hns_enet_acpi_match[1].id))
                        priv->enet_ver = AE_VERSION_2;
-               else
-                       return -ENXIO;
+               else {
+                       ret = -ENXIO;
+                       goto out_read_prop_fail;
+               }
 
                /* try to find port-idx-in-ae first */
                ret = acpi_node_get_property_reference(dev->fwnode,
@@ -2299,7 +2301,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
                priv->fwnode = args.fwnode;
        } else {
                dev_err(dev, "cannot read cfg data from OF or acpi\n");
-               return -ENXIO;
+               ret = -ENXIO;
+               goto out_read_prop_fail;
        }
 
        ret = device_property_read_u32(dev, "port-idx-in-ae", &port_id);
index 49624acf24739a085bd75f8d548979dd63660fe4..14e60c9e491d506c9f9865753432a15ab467dc43 100644 (file)
@@ -305,7 +305,7 @@ static int __lb_setup(struct net_device *ndev,
                break;
        case MAC_LOOP_PHY_NONE:
                ret = hns_nic_config_phy_loopback(phy_dev, 0x0);
-               /* fall through */
+               fallthrough;
        case MAC_LOOP_NONE:
                if (!ret && h->dev->ops->set_loopback) {
                        if (priv->ae_handle->phy_if != PHY_INTERFACE_MODE_XGMII)
@@ -463,8 +463,8 @@ static int __lb_clean_rings(struct hns_nic_priv *priv,
 
 /**
  * nic_run_loopback_test -  run loopback test
- * @nic_dev: net device
- * @loopback_type: loopback type
+ * @ndev: net device
+ * @loop_mode: loopback mode
  */
 static int __lb_run_test(struct net_device *ndev,
                         enum hnae_loop loop_mode)
@@ -572,7 +572,7 @@ static int __lb_down(struct net_device *ndev, enum hnae_loop loop)
 
 /**
  * hns_nic_self_test - self test
- * @dev: net device
+ * @ndev: net device
  * @eth_test: test cmd
  * @data: test result
  */
@@ -633,7 +633,7 @@ static void hns_nic_self_test(struct net_device *ndev,
 
 /**
  * hns_nic_get_drvinfo - get net driver info
- * @dev: net device
+ * @net_dev: net device
  * @drvinfo: driver info
  */
 static void hns_nic_get_drvinfo(struct net_device *net_dev,
@@ -658,7 +658,7 @@ static void hns_nic_get_drvinfo(struct net_device *net_dev,
 
 /**
  * hns_get_ringparam - get ring parameter
- * @dev: net device
+ * @net_dev: net device
  * @param: ethtool parameter
  */
 static void hns_get_ringparam(struct net_device *net_dev,
@@ -683,7 +683,7 @@ static void hns_get_ringparam(struct net_device *net_dev,
 
 /**
  * hns_get_pauseparam - get pause parameter
- * @dev: net device
+ * @net_dev: net device
  * @param: pause parameter
  */
 static void hns_get_pauseparam(struct net_device *net_dev,
@@ -701,7 +701,7 @@ static void hns_get_pauseparam(struct net_device *net_dev,
 
 /**
  * hns_set_pauseparam - set pause parameter
- * @dev: net device
+ * @net_dev: net device
  * @param: pause parameter
  *
  * Return 0 on success, negative on failure
@@ -725,7 +725,7 @@ static int hns_set_pauseparam(struct net_device *net_dev,
 
 /**
  * hns_get_coalesce - get coalesce info.
- * @dev: net device
+ * @net_dev: net device
  * @ec: coalesce info.
  *
  * Return 0 on success, negative on failure.
@@ -769,7 +769,7 @@ static int hns_get_coalesce(struct net_device *net_dev,
 
 /**
  * hns_set_coalesce - set coalesce info.
- * @dev: net device
+ * @net_dev: net device
  * @ec: coalesce info.
  *
  * Return 0 on success, negative on failure.
@@ -808,7 +808,7 @@ static int hns_set_coalesce(struct net_device *net_dev,
 
 /**
  * hns_get_channels - get channel info.
- * @dev: net device
+ * @net_dev: net device
  * @ch: channel info.
  */
 static void
@@ -825,7 +825,7 @@ hns_get_channels(struct net_device *net_dev, struct ethtool_channels *ch)
 
 /**
  * get_ethtool_stats - get detail statistics.
- * @dev: net device
+ * @netdev: net device
  * @stats: statistics info.
  * @data: statistics data.
  */
@@ -883,8 +883,8 @@ static void hns_get_ethtool_stats(struct net_device *netdev,
 
 /**
  * get_strings: Return a set of strings that describe the requested objects
- * @dev: net device
- * @stats: string set ID.
+ * @netdev: net device
+ * @stringset: string set ID.
  * @data: objects data.
  */
 static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
@@ -972,7 +972,7 @@ static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 
 /**
  * nic_get_sset_count - get string set count witch returned by nic_get_strings.
- * @dev: net device
+ * @netdev: net device
  * @stringset: string set index, 0: self test string; 1: statistics string.
  *
  * Return string set count.
@@ -1006,7 +1006,7 @@ static int hns_get_sset_count(struct net_device *netdev, int stringset)
 
 /**
  * hns_phy_led_set - set phy LED status.
- * @dev: net device
+ * @netdev: net device
  * @value: LED state.
  *
  * Return 0 on success, negative on failure.
@@ -1028,7 +1028,7 @@ static int hns_phy_led_set(struct net_device *netdev, int value)
 
 /**
  * nic_set_phys_id - set phy identify LED.
- * @dev: net device
+ * @netdev: net device
  * @state: LED state.
  *
  * Return 0 on success, negative on failure.
@@ -1104,9 +1104,9 @@ hns_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state)
 
 /**
  * hns_get_regs - get net device register
- * @dev: net device
+ * @net_dev: net device
  * @cmd: ethtool cmd
- * @date: register data
+ * @data: register data
  */
 static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,
                         void *data)
@@ -1126,7 +1126,7 @@ static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,
 
 /**
  * nic_get_regs_len - get total register len.
- * @dev: net device
+ * @net_dev: net device
  *
  * Return total register len.
  */
@@ -1151,7 +1151,7 @@ static int hns_get_regs_len(struct net_device *net_dev)
 
 /**
  * hns_nic_nway_reset - nway reset
- * @dev: net device
+ * @netdev: net device
  *
  * Return 0 on success, negative on failure
  */
index 87776ce3539b487523965c3fe549ff57f1aa2aaf..a4f1d515e5e09b6ce151295f255af25d0048c1f8 100644 (file)
@@ -21,6 +21,7 @@
 #include <net/pkt_cls.h>
 #include <net/tcp.h>
 #include <net/vxlan.h>
+#include <net/geneve.h>
 
 #include "hnae3.h"
 #include "hns3_enet.h"
@@ -780,7 +781,7 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
  * and it is udp packet, which has a dest port as the IANA assigned.
  * the hardware is expected to do the checksum offload, but the
  * hardware will not do the checksum offload when udp dest port is
- * 4789.
+ * 4789 or 6081.
  */
 static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
 {
@@ -789,7 +790,8 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
        l4.hdr = skb_transport_header(skb);
 
        if (!(!skb->encapsulation &&
-             l4.udp->dest == htons(IANA_VXLAN_UDP_PORT)))
+             (l4.udp->dest == htons(IANA_VXLAN_UDP_PORT) ||
+             l4.udp->dest == htons(GENEVE_UDP_PORT))))
                return false;
 
        skb_checksum_help(skb);
@@ -2746,7 +2748,7 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
        case HNS3_OL4_TYPE_MAC_IN_UDP:
        case HNS3_OL4_TYPE_NVGRE:
                skb->csum_level = 1;
-               /* fall through */
+               fallthrough;
        case HNS3_OL4_TYPE_NO_TUN:
                l3_type = hnae3_get_field(l234info, HNS3_RXD_L3ID_M,
                                          HNS3_RXD_L3ID_S);
index 36575e72a915e86de79dd0495b3b3854f89825fa..d553ed7ee64c0aef5030f7ed550a23e41ac49a59 100644 (file)
@@ -3061,7 +3061,7 @@ static irqreturn_t hclge_misc_irq_handle(int irq, void *data)
                 *    by first decoding the types of errors.
                 */
                set_bit(HNAE3_UNKNOWN_RESET, &hdev->reset_request);
-               /* fall through */
+               fallthrough;
        case HCLGE_VECTOR0_EVENT_RST:
                hclge_reset_task_schedule(hdev);
                break;
@@ -3686,12 +3686,10 @@ static int hclge_reset_prepare_up(struct hclge_dev *hdev)
 
        switch (hdev->reset_type) {
        case HNAE3_FUNC_RESET:
-               /* fall through */
        case HNAE3_FLR_RESET:
                ret = hclge_set_all_vf_rst(hdev, false);
                break;
        case HNAE3_GLOBAL_RESET:
-               /* fall through */
        case HNAE3_IMP_RESET:
                ret = hclge_set_rst_done(hdev);
                break;
index 6bb65ade1d773c8c1b2c7181af14f046a5803518..c340d9acba803fb1cdae76ca1adee0d2c74755c4 100644 (file)
@@ -1654,6 +1654,7 @@ static void hinic_diag_test(struct net_device *netdev,
        }
 
        netif_carrier_off(netdev);
+       netif_tx_disable(netdev);
 
        err = do_lp_test(nic_dev, eth_test->flags, LP_DEFAULT_TIME,
                         &test_index);
@@ -1662,9 +1663,12 @@ static void hinic_diag_test(struct net_device *netdev,
                data[test_index] = 1;
        }
 
+       netif_tx_wake_all_queues(netdev);
+
        err = hinic_port_link_state(nic_dev, &link_state);
        if (!err && link_state == HINIC_LINK_STATE_UP)
                netif_carrier_on(netdev);
+
 }
 
 static int hinic_set_phys_id(struct net_device *netdev,
index c6ce5966284cc2a7d6f15a3d1bb08c646e9e8812..2ebae6cb5db5f5b2a641032cb747cf1972be6caf 100644 (file)
 
 #define MGMT_MSG_TIMEOUT                5000
 
+#define SET_FUNC_PORT_MBOX_TIMEOUT     30000
+
 #define SET_FUNC_PORT_MGMT_TIMEOUT     25000
 
+#define UPDATE_FW_MGMT_TIMEOUT         20000
+
 #define mgmt_to_pfhwdev(pf_mgmt)        \
                container_of(pf_mgmt, struct hinic_pfhwdev, pf_to_mgmt)
 
@@ -361,16 +365,22 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt,
                return -EINVAL;
        }
 
-       if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
-               timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
+       if (HINIC_IS_VF(hwif)) {
+               if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
+                       timeout = SET_FUNC_PORT_MBOX_TIMEOUT;
 
-       if (HINIC_IS_VF(hwif))
                return hinic_mbox_to_pf(pf_to_mgmt->hwdev, mod, cmd, buf_in,
-                                       in_size, buf_out, out_size, 0);
-       else
+                                       in_size, buf_out, out_size, timeout);
+       } else {
+               if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
+                       timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
+               else if (cmd == HINIC_PORT_CMD_UPDATE_FW)
+                       timeout = UPDATE_FW_MGMT_TIMEOUT;
+
                return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size,
                                buf_out, out_size, MGMT_DIRECT_SEND,
                                MSG_NOT_RESP, timeout);
+       }
 }
 
 static void recv_mgmt_msg_work_handler(struct work_struct *work)
index 501056fd32eee67a380f0fe6bae677b759b8fee4..28581bd8ce077b869a0d9a6f6a49bf332196b7ed 100644 (file)
@@ -174,6 +174,24 @@ err_init_txq:
        return err;
 }
 
+static void enable_txqs_napi(struct hinic_dev *nic_dev)
+{
+       int num_txqs = hinic_hwdev_num_qps(nic_dev->hwdev);
+       int i;
+
+       for (i = 0; i < num_txqs; i++)
+               napi_enable(&nic_dev->txqs[i].napi);
+}
+
+static void disable_txqs_napi(struct hinic_dev *nic_dev)
+{
+       int num_txqs = hinic_hwdev_num_qps(nic_dev->hwdev);
+       int i;
+
+       for (i = 0; i < num_txqs; i++)
+               napi_disable(&nic_dev->txqs[i].napi);
+}
+
 /**
  * free_txqs - Free the Logical Tx Queues of specific NIC device
  * @nic_dev: the specific NIC device
@@ -400,6 +418,8 @@ int hinic_open(struct net_device *netdev)
                goto err_create_txqs;
        }
 
+       enable_txqs_napi(nic_dev);
+
        err = create_rxqs(nic_dev);
        if (err) {
                netif_err(nic_dev, drv, netdev,
@@ -484,6 +504,7 @@ err_port_state:
        }
 
 err_create_rxqs:
+       disable_txqs_napi(nic_dev);
        free_txqs(nic_dev);
 
 err_create_txqs:
@@ -497,6 +518,9 @@ int hinic_close(struct net_device *netdev)
        struct hinic_dev *nic_dev = netdev_priv(netdev);
        unsigned int flags;
 
+       /* Disable txq napi firstly to aviod rewaking txq in free_tx_poll */
+       disable_txqs_napi(nic_dev);
+
        down(&nic_dev->mgmt_lock);
 
        flags = nic_dev->flags;
index 5bee951fe9d422a5923bc9c2a6c9ce40547ce7d0..d0072f5e7efc63b8827bcda1f978c1899d89e4bd 100644 (file)
@@ -543,18 +543,25 @@ static int rx_request_irq(struct hinic_rxq *rxq)
        if (err) {
                netif_err(nic_dev, drv, rxq->netdev,
                          "Failed to set RX interrupt coalescing attribute\n");
-               rx_del_napi(rxq);
-               return err;
+               goto err_req_irq;
        }
 
        err = request_irq(rq->irq, rx_irq, 0, rxq->irq_name, rxq);
-       if (err) {
-               rx_del_napi(rxq);
-               return err;
-       }
+       if (err)
+               goto err_req_irq;
 
        cpumask_set_cpu(qp->q_id % num_online_cpus(), &rq->affinity_mask);
-       return irq_set_affinity_hint(rq->irq, &rq->affinity_mask);
+       err = irq_set_affinity_hint(rq->irq, &rq->affinity_mask);
+       if (err)
+               goto err_irq_affinity;
+
+       return 0;
+
+err_irq_affinity:
+       free_irq(rq->irq, rxq);
+err_req_irq:
+       rx_del_napi(rxq);
+       return err;
 }
 
 static void rx_free_irq(struct hinic_rxq *rxq)
index a97498ee69142c8062962f062258b07f35628b4a..c1f81e9144a15f3f512a86d6e770d71e4994d08e 100644 (file)
@@ -717,8 +717,8 @@ static int free_tx_poll(struct napi_struct *napi, int budget)
                netdev_txq = netdev_get_tx_queue(txq->netdev, qp->q_id);
 
                __netif_tx_lock(netdev_txq, smp_processor_id());
-
-               netif_wake_subqueue(nic_dev->netdev, qp->q_id);
+               if (!netif_testing(nic_dev->netdev))
+                       netif_wake_subqueue(nic_dev->netdev, qp->q_id);
 
                __netif_tx_unlock(netdev_txq);
 
@@ -745,18 +745,6 @@ static int free_tx_poll(struct napi_struct *napi, int budget)
        return budget;
 }
 
-static void tx_napi_add(struct hinic_txq *txq, int weight)
-{
-       netif_napi_add(txq->netdev, &txq->napi, free_tx_poll, weight);
-       napi_enable(&txq->napi);
-}
-
-static void tx_napi_del(struct hinic_txq *txq)
-{
-       napi_disable(&txq->napi);
-       netif_napi_del(&txq->napi);
-}
-
 static irqreturn_t tx_irq(int irq, void *data)
 {
        struct hinic_txq *txq = data;
@@ -790,7 +778,7 @@ static int tx_request_irq(struct hinic_txq *txq)
 
        qp = container_of(sq, struct hinic_qp, sq);
 
-       tx_napi_add(txq, nic_dev->tx_weight);
+       netif_napi_add(txq->netdev, &txq->napi, free_tx_poll, nic_dev->tx_weight);
 
        hinic_hwdev_msix_set(nic_dev->hwdev, sq->msix_entry,
                             TX_IRQ_NO_PENDING, TX_IRQ_NO_COALESC,
@@ -807,14 +795,14 @@ static int tx_request_irq(struct hinic_txq *txq)
        if (err) {
                netif_err(nic_dev, drv, txq->netdev,
                          "Failed to set TX interrupt coalescing attribute\n");
-               tx_napi_del(txq);
+               netif_napi_del(&txq->napi);
                return err;
        }
 
        err = request_irq(sq->irq, tx_irq, 0, txq->irq_name, txq);
        if (err) {
                dev_err(&pdev->dev, "Failed to request Tx irq\n");
-               tx_napi_del(txq);
+               netif_napi_del(&txq->napi);
                return err;
        }
 
@@ -826,7 +814,7 @@ static void tx_free_irq(struct hinic_txq *txq)
        struct hinic_sq *sq = txq->sq;
 
        free_irq(sq->irq, txq);
-       tx_napi_del(txq);
+       netif_napi_del(&txq->napi);
 }
 
 /**
index 0273fb7a9d015eccc8879d8c6b1ff76a38e30496..3153d62cc73e38724a365ca58c461144124168d3 100644 (file)
@@ -3247,7 +3247,7 @@ static int ehea_mem_notifier(struct notifier_block *nb,
        switch (action) {
        case MEM_CANCEL_OFFLINE:
                pr_info("memory offlining canceled");
-               /* Fall through - re-add canceled memory block */
+               fallthrough;    /* re-add canceled memory block */
 
        case MEM_ONLINE:
                pr_info("memory is going online");
index 06248a7db7f267afdad84c502952d7afc04b32b0..c00b9097eeea413755ead5d1f6e0949be72abe21 100644 (file)
@@ -2319,7 +2319,7 @@ static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:
                data->phy_id = dev->phy.address;
-               /* Fall through */
+               fallthrough;
        case SIOCGMIIREG:
                data->val_out = emac_mdio_read(ndev, dev->phy.address,
                                               data->reg_num);
index 5afb3c9c52d20a44d1cef41b0b1465e51269e9fe..1b702a43a5d01ef93c169bc40da164a07e83f144 100644 (file)
@@ -479,6 +479,9 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter)
        int i, j, rc;
        u64 *size_array;
 
+       if (!adapter->rx_pool)
+               return -1;
+
        size_array = (u64 *)((u8 *)(adapter->login_rsp_buf) +
                be32_to_cpu(adapter->login_rsp_buf->off_rxadd_buff_size));
 
@@ -649,6 +652,9 @@ static int reset_tx_pools(struct ibmvnic_adapter *adapter)
        int tx_scrqs;
        int i, rc;
 
+       if (!adapter->tx_pool)
+               return -1;
+
        tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
        for (i = 0; i < tx_scrqs; i++) {
                rc = reset_one_tx_pool(adapter, &adapter->tso_pool[i]);
@@ -2011,7 +2017,10 @@ static int do_reset(struct ibmvnic_adapter *adapter,
                    adapter->req_rx_add_entries_per_subcrq !=
                    old_num_rx_slots ||
                    adapter->req_tx_entries_per_subcrq !=
-                   old_num_tx_slots) {
+                   old_num_tx_slots ||
+                   !adapter->rx_pool ||
+                   !adapter->tso_pool ||
+                   !adapter->tx_pool) {
                        release_rx_pools(adapter);
                        release_tx_pools(adapter);
                        release_napi(adapter);
@@ -2023,12 +2032,18 @@ static int do_reset(struct ibmvnic_adapter *adapter,
 
                } else {
                        rc = reset_tx_pools(adapter);
-                       if (rc)
+                       if (rc) {
+                               netdev_dbg(adapter->netdev, "reset tx pools failed (%d)\n",
+                                               rc);
                                goto out;
+                       }
 
                        rc = reset_rx_pools(adapter);
-                       if (rc)
+                       if (rc) {
+                               netdev_dbg(adapter->netdev, "reset rx pools failed (%d)\n",
+                                               rc);
                                goto out;
+                       }
                }
                ibmvnic_disable_irqs(adapter);
        }
index 63dde3bcf5bc7991b8e90a593617fdd811f9126e..664e8ccc88d22df6c891c819b6da9c6bc3a383c0 100644 (file)
@@ -4079,7 +4079,6 @@ void e1000e_reset(struct e1000_adapter *adapter)
        case e1000_pch_lpt:
        case e1000_pch_spt:
        case e1000_pch_cnp:
-               fallthrough;
        case e1000_pch_tgp:
        case e1000_pch_adp:
                fc->refresh_time = 0xFFFF;
index 8e133d6545bd814e1bfe3434ca731d1df18e4635..47bfb2e95e2db3eb86fa9e8924813bb78851b1f9 100644 (file)
@@ -1115,7 +1115,7 @@ static int i40e_quiesce_vf_pci(struct i40e_vf *vf)
 static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
 {
        struct i40e_mac_filter *f;
-       int num_vlans = 0, bkt;
+       u16 num_vlans = 0, bkt;
 
        hash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {
                if (f->vlan >= 0 && f->vlan <= I40E_MAX_VLANID)
@@ -1134,8 +1134,8 @@ static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
  *
  * Called to get number of VLANs and VLAN list present in mac_filter_hash.
  **/
-static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, int *num_vlans,
-                                          s16 **vlan_list)
+static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, u16 *num_vlans,
+                                   s16 **vlan_list)
 {
        struct i40e_mac_filter *f;
        int i = 0;
@@ -1169,11 +1169,11 @@ err:
  **/
 static i40e_status
 i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
-                    bool unicast_enable, s16 *vl, int num_vlans)
+                    bool unicast_enable, s16 *vl, u16 num_vlans)
 {
+       i40e_status aq_ret, aq_tmp = 0;
        struct i40e_pf *pf = vf->pf;
        struct i40e_hw *hw = &pf->hw;
-       i40e_status aq_ret;
        int i;
 
        /* No VLAN to set promisc on, set on VSI */
@@ -1222,6 +1222,9 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
                                vf->vf_id,
                                i40e_stat_str(&pf->hw, aq_ret),
                                i40e_aq_str(&pf->hw, aq_err));
+
+                       if (!aq_tmp)
+                               aq_tmp = aq_ret;
                }
 
                aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, seid,
@@ -1235,8 +1238,15 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
                                vf->vf_id,
                                i40e_stat_str(&pf->hw, aq_ret),
                                i40e_aq_str(&pf->hw, aq_err));
+
+                       if (!aq_tmp)
+                               aq_tmp = aq_ret;
                }
        }
+
+       if (aq_tmp)
+               aq_ret = aq_tmp;
+
        return aq_ret;
 }
 
@@ -1258,7 +1268,7 @@ static i40e_status i40e_config_vf_promiscuous_mode(struct i40e_vf *vf,
        i40e_status aq_ret = I40E_SUCCESS;
        struct i40e_pf *pf = vf->pf;
        struct i40e_vsi *vsi;
-       int num_vlans;
+       u16 num_vlans;
        s16 *vl;
 
        vsi = i40e_find_vsi_from_id(pf, vsi_id);
index 4f05f6efe6af168f53fbe40db6afef6f96f19725..d9c3a6b169f90f349ec044f568f90a48fb924b6d 100644 (file)
@@ -718,7 +718,6 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)
        case e1000_i354:
        case e1000_i210:
        case e1000_i211:
-               fallthrough;
        default:
                for (; i < adapter->num_rx_queues; i++)
                        adapter->rx_ring[i]->reg_idx = rbase_offset + i;
index 3070dfdb7eb4af48649fe4a646fc07ae93709ce9..2d566f3c827b57a0ed30c1c9eace1baf5b89e335 100644 (file)
@@ -299,18 +299,14 @@ extern char igc_driver_name[];
 #define IGC_RX_HDR_LEN                 IGC_RXBUFFER_256
 
 /* Transmit and receive latency (for PTP timestamps) */
-/* FIXME: These values were estimated using the ones that i225 has as
- * basis, they seem to provide good numbers with ptp4l/phc2sys, but we
- * need to confirm them.
- */
-#define IGC_I225_TX_LATENCY_10         9542
-#define IGC_I225_TX_LATENCY_100                1024
-#define IGC_I225_TX_LATENCY_1000       178
-#define IGC_I225_TX_LATENCY_2500       64
-#define IGC_I225_RX_LATENCY_10         20662
-#define IGC_I225_RX_LATENCY_100                2213
-#define IGC_I225_RX_LATENCY_1000       448
-#define IGC_I225_RX_LATENCY_2500       160
+#define IGC_I225_TX_LATENCY_10         240
+#define IGC_I225_TX_LATENCY_100                58
+#define IGC_I225_TX_LATENCY_1000       80
+#define IGC_I225_TX_LATENCY_2500       1325
+#define IGC_I225_RX_LATENCY_10         6450
+#define IGC_I225_RX_LATENCY_100                185
+#define IGC_I225_RX_LATENCY_1000       300
+#define IGC_I225_RX_LATENCY_2500       1485
 
 /* RX and TX descriptor control thresholds.
  * PTHRESH - MAC will consider prefetch if it has fewer than this number of
index 36c999250fcc21168d9f3446187d95c7c0c6991d..6a9b5102aa55e6996f2e6c20ab23f7bc25728b44 100644 (file)
@@ -364,6 +364,7 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter)
        struct sk_buff *skb = adapter->ptp_tx_skb;
        struct skb_shared_hwtstamps shhwtstamps;
        struct igc_hw *hw = &adapter->hw;
+       int adjust = 0;
        u64 regval;
 
        if (WARN_ON_ONCE(!skb))
@@ -373,6 +374,24 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter)
        regval |= (u64)rd32(IGC_TXSTMPH) << 32;
        igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
 
+       switch (adapter->link_speed) {
+       case SPEED_10:
+               adjust = IGC_I225_TX_LATENCY_10;
+               break;
+       case SPEED_100:
+               adjust = IGC_I225_TX_LATENCY_100;
+               break;
+       case SPEED_1000:
+               adjust = IGC_I225_TX_LATENCY_1000;
+               break;
+       case SPEED_2500:
+               adjust = IGC_I225_TX_LATENCY_2500;
+               break;
+       }
+
+       shhwtstamps.hwtstamp =
+               ktime_add_ns(shhwtstamps.hwtstamp, adjust);
+
        /* Clear the lock early before calling skb_tstamp_tx so that
         * applications are not woken up before the lock bit is clear. We use
         * a copy of the skb pointer to ensure other threads can't change it
index 1645e4e7ebdbb3c7abff8fe4207273df20f123d4..635ff3a5dcfb31da762972c013bb3452c99e4392 100644 (file)
@@ -230,8 +230,8 @@ static int xrx200_poll_rx(struct napi_struct *napi, int budget)
        }
 
        if (rx < budget) {
-               napi_complete(&ch->napi);
-               ltq_dma_enable_irq(&ch->dma);
+               if (napi_complete_done(&ch->napi, rx))
+                       ltq_dma_enable_irq(&ch->dma);
        }
 
        return rx;
@@ -268,9 +268,12 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
        net_dev->stats.tx_bytes += bytes;
        netdev_completed_queue(ch->priv->net_dev, pkts, bytes);
 
+       if (netif_queue_stopped(net_dev))
+               netif_wake_queue(net_dev);
+
        if (pkts < budget) {
-               napi_complete(&ch->napi);
-               ltq_dma_enable_irq(&ch->dma);
+               if (napi_complete_done(&ch->napi, pkts))
+                       ltq_dma_enable_irq(&ch->dma);
        }
 
        return pkts;
@@ -342,10 +345,12 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr)
 {
        struct xrx200_chan *ch = ptr;
 
-       ltq_dma_disable_irq(&ch->dma);
-       ltq_dma_ack_irq(&ch->dma);
+       if (napi_schedule_prep(&ch->napi)) {
+               __napi_schedule(&ch->napi);
+               ltq_dma_disable_irq(&ch->dma);
+       }
 
-       napi_schedule(&ch->napi);
+       ltq_dma_ack_irq(&ch->dma);
 
        return IRQ_HANDLED;
 }
@@ -499,7 +504,7 @@ static int xrx200_probe(struct platform_device *pdev)
 
        /* setup NAPI */
        netif_napi_add(net_dev, &priv->chan_rx.napi, xrx200_poll_rx, 32);
-       netif_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32);
+       netif_tx_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32);
 
        platform_set_drvdata(pdev, priv);
 
index 832bbb8b05c80d814f8d3dee7c7c270a54d2e0f7..c4345e3d616f78589c2b5f59acb0eddb64a177c4 100644 (file)
@@ -2029,11 +2029,11 @@ mvneta_xdp_put_buff(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
        struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
        int i;
 
-       page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
-                          sync_len, napi);
        for (i = 0; i < sinfo->nr_frags; i++)
                page_pool_put_full_page(rxq->page_pool,
                                        skb_frag_page(&sinfo->frags[i]), napi);
+       page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
+                          sync_len, napi);
 }
 
 static int
@@ -2205,10 +2205,10 @@ mvneta_run_xdp(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(pp->dev, prog, act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                mvneta_xdp_put_buff(pp, rxq, xdp, sync, true);
                ret = MVNETA_XDP_DROPPED;
@@ -2383,8 +2383,12 @@ static int mvneta_rx_swbm(struct napi_struct *napi,
                        mvneta_swbm_rx_frame(pp, rx_desc, rxq, &xdp_buf,
                                             &size, page, &ps);
                } else {
-                       if (unlikely(!xdp_buf.data_hard_start))
+                       if (unlikely(!xdp_buf.data_hard_start)) {
+                               rx_desc->buf_phys_addr = 0;
+                               page_pool_put_full_page(rxq->page_pool, page,
+                                                       true);
                                continue;
+                       }
 
                        mvneta_swbm_add_rx_fragment(pp, rx_desc, rxq, &xdp_buf,
                                                    &size, page);
index d4a4e241333d8a120b4f14d339f2ae3dba22c8d4..41d935d1aaf6ff075e51b13e065d565a2ced4ae7 100644 (file)
@@ -1638,7 +1638,7 @@ int mvpp2_ethtool_rxfh_set(struct mvpp2_port *port, struct ethtool_rxnfc *info)
                        hash_opts |= MVPP22_CLS_HEK_OPT_L4SIP;
                if (info->data & RXH_L4_B_2_3)
                        hash_opts |= MVPP22_CLS_HEK_OPT_L4DIP;
-               /* Fallthrough */
+               fallthrough;
        case MVPP22_FLOW_IP4:
        case MVPP22_FLOW_IP6:
                if (info->data & RXH_L2DA)
index 2a8a5842eaefdf8d2d38795a3f9c26fb723a8ecd..6e140d1b8967cac0a7b05e8138d96227f3fac6fa 100644 (file)
@@ -5437,7 +5437,7 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
                }
                if (state->interface != PHY_INTERFACE_MODE_NA)
                        break;
-               /* Fall-through */
+               fallthrough;
        case PHY_INTERFACE_MODE_RGMII:
        case PHY_INTERFACE_MODE_RGMII_ID:
        case PHY_INTERFACE_MODE_RGMII_RXID:
@@ -5451,7 +5451,7 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
                phylink_set(mask, 1000baseX_Full);
                if (state->interface != PHY_INTERFACE_MODE_NA)
                        break;
-               /* Fall-through */
+               fallthrough;
        case PHY_INTERFACE_MODE_1000BASEX:
        case PHY_INTERFACE_MODE_2500BASEX:
                if (port->comphy ||
index 36953d4f51c73af7a710e1397a8431e5ab863a6a..01a793105599fbfcc78b5867d13b1442f1f578b5 100644 (file)
@@ -737,7 +737,7 @@ static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req,
                else if (req->ctype == NIX_AQ_CTYPE_MCE)
                        memcpy(mask, &req->mce_mask,
                               sizeof(struct nix_rx_mce_s));
-               /* Fall through */
+               fallthrough;
        case NIX_AQ_INSTOP_INIT:
                if (req->ctype == NIX_AQ_CTYPE_RQ)
                        memcpy(ctx, &req->rq, sizeof(struct nix_rq_ctx_s));
index b792f6306a641448b91edcda45a77ba24f75d498..6a930351cb239d4b330076d2446cb62f674d6f74 100644 (file)
@@ -2448,7 +2448,7 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = hw->phy_addr;
 
-               /* fallthru */
+               fallthrough;
        case SIOCGMIIREG: {
                u16 val = 0;
                spin_lock_bh(&hw->phy_lock);
index cec8124301c7f5683c41be085e0de9832f6dc23e..344864275ed56a6a323a19645f8a13d62b39db02 100644 (file)
@@ -1376,7 +1376,7 @@ static int sky2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCGMIIPHY:
                data->phy_id = PHY_ADDR_MARV;
 
-               /* fallthru */
+               fallthrough;
        case SIOCGMIIREG: {
                u16 val = 0;
 
@@ -2764,7 +2764,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
 
                case OP_RXCHKSVLAN:
                        sky2_rx_tag(sky2, length);
-                       /* fall through */
+                       fallthrough;
                case OP_RXCHKS:
                        if (likely(dev->features & NETIF_F_RXCSUM))
                                sky2_rx_checksum(sky2, status);
index 0870fe78ea38c100c578a38800c0b079c2432860..6d2d60675ffd7d293a6a7f7f8283f6a08342fd38 100644 (file)
@@ -228,7 +228,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode,
                        if (!MTK_HAS_CAPS(mac->hw->soc->caps,
                                          MTK_GMAC1_TRGMII))
                                goto err_phy;
-                       /* fall through */
+                       fallthrough;
                case PHY_INTERFACE_MODE_RGMII_TXID:
                case PHY_INTERFACE_MODE_RGMII_RXID:
                case PHY_INTERFACE_MODE_RGMII_ID:
@@ -501,11 +501,11 @@ static void mtk_validate(struct phylink_config *config,
        case PHY_INTERFACE_MODE_RGMII_RXID:
        case PHY_INTERFACE_MODE_RGMII_TXID:
                phylink_set(mask, 1000baseT_Half);
-               /* fall through */
+               fallthrough;
        case PHY_INTERFACE_MODE_SGMII:
                phylink_set(mask, 1000baseT_Full);
                phylink_set(mask, 1000baseX_Full);
-               /* fall through */
+               fallthrough;
        case PHY_INTERFACE_MODE_MII:
        case PHY_INTERFACE_MODE_RMII:
        case PHY_INTERFACE_MODE_REVMII:
index d2986f1f2db02a9380e1184057d114295dd2d60d..d7444782bfdd02863faa615a144c205b9b79666f 100644 (file)
@@ -114,7 +114,7 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order)
                goto err_out;
 
        for (i = 0; i <= buddy->max_order; ++i) {
-               s = BITS_TO_LONGS(1 << (buddy->max_order - i));
+               s = BITS_TO_LONGS(1UL << (buddy->max_order - i));
                buddy->bits[i] = kvmalloc_array(s, sizeof(long), GFP_KERNEL | __GFP_ZERO);
                if (!buddy->bits[i])
                        goto err_out_free;
index 0cc2080fd847b64fd4d52d86b8c5ac9037a6a050..90d5caabd6afc8fd91acb23e0eb28d573677038f 100644 (file)
@@ -600,7 +600,7 @@ struct mlx5e_rq {
        struct dim         dim; /* Dynamic Interrupt Moderation */
 
        /* XDP */
-       struct bpf_prog       *xdp_prog;
+       struct bpf_prog __rcu *xdp_prog;
        struct mlx5e_xdpsq    *xdpsq;
        DECLARE_BITMAP(flags, 8);
        struct page_pool      *page_pool;
@@ -1005,7 +1005,6 @@ int mlx5e_update_nic_rx(struct mlx5e_priv *priv);
 void mlx5e_update_carrier(struct mlx5e_priv *priv);
 int mlx5e_close(struct net_device *netdev);
 int mlx5e_open(struct net_device *netdev);
-void mlx5e_update_ndo_stats(struct mlx5e_priv *priv);
 
 void mlx5e_queue_update_stats(struct mlx5e_priv *priv);
 int mlx5e_bits_invert(unsigned long a, int size);
index 8fe8b4d6ad1c103becba2dde63201c6550467ea0..254c8473904643f2f88dc08441185c1a809eade1 100644 (file)
@@ -51,7 +51,7 @@ static void mlx5e_monitor_counters_work(struct work_struct *work)
                                               monitor_counters_work);
 
        mutex_lock(&priv->state_lock);
-       mlx5e_update_ndo_stats(priv);
+       mlx5e_stats_update_ndo_stats(priv);
        mutex_unlock(&priv->state_lock);
        mlx5e_monitor_counter_arm(priv);
 }
index 5de1cb9f53308c1dfa7a89ea897b314b1e25e6eb..96608dbb9314b125d63bd6e4a9dcc10df30c3684 100644 (file)
@@ -490,11 +490,8 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy)
        int err;
        int i;
 
-       if (!MLX5_CAP_GEN(dev, pcam_reg))
-               return -EOPNOTSUPP;
-
-       if (!MLX5_CAP_PCAM_REG(dev, pplm))
-               return -EOPNOTSUPP;
+       if (!MLX5_CAP_GEN(dev, pcam_reg) || !MLX5_CAP_PCAM_REG(dev, pplm))
+               return false;
 
        MLX5_SET(pplm_reg, in, local_port, 1);
        err =  mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPLM, 0, 0);
index c6bc9224c3b18ffce870206068fe134ee69b2f12..bc5f72ec362383a08c777b7419bc6ae6236de268 100644 (file)
@@ -699,6 +699,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
 err_rule:
        mlx5e_mod_hdr_detach(ct_priv->esw->dev,
                             &esw->offloads.mod_hdr, zone_rule->mh);
+       mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id);
 err_mod_hdr:
        kfree(spec);
        return err;
@@ -958,12 +959,22 @@ mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv,
        return 0;
 }
 
+void mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr)
+{
+       struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv);
+
+       if (!ct_priv || !ct_attr->ct_labels_id)
+               return;
+
+       mapping_remove(ct_priv->labels_mapping, ct_attr->ct_labels_id);
+}
+
 int
-mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,
-                      struct mlx5_flow_spec *spec,
-                      struct flow_cls_offload *f,
-                      struct mlx5_ct_attr *ct_attr,
-                      struct netlink_ext_ack *extack)
+mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
+                    struct mlx5_flow_spec *spec,
+                    struct flow_cls_offload *f,
+                    struct mlx5_ct_attr *ct_attr,
+                    struct netlink_ext_ack *extack)
 {
        struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv);
        struct flow_rule *rule = flow_cls_offload_flow_rule(f);
index 3baef917a677ad24424103b5f9d41eb13559d364..708c216325d3a49e63ed077b4c16768e20a8b740 100644 (file)
@@ -87,12 +87,15 @@ mlx5_tc_ct_init(struct mlx5_rep_uplink_priv *uplink_priv);
 void
 mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv);
 
+void
+mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr);
+
 int
-mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,
-                      struct mlx5_flow_spec *spec,
-                      struct flow_cls_offload *f,
-                      struct mlx5_ct_attr *ct_attr,
-                      struct netlink_ext_ack *extack);
+mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
+                    struct mlx5_flow_spec *spec,
+                    struct flow_cls_offload *f,
+                    struct mlx5_ct_attr *ct_attr,
+                    struct netlink_ext_ack *extack);
 int
 mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv,
                            struct mlx5_flow_spec *spec);
@@ -130,12 +133,15 @@ mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv)
 {
 }
 
+static inline void
+mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr) {}
+
 static inline int
-mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,
-                      struct mlx5_flow_spec *spec,
-                      struct flow_cls_offload *f,
-                      struct mlx5_ct_attr *ct_attr,
-                      struct netlink_ext_ack *extack)
+mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
+                    struct mlx5_flow_spec *spec,
+                    struct flow_cls_offload *f,
+                    struct mlx5_ct_attr *ct_attr,
+                    struct netlink_ext_ack *extack)
 {
        struct flow_rule *rule = flow_cls_offload_flow_rule(f);
 
index 9334c9c3e208b16bbbc8b527a8268ae5fc0553a3..24336c60123ac3aaba0ef32f88fa62c889bca2de 100644 (file)
@@ -20,6 +20,11 @@ enum mlx5e_icosq_wqe_type {
 };
 
 /* General */
+static inline bool mlx5e_skb_is_multicast(struct sk_buff *skb)
+{
+       return skb->pkt_type == PACKET_MULTICAST || skb->pkt_type == PACKET_BROADCAST;
+}
+
 void mlx5e_trigger_irq(struct mlx5e_icosq *sq);
 void mlx5e_completion_event(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe);
 void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);
index 0e6946fc121f0793234b057896de37b988429ac8..b28df21981a1349d727d1a4cca5a7373cb1a4992 100644 (file)
@@ -122,7 +122,7 @@ mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq,
 bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di,
                      u32 *len, struct xdp_buff *xdp)
 {
-       struct bpf_prog *prog = READ_ONCE(rq->xdp_prog);
+       struct bpf_prog *prog = rcu_dereference(rq->xdp_prog);
        u32 act;
        int err;
 
index a33a1f762c70db7d2722984b159e436410fa3e45..40db27bf790bb287aa5a9f63a3e83ee91266a18a 100644 (file)
@@ -31,7 +31,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq,
 {
        struct xdp_buff *xdp = wi->umr.dma_info[page_idx].xsk;
        u32 cqe_bcnt32 = cqe_bcnt;
-       bool consumed;
 
        /* Check packet size. Note LRO doesn't use linear SKB */
        if (unlikely(cqe_bcnt > rq->hw_mtu)) {
@@ -51,10 +50,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq,
        xsk_buff_dma_sync_for_cpu(xdp);
        prefetch(xdp->data);
 
-       rcu_read_lock();
-       consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp);
-       rcu_read_unlock();
-
        /* Possible flows:
         * - XDP_REDIRECT to XSKMAP:
         *   The page is owned by the userspace from now.
@@ -70,7 +65,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq,
         * allocated first from the Reuse Ring, so it has enough space.
         */
 
-       if (likely(consumed)) {
+       if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp))) {
                if (likely(__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)))
                        __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
                return NULL; /* page/packet was consumed by XDP */
@@ -88,7 +83,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq,
                                              u32 cqe_bcnt)
 {
        struct xdp_buff *xdp = wi->di->xsk;
-       bool consumed;
 
        /* wi->offset is not used in this function, because xdp->data and the
         * DMA address point directly to the necessary place. Furthermore, the
@@ -107,11 +101,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq,
                return NULL;
        }
 
-       rcu_read_lock();
-       consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp);
-       rcu_read_unlock();
-
-       if (likely(consumed))
+       if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp)))
                return NULL; /* page/packet was consumed by XDP */
 
        /* XDP_PASS: copy the data from the UMEM to a new SKB. The frame reuse
index dd9df519d383b5959373d1c5d0ff0860ea1d1092..55e65a438de70f6d2a6e6a17417a47aad5ec6710 100644 (file)
@@ -106,8 +106,7 @@ err_free_cparam:
 void mlx5e_close_xsk(struct mlx5e_channel *c)
 {
        clear_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
-       napi_synchronize(&c->napi);
-       synchronize_rcu(); /* Sync with the XSK wakeup. */
+       synchronize_rcu(); /* Sync with the XSK wakeup and with NAPI. */
 
        mlx5e_close_rq(&c->xskrq);
        mlx5e_close_cq(&c->xskrq.cq);
index acf6d80a6bb7b159cb66880ef35728202f18a688..6bbfcf18107d2250e3ae291f8037535f67290d6e 100644 (file)
@@ -234,7 +234,7 @@ mlx5e_get_ktls_rx_priv_ctx(struct tls_context *tls_ctx)
 
 /* Re-sync */
 /* Runs in work context */
-static struct mlx5_wqe_ctrl_seg *
+static int
 resync_post_get_progress_params(struct mlx5e_icosq *sq,
                                struct mlx5e_ktls_offload_context_rx *priv_rx)
 {
@@ -258,15 +258,19 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq,
                                       PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
        if (unlikely(dma_mapping_error(pdev, buf->dma_addr))) {
                err = -ENOMEM;
-               goto err_out;
+               goto err_free;
        }
 
        buf->priv_rx = priv_rx;
 
        BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1);
+
+       spin_lock(&sq->channel->async_icosq_lock);
+
        if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) {
+               spin_unlock(&sq->channel->async_icosq_lock);
                err = -ENOSPC;
-               goto err_out;
+               goto err_dma_unmap;
        }
 
        pi = mlx5e_icosq_get_next_pi(sq, 1);
@@ -294,12 +298,18 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq,
        };
        icosq_fill_wi(sq, pi, &wi);
        sq->pc++;
+       mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, cseg);
+       spin_unlock(&sq->channel->async_icosq_lock);
 
-       return cseg;
+       return 0;
 
+err_dma_unmap:
+       dma_unmap_single(pdev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
+err_free:
+       kfree(buf);
 err_out:
        priv_rx->stats->tls_resync_req_skip++;
-       return ERR_PTR(err);
+       return err;
 }
 
 /* Function is called with elevated refcount.
@@ -309,10 +319,8 @@ static void resync_handle_work(struct work_struct *work)
 {
        struct mlx5e_ktls_offload_context_rx *priv_rx;
        struct mlx5e_ktls_rx_resync_ctx *resync;
-       struct mlx5_wqe_ctrl_seg *cseg;
        struct mlx5e_channel *c;
        struct mlx5e_icosq *sq;
-       struct mlx5_wq_cyc *wq;
 
        resync = container_of(work, struct mlx5e_ktls_rx_resync_ctx, work);
        priv_rx = container_of(resync, struct mlx5e_ktls_offload_context_rx, resync);
@@ -324,18 +332,9 @@ static void resync_handle_work(struct work_struct *work)
 
        c = resync->priv->channels.c[priv_rx->rxq];
        sq = &c->async_icosq;
-       wq = &sq->wq;
-
-       spin_lock(&c->async_icosq_lock);
 
-       cseg = resync_post_get_progress_params(sq, priv_rx);
-       if (IS_ERR(cseg)) {
+       if (resync_post_get_progress_params(sq, priv_rx))
                refcount_dec(&resync->refcnt);
-               goto unlock;
-       }
-       mlx5e_notify_hw(wq, sq->pc, sq->uar_map, cseg);
-unlock:
-       spin_unlock(&c->async_icosq_lock);
 }
 
 static void resync_init(struct mlx5e_ktls_rx_resync_ctx *resync,
@@ -386,16 +385,17 @@ void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi,
        struct mlx5e_ktls_offload_context_rx *priv_rx;
        struct mlx5e_ktls_rx_resync_ctx *resync;
        u8 tracker_state, auth_state, *ctx;
+       struct device *dev;
        u32 hw_seq;
 
        priv_rx = buf->priv_rx;
        resync = &priv_rx->resync;
-
+       dev = resync->priv->mdev->device;
        if (unlikely(test_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags)))
                goto out;
 
-       dma_sync_single_for_cpu(resync->priv->mdev->device, buf->dma_addr,
-                               PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
+       dma_sync_single_for_cpu(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE,
+                               DMA_FROM_DEVICE);
 
        ctx = buf->progress.ctx;
        tracker_state = MLX5_GET(tls_progress_params, ctx, record_tracker_state);
@@ -411,6 +411,7 @@ void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi,
        priv_rx->stats->tls_resync_req_end++;
 out:
        refcount_dec(&resync->refcnt);
+       dma_unmap_single(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
        kfree(buf);
 }
 
@@ -659,7 +660,7 @@ void mlx5e_ktls_del_rx(struct net_device *netdev, struct tls_context *tls_ctx)
        priv_rx = mlx5e_get_ktls_rx_priv_ctx(tls_ctx);
        set_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags);
        mlx5e_set_ktls_rx_priv_ctx(tls_ctx, NULL);
-       napi_synchronize(&priv->channels.c[priv_rx->rxq]->napi);
+       synchronize_rcu(); /* Sync with NAPI */
        if (!cancel_work_sync(&priv_rx->rule.work))
                /* completion is needed, as the priv_rx in the add flow
                 * is maintained on the wqe info (wi), not on the socket.
index 01468ec2744660ad031686c3b9cc54cafb7f06a3..b949b9a7538b0d1ee8b5e996703dec76334ab6b3 100644 (file)
@@ -35,7 +35,6 @@
 #include <net/sock.h>
 
 #include "en.h"
-#include "accel/tls.h"
 #include "fpga/sdk.h"
 #include "en_accel/tls.h"
 
@@ -51,9 +50,14 @@ static const struct counter_desc mlx5e_tls_sw_stats_desc[] = {
 
 #define NUM_TLS_SW_COUNTERS ARRAY_SIZE(mlx5e_tls_sw_stats_desc)
 
+static bool is_tls_atomic_stats(struct mlx5e_priv *priv)
+{
+       return priv->tls && !mlx5_accel_is_ktls_device(priv->mdev);
+}
+
 int mlx5e_tls_get_count(struct mlx5e_priv *priv)
 {
-       if (!priv->tls)
+       if (!is_tls_atomic_stats(priv))
                return 0;
 
        return NUM_TLS_SW_COUNTERS;
@@ -63,7 +67,7 @@ int mlx5e_tls_get_strings(struct mlx5e_priv *priv, uint8_t *data)
 {
        unsigned int i, idx = 0;
 
-       if (!priv->tls)
+       if (!is_tls_atomic_stats(priv))
                return 0;
 
        for (i = 0; i < NUM_TLS_SW_COUNTERS; i++)
@@ -77,7 +81,7 @@ int mlx5e_tls_get_stats(struct mlx5e_priv *priv, u64 *data)
 {
        int i, idx = 0;
 
-       if (!priv->tls)
+       if (!is_tls_atomic_stats(priv))
                return 0;
 
        for (i = 0; i < NUM_TLS_SW_COUNTERS; i++)
index aebcf73f8546d054cb1e907a1a229066375e6b6e..b3cda7b6e5e1b1c937817a4f1f063d0a363216ff 100644 (file)
@@ -158,16 +158,6 @@ static void mlx5e_update_carrier_work(struct work_struct *work)
        mutex_unlock(&priv->state_lock);
 }
 
-void mlx5e_update_ndo_stats(struct mlx5e_priv *priv)
-{
-       int i;
-
-       for (i = mlx5e_nic_stats_grps_num(priv) - 1; i >= 0; i--)
-               if (mlx5e_nic_stats_grps[i]->update_stats_mask &
-                   MLX5E_NDO_UPDATE_STATS)
-                       mlx5e_nic_stats_grps[i]->update_stats(priv);
-}
-
 static void mlx5e_update_stats_work(struct work_struct *work)
 {
        struct mlx5e_priv *priv = container_of(work, struct mlx5e_priv,
@@ -399,7 +389,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
 
        if (params->xdp_prog)
                bpf_prog_inc(params->xdp_prog);
-       rq->xdp_prog = params->xdp_prog;
+       RCU_INIT_POINTER(rq->xdp_prog, params->xdp_prog);
 
        rq_xdp_ix = rq->ix;
        if (xsk)
@@ -408,7 +398,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
        if (err < 0)
                goto err_rq_wq_destroy;
 
-       rq->buff.map_dir = rq->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE;
+       rq->buff.map_dir = params->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE;
        rq->buff.headroom = mlx5e_get_rq_headroom(mdev, params, xsk);
        pool_size = 1 << params->log_rq_mtu_frames;
 
@@ -564,8 +554,8 @@ err_free:
        }
 
 err_rq_wq_destroy:
-       if (rq->xdp_prog)
-               bpf_prog_put(rq->xdp_prog);
+       if (params->xdp_prog)
+               bpf_prog_put(params->xdp_prog);
        xdp_rxq_info_unreg(&rq->xdp_rxq);
        page_pool_destroy(rq->page_pool);
        mlx5_wq_destroy(&rq->wq_ctrl);
@@ -575,10 +565,16 @@ err_rq_wq_destroy:
 
 static void mlx5e_free_rq(struct mlx5e_rq *rq)
 {
+       struct mlx5e_channel *c = rq->channel;
+       struct bpf_prog *old_prog = NULL;
        int i;
 
-       if (rq->xdp_prog)
-               bpf_prog_put(rq->xdp_prog);
+       /* drop_rq has neither channel nor xdp_prog. */
+       if (c)
+               old_prog = rcu_dereference_protected(rq->xdp_prog,
+                                                    lockdep_is_held(&c->priv->state_lock));
+       if (old_prog)
+               bpf_prog_put(old_prog);
 
        switch (rq->wq_type) {
        case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
@@ -867,7 +863,7 @@ void mlx5e_activate_rq(struct mlx5e_rq *rq)
 void mlx5e_deactivate_rq(struct mlx5e_rq *rq)
 {
        clear_bit(MLX5E_RQ_STATE_ENABLED, &rq->state);
-       napi_synchronize(&rq->channel->napi); /* prevent mlx5e_post_rx_wqes */
+       synchronize_rcu(); /* Sync with NAPI to prevent mlx5e_post_rx_wqes. */
 }
 
 void mlx5e_close_rq(struct mlx5e_rq *rq)
@@ -1312,12 +1308,10 @@ void mlx5e_tx_disable_queue(struct netdev_queue *txq)
 
 static void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq)
 {
-       struct mlx5e_channel *c = sq->channel;
        struct mlx5_wq_cyc *wq = &sq->wq;
 
        clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
-       /* prevent netif_tx_wake_queue */
-       napi_synchronize(&c->napi);
+       synchronize_rcu(); /* Sync with NAPI to prevent netif_tx_wake_queue. */
 
        mlx5e_tx_disable_queue(sq->txq);
 
@@ -1392,10 +1386,8 @@ void mlx5e_activate_icosq(struct mlx5e_icosq *icosq)
 
 void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq)
 {
-       struct mlx5e_channel *c = icosq->channel;
-
        clear_bit(MLX5E_SQ_STATE_ENABLED, &icosq->state);
-       napi_synchronize(&c->napi);
+       synchronize_rcu(); /* Sync with NAPI. */
 }
 
 void mlx5e_close_icosq(struct mlx5e_icosq *sq)
@@ -1474,7 +1466,7 @@ void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq)
        struct mlx5e_channel *c = sq->channel;
 
        clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
-       napi_synchronize(&c->napi);
+       synchronize_rcu(); /* Sync with NAPI. */
 
        mlx5e_destroy_sq(c->mdev, sq->sqn);
        mlx5e_free_xdpsq_descs(sq);
@@ -3567,6 +3559,7 @@ void mlx5e_fold_sw_stats64(struct mlx5e_priv *priv, struct rtnl_link_stats64 *s)
 
                s->rx_packets   += rq_stats->packets + xskrq_stats->packets;
                s->rx_bytes     += rq_stats->bytes + xskrq_stats->bytes;
+               s->multicast    += rq_stats->mcast_packets + xskrq_stats->mcast_packets;
 
                for (j = 0; j < priv->max_opened_tc; j++) {
                        struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j];
@@ -3582,7 +3575,6 @@ void
 mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
-       struct mlx5e_vport_stats *vstats = &priv->stats.vport;
        struct mlx5e_pport_stats *pstats = &priv->stats.pport;
 
        /* In switchdev mode, monitor counters doesn't monitor
@@ -3617,12 +3609,6 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
        stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +
                           stats->rx_frame_errors;
        stats->tx_errors = stats->tx_aborted_errors + stats->tx_carrier_errors;
-
-       /* vport multicast also counts packets that are dropped due to steering
-        * or rx out of buffer
-        */
-       stats->multicast =
-               VPORT_COUNTER_GET(vstats, received_eth_multicast.packets);
 }
 
 static void mlx5e_set_rx_mode(struct net_device *dev)
@@ -4330,6 +4316,16 @@ static int mlx5e_xdp_allowed(struct mlx5e_priv *priv, struct bpf_prog *prog)
        return 0;
 }
 
+static void mlx5e_rq_replace_xdp_prog(struct mlx5e_rq *rq, struct bpf_prog *prog)
+{
+       struct bpf_prog *old_prog;
+
+       old_prog = rcu_replace_pointer(rq->xdp_prog, prog,
+                                      lockdep_is_held(&rq->channel->priv->state_lock));
+       if (old_prog)
+               bpf_prog_put(old_prog);
+}
+
 static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
 {
        struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -4388,29 +4384,10 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
         */
        for (i = 0; i < priv->channels.num; i++) {
                struct mlx5e_channel *c = priv->channels.c[i];
-               bool xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
-
-               clear_bit(MLX5E_RQ_STATE_ENABLED, &c->rq.state);
-               if (xsk_open)
-                       clear_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state);
-               napi_synchronize(&c->napi);
-               /* prevent mlx5e_poll_rx_cq from accessing rq->xdp_prog */
-
-               old_prog = xchg(&c->rq.xdp_prog, prog);
-               if (old_prog)
-                       bpf_prog_put(old_prog);
-
-               if (xsk_open) {
-                       old_prog = xchg(&c->xskrq.xdp_prog, prog);
-                       if (old_prog)
-                               bpf_prog_put(old_prog);
-               }
 
-               set_bit(MLX5E_RQ_STATE_ENABLED, &c->rq.state);
-               if (xsk_open)
-                       set_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state);
-               /* napi_schedule in case we have missed anything */
-               napi_schedule(&c->napi);
+               mlx5e_rq_replace_xdp_prog(&c->rq, prog);
+               if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state))
+                       mlx5e_rq_replace_xdp_prog(&c->xskrq, prog);
        }
 
 unlock:
@@ -5200,7 +5177,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = {
        .enable            = mlx5e_nic_enable,
        .disable           = mlx5e_nic_disable,
        .update_rx         = mlx5e_update_nic_rx,
-       .update_stats      = mlx5e_update_ndo_stats,
+       .update_stats      = mlx5e_stats_update_ndo_stats,
        .update_carrier    = mlx5e_update_carrier,
        .rx_handlers       = &mlx5e_rx_handlers_nic,
        .max_tc            = MLX5E_MAX_NUM_TC,
index e13e5d1b3eaed7220939385d15e4fff475d6aa22..e979bff64c499b95bef365b332be7cb78e3f2964 100644 (file)
@@ -1171,7 +1171,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = {
        .cleanup_tx             = mlx5e_cleanup_rep_tx,
        .enable                 = mlx5e_rep_enable,
        .update_rx              = mlx5e_update_rep_rx,
-       .update_stats           = mlx5e_update_ndo_stats,
+       .update_stats           = mlx5e_stats_update_ndo_stats,
        .rx_handlers            = &mlx5e_rx_handlers_rep,
        .max_tc                 = 1,
        .rq_groups              = MLX5E_NUM_RQ_GROUPS(REGULAR),
@@ -1189,7 +1189,7 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = {
        .enable                 = mlx5e_uplink_rep_enable,
        .disable                = mlx5e_uplink_rep_disable,
        .update_rx              = mlx5e_update_rep_rx,
-       .update_stats           = mlx5e_update_ndo_stats,
+       .update_stats           = mlx5e_stats_update_ndo_stats,
        .update_carrier         = mlx5e_update_carrier,
        .rx_handlers            = &mlx5e_rx_handlers_rep,
        .max_tc                 = MLX5E_MAX_NUM_TC,
index 65828af120b7a63bfd08a8035285032ec75e47fe..64c8ac5eabf6a81325fdabd1daee031e8b74987e 100644 (file)
@@ -53,6 +53,7 @@
 #include "en/xsk/rx.h"
 #include "en/health.h"
 #include "en/params.h"
+#include "en/txrx.h"
 
 static struct sk_buff *
 mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
@@ -1080,6 +1081,9 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe,
                mlx5e_enable_ecn(rq, skb);
 
        skb->protocol = eth_type_trans(skb, netdev);
+
+       if (unlikely(mlx5e_skb_is_multicast(skb)))
+               stats->mcast_packets++;
 }
 
 static inline void mlx5e_complete_rx_cqe(struct mlx5e_rq *rq,
@@ -1132,7 +1136,6 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
        struct xdp_buff xdp;
        struct sk_buff *skb;
        void *va, *data;
-       bool consumed;
        u32 frag_size;
 
        va             = page_address(di->page) + wi->offset;
@@ -1144,11 +1147,8 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
        prefetchw(va); /* xdp_frame data area */
        prefetch(data);
 
-       rcu_read_lock();
        mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt, &xdp);
-       consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp);
-       rcu_read_unlock();
-       if (consumed)
+       if (mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp))
                return NULL; /* page/packet was consumed by XDP */
 
        rx_headroom = xdp.data - xdp.data_hard_start;
@@ -1438,7 +1438,6 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
        struct sk_buff *skb;
        void *va, *data;
        u32 frag_size;
-       bool consumed;
 
        /* Check packet size. Note LRO doesn't use linear SKB */
        if (unlikely(cqe_bcnt > rq->hw_mtu)) {
@@ -1455,11 +1454,8 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
        prefetchw(va); /* xdp_frame data area */
        prefetch(data);
 
-       rcu_read_lock();
        mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt32, &xdp);
-       consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp);
-       rcu_read_unlock();
-       if (consumed) {
+       if (mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp)) {
                if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags))
                        __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
                return NULL; /* page/packet was consumed by XDP */
index e3b2f59408e655e0f393d4d13eb2a8d15b73c5b8..f6383bc2bc3fe9419f8adc801bb741d49c7723e2 100644 (file)
@@ -54,6 +54,18 @@ unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv)
        return total;
 }
 
+void mlx5e_stats_update_ndo_stats(struct mlx5e_priv *priv)
+{
+       mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
+       const unsigned int num_stats_grps = stats_grps_num(priv);
+       int i;
+
+       for (i = num_stats_grps - 1; i >= 0; i--)
+               if (stats_grps[i]->update_stats &&
+                   stats_grps[i]->update_stats_mask & MLX5E_NDO_UPDATE_STATS)
+                       stats_grps[i]->update_stats(priv);
+}
+
 void mlx5e_stats_update(struct mlx5e_priv *priv)
 {
        mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
index 2e1cca1923b93757e792e2baabe9e0fe5d6f3b0e..562263d62141339972ce7dfeb76afa0153142751 100644 (file)
@@ -103,6 +103,7 @@ unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv);
 void mlx5e_stats_update(struct mlx5e_priv *priv);
 void mlx5e_stats_fill(struct mlx5e_priv *priv, u64 *data, int idx);
 void mlx5e_stats_fill_strings(struct mlx5e_priv *priv, u8 *data);
+void mlx5e_stats_update_ndo_stats(struct mlx5e_priv *priv);
 
 /* Concrete NIC Stats */
 
@@ -119,6 +120,7 @@ struct mlx5e_sw_stats {
        u64 tx_nop;
        u64 rx_lro_packets;
        u64 rx_lro_bytes;
+       u64 rx_mcast_packets;
        u64 rx_ecn_mark;
        u64 rx_removed_vlan_packets;
        u64 rx_csum_unnecessary;
@@ -298,6 +300,7 @@ struct mlx5e_rq_stats {
        u64 csum_none;
        u64 lro_packets;
        u64 lro_bytes;
+       u64 mcast_packets;
        u64 ecn_mark;
        u64 removed_vlan_packets;
        u64 xdp_drop;
index fd53d101d8fd27453968e8d3b1a3b1de9cc0d03c..1c93f92d9210aea838c911d7f6a806b71448f597 100644 (file)
@@ -1290,11 +1290,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
 
        mlx5e_put_flow_tunnel_id(flow);
 
-       if (flow_flag_test(flow, NOT_READY)) {
+       if (flow_flag_test(flow, NOT_READY))
                remove_unready_flow(flow);
-               kvfree(attr->parse_attr);
-               return;
-       }
 
        if (mlx5e_is_offloaded_flow(flow)) {
                if (flow_flag_test(flow, SLOW))
@@ -1315,6 +1312,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
                }
        kvfree(attr->parse_attr);
 
+       mlx5_tc_ct_match_del(priv, &flow->esw_attr->ct_attr);
+
        if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
                mlx5e_detach_mod_hdr(priv, flow);
 
@@ -2625,6 +2624,22 @@ static struct mlx5_fields fields[] = {
        OFFLOAD(UDP_DPORT, 16, U16_MAX, udp.dest,   0, udp_dport),
 };
 
+static unsigned long mask_to_le(unsigned long mask, int size)
+{
+       __be32 mask_be32;
+       __be16 mask_be16;
+
+       if (size == 32) {
+               mask_be32 = (__force __be32)(mask);
+               mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32));
+       } else if (size == 16) {
+               mask_be32 = (__force __be32)(mask);
+               mask_be16 = *(__be16 *)&mask_be32;
+               mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16));
+       }
+
+       return mask;
+}
 static int offload_pedit_fields(struct mlx5e_priv *priv,
                                int namespace,
                                struct pedit_headers_action *hdrs,
@@ -2638,9 +2653,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv,
        u32 *s_masks_p, *a_masks_p, s_mask, a_mask;
        struct mlx5e_tc_mod_hdr_acts *mod_acts;
        struct mlx5_fields *f;
-       unsigned long mask;
-       __be32 mask_be32;
-       __be16 mask_be16;
+       unsigned long mask, field_mask;
        int err;
        u8 cmd;
 
@@ -2706,14 +2719,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv,
                if (skip)
                        continue;
 
-               if (f->field_bsize == 32) {
-                       mask_be32 = (__force __be32)(mask);
-                       mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32));
-               } else if (f->field_bsize == 16) {
-                       mask_be32 = (__force __be32)(mask);
-                       mask_be16 = *(__be16 *)&mask_be32;
-                       mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16));
-               }
+               mask = mask_to_le(mask, f->field_bsize);
 
                first = find_first_bit(&mask, f->field_bsize);
                next_z = find_next_zero_bit(&mask, f->field_bsize, first);
@@ -2744,9 +2750,10 @@ static int offload_pedit_fields(struct mlx5e_priv *priv,
                if (cmd == MLX5_ACTION_TYPE_SET) {
                        int start;
 
+                       field_mask = mask_to_le(f->field_mask, f->field_bsize);
+
                        /* if field is bit sized it can start not from first bit */
-                       start = find_first_bit((unsigned long *)&f->field_mask,
-                                              f->field_bsize);
+                       start = find_first_bit(&field_mask, f->field_bsize);
 
                        MLX5_SET(set_action_in, action, offset, first - start);
                        /* length is num of bits to be written, zero means length of 32 */
@@ -4402,8 +4409,8 @@ __mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
                goto err_free;
 
        /* actions validation depends on parsing the ct matches first */
-       err = mlx5_tc_ct_parse_match(priv, &parse_attr->spec, f,
-                                    &flow->esw_attr->ct_attr, extack);
+       err = mlx5_tc_ct_match_add(priv, &parse_attr->spec, f,
+                                  &flow->esw_attr->ct_attr, extack);
        if (err)
                goto err_free;
 
index de10b06bade53d5ada8994f684d87d8be067f0e5..d5868670f8a5895625e253b1e4c3b7ceeb39fab9 100644 (file)
@@ -121,13 +121,17 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
        struct mlx5e_xdpsq *xsksq = &c->xsksq;
        struct mlx5e_rq *xskrq = &c->xskrq;
        struct mlx5e_rq *rq = &c->rq;
-       bool xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
        bool aff_change = false;
        bool busy_xsk = false;
        bool busy = false;
        int work_done = 0;
+       bool xsk_open;
        int i;
 
+       rcu_read_lock();
+
+       xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
+
        ch_stats->poll++;
 
        for (i = 0; i < c->num_tc; i++)
@@ -167,8 +171,10 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
        busy |= busy_xsk;
 
        if (busy) {
-               if (likely(mlx5e_channel_no_affinity_change(c)))
-                       return budget;
+               if (likely(mlx5e_channel_no_affinity_change(c))) {
+                       work_done = budget;
+                       goto out;
+               }
                ch_stats->aff_change++;
                aff_change = true;
                if (budget && work_done == budget)
@@ -176,7 +182,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
        }
 
        if (unlikely(!napi_complete_done(napi, work_done)))
-               return work_done;
+               goto out;
 
        ch_stats->arm++;
 
@@ -203,6 +209,9 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
                ch_stats->force_irq++;
        }
 
+out:
+       rcu_read_unlock();
+
        return work_done;
 }
 
index d2516922d8678b1678a454b71e9487f5ac607e6b..1bcf2609dca86962f628009478e60b7c4d7b374e 100644 (file)
@@ -1219,35 +1219,37 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw)
        }
        esw->fdb_table.offloads.send_to_vport_grp = g;
 
-       /* create peer esw miss group */
-       memset(flow_group_in, 0, inlen);
+       if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) {
+               /* create peer esw miss group */
+               memset(flow_group_in, 0, inlen);
 
-       esw_set_flow_group_source_port(esw, flow_group_in);
+               esw_set_flow_group_source_port(esw, flow_group_in);
 
-       if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) {
-               match_criteria = MLX5_ADDR_OF(create_flow_group_in,
-                                             flow_group_in,
-                                             match_criteria);
+               if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) {
+                       match_criteria = MLX5_ADDR_OF(create_flow_group_in,
+                                                     flow_group_in,
+                                                     match_criteria);
 
-               MLX5_SET_TO_ONES(fte_match_param, match_criteria,
-                                misc_parameters.source_eswitch_owner_vhca_id);
+                       MLX5_SET_TO_ONES(fte_match_param, match_criteria,
+                                        misc_parameters.source_eswitch_owner_vhca_id);
 
-               MLX5_SET(create_flow_group_in, flow_group_in,
-                        source_eswitch_owner_vhca_id_valid, 1);
-       }
+                       MLX5_SET(create_flow_group_in, flow_group_in,
+                                source_eswitch_owner_vhca_id_valid, 1);
+               }
 
-       MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, ix);
-       MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index,
-                ix + esw->total_vports - 1);
-       ix += esw->total_vports;
+               MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, ix);
+               MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index,
+                        ix + esw->total_vports - 1);
+               ix += esw->total_vports;
 
-       g = mlx5_create_flow_group(fdb, flow_group_in);
-       if (IS_ERR(g)) {
-               err = PTR_ERR(g);
-               esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err);
-               goto peer_miss_err;
+               g = mlx5_create_flow_group(fdb, flow_group_in);
+               if (IS_ERR(g)) {
+                       err = PTR_ERR(g);
+                       esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err);
+                       goto peer_miss_err;
+               }
+               esw->fdb_table.offloads.peer_miss_grp = g;
        }
-       esw->fdb_table.offloads.peer_miss_grp = g;
 
        /* create miss group */
        memset(flow_group_in, 0, inlen);
@@ -1281,7 +1283,8 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw)
 miss_rule_err:
        mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
 miss_err:
-       mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
+       if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
+               mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
 peer_miss_err:
        mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);
 send_vport_err:
@@ -1305,7 +1308,8 @@ static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw)
        mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_multi);
        mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_uni);
        mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);
-       mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
+       if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
+               mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
        mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
 
        mlx5_esw_chains_destroy(esw);
index 9ccec5f8b92a78cd3efe6d884f499e335888c583..75fa44eee434d9538a3d82e78994dfb63cdece16 100644 (file)
@@ -654,7 +654,7 @@ static struct fs_fte *alloc_fte(struct mlx5_flow_table *ft,
        fte->action = *flow_act;
        fte->flow_context = spec->flow_context;
 
-       tree_init_node(&fte->node, NULL, del_sw_fte);
+       tree_init_node(&fte->node, del_hw_fte, del_sw_fte);
 
        return fte;
 }
@@ -1792,7 +1792,6 @@ skip_search:
                up_write_ref_node(&g->node, false);
                rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
                up_write_ref_node(&fte->node, false);
-               tree_put_node(&fte->node, false);
                return rule;
        }
        rule = ERR_PTR(-ENOENT);
@@ -1891,7 +1890,6 @@ search_again_locked:
        up_write_ref_node(&g->node, false);
        rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
        up_write_ref_node(&fte->node, false);
-       tree_put_node(&fte->node, false);
        tree_put_node(&g->node, false);
        return rule;
 
@@ -2001,7 +1999,9 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)
                up_write_ref_node(&fte->node, false);
        } else {
                del_hw_fte(&fte->node);
-               up_write(&fte->node.lock);
+               /* Avoid double call to del_hw_fte */
+               fte->node.del_hw_func = NULL;
+               up_write_ref_node(&fte->node, false);
                tree_put_node(&fte->node, false);
        }
        kfree(handle);
index 7a04c626a2aa50efed43785074494598d826b7cc..bcd166911d444b13dcbe7b390073368116a1ac34 100644 (file)
@@ -72,7 +72,7 @@ static int mlxfw_fsm_state_err(struct mlxfw_dev *mlxfw_dev,
        case MLXFW_FSM_STATE_ERR_BLOCKED_PENDING_RESET:
                MLXFW_ERR_MSG(mlxfw_dev, extack, "pending reset", err);
                break;
-       case MLXFW_FSM_STATE_ERR_OK: /* fall through */
+       case MLXFW_FSM_STATE_ERR_OK:
        case MLXFW_FSM_STATE_ERR_MAX:
                MLXFW_ERR_MSG(mlxfw_dev, extack, "unknown error", err);
                break;
@@ -155,7 +155,7 @@ mlxfw_fsm_reactivate_err(struct mlxfw_dev *mlxfw_dev,
        case MLXFW_FSM_REACTIVATE_STATUS_FW_ALREADY_ACTIVATED:
                MLXFW_REACT_ERR("fw already activated", err);
                break;
-       case MLXFW_FSM_REACTIVATE_STATUS_OK: /* fall through */
+       case MLXFW_FSM_REACTIVATE_STATUS_OK:
        case MLXFW_FSM_REACTIVATE_STATUS_MAX:
                MLXFW_REACT_ERR("unexpected error", err);
                break;
index 08d101138fbe177ffc55d9df91b9f932c36b934c..ec45a03140d7f4e969be6fd43041109806ecf1c0 100644 (file)
@@ -2289,21 +2289,21 @@ int mlxsw_core_module_max_width(struct mlxsw_core *mlxsw_core, u8 module)
        /* Here we need to get the module width according to the module type. */
 
        switch (module_type) {
-       case MLXSW_REG_PMTM_MODULE_TYPE_C2C8X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_QSFP_DD: /* fall through */
+       case MLXSW_REG_PMTM_MODULE_TYPE_C2C8X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_QSFP_DD:
        case MLXSW_REG_PMTM_MODULE_TYPE_OSFP:
                return 8;
-       case MLXSW_REG_PMTM_MODULE_TYPE_C2C4X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_BP_4X: /* fall through */
+       case MLXSW_REG_PMTM_MODULE_TYPE_C2C4X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_BP_4X:
        case MLXSW_REG_PMTM_MODULE_TYPE_QSFP:
                return 4;
-       case MLXSW_REG_PMTM_MODULE_TYPE_C2C2X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_BP_2X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_SFP_DD: /* fall through */
+       case MLXSW_REG_PMTM_MODULE_TYPE_C2C2X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_BP_2X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_SFP_DD:
        case MLXSW_REG_PMTM_MODULE_TYPE_DSFP:
                return 2;
-       case MLXSW_REG_PMTM_MODULE_TYPE_C2C1X: /* fall through */
-       case MLXSW_REG_PMTM_MODULE_TYPE_BP_1X: /* fall through */
+       case MLXSW_REG_PMTM_MODULE_TYPE_C2C1X:
+       case MLXSW_REG_PMTM_MODULE_TYPE_BP_1X:
        case MLXSW_REG_PMTM_MODULE_TYPE_SFP:
                return 1;
        default:
index 44fa02cbb683db24cc4115030586d66c37de3306..056eeb85be6047f87a40bfb74a5965e1d1f17aab 100644 (file)
@@ -30,8 +30,8 @@ static int mlxsw_env_validate_cable_ident(struct mlxsw_core *core, int id,
        case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_SFP:
                *qsfp = false;
                break;
-       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP: /* fall-through */
-       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_PLUS: /* fall-through */
+       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP:
+       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_PLUS:
        case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP28:
                *qsfp = true;
                break;
@@ -205,7 +205,7 @@ int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module,
                modinfo->type       = ETH_MODULE_SFF_8436;
                modinfo->eeprom_len = ETH_MODULE_SFF_8436_MAX_LEN;
                break;
-       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_PLUS: /* fall-through */
+       case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_PLUS:
        case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP28:
                if (module_id == MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP28 ||
                    module_rev_id >=
index 3fe878d7c94cb3edf5c5fb59f0a3024ecf417df0..61719ec89808f8fbf80d813501439727c57cc845 100644 (file)
@@ -259,8 +259,8 @@ static ssize_t mlxsw_hwmon_module_temp_fault_show(struct device *dev,
                 */
                fault = 1;
                break;
-       case MLXSW_REG_MTBR_NO_CONN: /* fall-through */
-       case MLXSW_REG_MTBR_NO_TEMP_SENS: /* fall-through */
+       case MLXSW_REG_MTBR_NO_CONN:
+       case MLXSW_REG_MTBR_NO_TEMP_SENS:
        case MLXSW_REG_MTBR_INDEX_NA:
        default:
                fault = 0;
index fdf9aa8314b29933b0739edab74a9751e1ed87b5..4186e29119c27d134ee867ddb86cca418f2d7d95 100644 (file)
@@ -517,8 +517,8 @@ enum mlxsw_reg_spms_state mlxsw_sp_stp_spms_state(u8 state)
                return MLXSW_REG_SPMS_STATE_FORWARDING;
        case BR_STATE_LEARNING:
                return MLXSW_REG_SPMS_STATE_LEARNING;
-       case BR_STATE_LISTENING: /* fall-through */
-       case BR_STATE_DISABLED: /* fall-through */
+       case BR_STATE_LISTENING:
+       case BR_STATE_DISABLED:
        case BR_STATE_BLOCKING:
                return MLXSW_REG_SPMS_STATE_DISCARDING;
        default:
index f9ba59641b4df93dc1f7c495a098b879e502a7a3..5240bf11b6c42d310b9e660cdd40ac3546a000a8 100644 (file)
@@ -636,11 +636,11 @@ static inline unsigned int
 mlxsw_sp_kvdl_entry_size(enum mlxsw_sp_kvdl_entry_type type)
 {
        switch (type) {
-       case MLXSW_SP_KVDL_ENTRY_TYPE_ADJ: /* fall through */
-       case MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET: /* fall through */
-       case MLXSW_SP_KVDL_ENTRY_TYPE_PBS: /* fall through */
-       case MLXSW_SP_KVDL_ENTRY_TYPE_MCRIGR: /* fall through */
-       case MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT: /* fall through */
+       case MLXSW_SP_KVDL_ENTRY_TYPE_ADJ:
+       case MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET:
+       case MLXSW_SP_KVDL_ENTRY_TYPE_PBS:
+       case MLXSW_SP_KVDL_ENTRY_TYPE_MCRIGR:
+       case MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT:
        default:
                return 1;
        }
index 0521e9d48c457df8c3b1a5469e176cd4c07b45aa..24f1fd1f8d5619ecb757c31355fb8a77f0358917 100644 (file)
@@ -1164,7 +1164,7 @@ mlxsw_sp_router_ip2me_fib_entry_find(struct mlxsw_sp *mlxsw_sp, u32 tb_id,
                addr_len = 4;
                addr_prefix_len = 32;
                break;
-       case MLXSW_SP_L3_PROTO_IPV6: /* fall through */
+       case MLXSW_SP_L3_PROTO_IPV6:
        default:
                WARN_ON(1);
                return NULL;
@@ -4555,14 +4555,14 @@ mlxsw_sp_fib4_entry_type_set(struct mlxsw_sp *mlxsw_sp,
                        fib_entry->type = MLXSW_SP_FIB_ENTRY_TYPE_NVE_DECAP;
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        case RTN_BROADCAST:
                fib_entry->type = MLXSW_SP_FIB_ENTRY_TYPE_TRAP;
                return 0;
        case RTN_BLACKHOLE:
                fib_entry->type = MLXSW_SP_FIB_ENTRY_TYPE_BLACKHOLE;
                return 0;
-       case RTN_UNREACHABLE: /* fall through */
+       case RTN_UNREACHABLE:
        case RTN_PROHIBIT:
                /* Packets hitting these routes need to be trapped, but
                 * can do so with a lower priority than packets directed
@@ -5990,7 +5990,7 @@ static void mlxsw_sp_router_fib4_event_work(struct work_struct *work)
                mlxsw_sp_router_fib4_del(mlxsw_sp, &fib_work->fen_info);
                fib_info_put(fib_work->fen_info.fi);
                break;
-       case FIB_EVENT_NH_ADD: /* fall through */
+       case FIB_EVENT_NH_ADD:
        case FIB_EVENT_NH_DEL:
                mlxsw_sp_nexthop4_event(mlxsw_sp, fib_work->event,
                                        fib_work->fnh_info.fib_nh);
@@ -6050,7 +6050,7 @@ static void mlxsw_sp_router_fibmr_event_work(struct work_struct *work)
        rtnl_lock();
        mutex_lock(&mlxsw_sp->router->lock);
        switch (fib_work->event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_ADD:
                replace = fib_work->event == FIB_EVENT_ENTRY_REPLACE;
 
@@ -6089,7 +6089,7 @@ static void mlxsw_sp_router_fib4_event(struct mlxsw_sp_fib_event_work *fib_work,
        struct fib_nh_notifier_info *fnh_info;
 
        switch (fib_work->event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_DEL:
                fen_info = container_of(info, struct fib_entry_notifier_info,
                                        info);
@@ -6099,7 +6099,7 @@ static void mlxsw_sp_router_fib4_event(struct mlxsw_sp_fib_event_work *fib_work,
                 */
                fib_info_hold(fib_work->fen_info.fi);
                break;
-       case FIB_EVENT_NH_ADD: /* fall through */
+       case FIB_EVENT_NH_ADD:
        case FIB_EVENT_NH_DEL:
                fnh_info = container_of(info, struct fib_nh_notifier_info,
                                        info);
@@ -6116,8 +6116,8 @@ static int mlxsw_sp_router_fib6_event(struct mlxsw_sp_fib_event_work *fib_work,
        int err;
 
        switch (fib_work->event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
-       case FIB_EVENT_ENTRY_APPEND: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
+       case FIB_EVENT_ENTRY_APPEND:
        case FIB_EVENT_ENTRY_DEL:
                fen6_info = container_of(info, struct fib6_entry_notifier_info,
                                         info);
@@ -6136,13 +6136,13 @@ mlxsw_sp_router_fibmr_event(struct mlxsw_sp_fib_event_work *fib_work,
                            struct fib_notifier_info *info)
 {
        switch (fib_work->event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
-       case FIB_EVENT_ENTRY_ADD: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
+       case FIB_EVENT_ENTRY_ADD:
        case FIB_EVENT_ENTRY_DEL:
                memcpy(&fib_work->men_info, info, sizeof(fib_work->men_info));
                mr_cache_hold(fib_work->men_info.mfc);
                break;
-       case FIB_EVENT_VIF_ADD: /* fall through */
+       case FIB_EVENT_VIF_ADD:
        case FIB_EVENT_VIF_DEL:
                memcpy(&fib_work->ven_info, info, sizeof(fib_work->ven_info));
                dev_hold(fib_work->ven_info.dev);
@@ -6215,13 +6215,13 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
        router = container_of(nb, struct mlxsw_sp_router, fib_nb);
 
        switch (event) {
-       case FIB_EVENT_RULE_ADD: /* fall through */
+       case FIB_EVENT_RULE_ADD:
        case FIB_EVENT_RULE_DEL:
                err = mlxsw_sp_router_fib_rule_event(event, info,
                                                     router->mlxsw_sp);
                return notifier_from_errno(err);
-       case FIB_EVENT_ENTRY_ADD: /* fall through */
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
+       case FIB_EVENT_ENTRY_ADD:
+       case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_APPEND:
                if (router->aborted) {
                        NL_SET_ERR_MSG_MOD(info->extack, "FIB offload was aborted. Not configuring route");
@@ -7277,7 +7277,7 @@ int mlxsw_sp_netdevice_router_port_event(struct net_device *dev,
                goto out;
 
        switch (event) {
-       case NETDEV_CHANGEMTU: /* fall through */
+       case NETDEV_CHANGEMTU:
        case NETDEV_CHANGEADDR:
                err = mlxsw_sp_router_port_change_event(mlxsw_sp, rif);
                break;
index 5c959a995199619fbcab695f02055abe8457bb6d..1d18e41ab2553815c31e0952a91fdc739a9c2779 100644 (file)
@@ -1523,12 +1523,12 @@ mlxsw_sp_span_trigger_ops_set(struct mlxsw_sp_span_trigger_entry *trigger_entry)
        enum mlxsw_sp_span_trigger_type type;
 
        switch (trigger_entry->trigger) {
-       case MLXSW_SP_SPAN_TRIGGER_INGRESS: /* fall-through */
+       case MLXSW_SP_SPAN_TRIGGER_INGRESS:
        case MLXSW_SP_SPAN_TRIGGER_EGRESS:
                type = MLXSW_SP_SPAN_TRIGGER_TYPE_PORT;
                break;
-       case MLXSW_SP_SPAN_TRIGGER_TAIL_DROP: /* fall-through */
-       case MLXSW_SP_SPAN_TRIGGER_EARLY_DROP: /* fall-through */
+       case MLXSW_SP_SPAN_TRIGGER_TAIL_DROP:
+       case MLXSW_SP_SPAN_TRIGGER_EARLY_DROP:
        case MLXSW_SP_SPAN_TRIGGER_ECN:
                type = MLXSW_SP_SPAN_TRIGGER_TYPE_GLOBAL;
                break;
index a26162b08b7d8de47bb562cc5d2d6321788cb51a..72912afa6f72a2637653b53144fafcb239c2d0b6 100644 (file)
@@ -1297,7 +1297,7 @@ static int mlxsw_sp_port_fdb_tunnel_uc_op(struct mlxsw_sp *mlxsw_sp,
                uip = be32_to_cpu(addr->addr4);
                sfd_proto = MLXSW_REG_SFD_UC_TUNNEL_PROTOCOL_IPV4;
                break;
-       case MLXSW_SP_L3_PROTO_IPV6: /* fall through */
+       case MLXSW_SP_L3_PROTO_IPV6:
        default:
                WARN_ON(1);
                return -EOPNOTSUPP;
@@ -2870,7 +2870,7 @@ static void mlxsw_sp_switchdev_bridge_fdb_event_work(struct work_struct *work)
                fdb_info = &switchdev_work->fdb_info;
                mlxsw_sp_port_fdb_set(mlxsw_sp_port, fdb_info, false);
                break;
-       case SWITCHDEV_FDB_ADD_TO_BRIDGE: /* fall through */
+       case SWITCHDEV_FDB_ADD_TO_BRIDGE:
        case SWITCHDEV_FDB_DEL_TO_BRIDGE:
                /* These events are only used to potentially update an existing
                 * SPAN mirror.
@@ -3116,9 +3116,9 @@ static int mlxsw_sp_switchdev_event(struct notifier_block *unused,
        switchdev_work->event = event;
 
        switch (event) {
-       case SWITCHDEV_FDB_ADD_TO_DEVICE: /* fall through */
-       case SWITCHDEV_FDB_DEL_TO_DEVICE: /* fall through */
-       case SWITCHDEV_FDB_ADD_TO_BRIDGE: /* fall through */
+       case SWITCHDEV_FDB_ADD_TO_DEVICE:
+       case SWITCHDEV_FDB_DEL_TO_DEVICE:
+       case SWITCHDEV_FDB_ADD_TO_BRIDGE:
        case SWITCHDEV_FDB_DEL_TO_BRIDGE:
                fdb_info = container_of(info,
                                        struct switchdev_notifier_fdb_info,
@@ -3138,7 +3138,7 @@ static int mlxsw_sp_switchdev_event(struct notifier_block *unused,
                 */
                dev_hold(dev);
                break;
-       case SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE: /* fall through */
+       case SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE:
        case SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE:
                INIT_WORK(&switchdev_work->work,
                          mlxsw_sp_switchdev_vxlan_fdb_event_work);
index c533d06fbe3a599e40c4d51824f6b474eb0408d8..dcde496da7fb4b6c7a79f723d99a733e9493d49f 100644 (file)
@@ -548,7 +548,7 @@ static int lan743x_ethtool_get_rxnfc(struct net_device *netdev,
                case TCP_V4_FLOW:case UDP_V4_FLOW:
                case TCP_V6_FLOW:case UDP_V6_FLOW:
                        rxnfc->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-                       /* fall through */
+                       fallthrough;
                case IPV4_FLOW: case IPV6_FLOW:
                        rxnfc->data |= RXH_IP_SRC | RXH_IP_DST;
                        return 0;
index 867c680f5917787388083081b349d47740a3c215..8518e1d60da4f3b9cec248dbbb1239f28d8929fd 100644 (file)
@@ -421,10 +421,15 @@ int ocelot_port_add_txtstamp_skb(struct ocelot_port *ocelot_port,
 
        if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP &&
            ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
+               spin_lock(&ocelot_port->ts_id_lock);
+
                shinfo->tx_flags |= SKBTX_IN_PROGRESS;
                /* Store timestamp ID in cb[0] of sk_buff */
-               skb->cb[0] = ocelot_port->ts_id % 4;
+               skb->cb[0] = ocelot_port->ts_id;
+               ocelot_port->ts_id = (ocelot_port->ts_id + 1) % 4;
                skb_queue_tail(&ocelot_port->tx_skbs, skb);
+
+               spin_unlock(&ocelot_port->ts_id_lock);
                return 0;
        }
        return -ENODATA;
@@ -859,7 +864,7 @@ void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state)
        switch (state) {
        case BR_STATE_FORWARDING:
                ocelot->bridge_fwd_mask |= BIT(port);
-               /* Fallthrough */
+               fallthrough;
        case BR_STATE_LEARNING:
                port_cfg |= ANA_PORT_PORT_CFG_LEARN_ENA;
                break;
@@ -1300,6 +1305,7 @@ void ocelot_init_port(struct ocelot *ocelot, int port)
        struct ocelot_port *ocelot_port = ocelot->ports[port];
 
        skb_queue_head_init(&ocelot_port->tx_skbs);
+       spin_lock_init(&ocelot_port->ts_id_lock);
 
        /* Basic L2 initialization */
 
@@ -1544,18 +1550,18 @@ EXPORT_SYMBOL(ocelot_init);
 
 void ocelot_deinit(struct ocelot *ocelot)
 {
-       struct ocelot_port *port;
-       int i;
-
        cancel_delayed_work(&ocelot->stats_work);
        destroy_workqueue(ocelot->stats_queue);
        mutex_destroy(&ocelot->stats_lock);
-
-       for (i = 0; i < ocelot->num_phys_ports; i++) {
-               port = ocelot->ports[i];
-               skb_queue_purge(&port->tx_skbs);
-       }
 }
 EXPORT_SYMBOL(ocelot_deinit);
 
+void ocelot_deinit_port(struct ocelot *ocelot, int port)
+{
+       struct ocelot_port *ocelot_port = ocelot->ports[port];
+
+       skb_queue_purge(&ocelot_port->tx_skbs);
+}
+EXPORT_SYMBOL(ocelot_deinit_port);
+
 MODULE_LICENSE("Dual MIT/GPL");
index 0668d23cdbfa9a155534965511007ecbdaf2c677..8490e42e9e2d5d4ce99e65cf4db1538a57808328 100644 (file)
@@ -330,6 +330,7 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
        u8 grp = 0; /* Send everything on CPU group 0 */
        unsigned int i, count, last;
        int port = priv->chip_port;
+       bool do_tstamp;
 
        val = ocelot_read(ocelot, QS_INJ_STATUS);
        if (!(val & QS_INJ_STATUS_FIFO_RDY(BIT(grp))) ||
@@ -344,10 +345,12 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
        info.vid = skb_vlan_tag_get(skb);
 
        /* Check if timestamping is needed */
+       do_tstamp = (ocelot_port_add_txtstamp_skb(ocelot_port, skb) == 0);
+
        if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP) {
                info.rew_op = ocelot_port->ptp_cmd;
                if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP)
-                       info.rew_op |= (ocelot_port->ts_id  % 4) << 3;
+                       info.rew_op |= skb->cb[0] << 3;
        }
 
        ocelot_gen_ifh(ifh, &info);
@@ -380,12 +383,9 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
        dev->stats.tx_packets++;
        dev->stats.tx_bytes += skb->len;
 
-       if (!ocelot_port_add_txtstamp_skb(ocelot_port, skb)) {
-               ocelot_port->ts_id++;
-               return NETDEV_TX_OK;
-       }
+       if (!do_tstamp)
+               dev_kfree_skb_any(skb);
 
-       dev_kfree_skb_any(skb);
        return NETDEV_TX_OK;
 }
 
index 65408bc994c4d3b927c735f7b340ae97495341c8..dfb1535f26f299270906a562edab37b486f98a09 100644 (file)
@@ -806,17 +806,17 @@ static const struct vcap_field vsc7514_vcap_is2_keys[] = {
        [VCAP_IS2_HK_DIP_EQ_SIP]                = {123,   1},
        /* IP4_TCP_UDP (TYPE=100) */
        [VCAP_IS2_HK_TCP]                       = {124,   1},
-       [VCAP_IS2_HK_L4_SPORT]                  = {125,  16},
-       [VCAP_IS2_HK_L4_DPORT]                  = {141,  16},
+       [VCAP_IS2_HK_L4_DPORT]                  = {125,  16},
+       [VCAP_IS2_HK_L4_SPORT]                  = {141,  16},
        [VCAP_IS2_HK_L4_RNG]                    = {157,   8},
        [VCAP_IS2_HK_L4_SPORT_EQ_DPORT]         = {165,   1},
        [VCAP_IS2_HK_L4_SEQUENCE_EQ0]           = {166,   1},
-       [VCAP_IS2_HK_L4_URG]                    = {167,   1},
-       [VCAP_IS2_HK_L4_ACK]                    = {168,   1},
-       [VCAP_IS2_HK_L4_PSH]                    = {169,   1},
-       [VCAP_IS2_HK_L4_RST]                    = {170,   1},
-       [VCAP_IS2_HK_L4_SYN]                    = {171,   1},
-       [VCAP_IS2_HK_L4_FIN]                    = {172,   1},
+       [VCAP_IS2_HK_L4_FIN]                    = {167,   1},
+       [VCAP_IS2_HK_L4_SYN]                    = {168,   1},
+       [VCAP_IS2_HK_L4_RST]                    = {169,   1},
+       [VCAP_IS2_HK_L4_PSH]                    = {170,   1},
+       [VCAP_IS2_HK_L4_ACK]                    = {171,   1},
+       [VCAP_IS2_HK_L4_URG]                    = {172,   1},
        [VCAP_IS2_HK_L4_1588_DOM]               = {173,   8},
        [VCAP_IS2_HK_L4_1588_VER]               = {181,   4},
        /* IP4_OTHER (TYPE=101) */
@@ -896,11 +896,137 @@ static struct ptp_clock_info ocelot_ptp_clock_info = {
        .enable         = ocelot_ptp_enable,
 };
 
+static void mscc_ocelot_release_ports(struct ocelot *ocelot)
+{
+       int port;
+
+       for (port = 0; port < ocelot->num_phys_ports; port++) {
+               struct ocelot_port_private *priv;
+               struct ocelot_port *ocelot_port;
+
+               ocelot_port = ocelot->ports[port];
+               if (!ocelot_port)
+                       continue;
+
+               ocelot_deinit_port(ocelot, port);
+
+               priv = container_of(ocelot_port, struct ocelot_port_private,
+                                   port);
+
+               unregister_netdev(priv->dev);
+               free_netdev(priv->dev);
+       }
+}
+
+static int mscc_ocelot_init_ports(struct platform_device *pdev,
+                                 struct device_node *ports)
+{
+       struct ocelot *ocelot = platform_get_drvdata(pdev);
+       struct device_node *portnp;
+       int err;
+
+       ocelot->ports = devm_kcalloc(ocelot->dev, ocelot->num_phys_ports,
+                                    sizeof(struct ocelot_port *), GFP_KERNEL);
+       if (!ocelot->ports)
+               return -ENOMEM;
+
+       /* No NPI port */
+       ocelot_configure_cpu(ocelot, -1, OCELOT_TAG_PREFIX_NONE,
+                            OCELOT_TAG_PREFIX_NONE);
+
+       for_each_available_child_of_node(ports, portnp) {
+               struct ocelot_port_private *priv;
+               struct ocelot_port *ocelot_port;
+               struct device_node *phy_node;
+               phy_interface_t phy_mode;
+               struct phy_device *phy;
+               struct regmap *target;
+               struct resource *res;
+               struct phy *serdes;
+               char res_name[8];
+               u32 port;
+
+               if (of_property_read_u32(portnp, "reg", &port))
+                       continue;
+
+               snprintf(res_name, sizeof(res_name), "port%d", port);
+
+               res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+                                                  res_name);
+               target = ocelot_regmap_init(ocelot, res);
+               if (IS_ERR(target))
+                       continue;
+
+               phy_node = of_parse_phandle(portnp, "phy-handle", 0);
+               if (!phy_node)
+                       continue;
+
+               phy = of_phy_find_device(phy_node);
+               of_node_put(phy_node);
+               if (!phy)
+                       continue;
+
+               err = ocelot_probe_port(ocelot, port, target, phy);
+               if (err) {
+                       of_node_put(portnp);
+                       return err;
+               }
+
+               ocelot_port = ocelot->ports[port];
+               priv = container_of(ocelot_port, struct ocelot_port_private,
+                                   port);
+
+               of_get_phy_mode(portnp, &phy_mode);
+
+               ocelot_port->phy_mode = phy_mode;
+
+               switch (ocelot_port->phy_mode) {
+               case PHY_INTERFACE_MODE_NA:
+                       continue;
+               case PHY_INTERFACE_MODE_SGMII:
+                       break;
+               case PHY_INTERFACE_MODE_QSGMII:
+                       /* Ensure clock signals and speed is set on all
+                        * QSGMII links
+                        */
+                       ocelot_port_writel(ocelot_port,
+                                          DEV_CLOCK_CFG_LINK_SPEED
+                                          (OCELOT_SPEED_1000),
+                                          DEV_CLOCK_CFG);
+                       break;
+               default:
+                       dev_err(ocelot->dev,
+                               "invalid phy mode for port%d, (Q)SGMII only\n",
+                               port);
+                       of_node_put(portnp);
+                       return -EINVAL;
+               }
+
+               serdes = devm_of_phy_get(ocelot->dev, portnp, NULL);
+               if (IS_ERR(serdes)) {
+                       err = PTR_ERR(serdes);
+                       if (err == -EPROBE_DEFER)
+                               dev_dbg(ocelot->dev, "deferring probe\n");
+                       else
+                               dev_err(ocelot->dev,
+                                       "missing SerDes phys for port%d\n",
+                                       port);
+
+                       of_node_put(portnp);
+                       return err;
+               }
+
+               priv->serdes = serdes;
+       }
+
+       return 0;
+}
+
 static int mscc_ocelot_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
-       struct device_node *ports, *portnp;
        int err, irq_xtr, irq_ptp_rdy;
+       struct device_node *ports;
        struct ocelot *ocelot;
        struct regmap *hsio;
        unsigned int i;
@@ -985,20 +1111,24 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
 
        ports = of_get_child_by_name(np, "ethernet-ports");
        if (!ports) {
-               dev_err(&pdev->dev, "no ethernet-ports child node found\n");
+               dev_err(ocelot->dev, "no ethernet-ports child node found\n");
                return -ENODEV;
        }
 
        ocelot->num_phys_ports = of_get_child_count(ports);
 
-       ocelot->ports = devm_kcalloc(&pdev->dev, ocelot->num_phys_ports,
-                                    sizeof(struct ocelot_port *), GFP_KERNEL);
-
        ocelot->vcap_is2_keys = vsc7514_vcap_is2_keys;
        ocelot->vcap_is2_actions = vsc7514_vcap_is2_actions;
        ocelot->vcap = vsc7514_vcap_props;
 
-       ocelot_init(ocelot);
+       err = ocelot_init(ocelot);
+       if (err)
+               goto out_put_ports;
+
+       err = mscc_ocelot_init_ports(pdev, ports);
+       if (err)
+               goto out_put_ports;
+
        if (ocelot->ptp) {
                err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
                if (err) {
@@ -1008,96 +1138,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
                }
        }
 
-       /* No NPI port */
-       ocelot_configure_cpu(ocelot, -1, OCELOT_TAG_PREFIX_NONE,
-                            OCELOT_TAG_PREFIX_NONE);
-
-       for_each_available_child_of_node(ports, portnp) {
-               struct ocelot_port_private *priv;
-               struct ocelot_port *ocelot_port;
-               struct device_node *phy_node;
-               phy_interface_t phy_mode;
-               struct phy_device *phy;
-               struct regmap *target;
-               struct resource *res;
-               struct phy *serdes;
-               char res_name[8];
-               u32 port;
-
-               if (of_property_read_u32(portnp, "reg", &port))
-                       continue;
-
-               snprintf(res_name, sizeof(res_name), "port%d", port);
-
-               res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-                                                  res_name);
-               target = ocelot_regmap_init(ocelot, res);
-               if (IS_ERR(target))
-                       continue;
-
-               phy_node = of_parse_phandle(portnp, "phy-handle", 0);
-               if (!phy_node)
-                       continue;
-
-               phy = of_phy_find_device(phy_node);
-               of_node_put(phy_node);
-               if (!phy)
-                       continue;
-
-               err = ocelot_probe_port(ocelot, port, target, phy);
-               if (err) {
-                       of_node_put(portnp);
-                       goto out_put_ports;
-               }
-
-               ocelot_port = ocelot->ports[port];
-               priv = container_of(ocelot_port, struct ocelot_port_private,
-                                   port);
-
-               of_get_phy_mode(portnp, &phy_mode);
-
-               ocelot_port->phy_mode = phy_mode;
-
-               switch (ocelot_port->phy_mode) {
-               case PHY_INTERFACE_MODE_NA:
-                       continue;
-               case PHY_INTERFACE_MODE_SGMII:
-                       break;
-               case PHY_INTERFACE_MODE_QSGMII:
-                       /* Ensure clock signals and speed is set on all
-                        * QSGMII links
-                        */
-                       ocelot_port_writel(ocelot_port,
-                                          DEV_CLOCK_CFG_LINK_SPEED
-                                          (OCELOT_SPEED_1000),
-                                          DEV_CLOCK_CFG);
-                       break;
-               default:
-                       dev_err(ocelot->dev,
-                               "invalid phy mode for port%d, (Q)SGMII only\n",
-                               port);
-                       of_node_put(portnp);
-                       err = -EINVAL;
-                       goto out_put_ports;
-               }
-
-               serdes = devm_of_phy_get(ocelot->dev, portnp, NULL);
-               if (IS_ERR(serdes)) {
-                       err = PTR_ERR(serdes);
-                       if (err == -EPROBE_DEFER)
-                               dev_dbg(ocelot->dev, "deferring probe\n");
-                       else
-                               dev_err(ocelot->dev,
-                                       "missing SerDes phys for port%d\n",
-                                       port);
-
-                       of_node_put(portnp);
-                       goto out_put_ports;
-               }
-
-               priv->serdes = serdes;
-       }
-
        register_netdevice_notifier(&ocelot_netdevice_nb);
        register_switchdev_notifier(&ocelot_switchdev_nb);
        register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
@@ -1114,6 +1154,7 @@ static int mscc_ocelot_remove(struct platform_device *pdev)
        struct ocelot *ocelot = platform_get_drvdata(pdev);
 
        ocelot_deinit_timestamp(ocelot);
+       mscc_ocelot_release_ports(ocelot);
        ocelot_deinit(ocelot);
        unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
        unregister_switchdev_notifier(&ocelot_switchdev_nb);
index c2867fe995bc5eb1f9690777e87f6fb78f6e31e3..3de8430ee8c5d15e32cbe0f5ec003cf6eb605e57 100644 (file)
@@ -3081,7 +3081,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = np->phy_addr_external;
-               /* Fall Through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                /* The phy_id is not enough to uniquely identify
index 4f1f90f5e178a6ed07bf0ec9451b863151fe69aa..78eba10300ae6d217a142d2cbb09972bbd1be2ce 100644 (file)
@@ -3768,20 +3768,20 @@ vxge_hw_rts_rth_data0_data1_get(u32 j, u64 *data0, u64 *data1,
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM0_ENTRY_EN |
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM0_BUCKET_DATA(
                        itable[j]);
-               /* fall through */
+               fallthrough;
        case 2:
                *data0 |=
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM1_BUCKET_NUM(j)|
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM1_ENTRY_EN |
                        VXGE_HW_RTS_ACCESS_STEER_DATA0_RTH_ITEM1_BUCKET_DATA(
                        itable[j]);
-               /* fall through */
+               fallthrough;
        case 3:
                *data1 = VXGE_HW_RTS_ACCESS_STEER_DATA1_RTH_ITEM0_BUCKET_NUM(j)|
                        VXGE_HW_RTS_ACCESS_STEER_DATA1_RTH_ITEM0_ENTRY_EN |
                        VXGE_HW_RTS_ACCESS_STEER_DATA1_RTH_ITEM0_BUCKET_DATA(
                        itable[j]);
-               /* fall through */
+               fallthrough;
        case 4:
                *data1 |=
                        VXGE_HW_RTS_ACCESS_STEER_DATA1_RTH_ITEM1_BUCKET_NUM(j)|
index 7c50e3dfb9d525d4b6ad349101baf01038754e2e..76c51da5b66f3191ff29191f6f148b1879c0f9ae 100644 (file)
@@ -296,7 +296,7 @@ nfp_net_tls_add(struct net_device *netdev, struct sock *sk,
                        break;
                }
 #endif
-               /* fall through */
+               fallthrough;
        case AF_INET:
                req_sz = sizeof(struct nfp_crypto_req_add_v4);
                ipv6 = false;
index ff844e5cc41fb4741b5ac2dadca26a4de35ef9d3..1cbe2c9f3959f9859915b9ad53508d4e709cb6a8 100644 (file)
@@ -297,7 +297,7 @@ nfp_fl_get_tun_from_act(struct nfp_app *app,
        case htons(GENEVE_UDP_PORT):
                if (priv->flower_ext_feats & NFP_FL_FEATS_GENEVE)
                        return NFP_FL_TUNNEL_GENEVE;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                return NFP_FL_TUNNEL_NONE;
        }
index a050cb898782849c1ad18a91e1b89396b045aa8f..f21cf1f40f98734cd2bd44835cba017cc0c3a67e 100644 (file)
@@ -289,7 +289,7 @@ nfp_flower_cmsg_process_one_rx(struct nfp_app *app, struct sk_buff *skb)
                        skb_stored = nfp_flower_lag_unprocessed_msg(app, skb);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
 err_default:
                nfp_flower_cmsg_warn(app, "Cannot handle invalid repr control type %u\n",
index 4651fe417b7f87a0ed38930e47c86e56bf50a7c6..36356f96661d7b1dad93f9b0b156cae5c4a97740 100644 (file)
@@ -784,7 +784,7 @@ nfp_flower_copy_pre_actions(char *act_dst, char *act_src, int len,
                case NFP_FL_ACTION_OPCODE_PRE_TUNNEL:
                        if (tunnel_act)
                                *tunnel_act = true;
-                       /* fall through */
+                       fallthrough;
                case NFP_FL_ACTION_OPCODE_PRE_LAG:
                        memcpy(act_dst + act_off, act_src + act_off, act_len);
                        break;
index 2df3deedf9fd85bd4de664e333a468eb923a499a..7248d248f60416f18b7263622b2866da8627e410 100644 (file)
@@ -61,6 +61,7 @@ struct nfp_tun_active_tuns {
  * @flags:             options part of the request
  * @tun_info.ipv6:             dest IPv6 address of active route
  * @tun_info.egress_port:      port the encapsulated packet egressed
+ * @tun_info.extra:            reserved for future use
  * @tun_info:          tunnels that have sent traffic in reported period
  */
 struct nfp_tun_active_tuns_v6 {
@@ -70,6 +71,7 @@ struct nfp_tun_active_tuns_v6 {
        struct route_ip_info_v6 {
                struct in6_addr ipv6;
                __be32 egress_port;
+               __be32 extra[2];
        } tun_info[];
 };
 
index b04b83687fe219d98b8a9e1c2b21d1970ac409e0..2643ea5948f48f0d94fb5b83a6ce364b1932c3c1 100644 (file)
@@ -137,7 +137,7 @@ static u16 nfp_swreg_to_unreg(swreg reg, bool is_dst)
                                val;
                case NN_LM_MOD_DEC:
                        lm_dec = true;
-                       /* fall through */
+                       fallthrough;
                case NN_LM_MOD_INC:
                        if (val) {
                                pr_err("LM offset in inc/dev mode\n");
index 39ee23e8c0bfd6e8b41d5402449cbfa0233027bf..21ea22694e479a53f8d5441b0c4f93e19e349f97 100644 (file)
@@ -1940,10 +1940,10 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)
                                continue;
                        default:
                                bpf_warn_invalid_xdp_action(act);
-                               /* fall through */
+                               fallthrough;
                        case XDP_ABORTED:
                                trace_xdp_exception(dp->netdev, xdp_prog, act);
-                               /* fall through */
+                               fallthrough;
                        case XDP_DROP:
                                nfp_net_rx_give_one(dp, rx_ring, rxbuf->frag,
                                                    rxbuf->dma_addr);
index 6eb9fb9a1814535642ecf560d8ec6b939b11b3c7..9c9ae33d84ce987a33f16bb5ef093a828c018623 100644 (file)
@@ -829,8 +829,8 @@ nfp_port_get_fecparam(struct net_device *netdev,
        struct nfp_eth_table_port *eth_port;
        struct nfp_port *port;
 
-       param->active_fec = ETHTOOL_FEC_NONE_BIT;
-       param->fec = ETHTOOL_FEC_NONE_BIT;
+       param->active_fec = ETHTOOL_FEC_NONE;
+       param->fec = ETHTOOL_FEC_NONE;
 
        port = nfp_port_from_netdev(netdev);
        eth_port = nfp_port_get_eth_port(port);
index a486008eb80a9d2db26ceadb1ada187569bdc6c8..252fe06f58aacd1c9d08e87d88517bbb04537f48 100644 (file)
@@ -340,12 +340,12 @@ static int matching_bar(struct nfp_bar *bar, u32 tgt, u32 act, u32 tok,
        switch (maptype) {
        case NFP_PCIE_BAR_PCIE2CPP_MapType_TARGET:
                bartok = -1;
-               /* FALLTHROUGH */
+               fallthrough;
        case NFP_PCIE_BAR_PCIE2CPP_MapType_BULK:
                baract = NFP_CPP_ACTION_RW;
                if (act == 0)
                        act = NFP_CPP_ACTION_RW;
-               /* FALLTHROUGH */
+               fallthrough;
        case NFP_PCIE_BAR_PCIE2CPP_MapType_FIXED:
                break;
        default:
index 75f012444796d31a06923f4f09fd18d41c65665c..2260c2403a83a177df578bfe5bcad47981cc339f 100644 (file)
@@ -213,7 +213,7 @@ u64 nfp_rtsym_size(const struct nfp_rtsym *sym)
                return 0;
        default:
                pr_warn("rtsym '%s': unknown type: %d\n", sym->name, sym->type);
-               /* fall through */
+               fallthrough;
        case NFP_RTSYM_TYPE_OBJECT:
        case NFP_RTSYM_TYPE_FUNCTION:
                return sym->size;
index a26966fa40b93f8ad3095575f54b7d7e41849c9b..dceec80fd64227b278a20ecd0d3fa912f7efc440 100644 (file)
@@ -410,7 +410,7 @@ static void pch_gbe_check_copper_options(struct pch_gbe_adapter *adapter)
        case SPEED_1000 + HALF_DUPLEX:
                netdev_dbg(adapter->netdev,
                           "Half Duplex is not supported at 1000 Mbps\n");
-               /* fall through */
+               fallthrough;
        case SPEED_1000 + FULL_DUPLEX:
 full_duplex_only:
                netdev_dbg(adapter->netdev,
index 647a1431b35915d5de0489026e982d0fdd1266bb..3da0753071788faa4de65e289b745da53bbdd747 100644 (file)
@@ -1356,7 +1356,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = np->phys[0] & 0x1f;
-               /* Fall Through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                data->val_out = mdio_read(ioaddr, data->phy_id & 0x1f, data->reg_num & 0x1f);
index 8107d32c27673a2b8b8aa015a9198668ec040dfe..def65fee27b5a66a0c577f7d27686854d53d3ac0 100644 (file)
@@ -496,9 +496,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
        struct ionic_cq *txcq;
        u32 rx_work_done = 0;
        u32 tx_work_done = 0;
-       u32 work_done = 0;
        u32 flags = 0;
-       bool unmask;
 
        lif = rxcq->bound_q->lif;
        idev = &lif->ionic->idev;
@@ -512,17 +510,12 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
        if (rx_work_done)
                ionic_rx_fill_cb(rxcq->bound_q);
 
-       unmask = (rx_work_done < budget) && (tx_work_done < lif->tx_budget);
-
-       if (unmask && napi_complete_done(napi, rx_work_done)) {
+       if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) {
                flags |= IONIC_INTR_CRED_UNMASK;
                DEBUG_STATS_INTR_REARM(rxcq->bound_intr);
-               work_done = rx_work_done;
-       } else {
-               work_done = budget;
        }
 
-       if (work_done || flags) {
+       if (rx_work_done || flags) {
                flags |= IONIC_INTR_CRED_RESET_COALESCE;
                ionic_intr_credits(idev->intr_ctrl, rxcq->bound_intr->index,
                                   tx_work_done + rx_work_done, flags);
@@ -531,7 +524,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
        DEBUG_STATS_NAPI_POLL(qcq, rx_work_done);
        DEBUG_STATS_NAPI_POLL(qcq, tx_work_done);
 
-       return work_done;
+       return rx_work_done;
 }
 
 static dma_addr_t ionic_tx_map_single(struct ionic_queue *q,
index 66f45fce90fa8782333bd6fa646d4b4e691760b4..c3f50ddbe824148ead6fde0ed03eb820b2bc2ebd 100644 (file)
@@ -153,7 +153,7 @@ skip:
        case NETXEN_BRDTYPE_P3_4_GB_MM:
                supported |= SUPPORTED_Autoneg;
                advertising |= ADVERTISED_Autoneg;
-               /* fall through */
+               fallthrough;
        case NETXEN_BRDTYPE_P2_SB31_10G_CX4:
        case NETXEN_BRDTYPE_P3_10G_CX4:
        case NETXEN_BRDTYPE_P3_10G_CX4_LP:
@@ -182,7 +182,7 @@ skip:
                supported |= SUPPORTED_TP;
                check_sfp_module = netif_running(dev) &&
                        adapter->has_link_events;
-               /* fall through */
+               fallthrough;
        case NETXEN_BRDTYPE_P2_SB31_10G:
        case NETXEN_BRDTYPE_P3_10G_XFP:
                supported |= SUPPORTED_FIBRE;
index 876743a79c1f5034e983ac6a68711c1ed14825b1..0e4cd8890cffc8d4dc303d852f38914ef356424f 100644 (file)
@@ -2046,7 +2046,7 @@ int qed_cxt_set_pf_params(struct qed_hwfn *p_hwfn, u32 rdma_tasks)
                                               rdma_tasks);
                /* no need for break since RoCE coexist with Ethernet */
        }
-       /* fall through */
+               fallthrough;
        case QED_PCI_ETH:
        {
                struct qed_eth_pf_params *p_params =
index b3c9ebaf228077e618f7af9ad49f07307d97e63c..3db181f3617a53efdd5b04619a6755ac53fb4564 100644 (file)
@@ -3109,14 +3109,14 @@ int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params)
                                                p_hwfn->hw_info.hw_mode);
                        if (rc)
                                break;
-               /* Fall through */
+                       fallthrough;
                case FW_MSG_CODE_DRV_LOAD_PORT:
                        rc = qed_hw_init_port(p_hwfn, p_hwfn->p_main_ptt,
                                              p_hwfn->hw_info.hw_mode);
                        if (rc)
                                break;
 
-               /* Fall through */
+                       fallthrough;
                case FW_MSG_CODE_DRV_LOAD_FUNCTION:
                        rc = qed_hw_init_pf(p_hwfn, p_hwfn->p_main_ptt,
                                            p_params->p_tunn,
@@ -4253,7 +4253,8 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
                        cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) |
                                        BIT(QED_MF_LLH_PROTO_CLSS) |
                                        BIT(QED_MF_LL2_NON_UNICAST) |
-                                       BIT(QED_MF_INTER_PF_SWITCH);
+                                       BIT(QED_MF_INTER_PF_SWITCH) |
+                                       BIT(QED_MF_DISABLE_ARFS);
                        break;
                case NVM_CFG1_GLOB_MF_MODE_DEFAULT:
                        cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) |
@@ -4266,6 +4267,14 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
 
                DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n",
                        cdev->mf_bits);
+
+               /* In CMT the PF is unknown when the GFS block processes the
+                * packet. Therefore cannot use searcher as it has a per PF
+                * database, and thus ARFS must be disabled.
+                *
+                */
+               if (QED_IS_CMT(cdev))
+                       cdev->mf_bits |= BIT(QED_MF_DISABLE_ARFS);
        }
 
        DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n",
index 4c6ac8862744c342c891b85bc28d030154c3a258..07824bf9d68d999f6206e7b0bfef1b739701d002 100644 (file)
@@ -1980,6 +1980,9 @@ void qed_arfs_mode_configure(struct qed_hwfn *p_hwfn,
                             struct qed_ptt *p_ptt,
                             struct qed_arfs_config_params *p_cfg_params)
 {
+       if (test_bit(QED_MF_DISABLE_ARFS, &p_hwfn->cdev->mf_bits))
+               return;
+
        if (p_cfg_params->mode != QED_FILTER_CONFIG_MODE_DISABLE) {
                qed_gft_config(p_hwfn, p_ptt, p_hwfn->rel_pf_id,
                               p_cfg_params->tcp,
index 2558cb680db3159a8836dfe31016955cc3ba7c2a..50e5eb22e60afab0911bc490fe756e19a85f5a63 100644 (file)
@@ -444,6 +444,8 @@ int qed_fill_dev_info(struct qed_dev *cdev,
                dev_info->fw_eng = FW_ENGINEERING_VERSION;
                dev_info->b_inter_pf_switch = test_bit(QED_MF_INTER_PF_SWITCH,
                                                       &cdev->mf_bits);
+               if (!test_bit(QED_MF_DISABLE_ARFS, &cdev->mf_bits))
+                       dev_info->b_arfs_capable = true;
                dev_info->tx_switching = true;
 
                if (hw_info->b_wol_support == QED_WOL_SUPPORT_PME)
@@ -761,7 +763,7 @@ static int qed_set_int_mode(struct qed_dev *cdev, bool force_mode)
                kfree(int_params->msix_table);
                if (force_mode)
                        goto out;
-               /* Fallthrough */
+               fallthrough;
 
        case QED_INT_MODE_MSI:
                if (cdev->num_hwfns == 1) {
@@ -775,7 +777,7 @@ static int qed_set_int_mode(struct qed_dev *cdev, bool force_mode)
                        if (force_mode)
                                goto out;
                }
-               /* Fallthrough */
+               fallthrough;
 
        case QED_INT_MODE_INTA:
                        int_params->out.int_mode = QED_INT_MODE_INTA;
index 5be08f83e0aa682bb3053110e56a9653933f65b7..cd882c4533942966ca87b2c6ff23928b34b710c7 100644 (file)
@@ -1085,7 +1085,7 @@ int qed_mcp_unload_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
                DP_NOTICE(p_hwfn,
                          "Unknown WoL configuration %02x\n",
                          p_hwfn->cdev->wol_config);
-               /* Fallthrough */
+               fallthrough;
        case QED_OV_WOL_DEFAULT:
                wol_param = DRV_MB_PARAM_UNLOAD_WOL_MCP;
        }
@@ -1365,7 +1365,7 @@ static void qed_mcp_handle_link_change(struct qed_hwfn *p_hwfn,
                break;
        case LINK_STATUS_SPEED_AND_DUPLEX_1000THD:
                p_link->full_duplex = false;
-       /* Fall-through */
+               fallthrough;
        case LINK_STATUS_SPEED_AND_DUPLEX_1000TFD:
                p_link->speed = 1000;
                break;
@@ -2451,7 +2451,7 @@ qed_mcp_get_shmem_proto(struct qed_hwfn *p_hwfn,
                break;
        case FUNC_MF_CFG_PROTOCOL_ROCE:
                DP_NOTICE(p_hwfn, "RoCE personality is not a valid value!\n");
-       /* Fallthrough */
+               fallthrough;
        default:
                rc = -EINVAL;
        }
@@ -3546,7 +3546,7 @@ qed_mcp_resc_allocation_msg(struct qed_hwfn *p_hwfn,
        switch (p_in_params->cmd) {
        case DRV_MSG_SET_RESOURCE_VALUE_MSG:
                mfw_resc_info.size = p_in_params->resc_max_val;
-               /* Fallthrough */
+               fallthrough;
        case DRV_MSG_GET_RESOURCE_ALLOC_MSG:
                break;
        default:
@@ -3823,7 +3823,7 @@ qed_mcp_resc_unlock(struct qed_hwfn *p_hwfn,
                DP_INFO(p_hwfn,
                        "Resource unlock request for an already released resource [%d]\n",
                        p_params->resource);
-               /* Fallthrough */
+               fallthrough;
        case RESOURCE_OPCODE_RELEASED:
                p_params->b_released = true;
                break;
index f1f75b6d0421c1a1ed47b83fbf43345f6e803d42..b8dc5c4591ef52e212776aeece736303092c4ff6 100644 (file)
@@ -71,6 +71,7 @@ static int qed_sp_vf_start(struct qed_hwfn *p_hwfn, struct qed_vf_info *p_vf)
                p_ramrod->personality = PERSONALITY_ETH;
                break;
        case QED_PCI_ETH_ROCE:
+       case QED_PCI_ETH_IWARP:
                p_ramrod->personality = PERSONALITY_RDMA_AND_ETH;
                break;
        default:
index f961f65d9372497141a29e07a5a4d3d2c028790c..c59b72c9029329ccf59fa9b0ba7afc34070ecfe5 100644 (file)
@@ -311,6 +311,9 @@ int qede_alloc_arfs(struct qede_dev *edev)
 {
        int i;
 
+       if (!edev->dev_info.common.b_arfs_capable)
+               return -EINVAL;
+
        edev->arfs = vzalloc(sizeof(*edev->arfs));
        if (!edev->arfs)
                return -ENOMEM;
index 140a392a81bbd6aeb1564d027bc27d79ad914834..9e1f41ba766ce8180a13888eb5ad6ab370a874e6 100644 (file)
@@ -804,7 +804,7 @@ static void qede_init_ndev(struct qede_dev *edev)
                      NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
                      NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC;
 
-       if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1)
+       if (edev->dev_info.common.b_arfs_capable)
                hw_features |= NETIF_F_NTUPLE;
 
        if (edev->dev_info.common.vxlan_enable ||
@@ -2274,7 +2274,7 @@ static void qede_unload(struct qede_dev *edev, enum qede_unload_mode mode,
        qede_vlan_mark_nonconfigured(edev);
        edev->ops->fastpath_stop(edev->cdev);
 
-       if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) {
+       if (edev->dev_info.common.b_arfs_capable) {
                qede_poll_for_freeing_arfs_filters(edev);
                qede_free_arfs(edev);
        }
@@ -2341,10 +2341,9 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode,
        if (rc)
                goto err2;
 
-       if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) {
-               rc = qede_alloc_arfs(edev);
-               if (rc)
-                       DP_NOTICE(edev, "aRFS memory allocation failed\n");
+       if (qede_alloc_arfs(edev)) {
+               edev->ndev->features &= ~NETIF_F_NTUPLE;
+               edev->dev_info.common.b_arfs_capable = false;
        }
 
        qede_napi_add_enable(edev);
index 0d0e38debbc26b84180452a634aba6b76486ccfa..569e2a7a64e542b6303b09bae33e457c608546cc 100644 (file)
@@ -1542,7 +1542,7 @@ static void ql_link_state_machine_work(struct work_struct *work)
                if (test_bit(QL_LINK_MASTER, &qdev->flags))
                        ql_port_start(qdev);
                qdev->port_link_state = LS_DOWN;
-               /* Fall Through */
+               fallthrough;
 
        case LS_DOWN:
                if (curr_link_state == LS_UP) {
index 5c2a3acf1e89b10646de3e5116c845108676ddd9..b9894d54469c498aeb9a8a12b4cb840096a2abee 100644 (file)
@@ -353,7 +353,7 @@ skip:
        case QLCNIC_BRDTYPE_P3P_4_GB_MM:
                supported |= SUPPORTED_Autoneg;
                advertising |= ADVERTISED_Autoneg;
-               /* fall through */
+               fallthrough;
        case QLCNIC_BRDTYPE_P3P_10G_CX4:
        case QLCNIC_BRDTYPE_P3P_10G_CX4_LP:
        case QLCNIC_BRDTYPE_P3P_10000_BASE_T:
@@ -377,7 +377,7 @@ skip:
                supported |= SUPPORTED_TP;
                check_sfp_module = netif_running(adapter->netdev) &&
                                   ahw->has_link_events;
-               /* fall through */
+               fallthrough;
        case QLCNIC_BRDTYPE_P3P_10G_XFP:
                supported |= SUPPORTED_FIBRE;
                advertising |= ADVERTISED_FIBRE;
index d1da92ac7fbec8b593d35bd7dd5abc09182c098d..fc9e6626db558e47b7dfca524118548553f44da6 100644 (file)
@@ -4994,7 +4994,7 @@ static int rtl_alloc_irq(struct rtl8169_private *tp)
                rtl_unlock_config_regs(tp);
                RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~MSIEnable);
                rtl_lock_config_regs(tp);
-               /* fall through */
+               fallthrough;
        case RTL_GIGA_MAC_VER_07 ... RTL_GIGA_MAC_VER_17:
                flags = PCI_IRQ_LEGACY;
                break;
@@ -5137,7 +5137,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp)
        switch (tp->mac_version) {
        case RTL_GIGA_MAC_VER_49 ... RTL_GIGA_MAC_VER_52:
                rtl8168ep_stop_cmac(tp);
-               /* fall through */
+               fallthrough;
        case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48:
                rtl_hw_init_8168g(tp);
                break;
index 99f7aae102ce12a15155c84d888af04229e80c85..df89d09b253e24e2fdc6a87a0d78f8e332735117 100644 (file)
@@ -1342,6 +1342,51 @@ static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler,
        return error;
 }
 
+/* MDIO bus init function */
+static int ravb_mdio_init(struct ravb_private *priv)
+{
+       struct platform_device *pdev = priv->pdev;
+       struct device *dev = &pdev->dev;
+       int error;
+
+       /* Bitbang init */
+       priv->mdiobb.ops = &bb_ops;
+
+       /* MII controller setting */
+       priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb);
+       if (!priv->mii_bus)
+               return -ENOMEM;
+
+       /* Hook up MII support for ethtool */
+       priv->mii_bus->name = "ravb_mii";
+       priv->mii_bus->parent = dev;
+       snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
+                pdev->name, pdev->id);
+
+       /* Register MDIO bus */
+       error = of_mdiobus_register(priv->mii_bus, dev->of_node);
+       if (error)
+               goto out_free_bus;
+
+       return 0;
+
+out_free_bus:
+       free_mdio_bitbang(priv->mii_bus);
+       return error;
+}
+
+/* MDIO bus release function */
+static int ravb_mdio_release(struct ravb_private *priv)
+{
+       /* Unregister mdio bus */
+       mdiobus_unregister(priv->mii_bus);
+
+       /* Free bitbang info */
+       free_mdio_bitbang(priv->mii_bus);
+
+       return 0;
+}
+
 /* Network device open function for Ethernet AVB */
 static int ravb_open(struct net_device *ndev)
 {
@@ -1350,6 +1395,13 @@ static int ravb_open(struct net_device *ndev)
        struct device *dev = &pdev->dev;
        int error;
 
+       /* MDIO bus init */
+       error = ravb_mdio_init(priv);
+       if (error) {
+               netdev_err(ndev, "failed to initialize MDIO\n");
+               return error;
+       }
+
        napi_enable(&priv->napi[RAVB_BE]);
        napi_enable(&priv->napi[RAVB_NC]);
 
@@ -1427,6 +1479,7 @@ out_free_irq:
 out_napi_off:
        napi_disable(&priv->napi[RAVB_NC]);
        napi_disable(&priv->napi[RAVB_BE]);
+       ravb_mdio_release(priv);
        return error;
 }
 
@@ -1736,6 +1789,8 @@ static int ravb_close(struct net_device *ndev)
        ravb_ring_free(ndev, RAVB_BE);
        ravb_ring_free(ndev, RAVB_NC);
 
+       ravb_mdio_release(priv);
+
        return 0;
 }
 
@@ -1887,51 +1942,6 @@ static const struct net_device_ops ravb_netdev_ops = {
        .ndo_set_features       = ravb_set_features,
 };
 
-/* MDIO bus init function */
-static int ravb_mdio_init(struct ravb_private *priv)
-{
-       struct platform_device *pdev = priv->pdev;
-       struct device *dev = &pdev->dev;
-       int error;
-
-       /* Bitbang init */
-       priv->mdiobb.ops = &bb_ops;
-
-       /* MII controller setting */
-       priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb);
-       if (!priv->mii_bus)
-               return -ENOMEM;
-
-       /* Hook up MII support for ethtool */
-       priv->mii_bus->name = "ravb_mii";
-       priv->mii_bus->parent = dev;
-       snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
-                pdev->name, pdev->id);
-
-       /* Register MDIO bus */
-       error = of_mdiobus_register(priv->mii_bus, dev->of_node);
-       if (error)
-               goto out_free_bus;
-
-       return 0;
-
-out_free_bus:
-       free_mdio_bitbang(priv->mii_bus);
-       return error;
-}
-
-/* MDIO bus release function */
-static int ravb_mdio_release(struct ravb_private *priv)
-{
-       /* Unregister mdio bus */
-       mdiobus_unregister(priv->mii_bus);
-
-       /* Free bitbang info */
-       free_mdio_bitbang(priv->mii_bus);
-
-       return 0;
-}
-
 static const struct of_device_id ravb_match_table[] = {
        { .compatible = "renesas,etheravb-r8a7790", .data = (void *)RCAR_GEN2 },
        { .compatible = "renesas,etheravb-r8a7794", .data = (void *)RCAR_GEN2 },
@@ -2174,13 +2184,6 @@ static int ravb_probe(struct platform_device *pdev)
                eth_hw_addr_random(ndev);
        }
 
-       /* MDIO bus init */
-       error = ravb_mdio_init(priv);
-       if (error) {
-               dev_err(&pdev->dev, "failed to initialize MDIO\n");
-               goto out_dma_free;
-       }
-
        netif_napi_add(ndev, &priv->napi[RAVB_BE], ravb_poll, 64);
        netif_napi_add(ndev, &priv->napi[RAVB_NC], ravb_poll, 64);
 
@@ -2202,8 +2205,6 @@ static int ravb_probe(struct platform_device *pdev)
 out_napi_del:
        netif_napi_del(&priv->napi[RAVB_NC]);
        netif_napi_del(&priv->napi[RAVB_BE]);
-       ravb_mdio_release(priv);
-out_dma_free:
        dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
                          priv->desc_bat_dma);
 
@@ -2235,7 +2236,6 @@ static int ravb_remove(struct platform_device *pdev)
        unregister_netdev(ndev);
        netif_napi_del(&priv->napi[RAVB_NC]);
        netif_napi_del(&priv->napi[RAVB_BE]);
-       ravb_mdio_release(priv);
        pm_runtime_disable(&pdev->dev);
        free_netdev(ndev);
        platform_set_drvdata(pdev, NULL);
index fc99e7118e494d48350f79e39ce610bb95451a2b..42458a46ffaf6e0d0494a98d00e8d7cb7ba90571 100644 (file)
@@ -2169,7 +2169,7 @@ static void rocker_router_fib_event_work(struct work_struct *work)
                rocker_world_fib4_del(rocker, &fib_work->fen_info);
                fib_info_put(fib_work->fen_info.fi);
                break;
-       case FIB_EVENT_RULE_ADD: /* fall through */
+       case FIB_EVENT_RULE_ADD:
        case FIB_EVENT_RULE_DEL:
                rule = fib_work->fr_info.rule;
                if (!fib4_rule_default(rule))
@@ -2201,7 +2201,7 @@ static int rocker_router_fib_event(struct notifier_block *nb,
        fib_work->event = event;
 
        switch (event) {
-       case FIB_EVENT_ENTRY_REPLACE: /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
        case FIB_EVENT_ENTRY_DEL:
                if (info->family == AF_INET) {
                        struct fib_entry_notifier_info *fen_info = ptr;
@@ -2224,7 +2224,7 @@ static int rocker_router_fib_event(struct notifier_block *nb,
                 */
                fib_info_hold(fib_work->fen_info.fi);
                break;
-       case FIB_EVENT_RULE_ADD: /* fall through */
+       case FIB_EVENT_RULE_ADD:
        case FIB_EVENT_RULE_DEL:
                memcpy(&fib_work->fr_info, ptr, sizeof(fib_work->fr_info));
                fib_rule_get(fib_work->fr_info.rule);
@@ -2811,7 +2811,7 @@ static int rocker_switchdev_event(struct notifier_block *unused,
        switchdev_work->event = event;
 
        switch (event) {
-       case SWITCHDEV_FDB_ADD_TO_DEVICE: /* fall through */
+       case SWITCHDEV_FDB_ADD_TO_DEVICE:
        case SWITCHDEV_FDB_DEL_TO_DEVICE:
                memcpy(&switchdev_work->fdb_info, ptr,
                       sizeof(switchdev_work->fdb_info));
index 21465cb3d60ab09452c13c45ba8a606c684ad297..7f8b10c4966073c13849ea51a5c5511a929aeb88 100644 (file)
@@ -316,7 +316,7 @@ static int sxgbe_get_rss_hash_opts(struct sxgbe_priv_data *priv,
        case TCP_V4_FLOW:
        case UDP_V4_FLOW:
                cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* Fall through */
+               fallthrough;
        case SCTP_V4_FLOW:
        case AH_ESP_V4_FLOW:
        case AH_V4_FLOW:
@@ -327,7 +327,7 @@ static int sxgbe_get_rss_hash_opts(struct sxgbe_priv_data *priv,
        case TCP_V6_FLOW:
        case UDP_V6_FLOW:
                cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-               /* Fall through */
+               fallthrough;
        case SCTP_V6_FLOW:
        case AH_ESP_V6_FLOW:
        case AH_V6_FLOW:
index c54b7f8243f3ba9c03c8c50d30dc4fb6a6d9276e..ffdb36715a49689edbe1212298cee4c6e4ee17cb 100644 (file)
@@ -490,6 +490,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
        if (fcw.offset > pci_resource_len(efx->pci_dev, fcw.bar) - ESE_GZ_FCW_LEN) {
                netif_err(efx, probe, efx->net_dev,
                          "Func control window overruns BAR\n");
+               rc = -EIO;
                goto fail;
        }
 
index 012925e878f4ef08179b88c3aa030298ee2dadea..85207acf7dee94b0e3af315619d1820837d10f36 100644 (file)
@@ -36,7 +36,7 @@ bool ef100_rx_buf_hash_valid(const u8 *prefix)
        return PREFIX_FIELD(prefix, RSS_HASH_VALID);
 }
 
-static bool check_fcs(struct efx_channel *channel, u32 *prefix)
+static bool ef100_has_fcs_error(struct efx_channel *channel, u32 *prefix)
 {
        u16 rxclass;
        u8 l2status;
@@ -46,11 +46,11 @@ static bool check_fcs(struct efx_channel *channel, u32 *prefix)
 
        if (likely(l2status == ESE_GZ_RH_HCLASS_L2_STATUS_OK))
                /* Everything is ok */
-               return 0;
+               return false;
 
        if (l2status == ESE_GZ_RH_HCLASS_L2_STATUS_FCS_ERR)
                channel->n_rx_eth_crc_err++;
-       return 1;
+       return true;
 }
 
 void __ef100_rx_packet(struct efx_channel *channel)
@@ -63,7 +63,7 @@ void __ef100_rx_packet(struct efx_channel *channel)
 
        prefix = (u32 *)(eh - ESE_GZ_RX_PKT_PREFIX_LEN);
 
-       if (check_fcs(channel, prefix) &&
+       if (ef100_has_fcs_error(channel, prefix) &&
            unlikely(!(efx->net_dev->features & NETIF_F_RXALL)))
                goto out;
 
index db90d94e24c92525880cf3a38332fb38d7c20964..a6bae6a234bac5e9d3a32934f2ab119ef81e502a 100644 (file)
@@ -957,7 +957,7 @@ ef4_ethtool_get_rxnfc(struct net_device *net_dev,
                switch (info->flow_type) {
                case TCP_V4_FLOW:
                        info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-                       /* Fall through */
+                       fallthrough;
                case UDP_V4_FLOW:
                case SCTP_V4_FLOW:
                case AH_ESP_V4_FLOW:
index 332183280a459dc8ebbda51069ad910ca6c39b3f..fa1ade856b104e9ad32b52fda3ff48b8a77badf1 100644 (file)
@@ -1049,10 +1049,10 @@ ef4_farch_handle_rx_event(struct ef4_channel *channel, const ef4_qword_t *event)
                switch (rx_ev_hdr_type) {
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_TCP:
                        flags |= EF4_RX_PKT_TCP;
-                       /* fall through */
+                       fallthrough;
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_UDP:
                        flags |= EF4_RX_PKT_CSUMMED;
-                       /* fall through */
+                       fallthrough;
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_OTHER:
                case FSE_AZ_RX_EV_HDR_TYPE_OTHER:
                        break;
@@ -1310,7 +1310,7 @@ int ef4_farch_ev_process(struct ef4_channel *channel, int budget)
                        if (efx->type->handle_global_event &&
                            efx->type->handle_global_event(channel, &event))
                                break;
-                       /* else fall through */
+                       fallthrough;
                default:
                        netif_err(channel->efx, hw, channel->efx->net_dev,
                                  "channel %d unknown event type %d (data "
@@ -1983,7 +1983,7 @@ ef4_farch_filter_from_gen_spec(struct ef4_farch_filter_spec *spec,
              EF4_FILTER_MATCH_LOC_HOST | EF4_FILTER_MATCH_LOC_PORT |
              EF4_FILTER_MATCH_REM_HOST | EF4_FILTER_MATCH_REM_PORT):
                is_full = true;
-               /* fall through */
+               fallthrough;
        case (EF4_FILTER_MATCH_ETHER_TYPE | EF4_FILTER_MATCH_IP_PROTO |
              EF4_FILTER_MATCH_LOC_HOST | EF4_FILTER_MATCH_LOC_PORT): {
                __be32 rhost, host1, host2;
@@ -2034,7 +2034,7 @@ ef4_farch_filter_from_gen_spec(struct ef4_farch_filter_spec *spec,
 
        case EF4_FILTER_MATCH_LOC_MAC | EF4_FILTER_MATCH_OUTER_VID:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EF4_FILTER_MATCH_LOC_MAC:
                spec->type = (is_full ? EF4_FARCH_FILTER_MAC_FULL :
                              EF4_FARCH_FILTER_MAC_WILD);
@@ -2081,7 +2081,7 @@ ef4_farch_filter_to_gen_spec(struct ef4_filter_spec *gen_spec,
        case EF4_FARCH_FILTER_TCP_FULL:
        case EF4_FARCH_FILTER_UDP_FULL:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EF4_FARCH_FILTER_TCP_WILD:
        case EF4_FARCH_FILTER_UDP_WILD: {
                __be32 host1, host2;
@@ -2125,7 +2125,7 @@ ef4_farch_filter_to_gen_spec(struct ef4_filter_spec *gen_spec,
 
        case EF4_FARCH_FILTER_MAC_FULL:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EF4_FARCH_FILTER_MAC_WILD:
                gen_spec->match_flags = EF4_FILTER_MATCH_LOC_MAC;
                if (is_full)
index d07eeaad9bdffdefb2093e3f2929c66c84b469b2..4002f9a3ae9096c519cf13bc1a76982e00e678a3 100644 (file)
@@ -1038,10 +1038,10 @@ efx_farch_handle_rx_event(struct efx_channel *channel, const efx_qword_t *event)
                switch (rx_ev_hdr_type) {
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_TCP:
                        flags |= EFX_RX_PKT_TCP;
-                       /* fall through */
+                       fallthrough;
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_UDP:
                        flags |= EFX_RX_PKT_CSUMMED;
-                       /* fall through */
+                       fallthrough;
                case FSE_CZ_RX_EV_HDR_TYPE_IPV4V6_OTHER:
                case FSE_AZ_RX_EV_HDR_TYPE_OTHER:
                        break;
@@ -1316,7 +1316,7 @@ int efx_farch_ev_process(struct efx_channel *channel, int budget)
                        if (efx->type->handle_global_event &&
                            efx->type->handle_global_event(channel, &event))
                                break;
-                       /* else fall through */
+                       fallthrough;
                default:
                        netif_err(channel->efx, hw, channel->efx->net_dev,
                                  "channel %d unknown event type %d (data "
@@ -2043,7 +2043,7 @@ efx_farch_filter_from_gen_spec(struct efx_farch_filter_spec *spec,
              EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT |
              EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_REM_PORT):
                is_full = true;
-               /* fall through */
+               fallthrough;
        case (EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO |
              EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT): {
                __be32 rhost, host1, host2;
@@ -2094,7 +2094,7 @@ efx_farch_filter_from_gen_spec(struct efx_farch_filter_spec *spec,
 
        case EFX_FILTER_MATCH_LOC_MAC | EFX_FILTER_MATCH_OUTER_VID:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EFX_FILTER_MATCH_LOC_MAC:
                spec->type = (is_full ? EFX_FARCH_FILTER_MAC_FULL :
                              EFX_FARCH_FILTER_MAC_WILD);
@@ -2141,7 +2141,7 @@ efx_farch_filter_to_gen_spec(struct efx_filter_spec *gen_spec,
        case EFX_FARCH_FILTER_TCP_FULL:
        case EFX_FARCH_FILTER_UDP_FULL:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EFX_FARCH_FILTER_TCP_WILD:
        case EFX_FARCH_FILTER_UDP_WILD: {
                __be32 host1, host2;
@@ -2185,7 +2185,7 @@ efx_farch_filter_to_gen_spec(struct efx_filter_spec *gen_spec,
 
        case EFX_FARCH_FILTER_MAC_FULL:
                is_full = true;
-               /* fall through */
+               fallthrough;
        case EFX_FARCH_FILTER_MAC_WILD:
                gen_spec->match_flags = EFX_FILTER_MATCH_LOC_MAC;
                if (is_full)
index 5a74d880b733839b7a19019018a573fa50781dce..1523be77b9db6c509e0492e23c60b52f5409de0b 100644 (file)
@@ -140,7 +140,7 @@ efx_mcdi_filter_push_prep_set_match_fields(struct efx_nic *efx,
                switch (encap_type & EFX_ENCAP_TYPES_MASK) {
                case EFX_ENCAP_TYPE_VXLAN:
                        vni_type = MC_CMD_FILTER_OP_EXT_IN_VNI_TYPE_VXLAN;
-                       /* fallthrough */
+                       fallthrough;
                case EFX_ENCAP_TYPE_GENEVE:
                        COPY_VALUE(ether_type, ETHER_TYPE);
                        outer_ip_proto = IPPROTO_UDP;
index 56af8b54a864f28e3d17198fd0daee9b0d109c51..714d7f93721225f58135927984acb631d83c58af 100644 (file)
@@ -282,7 +282,7 @@ void efx_mcdi_phy_decode_link(struct efx_nic *efx,
                break;
        default:
                WARN_ON(1);
-               /* Fall through */
+               fallthrough;
        case MC_CMD_FCNTL_OFF:
                link_state->fc = 0;
                break;
index 59a43d586967fde0481645b02b56c18a62fd467d..aaa112877561ffdeaf5bd7c0661be7e1232cd969 100644 (file)
@@ -358,7 +358,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
 
        case XDP_ABORTED:
                trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act);
-               /* Fall through */
+               fallthrough;
        case XDP_DROP:
                efx_free_rx_buffers(rx_queue, rx_buf, 1);
                channel->n_rx_xdp_drops++;
index 336105f7731312ba44b653e17eddb3a097015849..cfa460c7db2316e325cb2ca736aab982a7085aee 100644 (file)
@@ -2228,7 +2228,7 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = sis_priv->mii->phy_addr;
-               /* Fall Through */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                data->val_out = mdio_read(net_dev, data->phy_id & 0x1f, data->reg_num & 0x1f);
index 186c0bddbe5fec665d5d9ca0d1a03e942240c8d0..01069dfaf75c9c156d142fa19efb014820e12b37 100644 (file)
@@ -712,7 +712,7 @@ static void smc911x_phy_detect(struct net_device *dev)
                                        /* Found an external PHY */
                                        break;
                        }
-                       /* Else, fall through */
+                       fallthrough;
                default:
                        /* Internal media only */
                        SMC_GET_PHY_ID1(lp, 1, id1);
index 25db667fa879c1f13c03d36af316264cb68d49ed..806eb651cea30fa57cd7b8e8f8857f76edc2363c 100644 (file)
@@ -919,10 +919,10 @@ static u32 netsec_run_xdp(struct netsec_priv *priv, struct bpf_prog *prog,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(priv->ndev, prog, act);
-               /* fall through -- handle aborts by dropping packet */
+               fallthrough;    /* handle aborts by dropping packet */
        case XDP_DROP:
                ret = NETSEC_XDP_CONSUMED;
                page = virt_to_head_page(xdp->data);
index d0d2d0fc5f0a9a78da74c9f4c042b3de631fdd29..08c76636c1641327b2e257a33db577d6f71486d1 100644 (file)
@@ -84,9 +84,10 @@ static struct anarion_gmac *anarion_config_dt(struct platform_device *pdev)
                return ERR_PTR(err);
 
        switch (phy_mode) {
-       case PHY_INTERFACE_MODE_RGMII:          /* Fall through */
-       case PHY_INTERFACE_MODE_RGMII_ID        /* Fall through */:
-       case PHY_INTERFACE_MODE_RGMII_RXID:     /* Fall through */
+       case PHY_INTERFACE_MODE_RGMII:
+               fallthrough;
+       case PHY_INTERFACE_MODE_RGMII_ID:
+       case PHY_INTERFACE_MODE_RGMII_RXID:
        case PHY_INTERFACE_MODE_RGMII_TXID:
                gmac->phy_intf_sel = GMAC_CONFIG_INTF_RGMII;
                break;
index e113b1376fddac7056c804143f6e2390e5f3343b..bf195adee393fa762f9579f9fbfabc24765f115d 100644 (file)
@@ -1985,7 +1985,7 @@ void stmmac_selftest_run(struct net_device *dev,
                                ret = phy_loopback(dev->phydev, true);
                        if (!ret)
                                break;
-                       /* Fallthrough */
+                       fallthrough;
                case STMMAC_LOOPBACK_MAC:
                        ret = stmmac_set_mac_loopback(priv, priv->ioaddr, true);
                        break;
@@ -2018,7 +2018,7 @@ void stmmac_selftest_run(struct net_device *dev,
                                ret = phy_loopback(dev->phydev, false);
                        if (!ret)
                                break;
-                       /* Fallthrough */
+                       fallthrough;
                case STMMAC_LOOPBACK_MAC:
                        stmmac_set_mac_loopback(priv, priv->ioaddr, false);
                        break;
index 3d747846f4829be0373ed6a211f15607e213e1e2..cc27d660a81851b13883c0c4ae8720ed1f3766fe 100644 (file)
@@ -228,7 +228,7 @@ static int tc_setup_cls_u32(struct stmmac_priv *priv,
        switch (cls->command) {
        case TC_CLSU32_REPLACE_KNODE:
                tc_unfill_entry(priv, cls);
-               /* Fall through */
+               fallthrough;
        case TC_CLSU32_NEW_KNODE:
                return tc_config_knode(priv, cls);
        case TC_CLSU32_DELETE_KNODE:
index e2bc7a25f6d1fbf666f4be67794904e20fa64e0a..b624e177ec7152ce081936aab658b56cd110e01d 100644 (file)
@@ -4759,7 +4759,7 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = cp->phy_addr;
-               /* Fallthrough... */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                spin_lock_irqsave(&cp->lock, flags);
index 9b5effb72657213f9f9e88b9acad9e91ceb7ee3d..68695d4afacd542a7d8d51d18da7a07918f72575 100644 (file)
@@ -8835,7 +8835,7 @@ static int walk_phys(struct niu *np, struct niu_parent *parent)
                        else
                                goto unknown_vg_1g_port;
 
-                       /* fallthru */
+                       fallthrough;
                case 0x22:
                        val = (phy_encode(PORT_TYPE_10G, 0) |
                               phy_encode(PORT_TYPE_10G, 1) |
@@ -8860,7 +8860,7 @@ static int walk_phys(struct niu *np, struct niu_parent *parent)
                        else
                                goto unknown_vg_1g_port;
 
-                       /* fallthru */
+                       fallthrough;
                case 0x13:
                        if ((lowest_10g & 0x7) == 0)
                                val = (phy_encode(PORT_TYPE_10G, 0) |
index eeb8518c8a84d43421a4245e56f486f686339c02..8deb943ca5de0ade288b03fce2db6f3627991332 100644 (file)
@@ -2712,7 +2712,7 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                data->phy_id = gp->mii_phy_addr;
-               /* Fallthrough... */
+               fallthrough;
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
                data->val_out = __sungem_phy_read(gp, data->phy_id & 0x1f,
index cb994f66c3be2328d134a5683e232923509ab636..9baf3f3da91e1ca137637b72328f0a8554782dde 100644 (file)
@@ -174,6 +174,8 @@ void am65_cpsw_nuss_adjust_link(struct net_device *ndev)
                if (phy->speed == 10 && phy_interface_is_rgmii(phy))
                        /* Can be used with in band mode only */
                        mac_control |= CPSW_SL_CTL_EXT_EN;
+               if (phy->speed == 100 && phy->interface == PHY_INTERFACE_MODE_RMII)
+                       mac_control |= CPSW_SL_CTL_IFCTL_A;
                if (phy->duplex)
                        mac_control |= CPSW_SL_CTL_FULLDUPLEX;
 
index 4e184eecc8e180c737c620c49523aca605526d6d..6e72ecbe5cf7e50420b8d097098373d1648d1760 100644 (file)
@@ -67,7 +67,7 @@ static void cpsw_gmii_sel_am3352(struct cpsw_phy_sel_priv *priv,
                dev_warn(priv->dev,
                         "Unsupported PHY mode: \"%s\". Defaulting to MII.\n",
                        phy_modes(phy_mode));
-               /* fallthrough */
+               fallthrough;
        case PHY_INTERFACE_MODE_MII:
                mode = AM33XX_GMII_SEL_MODE_MII;
                break;
@@ -122,7 +122,7 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv,
                dev_warn(priv->dev,
                         "Unsupported PHY mode: \"%s\". Defaulting to MII.\n",
                        phy_modes(phy_mode));
-               /* fallthrough */
+               fallthrough;
        case PHY_INTERFACE_MODE_MII:
                mode = AM33XX_GMII_SEL_MODE_MII;
                break;
index 9b17bbbe102fe419a208dc9741f26b6adfaf1fb4..4a65edc5a3759393215c419c3a4c72781d37bea0 100644 (file)
@@ -1116,7 +1116,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
                                  HOST_PORT_NUM, ALE_VLAN, vid);
        ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
                                  0, ALE_VLAN, vid);
-       ret |= cpsw_ale_flush_multicast(cpsw->ale, 0, vid);
+       ret |= cpsw_ale_flush_multicast(cpsw->ale, ALE_PORT_HOST, vid);
 err:
        pm_runtime_put(cpsw->dev);
        return ret;
index 1247d35d42ef38f0409b0e7dace448094dd72c49..15672d0a4de6977e71a5485a0fa54c20aaa2cd9b 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/phy.h>
 #include <linux/phy/phy.h>
 #include <linux/delay.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/gpio/consumer.h>
 #include <linux/of.h>
@@ -1032,19 +1033,34 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
                return ret;
        }
 
+       /* reset the return code as pm_runtime_get_sync() can return
+        * non zero values as well.
+        */
+       ret = 0;
        for (i = 0; i < cpsw->data.slaves; i++) {
                if (cpsw->slaves[i].ndev &&
-                   vid == cpsw->slaves[i].port_vlan)
+                   vid == cpsw->slaves[i].port_vlan) {
+                       ret = -EINVAL;
                        goto err;
+               }
        }
 
        dev_dbg(priv->dev, "removing vlanid %d from vlan filter\n", vid);
-       cpsw_ale_del_vlan(cpsw->ale, vid, 0);
-       cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr,
-                          HOST_PORT_NUM, ALE_VLAN, vid);
-       cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
-                          0, ALE_VLAN, vid);
-       cpsw_ale_flush_multicast(cpsw->ale, 0, vid);
+       ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0);
+       if (ret)
+               dev_err(priv->dev, "cpsw_ale_del_vlan() failed: ret %d\n", ret);
+       ret = cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr,
+                                HOST_PORT_NUM, ALE_VLAN, vid);
+       if (ret)
+               dev_err(priv->dev, "cpsw_ale_del_ucast() failed: ret %d\n",
+                       ret);
+       ret = cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
+                                0, ALE_VLAN, vid);
+       if (ret)
+               dev_err(priv->dev, "cpsw_ale_del_mcast failed. ret %d\n",
+                       ret);
+       cpsw_ale_flush_multicast(cpsw->ale, ALE_PORT_HOST, vid);
+       ret = 0;
 err:
        pm_runtime_put(cpsw->dev);
        return ret;
@@ -2055,9 +2071,61 @@ static int cpsw_remove(struct platform_device *pdev)
        return 0;
 }
 
+static int __maybe_unused cpsw_suspend(struct device *dev)
+{
+       struct cpsw_common *cpsw = dev_get_drvdata(dev);
+       int i;
+
+       rtnl_lock();
+
+       for (i = 0; i < cpsw->data.slaves; i++) {
+               struct net_device *ndev = cpsw->slaves[i].ndev;
+
+               if (!(ndev && netif_running(ndev)))
+                       continue;
+
+               cpsw_ndo_stop(ndev);
+       }
+
+       rtnl_unlock();
+
+       /* Select sleep pin state */
+       pinctrl_pm_select_sleep_state(dev);
+
+       return 0;
+}
+
+static int __maybe_unused cpsw_resume(struct device *dev)
+{
+       struct cpsw_common *cpsw = dev_get_drvdata(dev);
+       int i;
+
+       /* Select default pin state */
+       pinctrl_pm_select_default_state(dev);
+
+       /* shut up ASSERT_RTNL() warning in netif_set_real_num_tx/rx_queues */
+       rtnl_lock();
+
+       for (i = 0; i < cpsw->data.slaves; i++) {
+               struct net_device *ndev = cpsw->slaves[i].ndev;
+
+               if (!(ndev && netif_running(ndev)))
+                       continue;
+
+               cpsw_ndo_open(ndev);
+       }
+
+       rtnl_unlock();
+
+       return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume);
+
 static struct platform_driver cpsw_driver = {
        .driver = {
                .name    = "cpsw-switch",
+               .pm      = &cpsw_pm_ops,
                .of_match_table = cpsw_of_mtable,
        },
        .probe = cpsw_probe,
index d6d7a7d9c7ad07234458801ba0108787e7af0766..482a1a451e437169c140361f03b3a1843350dbdd 100644 (file)
@@ -1371,10 +1371,10 @@ int cpsw_run_xdp(struct cpsw_priv *priv, int ch, struct xdp_buff *xdp,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(ndev, prog, act);
-               /* fall through -- handle aborts by dropping packet */
+               fallthrough;    /* handle aborts by dropping packet */
        case XDP_DROP:
                goto drop;
        }
index 58623e974a0c0d1d915d440d6e4b3f5eb31f1bc6..76a342ea379727639f8ab02353a2b9fb23151161 100644 (file)
@@ -948,7 +948,7 @@ static int tlan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:               /* get address of MII PHY in use. */
                data->phy_id = phy;
-               /* fall through */
+               fallthrough;
 
 
        case SIOCGMIIREG:               /* read MII PHY register. */
index 2db546b27ee009221a78201b351f9e4d560636cf..dc14a66583ff37680f85619762f5cf504b2c7f66 100644 (file)
@@ -877,7 +877,7 @@ static int gelic_wl_set_auth(struct net_device *netdev,
        case IW_AUTH_KEY_MGMT:
                if (param->value & IW_AUTH_KEY_MGMT_PSK)
                        break;
-               /* intentionally fall through */
+               fallthrough;
        default:
                ret = -EOPNOTSUPP;
                break;
index 07389702a5400ba5362d8854ff1881f99bbe16c4..5f5b33e6653b2b68f8b9b88a2a2881322b554f50 100644 (file)
@@ -786,7 +786,7 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal)
                        /* fallthrough, if we release the descriptors
                         * brutally (then we don't care about
                         * SPIDER_NET_DESCR_CARDOWNED) */
-                       /* Fall through */
+                       fallthrough;
 
                case SPIDER_NET_DESCR_RESPONSE_ERROR:
                case SPIDER_NET_DESCR_PROTECTION_ERROR:
@@ -1397,9 +1397,9 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                show_error = 0;
                break;
 
-       case SPIDER_NET_GDDDEN0INT: /* fallthrough */
-       case SPIDER_NET_GDCDEN0INT: /* fallthrough */
-       case SPIDER_NET_GDBDEN0INT: /* fallthrough */
+       case SPIDER_NET_GDDDEN0INT:
+       case SPIDER_NET_GDCDEN0INT:
+       case SPIDER_NET_GDBDEN0INT:
        case SPIDER_NET_GDADEN0INT:
                /* someone has set RX_DMA_EN to 0 */
                show_error = 0;
@@ -1449,10 +1449,10 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                 * Logging is not needed. */
                show_error = 0;
                break;
-       case SPIDER_NET_GRFDFLLINT: /* fallthrough */
-       case SPIDER_NET_GRFCFLLINT: /* fallthrough */
-       case SPIDER_NET_GRFBFLLINT: /* fallthrough */
-       case SPIDER_NET_GRFAFLLINT: /* fallthrough */
+       case SPIDER_NET_GRFDFLLINT:
+       case SPIDER_NET_GRFCFLLINT:
+       case SPIDER_NET_GRFBFLLINT:
+       case SPIDER_NET_GRFAFLLINT:
        case SPIDER_NET_GRMFLLINT:
                /* Could happen when rx chain is full */
                if (card->ignore_rx_ramfull == 0) {
@@ -1473,9 +1473,9 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                break;
 
        /* chain end */
-       case SPIDER_NET_GDDDCEINT: /* fallthrough */
-       case SPIDER_NET_GDCDCEINT: /* fallthrough */
-       case SPIDER_NET_GDBDCEINT: /* fallthrough */
+       case SPIDER_NET_GDDDCEINT:
+       case SPIDER_NET_GDCDCEINT:
+       case SPIDER_NET_GDBDCEINT:
        case SPIDER_NET_GDADCEINT:
                spider_net_resync_head_ptr(card);
                spider_net_refill_rx_chain(card);
@@ -1486,9 +1486,9 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                break;
 
        /* invalid descriptor */
-       case SPIDER_NET_GDDINVDINT: /* fallthrough */
-       case SPIDER_NET_GDCINVDINT: /* fallthrough */
-       case SPIDER_NET_GDBINVDINT: /* fallthrough */
+       case SPIDER_NET_GDDINVDINT:
+       case SPIDER_NET_GDCINVDINT:
+       case SPIDER_NET_GDBINVDINT:
        case SPIDER_NET_GDAINVDINT:
                /* Could happen when rx chain is full */
                spider_net_resync_head_ptr(card);
index 3e3883ad88b080578ab450c992c0f9af4318ba98..3e337142b5161c1c097788b236fb05336ac55672 100644 (file)
@@ -1434,7 +1434,7 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
     switch(cmd) {
       case SIOCGMIIPHY:                /* Get the address of the PHY in use. */
        data->phy_id = 0;       /* we have only this address */
-       /* fall through */
+       fallthrough;
       case SIOCGMIIREG:                /* Read the specified MII register. */
        data->val_out = mii_rd(ioaddr, data->phy_id & 0x1f,
                               data->reg_num & 0x1f);
index 1be039579d7090b3e22a27624e8c135a9358ff1a..554cde8d6073e61a4857b7b1b6a74ef79a63b9a2 100644 (file)
@@ -847,7 +847,7 @@ static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd)
 
        case ACTIONS(PC5_SIGNAL) :
                ACTIONS_DONE() ;
-               /* fall through */
+               fallthrough;
        case PC5_SIGNAL :
                if ((cmd != PC_SIGNAL) && (cmd != PC_TIMEOUT_LCT))
                        break ;
@@ -946,7 +946,7 @@ static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd)
                SETMASK(PLC(np,PL_CNTRL_B),PL_PC_JOIN,PL_PC_JOIN) ;
                ACTIONS_DONE() ;
                cmd = 0 ;
-               /* fall thru */
+               fallthrough;
        case PC6_JOIN :
                switch (plc->p_state) {
                case PS_ACTIVE:
index 8c810edece866dcf2aac96bb57f690cce3ad7bf5..466622664424dcd14085257b76c32790f8eff6e6 100644 (file)
@@ -974,7 +974,7 @@ static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid)
                                FJES_RX_STOP_REQ_DONE;
                spin_unlock_irqrestore(&hw->rx_status_lock, flags);
                clear_bit(src_epid, &hw->txrx_stop_req_bit);
-               /* fall through */
+               fallthrough;
        case EP_PARTNER_UNSHARE:
        case EP_PARTNER_COMPLETE:
        default:
index c71f994fbc73cdbface9c031b76018f7ba0fe961..974a244f45ba016d23f6a3a6fab4a80eeb993205 100644 (file)
@@ -777,7 +777,8 @@ static struct rtable *geneve_get_v4_rt(struct sk_buff *skb,
                                       struct net_device *dev,
                                       struct geneve_sock *gs4,
                                       struct flowi4 *fl4,
-                                      const struct ip_tunnel_info *info)
+                                      const struct ip_tunnel_info *info,
+                                      __be16 dport, __be16 sport)
 {
        bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
        struct geneve_dev *geneve = netdev_priv(dev);
@@ -793,6 +794,8 @@ static struct rtable *geneve_get_v4_rt(struct sk_buff *skb,
        fl4->flowi4_proto = IPPROTO_UDP;
        fl4->daddr = info->key.u.ipv4.dst;
        fl4->saddr = info->key.u.ipv4.src;
+       fl4->fl4_dport = dport;
+       fl4->fl4_sport = sport;
 
        tos = info->key.tos;
        if ((tos == 1) && !geneve->cfg.collect_md) {
@@ -827,7 +830,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
                                           struct net_device *dev,
                                           struct geneve_sock *gs6,
                                           struct flowi6 *fl6,
-                                          const struct ip_tunnel_info *info)
+                                          const struct ip_tunnel_info *info,
+                                          __be16 dport, __be16 sport)
 {
        bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
        struct geneve_dev *geneve = netdev_priv(dev);
@@ -843,6 +847,9 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
        fl6->flowi6_proto = IPPROTO_UDP;
        fl6->daddr = info->key.u.ipv6.dst;
        fl6->saddr = info->key.u.ipv6.src;
+       fl6->fl6_dport = dport;
+       fl6->fl6_sport = sport;
+
        prio = info->key.tos;
        if ((prio == 1) && !geneve->cfg.collect_md) {
                prio = ip_tunnel_get_dsfield(ip_hdr(skb), skb);
@@ -889,7 +896,9 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
        __be16 sport;
        int err;
 
-       rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info);
+       sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
+       rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info,
+                             geneve->cfg.info.key.tp_dst, sport);
        if (IS_ERR(rt))
                return PTR_ERR(rt);
 
@@ -919,7 +928,6 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
                return -EMSGSIZE;
        }
 
-       sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
        if (geneve->cfg.collect_md) {
                tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
                ttl = key->ttl;
@@ -974,7 +982,9 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
        __be16 sport;
        int err;
 
-       dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info);
+       sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
+       dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info,
+                               geneve->cfg.info.key.tp_dst, sport);
        if (IS_ERR(dst))
                return PTR_ERR(dst);
 
@@ -1003,7 +1013,6 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
                return -EMSGSIZE;
        }
 
-       sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
        if (geneve->cfg.collect_md) {
                prio = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
                ttl = key->ttl;
@@ -1085,13 +1094,18 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
 {
        struct ip_tunnel_info *info = skb_tunnel_info(skb);
        struct geneve_dev *geneve = netdev_priv(dev);
+       __be16 sport;
 
        if (ip_tunnel_info_af(info) == AF_INET) {
                struct rtable *rt;
                struct flowi4 fl4;
+
                struct geneve_sock *gs4 = rcu_dereference(geneve->sock4);
+               sport = udp_flow_src_port(geneve->net, skb,
+                                         1, USHRT_MAX, true);
 
-               rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info);
+               rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info,
+                                     geneve->cfg.info.key.tp_dst, sport);
                if (IS_ERR(rt))
                        return PTR_ERR(rt);
 
@@ -1101,9 +1115,13 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
        } else if (ip_tunnel_info_af(info) == AF_INET6) {
                struct dst_entry *dst;
                struct flowi6 fl6;
+
                struct geneve_sock *gs6 = rcu_dereference(geneve->sock6);
+               sport = udp_flow_src_port(geneve->net, skb,
+                                         1, USHRT_MAX, true);
 
-               dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info);
+               dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info,
+                                       geneve->cfg.info.key.tp_dst, sport);
                if (IS_ERR(dst))
                        return PTR_ERR(dst);
 
@@ -1114,8 +1132,7 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
                return -EINVAL;
        }
 
-       info->key.tp_src = udp_flow_src_port(geneve->net, skb,
-                                            1, USHRT_MAX, true);
+       info->key.tp_src = sport;
        info->key.tp_dst = geneve->cfg.info.key.tp_dst;
        return 0;
 }
index 21640a035d7df30de40da0b14a7e6abd309550ef..8e47d0112e5dc3798a4ffbf0e345f5b35419d319 100644 (file)
@@ -1179,6 +1179,7 @@ static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq,
                goto nlmsg_failure;
 
        if (nla_put_u32(skb, GTPA_VERSION, pctx->gtp_version) ||
+           nla_put_u32(skb, GTPA_LINK, pctx->dev->ifindex) ||
            nla_put_be32(skb, GTPA_PEER_ADDRESS, pctx->peer_addr_ip4.s_addr) ||
            nla_put_be32(skb, GTPA_MS_ADDRESS, pctx->ms_addr_ip4.s_addr))
                goto nla_put_failure;
index 4476491b58f9d3270467528f0d258247d273c52c..e4e4981ac1d297cdb41902da306954d7bb05d167 100644 (file)
@@ -500,7 +500,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
                                }
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
 
                default:
                        if (bc->hdlctx.calibrate <= 0)
index deef14215110494783720b94908b432537ee664a..17be2bb2985cd00ab965f072762c1ff7e3f6da93 100644 (file)
@@ -482,7 +482,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
                case CRC_MODE_SMACK_TEST:
                        ax->crcmode  = CRC_MODE_FLEX_TEST;
                        printk(KERN_INFO "mkiss: %s: Trying crc-smack\n", ax->dev->name);
-                       // fall through
+                       fallthrough;
                case CRC_MODE_SMACK:
                        *p |= 0x80;
                        crc = swab16(crc16(0, p, len));
@@ -491,7 +491,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
                case CRC_MODE_FLEX_TEST:
                        ax->crcmode = CRC_MODE_NONE;
                        printk(KERN_INFO "mkiss: %s: Trying crc-flexnet\n", ax->dev->name);
-                       // fall through
+                       fallthrough;
                case CRC_MODE_FLEX:
                        *p |= 0x20;
                        crc = calc_crc_flex(p, len);
@@ -744,7 +744,6 @@ static int mkiss_open(struct tty_struct *tty)
                       ax->dev->name);
                break;
        case 0:
-               /* fall through */
        default:
                crc_force = 0;
                printk(KERN_INFO "mkiss: %s: crc mode is auto.\n",
index 2181d4538ab70712ddebd7fda12ca9a8c27b45c1..a0f338cf14247a13651d1fca873cf4423dad795f 100644 (file)
@@ -847,6 +847,10 @@ struct nvsp_message {
 
 #define NETVSC_XDP_HDRM 256
 
+#define NETVSC_XFER_HEADER_SIZE(rng_cnt) \
+               (offsetof(struct vmtransfer_page_packet_header, ranges) + \
+               (rng_cnt) * sizeof(struct vmtransfer_page_range))
+
 struct multi_send_data {
        struct sk_buff *skb; /* skb containing the pkt */
        struct hv_netvsc_packet *pkt; /* netvsc pkt pending */
@@ -974,6 +978,9 @@ struct net_device_context {
        /* Serial number of the VF to team with */
        u32 vf_serial;
 
+       /* Is the current data path through the VF NIC? */
+       bool  data_path_is_vf;
+
        /* Used to temporarily save the config info across hibernation */
        struct netvsc_device_info *saved_netvsc_dev_info;
 };
index 41f5cf0bb99712ec052f483c06cc997cb6a52326..5a57d1985bae62ba0054aa09b8caad3a45228264 100644 (file)
@@ -388,6 +388,15 @@ static int netvsc_init_buf(struct hv_device *device,
        net_device->recv_section_size = resp->sections[0].sub_alloc_size;
        net_device->recv_section_cnt = resp->sections[0].num_sub_allocs;
 
+       /* Ensure buffer will not overflow */
+       if (net_device->recv_section_size < NETVSC_MTU_MIN || (u64)net_device->recv_section_size *
+           (u64)net_device->recv_section_cnt > (u64)buf_size) {
+               netdev_err(ndev, "invalid recv_section_size %u\n",
+                          net_device->recv_section_size);
+               ret = -EINVAL;
+               goto cleanup;
+       }
+
        /* Setup receive completion ring.
         * Add 1 to the recv_section_cnt because at least one entry in a
         * ring buffer has to be empty.
@@ -460,6 +469,12 @@ static int netvsc_init_buf(struct hv_device *device,
        /* Parse the response */
        net_device->send_section_size = init_packet->msg.
                                v1_msg.send_send_buf_complete.section_size;
+       if (net_device->send_section_size < NETVSC_MTU_MIN) {
+               netdev_err(ndev, "invalid send_section_size %u\n",
+                          net_device->send_section_size);
+               ret = -EINVAL;
+               goto cleanup;
+       }
 
        /* Section count is simply the size divided by the section size. */
        net_device->send_section_cnt = buf_size / net_device->send_section_size;
@@ -731,12 +746,49 @@ static void netvsc_send_completion(struct net_device *ndev,
                                   int budget)
 {
        const struct nvsp_message *nvsp_packet = hv_pkt_data(desc);
+       u32 msglen = hv_pkt_datalen(desc);
+
+       /* Ensure packet is big enough to read header fields */
+       if (msglen < sizeof(struct nvsp_message_header)) {
+               netdev_err(ndev, "nvsp_message length too small: %u\n", msglen);
+               return;
+       }
 
        switch (nvsp_packet->hdr.msg_type) {
        case NVSP_MSG_TYPE_INIT_COMPLETE:
+               if (msglen < sizeof(struct nvsp_message_header) +
+                               sizeof(struct nvsp_message_init_complete)) {
+                       netdev_err(ndev, "nvsp_msg length too small: %u\n",
+                                  msglen);
+                       return;
+               }
+               fallthrough;
+
        case NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE:
+               if (msglen < sizeof(struct nvsp_message_header) +
+                               sizeof(struct nvsp_1_message_send_receive_buffer_complete)) {
+                       netdev_err(ndev, "nvsp_msg1 length too small: %u\n",
+                                  msglen);
+                       return;
+               }
+               fallthrough;
+
        case NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE:
+               if (msglen < sizeof(struct nvsp_message_header) +
+                               sizeof(struct nvsp_1_message_send_send_buffer_complete)) {
+                       netdev_err(ndev, "nvsp_msg1 length too small: %u\n",
+                                  msglen);
+                       return;
+               }
+               fallthrough;
+
        case NVSP_MSG5_TYPE_SUBCHANNEL:
+               if (msglen < sizeof(struct nvsp_message_header) +
+                               sizeof(struct nvsp_5_subchannel_complete)) {
+                       netdev_err(ndev, "nvsp_msg5 length too small: %u\n",
+                                  msglen);
+                       return;
+               }
                /* Copy the response back */
                memcpy(&net_device->channel_init_pkt, nvsp_packet,
                       sizeof(struct nvsp_message));
@@ -1117,19 +1169,28 @@ static void enq_receive_complete(struct net_device *ndev,
 static int netvsc_receive(struct net_device *ndev,
                          struct netvsc_device *net_device,
                          struct netvsc_channel *nvchan,
-                         const struct vmpacket_descriptor *desc,
-                         const struct nvsp_message *nvsp)
+                         const struct vmpacket_descriptor *desc)
 {
        struct net_device_context *net_device_ctx = netdev_priv(ndev);
        struct vmbus_channel *channel = nvchan->channel;
        const struct vmtransfer_page_packet_header *vmxferpage_packet
                = container_of(desc, const struct vmtransfer_page_packet_header, d);
+       const struct nvsp_message *nvsp = hv_pkt_data(desc);
+       u32 msglen = hv_pkt_datalen(desc);
        u16 q_idx = channel->offermsg.offer.sub_channel_index;
        char *recv_buf = net_device->recv_buf;
        u32 status = NVSP_STAT_SUCCESS;
        int i;
        int count = 0;
 
+       /* Ensure packet is big enough to read header fields */
+       if (msglen < sizeof(struct nvsp_message_header)) {
+               netif_err(net_device_ctx, rx_err, ndev,
+                         "invalid nvsp header, length too small: %u\n",
+                         msglen);
+               return 0;
+       }
+
        /* Make sure this is a valid nvsp packet */
        if (unlikely(nvsp->hdr.msg_type != NVSP_MSG1_TYPE_SEND_RNDIS_PKT)) {
                netif_err(net_device_ctx, rx_err, ndev,
@@ -1138,6 +1199,14 @@ static int netvsc_receive(struct net_device *ndev,
                return 0;
        }
 
+       /* Validate xfer page pkt header */
+       if ((desc->offset8 << 3) < sizeof(struct vmtransfer_page_packet_header)) {
+               netif_err(net_device_ctx, rx_err, ndev,
+                         "Invalid xfer page pkt, offset too small: %u\n",
+                         desc->offset8 << 3);
+               return 0;
+       }
+
        if (unlikely(vmxferpage_packet->xfer_pageset_id != NETVSC_RECEIVE_BUFFER_ID)) {
                netif_err(net_device_ctx, rx_err, ndev,
                          "Invalid xfer page set id - expecting %x got %x\n",
@@ -1148,6 +1217,14 @@ static int netvsc_receive(struct net_device *ndev,
 
        count = vmxferpage_packet->range_cnt;
 
+       /* Check count for a valid value */
+       if (NETVSC_XFER_HEADER_SIZE(count) > desc->offset8 << 3) {
+               netif_err(net_device_ctx, rx_err, ndev,
+                         "Range count is not valid: %d\n",
+                         count);
+               return 0;
+       }
+
        /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
        for (i = 0; i < count; i++) {
                u32 offset = vmxferpage_packet->ranges[i].byte_offset;
@@ -1155,7 +1232,8 @@ static int netvsc_receive(struct net_device *ndev,
                void *data;
                int ret;
 
-               if (unlikely(offset + buflen > net_device->recv_buf_size)) {
+               if (unlikely(offset > net_device->recv_buf_size ||
+                            buflen > net_device->recv_buf_size - offset)) {
                        nvchan->rsc.cnt = 0;
                        status = NVSP_STAT_FAIL;
                        netif_err(net_device_ctx, rx_err, ndev,
@@ -1194,6 +1272,13 @@ static void netvsc_send_table(struct net_device *ndev,
        u32 count, offset, *tab;
        int i;
 
+       /* Ensure packet is big enough to read send_table fields */
+       if (msglen < sizeof(struct nvsp_message_header) +
+                    sizeof(struct nvsp_5_send_indirect_table)) {
+               netdev_err(ndev, "nvsp_v5_msg length too small: %u\n", msglen);
+               return;
+       }
+
        count = nvmsg->msg.v5_msg.send_table.count;
        offset = nvmsg->msg.v5_msg.send_table.offset;
 
@@ -1225,10 +1310,18 @@ static void netvsc_send_table(struct net_device *ndev,
 }
 
 static void netvsc_send_vf(struct net_device *ndev,
-                          const struct nvsp_message *nvmsg)
+                          const struct nvsp_message *nvmsg,
+                          u32 msglen)
 {
        struct net_device_context *net_device_ctx = netdev_priv(ndev);
 
+       /* Ensure packet is big enough to read its fields */
+       if (msglen < sizeof(struct nvsp_message_header) +
+                    sizeof(struct nvsp_4_send_vf_association)) {
+               netdev_err(ndev, "nvsp_v4_msg length too small: %u\n", msglen);
+               return;
+       }
+
        net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated;
        net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial;
        netdev_info(ndev, "VF slot %u %s\n",
@@ -1238,16 +1331,24 @@ static void netvsc_send_vf(struct net_device *ndev,
 
 static void netvsc_receive_inband(struct net_device *ndev,
                                  struct netvsc_device *nvscdev,
-                                 const struct nvsp_message *nvmsg,
-                                 u32 msglen)
+                                 const struct vmpacket_descriptor *desc)
 {
+       const struct nvsp_message *nvmsg = hv_pkt_data(desc);
+       u32 msglen = hv_pkt_datalen(desc);
+
+       /* Ensure packet is big enough to read header fields */
+       if (msglen < sizeof(struct nvsp_message_header)) {
+               netdev_err(ndev, "inband nvsp_message length too small: %u\n", msglen);
+               return;
+       }
+
        switch (nvmsg->hdr.msg_type) {
        case NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE:
                netvsc_send_table(ndev, nvscdev, nvmsg, msglen);
                break;
 
        case NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION:
-               netvsc_send_vf(ndev, nvmsg);
+               netvsc_send_vf(ndev, nvmsg, msglen);
                break;
        }
 }
@@ -1261,23 +1362,20 @@ static int netvsc_process_raw_pkt(struct hv_device *device,
 {
        struct vmbus_channel *channel = nvchan->channel;
        const struct nvsp_message *nvmsg = hv_pkt_data(desc);
-       u32 msglen = hv_pkt_datalen(desc);
 
        trace_nvsp_recv(ndev, channel, nvmsg);
 
        switch (desc->type) {
        case VM_PKT_COMP:
-               netvsc_send_completion(ndev, net_device, channel,
-                                      desc, budget);
+               netvsc_send_completion(ndev, net_device, channel, desc, budget);
                break;
 
        case VM_PKT_DATA_USING_XFER_PAGES:
-               return netvsc_receive(ndev, net_device, nvchan,
-                                     desc, nvmsg);
+               return netvsc_receive(ndev, net_device, nvchan, desc);
                break;
 
        case VM_PKT_DATA_INBAND:
-               netvsc_receive_inband(ndev, net_device, nvmsg, msglen);
+               netvsc_receive_inband(ndev, net_device, desc);
                break;
 
        default:
index 64b0a74c1523142ec5124338105e9e4187ef3c5f..9869e390875e083a2527e6e01abee0d4637f9fb6 100644 (file)
@@ -748,6 +748,13 @@ void netvsc_linkstatus_callback(struct net_device *net,
        struct netvsc_reconfig *event;
        unsigned long flags;
 
+       /* Ensure the packet is big enough to access its fields */
+       if (resp->msg_len - RNDIS_HEADER_SIZE < sizeof(struct rndis_indicate_status)) {
+               netdev_err(net, "invalid rndis_indicate_status packet, len: %u\n",
+                          resp->msg_len);
+               return;
+       }
+
        /* Update the physical link speed when changing to another vSwitch */
        if (indicate->status == RNDIS_STATUS_LINK_SPEED_CHANGE) {
                u32 speed;
@@ -2366,7 +2373,16 @@ static int netvsc_register_vf(struct net_device *vf_netdev)
        return NOTIFY_OK;
 }
 
-/* VF up/down change detected, schedule to change data path */
+/* Change the data path when VF UP/DOWN/CHANGE are detected.
+ *
+ * Typically a UP or DOWN event is followed by a CHANGE event, so
+ * net_device_ctx->data_path_is_vf is used to cache the current data path
+ * to avoid the duplicate call of netvsc_switch_datapath() and the duplicate
+ * message.
+ *
+ * During hibernation, if a VF NIC driver (e.g. mlx5) preserves the network
+ * interface, there is only the CHANGE event and no UP or DOWN event.
+ */
 static int netvsc_vf_changed(struct net_device *vf_netdev)
 {
        struct net_device_context *net_device_ctx;
@@ -2383,6 +2399,10 @@ static int netvsc_vf_changed(struct net_device *vf_netdev)
        if (!netvsc_dev)
                return NOTIFY_DONE;
 
+       if (net_device_ctx->data_path_is_vf == vf_is_up)
+               return NOTIFY_OK;
+       net_device_ctx->data_path_is_vf = vf_is_up;
+
        netvsc_switch_datapath(ndev, vf_is_up);
        netdev_info(ndev, "Data path switched %s VF: %s\n",
                    vf_is_up ? "to" : "from", vf_netdev->name);
@@ -2587,8 +2607,8 @@ static int netvsc_remove(struct hv_device *dev)
 static int netvsc_suspend(struct hv_device *dev)
 {
        struct net_device_context *ndev_ctx;
-       struct net_device *vf_netdev, *net;
        struct netvsc_device *nvdev;
+       struct net_device *net;
        int ret;
 
        net = hv_get_drvdata(dev);
@@ -2604,10 +2624,6 @@ static int netvsc_suspend(struct hv_device *dev)
                goto out;
        }
 
-       vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
-       if (vf_netdev)
-               netvsc_unregister_vf(vf_netdev);
-
        /* Save the current config info */
        ndev_ctx->saved_netvsc_dev_info = netvsc_devinfo_get(nvdev);
 
@@ -2628,6 +2644,12 @@ static int netvsc_resume(struct hv_device *dev)
        rtnl_lock();
 
        net_device_ctx = netdev_priv(net);
+
+       /* Reset the data path to the netvsc NIC before re-opening the vmbus
+        * channel. Later netvsc_netdev_event() will switch the data path to
+        * the VF upon the UP or CHANGE event.
+        */
+       net_device_ctx->data_path_is_vf = false;
        device_info = net_device_ctx->saved_netvsc_dev_info;
 
        ret = netvsc_attach(net, device_info);
@@ -2695,6 +2717,7 @@ static int netvsc_netdev_event(struct notifier_block *this,
                return netvsc_unregister_vf(event_dev);
        case NETDEV_UP:
        case NETDEV_DOWN:
+       case NETDEV_CHANGE:
                return netvsc_vf_changed(event_dev);
        default:
                return NOTIFY_DONE;
index b81ceba38218c30cb6ab3507954b64b02a1276db..12ad471ac5e1fee70c044725f43092c3745a8f16 100644 (file)
@@ -275,6 +275,16 @@ static void rndis_filter_receive_response(struct net_device *ndev,
                return;
        }
 
+       /* Ensure the packet is big enough to read req_id. Req_id is the 1st
+        * field in any request/response message, so the payload should have at
+        * least sizeof(u32) bytes
+        */
+       if (resp->msg_len - RNDIS_HEADER_SIZE < sizeof(u32)) {
+               netdev_err(ndev, "rndis msg_len too small: %u\n",
+                          resp->msg_len);
+               return;
+       }
+
        spin_lock_irqsave(&dev->request_lock, flags);
        list_for_each_entry(request, &dev->req_list, list_ent) {
                /*
@@ -331,8 +341,9 @@ static void rndis_filter_receive_response(struct net_device *ndev,
  * Get the Per-Packet-Info with the specified type
  * return NULL if not found.
  */
-static inline void *rndis_get_ppi(struct rndis_packet *rpkt,
-                                 u32 type, u8 internal)
+static inline void *rndis_get_ppi(struct net_device *ndev,
+                                 struct rndis_packet *rpkt,
+                                 u32 rpkt_len, u32 type, u8 internal)
 {
        struct rndis_per_packet_info *ppi;
        int len;
@@ -340,11 +351,36 @@ static inline void *rndis_get_ppi(struct rndis_packet *rpkt,
        if (rpkt->per_pkt_info_offset == 0)
                return NULL;
 
+       /* Validate info_offset and info_len */
+       if (rpkt->per_pkt_info_offset < sizeof(struct rndis_packet) ||
+           rpkt->per_pkt_info_offset > rpkt_len) {
+               netdev_err(ndev, "Invalid per_pkt_info_offset: %u\n",
+                          rpkt->per_pkt_info_offset);
+               return NULL;
+       }
+
+       if (rpkt->per_pkt_info_len > rpkt_len - rpkt->per_pkt_info_offset) {
+               netdev_err(ndev, "Invalid per_pkt_info_len: %u\n",
+                          rpkt->per_pkt_info_len);
+               return NULL;
+       }
+
        ppi = (struct rndis_per_packet_info *)((ulong)rpkt +
                rpkt->per_pkt_info_offset);
        len = rpkt->per_pkt_info_len;
 
        while (len > 0) {
+               /* Validate ppi_offset and ppi_size */
+               if (ppi->size > len) {
+                       netdev_err(ndev, "Invalid ppi size: %u\n", ppi->size);
+                       continue;
+               }
+
+               if (ppi->ppi_offset >= ppi->size) {
+                       netdev_err(ndev, "Invalid ppi_offset: %u\n", ppi->ppi_offset);
+                       continue;
+               }
+
                if (ppi->type == type && ppi->internal == internal)
                        return (void *)((ulong)ppi + ppi->ppi_offset);
                len -= ppi->size;
@@ -388,14 +424,29 @@ static int rndis_filter_receive_data(struct net_device *ndev,
        const struct ndis_pkt_8021q_info *vlan;
        const struct rndis_pktinfo_id *pktinfo_id;
        const u32 *hash_info;
-       u32 data_offset;
+       u32 data_offset, rpkt_len;
        void *data;
        bool rsc_more = false;
        int ret;
 
+       /* Ensure data_buflen is big enough to read header fields */
+       if (data_buflen < RNDIS_HEADER_SIZE + sizeof(struct rndis_packet)) {
+               netdev_err(ndev, "invalid rndis pkt, data_buflen too small: %u\n",
+                          data_buflen);
+               return NVSP_STAT_FAIL;
+       }
+
+       /* Validate rndis_pkt offset */
+       if (rndis_pkt->data_offset >= data_buflen - RNDIS_HEADER_SIZE) {
+               netdev_err(ndev, "invalid rndis packet offset: %u\n",
+                          rndis_pkt->data_offset);
+               return NVSP_STAT_FAIL;
+       }
+
        /* Remove the rndis header and pass it back up the stack */
        data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset;
 
+       rpkt_len = data_buflen - RNDIS_HEADER_SIZE;
        data_buflen -= data_offset;
 
        /*
@@ -410,13 +461,13 @@ static int rndis_filter_receive_data(struct net_device *ndev,
                return NVSP_STAT_FAIL;
        }
 
-       vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO, 0);
+       vlan = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, IEEE_8021Q_INFO, 0);
 
-       csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO, 0);
+       csum_info = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, TCPIP_CHKSUM_PKTINFO, 0);
 
-       hash_info = rndis_get_ppi(rndis_pkt, NBL_HASH_VALUE, 0);
+       hash_info = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, NBL_HASH_VALUE, 0);
 
-       pktinfo_id = rndis_get_ppi(rndis_pkt, RNDIS_PKTINFO_ID, 1);
+       pktinfo_id = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, RNDIS_PKTINFO_ID, 1);
 
        data = (void *)msg + data_offset;
 
@@ -474,6 +525,14 @@ int rndis_filter_receive(struct net_device *ndev,
        if (netif_msg_rx_status(net_device_ctx))
                dump_rndis_message(ndev, rndis_msg);
 
+       /* Validate incoming rndis_message packet */
+       if (buflen < RNDIS_HEADER_SIZE || rndis_msg->msg_len < RNDIS_HEADER_SIZE ||
+           buflen < rndis_msg->msg_len) {
+               netdev_err(ndev, "Invalid rndis_msg (buflen: %u, msg_len: %u)\n",
+                          buflen, rndis_msg->msg_len);
+               return NVSP_STAT_FAIL;
+       }
+
        switch (rndis_msg->ndis_msg_type) {
        case RNDIS_MSG_PACKET:
                return rndis_filter_receive_data(ndev, net_dev, nvchan,
index c11f32f644db3ce27a81d41c27593f5d3821d7e7..7db9cbd0f5ded13c96060d6b3ef5946db8b3fcd0 100644 (file)
@@ -882,7 +882,9 @@ static int adf7242_rx(struct adf7242_local *lp)
        int ret;
        u8 lqi, len_u8, *data;
 
-       adf7242_read_reg(lp, 0, &len_u8);
+       ret = adf7242_read_reg(lp, 0, &len_u8);
+       if (ret)
+               return ret;
 
        len = len_u8;
 
index e04c3b60cae78fb56ab22510e3cff13748ac7485..4eb64709d44cb09865d23d9e34ea5d53a9cfe6b4 100644 (file)
@@ -2925,6 +2925,7 @@ static int ca8210_dev_com_init(struct ca8210_priv *priv)
        );
        if (!priv->irq_workqueue) {
                dev_crit(&priv->spi->dev, "alloc of irq_workqueue failed!\n");
+               destroy_workqueue(priv->mlme_workqueue);
                return -ENOMEM;
        }
 
index 2098ca2f2c902846cbb836b7bd2add5ac5dbe195..b3790aa952a15476b18f76a34c4e8add73d405e9 100644 (file)
@@ -521,7 +521,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint)
        val = ioread32(endpoint->ipa->reg_virt + offset);
 
        /* Zero all filter-related fields, preserving the rest */
-       u32_replace_bits(val, 0, IPA_REG_ENDP_FILTER_HASH_MSK_ALL);
+       u32p_replace_bits(&val, 0, IPA_REG_ENDP_FILTER_HASH_MSK_ALL);
 
        iowrite32(val, endpoint->ipa->reg_virt + offset);
 }
@@ -573,7 +573,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id)
        val = ioread32(ipa->reg_virt + offset);
 
        /* Zero all route-related fields, preserving the rest */
-       u32_replace_bits(val, 0, IPA_REG_ENDP_ROUTER_HASH_MSK_ALL);
+       u32p_replace_bits(&val, 0, IPA_REG_ENDP_ROUTER_HASH_MSK_ALL);
 
        iowrite32(val, ipa->reg_virt + offset);
 }
index 5da04e9979894333bb16a1e2df7e954e765916c5..c8d803d3616c90a74c05674a72c283b8062f4067 100644 (file)
@@ -842,7 +842,7 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (!net_eq(dev_net(dev), &init_net))
                        break;
-               /* fall through */
+               fallthrough;
        case SIOCGHWTSTAMP:
                if (netif_device_present(real_dev) && ops->ndo_do_ioctl)
                        err = ops->ndo_do_ioctl(real_dev, &ifrr, cmd);
index 44612122338bba29be8a0160169c877b237668af..f6a97c859f3a4b47ce4cec58b2e5bed64567615f 100644 (file)
@@ -597,7 +597,7 @@ int generic_mii_ioctl(struct mii_if_info *mii_if,
        switch(cmd) {
        case SIOCGMIIPHY:
                mii_data->phy_id = mii_if->phy_id;
-               /* fall through */
+               fallthrough;
 
        case SIOCGMIIREG:
                mii_data->val_out =
index 7971dc4f54f15fa20ad0ed579590872062f7dce6..0e9511661601a66540fef0562694cac19cdb9bb2 100644 (file)
@@ -193,7 +193,7 @@ new_device_store(struct bus_type *bus, const char *buf, size_t count)
        switch (err) {
        case 1:
                port_count = 1;
-               /* fall through */
+               fallthrough;
        case 2:
                if (id > INT_MAX) {
                        pr_err("Value of \"id\" is too big.\n");
index f32d56ac3e80faaa9e30b6b6aea8cc1b49a6f947..deea17a0e79c9ee55cbd27c76881d0e1fdc05bfd 100644 (file)
@@ -760,14 +760,14 @@ static int nsim_fib_event_nb(struct notifier_block *nb, unsigned long event,
        spin_lock_bh(&data->fib_lock);
 
        switch (event) {
-       case FIB_EVENT_RULE_ADD: /* fall through */
+       case FIB_EVENT_RULE_ADD:
        case FIB_EVENT_RULE_DEL:
                err = nsim_fib_rule_event(data, info,
                                          event == FIB_EVENT_RULE_ADD);
                break;
 
-       case FIB_EVENT_ENTRY_REPLACE:  /* fall through */
-       case FIB_EVENT_ENTRY_APPEND:  /* fall through */
+       case FIB_EVENT_ENTRY_REPLACE:
+       case FIB_EVENT_ENTRY_APPEND:
        case FIB_EVENT_ENTRY_DEL:
                err = nsim_fib_event(data, info, event);
                break;
index 7471a8b908735ceee56422f552d551957f2f86cc..307f0ac1287bed062acab03757e68ee5dbac5740 100644 (file)
@@ -366,10 +366,10 @@ static int adin_set_edpd(struct phy_device *phydev, u16 tx_interval)
 
        switch (tx_interval) {
        case 1000: /* 1 second */
-               /* fallthrough */
+               fallthrough;
        case ETHTOOL_PHY_EDPD_DFLT_TX_MSECS:
                val |= ADIN1300_NRG_PD_TX_EN;
-               /* fallthrough */
+               fallthrough;
        case ETHTOOL_PHY_EDPD_NO_TX:
                break;
        default:
index 50fb7d16b75ac9a49ddef1d31f7fa42f3dd15318..79e67f2fe00ae07c17b06db5c6cdec3f6f29e2a8 100644 (file)
@@ -766,13 +766,13 @@ static int decode_evnt(struct dp83640_private *dp83640,
        switch (words) {
        case 3:
                dp83640->edata.sec_hi = phy_txts->sec_hi;
-               /* fall through */
+               fallthrough;
        case 2:
                dp83640->edata.sec_lo = phy_txts->sec_lo;
-               /* fall through */
+               fallthrough;
        case 1:
                dp83640->edata.ns_hi = phy_txts->ns_hi;
-               /* fall through */
+               fallthrough;
        case 0:
                dp83640->edata.ns_lo = phy_txts->ns_lo;
        }
@@ -1409,7 +1409,7 @@ static void dp83640_txtstamp(struct mii_timestamper *mii_ts,
                        kfree_skb(skb);
                        return;
                }
-               /* fall through */
+               fallthrough;
        case HWTSTAMP_TX_ON:
                skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
                skb_info->tmo = jiffies + SKB_TIMESTAMP_TIMEOUT;
index f3c04981b8da67846eb9c0e5b20208741aecd3cc..cd7032628a28ceeec4d55ba4594269b3e09d5e84 100644 (file)
@@ -215,9 +215,9 @@ static int dp83867_set_wol(struct phy_device *phydev,
                if (wol->wolopts & WAKE_MAGICSECURE) {
                        phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1,
                                      (wol->sopass[1] << 8) | wol->sopass[0]);
-                       phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1,
+                       phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP2,
                                      (wol->sopass[3] << 8) | wol->sopass[2]);
-                       phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1,
+                       phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP3,
                                      (wol->sopass[5] << 8) | wol->sopass[4]);
 
                        val_rxcfg |= DP83867_WOL_SEC_EN;
index 58103152c6010e844589d81785ac0b7727b25ea7..6b98d74b5102bc98c524e790f8c0e60f2e75508e 100644 (file)
@@ -427,18 +427,18 @@ static int dp83869_config_init(struct phy_device *phydev)
                        return ret;
 
                val = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL);
-               val &= ~(DP83869_RGMII_TX_CLK_DELAY_EN |
-                        DP83869_RGMII_RX_CLK_DELAY_EN);
+               val |= (DP83869_RGMII_TX_CLK_DELAY_EN |
+                       DP83869_RGMII_RX_CLK_DELAY_EN);
 
                if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
-                       val |= (DP83869_RGMII_TX_CLK_DELAY_EN |
-                               DP83869_RGMII_RX_CLK_DELAY_EN);
+                       val &= ~(DP83869_RGMII_TX_CLK_DELAY_EN |
+                                DP83869_RGMII_RX_CLK_DELAY_EN);
 
                if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
-                       val |= DP83869_RGMII_TX_CLK_DELAY_EN;
+                       val &= ~DP83869_RGMII_TX_CLK_DELAY_EN;
 
                if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
-                       val |= DP83869_RGMII_RX_CLK_DELAY_EN;
+                       val &= ~DP83869_RGMII_RX_CLK_DELAY_EN;
 
                ret = phy_write_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL,
                                    val);
index c4641b1704d614862e0383d2f2186b318b57f875..18d81f43f2a889be11095d4613dc720d34d0ab6c 100644 (file)
@@ -279,13 +279,13 @@ static struct phy_device *__fixed_phy_register(unsigned int irq,
                                 phy->supported);
                linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
                                 phy->supported);
-               /* fall through */
+               fallthrough;
        case SPEED_100:
                linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT,
                                 phy->supported);
                linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
                                 phy->supported);
-               /* fall through */
+               fallthrough;
        case SPEED_10:
        default:
                linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT,
index 79b4f35d151ecc58c551548ee2306499c911bd63..8947d58f2a25f1f5820a64acb2a083e3819b6c41 100644 (file)
@@ -355,7 +355,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
        switch (cmd) {
        case SIOCGMIIPHY:
                mii_data->phy_id = phydev->mdio.addr;
-               /* fall through */
+               fallthrough;
 
        case SIOCGMIIREG:
                if (mdio_phy_id_is_c45(mii_data->phy_id)) {
@@ -433,7 +433,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (phydev->mii_ts && phydev->mii_ts->hwtstamp)
                        return phydev->mii_ts->hwtstamp(phydev->mii_ts, ifr);
-               /* fall through */
+               fallthrough;
 
        default:
                return -EOPNOTSUPP;
@@ -996,7 +996,7 @@ void phy_stop(struct phy_device *phydev)
 {
        struct net_device *dev = phydev->attached_dev;
 
-       if (!phy_is_started(phydev)) {
+       if (!phy_is_started(phydev) && phydev->state != PHY_DOWN) {
                WARN(1, "called from state %s\n",
                     phy_state_to_str(phydev->state));
                return;
index 57d44648c8dd1cbb5e54487d3d2497bbbf4d5612..5dab6be6fc383226d4d680b2f339f03ef469f8e8 100644 (file)
@@ -1143,10 +1143,6 @@ int phy_init_hw(struct phy_device *phydev)
        if (ret < 0)
                return ret;
 
-       ret = phy_disable_interrupts(phydev);
-       if (ret)
-               return ret;
-
        if (phydev->drv->config_init)
                ret = phydev->drv->config_init(phydev);
 
@@ -1423,6 +1419,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
        if (err)
                goto error;
 
+       err = phy_disable_interrupts(phydev);
+       if (err)
+               return err;
+
        phy_resume(phydev);
        phy_led_triggers_register(phydev);
 
@@ -1682,7 +1682,8 @@ void phy_detach(struct phy_device *phydev)
 
        phy_led_triggers_unregister(phydev);
 
-       module_put(phydev->mdio.dev.driver->owner);
+       if (phydev->mdio.dev.driver)
+               module_put(phydev->mdio.dev.driver->owner);
 
        /* If the device had no specific driver before (i.e. - it
         * was using the generic driver), we unbind the device
@@ -1979,7 +1980,7 @@ static int genphy_setup_master_slave(struct phy_device *phydev)
                break;
        case MASTER_SLAVE_CFG_MASTER_FORCE:
                ctl |= CTL1000_AS_MASTER;
-               /* fallthrough */
+               fallthrough;
        case MASTER_SLAVE_CFG_SLAVE_FORCE:
                ctl |= CTL1000_ENABLE_MASTER;
                break;
index 32b4bd6a5b55910e066069d4556d44c4307794da..32f4e8ec96cff23deba27167dc3d9ed1fdfaeb5c 100644 (file)
@@ -1905,7 +1905,7 @@ int phylink_mii_ioctl(struct phylink *pl, struct ifreq *ifr, int cmd)
                switch (cmd) {
                case SIOCGMIIPHY:
                        mii->phy_id = pl->phydev->mdio.addr;
-                       /* fall through */
+                       fallthrough;
 
                case SIOCGMIIREG:
                        ret = phylink_phy_read(pl, mii->phy_id, mii->reg_num);
@@ -1928,7 +1928,7 @@ int phylink_mii_ioctl(struct phylink *pl, struct ifreq *ifr, int cmd)
                switch (cmd) {
                case SIOCGMIIPHY:
                        mii->phy_id = 0;
-                       /* fall through */
+                       fallthrough;
 
                case SIOCGMIIREG:
                        ret = phylink_mii_read(pl, mii->phy_id, mii->reg_num);
index 6900c68260e0dca7d54a4961389dc65c1f90415f..58014feedf6c882b826a103975bca0c09406383a 100644 (file)
@@ -149,7 +149,7 @@ int sfp_parse_port(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
                        port = PORT_TP;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case SFF8024_CONNECTOR_SG: /* guess */
        case SFF8024_CONNECTOR_HSSDC_II:
        case SFF8024_CONNECTOR_NOSEPARATE:
@@ -301,7 +301,7 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
                break;
        case SFF8024_ECC_100GBASE_CR4:
                phylink_set(modes, 100000baseCR4_Full);
-               /* fallthrough */
+               fallthrough;
        case SFF8024_ECC_25GBASE_CR_S:
        case SFF8024_ECC_25GBASE_CR_N:
                phylink_set(modes, 25000baseCR_Full);
index c24b0e83dd3291faccae72d0348325bae845736b..cf83314c8591eead4c4a60ac9ec86dae99393dc7 100644 (file)
@@ -552,7 +552,7 @@ static umode_t sfp_hwmon_is_visible(const void *data,
                case hwmon_temp_crit:
                        if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN))
                                return 0;
-                       /* fall through */
+                       fallthrough;
                case hwmon_temp_input:
                case hwmon_temp_label:
                        return 0444;
@@ -571,7 +571,7 @@ static umode_t sfp_hwmon_is_visible(const void *data,
                case hwmon_in_crit:
                        if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN))
                                return 0;
-                       /* fall through */
+                       fallthrough;
                case hwmon_in_input:
                case hwmon_in_label:
                        return 0444;
@@ -590,7 +590,7 @@ static umode_t sfp_hwmon_is_visible(const void *data,
                case hwmon_curr_crit:
                        if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN))
                                return 0;
-                       /* fall through */
+                       fallthrough;
                case hwmon_curr_input:
                case hwmon_curr_label:
                        return 0444;
@@ -618,7 +618,7 @@ static umode_t sfp_hwmon_is_visible(const void *data,
                case hwmon_power_crit:
                        if (!(sfp->id.ext.enhopts & SFP_ENHOPTS_ALARMWARN))
                                return 0;
-                       /* fall through */
+                       fallthrough;
                case hwmon_power_input:
                case hwmon_power_label:
                        return 0444;
@@ -1872,7 +1872,7 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
                        dev_warn(sfp->dev, "hwmon probe failed: %d\n", err);
 
                sfp_sm_mod_next(sfp, SFP_MOD_WAITDEV, 0);
-               /* fall through */
+               fallthrough;
        case SFP_MOD_WAITDEV:
                /* Ensure that the device is attached before proceeding */
                if (sfp->sm_dev_state < SFP_DEV_DOWN)
@@ -1890,7 +1890,7 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
                        goto insert;
 
                sfp_sm_mod_next(sfp, SFP_MOD_HPOWER, 0);
-               /* fall through */
+               fallthrough;
        case SFP_MOD_HPOWER:
                /* Enable high power mode */
                err = sfp_sm_mod_hpower(sfp, true);
index d82016dcde3b961b083c955b8037093c5b6538a8..4406b353123edadd372a7e522f25c38a631bb9fc 100644 (file)
@@ -498,7 +498,7 @@ plip_receive(unsigned short nibble_timeout, struct net_device *dev,
                *data_p = (c0 >> 3) & 0x0f;
                write_data (dev, 0x10); /* send ACK */
                *ns_p = PLIP_NB_1;
-               /* fall through */
+               fallthrough;
 
        case PLIP_NB_1:
                cx = nibble_timeout;
@@ -594,7 +594,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                        printk(KERN_DEBUG "%s: receive start\n", dev->name);
                rcv->state = PLIP_PK_LENGTH_LSB;
                rcv->nibble = PLIP_NB_BEGIN;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_LENGTH_LSB:
                if (snd->state != PLIP_PK_DONE) {
@@ -615,7 +615,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                                return TIMEOUT;
                }
                rcv->state = PLIP_PK_LENGTH_MSB;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_LENGTH_MSB:
                if (plip_receive(nibble_timeout, dev,
@@ -638,7 +638,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                rcv->state = PLIP_PK_DATA;
                rcv->byte = 0;
                rcv->checksum = 0;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_DATA:
                lbuf = rcv->skb->data;
@@ -651,7 +651,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                        rcv->checksum += lbuf[--rcv->byte];
                } while (rcv->byte);
                rcv->state = PLIP_PK_CHECKSUM;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_CHECKSUM:
                if (plip_receive(nibble_timeout, dev,
@@ -664,7 +664,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
                        return ERROR;
                }
                rcv->state = PLIP_PK_DONE;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_DONE:
                /* Inform the upper layer for the arrival of a packet. */
@@ -710,7 +710,7 @@ plip_send(unsigned short nibble_timeout, struct net_device *dev,
        case PLIP_NB_BEGIN:
                write_data (dev, data & 0x0f);
                *ns_p = PLIP_NB_1;
-               /* fall through */
+               fallthrough;
 
        case PLIP_NB_1:
                write_data (dev, 0x10 | (data & 0x0f));
@@ -725,7 +725,7 @@ plip_send(unsigned short nibble_timeout, struct net_device *dev,
                }
                write_data (dev, 0x10 | (data >> 4));
                *ns_p = PLIP_NB_2;
-               /* fall through */
+               fallthrough;
 
        case PLIP_NB_2:
                write_data (dev, (data >> 4));
@@ -814,7 +814,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                              &snd->nibble, snd->length.b.lsb))
                        return TIMEOUT;
                snd->state = PLIP_PK_LENGTH_MSB;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_LENGTH_MSB:
                if (plip_send(nibble_timeout, dev,
@@ -823,7 +823,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                snd->state = PLIP_PK_DATA;
                snd->byte = 0;
                snd->checksum = 0;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_DATA:
                do {
@@ -835,7 +835,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                        snd->checksum += lbuf[--snd->byte];
                } while (snd->byte);
                snd->state = PLIP_PK_CHECKSUM;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_CHECKSUM:
                if (plip_send(nibble_timeout, dev,
@@ -846,7 +846,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,
                dev_kfree_skb(snd->skb);
                dev->stats.tx_packets++;
                snd->state = PLIP_PK_DONE;
-               /* fall through */
+               fallthrough;
 
        case PLIP_PK_DONE:
                /* Close the connection */
@@ -935,7 +935,7 @@ plip_interrupt(void *dev_id)
        switch (nl->connection) {
        case PLIP_CN_CLOSING:
                netif_wake_queue (dev);
-               /* fall through */
+               fallthrough;
        case PLIP_CN_NONE:
        case PLIP_CN_SEND:
                rcv->state = PLIP_PK_TRIGGER;
index 3c11a77f5709f1b0218e44f2e5b1fd90256e0d73..7959b5c2d11f1cdcc4d549546abeff694415e8a1 100644 (file)
@@ -1590,10 +1590,10 @@ static int tun_xdp_act(struct tun_struct *tun, struct bpf_prog *xdp_prog,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(tun->dev, xdp_prog, act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                this_cpu_inc(tun->pcpu_stats->rx_dropped);
                break;
@@ -2417,7 +2417,7 @@ static int tun_xdp_one(struct tun_struct *tun,
                switch (err) {
                case XDP_REDIRECT:
                        *flush = true;
-                       /* fall through */
+                       fallthrough;
                case XDP_TX:
                        return 0;
                case XDP_PASS:
index a7fbc3ccd29e422d231e2e8aab3b5d453ebb1e36..c7bcfca7d70b091a31a88113ad28a6ae97fc9e46 100644 (file)
@@ -252,6 +252,7 @@ config USB_NET_CDC_EEM
 config USB_NET_CDC_NCM
        tristate "CDC NCM support"
        depends on USB_USBNET
+       select USB_NET_CDCETHER
        default y
        help
          This driver provides support for CDC NCM (Network Control Model
index 7e44110746dd00f11382b9a03d8c56e724e00c59..0717c18015c9c5a93c2dc8dc29d864addf6ea8fa 100644 (file)
@@ -333,13 +333,13 @@ static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed)
                switch (speed) {
                case SPEED_5000:
                        aqc111_data->phy_cfg |= AQ_ADV_5G;
-                       /* fall-through */
+                       fallthrough;
                case SPEED_2500:
                        aqc111_data->phy_cfg |= AQ_ADV_2G5;
-                       /* fall-through */
+                       fallthrough;
                case SPEED_1000:
                        aqc111_data->phy_cfg |= AQ_ADV_1G;
-                       /* fall-through */
+                       fallthrough;
                case SPEED_100:
                        aqc111_data->phy_cfg |= AQ_ADV_100M;
                        /* fall-through */
index e39f41efda3ec1ecac5616d509f183c99ea69a33..7bc6e8f856fe0bd0188d3cb3af772d6e44870d43 100644 (file)
@@ -296,7 +296,7 @@ int asix_read_phy_addr(struct usbnet *dev, int internal)
 
        netdev_dbg(dev->net, "asix_get_phy_addr()\n");
 
-       if (ret < 0) {
+       if (ret < 2) {
                netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret);
                goto out;
        }
index d387bc7ac1b60b61969a8fa2eed848438438de59..97ba67042d126f07542f6e51f21d9378fa0ed3db 100644 (file)
@@ -858,7 +858,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
                default:
                        dev_warn(&intf->dev,
                                 "Couldn't detect memory size, assuming 32k\n");
-                       /* fall through */
+                       fallthrough;
                case 0x87654321:
                        catc_set_reg(catc, TxBufCount, 4);
                        catc_set_reg(catc, RxBufCount, 16);
index 9bdbd7b472a0ac622f843f43e90de8c11621ba88..dba847f280962d9feaa269d0e2cc012a7b5ff18b 100644 (file)
@@ -97,7 +97,7 @@ static void tx_complete(struct urb *req)
        case -ECONNRESET:
        case -ESHUTDOWN:
                dev->stats.tx_aborted_errors++;
-               /* fall through */
+               fallthrough;
        default:
                dev->stats.tx_errors++;
                dev_dbg(&dev->dev, "TX error (%d)\n", status);
index b91f92e4e5f22d659d89c35d8accc6ef03191b74..915ac75b55fc7c43f55db19b379983216b93de5f 100644 (file)
@@ -625,6 +625,10 @@ static const struct usb_device_id products[] = {
         USB_DEVICE(0x0a46, 0x1269),    /* DM9621A USB to Fast Ethernet Adapter */
         .driver_info = (unsigned long)&dm9601_info,
        },
+       {
+        USB_DEVICE(0x0586, 0x3427),    /* ZyXEL Keenetic Plus DSL xDSL modem */
+        .driver_info = (unsigned long)&dm9601_info,
+       },
        {},                     // END
 };
 
index 442507f25aadb7dca5bd84787a8d85a1a1b0822e..65b315bc60abd649f8743f3ae23d130fb27301f1 100644 (file)
@@ -3192,7 +3192,7 @@ static void rx_complete(struct urb *urb)
        case -EPIPE:
                dev->net->stats.rx_errors++;
                lan78xx_defer_kevent(dev, EVENT_RX_HALT);
-               /* FALLTHROUGH */
+               fallthrough;
        case -ECONNRESET:                               /* async unlink */
        case -ESHUTDOWN:                                /* hardware gone */
                netif_dbg(dev, ifdown, dev->net,
@@ -3213,7 +3213,7 @@ static void rx_complete(struct urb *urb)
        /* data overrun ... flush fifo? */
        case -EOVERFLOW:
                dev->net->stats.rx_over_errors++;
-               /* FALLTHROUGH */
+               fallthrough;
 
        default:
                state = rx_cleanup;
index 0ef7e1f443e333ffd49cab9161ccb55543a7a20e..e92cb51a2c77028b8c2f05b923bcda8312313be6 100644 (file)
@@ -629,7 +629,7 @@ static void write_bulk_callback(struct urb *urb)
                return;
        default:
                netif_info(pegasus, tx_err, net, "TX status %d\n", status);
-               /* FALL THROUGH */
+               fallthrough;
        case 0:
                break;
        }
@@ -1009,7 +1009,7 @@ static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
        switch (cmd) {
        case SIOCDEVPRIVATE:
                data[0] = pegasus->phy;
-               /* fall through */
+               fallthrough;
        case SIOCDEVPRIVATE + 1:
                read_mii_word(pegasus, data[0], data[1] & 0x1f, &data[3]);
                res = 0;
index 2b02fefd094d53fc1ed2342625c8f479f5652cae..b1770489aca5194a3ce054962c4c7cab1fc69281 100644 (file)
@@ -1682,7 +1682,7 @@ static void intr_callback(struct urb *urb)
        case -ECONNRESET:       /* unlink */
        case -ESHUTDOWN:
                netif_device_detach(tp->netdev);
-               /* fall through */
+               fallthrough;
        case -ENOENT:
        case -EPROTO:
                netif_info(tp, intr, tp->netdev,
@@ -3251,7 +3251,7 @@ static void r8153b_ups_en(struct r8152 *tp, bool enable)
                        r8152_mdio_write(tp, MII_BMCR, data);
 
                        data = r8153_phy_status(tp, PHY_STAT_LAN_ON);
-                       /* fall through */
+                       fallthrough;
 
                default:
                        if (data != PHY_STAT_LAN_ON)
@@ -4849,7 +4849,7 @@ static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u32 speed, u8 duplex,
                                tp->ups_info.speed_duplex = NWAY_1000M_FULL;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        ret = -EINVAL;
                        goto out;
index bd9c07888ebb43e6b0fff37a8578ec8cf1cde0dc..6fa7a009a24a48d564b19e6e0788dbbfadb3cb06 100644 (file)
@@ -201,7 +201,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
                        dev_dbg(&info->control->dev,
                                "rndis response error, code %d\n", retval);
                }
-               msleep(20);
+               msleep(40);
        }
        dev_dbg(&info->control->dev, "rndis response timeout\n");
        return -ETIMEDOUT;
index e7c630d375899ba3f94176b053c0b11e864c1c3d..733f120c852b727224fe645ca0a5b368c7f6758d 100644 (file)
@@ -843,7 +843,7 @@ static int rtl8150_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
        switch (cmd) {
        case SIOCDEVPRIVATE:
                data[0] = dev->phy;
-               /* fall through */
+               fallthrough;
        case SIOCDEVPRIVATE + 1:
                read_mii_word(dev, dev->phy, (data[1] & 0x1f), &data[3]);
                break;
index e45935a5856aa5425240a39657ba0355793bf951..2b2a841cd93884c9451ba9143821d9e66afff7f5 100644 (file)
@@ -110,7 +110,7 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf)
                                if (!usb_endpoint_dir_in(&e->desc))
                                        continue;
                                intr = 1;
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case USB_ENDPOINT_XFER_BULK:
                                break;
                        default:
@@ -628,7 +628,7 @@ block:
        /* data overrun ... flush fifo? */
        case -EOVERFLOW:
                dev->net->stats.rx_over_errors++;
-               // FALLTHROUGH
+               fallthrough;
 
        default:
                state = rx_cleanup;
@@ -1530,7 +1530,7 @@ static void usbnet_bh (struct timer_list *t)
                        continue;
                case tx_done:
                        kfree(entry->urb->sg);
-                       /* fall through */
+                       fallthrough;
                case rx_cleanup:
                        usb_free_urb (entry->urb);
                        dev_kfree_skb (skb);
index e56cd562a66455e43162274f34befb3d3ec066c6..a475f48d43c44d2b16f83c565615bf8289e488eb 100644 (file)
@@ -610,10 +610,10 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq,
                        goto xdp_xmit;
                default:
                        bpf_warn_invalid_xdp_action(act);
-                       /* fall through */
+                       fallthrough;
                case XDP_ABORTED:
                        trace_xdp_exception(rq->dev, xdp_prog, act);
-                       /* fall through */
+                       fallthrough;
                case XDP_DROP:
                        stats->xdp_drops++;
                        goto err_xdp;
@@ -745,10 +745,10 @@ static struct sk_buff *veth_xdp_rcv_skb(struct veth_rq *rq,
                goto xdp_xmit;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(rq->dev, xdp_prog, act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
                stats->xdp_drops++;
                goto xdp_drop;
index 0ada48edf74955c633a572fd70fa6eedab85dba9..263b005981bd7837277e65280c2ff3df38f17730 100644 (file)
@@ -724,7 +724,7 @@ static struct sk_buff *receive_small(struct net_device *dev,
                        goto xdp_xmit;
                default:
                        bpf_warn_invalid_xdp_action(act);
-                       /* fall through */
+                       fallthrough;
                case XDP_ABORTED:
                        trace_xdp_exception(vi->dev, xdp_prog, act);
                case XDP_DROP:
@@ -922,10 +922,10 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
                        goto xdp_xmit;
                default:
                        bpf_warn_invalid_xdp_action(act);
-                       /* fall through */
+                       fallthrough;
                case XDP_ABORTED:
                        trace_xdp_exception(vi->dev, xdp_prog, act);
-                       /* fall through */
+                       fallthrough;
                case XDP_DROP:
                        if (unlikely(xdp_page != page))
                                __free_pages(xdp_page, 0);
index def27afa1c69fa2dffad1466894ccb5c00721725..1014693a5ceb232a8674de096676beaedbec250f 100644 (file)
@@ -743,7 +743,7 @@ vmxnet3_get_rss_hash_opts(struct vmxnet3_adapter *adapter,
        case ESP_V4_FLOW:
                if (rss_fields & VMXNET3_RSS_FIELDS_ESPIP4)
                        info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
-                       /* fallthrough */
+               fallthrough;
        case SCTP_V4_FLOW:
        case IPV4_FLOW:
                info->data |= RXH_IP_SRC | RXH_IP_DST;
index 386ed2aa31fd93e63072063cd3fb200b57b23d30..9b00708676cf7123e022445434aa8f9ebb0f9a05 100644 (file)
@@ -229,7 +229,7 @@ static void hdlc_setup_dev(struct net_device *dev)
        dev->min_mtu             = 68;
        dev->max_mtu             = HDLC_MAX_MTU;
        dev->type                = ARPHRD_RAWHDLC;
-       dev->hard_header_len     = 16;
+       dev->hard_header_len     = 0;
        dev->needed_headroom     = 0;
        dev->addr_len            = 0;
        dev->header_ops          = &hdlc_null_ops;
index d8cba3625c185d76b5fd47e97eeaa1ab4900065a..cb5898f7d68c9849e1c04839dede6186cacf32a5 100644 (file)
@@ -118,6 +118,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
        skb_put(skb, sizeof(struct cisco_packet));
        skb->priority = TC_PRIO_CONTROL;
        skb->dev = dev;
+       skb->protocol = htons(ETH_P_HDLC);
        skb_reset_network_header(skb);
 
        dev_queue_xmit(skb);
@@ -370,6 +371,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
                memcpy(&state(hdlc)->settings, &new_settings, size);
                spin_lock_init(&state(hdlc)->lock);
                dev->header_ops = &cisco_header_ops;
+               dev->hard_header_len = sizeof(struct hdlc_header);
                dev->type = ARPHRD_CISCO;
                call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev);
                netif_dormant_on(dev);
index 9acad651ea1f6e02f2a9956da58601900e0262c0..d6cfd51613ed8d9132c51e307f9f6ef589deb974 100644 (file)
@@ -433,6 +433,8 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev)
                        if (pvc->state.fecn) /* TX Congestion counter */
                                dev->stats.tx_compressed++;
                        skb->dev = pvc->frad;
+                       skb->protocol = htons(ETH_P_HDLC);
+                       skb_reset_network_header(skb);
                        dev_queue_xmit(skb);
                        return NETDEV_TX_OK;
                }
@@ -555,6 +557,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep)
        skb_put(skb, i);
        skb->priority = TC_PRIO_CONTROL;
        skb->dev = dev;
+       skb->protocol = htons(ETH_P_HDLC);
        skb_reset_network_header(skb);
 
        dev_queue_xmit(skb);
@@ -1041,7 +1044,7 @@ static void pvc_setup(struct net_device *dev)
 {
        dev->type = ARPHRD_DLCI;
        dev->flags = IFF_POINTOPOINT;
-       dev->hard_header_len = 10;
+       dev->hard_header_len = 0;
        dev->addr_len = 2;
        netif_keep_dst(dev);
 }
@@ -1093,6 +1096,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
        dev->mtu = HDLC_MAX_MTU;
        dev->min_mtu = 68;
        dev->max_mtu = HDLC_MAX_MTU;
+       dev->needed_headroom = 10;
        dev->priv_flags |= IFF_NO_QUEUE;
        dev->ml_priv = pvc;
 
index 48ced3912576c7227abb980029a5383c3742a457..64f855651336963eaa2401669f7c422d9e376ffd 100644 (file)
@@ -251,6 +251,7 @@ static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code,
 
        skb->priority = TC_PRIO_CONTROL;
        skb->dev = dev;
+       skb->protocol = htons(ETH_P_HDLC);
        skb_reset_network_header(skb);
        skb_queue_tail(&tx_queue, skb);
 }
@@ -383,11 +384,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id,
        }
 
        for (opt = data; len; len -= opt[1], opt += opt[1]) {
-               if (len < 2 || len < opt[1]) {
-                       dev->stats.rx_errors++;
-                       kfree(out);
-                       return; /* bad packet, drop silently */
-               }
+               if (len < 2 || opt[1] < 2 || len < opt[1])
+                       goto err_out;
 
                if (pid == PID_LCP)
                        switch (opt[0]) {
@@ -395,6 +393,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id,
                                continue; /* MRU always OK and > 1500 bytes? */
 
                        case LCP_OPTION_ACCM: /* async control character map */
+                               if (opt[1] < sizeof(valid_accm))
+                                       goto err_out;
                                if (!memcmp(opt, valid_accm,
                                            sizeof(valid_accm)))
                                        continue;
@@ -406,6 +406,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id,
                                }
                                break;
                        case LCP_OPTION_MAGIC:
+                               if (len < 6)
+                                       goto err_out;
                                if (opt[1] != 6 || (!opt[2] && !opt[3] &&
                                                    !opt[4] && !opt[5]))
                                        break; /* reject invalid magic number */
@@ -424,6 +426,11 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id,
                ppp_cp_event(dev, pid, RCR_GOOD, CP_CONF_ACK, id, req_len, data);
 
        kfree(out);
+       return;
+
+err_out:
+       dev->stats.rx_errors++;
+       kfree(out);
 }
 
 static int ppp_rx(struct sk_buff *skb)
index 1ea15f2123ed5cf7d2bbec3fba0a3eedf8129dfd..b6be2454b8bdd2ae7fef46bd3e2cc63081404954 100644 (file)
@@ -173,7 +173,7 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb,
        case X25_IFACE_DISCONNECT:
                if ((err = lapb_disconnect_request(dev)) != LAPB_OK)
                        pr_err("lapb_disconnect_request err: %d\n", err);
-               /* Fall thru */
+               fallthrough;
        default:
                goto drop;
        }
@@ -198,8 +198,6 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb)
        struct net_device *dev;
        int size = skb->len;
 
-       skb->protocol = htons(ETH_P_X25);
-
        ptr = skb_push(skb, 2);
 
        *ptr++ = size % 256;
@@ -210,6 +208,10 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb)
 
        skb->dev = dev = lapbeth->ethdev;
 
+       skb->protocol = htons(ETH_P_DEC);
+
+       skb_reset_network_header(skb);
+
        dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0);
 
        dev_queue_xmit(skb);
@@ -340,6 +342,7 @@ static int lapbeth_new_device(struct net_device *dev)
         */
        ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len
                                           + dev->needed_headroom;
+       ndev->needed_tailroom = dev->needed_tailroom;
 
        lapbeth = netdev_priv(ndev);
        lapbeth->axdev = ndev;
index 77ccf3672ede7db77071d0cba13ad49ba8f3e4b3..bc2c1c7fb1a45aa8cbc6fd39e592275efe88df39 100644 (file)
@@ -413,7 +413,7 @@ static void sdla_errors(struct net_device *dev, int cmd, int dlci, int ret, int
                case SDLA_RET_NO_BUFS:
                        if (cmd == SDLA_INFORMATION_WRITE)
                                break;
-                       /* Else, fall through */
+                       fallthrough;
 
                default: 
                        netdev_dbg(dev, "Cmd 0x%02X generated return code 0x%02X\n",
index de79844635958d000adce25ce617b10b94310a88..7ee980575208341b902d1e82285a26eb70e49d6b 100644 (file)
@@ -330,7 +330,7 @@ static netdev_tx_t x25_asy_xmit(struct sk_buff *skb,
                if (err != LAPB_OK)
                        netdev_err(dev, "lapb_disconnect_request error: %d\n",
                                   err);
-               /* fall through */
+               fallthrough;
        default:
                kfree_skb(skb);
                return NETDEV_TX_OK;
index 4fe7c7e132c496611ddd1410c169cf2886adbc8b..9afed3b133d3f231a14ee83afb4a4017feb0f4b7 100644 (file)
@@ -352,7 +352,7 @@ void i2400m_report_tlv_system_state(struct i2400m *i2400m,
 
        case I2400M_SS_IDLE:
                d_printf(1, dev, "entering BS-negotiated idle mode\n");
-               /* Fall through */
+               fallthrough;
        case I2400M_SS_DISCONNECTING:
        case I2400M_SS_DATA_PATH_CONNECTED:
                wimax_state_change(wimax_dev, WIMAX_ST_CONNECTED);
index 1f7709d24f3526a1498a9f5a2f85e79c71ab811f..27ab233650d538c6aff52a7d015c14a99b36a6d9 100644 (file)
@@ -135,7 +135,7 @@ retry:
                        msleep(10);     /* give the device some time */
                        goto retry;
                }
-               /* fall through */
+               fallthrough;
        case -EINVAL:                   /* while removing driver */
        case -ENODEV:                   /* dev disconnect ... */
        case -ENOENT:                   /* just ignore it */
index 3a0e7226768ade6ee33081ee04d6f90de734c2a2..3ba9d70cca1b439bd530f1b04f8ea13debda3b5d 100644 (file)
@@ -136,7 +136,7 @@ retry:
                        msleep(10);     /* give the device some time */
                        goto retry;
                }
-               /* fall through */
+               fallthrough;
        case -EINVAL:                   /* while removing driver */
        case -ENODEV:                   /* dev disconnect ... */
        case -ENOENT:                   /* just ignore it */
index 9659f9e1aaa64c8a5a993fe17868013f86d94523..b684e97ac976806354ce538506a0d77efbbb9ce6 100644 (file)
@@ -195,7 +195,7 @@ retry:
                        msleep(10);     /* give the device some time */
                        goto retry;
                }
-               /* fall through */
+               fallthrough;
        case -EINVAL:                   /* while removing driver */
        case -ENODEV:                   /* dev disconnect ... */
        case -ENOENT:                   /* just ignore it */
index 3dd3b76790d051f81cbec498071c0477fe3a7c64..c0cfd9b36c0b594ac5ea87dca04ca075fe3da1d2 100644 (file)
@@ -87,15 +87,12 @@ static void handshake_zero(struct noise_handshake *handshake)
 
 void wg_noise_handshake_clear(struct noise_handshake *handshake)
 {
+       down_write(&handshake->lock);
        wg_index_hashtable_remove(
                        handshake->entry.peer->device->index_hashtable,
                        &handshake->entry);
-       down_write(&handshake->lock);
        handshake_zero(handshake);
        up_write(&handshake->lock);
-       wg_index_hashtable_remove(
-                       handshake->entry.peer->device->index_hashtable,
-                       &handshake->entry);
 }
 
 static struct noise_keypair *keypair_create(struct wg_peer *peer)
index e4deb331476b3d67c1d24eb269b26f587798cbc2..f2783aa7a88f110d36790b5dd6bfb8e41a83e065 100644 (file)
@@ -167,9 +167,13 @@ bool wg_index_hashtable_replace(struct index_hashtable *table,
                                struct index_hashtable_entry *old,
                                struct index_hashtable_entry *new)
 {
-       if (unlikely(hlist_unhashed(&old->index_hash)))
-               return false;
+       bool ret;
+
        spin_lock_bh(&table->lock);
+       ret = !hlist_unhashed(&old->index_hash);
+       if (unlikely(!ret))
+               goto out;
+
        new->index = old->index;
        hlist_replace_rcu(&old->index_hash, &new->index_hash);
 
@@ -180,8 +184,9 @@ bool wg_index_hashtable_replace(struct index_hashtable *table,
         * simply gets dropped, which isn't terrible.
         */
        INIT_HLIST_NODE(&old->index_hash);
+out:
        spin_unlock_bh(&table->lock);
-       return true;
+       return ret;
 }
 
 void wg_index_hashtable_remove(struct index_hashtable *table,
index e8712ad3ac45c46b29740cb4482eb78aba8075a8..3c07d1bbe1c6e9a5c4841ea83f6f47cb387505cb 100644 (file)
@@ -664,9 +664,15 @@ static void pkt_align(struct sk_buff *p, int len, int align)
 /* To check if there's window offered */
 static bool data_ok(struct brcmf_sdio *bus)
 {
-       /* Reserve TXCTL_CREDITS credits for txctl */
-       return (bus->tx_max - bus->tx_seq) > TXCTL_CREDITS &&
-              ((bus->tx_max - bus->tx_seq) & 0x80) == 0;
+       u8 tx_rsv = 0;
+
+       /* Reserve TXCTL_CREDITS credits for txctl when it is ready to send */
+       if (bus->ctrl_frame_stat)
+               tx_rsv = TXCTL_CREDITS;
+
+       return (bus->tx_max - bus->tx_seq - tx_rsv) != 0 &&
+              ((bus->tx_max - bus->tx_seq - tx_rsv) & 0x80) == 0;
+
 }
 
 /* To check if there's window offered */
index 8047e307892e369710a1071d0324b870010082b5..d9f8bdbc817b23f2a9d99f4cf784ac53497e5cd1 100644 (file)
@@ -954,7 +954,7 @@ struct mwifiex_tkip_param {
 struct mwifiex_aes_param {
        u8 pn[WPA_PN_SIZE];
        __le16 key_len;
-       u8 key[WLAN_KEY_LEN_CCMP];
+       u8 key[WLAN_KEY_LEN_CCMP_256];
 } __packed;
 
 struct mwifiex_wapi_param {
index 962d8bfe6f1014e4ad8938c0f757b0a97a16ff34..119ccacd1fcc4ea69e4cb5971f016dc879fc38d1 100644 (file)
@@ -619,7 +619,7 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,
        key_v2 = &resp->params.key_material_v2;
 
        len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len);
-       if (len > WLAN_KEY_LEN_CCMP)
+       if (len > sizeof(key_v2->key_param_set.key_params.aes.key))
                return -EINVAL;
 
        if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) {
@@ -635,7 +635,7 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,
                return 0;
 
        memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0,
-              WLAN_KEY_LEN_CCMP);
+              sizeof(key_v2->key_param_set.key_params.aes.key));
        priv->aes_key_v2.key_param_set.key_params.aes.key_len =
                                cpu_to_le16(len);
        memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key,
index d0cbb283982f2bf627dc6c5a58196188a738da8a..bd316dbd9041dfb7e930a4c9789e78dc4628e80b 100644 (file)
@@ -2128,7 +2128,8 @@ static int mt7615_load_n9(struct mt7615_dev *dev, const char *name)
                 sizeof(dev->mt76.hw->wiphy->fw_version),
                 "%.10s-%.15s", hdr->fw_ver, hdr->build_date);
 
-       if (!strncmp(hdr->fw_ver, "2.0", sizeof(hdr->fw_ver))) {
+       if (!is_mt7615(&dev->mt76) &&
+           !strncmp(hdr->fw_ver, "2.0", sizeof(hdr->fw_ver))) {
                dev->fw_ver = MT7615_FIRMWARE_V2;
                dev->mcu_ops = &sta_update_ops;
        } else {
index e90d0087e377c16791a653aa10250ea3087ab8df..8d6ceb3b67b45f0b68e27db7f8b0803f37e9830a 100644 (file)
@@ -699,8 +699,12 @@ void mt7915_unregister_device(struct mt7915_dev *dev)
        spin_lock_bh(&dev->token_lock);
        idr_for_each_entry(&dev->token, txwi, id) {
                mt7915_txp_skb_unmap(&dev->mt76, txwi);
-               if (txwi->skb)
-                       dev_kfree_skb_any(txwi->skb);
+               if (txwi->skb) {
+                       struct ieee80211_hw *hw;
+
+                       hw = mt76_tx_status_get_hw(&dev->mt76, txwi->skb);
+                       ieee80211_free_txskb(hw, txwi->skb);
+               }
                mt76_put_txwi(&dev->mt76, txwi);
        }
        spin_unlock_bh(&dev->token_lock);
index 6825afca1efb04144c37c89cbd421cd777bec298..036207f828f390fe1981d61af70be8b7efbe0bcd 100644 (file)
@@ -841,7 +841,7 @@ mt7915_tx_complete_status(struct mt76_dev *mdev, struct sk_buff *skb,
        if (sta || !(info->flags & IEEE80211_TX_CTL_NO_ACK))
                mt7915_tx_status(sta, hw, info, NULL);
 
-       dev_kfree_skb(skb);
+       ieee80211_free_txskb(hw, skb);
 }
 
 void mt7915_txp_skb_unmap(struct mt76_dev *dev,
index 9acd8a41ea61f23e4556b0ffddb2406342db5bf9..f2609d5b6bf717f9d1600d9256058b43f84158b8 100644 (file)
@@ -458,7 +458,6 @@ enum wl1271_cmd_key_type {
        KEY_TKIP = 2,
        KEY_AES  = 3,
        KEY_GEM  = 4,
-       KEY_IGTK  = 5,
 };
 
 struct wl1271_cmd_set_keys {
index 821ad1acd505993df51a73125976890187ce2cb7..d2bbd5108f7e4f3c9c56aba75b7e39a982f2319e 100644 (file)
@@ -3559,9 +3559,6 @@ int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd,
        case WL1271_CIPHER_SUITE_GEM:
                key_type = KEY_GEM;
                break;
-       case WLAN_CIPHER_SUITE_AES_CMAC:
-               key_type = KEY_IGTK;
-               break;
        default:
                wl1271_error("Unknown key algo 0x%x", key_conf->cipher);
 
@@ -6231,7 +6228,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
                WLAN_CIPHER_SUITE_TKIP,
                WLAN_CIPHER_SUITE_CCMP,
                WL1271_CIPHER_SUITE_GEM,
-               WLAN_CIPHER_SUITE_AES_CMAC,
        };
 
        /* The tx descriptor buffer */
index 6b7532f7c936d9aee02814b443a12fd24c5c718f..ff96f22648efdeaa3bbac353f1b84c3883a01948 100644 (file)
@@ -393,7 +393,7 @@ void xenvif_dump_hash_info(struct xenvif *vif, struct seq_file *m)
 
        case XEN_NETIF_CTRL_HASH_ALGORITHM_NONE:
                seq_puts(m, "Hash Algorithm: NONE\n");
-               /* FALLTHRU */
+               fallthrough;
        default:
                return;
        }
index 7e62a6ee76223bea8c8eccb2298fc659ba6af2ee..f1c1624cec8f5dffe6f57a3486187f9c4667dc5c 100644 (file)
@@ -448,7 +448,7 @@ static void frontend_changed(struct xenbus_device *dev,
                set_backend_state(be, XenbusStateClosed);
                if (xenbus_dev_is_online(dev))
                        break;
-               /* fall through - if not online */
+               fallthrough;    /* if not online */
        case XenbusStateUnknown:
                set_backend_state(be, XenbusStateClosed);
                device_unregister(&dev->dev);
index 458be6882b98869c36c7a6cd2f0440c4404d0f24..3e9895bec15f08c2239aad442f7e5659c4cb23a8 100644 (file)
@@ -2341,7 +2341,7 @@ static void netback_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* Fall through - Missed the backend's CLOSING state. */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 346e084387f7d125a48df07ade33ef0689f69239..f7464bd6d57cb2dbc9ef603f3a833ce8b3a344fb 100644 (file)
@@ -2321,7 +2321,7 @@ static int pn533_transceive(struct nfc_dev *nfc_dev,
 
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                /* jumbo frame ? */
                if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) {
@@ -2448,7 +2448,7 @@ static void pn533_wq_mi_recv(struct work_struct *work)
 
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                skb_put_u8(skb, 1); /*TG*/
 
index 0b9ca6d20ffadc48e36d15185f2272f23f6024fd..8874d605b14f8d824ad36bc5e2035f2226e21ee4 100644 (file)
@@ -611,7 +611,7 @@ static void st21nfca_im_recv_dep_res_cb(void *context, struct sk_buff *skb,
                switch (ST21NFCA_NFC_DEP_PFB_TYPE(dep_res->pfb)) {
                case ST21NFCA_NFC_DEP_PFB_ACK_NACK_PDU:
                        pr_err("Received a ACK/NACK PDU\n");
-                       /* fall through */
+                       fallthrough;
                case ST21NFCA_NFC_DEP_PFB_I_PDU:
                        info->dep_info.curr_nfc_dep_pni =
                            ST21NFCA_NFC_DEP_PFB_PNI(dep_res->pfb + 1);
index 9642971e89ceae99733f18bbef78911a578fcd67..4578547659839983dfbbe9491374b641a1d36880 100644 (file)
@@ -966,7 +966,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
        rc = down_killable(&stcontext->exchange_lock);
        if (rc) {
                WARN(1, "Semaphore is not found up in st95hf_in_send_cmd\n");
-               return rc;
+               goto free_skb_resp;
        }
 
        rc = st95hf_spi_send(&stcontext->spicontext, skb->data,
index e46adaac1c6350fd0d308f38fb3aa787b06a20b5..3bd97c73f983f2478dcaa3f06289a6d3fa269c03 100644 (file)
@@ -1153,7 +1153,7 @@ static int trf7970a_switch_rf(struct nfc_digital_dev *ddev, bool on)
                        dev_err(trf->dev, "%s - Invalid request: %d %d\n",
                                __func__, trf->state, on);
                        ret = -EINVAL;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case TRF7970A_ST_IDLE:
                case TRF7970A_ST_IDLE_RX_BLOCKED:
                case TRF7970A_ST_WAIT_FOR_RX_DATA:
@@ -1960,7 +1960,7 @@ static void trf7970a_shutdown(struct trf7970a *trf)
        case TRF7970A_ST_WAIT_TO_ISSUE_EOF:
        case TRF7970A_ST_LISTENING:
                trf7970a_send_err_upstream(trf, -ECANCELED);
-               /* FALLTHROUGH */
+               fallthrough;
        case TRF7970A_ST_IDLE:
        case TRF7970A_ST_IDLE_RX_BLOCKED:
                trf7970a_switch_rf_off(trf);
index e6d1f5b298f34083217a66873b7acc283d1060c2..4a02561cfb965726c2fe2d73c9934f10adcbfb20 100644 (file)
@@ -1483,7 +1483,7 @@ static void ntb_rx_copy_callback(void *data,
                case DMA_TRANS_READ_FAILED:
                case DMA_TRANS_WRITE_FAILED:
                        entry->errors++;
-                       /* fall through */
+                       fallthrough;
                case DMA_TRANS_ABORTED:
                {
                        struct ntb_transport_qp *qp = entry->qp;
@@ -1739,7 +1739,7 @@ static void ntb_tx_copy_callback(void *data,
                case DMA_TRANS_READ_FAILED:
                case DMA_TRANS_WRITE_FAILED:
                        entry->errors++;
-                       /* fall through */
+                       fallthrough;
                case DMA_TRANS_ABORTED:
                {
                        void __iomem *offset =
index 61374def515552f40ef6af782096652cdfe2a69d..b59032e0859b7f3a3fa50731ee8efff9c1fc5c8a 100644 (file)
@@ -529,6 +529,7 @@ static DEVICE_ATTR_ADMIN_RW(activate);
 static struct attribute *nvdimm_firmware_attributes[] = {
        &dev_attr_activate.attr,
        &dev_attr_result.attr,
+       NULL,
 };
 
 static umode_t nvdimm_firmware_visible(struct kobject *kobj, struct attribute *a, int n)
index 3ed9786b88d8edf2859967ba2fb7018ee67ba41d..a44d49d63968a45a4c29f89ac9c7dadcb8890961 100644 (file)
@@ -73,6 +73,7 @@ config NVME_TCP
        depends on INET
        depends on BLK_DEV_NVME
        select NVME_FABRICS
+       select CRYPTO
        select CRYPTO_CRC32C
        help
          This provides support for the NVMe over Fabrics protocol using
index 88cff309d8e4f06a18661f8c10f8ff318a835834..8f9d61e0729fb92a3bc825459be6eeaee0c0c0a0 100644 (file)
@@ -241,17 +241,6 @@ static blk_status_t nvme_error_status(u16 status)
        }
 }
 
-static inline bool nvme_req_needs_retry(struct request *req)
-{
-       if (blk_noretry_request(req))
-               return false;
-       if (nvme_req(req)->status & NVME_SC_DNR)
-               return false;
-       if (nvme_req(req)->retries >= nvme_max_retries)
-               return false;
-       return true;
-}
-
 static void nvme_retry_req(struct request *req)
 {
        struct nvme_ns *ns = req->q->queuedata;
@@ -268,34 +257,67 @@ static void nvme_retry_req(struct request *req)
        blk_mq_delay_kick_requeue_list(req->q, delay);
 }
 
-void nvme_complete_rq(struct request *req)
+enum nvme_disposition {
+       COMPLETE,
+       RETRY,
+       FAILOVER,
+};
+
+static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
 {
-       blk_status_t status = nvme_error_status(nvme_req(req)->status);
+       if (likely(nvme_req(req)->status == 0))
+               return COMPLETE;
 
-       trace_nvme_complete_rq(req);
+       if (blk_noretry_request(req) ||
+           (nvme_req(req)->status & NVME_SC_DNR) ||
+           nvme_req(req)->retries >= nvme_max_retries)
+               return COMPLETE;
 
-       nvme_cleanup_cmd(req);
+       if (req->cmd_flags & REQ_NVME_MPATH) {
+               if (nvme_is_path_error(nvme_req(req)->status) ||
+                   blk_queue_dying(req->q))
+                       return FAILOVER;
+       } else {
+               if (blk_queue_dying(req->q))
+                       return COMPLETE;
+       }
 
-       if (nvme_req(req)->ctrl->kas)
-               nvme_req(req)->ctrl->comp_seen = true;
+       return RETRY;
+}
 
-       if (unlikely(status != BLK_STS_OK && nvme_req_needs_retry(req))) {
-               if ((req->cmd_flags & REQ_NVME_MPATH) && nvme_failover_req(req))
-                       return;
+static inline void nvme_end_req(struct request *req)
+{
+       blk_status_t status = nvme_error_status(nvme_req(req)->status);
 
-               if (!blk_queue_dying(req->q)) {
-                       nvme_retry_req(req);
-                       return;
-               }
-       } else if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
-                  req_op(req) == REQ_OP_ZONE_APPEND) {
+       if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
+           req_op(req) == REQ_OP_ZONE_APPEND)
                req->__sector = nvme_lba_to_sect(req->q->queuedata,
                        le64_to_cpu(nvme_req(req)->result.u64));
-       }
 
        nvme_trace_bio_complete(req, status);
        blk_mq_end_request(req, status);
 }
+
+void nvme_complete_rq(struct request *req)
+{
+       trace_nvme_complete_rq(req);
+       nvme_cleanup_cmd(req);
+
+       if (nvme_req(req)->ctrl->kas)
+               nvme_req(req)->ctrl->comp_seen = true;
+
+       switch (nvme_decide_disposition(req)) {
+       case COMPLETE:
+               nvme_end_req(req);
+               return;
+       case RETRY:
+               nvme_retry_req(req);
+               return;
+       case FAILOVER:
+               nvme_failover_req(req);
+               return;
+       }
+}
 EXPORT_SYMBOL_GPL(nvme_complete_rq);
 
 bool nvme_cancel_request(struct request *req, void *data, bool reserved)
@@ -330,7 +352,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_RESETTING:
                case NVME_CTRL_CONNECTING:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -340,7 +362,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_NEW:
                case NVME_CTRL_LIVE:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -350,7 +372,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_NEW:
                case NVME_CTRL_RESETTING:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -361,7 +383,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_RESETTING:
                case NVME_CTRL_CONNECTING:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -371,7 +393,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                case NVME_CTRL_DELETING:
                case NVME_CTRL_DEAD:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -380,7 +402,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                switch (old_state) {
                case NVME_CTRL_DELETING:
                        changed = true;
-                       /* FALLTHRU */
+                       fallthrough;
                default:
                        break;
                }
@@ -2004,13 +2026,49 @@ static void nvme_update_disk_info(struct gendisk *disk,
        blk_mq_unfreeze_queue(disk->queue);
 }
 
+static inline bool nvme_first_scan(struct gendisk *disk)
+{
+       /* nvme_alloc_ns() scans the disk prior to adding it */
+       return !(disk->flags & GENHD_FL_UP);
+}
+
+static void nvme_set_chunk_sectors(struct nvme_ns *ns, struct nvme_id_ns *id)
+{
+       struct nvme_ctrl *ctrl = ns->ctrl;
+       u32 iob;
+
+       if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) &&
+           is_power_of_2(ctrl->max_hw_sectors))
+               iob = ctrl->max_hw_sectors;
+       else
+               iob = nvme_lba_to_sect(ns, le16_to_cpu(id->noiob));
+
+       if (!iob)
+               return;
+
+       if (!is_power_of_2(iob)) {
+               if (nvme_first_scan(ns->disk))
+                       pr_warn("%s: ignoring unaligned IO boundary:%u\n",
+                               ns->disk->disk_name, iob);
+               return;
+       }
+
+       if (blk_queue_is_zoned(ns->disk->queue)) {
+               if (nvme_first_scan(ns->disk))
+                       pr_warn("%s: ignoring zoned namespace IO boundary\n",
+                               ns->disk->disk_name);
+               return;
+       }
+
+       blk_queue_chunk_sectors(ns->queue, iob);
+}
+
 static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
 {
        unsigned lbaf = id->flbas & NVME_NS_FLBAS_LBA_MASK;
        struct nvme_ns *ns = disk->private_data;
        struct nvme_ctrl *ctrl = ns->ctrl;
        int ret;
-       u32 iob;
 
        /*
         * If identify namespace failed, use default 512 byte block size so
@@ -2038,12 +2096,6 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
                return -ENODEV;
        }
 
-       if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) &&
-           is_power_of_2(ctrl->max_hw_sectors))
-               iob = ctrl->max_hw_sectors;
-       else
-               iob = nvme_lba_to_sect(ns, le16_to_cpu(id->noiob));
-
        ns->features = 0;
        ns->ms = le16_to_cpu(id->lbaf[lbaf].ms);
        /* the PI implementation requires metadata equal t10 pi tuple size */
@@ -2075,8 +2127,7 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
                }
        }
 
-       if (iob)
-               blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(iob));
+       nvme_set_chunk_sectors(ns, id);
        nvme_update_disk_info(disk, ns, id);
 #ifdef CONFIG_NVME_MULTIPATH
        if (ns->head->disk) {
@@ -2965,14 +3016,14 @@ static struct nvme_cel *nvme_find_cel(struct nvme_ctrl *ctrl, u8 csi)
 {
        struct nvme_cel *cel, *ret = NULL;
 
-       spin_lock(&ctrl->lock);
+       spin_lock_irq(&ctrl->lock);
        list_for_each_entry(cel, &ctrl->cels, entry) {
                if (cel->csi == csi) {
                        ret = cel;
                        break;
                }
        }
-       spin_unlock(&ctrl->lock);
+       spin_unlock_irq(&ctrl->lock);
 
        return ret;
 }
@@ -2990,7 +3041,7 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi,
        if (!cel)
                return -ENOMEM;
 
-       ret = nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_CMD_EFFECTS, 0, csi,
+       ret = nvme_get_log(ctrl, 0x00, NVME_LOG_CMD_EFFECTS, 0, csi,
                        &cel->log, sizeof(cel->log), 0);
        if (ret) {
                kfree(cel);
@@ -2999,9 +3050,9 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi,
 
        cel->csi = csi;
 
-       spin_lock(&ctrl->lock);
+       spin_lock_irq(&ctrl->lock);
        list_add_tail(&cel->entry, &ctrl->cels);
-       spin_unlock(&ctrl->lock);
+       spin_unlock_irq(&ctrl->lock);
 out:
        *log = &cel->log;
        return 0;
@@ -3185,8 +3236,11 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
        if (ret < 0)
                return ret;
 
-       if (!ctrl->identified)
-               nvme_hwmon_init(ctrl);
+       if (!ctrl->identified) {
+               ret = nvme_hwmon_init(ctrl);
+               if (ret < 0)
+                       return ret;
+       }
 
        ctrl->identified = true;
 
@@ -3210,10 +3264,24 @@ static int nvme_dev_open(struct inode *inode, struct file *file)
                return -EWOULDBLOCK;
        }
 
+       nvme_get_ctrl(ctrl);
+       if (!try_module_get(ctrl->ops->module))
+               return -EINVAL;
+
        file->private_data = ctrl;
        return 0;
 }
 
+static int nvme_dev_release(struct inode *inode, struct file *file)
+{
+       struct nvme_ctrl *ctrl =
+               container_of(inode->i_cdev, struct nvme_ctrl, cdev);
+
+       module_put(ctrl->ops->module);
+       nvme_put_ctrl(ctrl);
+       return 0;
+}
+
 static int nvme_dev_user_cmd(struct nvme_ctrl *ctrl, void __user *argp)
 {
        struct nvme_ns *ns;
@@ -3276,6 +3344,7 @@ static long nvme_dev_ioctl(struct file *file, unsigned int cmd,
 static const struct file_operations nvme_dev_fops = {
        .owner          = THIS_MODULE,
        .open           = nvme_dev_open,
+       .release        = nvme_dev_release,
        .unlocked_ioctl = nvme_dev_ioctl,
        .compat_ioctl   = compat_ptr_ioctl,
 };
@@ -3474,10 +3543,6 @@ static ssize_t nvme_sysfs_delete(struct device *dev,
 {
        struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
 
-       /* Can't delete non-created controllers */
-       if (!ctrl->created)
-               return -EBUSY;
-
        if (device_remove_file_self(dev, attr))
                nvme_delete_ctrl_sync(ctrl);
        return count;
@@ -3654,6 +3719,10 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
                return 0;
        if (a == &dev_attr_hostid.attr && !ctrl->opts)
                return 0;
+       if (a == &dev_attr_ctrl_loss_tmo.attr && !ctrl->opts)
+               return 0;
+       if (a == &dev_attr_reconnect_delay.attr && !ctrl->opts)
+               return 0;
 
        return a->mode;
 }
@@ -4348,7 +4417,6 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
                nvme_queue_scan(ctrl);
                nvme_start_queues(ctrl);
        }
-       ctrl->created = true;
 }
 EXPORT_SYMBOL_GPL(nvme_start_ctrl);
 
@@ -4368,7 +4436,7 @@ static void nvme_free_ctrl(struct device *dev)
        struct nvme_subsystem *subsys = ctrl->subsys;
        struct nvme_cel *cel, *next;
 
-       if (subsys && ctrl->instance != subsys->instance)
+       if (!subsys || ctrl->instance != subsys->instance)
                ida_simple_remove(&nvme_instance_ida, ctrl->instance);
 
        list_for_each_entry_safe(cel, next, &ctrl->cels, entry) {
@@ -4512,7 +4580,7 @@ void nvme_unfreeze(struct nvme_ctrl *ctrl)
 }
 EXPORT_SYMBOL_GPL(nvme_unfreeze);
 
-void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
+int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
 {
        struct nvme_ns *ns;
 
@@ -4523,6 +4591,7 @@ void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
                        break;
        }
        up_read(&ctrl->namespaces_rwsem);
+       return timeout;
 }
 EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout);
 
index 4ec4829d62334bf042f1e96d2f001b104dcf4248..8575724734e02e5883f946d54cea6324a605fabf 100644 (file)
@@ -565,10 +565,14 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
        struct nvme_request *req = nvme_req(rq);
 
        /*
-        * If we are in some state of setup or teardown only allow
-        * internally generated commands.
+        * currently we have a problem sending passthru commands
+        * on the admin_q if the controller is not LIVE because we can't
+        * make sure that they are going out after the admin connect,
+        * controller enable and/or other commands in the initialization
+        * sequence. until the controller will be LIVE, fail with
+        * BLK_STS_RESOURCE so that they will be rescheduled.
         */
-       if (!blk_rq_is_passthrough(rq) || (req->flags & NVME_REQ_USERCMD))
+       if (rq->q == ctrl->admin_q && (req->flags & NVME_REQ_USERCMD))
                return false;
 
        /*
@@ -576,9 +580,8 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
         * which is require to set the queue live in the appropinquate states.
         */
        switch (ctrl->state) {
-       case NVME_CTRL_NEW:
        case NVME_CTRL_CONNECTING:
-               if (nvme_is_fabrics(req->cmd) &&
+               if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) &&
                    req->cmd->fabrics.fctype == nvme_fabrics_type_connect)
                        return true;
                break;
index eae43bb444e03888c6c149874cab431c6e724763..e2e09e25c05662bfc1612525594b0b40e05d6551 100644 (file)
@@ -2035,7 +2035,7 @@ done:
        }
 
        __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
-       if (!nvme_end_request(rq, status, result))
+       if (!nvme_try_complete_req(rq, status, result))
                nvme_fc_complete_rq(rq);
 
 check_error:
@@ -2078,7 +2078,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl,
        if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.cmddma)) {
                dev_err(ctrl->dev,
                        "FCP Op failed - cmdiu dma mapping failed.\n");
-               ret = EFAULT;
+               ret = -EFAULT;
                goto out_on_error;
        }
 
@@ -2088,7 +2088,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl,
        if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.rspdma)) {
                dev_err(ctrl->dev,
                        "FCP Op failed - rspiu dma mapping failed.\n");
-               ret = EFAULT;
+               ret = -EFAULT;
        }
 
        atomic_set(&op->state, FCPOP_STATE_IDLE);
@@ -2160,6 +2160,7 @@ nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl)
        struct nvme_fc_fcp_op *aen_op;
        int i;
 
+       cancel_work_sync(&ctrl->ctrl.async_event_work);
        aen_op = ctrl->aen_ops;
        for (i = 0; i < NVME_NR_AEN_COMMANDS; i++, aen_op++) {
                __nvme_fc_exit_request(ctrl, aen_op);
@@ -3670,12 +3671,14 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
        spin_lock_irqsave(&nvme_fc_lock, flags);
        list_for_each_entry(lport, &nvme_fc_lport_list, port_list) {
                if (lport->localport.node_name != laddr.nn ||
-                   lport->localport.port_name != laddr.pn)
+                   lport->localport.port_name != laddr.pn ||
+                   lport->localport.port_state != FC_OBJSTATE_ONLINE)
                        continue;
 
                list_for_each_entry(rport, &lport->endp_list, endp_list) {
                        if (rport->remoteport.node_name != raddr.nn ||
-                           rport->remoteport.port_name != raddr.pn)
+                           rport->remoteport.port_name != raddr.pn ||
+                           rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
                                continue;
 
                        /* if fail to get reference fall through. Will error */
index 412a6c97c0d87a22f9bf8298f8967ee3bbf15095..552dbc04567bcbf5a2ca26b935d0f771187e8506 100644 (file)
@@ -59,12 +59,8 @@ static int nvme_set_temp_thresh(struct nvme_ctrl *ctrl, int sensor, bool under,
 
 static int nvme_hwmon_get_smart_log(struct nvme_hwmon_data *data)
 {
-       int ret;
-
-       ret = nvme_get_log(data->ctrl, NVME_NSID_ALL, NVME_LOG_SMART, 0,
+       return nvme_get_log(data->ctrl, NVME_NSID_ALL, NVME_LOG_SMART, 0,
                           NVME_CSI_NVM, &data->log, sizeof(data->log), 0);
-
-       return ret <= 0 ? ret : -EIO;
 }
 
 static int nvme_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
@@ -225,7 +221,7 @@ static const struct hwmon_chip_info nvme_hwmon_chip_info = {
        .info   = nvme_hwmon_info,
 };
 
-void nvme_hwmon_init(struct nvme_ctrl *ctrl)
+int nvme_hwmon_init(struct nvme_ctrl *ctrl)
 {
        struct device *dev = ctrl->dev;
        struct nvme_hwmon_data *data;
@@ -234,7 +230,7 @@ void nvme_hwmon_init(struct nvme_ctrl *ctrl)
 
        data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
        if (!data)
-               return;
+               return 0;
 
        data->ctrl = ctrl;
        mutex_init(&data->read_lock);
@@ -244,7 +240,7 @@ void nvme_hwmon_init(struct nvme_ctrl *ctrl)
                dev_warn(ctrl->device,
                        "Failed to read smart log (error %d)\n", err);
                devm_kfree(dev, data);
-               return;
+               return err;
        }
 
        hwmon = devm_hwmon_device_register_with_info(dev, "nvme", data,
@@ -254,4 +250,6 @@ void nvme_hwmon_init(struct nvme_ctrl *ctrl)
                dev_warn(dev, "Failed to instantiate hwmon device\n");
                devm_kfree(dev, data);
        }
+
+       return 0;
 }
index 3ded54d2c9c6ad41063d74ecb0ba6559d0e61c01..d4ba736c6c8905cda938db0d15ea4b540e50ccf0 100644 (file)
@@ -65,51 +65,30 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
        }
 }
 
-bool nvme_failover_req(struct request *req)
+void nvme_failover_req(struct request *req)
 {
        struct nvme_ns *ns = req->q->queuedata;
-       u16 status = nvme_req(req)->status;
+       u16 status = nvme_req(req)->status & 0x7ff;
        unsigned long flags;
 
-       switch (status & 0x7ff) {
-       case NVME_SC_ANA_TRANSITION:
-       case NVME_SC_ANA_INACCESSIBLE:
-       case NVME_SC_ANA_PERSISTENT_LOSS:
-               /*
-                * If we got back an ANA error we know the controller is alive,
-                * but not ready to serve this namespaces.  The spec suggests
-                * we should update our general state here, but due to the fact
-                * that the admin and I/O queues are not serialized that is
-                * fundamentally racy.  So instead just clear the current path,
-                * mark the the path as pending and kick of a re-read of the ANA
-                * log page ASAP.
-                */
-               nvme_mpath_clear_current_path(ns);
-               if (ns->ctrl->ana_log_buf) {
-                       set_bit(NVME_NS_ANA_PENDING, &ns->flags);
-                       queue_work(nvme_wq, &ns->ctrl->ana_work);
-               }
-               break;
-       case NVME_SC_HOST_PATH_ERROR:
-       case NVME_SC_HOST_ABORTED_CMD:
-               /*
-                * Temporary transport disruption in talking to the controller.
-                * Try to send on a new path.
-                */
-               nvme_mpath_clear_current_path(ns);
-               break;
-       default:
-               /* This was a non-ANA error so follow the normal error path. */
-               return false;
+       nvme_mpath_clear_current_path(ns);
+
+       /*
+        * If we got back an ANA error, we know the controller is alive but not
+        * ready to serve this namespace.  Kick of a re-read of the ANA
+        * information page, and just try any other available path for now.
+        */
+       if (nvme_is_ana_error(status) && ns->ctrl->ana_log_buf) {
+               set_bit(NVME_NS_ANA_PENDING, &ns->flags);
+               queue_work(nvme_wq, &ns->ctrl->ana_work);
        }
 
        spin_lock_irqsave(&ns->head->requeue_lock, flags);
        blk_steal_bios(&ns->head->requeue_list, req);
        spin_unlock_irqrestore(&ns->head->requeue_lock, flags);
-       blk_mq_end_request(req, 0);
 
+       blk_mq_end_request(req, 0);
        kblockd_schedule_work(&ns->head->requeue_work);
-       return true;
 }
 
 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
@@ -233,7 +212,7 @@ static struct nvme_ns *nvme_next_ns(struct nvme_ns_head *head,
 static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
                int node, struct nvme_ns *old)
 {
-       struct nvme_ns *ns, *found, *fallback = NULL;
+       struct nvme_ns *ns, *found = NULL;
 
        if (list_is_singular(&head->list)) {
                if (nvme_path_is_disabled(old))
@@ -252,18 +231,22 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
                        goto out;
                }
                if (ns->ana_state == NVME_ANA_NONOPTIMIZED)
-                       fallback = ns;
+                       found = ns;
        }
 
-       /* No optimized path found, re-check the current path */
+       /*
+        * The loop above skips the current path for round-robin semantics.
+        * Fall back to the current path if either:
+        *  - no other optimized path found and current is optimized,
+        *  - no other usable path found and current is usable.
+        */
        if (!nvme_path_is_disabled(old) &&
-           old->ana_state == NVME_ANA_OPTIMIZED) {
-               found = old;
-               goto out;
-       }
-       if (!fallback)
+           (old->ana_state == NVME_ANA_OPTIMIZED ||
+            (!found && old->ana_state == NVME_ANA_NONOPTIMIZED)))
+               return old;
+
+       if (!found)
                return NULL;
-       found = fallback;
 out:
        rcu_assign_pointer(head->current_path[node], found);
        return found;
index ebb8c3ed388554e4b2717e6ba6b6f7c7df328ba4..2aaedfa43ed86c45886c2748576423bfd6720467 100644 (file)
@@ -307,7 +307,6 @@ struct nvme_ctrl {
        struct nvme_command ka_cmd;
        struct work_struct fw_act_work;
        unsigned long events;
-       bool created;
 
 #ifdef CONFIG_NVME_MULTIPATH
        /* asymmetric namespace access: */
@@ -523,7 +522,31 @@ static inline u32 nvme_bytes_to_numd(size_t len)
        return (len >> 2) - 1;
 }
 
-static inline bool nvme_end_request(struct request *req, __le16 status,
+static inline bool nvme_is_ana_error(u16 status)
+{
+       switch (status & 0x7ff) {
+       case NVME_SC_ANA_TRANSITION:
+       case NVME_SC_ANA_INACCESSIBLE:
+       case NVME_SC_ANA_PERSISTENT_LOSS:
+               return true;
+       default:
+               return false;
+       }
+}
+
+static inline bool nvme_is_path_error(u16 status)
+{
+       /* check for a status code type of 'path related status' */
+       return (status & 0x700) == 0x300;
+}
+
+/*
+ * Fill in the status and result information from the CQE, and then figure out
+ * if blk-mq will need to use IPI magic to complete the request, and if yes do
+ * so.  If not let the caller complete the request without an indirect function
+ * call.
+ */
+static inline bool nvme_try_complete_req(struct request *req, __le16 status,
                union nvme_result result)
 {
        struct nvme_request *rq = nvme_req(req);
@@ -581,7 +604,7 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl);
 void nvme_sync_queues(struct nvme_ctrl *ctrl);
 void nvme_unfreeze(struct nvme_ctrl *ctrl);
 void nvme_wait_freeze(struct nvme_ctrl *ctrl);
-void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
+int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
 void nvme_start_freeze(struct nvme_ctrl *ctrl);
 
 #define NVME_QID_ANY -1
@@ -629,7 +652,7 @@ void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys);
 void nvme_mpath_start_freeze(struct nvme_subsystem *subsys);
 void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
                        struct nvme_ctrl *ctrl, int *flags);
-bool nvme_failover_req(struct request *req);
+void nvme_failover_req(struct request *req);
 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl);
 int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head);
 void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id);
@@ -688,9 +711,8 @@ static inline void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
        sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
 }
 
-static inline bool nvme_failover_req(struct request *req)
+static inline void nvme_failover_req(struct request *req)
 {
-       return false;
 }
 static inline void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
 {
@@ -805,9 +827,12 @@ static inline struct nvme_ns *nvme_get_ns_from_dev(struct device *dev)
 }
 
 #ifdef CONFIG_NVME_HWMON
-void nvme_hwmon_init(struct nvme_ctrl *ctrl);
+int nvme_hwmon_init(struct nvme_ctrl *ctrl);
 #else
-static inline void nvme_hwmon_init(struct nvme_ctrl *ctrl) { }
+static inline int nvme_hwmon_init(struct nvme_ctrl *ctrl)
+{
+       return 0;
+}
 #endif
 
 u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
index ba725ae47305ef618bdfadbd1d216bbb5ae36d85..8984796db0c8010484531f6dbf641ab24b95219c 100644 (file)
@@ -120,7 +120,7 @@ struct nvme_dev {
        unsigned max_qid;
        unsigned io_queues[HCTX_MAX_TYPES];
        unsigned int num_vecs;
-       u16 q_depth;
+       u32 q_depth;
        int io_sqes;
        u32 db_stride;
        void __iomem *bar;
@@ -157,13 +157,13 @@ struct nvme_dev {
 static int io_queue_depth_set(const char *val, const struct kernel_param *kp)
 {
        int ret;
-       u16 n;
+       u32 n;
 
-       ret = kstrtou16(val, 10, &n);
+       ret = kstrtou32(val, 10, &n);
        if (ret != 0 || n < 2)
                return -EINVAL;
 
-       return param_set_ushort(val, kp);
+       return param_set_uint(val, kp);
 }
 
 static inline unsigned int sq_idx(unsigned int qid, u32 stride)
@@ -195,7 +195,7 @@ struct nvme_queue {
        dma_addr_t sq_dma_addr;
        dma_addr_t cq_dma_addr;
        u32 __iomem *q_db;
-       u16 q_depth;
+       u32 q_depth;
        u16 cq_vector;
        u16 sq_tail;
        u16 cq_head;
@@ -940,13 +940,6 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
        struct nvme_completion *cqe = &nvmeq->cqes[idx];
        struct request *req;
 
-       if (unlikely(cqe->command_id >= nvmeq->q_depth)) {
-               dev_warn(nvmeq->dev->ctrl.device,
-                       "invalid id %d completed on queue %d\n",
-                       cqe->command_id, le16_to_cpu(cqe->sq_id));
-               return;
-       }
-
        /*
         * AEN requests are special as they don't time out and can
         * survive any kind of queue freeze and often don't respond to
@@ -960,8 +953,15 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
        }
 
        req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id);
+       if (unlikely(!req)) {
+               dev_warn(nvmeq->dev->ctrl.device,
+                       "invalid id %d completed on queue %d\n",
+                       cqe->command_id, le16_to_cpu(cqe->sq_id));
+               return;
+       }
+
        trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail);
-       if (!nvme_end_request(req, cqe->status, cqe->result))
+       if (!nvme_try_complete_req(req, cqe->status, cqe->result))
                nvme_pci_complete_rq(req);
 }
 
@@ -1244,13 +1244,13 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
        switch (dev->ctrl.state) {
        case NVME_CTRL_CONNECTING:
                nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING);
-               /* fall through */
+               fallthrough;
        case NVME_CTRL_DELETING:
                dev_warn_ratelimited(dev->ctrl.device,
                         "I/O %d QID %d timeout, disable controller\n",
                         req->tag, nvmeq->qid);
-               nvme_dev_disable(dev, true);
                nvme_req(req)->flags |= NVME_REQ_CANCELLED;
+               nvme_dev_disable(dev, true);
                return BLK_EH_DONE;
        case NVME_CTRL_RESETTING:
                return BLK_EH_RESET_TIMER;
@@ -1267,10 +1267,10 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
                dev_warn(dev->ctrl.device,
                         "I/O %d QID %d timeout, reset controller\n",
                         req->tag, nvmeq->qid);
+               nvme_req(req)->flags |= NVME_REQ_CANCELLED;
                nvme_dev_disable(dev, false);
                nvme_reset_ctrl(&dev->ctrl);
 
-               nvme_req(req)->flags |= NVME_REQ_CANCELLED;
                return BLK_EH_DONE;
        }
 
@@ -2320,7 +2320,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
 
        dev->ctrl.cap = lo_hi_readq(dev->bar + NVME_REG_CAP);
 
-       dev->q_depth = min_t(u16, NVME_CAP_MQES(dev->ctrl.cap) + 1,
+       dev->q_depth = min_t(u32, NVME_CAP_MQES(dev->ctrl.cap) + 1,
                                io_queue_depth);
        dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */
        dev->db_stride = 1 << NVME_CAP_STRIDE(dev->ctrl.cap);
@@ -2460,7 +2460,8 @@ static int nvme_disable_prepare_reset(struct nvme_dev *dev, bool shutdown)
 static int nvme_setup_prp_pools(struct nvme_dev *dev)
 {
        dev->prp_page_pool = dma_pool_create("prp list page", dev->dev,
-                                               PAGE_SIZE, PAGE_SIZE, 0);
+                                               NVME_CTRL_PAGE_SIZE,
+                                               NVME_CTRL_PAGE_SIZE, 0);
        if (!dev->prp_page_pool)
                return -ENOMEM;
 
@@ -3152,7 +3153,8 @@ static const struct pci_device_id nvme_id_table[] = {
        { PCI_VDEVICE(INTEL, 0xf1a5),   /* Intel 600P/P3100 */
                .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
                                NVME_QUIRK_MEDIUM_PRIO_SQ |
-                               NVME_QUIRK_NO_TEMP_THRESH_CHANGE },
+                               NVME_QUIRK_NO_TEMP_THRESH_CHANGE |
+                               NVME_QUIRK_DISABLE_WRITE_ZEROES, },
        { PCI_VDEVICE(INTEL, 0xf1a6),   /* Intel 760p/Pro 7600p */
                .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
        { PCI_VDEVICE(INTEL, 0x5845),   /* Qemu emulated controller */
index 44c76ffbb264cdde539ee514e070151467ec432c..9e378d0a0c01c157ad24ab62595510c0c4f31eeb 100644 (file)
@@ -122,6 +122,7 @@ struct nvme_rdma_ctrl {
        struct sockaddr_storage src_addr;
 
        struct nvme_ctrl        ctrl;
+       struct mutex            teardown_lock;
        bool                    use_inline_data;
        u32                     io_queues[HCTX_MAX_TYPES];
 };
@@ -834,6 +835,7 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl,
                blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
        }
        if (ctrl->async_event_sqe.data) {
+               cancel_work_sync(&ctrl->ctrl.async_event_work);
                nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
                                sizeof(struct nvme_command), DMA_TO_DEVICE);
                ctrl->async_event_sqe.data = NULL;
@@ -975,7 +977,15 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new)
 
        if (!new) {
                nvme_start_queues(&ctrl->ctrl);
-               nvme_wait_freeze(&ctrl->ctrl);
+               if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) {
+                       /*
+                        * If we timed out waiting for freeze we are likely to
+                        * be stuck.  Fail the controller initialization just
+                        * to be safe.
+                        */
+                       ret = -ENODEV;
+                       goto out_wait_freeze_timed_out;
+               }
                blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset,
                        ctrl->ctrl.queue_count - 1);
                nvme_unfreeze(&ctrl->ctrl);
@@ -983,6 +993,9 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new)
 
        return 0;
 
+out_wait_freeze_timed_out:
+       nvme_stop_queues(&ctrl->ctrl);
+       nvme_rdma_stop_io_queues(ctrl);
 out_cleanup_connect_q:
        if (new)
                blk_cleanup_queue(ctrl->ctrl.connect_q);
@@ -997,6 +1010,7 @@ out_free_io_queues:
 static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
                bool remove)
 {
+       mutex_lock(&ctrl->teardown_lock);
        blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
        nvme_rdma_stop_queue(&ctrl->queues[0]);
        if (ctrl->ctrl.admin_tagset) {
@@ -1007,11 +1021,13 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
        if (remove)
                blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
        nvme_rdma_destroy_admin_queue(ctrl, remove);
+       mutex_unlock(&ctrl->teardown_lock);
 }
 
 static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
                bool remove)
 {
+       mutex_lock(&ctrl->teardown_lock);
        if (ctrl->ctrl.queue_count > 1) {
                nvme_start_freeze(&ctrl->ctrl);
                nvme_stop_queues(&ctrl->ctrl);
@@ -1025,6 +1041,7 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
                        nvme_start_queues(&ctrl->ctrl);
                nvme_rdma_destroy_io_queues(ctrl, remove);
        }
+       mutex_unlock(&ctrl->teardown_lock);
 }
 
 static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl)
@@ -1180,6 +1197,7 @@ static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl)
        if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))
                return;
 
+       dev_warn(ctrl->ctrl.device, "starting error recovery\n");
        queue_work(nvme_reset_wq, &ctrl->err_work);
 }
 
@@ -1189,7 +1207,7 @@ static void nvme_rdma_end_request(struct nvme_rdma_request *req)
 
        if (!refcount_dec_and_test(&req->ref))
                return;
-       if (!nvme_end_request(rq, req->status, req->result))
+       if (!nvme_try_complete_req(rq, req->status, req->result))
                nvme_rdma_complete_rq(rq);
 }
 
@@ -1915,7 +1933,7 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id,
        case RDMA_CM_EVENT_CONNECT_ERROR:
        case RDMA_CM_EVENT_UNREACHABLE:
                nvme_rdma_destroy_queue_ib(queue);
-               /* fall through */
+               fallthrough;
        case RDMA_CM_EVENT_ADDR_ERROR:
                dev_dbg(queue->ctrl->ctrl.device,
                        "CM error event %d\n", ev->event);
@@ -1946,6 +1964,22 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id,
        return 0;
 }
 
+static void nvme_rdma_complete_timed_out(struct request *rq)
+{
+       struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
+       struct nvme_rdma_queue *queue = req->queue;
+       struct nvme_rdma_ctrl *ctrl = queue->ctrl;
+
+       /* fence other contexts that may complete the command */
+       mutex_lock(&ctrl->teardown_lock);
+       nvme_rdma_stop_queue(queue);
+       if (!blk_mq_request_completed(rq)) {
+               nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
+               blk_mq_complete_request(rq);
+       }
+       mutex_unlock(&ctrl->teardown_lock);
+}
+
 static enum blk_eh_timer_return
 nvme_rdma_timeout(struct request *rq, bool reserved)
 {
@@ -1956,29 +1990,29 @@ nvme_rdma_timeout(struct request *rq, bool reserved)
        dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n",
                 rq->tag, nvme_rdma_queue_idx(queue));
 
-       /*
-        * Restart the timer if a controller reset is already scheduled. Any
-        * timed out commands would be handled before entering the connecting
-        * state.
-        */
-       if (ctrl->ctrl.state == NVME_CTRL_RESETTING)
-               return BLK_EH_RESET_TIMER;
-
        if (ctrl->ctrl.state != NVME_CTRL_LIVE) {
                /*
-                * Teardown immediately if controller times out while starting
-                * or we are already started error recovery. all outstanding
-                * requests are completed on shutdown, so we return BLK_EH_DONE.
+                * If we are resetting, connecting or deleting we should
+                * complete immediately because we may block controller
+                * teardown or setup sequence
+                * - ctrl disable/shutdown fabrics requests
+                * - connect requests
+                * - initialization admin requests
+                * - I/O requests that entered after unquiescing and
+                *   the controller stopped responding
+                *
+                * All other requests should be cancelled by the error
+                * recovery work, so it's fine that we fail it here.
                 */
-               flush_work(&ctrl->err_work);
-               nvme_rdma_teardown_io_queues(ctrl, false);
-               nvme_rdma_teardown_admin_queue(ctrl, false);
+               nvme_rdma_complete_timed_out(rq);
                return BLK_EH_DONE;
        }
 
-       dev_warn(ctrl->ctrl.device, "starting error recovery\n");
+       /*
+        * LIVE state should trigger the normal error recovery which will
+        * handle completing this request.
+        */
        nvme_rdma_error_recovery(ctrl);
-
        return BLK_EH_RESET_TIMER;
 }
 
@@ -2278,6 +2312,7 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
                return ERR_PTR(-ENOMEM);
        ctrl->ctrl.opts = opts;
        INIT_LIST_HEAD(&ctrl->list);
+       mutex_init(&ctrl->teardown_lock);
 
        if (!(opts->mask & NVMF_OPT_TRSVCID)) {
                opts->trsvcid =
index 62fbaecdc960c30af87fc36b744d57411bd45dc6..8f4f29f18b8c9c954ecb129816a04e430eb77e3a 100644 (file)
@@ -124,6 +124,7 @@ struct nvme_tcp_ctrl {
        struct sockaddr_storage src_addr;
        struct nvme_ctrl        ctrl;
 
+       struct mutex            teardown_lock;
        struct work_struct      err_work;
        struct delayed_work     connect_work;
        struct nvme_tcp_request async_req;
@@ -464,6 +465,7 @@ static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl)
        if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
                return;
 
+       dev_warn(ctrl->device, "starting error recovery\n");
        queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work);
 }
 
@@ -481,7 +483,7 @@ static int nvme_tcp_process_nvme_cqe(struct nvme_tcp_queue *queue,
                return -EINVAL;
        }
 
-       if (!nvme_end_request(rq, cqe->status, cqe->result))
+       if (!nvme_try_complete_req(rq, cqe->status, cqe->result))
                nvme_complete_rq(rq);
        queue->nr_cqe++;
 
@@ -672,7 +674,7 @@ static inline void nvme_tcp_end_request(struct request *rq, u16 status)
 {
        union nvme_result res = {};
 
-       if (!nvme_end_request(rq, cpu_to_le16(status << 1), res))
+       if (!nvme_try_complete_req(rq, cpu_to_le16(status << 1), res))
                nvme_complete_rq(rq);
 }
 
@@ -866,7 +868,6 @@ static void nvme_tcp_state_change(struct sock *sk)
        case TCP_LAST_ACK:
        case TCP_FIN_WAIT1:
        case TCP_FIN_WAIT2:
-               /* fallthrough */
                nvme_tcp_error_recovery(&queue->ctrl->ctrl);
                break;
        default:
@@ -1527,7 +1528,6 @@ static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid)
 
        if (!test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags))
                return;
-
        __nvme_tcp_stop_queue(queue);
 }
 
@@ -1596,6 +1596,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl,
 static void nvme_tcp_free_admin_queue(struct nvme_ctrl *ctrl)
 {
        if (to_tcp_ctrl(ctrl)->async_req.pdu) {
+               cancel_work_sync(&ctrl->async_event_work);
                nvme_tcp_free_async_req(to_tcp_ctrl(ctrl));
                to_tcp_ctrl(ctrl)->async_req.pdu = NULL;
        }
@@ -1782,7 +1783,15 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
 
        if (!new) {
                nvme_start_queues(ctrl);
-               nvme_wait_freeze(ctrl);
+               if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) {
+                       /*
+                        * If we timed out waiting for freeze we are likely to
+                        * be stuck.  Fail the controller initialization just
+                        * to be safe.
+                        */
+                       ret = -ENODEV;
+                       goto out_wait_freeze_timed_out;
+               }
                blk_mq_update_nr_hw_queues(ctrl->tagset,
                        ctrl->queue_count - 1);
                nvme_unfreeze(ctrl);
@@ -1790,6 +1799,9 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
 
        return 0;
 
+out_wait_freeze_timed_out:
+       nvme_stop_queues(ctrl);
+       nvme_tcp_stop_io_queues(ctrl);
 out_cleanup_connect_q:
        if (new)
                blk_cleanup_queue(ctrl->connect_q);
@@ -1875,6 +1887,7 @@ out_free_queue:
 static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
                bool remove)
 {
+       mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
        blk_mq_quiesce_queue(ctrl->admin_q);
        nvme_tcp_stop_queue(ctrl, 0);
        if (ctrl->admin_tagset) {
@@ -1885,13 +1898,16 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
        if (remove)
                blk_mq_unquiesce_queue(ctrl->admin_q);
        nvme_tcp_destroy_admin_queue(ctrl, remove);
+       mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
 }
 
 static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
                bool remove)
 {
+       mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
        if (ctrl->queue_count <= 1)
-               return;
+               goto out;
+       blk_mq_quiesce_queue(ctrl->admin_q);
        nvme_start_freeze(ctrl);
        nvme_stop_queues(ctrl);
        nvme_tcp_stop_io_queues(ctrl);
@@ -1903,6 +1919,8 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
        if (remove)
                nvme_start_queues(ctrl);
        nvme_tcp_destroy_io_queues(ctrl, remove);
+out:
+       mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
 }
 
 static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl)
@@ -2149,40 +2167,55 @@ static void nvme_tcp_submit_async_event(struct nvme_ctrl *arg)
        nvme_tcp_queue_request(&ctrl->async_req, true, true);
 }
 
+static void nvme_tcp_complete_timed_out(struct request *rq)
+{
+       struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
+       struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
+
+       /* fence other contexts that may complete the command */
+       mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
+       nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue));
+       if (!blk_mq_request_completed(rq)) {
+               nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
+               blk_mq_complete_request(rq);
+       }
+       mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
+}
+
 static enum blk_eh_timer_return
 nvme_tcp_timeout(struct request *rq, bool reserved)
 {
        struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
-       struct nvme_tcp_ctrl *ctrl = req->queue->ctrl;
+       struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
        struct nvme_tcp_cmd_pdu *pdu = req->pdu;
 
-       /*
-        * Restart the timer if a controller reset is already scheduled. Any
-        * timed out commands would be handled before entering the connecting
-        * state.
-        */
-       if (ctrl->ctrl.state == NVME_CTRL_RESETTING)
-               return BLK_EH_RESET_TIMER;
-
-       dev_warn(ctrl->ctrl.device,
+       dev_warn(ctrl->device,
                "queue %d: timeout request %#x type %d\n",
                nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type);
 
-       if (ctrl->ctrl.state != NVME_CTRL_LIVE) {
+       if (ctrl->state != NVME_CTRL_LIVE) {
                /*
-                * Teardown immediately if controller times out while starting
-                * or we are already started error recovery. all outstanding
-                * requests are completed on shutdown, so we return BLK_EH_DONE.
+                * If we are resetting, connecting or deleting we should
+                * complete immediately because we may block controller
+                * teardown or setup sequence
+                * - ctrl disable/shutdown fabrics requests
+                * - connect requests
+                * - initialization admin requests
+                * - I/O requests that entered after unquiescing and
+                *   the controller stopped responding
+                *
+                * All other requests should be cancelled by the error
+                * recovery work, so it's fine that we fail it here.
                 */
-               flush_work(&ctrl->err_work);
-               nvme_tcp_teardown_io_queues(&ctrl->ctrl, false);
-               nvme_tcp_teardown_admin_queue(&ctrl->ctrl, false);
+               nvme_tcp_complete_timed_out(rq);
                return BLK_EH_DONE;
        }
 
-       dev_warn(ctrl->ctrl.device, "starting error recovery\n");
-       nvme_tcp_error_recovery(&ctrl->ctrl);
-
+       /*
+        * LIVE state should trigger the normal error recovery which will
+        * handle completing this request.
+        */
+       nvme_tcp_error_recovery(ctrl);
        return BLK_EH_RESET_TIMER;
 }
 
@@ -2423,6 +2456,7 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev,
                        nvme_tcp_reconnect_ctrl_work);
        INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work);
        INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work);
+       mutex_init(&ctrl->teardown_lock);
 
        if (!(opts->mask & NVMF_OPT_TRSVCID)) {
                opts->trsvcid =
index 74b2b61c773bb30e977b5bd8fd39edcdc8e252ae..37e1d7784e175c1f8713d76728089a9747ec74a1 100644 (file)
@@ -1136,6 +1136,7 @@ static ssize_t nvmet_subsys_attr_model_store(struct config_item *item,
        up_write(&nvmet_config_sem);
 
        kfree_rcu(new_model, rcuhead);
+       kfree(new_model_number);
 
        return count;
 }
index b92f45f5cd5b1675d5c9190a0e59c694432e5ed6..b7b63330b5efdf1ecf2a5c905d9910ea8b213dc3 100644 (file)
@@ -73,7 +73,7 @@ inline u16 errno_to_nvme_status(struct nvmet_req *req, int errno)
                status = NVME_SC_ACCESS_DENIED;
                break;
        case -EIO:
-               /* FALLTHRU */
+               fallthrough;
        default:
                req->error_loc = offsetof(struct nvme_common_command, opcode);
                status = NVME_SC_INTERNAL | NVME_SC_DNR;
@@ -397,6 +397,9 @@ static void nvmet_keep_alive_timer(struct work_struct *work)
 
 static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
 {
+       if (unlikely(ctrl->kato == 0))
+               return;
+
        pr_debug("ctrl %d start keep-alive timer for %d secs\n",
                ctrl->cntlid, ctrl->kato);
 
@@ -406,6 +409,9 @@ static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
 
 static void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl)
 {
+       if (unlikely(ctrl->kato == 0))
+               return;
+
        pr_debug("ctrl %d stop keep-alive\n", ctrl->cntlid);
 
        cancel_delayed_work_sync(&ctrl->ka_work);
index 55bafd56166a2e6948f29fd56ef9a46d9249cf9d..e6861cc10e7db36400af6faa36149242a71d7694 100644 (file)
@@ -2342,9 +2342,9 @@ nvmet_fc_fod_op_done(struct nvmet_fc_fcp_iod *fod)
                        return;
                if (fcpreq->fcp_error ||
                    fcpreq->transferred_length != fcpreq->transfer_length) {
-                       spin_lock(&fod->flock);
+                       spin_lock_irqsave(&fod->flock, flags);
                        fod->abort = true;
-                       spin_unlock(&fod->flock);
+                       spin_unlock_irqrestore(&fod->flock, flags);
 
                        nvmet_req_complete(&fod->req, NVME_SC_INTERNAL);
                        return;
index c97e60b71bbc762004f32212383b43b265f58da5..3da067a8311e52158b38abc4ac1725d371b75035 100644 (file)
@@ -812,7 +812,7 @@ fcloop_fcp_op(struct nvmet_fc_target_port *tgtport,
                        break;
 
                /* Fall-Thru to RSP handling */
-               /* FALLTHRU */
+               fallthrough;
 
        case NVMET_FCOP_RSP:
                if (fcpreq) {
index 3dd6f566a240f147a4e12561175d927de564641c..125dde3f410ee711de2e90009eb76f0c3e0d5255 100644 (file)
@@ -139,7 +139,6 @@ static u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)
                req->error_loc = offsetof(struct nvme_rw_command, nsid);
                break;
        case BLK_STS_IOERR:
-               /* fallthru */
        default:
                status = NVME_SC_INTERNAL | NVME_SC_DNR;
                req->error_loc = offsetof(struct nvme_common_command, opcode);
index 4884ef1e46a2817743d06fa6d67b40da2ec953dc..0d6008cf66a2ada502dcbd6d71127f33e9ed90b9 100644 (file)
@@ -115,7 +115,7 @@ static void nvme_loop_queue_response(struct nvmet_req *req)
                        return;
                }
 
-               if (!nvme_end_request(rq, cqe->status, cqe->result))
+               if (!nvme_try_complete_req(rq, cqe->status, cqe->result))
                        nvme_loop_complete_rq(rq);
        }
 }
index 89d91dc999a6db57ca56fdc561d84aa51a42ae02..dacfa7435d0b2f7161ccad95e8e575e18cdf7355 100644 (file)
@@ -165,7 +165,7 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w)
 
        req->cqe->result = nvme_req(rq)->result;
        nvmet_req_complete(req, status);
-       blk_put_request(rq);
+       blk_mq_free_request(rq);
 }
 
 static void nvmet_passthru_req_done(struct request *rq,
@@ -175,7 +175,7 @@ static void nvmet_passthru_req_done(struct request *rq,
 
        req->cqe->result = nvme_req(rq)->result;
        nvmet_req_complete(req, nvme_req(rq)->status);
-       blk_put_request(rq);
+       blk_mq_free_request(rq);
 }
 
 static int nvmet_passthru_map_sg(struct nvmet_req *req, struct request *rq)
@@ -230,7 +230,7 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
                if (unlikely(!ns)) {
                        pr_err("failed to get passthru ns nsid:%u\n", nsid);
                        status = NVME_SC_INVALID_NS | NVME_SC_DNR;
-                       goto fail_out;
+                       goto out;
                }
 
                q = ns->queue;
@@ -238,16 +238,15 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
 
        rq = nvme_alloc_request(q, req->cmd, BLK_MQ_REQ_NOWAIT, NVME_QID_ANY);
        if (IS_ERR(rq)) {
-               rq = NULL;
                status = NVME_SC_INTERNAL;
-               goto fail_out;
+               goto out_put_ns;
        }
 
        if (req->sg_cnt) {
                ret = nvmet_passthru_map_sg(req, rq);
                if (unlikely(ret)) {
                        status = NVME_SC_INTERNAL;
-                       goto fail_out;
+                       goto out_put_req;
                }
        }
 
@@ -274,11 +273,13 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
 
        return;
 
-fail_out:
+out_put_req:
+       blk_mq_free_request(rq);
+out_put_ns:
        if (ns)
                nvme_put_ns(ns);
+out:
        nvmet_req_complete(req, status);
-       blk_put_request(rq);
 }
 
 /*
@@ -326,6 +327,10 @@ static u16 nvmet_setup_passthru_command(struct nvmet_req *req)
 
 u16 nvmet_parse_passthru_io_cmd(struct nvmet_req *req)
 {
+       /* Reject any commands with non-sgl flags set (ie. fused commands) */
+       if (req->cmd->common.flags & ~NVME_CMD_SGL_ALL)
+               return NVME_SC_INVALID_FIELD;
+
        switch (req->cmd->common.opcode) {
        case nvme_cmd_resv_register:
        case nvme_cmd_resv_report:
@@ -396,6 +401,10 @@ static u16 nvmet_passthru_get_set_features(struct nvmet_req *req)
 
 u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req)
 {
+       /* Reject any commands with non-sgl flags set (ie. fused commands) */
+       if (req->cmd->common.flags & ~NVME_CMD_SGL_ALL)
+               return NVME_SC_INVALID_FIELD;
+
        /*
         * Passthru all vendor specific commands
         */
@@ -508,6 +517,7 @@ int nvmet_passthru_ctrl_enable(struct nvmet_subsys *subsys)
                subsys->ver = NVME_VS(1, 2, 1);
        }
 
+       __module_get(subsys->passthru_ctrl->ops->module);
        mutex_unlock(&subsys->lock);
        return 0;
 
@@ -522,6 +532,7 @@ static void __nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys)
 {
        if (subsys->passthru_ctrl) {
                xa_erase(&passthru_subsystems, subsys->passthru_ctrl->cntlid);
+               module_put(subsys->passthru_ctrl->ops->module);
                nvme_put_ctrl(subsys->passthru_ctrl);
        }
        subsys->passthru_ctrl = NULL;
index 3ccb59260b4abbafe02c2578e1a04a040eb5f28f..ae6620489457d66c6f9074e616905d49bcea920d 100644 (file)
@@ -1758,7 +1758,7 @@ static int nvmet_rdma_cm_handler(struct rdma_cm_id *cm_id,
                        schedule_delayed_work(&port->repair_work, 0);
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case RDMA_CM_EVENT_DISCONNECTED:
        case RDMA_CM_EVENT_TIMEWAIT_EXIT:
                nvmet_rdma_queue_disconnect(queue);
@@ -1769,7 +1769,7 @@ static int nvmet_rdma_cm_handler(struct rdma_cm_id *cm_id,
        case RDMA_CM_EVENT_REJECTED:
                pr_debug("Connection rejected: %s\n",
                         rdma_reject_msg(cm_id, event->status));
-               /* FALLTHROUGH */
+               fallthrough;
        case RDMA_CM_EVENT_UNREACHABLE:
        case RDMA_CM_EVENT_CONNECT_ERROR:
                nvmet_rdma_queue_connect_fail(cm_id, queue);
index 9eda91162fe45d1aba836bf3811015e115f5aec0..8e0d766d272248aa32a7a85f1a4d6d54527755df 100644 (file)
@@ -160,6 +160,11 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd);
 static inline u16 nvmet_tcp_cmd_tag(struct nvmet_tcp_queue *queue,
                struct nvmet_tcp_cmd *cmd)
 {
+       if (unlikely(!queue->nr_cmds)) {
+               /* We didn't allocate cmds yet, send 0xffff */
+               return USHRT_MAX;
+       }
+
        return cmd - queue->cmds;
 }
 
@@ -866,7 +871,10 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue)
        struct nvme_tcp_data_pdu *data = &queue->pdu.data;
        struct nvmet_tcp_cmd *cmd;
 
-       cmd = &queue->cmds[data->ttag];
+       if (likely(queue->nr_cmds))
+               cmd = &queue->cmds[data->ttag];
+       else
+               cmd = &queue->connect;
 
        if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) {
                pr_err("ttag %u unexpected data offset %u (expected %u)\n",
index 9668ea04cc808c51419c5ac14180b563c7ff16f9..3ca7543142bf36465a9df1ce4bfc3fa8a38b60e0 100644 (file)
@@ -1296,13 +1296,19 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq)
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_remove);
 
-void _opp_remove_all_static(struct opp_table *opp_table)
+bool _opp_remove_all_static(struct opp_table *opp_table)
 {
        struct dev_pm_opp *opp, *tmp;
+       bool ret = true;
 
        mutex_lock(&opp_table->lock);
 
-       if (!opp_table->parsed_static_opps || --opp_table->parsed_static_opps)
+       if (!opp_table->parsed_static_opps) {
+               ret = false;
+               goto unlock;
+       }
+
+       if (--opp_table->parsed_static_opps)
                goto unlock;
 
        list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) {
@@ -1312,6 +1318,8 @@ void _opp_remove_all_static(struct opp_table *opp_table)
 
 unlock:
        mutex_unlock(&opp_table->lock);
+
+       return ret;
 }
 
 /**
@@ -2414,13 +2422,15 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev)
                return;
        }
 
-       _opp_remove_all_static(opp_table);
+       /*
+        * Drop the extra reference only if the OPP table was successfully added
+        * with dev_pm_opp_of_add_table() earlier.
+        **/
+       if (_opp_remove_all_static(opp_table))
+               dev_pm_opp_put_opp_table(opp_table);
 
        /* Drop reference taken by _find_opp_table() */
        dev_pm_opp_put_opp_table(opp_table);
-
-       /* Drop reference taken while the OPP table was added */
-       dev_pm_opp_put_opp_table(opp_table);
 }
 
 /**
index e51646ff279eb8e8b223b36df167115fc97869b0..c3fcd571e446ded1046da28312ba4d31868191f2 100644 (file)
@@ -212,7 +212,7 @@ struct opp_table {
 
 /* Routines internal to opp core */
 void dev_pm_opp_get(struct dev_pm_opp *opp);
-void _opp_remove_all_static(struct opp_table *opp_table);
+bool _opp_remove_all_static(struct opp_table *opp_table);
 void _get_opp_table_kref(struct opp_table *opp_table);
 int _get_opp_count(struct opp_table *opp_table);
 struct opp_table *_find_opp_table(struct device *dev);
index f28d6a3c5a684adf789ef89b271477ade45a736b..4547ac44c8d48d6f8a42bcbdd6c51c44a7611f01 100644 (file)
@@ -260,7 +260,7 @@ static void parport_ieee1284_terminate (struct parport *port)
                        port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
                }
 
-               /* fall through */
+               fallthrough;
 
        default:
                /* Terminate from all other modes. */
@@ -598,7 +598,7 @@ ssize_t parport_write (struct parport *port, const void *buffer, size_t len)
        case IEEE1284_MODE_NIBBLE:
        case IEEE1284_MODE_BYTE:
                parport_negotiate (port, IEEE1284_MODE_COMPAT);
-               /* fall through */
+               fallthrough;
        case IEEE1284_MODE_COMPAT:
                pr_debug("%s: Using compatibility mode\n", port->name);
                fn = port->ops->compat_write_data;
@@ -702,7 +702,7 @@ ssize_t parport_read (struct parport *port, void *buffer, size_t len)
                if (parport_negotiate (port, IEEE1284_MODE_NIBBLE)) {
                        return -EIO;
                }
-               /* fall through - to NIBBLE */
+               fallthrough;    /* to NIBBLE */
        case IEEE1284_MODE_NIBBLE:
                pr_debug("%s: Using nibble mode\n", port->name);
                fn = port->ops->nibble_read_data;
index 77e37e3cb3a091c65d31023ac3d850dd5559ecf2..eda4ded4d5e52a11f357e249a6826d893d227ceb 100644 (file)
@@ -1647,7 +1647,7 @@ static int parport_ECP_supported(struct parport *pb)
                break;
        default:
                pr_warn("0x%lx: Unknown implementation ID\n", pb->base);
-               /* Fall through - Assume 1 */
+               fallthrough;    /* Assume 1 */
        case 1:
                pword = 1;
        }
index 90df28c7cb0cf0f225da68427214a81ed875790b..5fef2613b223ad2188b833f29f7db850b3ebc8b2 100644 (file)
@@ -439,7 +439,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
                                   IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0);
                break;
-       case IMX6QP:            /* FALLTHROUGH */
+       case IMX6QP:
        case IMX6Q:
                /* power up core phy and enable ref clock */
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
@@ -642,7 +642,7 @@ static void imx6_pcie_init_phy(struct imx6_pcie *imx6_pcie)
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
                                   IMX6SX_GPR12_PCIE_RX_EQ_MASK,
                                   IMX6SX_GPR12_PCIE_RX_EQ_2);
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
                                   IMX6Q_GPR12_PCIE_CTL_2, 0 << 10);
@@ -1105,7 +1105,7 @@ static int imx6_pcie_probe(struct platform_device *pdev)
                        dev_err(dev, "pcie_aux clock source missing or invalid\n");
                        return PTR_ERR(imx6_pcie->pcie_aux);
                }
-               /* fall through */
+               fallthrough;
        case IMX7D:
                if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR)
                        imx6_pcie->controller_id = 1;
index c9530038ca9a53fcc66c0d9e792dc0072a522e84..afde4aa8f6dcbbf629612376ac377dc4ff8b7ae9 100644 (file)
@@ -223,7 +223,7 @@ static void rcar_pci_setup(struct rcar_pci_priv *priv)
                pr_warn("unknown window size %ld - defaulting to 256M\n",
                        window_size);
                window_size = SZ_256M;
-               /* fall-through */
+               fallthrough;
        case SZ_256M:
                val |= RCAR_USBCTR_PCIAHB_WIN1_256M;
                break;
index 5c93aa14f0de21ff008345037b2307fbeb7c3ed7..ae9acc77d14f1def561e80112a4b414f1c9af1b8 100644 (file)
@@ -1941,7 +1941,7 @@ static int __init update_bridge_ranges(struct bus_node **bus)
                                                break;
                                        case PCI_HEADER_TYPE_BRIDGE:
                                                function = 0x8;
-                                               /* fall through */
+                                               fallthrough;
                                        case PCI_HEADER_TYPE_MULTIBRIDGE:
                                                /* We assume here that only 1 bus behind the bridge
                                                   TO DO: add functionality for several:
index 6503d15effbbd314b4cfbc60358262fbbb23193f..9f85815b4f53403dd7f5dd3a0d23384232c25e0c 100644 (file)
@@ -236,7 +236,7 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
        switch (ctrl->state) {
        case BLINKINGOFF_STATE:
                cancel_delayed_work(&ctrl->button_work);
-               /* fall through */
+               fallthrough;
        case ON_STATE:
                ctrl->state = POWEROFF_STATE;
                mutex_unlock(&ctrl->state_lock);
@@ -265,7 +265,7 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
        switch (ctrl->state) {
        case BLINKINGON_STATE:
                cancel_delayed_work(&ctrl->button_work);
-               /* fall through */
+               fallthrough;
        case OFF_STATE:
                ctrl->state = POWERON_STATE;
                mutex_unlock(&ctrl->state_lock);
index afdc52d1cae75ede21970718e965601a30ee22ea..65502e3f7b4fb68aa43491d4fa94b2bffba61dd7 100644 (file)
@@ -642,7 +642,7 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot)
        switch (p_slot->state) {
        case BLINKINGON_STATE:
                cancel_delayed_work(&p_slot->work);
-               /* fall through */
+               fallthrough;
        case STATIC_STATE:
                p_slot->state = POWERON_STATE;
                mutex_unlock(&p_slot->lock);
@@ -678,7 +678,7 @@ int shpchp_sysfs_disable_slot(struct slot *p_slot)
        switch (p_slot->state) {
        case BLINKINGOFF_STATE:
                cancel_delayed_work(&p_slot->work);
-               /* fall through */
+               fallthrough;
        case STATIC_STATE:
                p_slot->state = POWEROFF_STATE;
                mutex_unlock(&p_slot->lock);
index a458c46d7e39d13c722d733cebc1c80d7f4b3ae1..e39c5499770ff4377766a72ccbb165e2bdbb917e 100644 (file)
@@ -1049,7 +1049,7 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
                if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot
                 && !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
                        need_restore = true;
-               /* Fall-through - force to D0 */
+               fallthrough;    /* force to D0 */
        default:
                pmcsr = 0;
                break;
@@ -2541,7 +2541,7 @@ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup)
                case PCI_D2:
                        if (pci_no_d1d2(dev))
                                break;
-                       /* else, fall through */
+                       fallthrough;
                default:
                        target_state = state;
                }
index bd2b691fa7a3320ccab98cf0f0bc64b470fd81af..d35186b01d98380d7458734e2b83dce93ebe35ee 100644 (file)
@@ -231,7 +231,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
                }
                /* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
-               /* fall through */
+               fallthrough;
        default:
                ret = -EINVAL;
                break;
index bdf9b52567e030640b5ee98ad9e1cded7be37f72..2a589b6d6ed85ca9644dbe85e08ab7bf85455cb2 100644 (file)
@@ -1730,7 +1730,7 @@ static void quirk_jmicron_ata(struct pci_dev *pdev)
        case PCI_DEVICE_ID_JMICRON_JMB366:
                /* Redirect IDE second PATA port to the right spot */
                conf5 |= (1 << 24);
-               /* Fall through */
+               fallthrough;
        case PCI_DEVICE_ID_JMICRON_JMB361:
        case PCI_DEVICE_ID_JMICRON_JMB363:
        case PCI_DEVICE_ID_JMICRON_JMB369:
@@ -2224,7 +2224,7 @@ static void quirk_netmos(struct pci_dev *dev)
                if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
                                dev->subsystem_device == 0x0299)
                        return;
-               /* else, fall through */
+               fallthrough;
        case PCI_DEVICE_ID_NETMOS_9735:
        case PCI_DEVICE_ID_NETMOS_9745:
        case PCI_DEVICE_ID_NETMOS_9845:
index 3951e02b7dedad9dded202f4e79bf9a124bb3acf..2ce636937c6eaf5b2c23045a1de00d368fb8cb01 100644 (file)
@@ -1253,7 +1253,7 @@ void __pci_bus_size_bridges(struct pci_bus *bus, struct list_head *realloc_head)
                        additional_mmio_size = pci_hotplug_mmio_size;
                        additional_mmio_pref_size = pci_hotplug_mmio_pref_size;
                }
-               /* Fall through */
+               fallthrough;
        default:
                pbus_size_io(bus, realloc_head ? 0 : additional_io_size,
                             additional_io_size, realloc_head);
index fab267e359e74004c3881ede7b32780893bc8d35..c0e85be598c11272c1b2c3a0e508f8d876257450 100644 (file)
@@ -1096,7 +1096,7 @@ static void __ref pcifront_backend_changed(struct xenbus_device *xdev,
        case XenbusStateClosed:
                if (xdev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's CLOSING state. */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                dev_warn(&xdev->dev, "backend going away!\n");
                pcifront_try_disconnect(pdev);
index 590e594092f25f080314d08316dd26b2b2831f8b..a7c7c7cd232698d53c1e8c8b1c04947af94d97e0 100644 (file)
@@ -255,10 +255,10 @@ static int db1x_pcmcia_configure(struct pcmcia_socket *skt,
        switch (state->Vcc) {
        case 50:
                ++v;
-               /* fall through */
+               fallthrough;
        case 33:
                ++v;
-               /* fall through */
+               fallthrough;
        case 0:
                break;
        default:
@@ -269,11 +269,11 @@ static int db1x_pcmcia_configure(struct pcmcia_socket *skt,
        switch (state->Vpp) {
        case 12:
                ++p;
-               /* fall through */
+               fallthrough;
        case 33:
        case 50:
                ++p;
-               /* fall through */
+               fallthrough;
        case 0:
                break;
        default:
index 7b7d23f2571390c3715ac778ef555873cd8a2eab..a0a71c1df042abf25ff8935aa95ca80f7a1565bf 100644 (file)
@@ -1404,7 +1404,7 @@ static int arm_ccn_init_nodes(struct arm_ccn *ccn, int region,
                break;
        case CCN_TYPE_SBAS:
                ccn->sbas_present = 1;
-               /* Fall-through */
+               fallthrough;
        default:
                component = &ccn->node[id];
                break;
index e51ddb6d63eda31acbd1a78c6060ff2e223ec44e..cc00915ad6d19aa957bbf718f3f7a1e49496c11d 100644 (file)
@@ -1002,7 +1002,7 @@ static void __arm_spe_pmu_dev_probe(void *info)
        default:
                dev_warn(dev, "unknown PMSIDR_EL1.Interval [%d]; assuming 8\n",
                         fld);
-               /* Fallthrough */
+               fallthrough;
        case 8:
                spe_pmu->min_period = 4096;
        }
@@ -1021,7 +1021,7 @@ static void __arm_spe_pmu_dev_probe(void *info)
        default:
                dev_warn(dev, "unknown PMSIDR_EL1.CountSize [%d]; assuming 2\n",
                         fld);
-               /* Fallthrough */
+               fallthrough;
        case 2:
                spe_pmu->counter_sz = 12;
        }
index 71f257b4a7f5d1f8a161ed579dc43e7affdea5e4..9061ece7ff6ab1e42aee9ee13528ee3dabf35a2c 100644 (file)
@@ -505,9 +505,9 @@ static int qcom_ipq806x_usb_phy_probe(struct platform_device *pdev)
        size = resource_size(res);
        phy_dwc3->base = devm_ioremap(phy_dwc3->dev, res->start, size);
 
-       if (IS_ERR(phy_dwc3->base)) {
+       if (!phy_dwc3->base) {
                dev_err(phy_dwc3->dev, "failed to map reg\n");
-               return PTR_ERR(phy_dwc3->base);
+               return -ENOMEM;
        }
 
        phy_dwc3->ref_clk = devm_clk_get(phy_dwc3->dev, "ref");
@@ -557,7 +557,6 @@ static struct platform_driver qcom_ipq806x_usb_phy_driver = {
        .probe          = qcom_ipq806x_usb_phy_probe,
        .driver         = {
                .name   = "qcom-ipq806x-usb-phy",
-               .owner  = THIS_MODULE,
                .of_match_table = qcom_ipq806x_usb_phy_table,
        },
 };
index 562053ce9455536a5bf90a634805077f5765667e..6e6f992a9524043c8b7776fea4fde09d74e8d148 100644 (file)
@@ -604,8 +604,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
        QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf),
        QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1),
        QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0),
-       QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0x1f),
-       QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x3f),
+       QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff),
+       QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f),
        QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6),
        QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf),
        QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0),
@@ -631,7 +631,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
        QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0),
        QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80),
        QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1),
-       QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_CTRL, 0xa),
        QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1),
        QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31),
        QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1),
@@ -640,7 +639,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
        QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f),
        QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19),
        QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19),
-       QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_CNTRL, 0x7),
 };
 
 static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = {
@@ -648,6 +646,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = {
        QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6),
        QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2),
        QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12),
+       QMP_PHY_INIT_CFG(QSERDES_TX_EMP_POST1_LVL, 0x36),
+       QMP_PHY_INIT_CFG(QSERDES_TX_SLEW_CNTL, 0x0a),
 };
 
 static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = {
@@ -658,7 +658,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = {
        QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb),
        QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b),
        QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4),
-       QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN_HALF, 0x4),
 };
 
 static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = {
@@ -2046,6 +2045,9 @@ static const struct qmp_phy_cfg msm8996_usb3phy_cfg = {
        .pwrdn_ctrl             = SW_PWRDN,
 };
 
+static const char * const ipq8074_pciephy_clk_l[] = {
+       "aux", "cfg_ahb",
+};
 /* list of resets */
 static const char * const ipq8074_pciephy_reset_l[] = {
        "phy", "common",
@@ -2063,8 +2065,8 @@ static const struct qmp_phy_cfg ipq8074_pciephy_cfg = {
        .rx_tbl_num             = ARRAY_SIZE(ipq8074_pcie_rx_tbl),
        .pcs_tbl                = ipq8074_pcie_pcs_tbl,
        .pcs_tbl_num            = ARRAY_SIZE(ipq8074_pcie_pcs_tbl),
-       .clk_list               = NULL,
-       .num_clks               = 0,
+       .clk_list               = ipq8074_pciephy_clk_l,
+       .num_clks               = ARRAY_SIZE(ipq8074_pciephy_clk_l),
        .reset_list             = ipq8074_pciephy_reset_l,
        .num_resets             = ARRAY_SIZE(ipq8074_pciephy_reset_l),
        .vreg_list              = NULL,
index 4277f592684b6a8ab135928635d9b3e2e450e81c..904b80ab90090dd2abe598bccc65c525c9b126d9 100644 (file)
@@ -77,6 +77,8 @@
 #define QSERDES_COM_CORECLK_DIV_MODE1                  0x1bc
 
 /* Only for QMP V2 PHY - TX registers */
+#define QSERDES_TX_EMP_POST1_LVL                       0x018
+#define QSERDES_TX_SLEW_CNTL                           0x040
 #define QSERDES_TX_RES_CODE_LANE_OFFSET                        0x054
 #define QSERDES_TX_DEBUG_BUS_SEL                       0x064
 #define QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN    0x068
index 61054272a7c8be306df65509793ae91fb76670d1..327df1a99f77325a1f229cc1638402f5e8bbe5d6 100644 (file)
@@ -53,7 +53,7 @@ static int qcom_usb_hs_phy_set_mode(struct phy *phy,
                case PHY_MODE_USB_OTG:
                case PHY_MODE_USB_HOST:
                        val |= ULPI_INT_IDGRD;
-                       /* fall through */
+                       fallthrough;
                case PHY_MODE_USB_DEVICE:
                        val |= ULPI_INT_SESS_VALID;
                default:
index a84e9f027fc4692b17ccee5ace4285e0ede991be..46ebdb1460a3de4753794adb2577e035e6666b9b 100644 (file)
@@ -546,7 +546,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work)
                rport->state = OTG_STATE_B_IDLE;
                if (!vbus_attach)
                        rockchip_usb2phy_power_off(rport->phy);
-               /* fall through */
+               fallthrough;
        case OTG_STATE_B_IDLE:
                if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) > 0) {
                        dev_dbg(&rport->phy->dev, "usb otg host connect\n");
@@ -754,11 +754,11 @@ static void rockchip_chg_detect_work(struct work_struct *work)
                        rphy->chg_type = POWER_SUPPLY_TYPE_USB_DCP;
                else
                        rphy->chg_type = POWER_SUPPLY_TYPE_USB_CDP;
-               /* fall through */
+               fallthrough;
        case USB_CHG_STATE_SECONDARY_DONE:
                rphy->chg_state = USB_CHG_STATE_DETECTED;
                delay = 0;
-               /* fall through */
+               fallthrough;
        case USB_CHG_STATE_DETECTED:
                /* put the controller in normal mode */
                property_enable(base, &rphy->phy_cfg->chg_det.opmode, true);
@@ -835,7 +835,7 @@ static void rockchip_usb2phy_sm_work(struct work_struct *work)
                        dev_dbg(&rport->phy->dev, "FS/LS online\n");
                        break;
                }
-               /* fall through */
+               fallthrough;
        case PHY_STATE_CONNECT:
                if (rport->suspended) {
                        dev_dbg(&rport->phy->dev, "Connected\n");
index cb2dd3230fa76f1deab0adc01a308d185509d724..507f79d14adb80f461730fb86818cc70ce858cc1 100644 (file)
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 #include <linux/of_platform.h>
+#include <linux/sys_soc.h>
 
 #define USB2PHY_ANA_CONFIG1            0x4c
 #define USB2PHY_DISCON_BYP_LATCH       BIT(31)
 
+#define USB2PHY_CHRG_DET                       0x14
+#define USB2PHY_CHRG_DET_USE_CHG_DET_REG       BIT(29)
+#define USB2PHY_CHRG_DET_DIS_CHG_DET           BIT(28)
+
 /* SoC Specific USB2_OTG register definitions */
 #define AM654_USB2_OTG_PD              BIT(8)
 #define AM654_USB2_VBUS_DET_EN         BIT(5)
@@ -43,6 +48,7 @@
 #define OMAP_USB2_HAS_START_SRP                        BIT(0)
 #define OMAP_USB2_HAS_SET_VBUS                 BIT(1)
 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT   BIT(2)
+#define OMAP_USB2_DISABLE_CHRG_DET             BIT(3)
 
 struct omap_usb {
        struct usb_phy          phy;
@@ -236,6 +242,13 @@ static int omap_usb_init(struct phy *x)
                omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val);
        }
 
+       if (phy->flags & OMAP_USB2_DISABLE_CHRG_DET) {
+               val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET);
+               val |= USB2PHY_CHRG_DET_USE_CHG_DET_REG |
+                      USB2PHY_CHRG_DET_DIS_CHG_DET;
+               omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val);
+       }
+
        return 0;
 }
 
@@ -329,6 +342,26 @@ static const struct of_device_id omap_usb2_id_table[] = {
 };
 MODULE_DEVICE_TABLE(of, omap_usb2_id_table);
 
+static void omap_usb2_init_errata(struct omap_usb *phy)
+{
+       static const struct soc_device_attribute am65x_sr10_soc_devices[] = {
+               { .family = "AM65X", .revision = "SR1.0" },
+               { /* sentinel */ }
+       };
+
+       /*
+        * Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by
+        * Default Without VBUS Presence.
+        *
+        * AM654x SR1.0 has a silicon bug due to which D+ is pulled high after
+        * POR, which could cause enumeration failure with some USB hubs.
+        * Disabling the USB2_PHY Charger Detect function will put D+
+        * into the normal state.
+        */
+       if (soc_device_match(am65x_sr10_soc_devices))
+               phy->flags |= OMAP_USB2_DISABLE_CHRG_DET;
+}
+
 static int omap_usb2_probe(struct platform_device *pdev)
 {
        struct omap_usb *phy;
@@ -366,14 +399,14 @@ static int omap_usb2_probe(struct platform_device *pdev)
        phy->mask               = phy_data->mask;
        phy->power_on           = phy_data->power_on;
        phy->power_off          = phy_data->power_off;
+       phy->flags              = phy_data->flags;
 
-       if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {
-               res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-               phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
-               if (IS_ERR(phy->phy_base))
-                       return PTR_ERR(phy->phy_base);
-               phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
-       }
+       omap_usb2_init_errata(phy);
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(phy->phy_base))
+               return PTR_ERR(phy->phy_base);
 
        phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
                                                        "syscon-phy-power");
index 5e1d14e35f20b19a154e028a5d5ca52166e2c066..0d46706afd2da352e6825b6d8bb04467388c4bf7 100644 (file)
@@ -431,7 +431,7 @@ static void olpc_xo175_ec_complete(void *arg)
                        input_sync(priv->pwrbtn);
                        input_report_key(priv->pwrbtn, KEY_POWER, 0);
                        input_sync(priv->pwrbtn);
-                       /* fall through */
+                       fallthrough;
                case EVENT_POWER_PRESS_WAKE:
                case EVENT_TIMED_HOST_WAKE:
                        pm_wakeup_event(priv->pwrbtn->dev.parent,
index 60c18f21588dd5d94a0beb343e8da6d3120d2a7b..49f4b73be513f515af3838e4af451c2071e945a7 100644 (file)
@@ -1001,7 +1001,7 @@ static acpi_status WMID_get_u32(u32 *value, u32 cap)
                        *value = tmp & 0x1;
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        default:
                return AE_ERROR;
        }
@@ -1328,7 +1328,7 @@ static acpi_status get_u32(u32 *value, u32 cap)
                        status = AMW0_get_u32(value, cap);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case ACER_WMID:
                status = WMID_get_u32(value, cap);
                break;
@@ -1371,7 +1371,7 @@ static acpi_status set_u32(u32 value, u32 cap)
 
                                return AMW0_set_u32(value, cap);
                        }
-                       /* fall through */
+                       fallthrough;
                case ACER_WMID:
                        return WMID_set_u32(value, cap);
                case ACER_WMID_v2:
@@ -1381,7 +1381,7 @@ static acpi_status set_u32(u32 value, u32 cap)
                                return wmid_v2_set_u32(value, cap);
                        else if (wmi_has_guid(WMID_GUID2))
                                return WMID_set_u32(value, cap);
-                       /* fall through */
+                       fallthrough;
                default:
                        return AE_BAD_PARAMETER;
                }
index 5e9c2296931c9a750c7030add75168919ca1e6f1..70edc5bb3a146082599c348a07f5a1d930e88c25 100644 (file)
@@ -1587,10 +1587,10 @@ static ssize_t kbd_led_timeout_store(struct device *dev,
                switch (unit) {
                case KBD_TIMEOUT_DAYS:
                        value *= 24;
-                       /* fall through */
+                       fallthrough;
                case KBD_TIMEOUT_HOURS:
                        value *= 60;
-                       /* fall through */
+                       fallthrough;
                case KBD_TIMEOUT_MINUTES:
                        value *= 60;
                        unit = KBD_TIMEOUT_SECONDS;
index ec515223f6549d8cbc8968d1f13780f21d65686a..d8afed5db94c59f69f58e63e24e5976e9fae2ee7 100644 (file)
@@ -84,28 +84,28 @@ static void surface_button_notify(struct acpi_device *device, u32 event)
        /* Power button press,release handle */
        case SURFACE_BUTTON_NOTIFY_PRESS_POWER:
                pressed = true;
-               /*fall through*/
+               fallthrough;
        case SURFACE_BUTTON_NOTIFY_RELEASE_POWER:
                key_code = KEY_POWER;
                break;
        /* Home button press,release handle */
        case SURFACE_BUTTON_NOTIFY_PRESS_HOME:
                pressed = true;
-               /*fall through*/
+               fallthrough;
        case SURFACE_BUTTON_NOTIFY_RELEASE_HOME:
                key_code = KEY_LEFTMETA;
                break;
        /* Volume up button press,release handle */
        case SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_UP:
                pressed = true;
-               /*fall through*/
+               fallthrough;
        case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_UP:
                key_code = KEY_VOLUMEUP;
                break;
        /* Volume down button press,release handle */
        case SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_DOWN:
                pressed = true;
-               /*fall through*/
+               fallthrough;
        case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_DOWN:
                key_code = KEY_VOLUMEDOWN;
                break;
index 4864a5c189d464a9ef4327416a7f9d0ae1aaca34..9c4df41687a39fee9275ef9d12d1fdf30b37e613 100644 (file)
@@ -4060,7 +4060,7 @@ static bool hotkey_notify_6xxx(const u32 hkey,
                 * AC status changed; can be triggered by plugging or
                 * unplugging AC adapter, docking or undocking. */
 
-               /* fallthrough */
+               fallthrough;
 
        case TP_HKEY_EV_KEY_NUMLOCK:
        case TP_HKEY_EV_KEY_FN:
@@ -4176,7 +4176,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
                                known_ev = true;
                                break;
                        }
-                       /* fallthrough - to default */
+                       fallthrough;    /* to default */
                default:
                        known_ev = false;
                }
@@ -6266,7 +6266,7 @@ static int thermal_get_sensor(int idx, s32 *value)
                        idx -= 8;
                }
 #endif
-               /* fallthrough */
+               fallthrough;
        case TPACPI_THERMAL_TPEC_8:
                if (idx <= 7) {
                        if (!acpi_ec_read(t + idx, &tmp))
index 36fff00af9ebd482d2dce7b10e25281767c6d188..e557d757c64708f6ebef5b6411c7917679ab6c86 100644 (file)
@@ -2748,7 +2748,7 @@ static void toshiba_acpi_process_hotkeys(struct toshiba_acpi_dev *dev)
                                result = hci_write(dev, HCI_SYSTEM_EVENT, 1);
                                if (result == TOS_SUCCESS)
                                        pr_notice("Re-enabled hotkeys\n");
-                               /* Fall through */
+                               fallthrough;
                        default:
                                retries--;
                                break;
index 9469fe182d02a1e333e5f305083bfdcc931c84d8..db65be0269206dd043acea31ed78c53533b519b6 100644 (file)
@@ -748,7 +748,7 @@ static int ab8500_charger_max_usb_curr(struct ab8500_charger *di,
                                                USB_CH_IP_CUR_LVL_1P5;
                        break;
                }
-               /* else, fall through */
+               fallthrough;
        case USB_STAT_HM_IDGND:
                dev_err(di->dev, "USB Type - Charging not allowed\n");
                di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05;
@@ -2410,7 +2410,7 @@ static void ab8500_charger_usb_state_changed_work(struct work_struct *work)
                 * of 1sec for enabling charging
                 */
                msleep(1000);
-               /* Intentional fall through */
+               fallthrough;
        case AB8500_BM_USB_STATE_CONFIGURED:
                /*
                 * USB is configured, enable charging with the charging
index 751c4f6c7487160d3725ecd1d3e723f58ec8fb2f..7eec415c82a3525b9dcbe83cc01aa8fe8e457e30 100644 (file)
@@ -1542,7 +1542,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di)
                ab8500_fg_discharge_state_to(di,
                        AB8500_FG_DISCHARGE_INITMEASURING);
 
-               /* Intentional fallthrough */
+               fallthrough;
        case AB8500_FG_DISCHARGE_INITMEASURING:
                /*
                 * Discard a number of samples during startup.
@@ -1572,7 +1572,7 @@ static void ab8500_fg_algorithm_discharging(struct ab8500_fg *di)
                ab8500_fg_discharge_state_to(di,
                        AB8500_FG_DISCHARGE_RECOVERY);
 
-               /* Intentional fallthrough */
+               fallthrough;
 
        case AB8500_FG_DISCHARGE_RECOVERY:
                sleep_time = di->bm->fg_params->recovery_sleep_timer;
index 2fb33a07879a3b6af8a53df920e47bca119cf0a1..175c4f3d795534143b231779dc72c74401ce3e6e 100644 (file)
@@ -1419,7 +1419,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                abx500_chargalg_stop_charging(di);
                di->charge_status = POWER_SUPPLY_STATUS_DISCHARGING;
                abx500_chargalg_state_to(di, STATE_HANDHELD);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_HANDHELD:
                break;
@@ -1435,7 +1435,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                di->maintenance_chg = false;
                abx500_chargalg_state_to(di, STATE_SUSPENDED);
                power_supply_changed(di->chargalg_psy);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_SUSPENDED:
                /* CHARGING is suspended */
@@ -1444,7 +1444,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_BATT_REMOVED_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_BATT_REMOVED);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_BATT_REMOVED:
                if (!di->events.batt_rem)
@@ -1454,7 +1454,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_HW_TEMP_PROTECT_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_HW_TEMP_PROTECT);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_HW_TEMP_PROTECT:
                if (!di->events.main_thermal_prot &&
@@ -1465,7 +1465,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_OVV_PROTECT_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_OVV_PROTECT);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_OVV_PROTECT:
                if (!di->events.vbus_ovv &&
@@ -1479,7 +1479,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_CHG_NOT_OK_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_CHG_NOT_OK);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_CHG_NOT_OK:
                if (!di->events.mainextchnotok &&
@@ -1490,7 +1490,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_SAFETY_TIMER_EXPIRED_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_SAFETY_TIMER_EXPIRED);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_SAFETY_TIMER_EXPIRED:
                /* We exit this state when charger is removed */
@@ -1537,7 +1537,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_WAIT_FOR_RECHARGE_INIT:
                abx500_chargalg_hold_charging(di);
                abx500_chargalg_state_to(di, STATE_WAIT_FOR_RECHARGE);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_WAIT_FOR_RECHARGE:
                if (di->batt_data.percent <=
@@ -1558,7 +1558,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                                di->bm->batt_id].maint_a_cur_lvl);
                abx500_chargalg_state_to(di, STATE_MAINTENANCE_A);
                power_supply_changed(di->chargalg_psy);
-               /* Intentional fallthrough*/
+               fallthrough;
 
        case STATE_MAINTENANCE_A:
                if (di->events.maintenance_timer_expired) {
@@ -1578,7 +1578,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                                di->bm->batt_id].maint_b_cur_lvl);
                abx500_chargalg_state_to(di, STATE_MAINTENANCE_B);
                power_supply_changed(di->chargalg_psy);
-               /* Intentional fallthrough*/
+               fallthrough;
 
        case STATE_MAINTENANCE_B:
                if (di->events.maintenance_timer_expired) {
@@ -1597,7 +1597,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
                di->charge_status = POWER_SUPPLY_STATUS_CHARGING;
                abx500_chargalg_state_to(di, STATE_TEMP_LOWHIGH);
                power_supply_changed(di->chargalg_psy);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_TEMP_LOWHIGH:
                if (!di->events.btemp_lowhigh)
@@ -1607,7 +1607,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_WD_EXPIRED_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_WD_EXPIRED);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_WD_EXPIRED:
                if (!di->events.ac_wd_expired &&
@@ -1618,7 +1618,7 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di)
        case STATE_TEMP_UNDEROVER_INIT:
                abx500_chargalg_stop_charging(di);
                abx500_chargalg_state_to(di, STATE_TEMP_UNDEROVER);
-               /* Intentional fallthrough */
+               fallthrough;
 
        case STATE_TEMP_UNDEROVER:
                if (!di->events.btemp_underover)
index d01dc0332edc7826c085d9147d25bb0e4a751327..0eaa86c52874a2e3360be35e1d93f7cd83eaa9e0 100644 (file)
@@ -349,7 +349,7 @@ static int axp20x_usb_power_set_current_max(struct axp20x_usb_power *power,
        case 100000:
                if (power->axp20x_id == AXP221_ID)
                        return -EINVAL;
-               /* fall through */
+               fallthrough;
        case 500000:
        case 900000:
                val = (900000 - intval) / 400000;
index 2a45e84447fe7cb9f2b9becbf31d2e56f087a242..d89e08efd2ad0f0719d32876605a5311af14af35 100644 (file)
@@ -383,7 +383,7 @@ static int cros_usbpd_charger_get_prop(struct power_supply *psy,
                 */
                if (ec_device->mkbp_event_supported || port->psy_online)
                        break;
-               /* fall through */
+               fallthrough;
        case POWER_SUPPLY_PROP_CURRENT_MAX:
        case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
        case POWER_SUPPLY_PROP_VOLTAGE_NOW:
index 5fca4960f440ae00cc740f44e97b8c03470779fd..8878f9131184f716b5512c89125bff3b13cee02a 100644 (file)
@@ -121,7 +121,7 @@ static irqreturn_t max8925_charger_handler(int irq, void *data)
        case MAX8925_IRQ_VCHG_THM_OK_F:
                /* Battery is not ready yet */
                dev_dbg(chip->dev, "Battery temperature is out of range\n");
-               /* Fall through */
+               fallthrough;
        case MAX8925_IRQ_VCHG_DC_OVP:
                dev_dbg(chip->dev, "Error detection\n");
                __set_charger(info, 0);
index 65832bc229f6c7b67f14ffa85c57d68c3dfc0a6a..18b33f14dfeef635453d57015720ca329d82abd7 100644 (file)
@@ -665,7 +665,7 @@ static int wm831x_power_probe(struct platform_device *pdev)
                break;
        default:
                dev_err(&pdev->dev, "Failed to find USB phy: %d\n", ret);
-               /* fall-through */
+               fallthrough;
        case -EPROBE_DEFER:
                goto err_bat_irq;
                break;
index 26923af574f430118067faaffbf2b0faaf90f067..e05cee457471bf1ff39db193930f5090309e1901 100644 (file)
@@ -227,7 +227,7 @@ static irqreturn_t wm8350_charger_handler(int irq, void *data)
        case WM8350_IRQ_EXT_USB_FB:
        case WM8350_IRQ_EXT_WALL_FB:
                wm8350_charger_config(wm8350, policy);
-               /* Fall through */
+               fallthrough;
        case WM8350_IRQ_EXT_BAT_FB:
                power_supply_changed(power->battery);
                power_supply_changed(power->usb);
index 6f55aaef8afc993dec7c82ac7a5473eb94ef5c74..983d75bd5bd19a46efcf4c8d57e39cb1638d6dfb 100644 (file)
@@ -1035,7 +1035,11 @@ static const struct x86_cpu_id rapl_ids[] __initconst = {
        X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L,         &rapl_defaults_core),
        X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE,           &rapl_defaults_core),
        X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L,         &rapl_defaults_core),
+       X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE,           &rapl_defaults_core),
+       X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE,          &rapl_defaults_core),
+       X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE,           &rapl_defaults_core),
        X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X,    &rapl_defaults_spr_server),
+       X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD,           &rapl_defaults_core),
 
        X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT,     &rapl_defaults_byt),
        X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT,        &rapl_defaults_cht),
index 24f04ffdd9861ccbdd64efb75835cc489d0c7e5b..9d66257e1da5c0b37607a34d49711b30efec2879 100644 (file)
@@ -769,7 +769,7 @@ static int ps3av_auto_videomode(struct ps3av_pkt_av_get_hw_conf *av_hw_conf)
                switch (info->monitor_type) {
                case PS3AV_MONITOR_TYPE_DVI:
                        dvi = PS3AV_MODE_DVI;
-                       /* fall through */
+                       fallthrough;
                case PS3AV_MONITOR_TYPE_HDMI:
                        id = ps3av_hdmi_get_id(info);
                        break;
index f0e650cc866e56566d05fedef4946ef83857d484..c22206652f06fd9dcaee9888ab6940fbec7389d6 100644 (file)
@@ -693,11 +693,11 @@ void ps3av_cmd_set_audio_mode(struct ps3av_pkt_audio_mode *audio, u32 avport,
        switch (ch) {
        case PS3AV_CMD_AUDIO_NUM_OF_CH_8:
                audio->audio_enable[3] = 1;
-               /* fall through */
+               fallthrough;
        case PS3AV_CMD_AUDIO_NUM_OF_CH_6:
                audio->audio_enable[2] = 1;
                audio->audio_enable[1] = 1;
-               /* fall through */
+               fallthrough;
        case PS3AV_CMD_AUDIO_NUM_OF_CH_2:
        default:
                audio->audio_enable[0] = 1;
index e4c422d806bee0728d2e51fff25c5881e533d70f..b9f8514909bf016df3bced3d5e53b221355d72c5 100644 (file)
@@ -37,7 +37,7 @@ config RAPIDIO_ENABLE_RX_TX_PORTS
 config RAPIDIO_DMA_ENGINE
        bool "DMA Engine support for RapidIO"
        depends on RAPIDIO
-       select DMADEVICES
+       depends on DMADEVICES
        select DMA_ENGINE
        help
          Say Y here if you want to use DMA Engine frameork for RapidIO data
index c07ceec3c6d4971e6dbbc35e87326b55ff735a3d..a30342942e26f996cab50a7ace832f6886f7dd7b 100644 (file)
@@ -2150,7 +2150,7 @@ static void mport_release_mapping(struct kref *ref)
        switch (map->dir) {
        case MAP_INBOUND:
                rio_unmap_inb_region(mport, map->phys_addr);
-               /* fall through */
+               fallthrough;
        case MAP_DMA:
                dma_free_coherent(mport->dev.parent, map->size,
                                  map->virt_addr, map->phys_addr);
index fbc95cadaf5393d4cb27dfe7bdeaf31895c75e2d..cd1224182ad7435cdbcd60f174376516e2ac969f 100644 (file)
@@ -42,8 +42,9 @@
 
 #define AXP20X_DCDC2_V_OUT_MASK                GENMASK(5, 0)
 #define AXP20X_DCDC3_V_OUT_MASK                GENMASK(7, 0)
-#define AXP20X_LDO24_V_OUT_MASK                GENMASK(7, 4)
+#define AXP20X_LDO2_V_OUT_MASK         GENMASK(7, 4)
 #define AXP20X_LDO3_V_OUT_MASK         GENMASK(6, 0)
+#define AXP20X_LDO4_V_OUT_MASK         GENMASK(3, 0)
 #define AXP20X_LDO5_V_OUT_MASK         GENMASK(7, 4)
 
 #define AXP20X_PWR_OUT_EXTEN_MASK      BIT_MASK(0)
@@ -399,7 +400,7 @@ static int axp20x_set_ramp_delay(struct regulator_dev *rdev, int ramp)
                if (rate_count > 0)
                        break;
 
-               /* fall through */
+               fallthrough;
        default:
                /* Not supported for this regulator */
                return -ENOTSUPP;
@@ -542,14 +543,14 @@ static const struct regulator_desc axp20x_regulators[] = {
                 AXP20X_PWR_OUT_CTRL, AXP20X_PWR_OUT_DCDC3_MASK),
        AXP_DESC_FIXED(AXP20X, LDO1, "ldo1", "acin", 1300),
        AXP_DESC(AXP20X, LDO2, "ldo2", "ldo24in", 1800, 3300, 100,
-                AXP20X_LDO24_V_OUT, AXP20X_LDO24_V_OUT_MASK,
+                AXP20X_LDO24_V_OUT, AXP20X_LDO2_V_OUT_MASK,
                 AXP20X_PWR_OUT_CTRL, AXP20X_PWR_OUT_LDO2_MASK),
        AXP_DESC(AXP20X, LDO3, "ldo3", "ldo3in", 700, 3500, 25,
                 AXP20X_LDO3_V_OUT, AXP20X_LDO3_V_OUT_MASK,
                 AXP20X_PWR_OUT_CTRL, AXP20X_PWR_OUT_LDO3_MASK),
        AXP_DESC_RANGES(AXP20X, LDO4, "ldo4", "ldo24in",
                        axp20x_ldo4_ranges, AXP20X_LDO4_V_OUT_NUM_VOLTAGES,
-                       AXP20X_LDO24_V_OUT, AXP20X_LDO24_V_OUT_MASK,
+                       AXP20X_LDO24_V_OUT, AXP20X_LDO4_V_OUT_MASK,
                        AXP20X_PWR_OUT_CTRL, AXP20X_PWR_OUT_LDO4_MASK),
        AXP_DESC_IO(AXP20X, LDO5, "ldo5", "ldo5in", 1800, 3300, 100,
                    AXP20X_LDO5_V_OUT, AXP20X_LDO5_V_OUT_MASK,
@@ -1022,7 +1023,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
                 * (See include/linux/mfd/axp20x.h)
                 */
                reg = AXP803_DCDC_FREQ_CTRL;
-               /* Fall through - to the check below.*/
+               fallthrough;    /* to the check below */
        case AXP806_ID:
                /*
                 * AXP806 also have DCDC work frequency setting register at a
@@ -1030,7 +1031,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
                 */
                if (axp20x->variant == AXP806_ID)
                        reg = AXP806_DCDC_FREQ_CTRL;
-               /* Fall through */
+               fallthrough;
        case AXP221_ID:
        case AXP223_ID:
        case AXP809_ID:
@@ -1118,7 +1119,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
                 * (See include/linux/mfd/axp20x.h)
                 */
                reg = AXP806_DCDC_MODE_CTRL2;
-                /* Fall through - to the check below. */
+               fallthrough;    /* to the check below */
        case AXP221_ID:
        case AXP223_ID:
        case AXP809_ID:
index 75ff7c563c5d601c75c1af357ee8645a6be0cc6d..7ff507ec875a85a8d904f30f947191091b1ccbfb 100644 (file)
@@ -236,8 +236,8 @@ static bool regulator_supply_is_couple(struct regulator_dev *rdev)
 static void regulator_unlock_recursive(struct regulator_dev *rdev,
                                       unsigned int n_coupled)
 {
-       struct regulator_dev *c_rdev;
-       int i;
+       struct regulator_dev *c_rdev, *supply_rdev;
+       int i, supply_n_coupled;
 
        for (i = n_coupled; i > 0; i--) {
                c_rdev = rdev->coupling_desc.coupled_rdevs[i - 1];
@@ -245,10 +245,13 @@ static void regulator_unlock_recursive(struct regulator_dev *rdev,
                if (!c_rdev)
                        continue;
 
-               if (c_rdev->supply && !regulator_supply_is_couple(c_rdev))
-                       regulator_unlock_recursive(
-                                       c_rdev->supply->rdev,
-                                       c_rdev->coupling_desc.n_coupled);
+               if (c_rdev->supply && !regulator_supply_is_couple(c_rdev)) {
+                       supply_rdev = c_rdev->supply->rdev;
+                       supply_n_coupled = supply_rdev->coupling_desc.n_coupled;
+
+                       regulator_unlock_recursive(supply_rdev,
+                                                  supply_n_coupled);
+               }
 
                regulator_unlock(c_rdev);
        }
@@ -1461,7 +1464,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
                                      const char *consumer_dev_name,
                                      const char *supply)
 {
-       struct regulator_map *node;
+       struct regulator_map *node, *new_node;
        int has_dev;
 
        if (supply == NULL)
@@ -1472,6 +1475,22 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
        else
                has_dev = 0;
 
+       new_node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL);
+       if (new_node == NULL)
+               return -ENOMEM;
+
+       new_node->regulator = rdev;
+       new_node->supply = supply;
+
+       if (has_dev) {
+               new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL);
+               if (new_node->dev_name == NULL) {
+                       kfree(new_node);
+                       return -ENOMEM;
+               }
+       }
+
+       mutex_lock(&regulator_list_mutex);
        list_for_each_entry(node, &regulator_map_list, list) {
                if (node->dev_name && consumer_dev_name) {
                        if (strcmp(node->dev_name, consumer_dev_name) != 0)
@@ -1489,26 +1508,19 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
                         node->regulator->desc->name,
                         supply,
                         dev_name(&rdev->dev), rdev_get_name(rdev));
-               return -EBUSY;
+               goto fail;
        }
 
-       node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL);
-       if (node == NULL)
-               return -ENOMEM;
-
-       node->regulator = rdev;
-       node->supply = supply;
-
-       if (has_dev) {
-               node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL);
-               if (node->dev_name == NULL) {
-                       kfree(node);
-                       return -ENOMEM;
-               }
-       }
+       list_add(&new_node->list, &regulator_map_list);
+       mutex_unlock(&regulator_list_mutex);
 
-       list_add(&node->list, &regulator_map_list);
        return 0;
+
+fail:
+       mutex_unlock(&regulator_list_mutex);
+       kfree(new_node->dev_name);
+       kfree(new_node);
+       return -EBUSY;
 }
 
 static void unset_regulator_supplies(struct regulator_dev *rdev)
@@ -1580,44 +1592,53 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
                                          const char *supply_name)
 {
        struct regulator *regulator;
-       char buf[REG_STR_SIZE];
-       int err, size;
+       int err;
+
+       if (dev) {
+               char buf[REG_STR_SIZE];
+               int size;
+
+               size = snprintf(buf, REG_STR_SIZE, "%s-%s",
+                               dev->kobj.name, supply_name);
+               if (size >= REG_STR_SIZE)
+                       return NULL;
+
+               supply_name = kstrdup(buf, GFP_KERNEL);
+               if (supply_name == NULL)
+                       return NULL;
+       } else {
+               supply_name = kstrdup_const(supply_name, GFP_KERNEL);
+               if (supply_name == NULL)
+                       return NULL;
+       }
 
        regulator = kzalloc(sizeof(*regulator), GFP_KERNEL);
-       if (regulator == NULL)
+       if (regulator == NULL) {
+               kfree(supply_name);
                return NULL;
+       }
 
-       regulator_lock(rdev);
        regulator->rdev = rdev;
+       regulator->supply_name = supply_name;
+
+       regulator_lock(rdev);
        list_add(&regulator->list, &rdev->consumer_list);
+       regulator_unlock(rdev);
 
        if (dev) {
                regulator->dev = dev;
 
                /* Add a link to the device sysfs entry */
-               size = snprintf(buf, REG_STR_SIZE, "%s-%s",
-                               dev->kobj.name, supply_name);
-               if (size >= REG_STR_SIZE)
-                       goto overflow_err;
-
-               regulator->supply_name = kstrdup(buf, GFP_KERNEL);
-               if (regulator->supply_name == NULL)
-                       goto overflow_err;
-
                err = sysfs_create_link_nowarn(&rdev->dev.kobj, &dev->kobj,
-                                       buf);
+                                              supply_name);
                if (err) {
                        rdev_dbg(rdev, "could not add device link %s err %d\n",
                                  dev->kobj.name, err);
                        /* non-fatal */
                }
-       } else {
-               regulator->supply_name = kstrdup_const(supply_name, GFP_KERNEL);
-               if (regulator->supply_name == NULL)
-                       goto overflow_err;
        }
 
-       regulator->debugfs = debugfs_create_dir(regulator->supply_name,
+       regulator->debugfs = debugfs_create_dir(supply_name,
                                                rdev->debugfs);
        if (!regulator->debugfs) {
                rdev_dbg(rdev, "Failed to create debugfs directory\n");
@@ -1642,13 +1663,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
            _regulator_is_enabled(rdev))
                regulator->always_on = true;
 
-       regulator_unlock(rdev);
        return regulator;
-overflow_err:
-       list_del(&regulator->list);
-       kfree(regulator);
-       regulator_unlock(rdev);
-       return NULL;
 }
 
 static int _regulator_get_enable_time(struct regulator_dev *rdev)
@@ -1895,7 +1910,7 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
                case EXCLUSIVE_GET:
                        dev_warn(dev,
                                 "dummy supplies not allowed for exclusive requests\n");
-                       /* fall through */
+                       fallthrough;
 
                default:
                        return ERR_PTR(-ENODEV);
@@ -2230,10 +2245,13 @@ EXPORT_SYMBOL_GPL(regulator_bulk_unregister_supply_alias);
 static int regulator_ena_gpio_request(struct regulator_dev *rdev,
                                const struct regulator_config *config)
 {
-       struct regulator_enable_gpio *pin;
+       struct regulator_enable_gpio *pin, *new_pin;
        struct gpio_desc *gpiod;
 
        gpiod = config->ena_gpiod;
+       new_pin = kzalloc(sizeof(*new_pin), GFP_KERNEL);
+
+       mutex_lock(&regulator_list_mutex);
 
        list_for_each_entry(pin, &regulator_ena_gpio_list, list) {
                if (pin->gpiod == gpiod) {
@@ -2242,9 +2260,13 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev,
                }
        }
 
-       pin = kzalloc(sizeof(struct regulator_enable_gpio), GFP_KERNEL);
-       if (pin == NULL)
+       if (new_pin == NULL) {
+               mutex_unlock(&regulator_list_mutex);
                return -ENOMEM;
+       }
+
+       pin = new_pin;
+       new_pin = NULL;
 
        pin->gpiod = gpiod;
        list_add(&pin->list, &regulator_ena_gpio_list);
@@ -2252,6 +2274,10 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev,
 update_ena_gpio_to_rdev:
        pin->request_count++;
        rdev->ena_pin = pin;
+
+       mutex_unlock(&regulator_list_mutex);
+       kfree(new_pin);
+
        return 0;
 }
 
@@ -2264,19 +2290,19 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev)
 
        /* Free the GPIO only in case of no use */
        list_for_each_entry_safe(pin, n, &regulator_ena_gpio_list, list) {
-               if (pin->gpiod == rdev->ena_pin->gpiod) {
-                       if (pin->request_count <= 1) {
-                               pin->request_count = 0;
-                               gpiod_put(pin->gpiod);
-                               list_del(&pin->list);
-                               kfree(pin);
-                               rdev->ena_pin = NULL;
-                               return;
-                       } else {
-                               pin->request_count--;
-                       }
-               }
+               if (pin != rdev->ena_pin)
+                       continue;
+
+               if (--pin->request_count)
+                       break;
+
+               gpiod_put(pin->gpiod);
+               list_del(&pin->list);
+               kfree(pin);
+               break;
        }
+
+       rdev->ena_pin = NULL;
 }
 
 /**
@@ -4949,13 +4975,9 @@ static void regulator_resolve_coupling(struct regulator_dev *rdev)
                        return;
                }
 
-               regulator_lock(c_rdev);
-
                c_desc->coupled_rdevs[i] = c_rdev;
                c_desc->n_resolved++;
 
-               regulator_unlock(c_rdev);
-
                regulator_resolve_coupling(c_rdev);
        }
 }
@@ -5040,7 +5062,10 @@ static int regulator_init_coupling(struct regulator_dev *rdev)
        if (!of_check_coupling_data(rdev))
                return -EPERM;
 
+       mutex_lock(&regulator_list_mutex);
        rdev->coupling_desc.coupler = regulator_find_coupler(rdev);
+       mutex_unlock(&regulator_list_mutex);
+
        if (IS_ERR(rdev->coupling_desc.coupler)) {
                err = PTR_ERR(rdev->coupling_desc.coupler);
                rdev_err(rdev, "failed to get coupler: %d\n", err);
@@ -5141,6 +5166,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
                ret = -ENOMEM;
                goto rinse;
        }
+       device_initialize(&rdev->dev);
 
        /*
         * Duplicate the config so the driver could override it after
@@ -5148,9 +5174,8 @@ regulator_register(const struct regulator_desc *regulator_desc,
         */
        config = kmemdup(cfg, sizeof(*cfg), GFP_KERNEL);
        if (config == NULL) {
-               kfree(rdev);
                ret = -ENOMEM;
-               goto rinse;
+               goto clean;
        }
 
        init_data = regulator_of_get_init_data(dev, regulator_desc, config,
@@ -5162,10 +5187,8 @@ regulator_register(const struct regulator_desc *regulator_desc,
         * from a gpio extender or something else.
         */
        if (PTR_ERR(init_data) == -EPROBE_DEFER) {
-               kfree(config);
-               kfree(rdev);
                ret = -EPROBE_DEFER;
-               goto rinse;
+               goto clean;
        }
 
        /*
@@ -5206,9 +5229,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
        }
 
        if (config->ena_gpiod) {
-               mutex_lock(&regulator_list_mutex);
                ret = regulator_ena_gpio_request(rdev, config);
-               mutex_unlock(&regulator_list_mutex);
                if (ret != 0) {
                        rdev_err(rdev, "Failed to request enable GPIO: %d\n",
                                 ret);
@@ -5220,7 +5241,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
        }
 
        /* register with sysfs */
-       device_initialize(&rdev->dev);
        rdev->dev.class = &regulator_class;
        rdev->dev.parent = dev;
        dev_set_name(&rdev->dev, "regulator.%lu",
@@ -5248,27 +5268,22 @@ regulator_register(const struct regulator_desc *regulator_desc,
        if (ret < 0)
                goto wash;
 
-       mutex_lock(&regulator_list_mutex);
        ret = regulator_init_coupling(rdev);
-       mutex_unlock(&regulator_list_mutex);
        if (ret < 0)
                goto wash;
 
        /* add consumers devices */
        if (init_data) {
-               mutex_lock(&regulator_list_mutex);
                for (i = 0; i < init_data->num_consumer_supplies; i++) {
                        ret = set_consumer_device_supply(rdev,
                                init_data->consumer_supplies[i].dev_name,
                                init_data->consumer_supplies[i].supply);
                        if (ret < 0) {
-                               mutex_unlock(&regulator_list_mutex);
                                dev_err(dev, "Failed to set supply %s\n",
                                        init_data->consumer_supplies[i].supply);
                                goto unset_supplies;
                        }
                }
-               mutex_unlock(&regulator_list_mutex);
        }
 
        if (!rdev->desc->ops->get_voltage &&
@@ -5303,13 +5318,11 @@ wash:
        mutex_lock(&regulator_list_mutex);
        regulator_ena_gpio_free(rdev);
        mutex_unlock(&regulator_list_mutex);
-       put_device(&rdev->dev);
-       rdev = NULL;
 clean:
        if (dangling_of_gpiod)
                gpiod_put(config->ena_gpiod);
-       kfree(rdev);
        kfree(config);
+       put_device(&rdev->dev);
 rinse:
        if (dangling_cfg_gpiod)
                gpiod_put(cfg->ena_gpiod);
index 3117bbd2826b2d1e42db29853d2541f9e5a0ad92..eb3fc1db4edc8118b0be4133e559e10e1f7a233d 100644 (file)
@@ -170,6 +170,9 @@ static int cros_ec_regulator_init_info(struct device *dev,
        data->voltages_mV =
                devm_kmemdup(dev, resp.voltages_mv,
                             sizeof(u16) * data->num_voltages, GFP_KERNEL);
+       if (!data->voltages_mV)
+               return -ENOMEM;
+
        data->desc.n_voltages = data->num_voltages;
 
        /* Make sure the returned name is always a valid string */
index d54830e48b8dc5671d921b919a7f24db71c8fe38..142a70a8915369423b01d42602d31ddd1aea8b7f 100644 (file)
@@ -182,7 +182,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
 
                drvdata->enable_clock = devm_clk_get(dev, NULL);
                if (IS_ERR(drvdata->enable_clock)) {
-                       dev_err(dev, "Cant get enable-clock from devicetree\n");
+                       dev_err(dev, "Can't get enable-clock from devicetree\n");
                        return -ENOENT;
                }
        } else {
index 3234b118b53ea275f94aa2831c88e2835a7b6a82..990bd50771d8df73885e256e8cb46d3aa6206974 100644 (file)
@@ -279,7 +279,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev,
                return ret;
        }
 
-       drvdata->state                  = -EINVAL;
+       drvdata->state                  = -ENOTRECOVERABLE;
        drvdata->duty_cycle_table       = duty_cycle_table;
        drvdata->desc.ops = &pwm_regulator_voltage_table_ops;
        drvdata->desc.n_voltages        = length / sizeof(*duty_cycle_table);
index 44e4cecbf6dec0600cc2501487a74a3b2bc9fac2..87b020d0b958dd9869a9ec6024f1892fbe651ce9 100644 (file)
@@ -319,7 +319,7 @@ static int slg51000_regulator_init(struct slg51000 *chip)
                                rdesc->linear_min_sel = 0;
                                break;
                        }
-                       /* Fall through - to the check below.*/
+                       fallthrough;    /* to the check below */
 
                default:
                        rdesc->linear_min_sel = vsel_range[0];
index f7db250a75839ece685010fae72817613dadaddb..430265c404d65846733898e2f118739ca46ecdb7 100644 (file)
@@ -312,7 +312,7 @@ static int twl6030smps_list_voltage(struct regulator_dev *rdev, unsigned index)
        switch (info->flags) {
        case SMPS_OFFSET_EN:
                voltage = 100000;
-               /* fall through */
+               fallthrough;
        case 0:
                switch (index) {
                case 0:
index 6955fab0a78b787fa5e908fc1235579a1b96796d..d94b7391bf9ddf24167ca22001c2fe0a242d368d 100644 (file)
@@ -511,7 +511,6 @@ static void omap_rproc_mbox_callback(struct mbox_client *client, void *data)
                dev_info(dev, "received echo reply from %s\n", name);
                break;
        case RP_MBOX_SUSPEND_ACK:
-               /* Fall through */
        case RP_MBOX_SUSPEND_CANCEL:
                oproc->suspend_acked = msg == RP_MBOX_SUSPEND_ACK;
                complete(&oproc->pm_comp);
index d170fe66321060356270ac330dacf9e55975b648..e8aa8691deb2dbc7bbd62153a5b82943a3c253cb 100644 (file)
@@ -222,7 +222,7 @@ static int imx8mq_reset_set(struct reset_controller_dev *rcdev,
 
        switch (id) {
        case IMX8MQ_RESET_PCIEPHY:
-       case IMX8MQ_RESET_PCIEPHY2: /* fallthrough */
+       case IMX8MQ_RESET_PCIEPHY2:
                /*
                 * wait for more than 10us to release phy g_rst and
                 * btnrst
@@ -232,12 +232,12 @@ static int imx8mq_reset_set(struct reset_controller_dev *rcdev,
                break;
 
        case IMX8MQ_RESET_PCIE_CTRL_APPS_EN:
-       case IMX8MQ_RESET_PCIE2_CTRL_APPS_EN:   /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_PCLK_RESET_N:        /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_ESC_RESET_N: /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N: /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_RESET_N:     /* fallthrough */
-       case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N:        /* fallthrough */
+       case IMX8MQ_RESET_PCIE2_CTRL_APPS_EN:
+       case IMX8MQ_RESET_MIPI_DSI_PCLK_RESET_N:
+       case IMX8MQ_RESET_MIPI_DSI_ESC_RESET_N:
+       case IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N:
+       case IMX8MQ_RESET_MIPI_DSI_RESET_N:
+       case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N:
                value = assert ? 0 : bit;
                break;
        }
index 1995f5b3ea6775e22f85dc97461a107fc5b4c561..f40312b16da06528fc11b9ee18589bd7d6728378 100644 (file)
@@ -553,7 +553,7 @@ static void qcom_glink_receive_version(struct qcom_glink *glink,
                break;
        case GLINK_VERSION_1:
                glink->features &= features;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                qcom_glink_send_version_ack(glink);
                break;
@@ -584,7 +584,7 @@ static void qcom_glink_receive_version_ack(struct qcom_glink *glink,
                        break;
 
                glink->features &= features;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                qcom_glink_send_version(glink);
                break;
index 9b70b371bd0c379ef9564d5db0e193973062e975..8a89bc52b0d45122e968e29941ce85c3a16a2384 100644 (file)
@@ -740,7 +740,7 @@ static int wdt_ioctl(struct file *file, unsigned int cmd,
                        return -EINVAL;
                wdt_margin = new_margin;
                wdt_ping();
-               /* Fall through */
+               fallthrough;
        case WDIOC_GETTIMEOUT:
                return put_user(wdt_margin, (int __user *)arg);
 
index ca55ba975aeb19c518fde0b3000b1b123af3c6b4..f8b99cb72959040f5460fd8a567307eff6adaf65 100644 (file)
@@ -353,7 +353,7 @@ static int pcf85063_load_capacitance(struct pcf85063 *pcf85063,
        default:
                dev_warn(&pcf85063->rtc->dev, "Unknown quartz-load-femtofarads value: %d. Assuming 7000",
                         load);
-               /* fall through */
+               fallthrough;
        case 7000:
                break;
        case 12500:
index 47e0f411dd5cb744f84f0fa2269a882b9038e08c..57d351dfe2723306bbf9a42b05e6f3ec64348c03 100644 (file)
@@ -108,7 +108,7 @@ static int pcf8523_load_capacitance(struct i2c_client *client)
        default:
                dev_warn(&client->dev, "Unknown quartz-load-femtofarads value: %d. Assuming 12500",
                         load);
-               /* fall through */
+               fallthrough;
        case 12500:
                value |= REG_CONTROL1_CAP_SEL;
                break;
index c9bc3d4a1e66c40a8897244b7063998c351d2d44..0a969af80af7c0ae96485df94b11190d650e12b8 100644 (file)
@@ -331,7 +331,7 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev)
        default:
                dev_warn(&pdev->dev,
                         "invalid crystal-freq specified in device-tree. Assuming no crystal\n");
-               /* fall-through */
+               fallthrough;
        case 0:
                /* keep XTAL on in low-power mode */
                pers0_set = STMP3XXX_RTC_PERSISTENT0_XTAL24MHZ_PWRUP;
index cbb770824226f664f9daf80afa843af1769586fc..1a44e321b54e1e6dd2cbf0005ed3ceb52ce6df2a 100644 (file)
@@ -40,6 +40,7 @@
 MODULE_LICENSE("GPL");
 
 static struct dasd_discipline dasd_fba_discipline;
+static void *dasd_fba_zero_page;
 
 struct dasd_fba_private {
        struct dasd_fba_characteristics rdc_data;
@@ -270,7 +271,7 @@ static void ccw_write_zero(struct ccw1 *ccw, int count)
        ccw->cmd_code = DASD_FBA_CCW_WRITE;
        ccw->flags |= CCW_FLAG_SLI;
        ccw->count = count;
-       ccw->cda = (__u32) (addr_t) page_to_phys(ZERO_PAGE(0));
+       ccw->cda = (__u32) (addr_t) dasd_fba_zero_page;
 }
 
 /*
@@ -830,6 +831,11 @@ dasd_fba_init(void)
        int ret;
 
        ASCEBC(dasd_fba_discipline.ebcname, 4);
+
+       dasd_fba_zero_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+       if (!dasd_fba_zero_page)
+               return -ENOMEM;
+
        ret = ccw_driver_register(&dasd_fba_driver);
        if (!ret)
                wait_for_device_probe();
@@ -841,6 +847,7 @@ static void __exit
 dasd_fba_cleanup(void)
 {
        ccw_driver_unregister(&dasd_fba_driver);
+       free_page((unsigned long)dasd_fba_zero_page);
 }
 
 module_init(dasd_fba_init);
index 4dbbfd88262cde0fbf71eaf6655103519368faed..f314936b54622d1c3b2228de56ead3f1453e2545 100644 (file)
@@ -1449,7 +1449,8 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
                if (!reqcnt)
                        return -ENOMEM;
                zcrypt_perdev_reqcnt(reqcnt, AP_DEVICES);
-               if (copy_to_user((int __user *) arg, reqcnt, sizeof(reqcnt)))
+               if (copy_to_user((int __user *) arg, reqcnt,
+                                sizeof(u32) * AP_DEVICES))
                        rc = -EFAULT;
                kfree(reqcnt);
                return rc;
index 3f5b61351cde56e77e362b1b14ec133da48ea1aa..c793dcabd551c3cf238a725811baa00324d7a74b 100644 (file)
@@ -1692,9 +1692,9 @@ int cca_findcard2(u32 **apqns, u32 *nr_apqns, u16 cardnr, u16 domain,
        *nr_apqns = 0;
 
        /* fetch status of all crypto cards */
-       device_status = kmalloc_array(MAX_ZDEV_ENTRIES_EXT,
-                                     sizeof(struct zcrypt_device_status_ext),
-                                     GFP_KERNEL);
+       device_status = kvmalloc_array(MAX_ZDEV_ENTRIES_EXT,
+                                      sizeof(struct zcrypt_device_status_ext),
+                                      GFP_KERNEL);
        if (!device_status)
                return -ENOMEM;
        zcrypt_device_status_mask_ext(device_status);
@@ -1762,7 +1762,7 @@ int cca_findcard2(u32 **apqns, u32 *nr_apqns, u16 cardnr, u16 domain,
                verify = 0;
        }
 
-       kfree(device_status);
+       kvfree(device_status);
        return rc;
 }
 EXPORT_SYMBOL(cca_findcard2);
index 3ce99e4db44d5fd573a9500f991d1947a3fe1551..661d2a49bce96a00f61d69230bd65105e6870547 100644 (file)
@@ -1695,7 +1695,7 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg)
                        grp->changed_side = 2;
                        break;
                }
-               /* Else, fall through */
+               fallthrough;
        case MPCG_STATE_XID0IOWAIX:
        case MPCG_STATE_XID7INITW:
        case MPCG_STATE_XID7INITX:
index ab316baa828433ed71390aa96c04f8600c641101..85a1a4533cbebc32fb80638edb29d5461842025d 100644 (file)
@@ -357,7 +357,7 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int))
                /*fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW);*/
                if (callback)
                        grp->send_qllc_disc = 1;
-               /* Else, fall through */
+               fallthrough;
        case MPCG_STATE_XID0IOWAIT:
                fsm_deltimer(&grp->timer);
                grp->outstanding_xid2 = 0;
@@ -1470,7 +1470,7 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg)
                if ((fsm_getstate(rch->fsm) == CH_XID0_PENDING) &&
                   (fsm_getstate(wch->fsm) == CH_XID0_PENDING))
                        break;
-               /* Else, fall through */
+               fallthrough;
        default:
                fsm_event(grp->fsm, MPCG_EVENT_INOP, dev);
        }
@@ -2089,7 +2089,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev)
                        grp->estconnfunc = NULL;
                        break;
                }
-               /* Else, fall through */
+               fallthrough;
        case MPCG_STATE_FLOWC:
        case MPCG_STATE_READY:
                grp->send_qllc_disc = 2;
index bba1b54b8aa390ee910b96418eab8b4747bf84ea..6a739825142370348e8e1ce91d9b00e23f90744c 100644 (file)
@@ -1071,7 +1071,7 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,
                break;
        case -EIO:
                qeth_schedule_recovery(card);
-               /* fall through */
+               fallthrough;
        default:
                qeth_clear_ipacmd_list(card);
                goto err_idx;
@@ -2886,7 +2886,7 @@ void qeth_print_status_message(struct qeth_card *card)
                                card->info.mcl_level[3]);
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case QETH_CARD_TYPE_IQD:
                if (IS_VM_NIC(card) || (card->info.mcl_level[0] & 0x80)) {
                        card->info.mcl_level[0] = (char) _ebcasc[(__u8)
index ebdc03210608957ad3dcca451f9121e4e13ae704..f870c5322bfe7431fc3cf063aaa293acb1894837 100644 (file)
@@ -356,7 +356,7 @@ static void qeth_set_cmd_adv_sup(struct ethtool_link_ksettings *cmd,
                                                     10000baseT_Full);
                ethtool_link_ksettings_add_link_mode(cmd, advertising,
                                                     10000baseT_Full);
-               /* fall through */
+               fallthrough;
        case SPEED_1000:
                ethtool_link_ksettings_add_link_mode(cmd, supported,
                                                     1000baseT_Full);
@@ -366,7 +366,7 @@ static void qeth_set_cmd_adv_sup(struct ethtool_link_ksettings *cmd,
                                                     1000baseT_Half);
                ethtool_link_ksettings_add_link_mode(cmd, advertising,
                                                     1000baseT_Half);
-               /* fall through */
+               fallthrough;
        case SPEED_100:
                ethtool_link_ksettings_add_link_mode(cmd, supported,
                                                     100baseT_Full);
@@ -376,7 +376,7 @@ static void qeth_set_cmd_adv_sup(struct ethtool_link_ksettings *cmd,
                                                     100baseT_Half);
                ethtool_link_ksettings_add_link_mode(cmd, advertising,
                                                     100baseT_Half);
-               /* fall through */
+               fallthrough;
        case SPEED_10:
                ethtool_link_ksettings_add_link_mode(cmd, supported,
                                                     10baseT_Full);
index 8b342a88ff5cb9c8ab8d0c5e49ee655632fa78f9..6384f7adba6600b8d6b756f3b5487102676d78e5 100644 (file)
@@ -284,11 +284,11 @@ static void qeth_l2_stop_card(struct qeth_card *card)
 
        if (card->state == CARD_STATE_SOFTSETUP) {
                qeth_clear_ipacmd_list(card);
-               qeth_drain_output_queues(card);
                card->state = CARD_STATE_DOWN;
        }
 
        qeth_qdio_clear_card(card, 0);
+       qeth_drain_output_queues(card);
        qeth_clear_working_pool_list(card);
        flush_workqueue(card->event_wq);
        qeth_flush_local_addrs(card);
@@ -488,7 +488,7 @@ static void qeth_l2_rx_mode_work(struct work_struct *work)
                                kfree(mac);
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        /* for next call to set_rx_mode(): */
                        mac->disp_flag = QETH_DISP_ADDR_DELETE;
index fe44b0249e34ad3d8eb8ee0940e132617547974e..09ef518ca1eafc08208ffb9f3af10bd602d8db04 100644 (file)
@@ -1168,11 +1168,11 @@ static void qeth_l3_stop_card(struct qeth_card *card)
        if (card->state == CARD_STATE_SOFTSETUP) {
                qeth_l3_clear_ip_htable(card, 1);
                qeth_clear_ipacmd_list(card);
-               qeth_drain_output_queues(card);
                card->state = CARD_STATE_DOWN;
        }
 
        qeth_qdio_clear_card(card, 0);
+       qeth_drain_output_queues(card);
        qeth_clear_working_pool_list(card);
        flush_workqueue(card->event_wq);
        qeth_flush_local_addrs(card);
@@ -1235,7 +1235,7 @@ static void qeth_l3_rx_mode_work(struct work_struct *work)
                                        break;
                                }
                                addr->ref_counter = 1;
-                               /* fall through */
+                               fallthrough;
                        default:
                                /* for next call to set_rx_mode(): */
                                addr->disp_flag = QETH_DISP_ADDR_DELETE;
index 461b3babb601ef4894da677acb196745c2a4c0b2..84b57a8f86bfa942fd78fa8f17c27ff9302d9df2 100644 (file)
@@ -1832,7 +1832,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
        case REQUEST_SENSE:
                /* clear the internal sense magic */
                SCp->cmnd[6] = 0;
-               /* fall through */
+               fallthrough;
        default:
                /* OK, get it from the command */
                switch(SCp->sc_data_direction) {
index bb49d83cadc787c52d10c1f899cefc5531626551..ccb061ab0a0ad2bf11819a98cfc5040831381b2a 100644 (file)
@@ -2635,7 +2635,7 @@ static int blogic_resultcode(struct blogic_adapter *adapter,
        case BLOGIC_BAD_CMD_PARAM:
                blogic_warn("BusLogic Driver Protocol Error 0x%02X\n",
                                adapter, adapter_status);
-               /* fall through */
+               fallthrough;
        case BLOGIC_DATA_UNDERRUN:
        case BLOGIC_DATA_OVERRUN:
        case BLOGIC_NOEXPECT_BUSFREE:
index 0f17bd51088ac7890c94cda8b887b6a7aae3e5e6..24ace18240480a212137e277b3bfa864d90cb6b3 100644 (file)
@@ -1034,11 +1034,14 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)
                        temp6 >>= 1;
                        switch (temp & 0x3) {
                        case AUTO_RATE_20:      /* Synchronous, 20 mega-transfers/second */
-                               temp6 |= 0x8000;        /* Fall through */
+                               temp6 |= 0x8000;
+                               fallthrough;
                        case AUTO_RATE_10:      /* Synchronous, 10 mega-transfers/second */
-                               temp5 |= 0x8000;        /* Fall through */
+                               temp5 |= 0x8000;
+                               fallthrough;
                        case AUTO_RATE_05:      /* Synchronous, 5 mega-transfers/second */
-                               temp2 |= 0x8000;        /* Fall through */
+                               temp2 |= 0x8000;
+                               fallthrough;
                        case AUTO_RATE_00:      /* Asynchronous */
                                break;
                        }
index f2f7e6e76c07ac10b4bbf8f99a5d74c1315d960d..d654a6cc4162f8ff7a8dcf9675886f816b09bc5b 100644 (file)
@@ -1943,7 +1943,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
                                                return;
 
                                        /* Reject message */
-                                       /* Fall through */
+                                       fallthrough;
                                default:
                                        /*
                                         * If we get something weird that we aren't expecting,
index 769af4ca9ca97e675c48e6a15750132b1969cf56..fd6ae5c380861c0917a5fd78ae3f0806a021138a 100644 (file)
@@ -2809,7 +2809,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
                                            !(dev->raw_io_64) ||
                                            ((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
                                                break;
-                                       /* fall through */
+                                       fallthrough;
                                case INQUIRY:
                                case READ_CAPACITY:
                                case TEST_UNIT_READY:
@@ -2884,7 +2884,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
                /* Issue FIB to tell Firmware to flush it's cache */
                if ((aac_cache & 6) != 2)
                        return aac_synchronize(scsicmd);
-               /* fall through */
+               fallthrough;
        case INQUIRY:
        {
                struct inquiry_data inq_data;
@@ -3240,7 +3240,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
                                     SCSI_SENSE_BUFFERSIZE));
                        break;
                }
-               /* fall through */
+               fallthrough;
        case RESERVE:
        case RELEASE:
        case REZERO_UNIT:
@@ -3253,7 +3253,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
        case START_STOP:
                return aac_start_stop(scsicmd);
 
-       /* FALLTHRU */
+               fallthrough;
        default:
        /*
         *      Unhandled commands
index adbdc3b7c7a706e0151c698f84c73251157a05e8..383e74fea6edf13fde747411b09db04b4e44e140 100644 (file)
@@ -1431,7 +1431,7 @@ retry_next:
                                                "enclosure services event");
                                scsi_device_set_state(device, SDEV_RUNNING);
                        }
-                       /* FALLTHRU */
+                       fallthrough;
                case CHANGE:
                        if ((channel == CONTAINER_CHANNEL)
                         && (!dev->fsa_dev[container].valid)) {
index 8588da0a065551a6db065257c87a61f4ef9360a7..a3aee146537bc839db65f503e71b775f67dc2ba0 100644 (file)
@@ -765,7 +765,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
                            !(aac->raw_io_64) ||
                            ((cmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
                                break;
-                       /* fall through */
+                       fallthrough;
                case INQUIRY:
                case READ_CAPACITY:
                        /*
index c912d29b8bdf7bc302753792a1d859d611649391..1c617c0d5899f302900c8c443f84ecaea4b3a347 100644 (file)
@@ -2274,7 +2274,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
                        switch (scb->hscb->task_management) {
                        case SIU_TASKMGMT_ABORT_TASK:
                                tag = SCB_GET_TAG(scb);
-                               /* fall through */
+                               fallthrough;
                        case SIU_TASKMGMT_ABORT_TASK_SET:
                        case SIU_TASKMGMT_CLEAR_TASK_SET:
                                lun = scb->hscb->lun;
@@ -2285,7 +2285,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
                                break;
                        case SIU_TASKMGMT_LUN_RESET:
                                lun = scb->hscb->lun;
-                               /* fall through */
+                               fallthrough;
                        case SIU_TASKMGMT_TARGET_RESET:
                        {
                                struct ahd_devinfo devinfo;
@@ -3791,7 +3791,7 @@ ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo,
                        *bus_width = MSG_EXT_WDTR_BUS_16_BIT;
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_EXT_WDTR_BUS_8_BIT:
                *bus_width = MSG_EXT_WDTR_BUS_8_BIT;
                break;
@@ -5104,7 +5104,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
                break;
        case MSG_MESSAGE_REJECT:
                response = ahd_handle_msg_reject(ahd, devinfo);
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_NOOP:
                done = MSGLOOP_MSGCOMPLETE;
                break;
@@ -5454,7 +5454,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
                               ahd_name(ahd), ahd_inb(ahd, SCSISIGI));
 #endif
                ahd->msg_flags |= MSG_FLAG_EXPECT_QASREJ_BUSFREE;
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_TERM_IO_PROC:
        default:
                reject = TRUE;
@@ -6117,17 +6117,17 @@ ahd_free(struct ahd_softc *ahd)
        default:
        case 5:
                ahd_shutdown(ahd);
-               /* FALLTHROUGH */
+               fallthrough;
        case 4:
                ahd_dmamap_unload(ahd, ahd->shared_data_dmat,
                                  ahd->shared_data_map.dmamap);
-               /* FALLTHROUGH */
+               fallthrough;
        case 3:
                ahd_dmamem_free(ahd, ahd->shared_data_dmat, ahd->qoutfifo,
                                ahd->shared_data_map.dmamap);
                ahd_dmamap_destroy(ahd, ahd->shared_data_dmat,
                                   ahd->shared_data_map.dmamap);
-               /* FALLTHROUGH */
+               fallthrough;
        case 2:
                ahd_dma_tag_destroy(ahd, ahd->shared_data_dmat);
        case 1:
@@ -6513,7 +6513,7 @@ ahd_fini_scbdata(struct ahd_softc *ahd)
                }
                ahd_dma_tag_destroy(ahd, scb_data->sense_dmat);
        }
-               /* fall through */
+               fallthrough;
        case 6:
        {
                struct map_node *sg_map;
@@ -6528,7 +6528,7 @@ ahd_fini_scbdata(struct ahd_softc *ahd)
                }
                ahd_dma_tag_destroy(ahd, scb_data->sg_dmat);
        }
-               /* fall through */
+               fallthrough;
        case 5:
        {
                struct map_node *hscb_map;
@@ -7171,7 +7171,7 @@ ahd_init(struct ahd_softc *ahd)
                case FLX_CSTAT_OVER:
                case FLX_CSTAT_UNDER:
                        warn_user++;
-                       /* fall through */
+                       fallthrough;
                case FLX_CSTAT_INVALID:
                case FLX_CSTAT_OKAY:
                        if (warn_user == 0 && bootverbose == 0)
@@ -8175,12 +8175,12 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
                                if ((scb->flags & SCB_ACTIVE) == 0)
                                        printk("Inactive SCB in qinfifo\n");
                                ahd_done_with_status(ahd, scb, status);
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case SEARCH_REMOVE:
                                break;
                        case SEARCH_PRINT:
                                printk(" 0x%x", ahd->qinfifo[qinpos]);
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case SEARCH_COUNT:
                                ahd_qinfifo_requeue(ahd, prev_scb, scb);
                                prev_scb = scb;
@@ -8271,7 +8271,7 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
                                if ((mk_msg_scb->flags & SCB_ACTIVE) == 0)
                                        printk("Inactive SCB pending MK_MSG\n");
                                ahd_done_with_status(ahd, mk_msg_scb, status);
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case SEARCH_REMOVE:
                        {
                                u_int tail_offset;
@@ -8295,7 +8295,7 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel,
                        }
                        case SEARCH_PRINT:
                                printk(" 0x%x", SCB_GET_TAG(scb));
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case SEARCH_COUNT:
                                break;
                        }
@@ -8376,7 +8376,7 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel,
                        if ((scb->flags & SCB_ACTIVE) == 0)
                                printk("Inactive SCB in Waiting List\n");
                        ahd_done_with_status(ahd, scb, status);
-                       /* fall through */
+                       fallthrough;
                case SEARCH_REMOVE:
                        ahd_rem_wscb(ahd, scbid, prev, next, tid);
                        *list_tail = prev;
@@ -8385,7 +8385,7 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel,
                        break;
                case SEARCH_PRINT:
                        printk("0x%x ", scbid);
-                       /* fall through */
+                       fallthrough;
                case SEARCH_COUNT:
                        prev = scbid;
                        break;
@@ -9023,7 +9023,7 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
        case SCSI_STATUS_OK:
                printk("%s: Interrupted for status of 0???\n",
                       ahd_name(ahd));
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                ahd_done(ahd, scb);
                break;
@@ -9512,7 +9512,7 @@ ahd_download_instr(struct ahd_softc *ahd, u_int instrptr, uint8_t *dconsts)
                fmt3_ins = &instr.format3;
                fmt3_ins->address = ahd_resolve_seqaddr(ahd, fmt3_ins->address);
        }
-               /* fall through */
+               fallthrough;
        case AIC_OP_OR:
        case AIC_OP_AND:
        case AIC_OP_XOR:
@@ -9523,7 +9523,7 @@ ahd_download_instr(struct ahd_softc *ahd, u_int instrptr, uint8_t *dconsts)
                        fmt1_ins->immediate = dconsts[fmt1_ins->immediate];
                }
                fmt1_ins->parity = 0;
-               /* fall through */
+               fallthrough;
        case AIC_OP_ROL:
        {
                int i, count;
index d019e3f2bb9b3c038dedb981ead9fca0cb167d40..7c321303969eb0b15e715363782662b3bebe9078 100644 (file)
@@ -2035,7 +2035,7 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)
                break;
        case CAM_AUTOSENSE_FAIL:
                new_status = DID_ERROR;
-               /* Fallthrough */
+               fallthrough;
        case CAM_SCSI_STATUS_ERROR:
                scsi_status = ahd_cmd_get_scsi_status(cmd);
 
index 3d4df906fa4f4e4d470b40f6b81d5f768640fa2d..2231c4afa531bbcb213eca31361f4f528210fb73 100644 (file)
@@ -2404,7 +2404,7 @@ ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo,
                        *bus_width = MSG_EXT_WDTR_BUS_16_BIT;
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_EXT_WDTR_BUS_8_BIT:
                *bus_width = MSG_EXT_WDTR_BUS_8_BIT;
                break;
@@ -3599,7 +3599,7 @@ ahc_parse_msg(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
                break;
        case MSG_MESSAGE_REJECT:
                response = ahc_handle_msg_reject(ahc, devinfo);
-               /* FALLTHROUGH */
+               fallthrough;
        case MSG_NOOP:
                done = MSGLOOP_MSGCOMPLETE;
                break;
@@ -4465,17 +4465,17 @@ ahc_free(struct ahc_softc *ahc)
        default:
        case 5:
                ahc_shutdown(ahc);
-               /* FALLTHROUGH */
+               fallthrough;
        case 4:
                ahc_dmamap_unload(ahc, ahc->shared_data_dmat,
                                  ahc->shared_data_dmamap);
-               /* FALLTHROUGH */
+               fallthrough;
        case 3:
                ahc_dmamem_free(ahc, ahc->shared_data_dmat, ahc->qoutfifo,
                                ahc->shared_data_dmamap);
                ahc_dmamap_destroy(ahc, ahc->shared_data_dmat,
                                   ahc->shared_data_dmamap);
-               /* FALLTHROUGH */
+               fallthrough;
        case 2:
                ahc_dma_tag_destroy(ahc, ahc->shared_data_dmat);
        case 1:
@@ -4893,30 +4893,30 @@ ahc_fini_scbdata(struct ahc_softc *ahc)
                }
                ahc_dma_tag_destroy(ahc, scb_data->sg_dmat);
        }
-               /* fall through */
+               fallthrough;
        case 6:
                ahc_dmamap_unload(ahc, scb_data->sense_dmat,
                                  scb_data->sense_dmamap);
-               /* fall through */
+               fallthrough;
        case 5:
                ahc_dmamem_free(ahc, scb_data->sense_dmat, scb_data->sense,
                                scb_data->sense_dmamap);
                ahc_dmamap_destroy(ahc, scb_data->sense_dmat,
                                   scb_data->sense_dmamap);
-               /* fall through */
+               fallthrough;
        case 4:
                ahc_dma_tag_destroy(ahc, scb_data->sense_dmat);
-               /* fall through */
+               fallthrough;
        case 3:
                ahc_dmamap_unload(ahc, scb_data->hscb_dmat,
                                  scb_data->hscb_dmamap);
-               /* fall through */
+               fallthrough;
        case 2:
                ahc_dmamem_free(ahc, scb_data->hscb_dmat, scb_data->hscbs,
                                scb_data->hscb_dmamap);
                ahc_dmamap_destroy(ahc, scb_data->hscb_dmat,
                                   scb_data->hscb_dmamap);
-               /* fall through */
+               fallthrough;
        case 1:
                ahc_dma_tag_destroy(ahc, scb_data->hscb_dmat);
                break;
@@ -5981,7 +5981,7 @@ ahc_search_qinfifo(struct ahc_softc *ahc, int target, char channel,
                                        printk("Inactive SCB in Waiting List\n");
                                ahc_done(ahc, scb);
                        }
-                               /* fall through */
+                               fallthrough;
                        case SEARCH_REMOVE:
                                next = ahc_rem_wscb(ahc, next, prev);
                                break;
@@ -6987,7 +6987,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
                address -= address_offset;
                fmt3_ins->address = address;
        }
-               /* fall through */
+               fallthrough;
        case AIC_OP_OR:
        case AIC_OP_AND:
        case AIC_OP_XOR:
@@ -7013,7 +7013,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
                        fmt1_ins->opcode = AIC_OP_AND;
                        fmt1_ins->immediate = 0xff;
                }
-               /* fall through */
+               fallthrough;
        case AIC_OP_ROL:
                if ((ahc->features & AHC_ULTRA2) != 0) {
                        int i, count;
index c264b4b56970b1a8050a5def47c37a2d77364aa3..e2d880a5f391535cc9fb37f1bac604ac6280c401 100644 (file)
@@ -706,11 +706,11 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd)
        switch (pd->max_sas_lrate) {
        case SAS_LINK_RATE_6_0_GBPS:
                *speed_mask &= ~SAS_SPEED_60_DIS;
-               /* fall through*/
+               fallthrough;
        default:
        case SAS_LINK_RATE_3_0_GBPS:
                *speed_mask &= ~SAS_SPEED_30_DIS;
-               /* fall through*/
+               fallthrough;
        case SAS_LINK_RATE_1_5_GBPS:
                *speed_mask &= ~SAS_SPEED_15_DIS;
        }
@@ -718,7 +718,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd)
        switch (pd->min_sas_lrate) {
        case SAS_LINK_RATE_6_0_GBPS:
                *speed_mask |= SAS_SPEED_30_DIS;
-               /* fall through*/
+               fallthrough;
        case SAS_LINK_RATE_3_0_GBPS:
                *speed_mask |= SAS_SPEED_15_DIS;
        default:
@@ -730,7 +730,7 @@ static void set_speed_mask(u8 *speed_mask, struct asd_phy_desc *pd)
        switch (pd->max_sata_lrate) {
        case SAS_LINK_RATE_3_0_GBPS:
                *speed_mask &= ~SATA_SPEED_30_DIS;
-               /* fall through*/
+               fallthrough;
        default:
        case SAS_LINK_RATE_1_5_GBPS:
                *speed_mask &= ~SATA_SPEED_15_DIS;
@@ -789,7 +789,7 @@ void asd_build_control_phy(struct asd_ascb *ascb, int phy_id, u8 subfunc)
 
                /* link reset retries, this should be nominal */
                control_phy->link_reset_retries = 10;
-               /* fall through */
+               fallthrough;
 
        case RELEASE_SPINUP_HOLD: /* 0x02 */
                /* decide the func_mask */
index 1fcee65193a33e0245c10599681bc75a1ef59ded..0eb6e206a2b48f2ddf0c1169963fcc9c9f085cb2 100644 (file)
@@ -490,7 +490,7 @@ int asd_abort_task(struct sas_task *task)
                switch (tcs.dl_opcode) {
                default:
                        res = asd_clear_nexus(task);
-                       /* fallthrough */
+                       fallthrough;
                case TC_NO_ERROR:
                        break;
                        /* The task hasn't been sent to the device xor
index fa562a085600ded315af1e20442e2372ff4d31e6..ec895d0319f02ff45e5c0387c4c3338438ef92d3 100644 (file)
@@ -4470,7 +4470,7 @@ static const char *arcmsr_info(struct Scsi_Host *host)
        case PCI_DEVICE_ID_ARECA_1202:
        case PCI_DEVICE_ID_ARECA_1210:
                raid6 = 0;
-               /*FALLTHRU*/
+               fallthrough;
        case PCI_DEVICE_ID_ARECA_1120:
        case PCI_DEVICE_ID_ARECA_1130:
        case PCI_DEVICE_ID_ARECA_1160:
index 6c68c23036383406d65f328ba4bfeac88aa2521b..2e687ce6075383a8338c0acd5ed908276e072539 100644 (file)
@@ -603,7 +603,7 @@ static void fas216_handlesync(FAS216_Info *info, char *msg)
                msgqueue_flush(&info->scsi.msgs);
                msgqueue_addmsg(&info->scsi.msgs, 1, MESSAGE_REJECT);
                info->scsi.phase = PHASE_MSGOUT_EXPECT;
-               /* fall through */
+               fallthrough;
 
        case async:
                dev->period = info->ifcfg.asyncperiod / 4;
@@ -916,7 +916,7 @@ static void fas216_disconnect_intr(FAS216_Info *info)
                        fas216_done(info, DID_ABORT);
                        break;
                }
-               /* else, fall through */
+               fallthrough;
 
        default:                                /* huh?                                 */
                printk(KERN_ERR "scsi%d.%c: unexpected disconnect in phase %s\n",
@@ -1413,7 +1413,7 @@ static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne
        case STATE(STAT_STATUS, PHASE_DATAOUT): /* Data Out     -> Status       */
        case STATE(STAT_STATUS, PHASE_DATAIN):  /* Data In      -> Status       */
                fas216_stoptransfer(info);
-               /* fall through */
+               fallthrough;
 
        case STATE(STAT_STATUS, PHASE_SELSTEPS):/* Sel w/ steps -> Status       */
        case STATE(STAT_STATUS, PHASE_MSGOUT):  /* Message Out  -> Status       */
@@ -1426,7 +1426,7 @@ static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigne
        case STATE(STAT_MESGIN, PHASE_DATAOUT): /* Data Out     -> Message In   */
        case STATE(STAT_MESGIN, PHASE_DATAIN):  /* Data In      -> Message In   */
                fas216_stoptransfer(info);
-               /* fall through */
+               fallthrough;
 
        case STATE(STAT_MESGIN, PHASE_COMMAND): /* Command      -> Message In   */
        case STATE(STAT_MESGIN, PHASE_SELSTEPS):/* Sel w/ steps -> Message In   */
@@ -1581,7 +1581,7 @@ static void fas216_funcdone_intr(FAS216_Info *info, unsigned int stat, unsigned
                        fas216_message(info);
                        break;
                }
-               /* else, fall through */
+               fallthrough;
 
        default:
                fas216_log(info, 0, "internal phase %s for function done?"
@@ -1964,7 +1964,7 @@ static void fas216_kick(FAS216_Info *info)
        switch (where_from) {
        case TYPE_QUEUE:
                fas216_allocate_tag(info, SCpnt);
-               /* fall through */
+               fallthrough;
        case TYPE_OTHER:
                fas216_start_command(info, SCpnt);
                break;
index 93da6344424dd7e53d7a03a5d4736828be9c3f53..a13c203ef7a9a88260cfb430ab4f537498f17963 100644 (file)
@@ -677,7 +677,7 @@ int beiscsi_set_param(struct iscsi_cls_conn *cls_conn,
        case ISCSI_PARAM_MAX_XMIT_DLENGTH:
                if (conn->max_xmit_dlength > 65536)
                        conn->max_xmit_dlength = 65536;
-               /* fall through */
+               fallthrough;
        default:
                return 0;
        }
index 8dc2e0824ad78261ed450602f6a0e84766b9fad6..5c3513a4b450ed417ce17007f677e4aca518b31b 100644 (file)
@@ -1532,7 +1532,7 @@ beiscsi_hdl_get_handle(struct beiscsi_conn *beiscsi_conn,
                break;
        case UNSOL_DATA_DIGEST_ERROR_NOTIFY:
                error = 1;
-               /* fall through */
+               fallthrough;
        case UNSOL_DATA_NOTIFY:
                pasync_handle = pasync_ctx->async_entry[ci].data;
                break;
index 29f99561dfc3ad39d55075b84377d2e1ebf208e0..38d1c453074dc1d91198d1aed575b18f40c1afbe 100644 (file)
@@ -2572,7 +2572,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
        case FCP_IODIR_RW:
                bfa_stats(itnim, input_reqs);
                bfa_stats(itnim, output_reqs);
-               /* fall through */
+               fallthrough;
        default:
                bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_fn_lpu(ioim->bfa));
        }
@@ -2807,7 +2807,7 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
 
        case BFI_IOIM_STS_TIMEDOUT:
                bfa_stats(ioim->itnim, iocomp_timedout);
-               /* fall through */
+               fallthrough;
        case BFI_IOIM_STS_ABORTED:
                rsp->io_status = BFI_IOIM_STS_ABORTED;
                bfa_stats(ioim->itnim, iocomp_aborted);
@@ -3203,7 +3203,7 @@ bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim,
        switch (event) {
        case BFA_TSKIM_SM_DONE:
                bfa_reqq_wcancel(&tskim->reqq_wait);
-               /* fall through */
+               fallthrough;
        case BFA_TSKIM_SM_QRESUME:
                bfa_sm_set_state(tskim, bfa_tskim_sm_cleanup);
                bfa_tskim_send_abort(tskim);
index 297a77f5806ccf46bb2fe96805966b46a26feb62..3486e402bfc1f3a2d410c85f03d27ee755f5922d 100644 (file)
@@ -6422,7 +6422,7 @@ bfa_fcs_vport_sm_logo_for_stop(struct bfa_fcs_vport_s *vport,
        switch (event) {
        case BFA_FCS_VPORT_SM_OFFLINE:
                bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE);
-               /* fall through */
+               fallthrough;
 
        case BFA_FCS_VPORT_SM_RSP_OK:
        case BFA_FCS_VPORT_SM_RSP_ERROR:
@@ -6448,7 +6448,7 @@ bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport,
        switch (event) {
        case BFA_FCS_VPORT_SM_OFFLINE:
                bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE);
-               /* fall through */
+               fallthrough;
 
        case BFA_FCS_VPORT_SM_RSP_OK:
        case BFA_FCS_VPORT_SM_RSP_ERROR:
index 143c35bd668c2626157dae76add4e0d92f9a1b67..c21aa37b8adbe483c22f56eee3589d3b9cbc7ea9 100644 (file)
@@ -419,13 +419,13 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event)
 
        case RPSM_EVENT_LOGO_RCVD:
                bfa_fcs_rport_send_logo_acc(rport);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_PRLO_RCVD:
                if (rport->prlo == BFA_TRUE)
                        bfa_fcs_rport_send_prlo_acc(rport);
 
                bfa_fcxp_discard(rport->fcxp);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_FAILED:
                if (rport->plogi_retries < BFA_FCS_RPORT_MAX_RETRIES) {
                        rport->plogi_retries++;
@@ -856,7 +856,7 @@ bfa_fcs_rport_sm_adisc_online(struct bfa_fcs_rport_s *rport,
                 * At least go offline when a PLOGI is received.
                 */
                bfa_fcxp_discard(rport->fcxp);
-               /* fall through */
+               fallthrough;
 
        case RPSM_EVENT_FAILED:
        case RPSM_EVENT_ADDRESS_CHANGE:
@@ -1042,7 +1042,7 @@ bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport,
 
        case RPSM_EVENT_LOGO_RCVD:
                bfa_fcs_rport_send_logo_acc(rport);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_PRLO_RCVD:
                if (rport->prlo == BFA_TRUE)
                        bfa_fcs_rport_send_prlo_acc(rport);
@@ -1131,7 +1131,7 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport,
                        bfa_fcs_rport_send_plogiacc(rport, NULL);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case RPSM_EVENT_ADDRESS_CHANGE:
                if (!bfa_fcs_lport_is_online(rport->port)) {
@@ -1288,7 +1288,7 @@ bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport,
 
        case RPSM_EVENT_LOGO_RCVD:
                bfa_fcs_rport_send_logo_acc(rport);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_PRLO_RCVD:
                if (rport->prlo == BFA_TRUE)
                        bfa_fcs_rport_send_prlo_acc(rport);
@@ -1332,7 +1332,7 @@ bfa_fcs_rport_sm_logo_sending(struct bfa_fcs_rport_s *rport,
 
        case RPSM_EVENT_LOGO_RCVD:
                bfa_fcs_rport_send_logo_acc(rport);
-               /* fall through */
+               fallthrough;
        case RPSM_EVENT_PRLO_RCVD:
                if (rport->prlo == BFA_TRUE)
                        bfa_fcs_rport_send_prlo_acc(rport);
index dd5821dfcac2d68585d3a4276bfdada0b943228e..325ad8a592bbc7bb26e60dcf5eda25b0d8d95524 100644 (file)
@@ -969,7 +969,7 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event)
 
        case IOCPF_E_INITFAIL:
                bfa_iocpf_timer_stop(ioc);
-               /* fall through */
+               fallthrough;
 
        case IOCPF_E_TIMEOUT:
                writel(1, ioc->ioc_regs.ioc_sem_reg);
@@ -1045,7 +1045,7 @@ bfa_iocpf_sm_disabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event)
 
        case IOCPF_E_FAIL:
                bfa_iocpf_timer_stop(ioc);
-               /* fall through */
+               fallthrough;
 
        case IOCPF_E_TIMEOUT:
                bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL);
@@ -5988,7 +5988,7 @@ bfa_dconf_sm_final_sync(struct bfa_dconf_mod_s *dconf,
        case BFA_DCONF_SM_IOCDISABLE:
        case BFA_DCONF_SM_FLASH_COMP:
                bfa_timer_stop(&dconf->timer);
-               /* fall through */
+               fallthrough;
        case BFA_DCONF_SM_TIMEOUT:
                bfa_sm_set_state(dconf, bfa_dconf_sm_uninit);
                bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_DCONF_DONE);
index 1e266c1ef7938f01a8c449845062f578294e645c..11c0c3e6f014ff6401803dd6f4c77305120b153e 100644 (file)
@@ -6397,7 +6397,7 @@ bfa_dport_sm_starting(struct bfa_dport_s *dport, enum bfa_dport_sm_event event)
                        dport->test_state = BFA_DPORT_ST_INP;
                        bfa_dport_result_start(dport, BFA_DPORT_OPMODE_MANU);
                }
-               /* fall thru */
+               fallthrough;
 
        case BFA_DPORT_SM_REQFAIL:
                bfa_sm_set_state(dport, bfa_dport_sm_enabled);
index e72d7bb7f4f42f3e6cb465d28fbc6424cc616985..08992095ce7ae2a5bfb54d1e151d4634706ff3ed 100644 (file)
@@ -1404,7 +1404,6 @@ void bnx2fc_indicate_kcqe(void *context, struct kcqe *kcq[],
                        break;
 
                case FCOE_KCQE_OPCODE_FCOE_ERROR:
-                       /* fall thru */
                default:
                        printk(KERN_ERR PFX "unknown opcode 0x%x\n",
                                                                kcqe->op_code);
index 98d4d39aaa572473896ec17c895a7f4254c1a6bc..7fa20609d5e7f51f89155bbdfd2a95af7a9b8f76 100644 (file)
@@ -2939,7 +2939,7 @@ csio_hws_quiescing(struct csio_hw *hw, enum csio_hw_ev evt)
                case CSIO_HWE_FW_DLOAD:
                        csio_set_state(&hw->sm, csio_hws_resetting);
                        /* Download firmware */
-                       /* Fall through */
+                       fallthrough;
 
                case CSIO_HWE_HBA_RESET:
                        csio_set_state(&hw->sm, csio_hws_resetting);
index 61cf54208451a591830c6448ba821f8ec0afe548..dc98f51f466fb3e0d3bc51034beaad0e05d5f348 100644 (file)
@@ -1187,7 +1187,6 @@ csio_lns_online(struct csio_lnode *ln, enum csio_ln_ev evt)
                break;
 
        case CSIO_LNE_LINK_DOWN:
-               /* Fall through */
        case CSIO_LNE_DOWN_LINK:
                csio_set_state(&ln->sm, csio_lns_uninit);
                if (csio_is_phys_ln(ln)) {
index 0ca695110f5493668b36f2e3375ae84163f6ee43..9010cb6045dc54fe39aa75e7c85c2ea0a6c57a89 100644 (file)
@@ -808,7 +808,7 @@ csio_wr_destroy_queues(struct csio_hw *hw, bool cmd)
 
                                csio_q_eqid(hw, i) = CSIO_MAX_QID;
                        }
-                       /* fall through */
+                       fallthrough;
                case CSIO_INGRESS:
                        if (csio_q_iqid(hw, i) != CSIO_MAX_QID) {
                                csio_wr_cleanup_iq_ftr(hw, i);
index 2b48954b6b1ef58549f0f7ff07b20546a7acca59..37d99357120faeae6d16b6fdbc18993e29b96af9 100644 (file)
@@ -643,7 +643,7 @@ static int abort_status_to_errno(struct cxgbi_sock *csk, int abort_reason,
                                 int *need_rst)
 {
        switch (abort_reason) {
-       case CPL_ERR_BAD_SYN: /* fall through */
+       case CPL_ERR_BAD_SYN:
        case CPL_ERR_CONN_RESET:
                return csk->state > CTP_ESTABLISHED ? -EPIPE : -ECONNRESET;
        case CPL_ERR_XMIT_TIMEDOUT:
index 4e82c14cb795e19a7259744b52f6ce9002013033..2c3491528d4245873505bcb09c481215569a5fdc 100644 (file)
@@ -1133,7 +1133,7 @@ static int abort_status_to_errno(struct cxgbi_sock *csk, int abort_reason,
                                                                int *need_rst)
 {
        switch (abort_reason) {
-       case CPL_ERR_BAD_SYN: /* fall through */
+       case CPL_ERR_BAD_SYN:
        case CPL_ERR_CONN_RESET:
                return csk->state > CTP_ESTABLISHED ?
                        -EPIPE : -ECONNRESET;
index 71aebaf533ea543dd4ec701aab5166036ed020bc..0e8621a6956dcc6d3bf325e760ec4cc217f210fd 100644 (file)
@@ -2457,10 +2457,10 @@ int cxgbi_conn_xmit_pdu(struct iscsi_task *task)
                return err;
        }
 
-       __kfree_skb(skb);
        log_debug(1 << CXGBI_DBG_ISCSI | 1 << CXGBI_DBG_PDU_TX,
                  "itt 0x%x, skb 0x%p, len %u/%u, xmit err %d.\n",
                  task->itt, skb, skb->len, skb->data_len, err);
+       __kfree_skb(skb);
        iscsi_conn_printk(KERN_ERR, task->conn, "xmit err %d.\n", err);
        iscsi_conn_failure(task->conn, ISCSI_ERR_XMIT_FAILED);
        return err;
index 94250ebe9e803cd66cabb511a066ad123e273ce8..e72440d919d2aab61657ac7e27873c576a0b18e7 100644 (file)
@@ -748,16 +748,16 @@ static void term_intr(struct cxlflash_cfg *cfg, enum undo_level level,
                /* SISL_MSI_ASYNC_ERROR is setup only for the primary HWQ */
                if (index == PRIMARY_HWQ)
                        cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 3, hwq);
-               /* fall through */
+               fallthrough;
        case UNMAP_TWO:
                cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
-               /* fall through */
+               fallthrough;
        case UNMAP_ONE:
                cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
-               /* fall through */
+               fallthrough;
        case FREE_IRQ:
                cfg->ops->free_afu_irqs(hwq->ctx_cookie);
-               /* fall through */
+               fallthrough;
        case UNDO_NOOP:
                /* No action required */
                break;
@@ -971,18 +971,18 @@ static void cxlflash_remove(struct pci_dev *pdev)
        switch (cfg->init_state) {
        case INIT_STATE_CDEV:
                cxlflash_release_chrdev(cfg);
-               /* fall through */
+               fallthrough;
        case INIT_STATE_SCSI:
                cxlflash_term_local_luns(cfg);
                scsi_remove_host(cfg->host);
-               /* fall through */
+               fallthrough;
        case INIT_STATE_AFU:
                term_afu(cfg);
-               /* fall through */
+               fallthrough;
        case INIT_STATE_PCI:
                cfg->ops->destroy_afu(cfg->afu_cookie);
                pci_disable_device(pdev);
-               /* fall through */
+               fallthrough;
        case INIT_STATE_NONE:
                free_mem(cfg);
                scsi_host_put(cfg->host);
@@ -2355,11 +2355,11 @@ retry:
                        cxlflash_schedule_async_reset(cfg);
                        break;
                }
-               /* fall through - to retry */
+               fallthrough;    /* to retry */
        case -EAGAIN:
                if (++nretry < 2)
                        goto retry;
-               /* fall through - to exit */
+               fallthrough;    /* to exit */
        default:
                break;
        }
@@ -2533,12 +2533,12 @@ static int cxlflash_eh_host_reset_handler(struct scsi_cmnd *scp)
                        cfg->state = STATE_NORMAL;
                wake_up_all(&cfg->reset_waitq);
                ssleep(1);
-               /* fall through */
+               fallthrough;
        case STATE_RESET:
                wait_event(cfg->reset_waitq, cfg->state != STATE_RESET);
                if (cfg->state == STATE_NORMAL)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                rc = FAILED;
                break;
@@ -3019,7 +3019,7 @@ retry:
                wait_event(cfg->reset_waitq, cfg->state != STATE_RESET);
                if (cfg->state == STATE_NORMAL)
                        goto retry;
-               /* else, fall through */
+               fallthrough;
        default:
                /* Ideally should not happen */
                dev_err(dev, "%s: Device is not ready, state=%d\n",
@@ -3531,7 +3531,7 @@ static long cxlflash_chr_ioctl(struct file *file, unsigned int cmd,
                if (likely(do_ioctl))
                        break;
 
-               /* fall through */
+               fallthrough;
        default:
                rc = -EINVAL;
                goto out;
index 593669ac3669443763f74a468fdc965a74845b6f..5dddf67dfa24a50ad9232c819099f65a9ac4e717 100644 (file)
@@ -375,14 +375,13 @@ retry:
                        switch (sshdr.sense_key) {
                        case NO_SENSE:
                        case RECOVERED_ERROR:
-                               /* fall through */
                        case NOT_READY:
                                result &= ~SAM_STAT_CHECK_CONDITION;
                                break;
                        case UNIT_ATTENTION:
                                switch (sshdr.asc) {
                                case 0x29: /* Power on Reset or Device Reset */
-                                       /* fall through */
+                                       fallthrough;
                                case 0x2A: /* Device capacity changed */
                                case 0x3F: /* Report LUNs changed */
                                        /* Retry the command once more */
@@ -1791,13 +1790,12 @@ static int process_sense(struct scsi_device *sdev,
        switch (sshdr.sense_key) {
        case NO_SENSE:
        case RECOVERED_ERROR:
-               /* fall through */
        case NOT_READY:
                break;
        case UNIT_ATTENTION:
                switch (sshdr.asc) {
                case 0x29: /* Power on Reset or Device Reset */
-                       /* fall through */
+                       fallthrough;
                case 0x2A: /* Device settings/capacity changed */
                        rc = read_cap16(sdev, lli);
                        if (rc) {
@@ -2157,7 +2155,7 @@ int cxlflash_ioctl(struct scsi_device *sdev, unsigned int cmd, void __user *arg)
                if (unlikely(rc))
                        goto cxlflash_ioctl_exit;
 
-               /* fall through */
+               fallthrough;
 
        case DK_CXLFLASH_MANAGE_LUN:
                known_ioctl = true;
@@ -2168,7 +2166,7 @@ int cxlflash_ioctl(struct scsi_device *sdev, unsigned int cmd, void __user *arg)
                if (likely(do_ioctl))
                        break;
 
-               /* fall through */
+               fallthrough;
        default:
                rc = -EINVAL;
                goto cxlflash_ioctl_exit;
index 8acd4bb9fefbb409a8ae0d44e52311d152508b50..4a3f7831a2d648dddeba35e5c55cb6359c9d425e 100644 (file)
@@ -60,7 +60,7 @@ static int tur_done(struct scsi_device *sdev, struct hp_sw_dh_data *h,
                        ret = SCSI_DH_OK;
                        break;
                }
-               /* Fallthrough */
+               fallthrough;
        default:
                sdev_printk(KERN_WARNING, sdev,
                           "%s: sending tur failed, sense %x/%x/%x\n",
@@ -147,7 +147,7 @@ retry:
                                rc = SCSI_DH_RETRY;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        sdev_printk(KERN_WARNING, sdev,
                                    "%s: sending start_stop_unit failed, "
index b02ac389e6c6050fc92696d480131db15678ebb4..429d64299fe94645736ba1bda08904c4128f5598 100644 (file)
@@ -1500,7 +1500,7 @@ bool esas2r_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi,
                        return complete_fmapi_req(a, rq, FI_STAT_SUCCESS);
                }
 
-       /* fall through */
+               fallthrough;
 
        case FI_ACT_UP: /* Upload the components */
        default:
index eb7d139ffc00baf279b6e61f394265187dfa269b..09c5c24bf391fd4a2467ca6d89e0d181b130267b 100644 (file)
@@ -1236,7 +1236,7 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a,
                        a->init_msg = ESAS2R_INIT_MSG_GET_INIT;
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case ESAS2R_INIT_MSG_GET_INIT:
                if (msg == ESAS2R_INIT_MSG_GET_INIT) {
@@ -1250,7 +1250,7 @@ static bool esas2r_format_init_msg(struct esas2r_adapter *a,
                                esas2r_hdebug("FAILED");
                        }
                }
-               /* fall through */
+               fallthrough;
 
        default:
                rq->req_stat = RS_SUCCESS;
index 89afa31e33cba889a9af63dd5253cf8a72f7ff0d..43a1fd11df5ed2ebb89c60e230868db923bcba1f 100644 (file)
@@ -307,7 +307,7 @@ static void esp_reset_esp(struct esp *esp)
 
        case FASHME:
                esp->config2 |= (ESP_CONFIG2_HME32 | ESP_CONFIG2_HMEFENAB);
-               /* fallthrough... */
+               fallthrough;
 
        case FAS236:
        case PCSCSI:
@@ -1741,7 +1741,7 @@ again:
 
        case ESP_EVENT_DATA_IN:
                write = 1;
-               /* fallthru */
+               fallthrough;
 
        case ESP_EVENT_DATA_OUT: {
                struct esp_cmd_entry *ent = esp->active_cmd;
index 1409c7687853c9da8f4e751b094f85c2860c8cec..5ea426effa60964bbdf0e79da95c8830ea6fff8e 100644 (file)
@@ -450,10 +450,10 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip)
                switch (fip->mode) {
                default:
                        LIBFCOE_FIP_DBG(fip, "invalid mode %d\n", fip->mode);
-                       /* fall-through */
+                       fallthrough;
                case FIP_MODE_AUTO:
                        LIBFCOE_FIP_DBG(fip, "%s", "setting AUTO mode.\n");
-                       /* fall-through */
+                       fallthrough;
                case FIP_MODE_FABRIC:
                case FIP_MODE_NON_FIP:
                        mutex_unlock(&fip->ctlr_mutex);
@@ -773,7 +773,7 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport,
                        fc_fcoe_set_mac(mac, fh->fh_d_id);
                        fip->update_mac(lport, mac);
                }
-               /* fall through */
+               fallthrough;
        case ELS_LS_RJT:
                op = fr_encaps(fp);
                if (op)
@@ -2439,7 +2439,7 @@ static void fcoe_ctlr_vn_probe_req(struct fcoe_ctlr *fip,
                                          frport->enode_mac, 0);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case FIP_ST_VNMP_START:
                LIBFCOE_FIP_DBG(fip, "vn_probe_req: "
                                "restart VN2VN negotiation\n");
index 2cc676e3df6a74a4bd38b796dc067d07d3c03567..29e4cdcade7201166a7751e157dbb1561d29740b 100644 (file)
@@ -340,7 +340,7 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
                        break;
                case BOARD_DTC3181E:
                        hostdata->io_width = 2; /* 16-bit PDMA */
-                       /* fall through */
+                       fallthrough;
                case BOARD_NCR53C400A:
                case BOARD_HP_C2502:
                        hostdata->c400_ctl_status = 9;
index 11caa4b0d79773e80f17e38f4653aeeb03b3ac81..d9d21d23372e54dc659ed974049e6178ff6c9292 100644 (file)
@@ -1144,7 +1144,7 @@ static int hisi_sas_control_phy(struct asd_sas_phy *sas_phy, enum phy_func func,
                        hisi_hba->hw->get_events(hisi_hba, phy_no);
                        break;
                }
-               /* fallthru */
+               fallthrough;
        case PHY_FUNC_RELEASE_SPINUP_HOLD:
        default:
                return -EOPNOTSUPP;
index 91794a50b31fe541eb39f788cbebd4ddbaaa6a3c..48d5da59262b43b73aa76c037531b5368df8bbdb 100644 (file)
@@ -4697,7 +4697,7 @@ static int fixup_ioaccel_cdb(u8 *cdb, int *cdb_len)
        case WRITE_6:
        case WRITE_12:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_6:
        case READ_12:
                if (*cdb_len == 6) {
@@ -5147,7 +5147,7 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
        switch (cmd->cmnd[0]) {
        case WRITE_6:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_6:
                first_block = (((cmd->cmnd[1] & 0x1F) << 16) |
                                (cmd->cmnd[2] << 8) |
@@ -5158,7 +5158,7 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
                break;
        case WRITE_10:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_10:
                first_block =
                        (((u64) cmd->cmnd[2]) << 24) |
@@ -5171,7 +5171,7 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
                break;
        case WRITE_12:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_12:
                first_block =
                        (((u64) cmd->cmnd[2]) << 24) |
@@ -5186,7 +5186,7 @@ static int hpsa_scsi_ioaccel_raid_map(struct ctlr_info *h,
                break;
        case WRITE_16:
                is_write = 1;
-               /* fall through */
+               fallthrough;
        case READ_16:
                first_block =
                        (((u64) cmd->cmnd[2]) << 56) |
index 77f4d37d5bd625b88c8e2ea9c5827851c0e57cba..ea7c8930592dc49905f84bd5dcc414d8c93a2322 100644 (file)
@@ -1866,7 +1866,7 @@ static int ibmvfc_bsg_request(struct bsg_job *job)
                port_id = (bsg_request->rqst_data.h_els.port_id[0] << 16) |
                        (bsg_request->rqst_data.h_els.port_id[1] << 8) |
                        bsg_request->rqst_data.h_els.port_id[2];
-               /* fall through */
+               fallthrough;
        case FC_BSG_RPT_ELS:
                fc_flags = IBMVFC_FC_ELS;
                break;
@@ -1875,7 +1875,7 @@ static int ibmvfc_bsg_request(struct bsg_job *job)
                port_id = (bsg_request->rqst_data.h_ct.port_id[0] << 16) |
                        (bsg_request->rqst_data.h_ct.port_id[1] << 8) |
                        bsg_request->rqst_data.h_ct.port_id[2];
-               /* fall through */
+               fallthrough;
        case FC_BSG_RPT_CT:
                fc_flags = IBMVFC_FC_CT_IU;
                break;
@@ -4122,7 +4122,7 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt)
                return;
        case IBMVFC_MAD_CRQ_ERROR:
                ibmvfc_retry_host_init(vhost);
-               /* fall through */
+               fallthrough;
        case IBMVFC_MAD_DRIVER_FAILED:
                ibmvfc_free_event(evt);
                return;
index d9e94e81da01787f28b4bbd6cd0d840f1aa833be..cc3908c2d2f943173e0bc6cffe7770032d1eb2a8 100644 (file)
@@ -1581,7 +1581,7 @@ static long ibmvscsis_adapter_info(struct scsi_info *vscsi,
        case H_PERMISSION:
                if (connection_broken(vscsi))
                        flag_bits = (RESPONSE_Q_DOWN | CLIENT_FAILED);
-               /* Fall through */
+               fallthrough;
        default:
                dev_err(&vscsi->dev, "adapter_info: h_copy_rdma to client failed, rc %ld\n",
                        rc);
@@ -2489,10 +2489,10 @@ static long ibmvscsis_ping_response(struct scsi_info *vscsi)
                break;
        case H_CLOSED:
                vscsi->flags |= CLIENT_FAILED;
-               /* Fall through */
+               fallthrough;
        case H_DROPPED:
                vscsi->flags |= RESPONSE_Q_DOWN;
-               /* Fall through */
+               fallthrough;
        case H_REMOTE_PARM:
                dev_err(&vscsi->dev, "ping_response: h_send_crq failed, rc %ld\n",
                        rc);
index 1459b1467027994f1121de7c95c2d4f8b2782765..862d35a098cf3c9f3cd9ca11a3a9bb222f221df4 100644 (file)
@@ -801,7 +801,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
        case 1:         /* Phase 1 - Connected */
                imm_connect(dev, CONNECT_EPP_MAYBE);
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 2:         /* Phase 2 - We are now talking to the scsi bus */
                if (!imm_select(dev, scmd_id(cmd))) {
@@ -809,7 +809,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                        return 0;
                }
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 3:         /* Phase 3 - Ready to accept a command */
                w_ctr(ppb, 0x0c);
@@ -819,7 +819,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                if (!imm_send_command(cmd))
                        return 0;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 4:         /* Phase 4 - Setup scatter/gather buffers */
                if (scsi_bufflen(cmd)) {
@@ -835,7 +835,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                cmd->SCp.phase++;
                if (cmd->SCp.this_residual & 0x01)
                        cmd->SCp.this_residual++;
-               /* fall through */
+               fallthrough;
 
        case 5:         /* Phase 5 - Pre-Data transfer stage */
                /* Spin lock for BUSY */
@@ -852,7 +852,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                        if (imm_negotiate(dev))
                                return 0;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 6:         /* Phase 6 - Data transfer stage */
                /* Spin lock for BUSY */
@@ -868,7 +868,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                                return 1;
                }
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 7:         /* Phase 7 - Post data transfer stage */
                if ((dev->dp) && (dev->rd)) {
@@ -880,7 +880,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
                        }
                }
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 8:         /* Phase 8 - Read status/message */
                /* Check for data overrun */
index 7f9b3f20e5e4228c31afb9d9e73d1783209dc12b..4cacb800b53095712540bb9ffa5df22bdb3c588a 100644 (file)
@@ -778,7 +778,7 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
                        break;
                case SCU_EVENT_LINK_FAILURE:
                        scu_link_layer_set_txcomsas_timeout(iphy, SCU_SAS_LINK_LAYER_TXCOMSAS_NEGTIME_DEFAULT);
-                       /* fall through */
+                       fallthrough;
                case SCU_EVENT_HARD_RESET_RECEIVED:
                        /* Start the oob/sn state machine over again */
                        sci_change_state(&iphy->sm, SCI_PHY_STARTING);
index cd1e4b4d95bbbba007f93630a81574ff20d3bc73..c3f540b556895675105679ec09c69190c10c91e5 100644 (file)
@@ -310,7 +310,7 @@ static void isci_remote_device_not_ready(struct isci_host *ihost,
                /* Kill all outstanding requests for the device. */
                sci_remote_device_terminate_requests(idev);
 
-               /* Fall through - into the default case... */
+               fallthrough;    /* into the default case */
        default:
                clear_bit(IDEV_IO_READY, &idev->flags);
                break;
@@ -593,7 +593,7 @@ enum sci_status sci_remote_device_event_handler(struct isci_remote_device *idev,
 
                        break;
                }
-               /* fall through - and treat as unhandled... */
+               fallthrough;    /* and treat as unhandled */
        default:
                dev_dbg(scirdev_to_dev(idev),
                        "%s: device: %p event code: %x: %s\n",
index 474a434609636bb9cb65064aec27abda05f36719..68333f523b351a8305a829a546b17826d68a0f60 100644 (file)
@@ -225,7 +225,7 @@ static void sci_remote_node_context_continue_state_transitions(struct sci_remote
        case RNC_DEST_READY:
        case RNC_DEST_SUSPENDED_RESUME:
                rnc->destination_state = RNC_DEST_READY;
-               /* Fall through... */
+               fallthrough;
        case RNC_DEST_FINAL:
                sci_remote_node_context_resume(rnc, rnc->user_callback,
                                               rnc->user_cookie);
@@ -601,9 +601,9 @@ enum sci_status sci_remote_node_context_suspend(
                                 __func__, sci_rnc);
                        return SCI_FAILURE_INVALID_STATE;
                }
-               /* Fall through - and handle like SCI_RNC_POSTING */
+               fallthrough;    /* and handle like SCI_RNC_POSTING */
        case SCI_RNC_RESUMING:
-               /* Fall through - and handle like SCI_RNC_POSTING */
+               fallthrough;    /* and handle like SCI_RNC_POSTING */
        case SCI_RNC_POSTING:
                /* Set the destination state to AWAIT - this signals the
                 * entry into the SCI_RNC_READY state that a suspension
index 6561a07db18992686757adf8cfdfd6629f7d00fa..6e0817941fa74c5589dab4ef749d953526e31d6a 100644 (file)
@@ -894,7 +894,7 @@ sci_io_request_terminate(struct isci_request *ireq)
                 * and don't wait for the task response.
                 */
                sci_change_state(&ireq->sm, SCI_REQ_ABORTING);
-               /* Fall through - and handle like ABORTING... */
+               fallthrough;    /* and handle like ABORTING */
        case SCI_REQ_ABORTING:
                if (!isci_remote_device_is_safe_to_abort(ireq->target_device))
                        set_bit(IREQ_PENDING_ABORT, &ireq->flags);
index d8cbc9c0e766b1adabc3675fe0dfbe462d73dda4..e67abb184a8a0fb23a2fae0b7f58d43664e9841a 100644 (file)
@@ -634,8 +634,6 @@ free_fp:
        fc_frame_free(fp);
 out:
        kref_put(&rdata->kref, fc_rport_destroy);
-       if (!IS_ERR(fp))
-               fc_frame_free(fp);
 }
 
 /**
index 16eb3b60ed5825ae9253cd97436c3f345553b752..96a2952cf626bf1b3bb08c01cac23a9d5c359310 100644 (file)
@@ -2108,7 +2108,7 @@ static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg)
        switch (op) {
        case ELS_LS_RJT:
                FC_EXCH_DBG(aborted_ep, "LS_RJT for RRQ\n");
-               /* fall through */
+               fallthrough;
        case ELS_LS_ACC:
                goto cleanup;
        default:
@@ -2622,7 +2622,7 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)
        case FC_EOF_T:
                if (f_ctl & FC_FC_END_SEQ)
                        skb_trim(fp_skb(fp), fr_len(fp) - FC_FC_FILL(f_ctl));
-               /* fall through */
+               fallthrough;
        case FC_EOF_N:
                if (fh->fh_type == FC_TYPE_BLS)
                        fc_exch_recv_bls(ema->mp, fp);
index e11d4f002bd493dc7f78d0782f330e4f6113c0ec..7cfeb6886237c0f44071fccc1ec7480b80679ec3 100644 (file)
@@ -752,7 +752,7 @@ static void fc_fcp_abts_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
                brp = fc_frame_payload_get(fp, sizeof(*brp));
                if (brp && brp->br_reason == FC_BA_RJT_LOG_ERR)
                        break;
-               /* fall thru */
+               fallthrough;
        default:
                /*
                 * we will let the command timeout
@@ -1536,7 +1536,7 @@ static void fc_fcp_rec_resp(struct fc_seq *seq, struct fc_frame *fp, void *arg)
                                   "device %x invalid REC reject %d/%d\n",
                                   fsp->rport->port_id, rjt->er_reason,
                                   rjt->er_explan);
-                       /* fall through */
+                       fallthrough;
                case ELS_RJT_UNSUP:
                        FC_FCP_DBG(fsp, "device does not support REC\n");
                        rpriv = fsp->rport->dd_data;
@@ -1668,7 +1668,7 @@ static void fc_fcp_rec_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
                FC_FCP_DBG(fsp, "REC %p fid %6.6x error unexpected error %d\n",
                           fsp, fsp->rport->port_id, error);
                fsp->status_code = FC_CMD_PLOGO;
-               /* fall through */
+               fallthrough;
 
        case -FC_EX_TIMEOUT:
                /*
@@ -1830,7 +1830,7 @@ static void fc_fcp_srr_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
                break;
        case -FC_EX_CLOSED:                     /* e.g., link failure */
                FC_FCP_DBG(fsp, "SRR error, exchange closed\n");
-               /* fall through */
+               fallthrough;
        default:
                fc_fcp_retry_cmd(fsp, FC_ERROR);
                break;
index b84dbc316df1513473b91b5fc682bbebc0ae2567..6557fda85c5c716c77609c33afc7cc58b5e35267 100644 (file)
@@ -1578,7 +1578,7 @@ static void fc_lport_timeout(struct work_struct *work)
        case LPORT_ST_DPRT:
                FC_LPORT_DBG(lport, "Skipping lport state %s to SCR\n",
                             fc_lport_state(lport));
-               /* fall thru */
+               fallthrough;
        case LPORT_ST_SCR:
                fc_lport_enter_scr(lport);
                break;
index 18663a82865f99d746a2c61fb4d2a19e2e5db8e3..a60b228d13f16b955e6a2d0f10f79cc33cf4ab66 100644 (file)
@@ -1723,7 +1723,7 @@ static void fc_rport_recv_els_req(struct fc_lport *lport, struct fc_frame *fp)
                        kref_put(&rdata->kref, fc_rport_destroy);
                        goto busy;
                }
-               /* fall through */
+               fallthrough;
        default:
                FC_RPORT_DBG(rdata,
                             "Reject ELS 0x%02x while in state %s\n",
index 49c8a1818baf89e58c7543f6157cb307cfcf5bd3..1e9c3171fa9f44bed8c982f8abaecc8284a764ff 100644 (file)
@@ -248,7 +248,7 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode)
                hdr_lun = scsilun_to_int(&tmf->lun);
                if (hdr_lun != task->sc->device->lun)
                        return 0;
-               /* fall through */
+               fallthrough;
        case ISCSI_TM_FUNC_TARGET_WARM_RESET:
                /*
                 * Fail all SCSI cmd PDUs
@@ -1674,7 +1674,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
                                sc->result = DID_NO_CONNECT << 16;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case ISCSI_STATE_IN_RECOVERY:
                        reason = FAILURE_SESSION_IN_RECOVERY;
                        sc->result = DID_IMM_RETRY << 16;
@@ -2239,7 +2239,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
                                              "progress\n");
                        goto success;
                }
-               /* fall through */
+               fallthrough;
        default:
                conn->tmf_state = TMF_INITIAL;
                goto failed;
index 6ef93c7af954816b1c87189fb5d7fc5199c83c5a..37e5d4e48c2f206af3ca71f4006bd136aae1b3b0 100644 (file)
@@ -772,7 +772,7 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
                        iscsi_tcp_data_recv_prep(tcp_conn);
                        return 0;
                }
-       /* fall through */
+               fallthrough;
        case ISCSI_OP_LOGOUT_RSP:
        case ISCSI_OP_NOOP_IN:
        case ISCSI_OP_SCSI_TMFUNC_RSP:
index 1b93332daa6b38a206ced8e0393f3292ec0e7449..a4887985aad6e4ef341fdebf2a00a9d4a6bfbc0b 100644 (file)
@@ -209,7 +209,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
                task->num_scatter = si;
        }
 
-       task->data_dir = qc->dma_dir;
+       if (qc->tf.protocol == ATA_PROT_NODATA)
+               task->data_dir = DMA_NONE;
+       else
+               task->data_dir = qc->dma_dir;
        task->scatter = qc->sg;
        task->ata_task.retry_count = 1;
        task->task_state_flags = SAS_TASK_STATE_PENDING;
@@ -324,7 +327,7 @@ static int smp_ata_check_ready(struct ata_link *link)
        case SAS_END_DEVICE:
                if (ex_phy->attached_sata_dev)
                        return sas_ata_clear_pending(dev, ex_phy);
-               /* fall through */
+               fallthrough;
        default:
                return -ENODEV;
        }
index daf951b0b3f5538fa05f7c7b5e2e99626e18d5cd..d0f9e90e3279c8334477b35bcac86b1c9e7c625f 100644 (file)
@@ -108,7 +108,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
                        rphy = NULL;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case SAS_END_DEVICE:
                rphy = sas_end_device_alloc(port->port);
                break;
@@ -182,10 +182,11 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
                pr_warn("driver on host %s cannot handle device %016llx, error:%d\n",
                        dev_name(sas_ha->dev),
                        SAS_ADDR(dev->sas_addr), res);
+               return res;
        }
        set_bit(SAS_DEV_FOUND, &dev->state);
        kref_get(&dev->kref);
-       return res;
+       return 0;
 }
 
 
index b7d1b1ea185d773998aee67024abc054ec97da58..8d6bcc19359ffda33c6e4dcf181532553408ad2c 100644 (file)
@@ -1096,7 +1096,7 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
                } else
                        memcpy(dev->port->disc.fanout_sas_addr,
                               ex_phy->attached_sas_addr, SAS_ADDR_SIZE);
-               /* fallthrough */
+               fallthrough;
        case SAS_EDGE_EXPANDER_DEVICE:
                child = sas_ex_discover_expander(dev, phy_id);
                break;
index 9e0975e55c27e247c04eb118d799c1f0d752cfae..1bf939818c98182d0d41b78ad3357e0d5dbf440b 100644 (file)
@@ -622,7 +622,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
                                sas_scsi_clear_queue_lu(work_q, cmd);
                                goto Again;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case TASK_IS_NOT_AT_LU:
                case TASK_ABORT_FAILED:
                        pr_notice("task 0x%p is not at LU: I_T recover\n",
index ef2015fad2d5929da4cf5d0cab05bcf8d00d9356..d0141a23a833765a09137794781748ef51ac543e 100644 (file)
@@ -3202,7 +3202,7 @@ port_out:
        case SLI_MGMT_GHAT:
        case SLI_MGMT_GRPL:
                rsp_size = FC_MAX_NS_RSP;
-               /* fall through */
+               fallthrough;
        case SLI_MGMT_DHBA:
        case SLI_MGMT_DHAT:
                pe = (struct lpfc_fdmi_port_entry *)&CtReq->un.PortID;
@@ -3215,7 +3215,7 @@ port_out:
        case SLI_MGMT_GPAT:
        case SLI_MGMT_GPAS:
                rsp_size = FC_MAX_NS_RSP;
-               /* fall through */
+               fallthrough;
        case SLI_MGMT_DPRT:
        case SLI_MGMT_DPA:
                pe = (struct lpfc_fdmi_port_entry *)&CtReq->un.PortID;
index 48dc63f22ccad5427949c9c9ae851dcaab03406f..b60945182db8056f253758f5d9c95ae002cb3a0a 100644 (file)
@@ -3517,6 +3517,9 @@ lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t retry)
                                FC_TLV_DESC_LENGTH_FROM_SZ(prdf->reg_d1));
        prdf->reg_d1.reg_desc.count = cpu_to_be32(ELS_RDF_REG_TAG_CNT);
        prdf->reg_d1.desc_tags[0] = cpu_to_be32(ELS_DTAG_LNK_INTEGRITY);
+       prdf->reg_d1.desc_tags[1] = cpu_to_be32(ELS_DTAG_DELIVERY);
+       prdf->reg_d1.desc_tags[2] = cpu_to_be32(ELS_DTAG_PEER_CONGEST);
+       prdf->reg_d1.desc_tags[3] = cpu_to_be32(ELS_DTAG_CONGESTION);
 
        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
                              "Issue RDF:       did:x%x",
@@ -4656,7 +4659,9 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 out:
        if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) {
                spin_lock_irq(shost->host_lock);
-               ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI);
+               if (mbox)
+                       ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN;
+               ndlp->nlp_flag &= ~NLP_RM_DFLT_RPI;
                spin_unlock_irq(shost->host_lock);
 
                /* If the node is not being used by another discovery thread,
@@ -9134,7 +9139,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                                lpfc_nlp_put(ndlp);
                                return;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        /* Try to recover from this error */
                        if (phba->sli_rev == LPFC_SLI_REV4)
index 142a021144793c555242f5f37d58f508f9661ddd..bb02fd8bc2ddf2b52aaf35a16fadd2e4fe286c52 100644 (file)
@@ -71,6 +71,7 @@ static void lpfc_disc_timeout_handler(struct lpfc_vport *);
 static void lpfc_disc_flush_list(struct lpfc_vport *vport);
 static void lpfc_unregister_fcfi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
 static int lpfc_fcf_inuse(struct lpfc_hba *);
+static void lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *);
 
 void
 lpfc_terminate_rport_io(struct fc_rport *rport)
@@ -1138,11 +1139,13 @@ out:
        return;
 }
 
-
 void
 lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 {
        struct lpfc_vport *vport = pmb->vport;
+       LPFC_MBOXQ_t *sparam_mb;
+       struct lpfc_dmabuf *sparam_mp;
+       int rc;
 
        if (pmb->u.mb.mbxStatus)
                goto out;
@@ -1167,12 +1170,42 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        }
 
        /* Start discovery by sending a FLOGI. port_state is identically
-        * LPFC_FLOGI while waiting for FLOGI cmpl. Check if sending
-        * the FLOGI is being deferred till after MBX_READ_SPARAM completes.
+        * LPFC_FLOGI while waiting for FLOGI cmpl.
         */
        if (vport->port_state != LPFC_FLOGI) {
-               if (!(phba->hba_flag & HBA_DEFER_FLOGI))
+               /* Issue MBX_READ_SPARAM to update CSPs before FLOGI if
+                * bb-credit recovery is in place.
+                */
+               if (phba->bbcredit_support && phba->cfg_enable_bbcr &&
+                   !(phba->link_flag & LS_LOOPBACK_MODE)) {
+                       sparam_mb = mempool_alloc(phba->mbox_mem_pool,
+                                                 GFP_KERNEL);
+                       if (!sparam_mb)
+                               goto sparam_out;
+
+                       rc = lpfc_read_sparam(phba, sparam_mb, 0);
+                       if (rc) {
+                               mempool_free(sparam_mb, phba->mbox_mem_pool);
+                               goto sparam_out;
+                       }
+                       sparam_mb->vport = vport;
+                       sparam_mb->mbox_cmpl = lpfc_mbx_cmpl_read_sparam;
+                       rc = lpfc_sli_issue_mbox(phba, sparam_mb, MBX_NOWAIT);
+                       if (rc == MBX_NOT_FINISHED) {
+                               sparam_mp = (struct lpfc_dmabuf *)
+                                               sparam_mb->ctx_buf;
+                               lpfc_mbuf_free(phba, sparam_mp->virt,
+                                              sparam_mp->phys);
+                               kfree(sparam_mp);
+                               sparam_mb->ctx_buf = NULL;
+                               mempool_free(sparam_mb, phba->mbox_mem_pool);
+                               goto sparam_out;
+                       }
+
+                       phba->hba_flag |= HBA_DEFER_FLOGI;
+               }  else {
                        lpfc_initial_flogi(vport);
+               }
        } else {
                if (vport->fc_flag & FC_PT2PT)
                        lpfc_disc_start(vport);
@@ -1184,6 +1217,7 @@ out:
                         "0306 CONFIG_LINK mbxStatus error x%x "
                         "HBA state x%x\n",
                         pmb->u.mb.mbxStatus, vport->port_state);
+sparam_out:
        mempool_free(pmb, phba->mbox_mem_pool);
 
        lpfc_linkdown(phba);
@@ -3239,21 +3273,6 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
        lpfc_linkup(phba);
        sparam_mbox = NULL;
 
-       if (!(phba->hba_flag & HBA_FCOE_MODE)) {
-               cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
-               if (!cfglink_mbox)
-                       goto out;
-               vport->port_state = LPFC_LOCAL_CFG_LINK;
-               lpfc_config_link(phba, cfglink_mbox);
-               cfglink_mbox->vport = vport;
-               cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link;
-               rc = lpfc_sli_issue_mbox(phba, cfglink_mbox, MBX_NOWAIT);
-               if (rc == MBX_NOT_FINISHED) {
-                       mempool_free(cfglink_mbox, phba->mbox_mem_pool);
-                       goto out;
-               }
-       }
-
        sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
        if (!sparam_mbox)
                goto out;
@@ -3274,7 +3293,20 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
                goto out;
        }
 
-       if (phba->hba_flag & HBA_FCOE_MODE) {
+       if (!(phba->hba_flag & HBA_FCOE_MODE)) {
+               cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+               if (!cfglink_mbox)
+                       goto out;
+               vport->port_state = LPFC_LOCAL_CFG_LINK;
+               lpfc_config_link(phba, cfglink_mbox);
+               cfglink_mbox->vport = vport;
+               cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link;
+               rc = lpfc_sli_issue_mbox(phba, cfglink_mbox, MBX_NOWAIT);
+               if (rc == MBX_NOT_FINISHED) {
+                       mempool_free(cfglink_mbox, phba->mbox_mem_pool);
+                       goto out;
+               }
+       } else {
                vport->port_state = LPFC_VPORT_UNKNOWN;
                /*
                 * Add the driver's default FCF record at FCF index 0 now. This
@@ -3331,10 +3363,6 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
                }
                /* Reset FCF roundrobin bmask for new discovery */
                lpfc_sli4_clear_fcf_rr_bmask(phba);
-       } else {
-               if (phba->bbcredit_support && phba->cfg_enable_bbcr &&
-                   !(phba->link_flag & LS_LOOPBACK_MODE))
-                       phba->hba_flag |= HBA_DEFER_FLOGI;
        }
 
        /* Prepare for LINK up registrations */
@@ -4728,15 +4756,14 @@ lpfc_check_sli_ndlp(struct lpfc_hba *phba,
                case CMD_GEN_REQUEST64_CR:
                        if (iocb->context_un.ndlp == ndlp)
                                return 1;
-                       /* fall through */
+                       fallthrough;
                case CMD_ELS_REQUEST64_CR:
                        if (icmd->un.elsreq64.remoteID == ndlp->nlp_DID)
                                return 1;
-                       /* fall through */
+                       fallthrough;
                case CMD_XMIT_ELS_RSP64_CX:
                        if (iocb->context1 == (uint8_t *) ndlp)
                                return 1;
-                       /* fall through */
                }
        } else if (pring->ringno == LPFC_FCP_RING) {
                /* Skip match check if waiting to relogin to FCP target */
@@ -6055,7 +6082,7 @@ restart_disc:
 
        case LPFC_LINK_UP:
                lpfc_issue_clear_la(phba, vport);
-               /* fall through */
+               fallthrough;
        case LPFC_LINK_UNKNOWN:
        case LPFC_WARM_START:
        case LPFC_INIT_START:
index c4ba8273a63fbea46f49b45a92dd85c3a55e444c..12e4e76233e6aede588fd19227c311904d9d33ac 100644 (file)
@@ -4800,7 +4800,7 @@ struct send_frame_wqe {
        uint32_t fc_hdr_wd5;           /* word 15 */
 };
 
-#define ELS_RDF_REG_TAG_CNT            1
+#define ELS_RDF_REG_TAG_CNT            4
 struct lpfc_els_rdf_reg_desc {
        struct fc_df_desc_fpin_reg      reg_desc;       /* descriptor header */
        __be32                          desc_tags[ELS_RDF_REG_TAG_CNT];
index c697259993159d1c6895f2d1a7c8653e5ae48256..ca25e54bb78249e6e9535eb2c52251ff2498347c 100644 (file)
@@ -11376,7 +11376,6 @@ lpfc_irq_clear_aff(struct lpfc_hba_eq_hdl *eqhdl)
 {
        cpumask_clear(&eqhdl->aff_mask);
        irq_clear_status_flags(eqhdl->irq, IRQ_NO_BALANCING);
-       irq_set_affinity_hint(eqhdl->irq, &eqhdl->aff_mask);
 }
 
 /**
index cad53d19cb25f15aeef94add85620e5a153a62b9..92d6e7b98770d764624a586045ae5a94d72d56b9 100644 (file)
@@ -464,7 +464,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        case  NLP_STE_NPR_NODE:
                if (!(ndlp->nlp_flag & NLP_NPR_ADISC))
                        break;
-               /* fall through */
+               fallthrough;
        case  NLP_STE_REG_LOGIN_ISSUE:
        case  NLP_STE_PRLI_ISSUE:
        case  NLP_STE_UNMAPPED_NODE:
index e5be334d6a119e15ed0f794e138e9655c309e227..0c39ed50998c866ab2521f1913521b3bb1204287 100644 (file)
@@ -1225,7 +1225,7 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn,
                                         lpfc_ncmd, nCmd,
                                         lpfc_ncmd->cur_iocbq.sli4_xritag,
                                         bf_get(lpfc_wcqe_c_xb, wcqe));
-                       /* fall through */
+                       fallthrough;
                default:
 out_err:
                        lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR,
index 5e802c8b22a99229ed1ae072b3c79011723caa1f..983eeb0e3d07e36604ec129c6bf7dbc6ddbfe041 100644 (file)
@@ -1093,7 +1093,7 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
 
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        case SCSI_PROT_WRITE_INSERT:
                                /*
                                 * For WRITE_INSERT, force the error
@@ -1213,7 +1213,7 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
                                        rc = BG_ERR_TGT | BG_ERR_CHECK;
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        case SCSI_PROT_WRITE_INSERT:
                                /*
                                 * For WRITE_INSERT, force the
@@ -1295,7 +1295,7 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
                        switch (op) {
                        case SCSI_PROT_WRITE_PASS:
                                rc = BG_ERR_CHECK;
-                               /* fall through */
+                               fallthrough;
 
                        case SCSI_PROT_WRITE_INSERT:
                                /*
@@ -3980,7 +3980,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
                                        lpfc_cmd->cur_iocbq.sli4_lxritag,
                                        0, 0);
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        cmd->result = DID_ERROR << 16;
                        break;
index 4cd7ded656b7d25c771d36de6082af71888f1c18..e158cd77d387f4c7c4eaf7c001e3af68b3588019 100644 (file)
@@ -9339,7 +9339,7 @@ __lpfc_sli_issue_iocb_s3(struct lpfc_hba *phba, uint32_t ring_number,
                         */
                        if (piocb->iocb_cmpl)
                                piocb->iocb_cmpl = NULL;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case CMD_CREATE_XRI_CR:
                case CMD_CLOSE_XRI_CN:
                case CMD_CLOSE_XRI_CX:
@@ -9653,7 +9653,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
                cmnd = CMD_XMIT_SEQUENCE64_CR;
                if (phba->link_flag & LS_LOOPBACK_MODE)
                        bf_set(wqe_xo, &wqe->xmit_sequence.wge_ctl, 1);
-               /* fall through */
+               fallthrough;
        case CMD_XMIT_SEQUENCE64_CR:
                /* word3 iocb=io_tag32 wqe=reserved */
                wqe->xmit_sequence.rsvd3 = 0;
@@ -13630,7 +13630,7 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
        case FC_STATUS_RQ_BUF_LEN_EXCEEDED:
                lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
                                "2537 Receive Frame Truncated!!\n");
-               /* fall through */
+               fallthrough;
        case FC_STATUS_RQ_SUCCESS:
                spin_lock_irqsave(&phba->hbalock, iflags);
                lpfc_sli4_rq_release(hrq, drq);
@@ -13678,7 +13678,7 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
                                        atomic_read(&tgtp->rcv_fcp_cmd_out),
                                        atomic_read(&tgtp->xmt_fcp_release));
                }
-               /* fallthrough */
+               fallthrough;
 
        case FC_STATUS_INSUFF_BUF_NEED_BUF:
                hrq->RQ_no_posted_buf++;
@@ -14162,7 +14162,7 @@ lpfc_sli4_nvmet_handle_rcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
        case FC_STATUS_RQ_BUF_LEN_EXCEEDED:
                lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
                                "6126 Receive Frame Truncated!!\n");
-               /* fall through */
+               fallthrough;
        case FC_STATUS_RQ_SUCCESS:
                spin_lock_irqsave(&phba->hbalock, iflags);
                lpfc_sli4_rq_release(hrq, drq);
@@ -14209,7 +14209,7 @@ drop:
                                        atomic_read(&tgtp->rcv_fcp_cmd_out),
                                        atomic_read(&tgtp->xmt_fcp_release));
                }
-               /* fallthrough */
+               fallthrough;
 
        case FC_STATUS_INSUFF_BUF_NEED_BUF:
                hrq->RQ_no_posted_buf++;
@@ -15096,7 +15096,7 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax)
                        status = -EINVAL;
                        goto out;
                }
-               /* fall through - otherwise default to smallest count */
+               fallthrough;    /* otherwise default to smallest count */
        case 256:
                bf_set(lpfc_eq_context_count, &eq_create->u.request.context,
                       LPFC_EQ_CNT_256);
@@ -15238,7 +15238,7 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
                               LPFC_CQ_CNT_WORD7);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
                                "0361 Unsupported CQ count: "
@@ -15249,7 +15249,7 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
                        status = -EINVAL;
                        goto out;
                }
-               /* fall through - otherwise default to smallest count */
+               fallthrough;    /* otherwise default to smallest count */
        case 256:
                bf_set(lpfc_cq_context_count, &cq_create->u.request.context,
                       LPFC_CQ_CNT_256);
@@ -15417,7 +15417,7 @@ lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp,
                                               LPFC_CQ_CNT_WORD7);
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
                                                "3118 Bad CQ count. (%d)\n",
@@ -15426,7 +15426,7 @@ lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp,
                                        status = -EINVAL;
                                        goto out;
                                }
-                               /* fall through - otherwise default to smallest */
+                               fallthrough;    /* otherwise default to smallest */
                        case 256:
                                bf_set(lpfc_mbx_cq_create_set_cqe_cnt,
                                       &cq_set->u.request, LPFC_CQ_CNT_256);
@@ -15702,7 +15702,7 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
                        status = -EINVAL;
                        goto out;
                }
-               /* fall through - otherwise default to smallest count */
+               fallthrough;    /* otherwise default to smallest count */
        case 16:
                bf_set(lpfc_mq_context_ring_size,
                       &mq_create_ext->u.request.context,
@@ -16123,7 +16123,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
                                status = -EINVAL;
                                goto out;
                        }
-                       /* fall through - otherwise default to smallest count */
+                       fallthrough;    /* otherwise default to smallest count */
                case 512:
                        bf_set(lpfc_rq_context_rqe_count,
                               &rq_create->u.request.context,
@@ -16260,7 +16260,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
                                status = -EINVAL;
                                goto out;
                        }
-                       /* fall through - otherwise default to smallest count */
+                       fallthrough;    /* otherwise default to smallest count */
                case 512:
                        bf_set(lpfc_rq_context_rqe_count,
                               &rq_create->u.request.context,
index 20adec4387f026cb2a242a35b577ee0cfb40761b..c657abf22b751318179fa5cf8ddff8b6d9e0aa1d 100644 (file)
@@ -20,7 +20,7 @@
  * included with this package.                                     *
  *******************************************************************/
 
-#define LPFC_DRIVER_VERSION "12.8.0.3"
+#define LPFC_DRIVER_VERSION "12.8.0.4"
 #define LPFC_DRIVER_NAME               "lpfc"
 
 /* Used for SLI 2/3 */
index 0484ee52ae8023e2be9bc06f6f47fb55999fd612..ac406049e7c8afb37f32dca360ad67ca6994ae84 100644 (file)
@@ -491,9 +491,9 @@ mega_get_ldrv_num(adapter_t *adapter, struct scsi_cmnd *cmd, int channel)
 
        if (adapter->support_random_del && adapter->read_ldidmap )
                switch (cmd->cmnd[0]) {
-               case READ_6:    /* fall through */
-               case WRITE_6:   /* fall through */
-               case READ_10:   /* fall through */
+               case READ_6:
+               case WRITE_6:
+               case READ_10:
                case WRITE_10:
                        ldrv_num += 0x80;
                }
@@ -852,7 +852,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
                        return scb;
 
 #if MEGA_HAVE_CLUSTERING
-               case RESERVE:   /* Fall through */
+               case RESERVE:
                case RELEASE:
 
                        /*
@@ -987,7 +987,7 @@ mega_prepare_passthru(adapter_t *adapter, scb_t *scb, struct scsi_cmnd *cmd,
 
                        adapter->flag |= (1L << cmd->device->channel);
                }
-               /* Fall through */
+               fallthrough;
        default:
                pthru->numsgelements = mega_build_sglist(adapter, scb,
                                &pthru->dataxferaddr, &pthru->dataxferlen);
@@ -1050,7 +1050,7 @@ mega_prepare_extpassthru(adapter_t *adapter, scb_t *scb,
 
                        adapter->flag |= (1L << cmd->device->channel);
                }
-               /* Fall through */
+               fallthrough;
        default:
                epthru->numsgelements = mega_build_sglist(adapter, scb,
                                &epthru->dataxferaddr, &epthru->dataxferlen);
index 19469a2c0ea36f617f5cb33636c4d7dea4b54f71..4a27ac869f2e20dc86865079a5c687020c4de3fa 100644 (file)
@@ -1581,7 +1581,7 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
                                return NULL;
                        }
 
-                       /* Fall through */
+                       fallthrough;
 
                case READ_CAPACITY:
                        /*
index 861f7140f52e852b7ee375f1a3dce4af068f6b9c..2b7e7b5f38edf997cfc2c03fdd4e2aeae2c17e2c 100644 (file)
@@ -3522,7 +3522,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
                        megasas_complete_int_cmd(instance, cmd);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case MFI_CMD_LD_READ:
        case MFI_CMD_LD_WRITE:
index 0824410f78f8a241a549eaf14ee759b5e15ed151..b0c01cf0428f2f8b507421c7251b26a1cfa4540d 100644 (file)
@@ -3534,7 +3534,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
                                atomic_dec(&lbinfo->scsi_pending_cmds[cmd_fusion->pd_r1_lb]);
                                cmd_fusion->scmd->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG;
                        }
-                       /* Fall through - and complete IO */
+                       fallthrough;    /* and complete IO */
                case MEGASAS_MPI2_FUNCTION_LD_IO_REQUEST: /* LD-IO Path */
                        atomic_dec(&instance->fw_outstanding);
                        if (cmd_fusion->r1_alt_dev_handle == MR_DEVHANDLE_INVALID) {
@@ -3689,7 +3689,7 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int budget)
        instance = irq_ctx->instance;
 
        if (irq_ctx->irq_line_enable) {
-               disable_irq(irq_ctx->os_irq);
+               disable_irq_nosync(irq_ctx->os_irq);
                irq_ctx->irq_line_enable = false;
        }
 
index fd1d03064079729580c2c911a6cfa55d2137b975..0a9f4e44ab2cb92cec67457a24ec8e3a0c36588c 100644 (file)
@@ -1457,7 +1457,7 @@ static void cmd_complete(struct mesh_state *ms)
                /* huh?  we expected a phase mismatch */
                ms->n_msgin = 0;
                ms->msgphase = msg_in;
-               /* fall through */
+               fallthrough;
 
        case msg_in:
                /* should have some message bytes in fifo */
index 1d64524cd86315c4e31c5427f9e2649904b5e557..8062bd99add85cdaf6a29391c91f5f1110387a12 100644 (file)
@@ -1733,7 +1733,7 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget)
        reply_q = container_of(irqpoll, struct adapter_reply_queue,
                        irqpoll);
        if (reply_q->irq_line_enable) {
-               disable_irq(reply_q->os_irq);
+               disable_irq_nosync(reply_q->os_irq);
                reply_q->irq_line_enable = false;
        }
        num_entries = _base_process_reply_queue(reply_q);
@@ -4681,7 +4681,7 @@ _base_update_ioc_page1_inlinewith_perf_mode(struct MPT3SAS_ADAPTER *ioc)
                        ioc_info(ioc, "performance mode: balanced\n");
                        return;
                }
-               /* Fall through */
+               fallthrough;
        case MPT_PERF_MODE_LATENCY:
                /*
                 * Enable interrupt coalescing on all reply queues
index 43260306668cfb8d7f9fbb45b672f4c24bc6f61e..7c119b9048349bbd37aefa92b8200c2764358c58 100644 (file)
@@ -1002,7 +1002,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
                }
                /* drop to default case for posting the request */
        }
-               /* fall through */
+               fallthrough;
        default:
                ioc->build_sg_mpi(ioc, psge, data_out_dma, data_out_sz,
                    data_in_dma, data_in_sz);
index 08fc4b381056c726a6203d44d74323f7241bc517..2e2756d8a49b111002e9eb11066db16c9a9fbc5f 100644 (file)
@@ -5470,7 +5470,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 
        case MPI2_IOCSTATUS_SCSI_DATA_OVERRUN:
                scsi_set_resid(scmd, 0);
-               /* fall through */
+               fallthrough;
        case MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR:
        case MPI2_IOCSTATUS_SUCCESS:
                scmd->result = (DID_OK << 16) | scsi_status;
@@ -6480,7 +6480,7 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc,
                        if (!test_bit(handle, ioc->pend_os_device_add))
                                break;
 
-                       /* fall through */
+                       fallthrough;
 
                case MPI2_EVENT_SAS_TOPO_RC_TARG_ADDED:
 
@@ -7208,7 +7208,7 @@ _scsih_pcie_topology_change_event(struct MPT3SAS_ADAPTER *ioc,
                        event_data->PortEntry[i].PortStatus &= 0xF0;
                        event_data->PortEntry[i].PortStatus |=
                                MPI26_EVENT_PCIE_TOPO_PS_DEV_ADDED;
-                       /* fall through */
+                       fallthrough;
                case MPI26_EVENT_PCIE_TOPO_PS_DEV_ADDED:
                        if (ioc->shost_recovery)
                                break;
@@ -10653,7 +10653,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                case MPI26_MFGPAGE_DEVID_CFG_SEC_3916:
                        dev_info(&pdev->dev,
                            "HBA is in Configurable Secure mode\n");
-                       /* fall through */
+                       fallthrough;
                case MPI26_MFGPAGE_DEVID_HARD_SEC_3816:
                case MPI26_MFGPAGE_DEVID_HARD_SEC_3916:
                        ioc->is_aero_ioc = ioc->is_gen35_ioc = 1;
index d4bd31a75b9dbf8accf12d05c1c6349f9c823163..b2869c5dd7fb53a7c2c4a8701cae280053872270 100644 (file)
@@ -650,7 +650,7 @@ static void myrb_bgi_control(struct myrb_hba *cb)
                if (sdev && cb->bgi_status.status == MYRB_BGI_INPROGRESS)
                        sdev_printk(KERN_INFO, sdev,
                                    "Background Initialization Aborted\n");
-               /* Fallthrough */
+               fallthrough;
        case MYRB_STATUS_NO_BGI_INPROGRESS:
                cb->bgi_status.status = MYRB_BGI_INVALID;
                break;
@@ -1528,7 +1528,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
                        scmd->scsi_done(scmd);
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        case WRITE_6:
                lba = (((scmd->cmnd[1] & 0x1F) << 16) |
                       (scmd->cmnd[2] << 8) |
@@ -1545,7 +1545,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
                        scmd->scsi_done(scmd);
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        case WRITE_10:
        case VERIFY:            /* 0x2F */
        case WRITE_VERIFY:      /* 0x2E */
@@ -1562,7 +1562,7 @@ static int myrb_ldev_queuecommand(struct Scsi_Host *shost,
                        scmd->scsi_done(scmd);
                        return 0;
                }
-               /* fall through */
+               fallthrough;
        case WRITE_12:
        case VERIFY_12: /* 0xAF */
        case WRITE_VERIFY_12:   /* 0xAE */
index f88adab3f9135ca30f68379bc0e7025bb3f62663..03d70138ad58daffda6e3d211b0c41078d5b3c39 100644 (file)
@@ -3640,7 +3640,7 @@ ncr_script_copy_and_bind (struct ncb *np, ncrcmd *src, ncrcmd *dst, int len)
                                                new = old;
                                                break;
                                        }
-                                       /* fall through */
+                                       fallthrough;
                                default:
                                        panic("ncr_script_copy_and_bind: weird relocation %x\n", old);
                                        break;
@@ -3910,14 +3910,14 @@ static void __init ncr_prepare_setting(struct ncb *np)
                                        np->scsi_mode = SMODE_HVD;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case 3: /* SYMBIOS controllers report HVD through GPIO3 */
                        if (INB(nc_gpreg) & 0x08)
                                break;
-                       /* fall through */
+                       fallthrough;
                case 2: /* Set HVD unconditionally */
                        np->scsi_mode = SMODE_HVD;
-                       /* fall through */
+                       fallthrough;
                case 1: /* Trust previous settings for HVD */
                        if (np->sv_stest2 & 0x20)
                                np->scsi_mode = SMODE_HVD;
@@ -4296,7 +4296,7 @@ static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd)
                        break;
                cp->phys.header.wgoalp  = cpu_to_scr(goalp);
                cp->phys.header.wlastp  = cpu_to_scr(lastp);
-               /* fall through */
+               fallthrough;
        case DMA_FROM_DEVICE:
                goalp = NCB_SCRIPT_PHYS (np, data_in2) + 8;
                if (segments <= MAX_SCATTERL)
@@ -6717,7 +6717,7 @@ void ncr_int_sir (struct ncb *np)
                        OUTL_DSP (scr_to_cpu(tp->lp[0]->jump_ccb[0]));
                        return;
                }
-               /* fall through */
+               fallthrough;
        case SIR_RESEL_BAD_TARGET:      /* Will send a TARGET RESET message */
        case SIR_RESEL_BAD_LUN:         /* Will send a TARGET RESET message */
        case SIR_RESEL_BAD_I_T_L_Q:     /* Will send an ABORT TAG message   */
@@ -6825,7 +6825,7 @@ void ncr_int_sir (struct ncb *np)
                */
                OUTB (HS_PRT, HS_BUSY);
 
-               /* fall through */
+               fallthrough;
 
        case SIR_NEGO_PROTO:
                /*-------------------------------------------------------
index 8655ff1249bbc981e50f41f6294ec2bc6dc7baa8..bc5a623519e7ba5accaa726a69ae149849ceb8b1 100644 (file)
@@ -1113,7 +1113,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
                        nsp_scsi_done(tmpSC);
                        return IRQ_HANDLED;
                }
-               /* fall thru */
+               fallthrough;
        default:
                if ((irq_status & (IRQSTATUS_SCSI | IRQSTATUS_FIFO)) == 0) {
                        return IRQ_HANDLED;
index 337e79d6837ffa86d6dde1e6a0d077692800ce37..9889bab7d31c1ca60cc2b14347d31a2c3b0c1c85 100644 (file)
@@ -818,7 +818,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
 
                res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
                if (res)
-                       return res;
+                       goto ex_err;
                ccb = &pm8001_ha->ccb_info[ccb_tag];
                ccb->device = pm8001_dev;
                ccb->ccb_tag = ccb_tag;
index 0ae800c5b7396aa5944eb36bf8bbb4ae5f1f632c..aa41f7ac91cb7bf8bde076f519acb84d2f185896 100644 (file)
@@ -717,7 +717,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                        }
                        cmd->SCp.phase++;
                }
-               /* fall through */
+               fallthrough;
 
        case 2:         /* Phase 2 - We are now talking to the scsi bus */
                if (!ppa_select(dev, scmd_id(cmd))) {
@@ -725,7 +725,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                        return 0;
                }
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 3:         /* Phase 3 - Ready to accept a command */
                w_ctr(ppb, 0x0c);
@@ -735,7 +735,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                if (!ppa_send_command(cmd))
                        return 0;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 4:         /* Phase 4 - Setup scatter/gather buffers */
                if (scsi_bufflen(cmd)) {
@@ -749,7 +749,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                }
                cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 5:         /* Phase 5 - Data transfer stage */
                w_ctr(ppb, 0x0c);
@@ -762,7 +762,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
                if (retv == 0)
                        return 1;
                cmd->SCp.phase++;
-               /* fall through */
+               fallthrough;
 
        case 6:         /* Phase 6 - Read status/message */
                cmd->result = DID_OK << 16;
index 3f04f2c8136638117803e9db000ccbcfbe8006e6..5ca424df355c15912e0a9380dc2559d4f0ea988d 100644 (file)
@@ -3863,7 +3863,7 @@ void qedf_stag_change_work(struct work_struct *work)
            container_of(work, struct qedf_ctx, stag_work.work);
 
        if (!qedf) {
-               QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
+               QEDF_ERR(NULL, "qedf is NULL");
                return;
        }
        QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n");
index 1bc090d8a71b0e2f08b660b50c7a6b0586531649..a165120d2976f711c0915c7504ec268de4aa3d6b 100644 (file)
@@ -1626,7 +1626,7 @@ typedef struct {
         */
        uint8_t  firmware_options[2];
 
-       uint16_t frame_payload_size;
+       __le16  frame_payload_size;
        __le16  max_iocb_allocation;
        __le16  execution_throttle;
        uint8_t  retry_count;
index de9fd7f688d014dca79eba9fde812ae63e14c91e..b569fd6e96d63637f15633c279b3997b367a117c 100644 (file)
@@ -177,7 +177,7 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
                        break;
                case CS_TIMEOUT:
                        rval = QLA_FUNCTION_TIMEOUT;
-                       /* fall through */
+                       fallthrough;
                default:
                        ql_dbg(ql_dbg_disc, vha, 0x2033,
                            "%s failed, completion status (%x) on port_id: "
index 57a2d76aa691d6707c180f6e72a4ffe4b1ab63dd..0bd04a62af836dc113398a31835569aabca2b9f7 100644 (file)
@@ -857,7 +857,7 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
                                            fcport);
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                if (fcport_is_smaller(fcport)) {
                                        /* local adapter is bigger */
@@ -4603,18 +4603,18 @@ qla2x00_nvram_config(scsi_qla_host_t *vha)
                        nv->firmware_options[1] = BIT_7 | BIT_5;
                        nv->add_firmware_options[0] = BIT_5;
                        nv->add_firmware_options[1] = BIT_5 | BIT_4;
-                       nv->frame_payload_size = 2048;
+                       nv->frame_payload_size = cpu_to_le16(2048);
                        nv->special_options[1] = BIT_7;
                } else if (IS_QLA2200(ha)) {
                        nv->firmware_options[0] = BIT_2 | BIT_1;
                        nv->firmware_options[1] = BIT_7 | BIT_5;
                        nv->add_firmware_options[0] = BIT_5;
                        nv->add_firmware_options[1] = BIT_5 | BIT_4;
-                       nv->frame_payload_size = 1024;
+                       nv->frame_payload_size = cpu_to_le16(1024);
                } else if (IS_QLA2100(ha)) {
                        nv->firmware_options[0] = BIT_3 | BIT_1;
                        nv->firmware_options[1] = BIT_5;
-                       nv->frame_payload_size = 1024;
+                       nv->frame_payload_size = cpu_to_le16(1024);
                }
 
                nv->max_iocb_allocation = cpu_to_le16(256);
index e3d2dea0b057c0a997d8dba6e4589174e32aa501..0954fa41911caceb9a59e0d9a997501449ca5fad 100644 (file)
@@ -2874,7 +2874,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
                                            &vha->dpc_flags);
                                        qla2xxx_wake_dpc(vha);
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                ql_dbg(ql_dbg_disc, vha, 0x20eb,
                                    "%s %8phC cmd error fw_status 0x%x 0x%x 0x%x\n",
index ab5275dbc33893074fdd2f8727a62e44b001d93d..25e0a1684763251da1cae29a66279a89aaea3d8d 100644 (file)
@@ -1580,11 +1580,11 @@ global_port_update:
                                qla2xxx_wake_dpc(vha);
                        }
                }
-               /* fall through */
+               fallthrough;
        case MBA_IDC_COMPLETE:
                if (ha->notify_lb_portup_comp && !vha->vp_idx)
                        complete(&ha->lb_portup_comp);
-               /* Fallthru */
+               fallthrough;
        case MBA_IDC_TIME_EXT:
                if (IS_QLA81XX(vha->hw) || IS_QLA8031(vha->hw) ||
                    IS_QLA8044(ha))
@@ -2188,7 +2188,7 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req,
                                set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
                        qla2xxx_wake_dpc(vha);
                }
-               /* fall through */
+               fallthrough;
        default:
                data[0] = MBS_COMMAND_ERROR;
                break;
@@ -2368,7 +2368,7 @@ static void qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
        case CS_PORT_UNAVAILABLE:
        case CS_PORT_LOGGED_OUT:
                fcport->nvme_flag |= NVME_FLAG_RESETTING;
-               /* fall through */
+               fallthrough;
        case CS_ABORTED:
        case CS_PORT_BUSY:
                fd->transferred_length = 0;
@@ -3485,7 +3485,7 @@ process_err:
                        } else {
                                qlt_24xx_process_atio_queue(vha, 1);
                        }
-                       /* fall through */
+                       fallthrough;
                case ABTS_RESP_24XX:
                case CTIO_TYPE7:
                case CTIO_CRC2:
index e161c05d7d826a8936c919d58d7909d7fd73e6b8..411b8a9ff393b425b254866f82f68e9f9e2b9d82 100644 (file)
@@ -2457,7 +2457,7 @@ qla2x00_write_optrom_data(struct scsi_qla_host *vha, void *buf,
                                sec_mask = 0x10000;
                                break;
                        }
-                       /* Fall through... */
+                       fallthrough;
 
                case 0x1f: /* Atmel flash. */
                        /* 512k sector size. */
@@ -2466,7 +2466,7 @@ qla2x00_write_optrom_data(struct scsi_qla_host *vha, void *buf,
                                sec_mask =   0x80000000;
                                break;
                        }
-                       /* Fall through... */
+                       fallthrough;
 
                case 0x01: /* AMD flash. */
                        if (flash_id == 0x38 || flash_id == 0x40 ||
@@ -2499,7 +2499,7 @@ qla2x00_write_optrom_data(struct scsi_qla_host *vha, void *buf,
                                sec_mask = 0x1e000;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        /* Default to 16 kb sector size. */
                        rest_addr = 0x3fff;
index 90289162dbd4c748a50721aa1766b669d53339a0..2d445bdb2129090a7aa0f0b688a21bc632de9d75 100644 (file)
@@ -442,7 +442,7 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha,
                ql_dbg(ql_dbg_tgt, vha, 0xe073,
                        "qla_target(%d):%s: CRC2 Response pkt\n",
                        vha->vp_idx, __func__);
-               /* fall through */
+               fallthrough;
        case CTIO_TYPE7:
        {
                struct ctio7_from_24xx *entry = (struct ctio7_from_24xx *)pkt;
@@ -4423,7 +4423,7 @@ static int qlt_issue_task_mgmt(struct fc_port *sess, u64 lun,
        case QLA_TGT_CLEAR_TS:
        case QLA_TGT_ABORT_TS:
                abort_cmds_for_lun(vha, lun, a->u.isp24.fcp_hdr.s_id);
-               /* fall through */
+               fallthrough;
        case QLA_TGT_CLEAR_ACA:
                h = qlt_find_qphint(vha, mcmd->unpacked_lun);
                mcmd->qpair = h->qpair;
@@ -5057,7 +5057,7 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha,
                        res = 1;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case ELS_LOGO:
        case ELS_PRLO:
                spin_lock_irqsave(&ha->tgt.sess_lock, flags);
index bab87e47b238dbdb0c4a07e534238661140d84cd..676778cbc55099727422bb3730f35cb7d84dcf9f 100644 (file)
@@ -2907,7 +2907,7 @@ static int qla4xxx_session_get_param(struct iscsi_cls_session *cls_sess,
                                                chap_tbl.secret_len);
                        }
                }
-               /* fall through */
+               fallthrough;
        default:
                return iscsi_session_get_param(cls_sess, param, buf);
        }
index 3790e8b70bba941e638ed9082687629168a54f59..48ff7d88af8604c2bee81c9b2c739ced57536fa2 100644 (file)
@@ -200,15 +200,15 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
        /* Write mailbox command registers. */
        switch (mbox_param[param[0]] >> 4) {
        case 6: sbus_writew(param[5], qpti->qregs + MBOX5);
-               /* Fall through */
+               fallthrough;
        case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
-               /* Fall through */
+               fallthrough;
        case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
-               /* Fall through */
+               fallthrough;
        case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
-               /* Fall through */
+               fallthrough;
        case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
-               /* Fall through */
+               fallthrough;
        case 1: sbus_writew(param[0], qpti->qregs + MBOX0);
        }
 
@@ -259,15 +259,15 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
        /* Read back output parameters. */
        switch (mbox_param[param[0]] & 0xf) {
        case 6: param[5] = sbus_readw(qpti->qregs + MBOX5);
-               /* Fall through */
+               fallthrough;
        case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
-               /* Fall through */
+               fallthrough;
        case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
-               /* Fall through */
+               fallthrough;
        case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
-               /* Fall through */
+               fallthrough;
        case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
-               /* Fall through */
+               fallthrough;
        case 1: param[0] = sbus_readw(qpti->qregs + MBOX0);
        }
 
index 139f0073da371b94dad7180e49776a84e79601a9..1ad7260d4758f4d0d2a232f6bb2561bc3a940a9b 100644 (file)
@@ -4482,8 +4482,6 @@ static int resp_open_zone(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
                goto fini;
        }
 
-       if (zc == ZC2_IMPLICIT_OPEN)
-               zbc_close_zone(devip, zsp);
        zbc_open_zone(devip, zsp, true);
 fini:
        write_unlock(macc_lckp);
index 927b1e6418423fa6e08b82d75ff53b6b94dc1d0f..7d3571a2bd89bb802f4457c925f1acff21dc2fbb 100644 (file)
@@ -599,7 +599,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
                        set_host_byte(scmd, DID_ALLOC_FAILURE);
                        return SUCCESS;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case COPY_ABORTED:
        case VOLUME_OVERFLOW:
        case MISCOMPARE:
@@ -621,7 +621,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
                        return ADD_TO_MLQUEUE;
                else
                        set_host_byte(scmd, DID_TARGET_FAILURE);
-               /* FALLTHROUGH */
+               fallthrough;
 
        case ILLEGAL_REQUEST:
                if (sshdr.asc == 0x20 || /* Invalid command operation code */
@@ -734,7 +734,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
        switch (status_byte(scmd->result)) {
        case GOOD:
                scsi_handle_queue_ramp_up(scmd->device);
-               /* FALLTHROUGH */
+               fallthrough;
        case COMMAND_TERMINATED:
                return SUCCESS;
        case CHECK_CONDITION:
@@ -755,7 +755,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
                return FAILED;
        case QUEUE_FULL:
                scsi_handle_queue_full(scmd->device);
-               /* fall through */
+               fallthrough;
        case BUSY:
                return NEEDS_RETRY;
        default:
@@ -1302,7 +1302,7 @@ retry_tur:
        case NEEDS_RETRY:
                if (retry_cnt--)
                        goto retry_tur;
-               /*FALLTHRU*/
+               fallthrough;
        case SUCCESS:
                return 0;
        default:
@@ -1739,7 +1739,7 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
                if (msg_byte(scmd->result) == COMMAND_COMPLETE &&
                    status_byte(scmd->result) == RESERVATION_CONFLICT)
                        return 0;
-               /* fall through */
+               fallthrough;
        case DID_SOFT_ERROR:
                return (scmd->request->cmd_flags & REQ_FAILFAST_DRIVER);
        }
@@ -1810,7 +1810,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                        set_host_byte(scmd, DID_TIME_OUT);
                        return SUCCESS;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case DID_NO_CONNECT:
        case DID_BAD_TARGET:
                /*
@@ -1854,7 +1854,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                         * lower down
                         */
                        break;
-               /* fallthrough */
+               fallthrough;
        case DID_BUS_BUSY:
        case DID_PARITY:
                goto maybe_retry;
@@ -1892,7 +1892,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                 * the case of trying to send too many commands to a
                 * tagged queueing device.
                 */
-               /* FALLTHROUGH */
+               fallthrough;
        case BUSY:
                /*
                 * device can't talk to us at the moment.  Should only
@@ -1905,7 +1905,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                if (scmd->cmnd[0] == REPORT_LUNS)
                        scmd->device->sdev_target->expecting_lun_change = 0;
                scsi_handle_queue_ramp_up(scmd->device);
-               /* FALLTHROUGH */
+               fallthrough;
        case COMMAND_TERMINATED:
                return SUCCESS;
        case TASK_ABORTED:
@@ -2376,22 +2376,22 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
                rtn = scsi_try_bus_device_reset(scmd);
                if (rtn == SUCCESS || (val & SG_SCSI_RESET_NO_ESCALATE))
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case SG_SCSI_RESET_TARGET:
                rtn = scsi_try_target_reset(scmd);
                if (rtn == SUCCESS || (val & SG_SCSI_RESET_NO_ESCALATE))
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case SG_SCSI_RESET_BUS:
                rtn = scsi_try_bus_reset(scmd);
                if (rtn == SUCCESS || (val & SG_SCSI_RESET_NO_ESCALATE))
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        case SG_SCSI_RESET_HOST:
                rtn = scsi_try_host_reset(scmd);
                if (rtn == SUCCESS)
                        break;
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                rtn = FAILED;
                break;
index 45d04b7b26439896b3caa4654222d77255994750..14872c9dc78cc6738a29043c8781de2952d23a75 100644 (file)
@@ -117,14 +117,14 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
                case NOT_READY: /* This happens if there is no disc in drive */
                        if (sdev->removable)
                                break;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case UNIT_ATTENTION:
                        if (sdev->removable) {
                                sdev->changed = 1;
                                result = 0;     /* This is no longer considered an error */
                                break;
                        }
-                       /* FALLTHROUGH -- for non-removable media */
+                       fallthrough;    /* for non-removable media */
                default:
                        sdev_printk(KERN_INFO, sdev,
                                    "ioctl_internal_command return code = %x\n",
index 7c6dd6f751907bf961334d7fae0f4d41d5e7bdad..7affaaf8b98e0c8cbc819e69bc017d1be8b29822 100644 (file)
@@ -795,7 +795,7 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
                }
                if (!scsi_end_request(req, blk_stat, blk_rq_err_bytes(req)))
                        return;
-               /*FALLTHRU*/
+               fallthrough;
        case ACTION_REPREP:
                scsi_io_completion_reprep(cmd, q);
                break;
index 95018e650f2d0ce79702b7dc049827ecb9b51cd9..16503e22691eda519a85c7b3b4ffc68214b64de4 100644 (file)
@@ -2964,26 +2964,32 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
 
        if (sdkp->device->type == TYPE_ZBC) {
                /* Host-managed */
-               q->limits.zoned = BLK_ZONED_HM;
+               blk_queue_set_zoned(sdkp->disk, BLK_ZONED_HM);
        } else {
                sdkp->zoned = (buffer[8] >> 4) & 3;
-               if (sdkp->zoned == 1 && !disk_has_partitions(sdkp->disk)) {
+               if (sdkp->zoned == 1) {
                        /* Host-aware */
-                       q->limits.zoned = BLK_ZONED_HA;
+                       blk_queue_set_zoned(sdkp->disk, BLK_ZONED_HA);
                } else {
-                       /*
-                        * Treat drive-managed devices and host-aware devices
-                        * with partitions as regular block devices.
-                        */
-                       q->limits.zoned = BLK_ZONED_NONE;
-                       if (sdkp->zoned == 2 && sdkp->first_scan)
-                               sd_printk(KERN_NOTICE, sdkp,
-                                         "Drive-managed SMR disk\n");
+                       /* Regular disk or drive managed disk */
+                       blk_queue_set_zoned(sdkp->disk, BLK_ZONED_NONE);
                }
        }
-       if (blk_queue_is_zoned(q) && sdkp->first_scan)
+
+       if (!sdkp->first_scan)
+               goto out;
+
+       if (blk_queue_is_zoned(q)) {
                sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n",
                      q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware");
+       } else {
+               if (sdkp->zoned == 1)
+                       sd_printk(KERN_NOTICE, sdkp,
+                                 "Host-aware SMR disk used as regular disk\n");
+               else if (sdkp->zoned == 2)
+                       sd_printk(KERN_NOTICE, sdkp,
+                                 "Drive-managed SMR disk\n");
+       }
 
  out:
        kfree(buffer);
@@ -3404,10 +3410,6 @@ static int sd_probe(struct device *dev)
        sdkp->first_scan = 1;
        sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS;
 
-       error = sd_zbc_init_disk(sdkp);
-       if (error)
-               goto out_free_index;
-
        sd_revalidate_disk(gd);
 
        gd->flags = GENHD_FL_EXT_DEVT;
index 4933e7daf17d778fd9e85658074501d37afdab29..a3aad608bc383748b43d055d526db2ff66d50cdd 100644 (file)
@@ -215,7 +215,6 @@ static inline int sd_is_zoned(struct scsi_disk *sdkp)
 
 #ifdef CONFIG_BLK_DEV_ZONED
 
-int sd_zbc_init_disk(struct scsi_disk *sdkp);
 void sd_zbc_release_disk(struct scsi_disk *sdkp);
 int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buffer);
 int sd_zbc_revalidate_zones(struct scsi_disk *sdkp);
@@ -231,11 +230,6 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba,
 
 #else /* CONFIG_BLK_DEV_ZONED */
 
-static inline int sd_zbc_init_disk(struct scsi_disk *sdkp)
-{
-       return 0;
-}
-
 static inline void sd_zbc_release_disk(struct scsi_disk *sdkp) {}
 
 static inline int sd_zbc_read_zones(struct scsi_disk *sdkp,
@@ -259,7 +253,7 @@ static inline blk_status_t sd_zbc_setup_zone_mgmt_cmnd(struct scsi_cmnd *cmd,
 static inline unsigned int sd_zbc_complete(struct scsi_cmnd *cmd,
                        unsigned int good_bytes, struct scsi_sense_hdr *sshdr)
 {
-       return 0;
+       return good_bytes;
 }
 
 static inline blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd,
index 0e94ff056bff4fe516d8027a33544010d6ed1ebf..cf07b7f9357906d875ffd7e3dda16c66b221f49a 100644 (file)
@@ -651,6 +651,28 @@ static void sd_zbc_print_zones(struct scsi_disk *sdkp)
                          sdkp->zone_blocks);
 }
 
+static int sd_zbc_init_disk(struct scsi_disk *sdkp)
+{
+       sdkp->zones_wp_offset = NULL;
+       spin_lock_init(&sdkp->zones_wp_offset_lock);
+       sdkp->rev_wp_offset = NULL;
+       mutex_init(&sdkp->rev_mutex);
+       INIT_WORK(&sdkp->zone_wp_offset_work, sd_zbc_update_wp_offset_workfn);
+       sdkp->zone_wp_update_buf = kzalloc(SD_BUF_SIZE, GFP_KERNEL);
+       if (!sdkp->zone_wp_update_buf)
+               return -ENOMEM;
+
+       return 0;
+}
+
+void sd_zbc_release_disk(struct scsi_disk *sdkp)
+{
+       kvfree(sdkp->zones_wp_offset);
+       sdkp->zones_wp_offset = NULL;
+       kfree(sdkp->zone_wp_update_buf);
+       sdkp->zone_wp_update_buf = NULL;
+}
+
 static void sd_zbc_revalidate_zones_cb(struct gendisk *disk)
 {
        struct scsi_disk *sdkp = scsi_disk(disk);
@@ -667,7 +689,24 @@ int sd_zbc_revalidate_zones(struct scsi_disk *sdkp)
        u32 max_append;
        int ret = 0;
 
-       if (!sd_is_zoned(sdkp))
+       /*
+        * For all zoned disks, initialize zone append emulation data if not
+        * already done. This is necessary also for host-aware disks used as
+        * regular disks due to the presence of partitions as these partitions
+        * may be deleted and the disk zoned model changed back from
+        * BLK_ZONED_NONE to BLK_ZONED_HA.
+        */
+       if (sd_is_zoned(sdkp) && !sdkp->zone_wp_update_buf) {
+               ret = sd_zbc_init_disk(sdkp);
+               if (ret)
+                       return ret;
+       }
+
+       /*
+        * There is nothing to do for regular disks, including host-aware disks
+        * that have partitions.
+        */
+       if (!blk_queue_is_zoned(q))
                return 0;
 
        /*
@@ -764,28 +803,3 @@ err:
 
        return ret;
 }
-
-int sd_zbc_init_disk(struct scsi_disk *sdkp)
-{
-       if (!sd_is_zoned(sdkp))
-               return 0;
-
-       sdkp->zones_wp_offset = NULL;
-       spin_lock_init(&sdkp->zones_wp_offset_lock);
-       sdkp->rev_wp_offset = NULL;
-       mutex_init(&sdkp->rev_mutex);
-       INIT_WORK(&sdkp->zone_wp_offset_work, sd_zbc_update_wp_offset_workfn);
-       sdkp->zone_wp_update_buf = kzalloc(SD_BUF_SIZE, GFP_KERNEL);
-       if (!sdkp->zone_wp_update_buf)
-               return -ENOMEM;
-
-       return 0;
-}
-
-void sd_zbc_release_disk(struct scsi_disk *sdkp)
-{
-       kvfree(sdkp->zones_wp_offset);
-       sdkp->zones_wp_offset = NULL;
-       kfree(sdkp->zone_wp_update_buf);
-       sdkp->zone_wp_update_buf = NULL;
-}
index bd38c8cea56e147a48fe7571cf1ee9b1f97be681..ca1e6cf6a38ef61df1417dbe51c31e049c4943e8 100644 (file)
@@ -516,7 +516,7 @@ static int pqi_build_raid_path_request(struct pqi_ctrl_info *ctrl_info,
                break;
        case BMIC_SENSE_DIAG_OPTIONS:
                cdb_length = 0;
-               /* fall through */
+               fallthrough;
        case BMIC_IDENTIFY_CONTROLLER:
        case BMIC_IDENTIFY_PHYSICAL_DEVICE:
        case BMIC_SENSE_SUBSYSTEM_INFORMATION:
@@ -527,7 +527,7 @@ static int pqi_build_raid_path_request(struct pqi_ctrl_info *ctrl_info,
                break;
        case BMIC_SET_DIAG_OPTIONS:
                cdb_length = 0;
-               /* fall through */
+               fallthrough;
        case BMIC_WRITE_HOST_WELLNESS:
                request->data_direction = SOP_WRITE_FLAG;
                cdb[0] = BMIC_WRITE;
@@ -2324,7 +2324,7 @@ static int pqi_raid_bypass_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info,
        switch (scmd->cmnd[0]) {
        case WRITE_6:
                is_write = true;
-               /* fall through */
+               fallthrough;
        case READ_6:
                first_block = (u64)(((scmd->cmnd[1] & 0x1f) << 16) |
                        (scmd->cmnd[2] << 8) | scmd->cmnd[3]);
@@ -2334,21 +2334,21 @@ static int pqi_raid_bypass_submit_scsi_cmd(struct pqi_ctrl_info *ctrl_info,
                break;
        case WRITE_10:
                is_write = true;
-               /* fall through */
+               fallthrough;
        case READ_10:
                first_block = (u64)get_unaligned_be32(&scmd->cmnd[2]);
                block_cnt = (u32)get_unaligned_be16(&scmd->cmnd[7]);
                break;
        case WRITE_12:
                is_write = true;
-               /* fall through */
+               fallthrough;
        case READ_12:
                first_block = (u64)get_unaligned_be32(&scmd->cmnd[2]);
                block_cnt = get_unaligned_be32(&scmd->cmnd[6]);
                break;
        case WRITE_16:
                is_write = true;
-               /* fall through */
+               fallthrough;
        case READ_16:
                first_block = get_unaligned_be64(&scmd->cmnd[2]);
                block_cnt = get_unaligned_be32(&scmd->cmnd[10]);
@@ -2948,7 +2948,7 @@ static unsigned int pqi_process_io_intr(struct pqi_ctrl_info *ctrl_info,
                case PQI_RESPONSE_IU_AIO_PATH_IO_SUCCESS:
                        if (io_request->scmd)
                                io_request->scmd->result = 0;
-                       /* fall through */
+                       fallthrough;
                case PQI_RESPONSE_IU_GENERAL_MANAGEMENT:
                        break;
                case PQI_RESPONSE_IU_VENDOR_GENERAL:
@@ -3115,12 +3115,11 @@ static void pqi_process_soft_reset(struct pqi_ctrl_info *ctrl_info,
 
        switch (reset_status) {
        case RESET_INITIATE_DRIVER:
-               /* fall through */
        case RESET_TIMEDOUT:
                dev_info(&ctrl_info->pci_dev->dev,
                        "resetting controller %u\n", ctrl_info->ctrl_id);
                sis_soft_reset(ctrl_info);
-               /* fall through */
+               fallthrough;
        case RESET_INITIATE_FIRMWARE:
                rc = pqi_ofa_ctrl_restart(ctrl_info);
                pqi_ofa_free_host_buffer(ctrl_info);
index 0c4aa4665a2f9d2a6fa9db565a220f01322c5ec1..3b3a53c6a0de530ba6eef5014d3812a89eac4015 100644 (file)
@@ -877,10 +877,10 @@ static void get_sectorsize(struct scsi_cd *cd)
                case 2340:
                case 2352:
                        sector_size = 2048;
-                       /* fall through */
+                       fallthrough;
                case 2048:
                        cd->capacity *= 4;
-                       /* fall through */
+                       fallthrough;
                case 512:
                        break;
                default:
index 87fbc0ea350b13bcf502ffb12350545a588c585e..e2e5356a997de58051279afa09fac75f984d32ca 100644 (file)
@@ -339,14 +339,14 @@ static void st_analyze_sense(struct st_request *SRpnt, struct st_cmdstatus *s)
                switch (sense[0] & 0x7f) {
                case 0x71:
                        s->deferred = 1;
-                       /* fall through */
+                       fallthrough;
                case 0x70:
                        s->fixed_format = 1;
                        s->flags = sense[2] & 0xe0;
                        break;
                case 0x73:
                        s->deferred = 1;
-                       /* fall through */
+                       fallthrough;
                case 0x72:
                        s->fixed_format = 0;
                        ucp = scsi_sense_desc_find(sense, SCSI_SENSE_BUFFERSIZE, 4);
@@ -2723,7 +2723,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
        switch (cmd_in) {
        case MTFSFM:
                chg_eof = 0;    /* Changed from the FSF after this */
-               /* fall through */
+               fallthrough;
        case MTFSF:
                cmd[0] = SPACE;
                cmd[1] = 0x01;  /* Space FileMarks */
@@ -2738,7 +2738,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
                break;
        case MTBSFM:
                chg_eof = 0;    /* Changed from the FSF after this */
-               /* fall through */
+               fallthrough;
        case MTBSF:
                cmd[0] = SPACE;
                cmd[1] = 0x01;  /* Space FileMarks */
index 701b842296f05259a47f6543b1432debbcf42cef..2e3fbc2fae976bfbcfd77878bef47923ff709f7d 100644 (file)
@@ -397,12 +397,12 @@ static int sun3scsi_dma_finish(int write_flag)
                case CSR_LEFT_3:
                        *vaddr = (dregs->bpack_lo & 0xff00) >> 8;
                        vaddr--;
-                       /* Fall through */
+                       fallthrough;
 
                case CSR_LEFT_2:
                        *vaddr = (dregs->bpack_hi & 0x00ff);
                        vaddr--;
-                       /* Fall through */
+                       fallthrough;
 
                case CSR_LEFT_1:
                        *vaddr = (dregs->bpack_hi & 0xff00) >> 8;
index 6d7651a7847e82704111e121febb897f96f63794..c6db61b61de3a5b9b9ede1dad9ed112591cd5e3d 100644 (file)
@@ -523,7 +523,7 @@ void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len)
                                        new = old;
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                new = 0;
                                panic("sym_fw_bind_script: "
index 8410117d5aa4413285c8d47fe9584a66127144eb..cc11daa1222b160f73afeab1b84f1838cd112bc5 100644 (file)
@@ -3059,7 +3059,7 @@ static void sym_sir_bad_scsi_status(struct sym_hcb *np, int num, struct sym_ccb
                        sym_print_addr(cp->cmd, "%s\n",
                                s_status == S_BUSY ? "BUSY" : "QUEUE FULL\n");
                }
-               /* fall through */
+               fallthrough;
        default:        /* S_INT, S_INT_COND_MET, S_CONFLICT */
                sym_complete_error (np, cp);
                break;
@@ -4620,7 +4620,7 @@ static void sym_int_sir(struct sym_hcb *np)
         *  Negotiation failed.
         *  Target does not want answer message.
         */
-       /* fall through */
+               fallthrough;
        case SIR_NEGO_PROTO:
                sym_nego_default(np, tp, cp);
                goto out;
index d37e2a69136ad62a54853df2da959e3ddba34d9c..e13d5351f155f3ae01783d2e8ca49560ab9af03e 100644 (file)
@@ -695,7 +695,7 @@ static int sym_read_Tekram_nvram (struct sym_device *np, Tekram_nvram *nvram)
                                          data, len);
                if (!x)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                x = sym_read_T93C46_nvram(np, nvram);
                break;
index bcfbbd0d5c4560af3abb0007cf5b5eb969cdd0de..5b2bc1a6f9226c2b1cfd925b9a6d83d014f9f839 100644 (file)
@@ -110,7 +110,7 @@ static int ufs_bsg_request(struct bsg_job *job)
                        goto out;
                }
 
-               /* fall through */
+               fallthrough;
        case UPIU_TRANSACTION_NOP_OUT:
        case UPIU_TRANSACTION_TASK_REQ:
                ret = ufshcd_exec_raw_upiu_cmd(hba, &bsg_request->upiu_req,
index da199fa7a3e079ea865462b20e289456f4cf127f..1d157ff58d81721387d25a31a52af5f0bd96ad8f 100644 (file)
@@ -1612,7 +1612,7 @@ start:
                 * currently running. Hence, fall through to cancel gating
                 * work and to enable clocks.
                 */
-               /* fallthrough */
+               fallthrough;
        case CLKS_OFF:
                ufshcd_scsi_block_requests(hba);
                hba->clk_gating.state = REQ_CLKS_ON;
@@ -1624,7 +1624,7 @@ start:
                 * fall through to check if we should wait for this
                 * work to be done or not.
                 */
-               /* fallthrough */
+               fallthrough;
        case REQ_CLKS_ON:
                if (async) {
                        rc = -EAGAIN;
@@ -4737,7 +4737,7 @@ ufshcd_scsi_cmd_status(struct ufshcd_lrb *lrbp, int scsi_status)
        switch (scsi_status) {
        case SAM_STAT_CHECK_CONDITION:
                ufshcd_copy_sense_data(lrbp);
-               /* fallthrough */
+               fallthrough;
        case SAM_STAT_GOOD:
                result |= DID_OK << 16 |
                          COMMAND_COMPLETE << 8 |
@@ -6277,7 +6277,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
        switch (msgcode) {
        case UPIU_TRANSACTION_NOP_OUT:
                cmd_type = DEV_CMD_TYPE_NOP;
-               /* fall through */
+               fallthrough;
        case UPIU_TRANSACTION_QUERY_REQ:
                ufshcd_hold(hba, false);
                mutex_lock(&hba->dev_cmd.lock);
index ca1c39b6f631f8ce53ca5bba2d7ae985eb398aea..3b18034320903437605d988e8f05838c88fd8091 100644 (file)
@@ -148,7 +148,7 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
        default:
                scmd_printk(KERN_WARNING, sc, "Unknown response %d",
                            resp->response);
-               /* fall through */
+               fallthrough;
        case VIRTIO_SCSI_S_FAILURE:
                set_host_byte(sc, DID_ERROR);
                break;
index 8dbb4db6831afbe0bc3e65c67a69763f76990999..081f54ab7d86cb2a076cc71284a76e8c134145e5 100644 (file)
@@ -607,7 +607,7 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
                case BTSTAT_TAGREJECT:
                case BTSTAT_BADMSG:
                        cmd->result = (DRIVER_INVALID << 24);
-                       /* fall through */
+                       fallthrough;
 
                case BTSTAT_HAHARDWARE:
                case BTSTAT_INVPHASE:
index f81046f0e68a69bea44e2f311a3d1f401b97a02c..87dafbc942d37ee0195d2fff8e01aa87ca020769 100644 (file)
@@ -1854,7 +1854,7 @@ round_4(unsigned int x)
                case 1: --x;
                        break;
                case 2: ++x;
-                       /* fall through */
+                       fallthrough;
                case 3: ++x;
        }
        return x;
index f0068e96a177fc0b48390d826638181983fdb248..259fc248d06cffa7278592d79cff2b6207987bda 100644 (file)
@@ -1111,7 +1111,7 @@ static void scsifront_backend_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's Closing state */
+               fallthrough;    /* Missed the backend's Closing state */
        case XenbusStateClosing:
                scsifront_disconnect(info);
                break;
index e19102f463027a6b1c93760500ecad9aed411cfc..b25d0f7dac9e8ad38914d445ec12f83f4ecb79ab 100644 (file)
@@ -353,7 +353,7 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
 
                debugfs_create_u32("nmodem_supported", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.nmodem_supported);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 14):
                qcom_socinfo->info.num_clusters = __le32_to_cpu(info->num_clusters);
                qcom_socinfo->info.ncluster_array_offset = __le32_to_cpu(info->ncluster_array_offset);
@@ -368,14 +368,14 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
                                   &qcom_socinfo->info.num_defective_parts);
                debugfs_create_u32("ndefective_parts_array_offset", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.ndefective_parts_array_offset);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 13):
                qcom_socinfo->info.nproduct_id = __le32_to_cpu(info->nproduct_id);
 
                debugfs_create_u32("nproduct_id", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.nproduct_id);
                DEBUGFS_ADD(info, chip_id);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 12):
                qcom_socinfo->info.chip_family =
                        __le32_to_cpu(info->chip_family);
@@ -392,7 +392,7 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
                debugfs_create_x32("raw_device_number", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.raw_device_num);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 11):
        case SOCINFO_VERSION(0, 10):
        case SOCINFO_VERSION(0, 9):
@@ -400,12 +400,12 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
 
                debugfs_create_u32("foundry_id", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.foundry_id);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 8):
        case SOCINFO_VERSION(0, 7):
                DEBUGFS_ADD(info, pmic_model);
                DEBUGFS_ADD(info, pmic_die_rev);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 6):
                qcom_socinfo->info.hw_plat_subtype =
                        __le32_to_cpu(info->hw_plat_subtype);
@@ -413,7 +413,7 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
                debugfs_create_u32("hardware_platform_subtype", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.hw_plat_subtype);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 5):
                qcom_socinfo->info.accessory_chip =
                        __le32_to_cpu(info->accessory_chip);
@@ -421,27 +421,27 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
                debugfs_create_u32("accessory_chip", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.accessory_chip);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 4):
                qcom_socinfo->info.plat_ver = __le32_to_cpu(info->plat_ver);
 
                debugfs_create_u32("platform_version", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.plat_ver);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 3):
                qcom_socinfo->info.hw_plat = __le32_to_cpu(info->hw_plat);
 
                debugfs_create_u32("hardware_platform", 0400,
                                   qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.hw_plat);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 2):
                qcom_socinfo->info.raw_ver  = __le32_to_cpu(info->raw_ver);
 
                debugfs_create_u32("raw_version", 0400, qcom_socinfo->dbg_root,
                                   &qcom_socinfo->info.raw_ver);
-               /* Fall through */
+               fallthrough;
        case SOCINFO_VERSION(0, 1):
                DEBUGFS_ADD(info, build_id);
                break;
index 42cf37a0556b30946e7d2f677c98926a7449fdef..d332e5d9abac49001e1d2acbcaafa02865124300 100644 (file)
@@ -2229,7 +2229,7 @@ static int tegra_pmc_clk_notify_cb(struct notifier_block *nb,
 
        case POST_RATE_CHANGE:
                pmc->rate = data->new_rate;
-               /* fall through */
+               fallthrough;
 
        case ABORT_RATE_CHANGE:
                mutex_unlock(&pmc->powergates_lock);
index e6e0fb9a81b4c00209fc40fdfa9d3764c59ce6cd..da0201693c24d591fedf76a2b9888fe16b0429d0 100644 (file)
@@ -1372,7 +1372,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
                return ret;
        }
 
-       /* Read Instat 1, Instat 2 and Instat 3 registers */
+       /* Read Intstat 1, Intstat 2 and Intstat 3 registers */
        ret = sdw_read(slave, SDW_SCP_INT1);
        if (ret < 0) {
                dev_err(slave->bus->dev,
index 37290a799023cb379f06c191d03057e7a8d9409c..6e36deb505b1e1e76013ccc83e9e93e0817be4df 100644 (file)
@@ -717,6 +717,7 @@ error:
        kfree(wbuf);
 error_1:
        kfree(wr_msg);
+       bus->defer_msg.msg = NULL;
        return ret;
 }
 
@@ -840,9 +841,10 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
 error:
        list_for_each_entry(m_rt, &stream->master_list, stream_node) {
                bus = m_rt->bus;
-
-               kfree(bus->defer_msg.msg->buf);
-               kfree(bus->defer_msg.msg);
+               if (bus->defer_msg.msg) {
+                       kfree(bus->defer_msg.msg->buf);
+                       kfree(bus->defer_msg.msg);
+               }
        }
 
 msg_unlock:
index 681d09085175696ccc9f3db3e332e2bdd3650558..9cfa15ec8b08c43e24484d88eca661b7e5f52dee 100644 (file)
@@ -1295,7 +1295,7 @@ static const struct of_device_id bcm_qspi_of_match[] = {
        },
        {
                .compatible = "brcm,spi-bcm-qspi",
-               .data = &bcm_qspi_rev_data,
+               .data = &bcm_qspi_no_rev_data,
        },
        {
                .compatible = "brcm,spi-bcm7216-qspi",
index c45d76c848c8db135648e4fd89a719286adf4669..41986ac0fbfb2e2d56e042f745254d089da7437b 100644 (file)
@@ -75,7 +75,7 @@
 #define DRV_NAME       "spi-bcm2835"
 
 /* define polling limits */
-unsigned int polling_limit_us = 30;
+static unsigned int polling_limit_us = 30;
 module_param(polling_limit_us, uint, 0664);
 MODULE_PARM_DESC(polling_limit_us,
                 "time in us to run a transfer in polling mode\n");
index 2f717812c76617d4f989c8082d0a13ebca1e1a07..03b034c15d2beb32d1ec2c450bfa7e8286b13053 100644 (file)
@@ -164,10 +164,10 @@ static inline void bcm2835aux_rd_fifo(struct bcm2835aux_spi *bs)
                switch (count) {
                case 3:
                        *bs->rx_buf++ = (data >> 16) & 0xff;
-                       /* fallthrough */
+                       fallthrough;
                case 2:
                        *bs->rx_buf++ = (data >> 8) & 0xff;
-                       /* fallthrough */
+                       fallthrough;
                case 1:
                        *bs->rx_buf++ = (data >> 0) & 0xff;
                        /* fallthrough - no default */
index 1c1a9d17eec0d4af3bcd11132cfb7a87435fccfd..c6795c684b16a61d0c3ba61bb1f924f898a222a9 100644 (file)
@@ -907,14 +907,16 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata,
        struct dma_async_tx_descriptor *tx;
        dma_cookie_t cookie;
        dma_addr_t dma_dst;
+       struct device *ddev;
 
        if (!cqspi->rx_chan || !virt_addr_valid(buf)) {
                memcpy_fromio(buf, cqspi->ahb_base + from, len);
                return 0;
        }
 
-       dma_dst = dma_map_single(dev, buf, len, DMA_FROM_DEVICE);
-       if (dma_mapping_error(dev, dma_dst)) {
+       ddev = cqspi->rx_chan->device->dev;
+       dma_dst = dma_map_single(ddev, buf, len, DMA_FROM_DEVICE);
+       if (dma_mapping_error(ddev, dma_dst)) {
                dev_err(dev, "dma mapping failed\n");
                return -ENOMEM;
        }
@@ -948,7 +950,7 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata,
        }
 
 err_unmap:
-       dma_unmap_single(dev, dma_dst, len, DMA_FROM_DEVICE);
+       dma_unmap_single(ddev, dma_dst, len, DMA_FROM_DEVICE);
 
        return ret;
 }
@@ -1128,8 +1130,17 @@ static int cqspi_request_mmap_dma(struct cqspi_st *cqspi)
        return 0;
 }
 
+static const char *cqspi_get_name(struct spi_mem *mem)
+{
+       struct cqspi_st *cqspi = spi_master_get_devdata(mem->spi->master);
+       struct device *dev = &cqspi->pdev->dev;
+
+       return devm_kasprintf(dev, GFP_KERNEL, "%s.%d", dev_name(dev), mem->spi->chip_select);
+}
+
 static const struct spi_controller_mem_ops cqspi_mem_ops = {
        .exec_op = cqspi_exec_mem_op,
+       .get_name = cqspi_get_name,
 };
 
 static int cqspi_setup_flash(struct cqspi_st *cqspi)
index 54ad0ac121e5bd12f3dde92b734ea42f085a7f81..ee905880769e6c86362c8bbdd5edcce3c0d324ad 100644 (file)
@@ -226,7 +226,7 @@ static void fsl_spi_free_dummy_rx(void)
        case 1:
                kfree(fsl_dummy_rx);
                fsl_dummy_rx = NULL;
-               /* fall through */
+               fallthrough;
        default:
                fsl_dummy_rx_refcnt--;
                break;
@@ -294,7 +294,7 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
                switch (mspi->subblock) {
                default:
                        dev_warn(dev, "cell-index unspecified, assuming SPI1\n");
-                       /* fall through */
+                       fallthrough;
                case 0:
                        mspi->subblock = QE_CR_SUBBLOCK_SPI1;
                        break;
index 91c6affe139c998bb0d51d0d1216acf1ca2c8101..127323a4b27c45348a67557077f3d88d843ca45f 100644 (file)
@@ -174,17 +174,17 @@ static const struct fsl_dspi_devtype_data devtype_data[] = {
                .fifo_size              = 16,
        },
        [LS2080A] = {
-               .trans_mode             = DSPI_DMA_MODE,
+               .trans_mode             = DSPI_XSPI_MODE,
                .max_clock_factor       = 8,
                .fifo_size              = 4,
        },
        [LS2085A] = {
-               .trans_mode             = DSPI_DMA_MODE,
+               .trans_mode             = DSPI_XSPI_MODE,
                .max_clock_factor       = 8,
                .fifo_size              = 4,
        },
        [LX2160A] = {
-               .trans_mode             = DSPI_DMA_MODE,
+               .trans_mode             = DSPI_XSPI_MODE,
                .max_clock_factor       = 8,
                .fifo_size              = 4,
        },
@@ -1273,11 +1273,14 @@ static int dspi_probe(struct platform_device *pdev)
        void __iomem *base;
        bool big_endian;
 
-       ctlr = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi));
+       dspi = devm_kzalloc(&pdev->dev, sizeof(*dspi), GFP_KERNEL);
+       if (!dspi)
+               return -ENOMEM;
+
+       ctlr = spi_alloc_master(&pdev->dev, 0);
        if (!ctlr)
                return -ENOMEM;
 
-       dspi = spi_controller_get_devdata(ctlr);
        dspi->pdev = pdev;
        dspi->ctlr = ctlr;
 
@@ -1414,7 +1417,7 @@ poll_mode:
        if (dspi->devtype_data->trans_mode != DSPI_DMA_MODE)
                ctlr->ptp_sts_supported = true;
 
-       platform_set_drvdata(pdev, ctlr);
+       platform_set_drvdata(pdev, dspi);
 
        ret = spi_register_controller(ctlr);
        if (ret != 0) {
@@ -1437,8 +1440,7 @@ out_ctlr_put:
 
 static int dspi_remove(struct platform_device *pdev)
 {
-       struct spi_controller *ctlr = platform_get_drvdata(pdev);
-       struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
+       struct fsl_dspi *dspi = platform_get_drvdata(pdev);
 
        /* Disconnect from the SPI framework */
        spi_unregister_controller(dspi->ctlr);
index e60581283a247c24c9795ffd7bdcf2fee34b0e22..6d148ab70b93e73f3b61b44250e659f3f9d7df30 100644 (file)
@@ -564,13 +564,14 @@ static void fsl_espi_cpu_irq(struct fsl_espi *espi, u32 events)
 static irqreturn_t fsl_espi_irq(s32 irq, void *context_data)
 {
        struct fsl_espi *espi = context_data;
-       u32 events;
+       u32 events, mask;
 
        spin_lock(&espi->lock);
 
        /* Get interrupt events(tx/rx) */
        events = fsl_espi_read_reg(espi, ESPI_SPIE);
-       if (!events) {
+       mask = fsl_espi_read_reg(espi, ESPI_SPIM);
+       if (!(events & mask)) {
                spin_unlock(&espi->lock);
                return IRQ_NONE;
        }
index 9522d1b5786d5c9e5fc49d6de14027c312ecdc1d..df981e55c24c99b618fa4a0e2849bfaab6b88ebc 100644 (file)
@@ -90,7 +90,7 @@ static struct spi_test spi_tests[] = {
        {
                .description    = "tx/rx-transfer - crossing PAGE_SIZE",
                .fill_option    = FILL_COUNT_8,
-               .iterate_len    = { ITERATE_MAX_LEN },
+               .iterate_len    = { ITERATE_LEN },
                .iterate_tx_align = ITERATE_ALIGN,
                .iterate_rx_align = ITERATE_ALIGN,
                .transfer_count = 1,
index bd23c4689b46317209b6bc8dbd30c00fe85acf90..127b8bd258312770a1ba15a60d4b5d64f279d171 100644 (file)
@@ -506,7 +506,7 @@ static int sprd_adi_probe(struct platform_device *pdev)
                default:
                        dev_err(&pdev->dev,
                                "failed to find hwlock id, %d\n", ret);
-                       /* fall-through */
+                       fallthrough;
                case -EPROBE_DEFER:
                        goto put_ctlr;
                }
index d4b33b358a31ecf07488148d23e06b0c81736220..3056428b09f314c128226664c0a5cd55244739f8 100644 (file)
@@ -936,7 +936,11 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
        }
 
        if (sr & STM32H7_SPI_SR_SUSP) {
-               dev_warn(spi->dev, "Communication suspended\n");
+               static DEFINE_RATELIMIT_STATE(rs,
+                                             DEFAULT_RATELIMIT_INTERVAL * 10,
+                                             1);
+               if (__ratelimit(&rs))
+                       dev_dbg_ratelimited(spi->dev, "Communication suspended\n");
                if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
                        stm32h7_spi_read_rxfifo(spi, false);
                /*
@@ -2060,7 +2064,7 @@ static int stm32_spi_resume(struct device *dev)
        }
 
        ret = pm_runtime_get_sync(dev);
-       if (ret) {
+       if (ret < 0) {
                dev_err(dev, "Unable to power device:%d\n", ret);
                return ret;
        }
index dc12af018350cd195e114abc8afd09fdbd01904d..0cab239d8e7fc00983084107c7a74f5f0367af74 100644 (file)
@@ -1327,8 +1327,6 @@ out:
        if (msg->status && ctlr->handle_err)
                ctlr->handle_err(ctlr, msg);
 
-       spi_res_release(ctlr, msg);
-
        spi_finalize_current_message(ctlr);
 
        return ret;
@@ -1725,6 +1723,13 @@ void spi_finalize_current_message(struct spi_controller *ctlr)
 
        spi_unmap_msg(ctlr, mesg);
 
+       /* In the prepare_messages callback the spi bus has the opportunity to
+        * split a transfer to smaller chunks.
+        * Release splited transfers here since spi_map_msg is done on the
+        * splited transfers.
+        */
+       spi_res_release(ctlr, mesg);
+
        if (ctlr->cur_msg_prepared && ctlr->unprepare_message) {
                ret = ctlr->unprepare_message(ctlr, mesg);
                if (ret) {
index 823dc99be46f15adf58389c5fd82e06f7627e7cf..a8d2525e7af9e8a098aafdc4a5caf69f43462992 100644 (file)
@@ -425,7 +425,7 @@ void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc,
                        *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_M2);
                        break;
                }
-               /* Fall through */
+               fallthrough;
        default:
                *m = chipco_read32(cc, SSB_CHIPCO_CLOCK_SB);
        }
index 1ca2ac5ef2b80f2f2e447f370c26584cd4df256b..354486b7ed3a718c41e3ceaa3da56a3d7e38b50f 100644 (file)
@@ -342,7 +342,7 @@ void ssb_mipscore_init(struct ssb_mipscore *mcore)
                                set_irq(dev, irq++);
                                break;
                        }
-                       /* fallthrough */
+                       fallthrough;
                case SSB_DEV_EXTIF:
                        set_irq(dev, 0);
                        break;
index b97a5c32d44abc0a11cf58a1d1d95c281ff512e4..f49ab1aa2149ab28213eed3639804d117ce15ea5 100644 (file)
@@ -228,7 +228,7 @@ static void __iomem *ssb_ioremap(struct ssb_bus *bus,
        switch (bus->bustype) {
        case SSB_BUSTYPE_SSB:
                /* Only map the first core for now. */
-               /* fallthrough... */
+               fallthrough;
        case SSB_BUSTYPE_PCMCIA:
                mmio = ioremap(baseaddr, SSB_CORE_SIZE);
                break;
index 8b100a71f02ef09919fcb38acf561b006f98b14a..237531ba60f30ea7722bc088f801011a1a861f1f 100644 (file)
@@ -173,8 +173,7 @@ static int gbaudio_remove_controls(struct snd_card *card, struct device *dev,
                id.index = control->index;
                kctl = snd_ctl_find_id(card, &id);
                if (!kctl) {
-                       dev_err(dev, "%d: Failed to find %s\n", err,
-                               control->name);
+                       dev_err(dev, "Failed to find %s\n", control->name);
                        continue;
                }
                err = snd_ctl_remove(card, kctl);
index 2f9fdbdcd547017b8704b7839f8cb33f658ab110..83b38ae8908c1be464df121c139349435fbaed07 100644 (file)
@@ -456,6 +456,15 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
        val = ucontrol->value.integer.value[0] & mask;
        connect = !!val;
 
+       ret = gb_pm_runtime_get_sync(bundle);
+       if (ret)
+               return ret;
+
+       ret = gb_audio_gb_get_control(module->mgmt_connection, data->ctl_id,
+                                     GB_AUDIO_INVALID_INDEX, &gbvalue);
+       if (ret)
+               goto exit;
+
        /* update ucontrol */
        if (gbvalue.value.integer_value[0] != val) {
                for (wi = 0; wi < wlist->num_widgets; wi++) {
@@ -466,25 +475,17 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
                gbvalue.value.integer_value[0] =
                        cpu_to_le32(ucontrol->value.integer.value[0]);
 
-               ret = gb_pm_runtime_get_sync(bundle);
-               if (ret)
-                       return ret;
-
                ret = gb_audio_gb_set_control(module->mgmt_connection,
                                              data->ctl_id,
                                              GB_AUDIO_INVALID_INDEX, &gbvalue);
-
-               gb_pm_runtime_put_autosuspend(bundle);
-
-               if (ret) {
-                       dev_err_ratelimited(codec_dev,
-                                           "%d:Error in %s for %s\n", ret,
-                                           __func__, kcontrol->id.name);
-                       return ret;
-               }
        }
 
-       return 0;
+exit:
+       gb_pm_runtime_put_autosuspend(bundle);
+       if (ret)
+               dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret,
+                                   __func__, kcontrol->id.name);
+       return ret;
 }
 
 #define SOC_DAPM_MIXER_GB(xname, kcount, data) \
index 8ea65bef35d24f4db4caa79c246e46f6df9d59ab..a4e4eef55f352a55b5c2363e6d472c0ea20ee3d8 100644 (file)
@@ -4984,7 +4984,7 @@ enum mipi_port_id __get_mipi_port(struct atomisp_device *isp,
                if (MIPI_PORT1_ID + 1 != N_MIPI_PORT_ID) {
                        return MIPI_PORT1_ID + 1;
                }
-       /* fall through */
+               fallthrough;
        default:
                dev_err(isp->dev, "unsupported port: %d\n", port);
                return MIPI_PORT0_ID;
index cccc5bfa105732f117992341e471ed44870e7436..1b2b2c68025b4cc6643c40942925cc8948c69a71 100644 (file)
@@ -704,14 +704,14 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd,
 
                        return false;
                }
-       /* fall-through */
+               fallthrough;
        case ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE:
                if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
                    pipe_id == IA_CSS_PIPE_ID_PREVIEW)
                        return true;
 
                return false;
-       /* fall-through */
+               fallthrough;
        case ATOMISP_RUN_MODE_VIDEO:
                if (!asd->continuous_mode->val) {
                        if (pipe_id == IA_CSS_PIPE_ID_VIDEO ||
@@ -720,7 +720,7 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd,
                        else
                                return false;
                }
-       /* fall through  */
+               fallthrough;
        case ATOMISP_RUN_MODE_SDV:
                if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
                    pipe_id == IA_CSS_PIPE_ID_VIDEO)
@@ -2765,7 +2765,7 @@ static unsigned int atomisp_get_pipe_index(struct atomisp_sub_device *asd,
                if (!atomisp_is_mbuscode_raw(asd->fmt[asd->capture_pad].fmt.code)) {
                        return IA_CSS_PIPE_ID_CAPTURE;
                }
-               /* fall through */
+               fallthrough;
        case ATOMISP_SUBDEV_PAD_SOURCE_PREVIEW:
                if (asd->yuvpp_mode)
                        return IA_CSS_PIPE_ID_YUVPP;
index f8d616f08b510fe093b9fe6e47683c2bb4b63137..65b0c8a662a06f267b739cc1af89e64586c81495 100644 (file)
@@ -1467,7 +1467,6 @@ enum ia_css_pipe_id atomisp_get_css_pipe_id(struct atomisp_sub_device *asd)
        case ATOMISP_RUN_MODE_VIDEO:
                return IA_CSS_PIPE_ID_VIDEO;
        case ATOMISP_RUN_MODE_STILL_CAPTURE:
-       /* fall through */
        default:
                return IA_CSS_PIPE_ID_CAPTURE;
        }
index a000a1e316f78d705f320cefd8f855b017ccd655..0114b040247b986abfc9babea458dd68a037db2f 100644 (file)
@@ -1086,7 +1086,7 @@ static int atomisp_subdev_probe(struct atomisp_device *isp)
                case RAW_CAMERA:
                        dev_dbg(isp->dev, "raw_index: %d\n", raw_index);
                        raw_index = isp->input_cnt;
-                       /* fall through */
+                       fallthrough;
                case SOC_CAMERA:
                        dev_dbg(isp->dev, "SOC_INDEX: %d\n", isp->input_cnt);
                        if (isp->input_cnt >= ATOM_ISP_MAX_INPUTS) {
index 4fb9bfdd2f4cee1506fce817d214b5a67c490143..f13af2329f4860a7bacdee9f5410ba6e26fbce5f 100644 (file)
@@ -660,7 +660,7 @@ static void free_private_bo_pages(struct hmm_buffer_object *bo,
                                break;
                        }
 
-                       /* fall through */
+                       fallthrough;
 
                /*
                 * if dynamic memory pool doesn't exist, need to free
index 54434c2dbaf904d8037b8f709452ede91ee8e744..a68cbb4995f0f3e02b63a84cafb384c274b02aad 100644 (file)
@@ -4510,7 +4510,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,
 #endif
                                        pipe->stop_requested = false;
                                }
-                               /* fall through */
+                               fallthrough;
                        case IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME:
                        case IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME:
                                frame = (struct ia_css_frame *)HOST_ADDRESS(ddr_buffer.kernel_ptr);
index 24041849384a4bd5189b57b856683e416d79b14f..6386a3989bfe9aaea9d243ee9b1777c908483eff 100644 (file)
@@ -110,7 +110,7 @@ hantro_g1_mpeg2_dec_set_buffers(struct hantro_dev *vpu, struct hantro_ctx *ctx,
        case V4L2_MPEG2_PICTURE_CODING_TYPE_B:
                backward_addr = hantro_get_ref(ctx,
                                               slice_params->backward_ref_ts);
-               /* fall-through */
+               fallthrough;
        case V4L2_MPEG2_PICTURE_CODING_TYPE_P:
                forward_addr = hantro_get_ref(ctx,
                                              slice_params->forward_ref_ts);
index 7e9aad67148963c5dc36f472bc7890005d5db808..f610fa5b43354bb9c7761ab90faa7273c0f8ffe2 100644 (file)
@@ -112,7 +112,7 @@ rk3399_vpu_mpeg2_dec_set_buffers(struct hantro_dev *vpu,
        case V4L2_MPEG2_PICTURE_CODING_TYPE_B:
                backward_addr = hantro_get_ref(ctx,
                                               slice_params->backward_ref_ts);
-               /* fall-through */
+               fallthrough;
        case V4L2_MPEG2_PICTURE_CODING_TYPE_P:
                forward_addr = hantro_get_ref(ctx,
                                              slice_params->forward_ref_ts);
index d92fd804488e907d5a29ea55a85ec576b294187b..21ebf77696964f4da12004df69947d44a8cae381 100644 (file)
@@ -488,7 +488,7 @@ static int csi_idmac_setup_channel(struct csi_priv *priv)
                        passthrough_cycles = incc->cycles;
                        break;
                }
-               /* fallthrough - non-passthrough RGB565 (CSI-2 bus) */
+               fallthrough;    /* non-passthrough RGB565 (CSI-2 bus) */
        default:
                burst_size = (image.pix.width & 0xf) ? 8 : 16;
                passthrough_bits = 16;
index bc27f9430eeb14712169a16f9807ee6536a4d5b1..7c6b91f0e780a303a60f623d702d3baae12d497d 100644 (file)
@@ -199,6 +199,7 @@ static int cedrus_request_validate(struct media_request *req)
        struct v4l2_ctrl *ctrl_test;
        unsigned int count;
        unsigned int i;
+       int ret = 0;
 
        list_for_each_entry(obj, &req->objects, list) {
                struct vb2_buffer *vb;
@@ -243,12 +244,16 @@ static int cedrus_request_validate(struct media_request *req)
                if (!ctrl_test) {
                        v4l2_info(&ctx->dev->v4l2_dev,
                                  "Missing required codec control\n");
-                       return -ENOENT;
+                       ret = -ENOENT;
+                       break;
                }
        }
 
        v4l2_ctrl_request_hdl_put(hdl);
 
+       if (ret)
+               return ret;
+
        return vb2_request_validate(req);
 }
 
index 6e4df3335b1befd0da948428d58aca0593f5fbcd..aa3ff67a3cb1d3e02977691c963a3586ccabb61d 100644 (file)
@@ -303,13 +303,13 @@ usbvision_i2c_read_max4(struct usb_usbvision *usbvision, unsigned char addr,
        switch (len) {
        case 4:
                buf[3] = usbvision_read_reg(usbvision, USBVISION_SER_DAT4);
-               /* fall through */
+               fallthrough;
        case 3:
                buf[2] = usbvision_read_reg(usbvision, USBVISION_SER_DAT3);
-               /* fall through */
+               fallthrough;
        case 2:
                buf[1] = usbvision_read_reg(usbvision, USBVISION_SER_DAT2);
-               /* fall through */
+               fallthrough;
        case 1:
                buf[0] = usbvision_read_reg(usbvision, USBVISION_SER_DAT1);
                break;
index fa1bf8b069fda5898b485dde6210ef7ebbea0b2c..2720f7319a3d03bb4bbda3eca700595ddd79863d 100644 (file)
@@ -524,13 +524,8 @@ static void hfa384x_usb_defer(struct work_struct *data)
  */
 void hfa384x_create(struct hfa384x *hw, struct usb_device *usb)
 {
-       memset(hw, 0, sizeof(*hw));
        hw->usb = usb;
 
-       /* set up the endpoints */
-       hw->endp_in = usb_rcvbulkpipe(usb, 1);
-       hw->endp_out = usb_sndbulkpipe(usb, 2);
-
        /* Set up the waitq */
        init_waitqueue_head(&hw->cmdq);
 
index 456603fd26c0b9892d902927a8776c5cc9db8b03..4b08dc1da4f97bb88435d195a206f3f96cffe884 100644 (file)
@@ -61,23 +61,14 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
                               const struct usb_device_id *id)
 {
        struct usb_device *dev;
-       const struct usb_endpoint_descriptor *epd;
-       const struct usb_host_interface *iface_desc = interface->cur_altsetting;
+       struct usb_endpoint_descriptor *bulk_in, *bulk_out;
+       struct usb_host_interface *iface_desc = interface->cur_altsetting;
        struct wlandevice *wlandev = NULL;
        struct hfa384x *hw = NULL;
        int result = 0;
 
-       if (iface_desc->desc.bNumEndpoints != 2) {
-               result = -ENODEV;
-               goto failed;
-       }
-
-       result = -EINVAL;
-       epd = &iface_desc->endpoint[1].desc;
-       if (!usb_endpoint_is_bulk_in(epd))
-               goto failed;
-       epd = &iface_desc->endpoint[2].desc;
-       if (!usb_endpoint_is_bulk_out(epd))
+       result = usb_find_common_endpoints(iface_desc, &bulk_in, &bulk_out, NULL, NULL);
+       if (result)
                goto failed;
 
        dev = interface_to_usbdev(interface);
@@ -96,6 +87,8 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
        }
 
        /* Initialize the hw data */
+       hw->endp_in = usb_rcvbulkpipe(dev, bulk_in->bEndpointAddress);
+       hw->endp_out = usb_sndbulkpipe(dev, bulk_out->bEndpointAddress);
        hfa384x_create(hw, dev);
        hw->wlandev = wlandev;
 
index 30ea37e1a3f5e11021967201bd3f197030259050..bd37f2afadeaff98968274cf3c017d85dff8232d 100644 (file)
@@ -444,7 +444,7 @@ cxgbit_uld_lro_rx_handler(void *hndl, const __be64 *rsp,
        case CPL_RX_ISCSI_DDP:
        case CPL_FW4_ACK:
                lro_flush = false;
-               /* fall through */
+               fallthrough;
        case CPL_ABORT_RPL_RSS:
        case CPL_PASS_ESTABLISH:
        case CPL_PEER_CLOSE:
index c9689610e186d6af9247400fd6f25a7bcf2b35bc..7b56fe9f10628b2c122643e5bff9fbc1b93a323a 100644 (file)
@@ -1389,14 +1389,27 @@ static u32 iscsit_do_crypto_hash_sg(
        sg = cmd->first_data_sg;
        page_off = cmd->first_data_sg_off;
 
+       if (data_length && page_off) {
+               struct scatterlist first_sg;
+               u32 len = min_t(u32, data_length, sg->length - page_off);
+
+               sg_init_table(&first_sg, 1);
+               sg_set_page(&first_sg, sg_page(sg), len, sg->offset + page_off);
+
+               ahash_request_set_crypt(hash, &first_sg, NULL, len);
+               crypto_ahash_update(hash);
+
+               data_length -= len;
+               sg = sg_next(sg);
+       }
+
        while (data_length) {
-               u32 cur_len = min_t(u32, data_length, (sg->length - page_off));
+               u32 cur_len = min_t(u32, data_length, sg->length);
 
                ahash_request_set_crypt(hash, sg, NULL, cur_len);
                crypto_ahash_update(hash);
 
                data_length -= cur_len;
-               page_off = 0;
                /* iscsit_map_iovec has already checked for invalid sg pointers */
                sg = sg_next(sg);
        }
@@ -3740,7 +3753,7 @@ check_rsp_state:
        case ISTATE_SEND_LOGOUTRSP:
                if (!iscsit_logout_post_handler(cmd, conn))
                        return -ECONNRESET;
-               /* fall through */
+               fallthrough;
        case ISTATE_SEND_STATUS:
        case ISTATE_SEND_ASYNCMSG:
        case ISTATE_SEND_NOPIN:
index 85748e3388582156dfb8b35a14c499b05edc9033..893d1b406c29254ca0bb33fa19b4bcadd0253192 100644 (file)
@@ -1149,7 +1149,7 @@ void iscsit_free_conn(struct iscsi_conn *conn)
 }
 
 void iscsi_target_login_sess_out(struct iscsi_conn *conn,
-               struct iscsi_np *np, bool zero_tsih, bool new_sess)
+                                bool zero_tsih, bool new_sess)
 {
        if (!new_sess)
                goto old_sess_out;
@@ -1167,7 +1167,6 @@ void iscsi_target_login_sess_out(struct iscsi_conn *conn,
        conn->sess = NULL;
 
 old_sess_out:
-       iscsi_stop_login_thread_timer(np);
        /*
         * If login negotiation fails check if the Time2Retain timer
         * needs to be restarted.
@@ -1407,8 +1406,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
 new_sess_out:
        new_sess = true;
 old_sess_out:
+       iscsi_stop_login_thread_timer(np);
        tpg_np = conn->tpg_np;
-       iscsi_target_login_sess_out(conn, np, zero_tsih, new_sess);
+       iscsi_target_login_sess_out(conn, zero_tsih, new_sess);
        new_sess = false;
 
        if (tpg) {
index 3b8e3639ff5d01c6dbeb31ffb1201bb2453a822c..fc95e6150253f6ed744bb9ae955960b8bb1a3230 100644 (file)
@@ -22,8 +22,7 @@ extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32);
 extern void iscsit_free_conn(struct iscsi_conn *);
 extern int iscsit_start_kthreads(struct iscsi_conn *);
 extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8);
-extern void iscsi_target_login_sess_out(struct iscsi_conn *, struct iscsi_np *,
-                               bool, bool);
+extern void iscsi_target_login_sess_out(struct iscsi_conn *, bool, bool);
 extern int iscsi_target_login_thread(void *);
 extern void iscsi_handle_login_thread_timeout(struct timer_list *t);
 
index f88a52fec88952c74515f4ad4beaedbec2252cd6..8b40f10976ff8a6d9de20a23071ec6d554d828b2 100644 (file)
@@ -535,12 +535,11 @@ static bool iscsi_target_sk_check_and_clear(struct iscsi_conn *conn, unsigned in
 
 static void iscsi_target_login_drop(struct iscsi_conn *conn, struct iscsi_login *login)
 {
-       struct iscsi_np *np = login->np;
        bool zero_tsih = login->zero_tsih;
 
        iscsi_remove_failed_auth_entry(conn);
        iscsi_target_nego_release(conn);
-       iscsi_target_login_sess_out(conn, np, zero_tsih, true);
+       iscsi_target_login_sess_out(conn, zero_tsih, true);
 }
 
 struct conn_timeout {
index 8fc88654bff63c0f90341b5f6e0578d358d5a3f6..5f79ea05f9b815ce9ced1f7a6c670325cebf6c18 100644 (file)
@@ -345,7 +345,7 @@ static int core_scsi3_pr_seq_non_holder(struct se_cmd *cmd, u32 pr_reg_type,
                break;
        case PR_TYPE_WRITE_EXCLUSIVE_REGONLY:
                we = 1;
-               /* fall through */
+               fallthrough;
        case PR_TYPE_EXCLUSIVE_ACCESS_REGONLY:
                /*
                 * Some commands are only allowed for registered I_T Nexuses.
@@ -354,7 +354,7 @@ static int core_scsi3_pr_seq_non_holder(struct se_cmd *cmd, u32 pr_reg_type,
                break;
        case PR_TYPE_WRITE_EXCLUSIVE_ALLREG:
                we = 1;
-               /* fall through */
+               fallthrough;
        case PR_TYPE_EXCLUSIVE_ACCESS_ALLREG:
                /*
                 * Each registered I_T Nexus is a reservation holder.
index f1e81886122d0ade6ba6438bc7e77df5bce1b8ae..6e8b8d30938f6f12509578406537147b541fccfb 100644 (file)
@@ -734,7 +734,7 @@ sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb,
                }
                if (!protect)
                        return TCM_NO_SENSE;
-               /* Fallthrough */
+               fallthrough;
        default:
                pr_err("Unable to determine pi_prot_type for CDB: 0x%02x "
                       "PROTECT: 0x%02x\n", cdb[0], protect);
index 9fb0be0aa620438babaaf1e1664cc4ad7aa05b1d..590eac2df90904cae2f7aa51dac26308be60cfb4 100644 (file)
@@ -2236,7 +2236,7 @@ static void transport_complete_qf(struct se_cmd *cmd)
                        ret = cmd->se_tfo->queue_data_in(cmd);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case DMA_NONE:
 queue_status:
                trace_target_cmd_complete(cmd);
@@ -2431,7 +2431,7 @@ queue_rsp:
                                goto queue_full;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case DMA_NONE:
 queue_status:
                trace_target_cmd_complete(cmd);
index e9f0dda5ff92b36991f6aef37274d23d3fd961f0..a7ed56602c6cd20dbd425d915419c6e7abae6ff8 100644 (file)
@@ -537,7 +537,7 @@ static void ft_send_work(struct work_struct *work)
        case FCP_PTA_ACA:
                task_attr = TCM_ACA_TAG;
                break;
-       case FCP_PTA_SIMPLE: /* Fallthrough */
+       case FCP_PTA_SIMPLE:
        default:
                task_attr = TCM_SIMPLE_TAG;
        }
index bf7bae42c141c51493c240e297c6b226f38b232a..6dc879fea9c8a8d4c09705bbb02cec0a54f339e1 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2011-2015, 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2015, 2017, 2020, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/bitops.h>
@@ -191,7 +191,7 @@ static int qpnp_tm_get_temp(void *data, int *temp)
                chip->temp = mili_celsius;
        }
 
-       *temp = chip->temp < 0 ? 0 : chip->temp;
+       *temp = chip->temp;
 
        return 0;
 }
index e64db5f80d909a8ad980c177986b5f069168b45b..4ffa2e2c0145777d0f1d65f0f4f0c9ad99486f56 100644 (file)
@@ -220,7 +220,7 @@ static int calibrate_8916(struct tsens_priv *priv)
                p2[4] = (qfprom_cdata[1] & MSM8916_S4_P2_MASK) >> MSM8916_S4_P2_SHIFT;
                for (i = 0; i < priv->num_sensors; i++)
                        p2[i] = ((base1 + p2[i]) << 3);
-               /* Fall through */
+               fallthrough;
        case ONE_PT_CALIB2:
                base0 = (qfprom_cdata[0] & MSM8916_BASE0_MASK);
                p1[0] = (qfprom_cdata[0] & MSM8916_S0_P1_MASK) >> MSM8916_S0_P1_SHIFT;
@@ -355,7 +355,7 @@ static int calibrate_8974(struct tsens_priv *priv)
                        p2[8] = (calib[5] & S8_P2_BKP_MASK) >> S8_P2_BKP_SHIFT;
                        p2[9] = (calib[5] & S9_P2_BKP_MASK) >> S9_P2_BKP_SHIFT;
                        p2[10] = (calib[5] & S10_P2_BKP_MASK) >> S10_P2_BKP_SHIFT;
-                       /* Fall through */
+                       fallthrough;
                case ONE_PT_CALIB:
                case ONE_PT_CALIB2:
                        base1 = bkp[0] & BASE1_MASK;
@@ -390,7 +390,7 @@ static int calibrate_8974(struct tsens_priv *priv)
                        p2[8] = (calib[4] & S8_P2_MASK) >> S8_P2_SHIFT;
                        p2[9] = (calib[4] & S9_P2_MASK) >> S9_P2_SHIFT;
                        p2[10] = (calib[4] & S10_P2_MASK) >> S10_P2_SHIFT;
-                       /* Fall through */
+                       fallthrough;
                case ONE_PT_CALIB:
                case ONE_PT_CALIB2:
                        base1 = calib[0] & BASE1_MASK;
@@ -420,7 +420,7 @@ static int calibrate_8974(struct tsens_priv *priv)
                        p2[i] <<= 2;
                        p2[i] |= BIT_APPEND;
                }
-               /* Fall through */
+               fallthrough;
        case ONE_PT_CALIB2:
                for (i = 0; i < priv->num_sensors; i++) {
                        p1[i] += base1;
index b682a4df00810c6f92085babad1b6f567849baac..3c19a3800c6d685425f35c46d0a7545bc78749ac 100644 (file)
@@ -202,7 +202,7 @@ static int calibrate_v1(struct tsens_priv *priv)
                p2[9] = (qfprom_cdata[3] & S9_P2_MASK) >> S9_P2_SHIFT;
                for (i = 0; i < priv->num_sensors; i++)
                        p2[i] = ((base1 + p2[i]) << 2);
-               /* Fall through */
+               fallthrough;
        case ONE_PT_CALIB2:
                base0 = (qfprom_cdata[4] & BASE0_MASK) >> BASE0_SHIFT;
                p1[0] = (qfprom_cdata[0] & S0_P1_MASK) >> S0_P1_SHIFT;
@@ -263,7 +263,7 @@ static int calibrate_8976(struct tsens_priv *priv)
 
                for (i = 0; i < priv->num_sensors; i++)
                        p2[i] = ((base1 + p2[i]) << 2);
-               /* Fall through */
+               fallthrough;
        case ONE_PT_CALIB2:
                base0 = qfprom_cdata[0] & MSM8976_BASE0_MASK;
                p1[0] = (qfprom_cdata[0] & MSM8976_S0_P1_MASK) >> MSM8976_S0_P1_SHIFT;
index 72bf159bceccd83c187bb114ad9eacb175dfa6a0..a6616e530a84d2d87bcb1dbc4d78026827017369 100644 (file)
@@ -1516,7 +1516,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_device_register);
  */
 void thermal_zone_device_unregister(struct thermal_zone_device *tz)
 {
-       int i;
+       int i, tz_id;
        const struct thermal_zone_params *tzp;
        struct thermal_cooling_device *cdev;
        struct thermal_zone_device *pos = NULL;
@@ -1525,6 +1525,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
                return;
 
        tzp = tz->tzp;
+       tz_id = tz->id;
 
        mutex_lock(&thermal_list_lock);
        list_for_each_entry(pos, &thermal_tz_list, node)
@@ -1567,7 +1568,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
        mutex_destroy(&tz->lock);
        device_unregister(&tz->device);
 
-       thermal_notify_tz_delete(tz->id);
+       thermal_notify_tz_delete(tz_id);
 }
 EXPORT_SYMBOL_GPL(thermal_zone_device_unregister);
 
index 63b02bfb2adf65ccdc913621c7df3863ae185326..fdb8a495ab69a8b0c2ad35f8ee56e0bc9c947ccf 100644 (file)
@@ -37,20 +37,21 @@ static struct temp_sensor_data omap4430_mpu_temp_sensor_data = {
 
 /*
  * Temperature values in milli degree celsius
- * ADC code values from 530 to 923
+ * ADC code values from 13 to 107, see TRM
+ * "18.4.10.2.3 ADC Codes Versus Temperature".
  */
 static const int
 omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = {
-       -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, -22000,
-       -20000, -18000, -17000, -15000, -13000, -12000, -10000, -8000, -6000,
-       -5000, -3000, -1000, 0, 2000, 3000, 5000, 6000, 8000, 10000, 12000,
-       13000, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28000, 30000,
-       32000, 33000, 35000, 37000, 38000, 40000, 42000, 43000, 45000, 47000,
-       48000, 50000, 52000, 53000, 55000, 57000, 58000, 60000, 62000, 64000,
-       66000, 68000, 70000, 71000, 73000, 75000, 77000, 78000, 80000, 82000,
-       83000, 85000, 87000, 88000, 90000, 92000, 93000, 95000, 97000, 98000,
-       100000, 102000, 103000, 105000, 107000, 109000, 111000, 113000, 115000,
-       117000, 118000, 120000, 122000, 123000,
+       -40000, -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000,
+       -22000, -20000, -18500, -17000, -15000, -13500, -12000, -10000, -8000,
+       -6500, -5000, -3500, -1500, 0, 2000, 3500, 5000, 6500, 8500, 10000,
+       12000, 13500, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28500,
+       30000, 32000, 33500, 35000, 37000, 38500, 40000, 42000, 43500, 45000,
+       47000, 48500, 50000, 52000, 53500, 55000, 57000, 58500, 60000, 62000,
+       64000, 66000, 68000, 70000, 71500, 73500, 75000, 77000, 78500, 80000,
+       82000, 83500, 85000, 87000, 88500, 90000, 92000, 93500, 95000, 97000,
+       98500, 100000, 102000, 103500, 105000, 107000, 109000, 111000, 113000,
+       115000, 117000, 118500, 120000, 122000, 123500, 125000,
 };
 
 /* OMAP4430 data */
index a453ff8eb313e185895208ac4855639a388ef011..9a3955c3853ba112dbf12bf1d006e80b2f3718e6 100644 (file)
  * and thresholds for OMAP4430.
  */
 
-/* ADC conversion table limits */
-#define OMAP4430_ADC_START_VALUE                       0
-#define OMAP4430_ADC_END_VALUE                         127
+/*
+ * ADC conversion table limits. Ignore values outside the TRM listed
+ * range to avoid bogus thermal shutdowns. See omap4430 TRM chapter
+ * "18.4.10.2.3 ADC Codes Versus Temperature".
+ */
+#define OMAP4430_ADC_START_VALUE                       13
+#define OMAP4430_ADC_END_VALUE                         107
 /* bandgap clock limits (no control on 4430) */
 #define OMAP4430_MAX_FREQ                              32768
 #define OMAP4430_MIN_FREQ                              32768
index f77ceae5c7d789d48aecaa9c242408a161c191bf..394a23ce6ca4765b3571d678b4574813acbca2d1 100644 (file)
@@ -453,7 +453,7 @@ static void tb_ctl_rx_callback(struct tb_ring *ring, struct ring_frame *frame,
                                   "RX: checksum mismatch, dropping packet\n");
                        goto rx;
                }
-               /* Fall through */
+               fallthrough;
        case TB_CFG_PKG_ICM_EVENT:
                if (tb_ctl_handle_event(pkg->ctl, frame->eof, pkg, frame->size))
                        goto rx;
index 3ebca44ab3faa38de775099a2fc135711f1ec855..0c8471be3e32f9ccdeab03eb976323161f463713 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include <linux/crc32.h>
+#include <linux/delay.h>
 #include <linux/property.h>
 #include <linux/slab.h>
 #include "tb.h"
@@ -389,8 +390,8 @@ static int tb_drom_parse_entries(struct tb_switch *sw)
                struct tb_drom_entry_header *entry = (void *) (sw->drom + pos);
                if (pos + 1 == drom_size || pos + entry->len > drom_size
                                || !entry->len) {
-                       tb_sw_warn(sw, "drom buffer overrun, aborting\n");
-                       return -EIO;
+                       tb_sw_warn(sw, "DROM buffer overrun\n");
+                       return -EILSEQ;
                }
 
                switch (entry->type) {
@@ -526,7 +527,8 @@ int tb_drom_read(struct tb_switch *sw)
        u16 size;
        u32 crc;
        struct tb_drom_header *header;
-       int res;
+       int res, retries = 1;
+
        if (sw->drom)
                return 0;
 
@@ -612,7 +614,17 @@ parse:
                tb_sw_warn(sw, "drom device_rom_revision %#x unknown\n",
                        header->device_rom_revision);
 
-       return tb_drom_parse_entries(sw);
+       res = tb_drom_parse_entries(sw);
+       /* If the DROM parsing fails, wait a moment and retry once */
+       if (res == -EILSEQ && retries--) {
+               tb_sw_warn(sw, "parsing DROM failed, retrying\n");
+               msleep(100);
+               res = tb_drom_read_n(sw, 0, sw->drom, size);
+               if (!res)
+                       goto parse;
+       }
+
+       return res;
 err:
        kfree(sw->drom);
        sw->drom = NULL;
index 712395f518b82225e06f58699f23c2fca470cb4d..a921de9ce7cbe2277244215413dfaff377123852 100644 (file)
@@ -684,6 +684,7 @@ static int tb_init_port(struct tb_port *port)
                if (res == -ENODEV) {
                        tb_dbg(port->sw->tb, " Port %d: not implemented\n",
                               port->port);
+                       port->disabled = true;
                        return 0;
                }
                return res;
@@ -2092,7 +2093,7 @@ static int tb_switch_add_dma_port(struct tb_switch *sw)
                if (tb_route(sw))
                        return 0;
 
-               /* fallthrough */
+               fallthrough;
        case 3:
                ret = tb_switch_set_uuid(sw);
                if (ret)
index a413d55b5f8b3d40aff34f0db6fab9dd98a63c9e..3c620a9203c5a434b561fe253ef32938b578af90 100644 (file)
@@ -186,7 +186,7 @@ struct tb_switch {
  * @cap_adap: Offset of the adapter specific capability (%0 if not present)
  * @cap_usb4: Offset to the USB4 port capability (%0 if not present)
  * @port: Port number on switch
- * @disabled: Disabled by eeprom
+ * @disabled: Disabled by eeprom or enabled but not implemented
  * @bonded: true if the port is bonded (two lanes combined as one)
  * @dual_link_port: If the switch is connected using two ports, points
  *                 to the other port.
index 2aae2c76d880dd49074b2e040627523691f3df94..829b6ccdd5d4f335120934a525181dd277fdd17d 100644 (file)
@@ -315,7 +315,7 @@ static inline u32 tb_dp_cap_set_rate(u32 val, u32 rate)
        switch (rate) {
        default:
                WARN(1, "invalid rate %u passed, defaulting to 1620 MB/s\n", rate);
-               /* Fallthrough */
+               fallthrough;
        case 1620:
                val |= DP_COMMON_CAP_RATE_RBR << DP_COMMON_CAP_RATE_SHIFT;
                break;
@@ -355,7 +355,7 @@ static inline u32 tb_dp_cap_set_lanes(u32 val, u32 lanes)
        default:
                WARN(1, "invalid number of lanes %u passed, defaulting to 1\n",
                     lanes);
-               /* Fallthrough */
+               fallthrough;
        case 1:
                val |= DP_COMMON_CAP_1_LANE << DP_COMMON_CAP_LANES_SHIFT;
                break;
@@ -951,10 +951,18 @@ static void tb_usb3_reclaim_available_bandwidth(struct tb_tunnel *tunnel,
        int ret, max_rate, allocate_up, allocate_down;
 
        ret = usb4_usb3_port_actual_link_rate(tunnel->src_port);
-       if (ret <= 0) {
-               tb_tunnel_warn(tunnel, "tunnel is not up\n");
+       if (ret < 0) {
+               tb_tunnel_warn(tunnel, "failed to read actual link rate\n");
                return;
+       } else if (!ret) {
+               /* Use maximum link rate if the link valid is not set */
+               ret = usb4_usb3_port_max_link_rate(tunnel->src_port);
+               if (ret < 0) {
+                       tb_tunnel_warn(tunnel, "failed to read maximum link rate\n");
+                       return;
+               }
        }
+
        /*
         * 90% of the max rate can be allocated for isochronous
         * transfers.
index 2a0e51a20e342911748ba524d19c03fc99af59fd..92c9a476defc998f5cf8dfd6185127cf68b479b5 100644 (file)
@@ -492,7 +492,7 @@ static void xencons_backend_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's CLOSING state. */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 21e76a2ec1820ccaee4d227239823e35f849a992..a8e19b4833bf9a95a0f95412d2241bdbb071f2f5 100644 (file)
@@ -243,7 +243,7 @@ done:
                /* Fall back to a 3 byte encoding */
                word.bytes = 3;
                word.word &= 0x00ffffff;
-               /* Fall through */
+               fallthrough;
        case 3:
                /* 3 byte encoding */
                word.word |= 0x82000000;
index 0a29a94ec438e74f2b4e79c255f4507da90f2afd..35cf12147e39c1b87a820738d347e12d53945ce7 100644 (file)
@@ -1584,7 +1584,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen)
                        gsm_process_modem(tty, dlci, modem, clen);
                        tty_kref_put(tty);
                }
-               /* Fall through */
+               fallthrough;
        case 1:         /* Line state will go via DLCI 0 controls only */
        default:
                tty_insert_flip_string(port, data, len);
@@ -1986,7 +1986,7 @@ static void gsm1_receive(struct gsm_mux *gsm, unsigned char c)
                gsm->address = 0;
                gsm->state = GSM_ADDRESS;
                gsm->fcs = INIT_FCS;
-               /* Fall through */
+               fallthrough;
        case GSM_ADDRESS:       /* Address continuation */
                gsm->fcs = gsm_fcs_add(gsm->fcs, c);
                if (gsm_read_ea(&gsm->address, c))
index b09eac4b6d64f0ae01076a6f6d39164dc435a14b..8e975cb29833adfef8cca81622c48868aa3db756 100644 (file)
@@ -602,7 +602,7 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
                case TCOFLUSH:
                        flush_tx_queue(tty);
                }
-               /* fall through - to default */
+               fallthrough;    /* to default */
 
        default:
                error = n_tty_ioctl_helper(tty, file, cmd, arg);
index f75696f0ee2d03c83de6ee7af0ae93bd93440c4a..934dd2fb2ec8072d50fef3324ee12852a063f869 100644 (file)
@@ -605,7 +605,6 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c)
                }
                break;
        case R3964_WAIT_FOR_RX_REPEAT:
-               /* FALLTHROUGH */
        case R3964_IDLE:
                if (c == STX) {
                        /* Prevent rx_queue from overflow: */
index db88dee3a3999a34fcdff1ccc193e315e1dc219c..f8e99995eee911de69ceb5eb8d95dec876cb1acd 100644 (file)
@@ -39,7 +39,7 @@ static void serial8250_em_serial_out(struct uart_port *p, int offset, int value)
                break;
        case UART_IER: /* IER @ 0x04 */
                value &= 0x0f; /* only 4 valid bits - not Xscale */
-               /* fall-through */
+               fallthrough;
        case UART_DLL_EM: /* DLL @ 0x24 (+9) */
        case UART_DLM_EM: /* DLM @ 0x28 (+9) */
                writel(value, p->membase + (offset << 2));
index 04b9af7ed94153dac7e045bce7d8e11132f3e057..2d0e7c7e408dc9722181d51ee6415daa3e2e7d52 100644 (file)
@@ -744,6 +744,24 @@ static const struct exar8250_board pbn_exar_XR17V35x = {
        .exit           = pci_xr17v35x_exit,
 };
 
+static const struct exar8250_board pbn_fastcom35x_2 = {
+       .num_ports      = 2,
+       .setup          = pci_xr17v35x_setup,
+       .exit           = pci_xr17v35x_exit,
+};
+
+static const struct exar8250_board pbn_fastcom35x_4 = {
+       .num_ports      = 4,
+       .setup          = pci_xr17v35x_setup,
+       .exit           = pci_xr17v35x_exit,
+};
+
+static const struct exar8250_board pbn_fastcom35x_8 = {
+       .num_ports      = 8,
+       .setup          = pci_xr17v35x_setup,
+       .exit           = pci_xr17v35x_exit,
+};
+
 static const struct exar8250_board pbn_exar_XR17V4358 = {
        .num_ports      = 12,
        .setup          = pci_xr17v35x_setup,
@@ -811,9 +829,9 @@ static const struct pci_device_id exar_pci_tbl[] = {
        EXAR_DEVICE(EXAR, XR17V358, pbn_exar_XR17V35x),
        EXAR_DEVICE(EXAR, XR17V4358, pbn_exar_XR17V4358),
        EXAR_DEVICE(EXAR, XR17V8358, pbn_exar_XR17V8358),
-       EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_exar_XR17V35x),
-       EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_exar_XR17V35x),
-       EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_exar_XR17V35x),
+       EXAR_DEVICE(COMMTECH, 4222PCIE, pbn_fastcom35x_2),
+       EXAR_DEVICE(COMMTECH, 4224PCIE, pbn_fastcom35x_4),
+       EXAR_DEVICE(COMMTECH, 4228PCIE, pbn_fastcom35x_8),
 
        EXAR_DEVICE(COMMTECH, 4222PCI335, pbn_fastcom335_2),
        EXAR_DEVICE(COMMTECH, 4224PCI335, pbn_fastcom335_4),
index d1d253c4b518bc724ebe7fa3498a057604b3440d..31c9e83ea3cb2c5bcf62aea19e8957d7fff284a4 100644 (file)
@@ -255,7 +255,7 @@ static void fintek_8250_set_irq_mode(struct fintek_8250 *pdata, bool is_level)
        case CHIP_ID_F81866:
                sio_write_mask_reg(pdata, F81866_FIFO_CTRL, F81866_IRQ_MODE1,
                                   0);
-               /* fall through */
+               fallthrough;
        case CHIP_ID_F81865:
                sio_write_mask_reg(pdata, F81866_IRQ_MODE, F81866_IRQ_SHARE,
                                   F81866_IRQ_SHARE);
index 1a74d511b02a580bbbdf033e7d9269e78c602def..55bb7b897d976551d9012a2f684f86e8b4d59c21 100644 (file)
@@ -631,7 +631,7 @@ pci_timedia_setup(struct serial_private *priv,
                break;
        case 3:
                offset = board->uart_offset;
-               /* FALLTHROUGH */
+               fallthrough;
        case 4: /* BAR 2 */
        case 5: /* BAR 3 */
        case 6: /* BAR 4 */
@@ -5566,6 +5566,17 @@ static const struct pci_device_id serial_pci_tbl[] = {
                PCI_ANY_ID, PCI_ANY_ID,
                0, 0, pbn_wch384_4 },
 
+       /*
+        * Realtek RealManage
+        */
+       {       PCI_VENDOR_ID_REALTEK, 0x816a,
+               PCI_ANY_ID, PCI_ANY_ID,
+               0, 0, pbn_b0_1_115200 },
+
+       {       PCI_VENDOR_ID_REALTEK, 0x816b,
+               PCI_ANY_ID, PCI_ANY_ID,
+               0, 0, pbn_b0_1_115200 },
+
        /* Fintek PCI serial cards */
        { PCI_DEVICE(0x1c29, 0x1104), .driver_data = pbn_fintek_4 },
        { PCI_DEVICE(0x1c29, 0x1108), .driver_data = pbn_fintek_8 },
index 09475695effd472dd027922b5642d189a23921ec..c71d647eb87a0214137b136d8e01c7fb9fddb197 100644 (file)
@@ -1872,7 +1872,7 @@ static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir)
        switch (iir & 0x3f) {
        case UART_IIR_RX_TIMEOUT:
                serial8250_rx_dma_flush(up);
-               /* fall-through */
+               fallthrough;
        case UART_IIR_RLSI:
                return true;
        }
@@ -2275,6 +2275,10 @@ int serial8250_do_startup(struct uart_port *port)
 
        if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) {
                unsigned char iir1;
+
+               if (port->irqflags & IRQF_SHARED)
+                       disable_irq_nosync(port->irq);
+
                /*
                 * Test for UARTs that do not reassert THRE when the
                 * transmitter is idle and the interrupt has already
@@ -2284,8 +2288,6 @@ int serial8250_do_startup(struct uart_port *port)
                 * allow register changes to become visible.
                 */
                spin_lock_irqsave(&port->lock, flags);
-               if (up->port.irqflags & IRQF_SHARED)
-                       disable_irq_nosync(port->irq);
 
                wait_for_xmitr(up, UART_LSR_THRE);
                serial_port_out_sync(port, UART_IER, UART_IER_THRI);
@@ -2297,9 +2299,10 @@ int serial8250_do_startup(struct uart_port *port)
                iir = serial_port_in(port, UART_IIR);
                serial_port_out(port, UART_IER, 0);
 
+               spin_unlock_irqrestore(&port->lock, flags);
+
                if (port->irqflags & IRQF_SHARED)
                        enable_irq(port->irq);
-               spin_unlock_irqrestore(&port->lock, flags);
 
                /*
                 * If the interrupt is not reasserted, or we otherwise
index e0b73a5402db71048565aa809aca25ef8559e381..a2978abab0db6032b1cae214c5ba0da575bd0542 100644 (file)
@@ -75,7 +75,7 @@ static unsigned int uniphier_serial_in(struct uart_port *p, int offset)
                break;
        case UART_LCR:
                valshift = 8;
-               /* fall through */
+               fallthrough;
        case UART_MCR:
                offset = UNIPHIER_UART_LCR_MCR;
                break;
@@ -101,7 +101,7 @@ static void uniphier_serial_out(struct uart_port *p, int offset, int value)
        case UART_SCR:
                /* No SCR for this hardware.  Use CHAR as a scratch register */
                valshift = 8;
-               /* fall through */
+               fallthrough;
        case UART_FCR:
                offset = UNIPHIER_UART_CHAR_FCR;
                break;
@@ -109,7 +109,7 @@ static void uniphier_serial_out(struct uart_port *p, int offset, int value)
                valshift = 8;
                /* Divisor latch access bit does not exist. */
                value &= ~UART_LCR_DLAB;
-               /* fall through */
+               fallthrough;
        case UART_MCR:
                offset = UNIPHIER_UART_LCR_MCR;
                break;
index 8a0352eb337c84ea5c9dd318edd7726b3946f583..9409be982aa64c1adc1359ec87c31c09c42efe63 100644 (file)
@@ -517,6 +517,7 @@ config SERIAL_IMX_CONSOLE
 
 config SERIAL_IMX_EARLYCON
        bool "Earlycon on IMX serial port"
+       depends on ARCH_MXC || COMPILE_TEST
        depends on OF
        select SERIAL_EARLYCON
        help
index d056ee6cca33edeb7723dce2cb7957b8deff8104..caf167f0c10a6238417184606973ea7ffc71be5b 100644 (file)
@@ -43,6 +43,7 @@ obj-$(CONFIG_SERIAL_ZS) += zs.o
 obj-$(CONFIG_SERIAL_SH_SCI) += sh-sci.o
 obj-$(CONFIG_SERIAL_CPM) += cpm_uart/
 obj-$(CONFIG_SERIAL_IMX) += imx.o
+obj-$(CONFIG_SERIAL_IMX_EARLYCON) += imx_earlycon.o
 obj-$(CONFIG_SERIAL_MPC52xx) += mpc52xx_uart.o
 obj-$(CONFIG_SERIAL_ICOM) += icom.o
 obj-$(CONFIG_SERIAL_MESON) += meson_uart.o
index c010f639298dd17a451e5606c69b525417e08529..67498594d7d7e61a56ba4a28275327f652aec3ce 100644 (file)
@@ -2241,9 +2241,8 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
        clk_disable(uap->clk);
 }
 
-static void __init
-pl011_console_get_options(struct uart_amba_port *uap, int *baud,
-                            int *parity, int *bits)
+static void pl011_console_get_options(struct uart_amba_port *uap, int *baud,
+                                     int *parity, int *bits)
 {
        if (pl011_read(uap, REG_CR) & UART01x_CR_UARTEN) {
                unsigned int lcr_h, ibrd, fbrd;
@@ -2276,7 +2275,7 @@ pl011_console_get_options(struct uart_amba_port *uap, int *baud,
        }
 }
 
-static int __init pl011_console_setup(struct console *co, char *options)
+static int pl011_console_setup(struct console *co, char *options)
 {
        struct uart_amba_port *uap;
        int baud = 38400;
@@ -2344,8 +2343,8 @@ static int __init pl011_console_setup(struct console *co, char *options)
  *
  *     Returns 0 if console matches; otherwise non-zero to use default matching
  */
-static int __init pl011_console_match(struct console *co, char *name, int idx,
-                                     char *options)
+static int pl011_console_match(struct console *co, char *name, int idx,
+                              char *options)
 {
        unsigned char iotype;
        resource_size_t addr;
@@ -2615,7 +2614,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
 
 static int pl011_register_port(struct uart_amba_port *uap)
 {
-       int ret;
+       int ret, i;
 
        /* Ensure interrupts from this UART are masked and cleared */
        pl011_write(0, uap, REG_IMSC);
@@ -2626,6 +2625,9 @@ static int pl011_register_port(struct uart_amba_port *uap)
                if (ret < 0) {
                        dev_err(uap->port.dev,
                                "Failed to register AMBA-PL011 driver\n");
+                       for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
+                               if (amba_ports[i] == uap)
+                                       amba_ports[i] = NULL;
                        return ret;
                }
        }
index e43471b33710b3885dd2b1ec74d68cdec70a3901..bb5fc8bdd57a6f06e118517a68ab2e078685c92a 100644 (file)
@@ -1845,7 +1845,7 @@ static void atmel_get_ip_name(struct uart_port *port)
                version = atmel_uart_readl(port, ATMEL_US_VERSION);
                switch (version) {
                case 0x814:     /* sama5d2 */
-                       /* fall through */
+                       fallthrough;
                case 0x701:     /* sama5d4 */
                        atmel_port->fidi_min = 3;
                        atmel_port->fidi_max = 65535;
index 8573fc9cb0cdf58abe4e3dc59e6c8a72845d375d..76b94d0ff58659472f286a2ed526c96e9d1ab8a6 100644 (file)
@@ -587,7 +587,6 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
                        transmit_chars(up, lsr);
                        break;
                case UART_IIR_RX_TIMEOUT:
-                       /* FALLTHROUGH */
                case UART_IIR_RDI:
                        serial_omap_rdi(up, lsr);
                        break;
@@ -598,7 +597,6 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
                        /* simply try again */
                        break;
                case UART_IIR_XOFF:
-                       /* FALLTHROUGH */
                default:
                        break;
                }
index 3aa29d201f54d38e1d24f63b883679d4a50ffa9a..184b458820a313cb0412b8ed13e0981976b3d8c1 100644 (file)
@@ -361,11 +361,16 @@ static int qcom_geni_serial_get_char(struct uart_port *uport)
                        return NO_POLL_CHAR;
 
                if (word_cnt == 1 && (status & RX_LAST))
+                       /*
+                        * NOTE: If RX_LAST_BYTE_VALID is 0 it needs to be
+                        * treated as if it was BYTES_PER_FIFO_WORD.
+                        */
                        private_data->poll_cached_bytes_cnt =
                                (status & RX_LAST_BYTE_VALID_MSK) >>
                                RX_LAST_BYTE_VALID_SHFT;
-               else
-                       private_data->poll_cached_bytes_cnt = 4;
+
+               if (private_data->poll_cached_bytes_cnt == 0)
+                       private_data->poll_cached_bytes_cnt = BYTES_PER_FIFO_WORD;
 
                private_data->poll_cached_bytes =
                        readl(uport->membase + SE_GENI_RX_FIFOn);
@@ -1098,7 +1103,7 @@ static unsigned int qcom_geni_serial_tx_empty(struct uart_port *uport)
 }
 
 #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE
-static int __init qcom_geni_console_setup(struct console *co, char *options)
+static int qcom_geni_console_setup(struct console *co, char *options)
 {
        struct uart_port *uport;
        struct qcom_geni_serial_port *port;
index b5ef86ae2746e4b3b3810e26345cf8f4e1b264c5..85366e05925850dbd8d2c603893a0433a19ccf29 100644 (file)
@@ -259,7 +259,7 @@ static void rda_uart_set_termios(struct uart_port *port,
        case CS5:
        case CS6:
                dev_warn(port->dev, "bit size not supported, using 7 bits\n");
-               /* Fall through */
+               fallthrough;
        case CS7:
                ctrl &= ~RDA_UART_DBITS_8;
                break;
index 8ed3482d2e1ebd44616e7e3dc060c6fd3734b7bc..8ae3e03fbd8ce625742782950af00eebbf698c64 100644 (file)
@@ -1905,9 +1905,11 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
                ourport->tx_irq = ret + 1;
        }
 
-       ret = platform_get_irq(platdev, 1);
-       if (ret > 0)
-               ourport->tx_irq = ret;
+       if (!s3c24xx_serial_has_interrupt_mask(port)) {
+               ret = platform_get_irq(platdev, 1);
+               if (ret > 0)
+                       ourport->tx_irq = ret;
+       }
        /*
         * DMA is currently supported only on DT platforms, if DMA properties
         * are specified.
index b87914ae6da8f27de4f430affd7225e3776b6126..bd13014a1c53758fd66c3ab985b3825029ec21ce 100644 (file)
@@ -876,7 +876,7 @@ static irqreturn_t tegra_uart_isr(int irq, void *data)
                                tegra_uart_write(tup, ier, UART_IER);
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case 2: /* Receive */
                        if (!tup->use_rx_pio) {
                                is_rx_start = tup->rx_in_progress;
index 3403dd79051737b50a6f5849eddb36bdee63241d..124524ecfe262fc263771d8f660d9ca1694437da 100644 (file)
@@ -1916,24 +1916,12 @@ static inline bool uart_console_enabled(struct uart_port *port)
        return uart_console(port) && (port->cons->flags & CON_ENABLED);
 }
 
-static void __uart_port_spin_lock_init(struct uart_port *port)
+static void uart_port_spin_lock_init(struct uart_port *port)
 {
        spin_lock_init(&port->lock);
        lockdep_set_class(&port->lock, &port_lock_key);
 }
 
-/*
- * Ensure that the serial console lock is initialised early.
- * If this port is a console, then the spinlock is already initialised.
- */
-static inline void uart_port_spin_lock_init(struct uart_port *port)
-{
-       if (uart_console(port))
-               return;
-
-       __uart_port_spin_lock_init(port);
-}
-
 #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL)
 /**
  *     uart_console_write - write a console message to a serial port
@@ -2086,7 +2074,15 @@ uart_set_options(struct uart_port *port, struct console *co,
        struct ktermios termios;
        static struct ktermios dummy;
 
-       uart_port_spin_lock_init(port);
+       /*
+        * Ensure that the serial-console lock is initialised early.
+        *
+        * Note that the console-enabled check is needed because of kgdboc,
+        * which can end up calling uart_set_options() for an already enabled
+        * console via tty_find_polling_driver() and uart_poll_init().
+        */
+       if (!uart_console_enabled(port) && !port->console_reinit)
+               uart_port_spin_lock_init(port);
 
        memset(&termios, 0, sizeof(struct ktermios));
 
@@ -2101,7 +2097,7 @@ uart_set_options(struct uart_port *port, struct console *co,
        switch (parity) {
        case 'o': case 'O':
                termios.c_cflag |= PARODD;
-               /*fall through*/
+               fallthrough;
        case 'e': case 'E':
                termios.c_cflag |= PARENB;
                break;
@@ -2378,13 +2374,6 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
                /* Power up port for set_mctrl() */
                uart_change_pm(state, UART_PM_STATE_ON);
 
-               /*
-                * If this driver supports console, and it hasn't been
-                * successfully registered yet, initialise spin lock for it.
-                */
-               if (port->cons && !(port->cons->flags & CON_ENABLED))
-                       __uart_port_spin_lock_init(port);
-
                /*
                 * Ensure that the modem control lines are de-activated.
                 * keep the DTR setting that is set in uart_set_options()
@@ -2801,10 +2790,12 @@ static ssize_t console_store(struct device *dev,
                if (oldconsole && !newconsole) {
                        ret = unregister_console(uport->cons);
                } else if (!oldconsole && newconsole) {
-                       if (uart_console(uport))
+                       if (uart_console(uport)) {
+                               uport->console_reinit = 1;
                                register_console(uport->cons);
-                       else
+                       } else {
                                ret = -ENOENT;
+                       }
                }
        } else {
                ret = -ENXIO;
@@ -2900,7 +2891,12 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
                goto out;
        }
 
-       uart_port_spin_lock_init(uport);
+       /*
+        * If this port is in use as a console then the spinlock is already
+        * initialised.
+        */
+       if (!uart_console_enabled(uport))
+               uart_port_spin_lock_init(uport);
 
        if (uport->cons && uport->dev)
                of_console_check(uport->dev->of_node, uport->cons->name, uport->line);
index 143300a8009098f946740357a2a51c9851eba054..ba503dd04ce2dc640c6618bf19c12b8fe3cf0873 100644 (file)
@@ -970,7 +970,7 @@ static int stm32_init_port(struct stm32_port *stm32port,
                return ret;
 
        if (stm32port->info->cfg.has_wakeup) {
-               stm32port->wakeirq = platform_get_irq(pdev, 1);
+               stm32port->wakeirq = platform_get_irq_optional(pdev, 1);
                if (stm32port->wakeirq <= 0 && stm32port->wakeirq != -ENXIO)
                        return stm32port->wakeirq ? : -ENODEV;
        }
index 8ce9a7a256e56b7860d57be20087512f6c0854e4..319e5ceb6130e2bee8a1ccc60e6a590c83a68ef9 100644 (file)
@@ -514,7 +514,7 @@ static void receive_kbd_ms_chars(struct uart_sunsu_port *up, int is_break)
                        switch (ret) {
                        case 2:
                                sunsu_change_mouse_baud(up);
-                               /* fallthru */
+                               fallthrough;
                        case 1:
                                break;
 
index 7ea06bbc61973e501c449e517f561f0865819b39..001e19d7c17db51017068f2d831e0d2cd29713e8 100644 (file)
@@ -306,7 +306,7 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up,
                switch (ret) {
                case 2:
                        sunzilog_change_mouse_baud(up);
-                       /* fallthru */
+                       fallthrough;
                case 1:
                        break;
 
index 2833f1418d6d9570ac9ce4f1e3449055e09ddd93..a9b1ee27183a7105537c90140f9e7ce5969246c7 100644 (file)
@@ -544,7 +544,7 @@ static int cdns_uart_clk_notifier_cb(struct notifier_block *nb,
 
                cdns_uart->baud = cdns_uart_set_baud_rate(cdns_uart->port,
                                cdns_uart->baud);
-               /* fall through */
+               fallthrough;
        case ABORT_RATE_CHANGE:
                if (!locked)
                        spin_lock_irqsave(&cdns_uart->port->lock, flags);
index 9245fffdbceb170c1e686c093194f48d7f50ac49..e18f318586ab4c362c25e6f46a6499921a40169b 100644 (file)
@@ -866,7 +866,7 @@ static int __tty_perform_flush(struct tty_struct *tty, unsigned long arg)
                        ld->ops->flush_buffer(tty);
                        tty_unthrottle(tty);
                }
-               /* fall through */
+               fallthrough;
        case TCOFLUSH:
                tty_driver_flush_buffer(tty);
                break;
index ccb533fd00a29aad764a2634ce4ba8fc2f005efd..19cd4a4b193999519e445d90e1c586c6c3fb39fe 100644 (file)
@@ -1201,7 +1201,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
        unsigned int old_rows, old_row_size, first_copied_row;
        unsigned int new_cols, new_rows, new_row_size, new_screen_size;
        unsigned int user;
-       unsigned short *newscreen;
+       unsigned short *oldscreen, *newscreen;
        struct uni_screen *new_uniscr = NULL;
 
        WARN_CONSOLE_UNLOCKED();
@@ -1299,10 +1299,11 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
        if (new_scr_end > new_origin)
                scr_memsetw((void *)new_origin, vc->vc_video_erase_char,
                            new_scr_end - new_origin);
-       kfree(vc->vc_screenbuf);
+       oldscreen = vc->vc_screenbuf;
        vc->vc_screenbuf = newscreen;
        vc->vc_screenbuf_size = new_screen_size;
        set_origin(vc);
+       kfree(oldscreen);
 
        /* do part of a reset_terminal() */
        vc->vc_top = 0;
@@ -1553,7 +1554,7 @@ static void csi_J(struct vc_data *vc, int vpar)
                        break;
                case 3: /* include scrollback */
                        flush_scrollback(vc);
-                       /* fallthrough */
+                       fallthrough;
                case 2: /* erase whole display */
                        vc_uniscr_clear_lines(vc, 0, vc->vc_rows);
                        count = vc->vc_cols * vc->vc_rows;
@@ -2167,7 +2168,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
                lf(vc);
                if (!is_kbd(vc, lnm))
                        return;
-               /* fall through */
+               fallthrough;
        case 13:
                cr(vc);
                return;
@@ -2306,7 +2307,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
                        return;
                }
                vc->vc_priv = EPecma;
-               /* fall through */
+               fallthrough;
        case ESgetpars:
                if (c == ';' && vc->vc_npar < NPAR - 1) {
                        vc->vc_npar++;
index 91c3017750476d73ec9b193b9b8a7fe1995624fe..a4e520bdd521df3994284450253f622e8bc3c7d4 100644 (file)
@@ -806,12 +806,22 @@ static int vt_resizex(struct vc_data *vc, struct vt_consize __user *cs)
                console_lock();
                vcp = vc_cons[i].d;
                if (vcp) {
+                       int ret;
+                       int save_scan_lines = vcp->vc_scan_lines;
+                       int save_font_height = vcp->vc_font.height;
+
                        if (v.v_vlin)
                                vcp->vc_scan_lines = v.v_vlin;
                        if (v.v_clin)
                                vcp->vc_font.height = v.v_clin;
                        vcp->vc_resize_user = 1;
-                       vc_resize(vcp, v.v_cols, v.v_rows);
+                       ret = vc_resize(vcp, v.v_cols, v.v_rows);
+                       if (ret) {
+                               vcp->vc_scan_lines = save_scan_lines;
+                               vcp->vc_font.height = save_font_height;
+                               console_unlock();
+                               return ret;
+                       }
                }
                console_unlock();
        }
index f7f6229082cad4a86d703e5beb545040bdeac256..60f4711717d22e07446aeb2d635327cc5a709a84 100644 (file)
@@ -710,7 +710,8 @@ static int c67x00_add_ctrl_urb(struct c67x00_hcd *c67x00, struct urb *urb)
                        if (ret)
                                return ret;
                        break;
-               }               /* else fallthrough */
+               }
+               fallthrough;
        case STATUS_STAGE:
                pid = !usb_pipeout(urb->pipe) ? USB_PID_OUT : USB_PID_IN;
                ret = c67x00_create_td(c67x00, urb, NULL, 0, pid, 1,
index 991786876dbb3cb598c44c1ccb0c250d55c16e08..7f6f3ab5b8a6770060cae81445aecd9e88d1cc48 100644 (file)
@@ -378,21 +378,19 @@ static void acm_ctrl_irq(struct urb *urb)
        if (current_size < expected_size) {
                /* notification is transmitted fragmented, reassemble */
                if (acm->nb_size < expected_size) {
-                       if (acm->nb_size) {
-                               kfree(acm->notification_buffer);
-                               acm->nb_size = 0;
-                       }
+                       u8 *new_buffer;
                        alloc_size = roundup_pow_of_two(expected_size);
-                       /*
-                        * kmalloc ensures a valid notification_buffer after a
-                        * use of kfree in case the previous allocation was too
-                        * small. Final freeing is done on disconnect.
-                        */
-                       acm->notification_buffer =
-                               kmalloc(alloc_size, GFP_ATOMIC);
-                       if (!acm->notification_buffer)
+                       /* Final freeing is done on disconnect. */
+                       new_buffer = krealloc(acm->notification_buffer,
+                                             alloc_size, GFP_ATOMIC);
+                       if (!new_buffer) {
+                               acm->nb_index = 0;
                                goto exit;
+                       }
+
+                       acm->notification_buffer = new_buffer;
                        acm->nb_size = alloc_size;
+                       dr = (struct usb_cdc_notification *)acm->notification_buffer;
                }
 
                copy_size = min(current_size,
index 084c48c5848fc90354216254ffbd48c17a7be030..67cbd42421bee7e5776659a5f7ebfb077564a457 100644 (file)
@@ -827,6 +827,11 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t len, lo
        if (rv < 0)
                return rv;
 
+       if (!usblp->present) {
+               count = -ENODEV;
+               goto done;
+       }
+
        if ((avail = usblp->rstatus) < 0) {
                printk(KERN_ERR "usblp%d: error %d reading from printer\n",
                    usblp->minor, (int)avail);
index f81606c6a35b03b92b7d0da2976c2e7a3800dfa7..7e73e989645bd2d517693707f8cf69d138a282a4 100644 (file)
@@ -905,6 +905,35 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
        return 0;
 }
 
+static bool is_dev_usb_generic_driver(struct device *dev)
+{
+       struct usb_device_driver *udd = dev->driver ?
+               to_usb_device_driver(dev->driver) : NULL;
+
+       return udd == &usb_generic_driver;
+}
+
+static int __usb_bus_reprobe_drivers(struct device *dev, void *data)
+{
+       struct usb_device_driver *new_udriver = data;
+       struct usb_device *udev;
+       int ret;
+
+       if (!is_dev_usb_generic_driver(dev))
+               return 0;
+
+       udev = to_usb_device(dev);
+       if (usb_device_match_id(udev, new_udriver->id_table) == NULL &&
+           (!new_udriver->match || new_udriver->match(udev) != 0))
+               return 0;
+
+       ret = device_reprobe(dev);
+       if (ret && ret != -EPROBE_DEFER)
+               dev_err(dev, "Failed to reprobe device (error %d)\n", ret);
+
+       return 0;
+}
+
 /**
  * usb_register_device_driver - register a USB device (not interface) driver
  * @new_udriver: USB operations for the device driver
@@ -934,13 +963,20 @@ int usb_register_device_driver(struct usb_device_driver *new_udriver,
 
        retval = driver_register(&new_udriver->drvwrap.driver);
 
-       if (!retval)
+       if (!retval) {
                pr_info("%s: registered new device driver %s\n",
                        usbcore_name, new_udriver->name);
-       else
+               /*
+                * Check whether any device could be better served with
+                * this new driver
+                */
+               bus_for_each_dev(&usb_bus_type, NULL, new_udriver,
+                                __usb_bus_reprobe_drivers);
+       } else {
                printk(KERN_ERR "%s: error %d registering device "
                        "       driver %s\n",
                        usbcore_name, retval, new_udriver->name);
+       }
 
        return retval;
 }
index b6f2d4b447546ed5a44366bfbc7e375f09ba761c..2b2f1ab6e36aafca243d3203666d6790644340a5 100644 (file)
@@ -205,8 +205,9 @@ static int __check_usb_generic(struct device_driver *drv, void *data)
        udrv = to_usb_device_driver(drv);
        if (udrv == &usb_generic_driver)
                return 0;
-
-       return usb_device_match_id(udev, udrv->id_table) != NULL;
+       if (usb_device_match_id(udev, udrv->id_table) != NULL)
+               return 1;
+       return (udrv->match && udrv->match(udev));
 }
 
 static bool usb_generic_driver_match(struct usb_device *udev)
index 4dc443aaef5c624526624b178b57e73318efd3cc..ec0d6c50610cef42f8c34ba6f815668761b6a70e 100644 (file)
@@ -315,11 +315,14 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_probe);
 void usb_hcd_pci_remove(struct pci_dev *dev)
 {
        struct usb_hcd          *hcd;
+       int                     hcd_driver_flags;
 
        hcd = pci_get_drvdata(dev);
        if (!hcd)
                return;
 
+       hcd_driver_flags = hcd->driver->flags;
+
        if (pci_dev_run_wake(dev))
                pm_runtime_get_noresume(&dev->dev);
 
@@ -347,7 +350,7 @@ void usb_hcd_pci_remove(struct pci_dev *dev)
                up_read(&companions_rwsem);
        }
        usb_put_hcd(hcd);
-       if ((hcd->driver->flags & HCD_MASK) < HCD_USB3)
+       if ((hcd_driver_flags & HCD_MASK) < HCD_USB3)
                pci_free_irq_vectors(dev);
        pci_disable_device(dev);
 }
index 052d5accfe9b2bc077e0b877efdce60a2aafd95b..5b768b80d1eeb56190bb581ac561f80f730e97f0 100644 (file)
@@ -727,7 +727,7 @@ static void hub_irq(struct urb *urb)
                if ((++hub->nerrors < 10) || hub->error)
                        goto resubmit;
                hub->error = status;
-               /* FALL THROUGH */
+               fallthrough;
 
        /* let hub_wq handle things */
        case 0:                 /* we got data:  port status changed */
index 6197938dcc2d8f104efbd8e923bbc6e3d0b94c7b..ae1de9cc4b094cad6cfe00c0c58d28a4a81b4dd4 100644 (file)
@@ -1205,6 +1205,34 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
        }
 }
 
+/*
+ * usb_disable_device_endpoints -- Disable all endpoints for a device
+ * @dev: the device whose endpoints are being disabled
+ * @skip_ep0: 0 to disable endpoint 0, 1 to skip it.
+ */
+static void usb_disable_device_endpoints(struct usb_device *dev, int skip_ep0)
+{
+       struct usb_hcd *hcd = bus_to_hcd(dev->bus);
+       int i;
+
+       if (hcd->driver->check_bandwidth) {
+               /* First pass: Cancel URBs, leave endpoint pointers intact. */
+               for (i = skip_ep0; i < 16; ++i) {
+                       usb_disable_endpoint(dev, i, false);
+                       usb_disable_endpoint(dev, i + USB_DIR_IN, false);
+               }
+               /* Remove endpoints from the host controller internal state */
+               mutex_lock(hcd->bandwidth_mutex);
+               usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
+               mutex_unlock(hcd->bandwidth_mutex);
+       }
+       /* Second pass: remove endpoint pointers */
+       for (i = skip_ep0; i < 16; ++i) {
+               usb_disable_endpoint(dev, i, true);
+               usb_disable_endpoint(dev, i + USB_DIR_IN, true);
+       }
+}
+
 /**
  * usb_disable_device - Disable all the endpoints for a USB device
  * @dev: the device whose endpoints are being disabled
@@ -1218,7 +1246,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
 void usb_disable_device(struct usb_device *dev, int skip_ep0)
 {
        int i;
-       struct usb_hcd *hcd = bus_to_hcd(dev->bus);
 
        /* getting rid of interfaces will disconnect
         * any drivers bound to them (a key side effect)
@@ -1264,22 +1291,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
 
        dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__,
                skip_ep0 ? "non-ep0" : "all");
-       if (hcd->driver->check_bandwidth) {
-               /* First pass: Cancel URBs, leave endpoint pointers intact. */
-               for (i = skip_ep0; i < 16; ++i) {
-                       usb_disable_endpoint(dev, i, false);
-                       usb_disable_endpoint(dev, i + USB_DIR_IN, false);
-               }
-               /* Remove endpoints from the host controller internal state */
-               mutex_lock(hcd->bandwidth_mutex);
-               usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
-               mutex_unlock(hcd->bandwidth_mutex);
-               /* Second pass: remove endpoint pointers */
-       }
-       for (i = skip_ep0; i < 16; ++i) {
-               usb_disable_endpoint(dev, i, true);
-               usb_disable_endpoint(dev, i + USB_DIR_IN, true);
-       }
+
+       usb_disable_device_endpoints(dev, skip_ep0);
 }
 
 /**
@@ -1522,6 +1535,9 @@ EXPORT_SYMBOL_GPL(usb_set_interface);
  * The caller must own the device lock.
  *
  * Return: Zero on success, else a negative error code.
+ *
+ * If this routine fails the device will probably be in an unusable state
+ * with endpoints disabled, and interfaces only partially enabled.
  */
 int usb_reset_configuration(struct usb_device *dev)
 {
@@ -1537,10 +1553,7 @@ int usb_reset_configuration(struct usb_device *dev)
         * calls during probe() are fine
         */
 
-       for (i = 1; i < 16; ++i) {
-               usb_disable_endpoint(dev, i, true);
-               usb_disable_endpoint(dev, i + USB_DIR_IN, true);
-       }
+       usb_disable_device_endpoints(dev, 1); /* skip ep0*/
 
        config = dev->actconfig;
        retval = 0;
@@ -1553,34 +1566,10 @@ int usb_reset_configuration(struct usb_device *dev)
                mutex_unlock(hcd->bandwidth_mutex);
                return -ENOMEM;
        }
-       /* Make sure we have enough bandwidth for each alternate setting 0 */
-       for (i = 0; i < config->desc.bNumInterfaces; i++) {
-               struct usb_interface *intf = config->interface[i];
-               struct usb_host_interface *alt;
 
-               alt = usb_altnum_to_altsetting(intf, 0);
-               if (!alt)
-                       alt = &intf->altsetting[0];
-               if (alt != intf->cur_altsetting)
-                       retval = usb_hcd_alloc_bandwidth(dev, NULL,
-                                       intf->cur_altsetting, alt);
-               if (retval < 0)
-                       break;
-       }
-       /* If not, reinstate the old alternate settings */
+       /* xHCI adds all endpoints in usb_hcd_alloc_bandwidth */
+       retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL);
        if (retval < 0) {
-reset_old_alts:
-               for (i--; i >= 0; i--) {
-                       struct usb_interface *intf = config->interface[i];
-                       struct usb_host_interface *alt;
-
-                       alt = usb_altnum_to_altsetting(intf, 0);
-                       if (!alt)
-                               alt = &intf->altsetting[0];
-                       if (alt != intf->cur_altsetting)
-                               usb_hcd_alloc_bandwidth(dev, NULL,
-                                               alt, intf->cur_altsetting);
-               }
                usb_enable_lpm(dev);
                mutex_unlock(hcd->bandwidth_mutex);
                return retval;
@@ -1589,8 +1578,12 @@ reset_old_alts:
                        USB_REQ_SET_CONFIGURATION, 0,
                        config->desc.bConfigurationValue, 0,
                        NULL, 0, USB_CTRL_SET_TIMEOUT);
-       if (retval < 0)
-               goto reset_old_alts;
+       if (retval < 0) {
+               usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
+               usb_enable_lpm(dev);
+               mutex_unlock(hcd->bandwidth_mutex);
+               return retval;
+       }
        mutex_unlock(hcd->bandwidth_mutex);
 
        /* re-init hc/hcd interface/endpoint state */
index 7c1198f80c2316e48acdcbdefe9a3b64bcb5d096..10574fa3f927742c0b46299c1f1cf5752754e2d8 100644 (file)
@@ -370,6 +370,10 @@ static const struct usb_device_id usb_quirk_list[] = {
        { USB_DEVICE(0x0926, 0x0202), .driver_info =
                        USB_QUIRK_ENDPOINT_IGNORE },
 
+       /* Sound Devices MixPre-D */
+       { USB_DEVICE(0x0926, 0x0208), .driver_info =
+                       USB_QUIRK_ENDPOINT_IGNORE },
+
        /* Keytouch QWERTY Panel keyboard */
        { USB_DEVICE(0x0926, 0x3333), .driver_info =
                        USB_QUIRK_CONFIG_INTF_STRINGS },
@@ -393,6 +397,10 @@ static const struct usb_device_id usb_quirk_list[] = {
        /* Generic RTL8153 based ethernet adapters */
        { USB_DEVICE(0x0bda, 0x8153), .driver_info = USB_QUIRK_NO_LPM },
 
+       /* SONiX USB DEVICE Touchpad */
+       { USB_DEVICE(0x0c45, 0x7056), .driver_info =
+                       USB_QUIRK_IGNORE_REMOTE_WAKEUP },
+
        /* Action Semiconductor flash disk */
        { USB_DEVICE(0x10d6, 0x2200), .driver_info =
                        USB_QUIRK_STRING_FETCH_255 },
@@ -465,6 +473,8 @@ static const struct usb_device_id usb_quirk_list[] = {
 
        { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM },
 
+       { USB_DEVICE(0x2386, 0x350e), .driver_info = USB_QUIRK_NO_LPM },
+
        /* DJI CineSSD */
        { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
 
@@ -509,6 +519,7 @@ static const struct usb_device_id usb_amd_resume_quirk_list[] = {
  */
 static const struct usb_device_id usb_endpoint_ignore[] = {
        { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0202, 1), .driver_info = 0x85 },
+       { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0208, 1), .driver_info = 0x85 },
        { }
 };
 
index a2ca38e25e0c33ab6a2c7aace36573068e3d9e36..8d134193fa0cf0ff7da568e5ee7f7b4bbdb30598 100644 (file)
@@ -889,7 +889,11 @@ read_descriptors(struct file *filp, struct kobject *kobj,
        size_t srclen, n;
        int cfgno;
        void *src;
+       int retval;
 
+       retval = usb_lock_device_interruptible(udev);
+       if (retval < 0)
+               return -EINTR;
        /* The binary attribute begins with the device descriptor.
         * Following that are the raw descriptor entries for all the
         * configurations (config plus subsidiary descriptors).
@@ -914,6 +918,7 @@ read_descriptors(struct file *filp, struct kobject *kobj,
                        off -= srclen;
                }
        }
+       usb_unlock_device(udev);
        return count - nleft;
 }
 
index 422aea24afcd1ffbc8cccdb802acb81632601c23..2eb34c8b4065f5939fac1ebd57b32ecc2870d1c2 100644 (file)
@@ -646,9 +646,8 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
                        if (!(reg & DWC3_GUSB2PHYCFG_ULPI_UTMI))
                                break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI:
-               /* FALLTHROUGH */
        default:
                break;
        }
@@ -1411,7 +1410,7 @@ static void dwc3_check_params(struct dwc3 *dwc)
        default:
                dev_err(dev, "invalid maximum_speed parameter %d\n",
                        dwc->maximum_speed);
-               /* fall through */
+               fallthrough;
        case USB_SPEED_UNKNOWN:
                /* default to superspeed */
                dwc->maximum_speed = USB_SPEED_SUPER;
index 88b75b5a039c949ba63b195ff80acc34a43649e6..1f7f4d88ed9d8d1227fde3ce460b3bfe4fc5abf6 100644 (file)
@@ -737,13 +737,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
                goto err_disable_clks;
        }
 
-       ret = reset_control_deassert(priv->reset);
+       ret = reset_control_reset(priv->reset);
        if (ret)
-               goto err_assert_reset;
+               goto err_disable_clks;
 
        ret = dwc3_meson_g12a_get_phys(priv);
        if (ret)
-               goto err_assert_reset;
+               goto err_disable_clks;
 
        ret = priv->drvdata->setup_regmaps(priv, base);
        if (ret)
@@ -752,7 +752,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
        if (priv->vbus) {
                ret = regulator_enable(priv->vbus);
                if (ret)
-                       goto err_assert_reset;
+                       goto err_disable_clks;
        }
 
        /* Get dr_mode */
@@ -765,13 +765,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev)
 
        ret = priv->drvdata->usb_init(priv);
        if (ret)
-               goto err_assert_reset;
+               goto err_disable_clks;
 
        /* Init PHYs */
        for (i = 0 ; i < PHY_COUNT ; ++i) {
                ret = phy_init(priv->phys[i]);
                if (ret)
-                       goto err_assert_reset;
+                       goto err_disable_clks;
        }
 
        /* Set PHY Power */
@@ -809,9 +809,6 @@ err_phys_exit:
        for (i = 0 ; i < PHY_COUNT ; ++i)
                phy_exit(priv->phys[i]);
 
-err_assert_reset:
-       reset_control_assert(priv->reset);
-
 err_disable_clks:
        clk_bulk_disable_unprepare(priv->drvdata->num_clks,
                                   priv->drvdata->clks);
index e44bfc3b5096d987dd74f9ff0c14a273862c6568..c2a0f64f8d1e12e7b949ae8b6978a3a02aee5338 100644 (file)
@@ -1054,27 +1054,25 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb,
  * dwc3_prepare_one_trb - setup one TRB from one request
  * @dep: endpoint for which this request is prepared
  * @req: dwc3_request pointer
+ * @trb_length: buffer size of the TRB
  * @chain: should this TRB be chained to the next?
  * @node: only for isochronous endpoints. First TRB needs different type.
  */
 static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
-               struct dwc3_request *req, unsigned chain, unsigned node)
+               struct dwc3_request *req, unsigned int trb_length,
+               unsigned chain, unsigned node)
 {
        struct dwc3_trb         *trb;
-       unsigned int            length;
        dma_addr_t              dma;
        unsigned                stream_id = req->request.stream_id;
        unsigned                short_not_ok = req->request.short_not_ok;
        unsigned                no_interrupt = req->request.no_interrupt;
        unsigned                is_last = req->request.is_last;
 
-       if (req->request.num_sgs > 0) {
-               length = sg_dma_len(req->start_sg);
+       if (req->request.num_sgs > 0)
                dma = sg_dma_address(req->start_sg);
-       } else {
-               length = req->request.length;
+       else
                dma = req->request.dma;
-       }
 
        trb = &dep->trb_pool[dep->trb_enqueue];
 
@@ -1086,7 +1084,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
 
        req->num_trbs++;
 
-       __dwc3_prepare_one_trb(dep, trb, dma, length, chain, node,
+       __dwc3_prepare_one_trb(dep, trb, dma, trb_length, chain, node,
                        stream_id, short_not_ok, no_interrupt, is_last);
 }
 
@@ -1096,16 +1094,27 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
        struct scatterlist *sg = req->start_sg;
        struct scatterlist *s;
        int             i;
-
+       unsigned int length = req->request.length;
        unsigned int remaining = req->request.num_mapped_sgs
                - req->num_queued_sgs;
 
+       /*
+        * If we resume preparing the request, then get the remaining length of
+        * the request and resume where we left off.
+        */
+       for_each_sg(req->request.sg, s, req->num_queued_sgs, i)
+               length -= sg_dma_len(s);
+
        for_each_sg(sg, s, remaining, i) {
-               unsigned int length = req->request.length;
                unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc);
                unsigned int rem = length % maxp;
+               unsigned int trb_length;
                unsigned chain = true;
 
+               trb_length = min_t(unsigned int, length, sg_dma_len(s));
+
+               length -= trb_length;
+
                /*
                 * IOMMU driver is coalescing the list of sgs which shares a
                 * page boundary into one and giving it to USB driver. With
@@ -1113,7 +1122,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
                 * sgs passed. So mark the chain bit to false if it isthe last
                 * mapped sg.
                 */
-               if (i == remaining - 1)
+               if ((i == remaining - 1) || !length)
                        chain = false;
 
                if (rem && usb_endpoint_dir_out(dep->endpoint.desc) && !chain) {
@@ -1123,7 +1132,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
                        req->needs_extra_trb = true;
 
                        /* prepare normal TRB */
-                       dwc3_prepare_one_trb(dep, req, true, i);
+                       dwc3_prepare_one_trb(dep, req, trb_length, true, i);
 
                        /* Now prepare one extra TRB to align transfer size */
                        trb = &dep->trb_pool[dep->trb_enqueue];
@@ -1134,8 +1143,39 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
                                        req->request.short_not_ok,
                                        req->request.no_interrupt,
                                        req->request.is_last);
+               } else if (req->request.zero && req->request.length &&
+                          !usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
+                          !rem && !chain) {
+                       struct dwc3     *dwc = dep->dwc;
+                       struct dwc3_trb *trb;
+
+                       req->needs_extra_trb = true;
+
+                       /* Prepare normal TRB */
+                       dwc3_prepare_one_trb(dep, req, trb_length, true, i);
+
+                       /* Prepare one extra TRB to handle ZLP */
+                       trb = &dep->trb_pool[dep->trb_enqueue];
+                       req->num_trbs++;
+                       __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0,
+                                              !req->direction, 1,
+                                              req->request.stream_id,
+                                              req->request.short_not_ok,
+                                              req->request.no_interrupt,
+                                              req->request.is_last);
+
+                       /* Prepare one more TRB to handle MPS alignment */
+                       if (!req->direction) {
+                               trb = &dep->trb_pool[dep->trb_enqueue];
+                               req->num_trbs++;
+                               __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp,
+                                                      false, 1, req->request.stream_id,
+                                                      req->request.short_not_ok,
+                                                      req->request.no_interrupt,
+                                                      req->request.is_last);
+                       }
                } else {
-                       dwc3_prepare_one_trb(dep, req, chain, i);
+                       dwc3_prepare_one_trb(dep, req, trb_length, chain, i);
                }
 
                /*
@@ -1150,6 +1190,16 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
 
                req->num_queued_sgs++;
 
+               /*
+                * The number of pending SG entries may not correspond to the
+                * number of mapped SG entries. If all the data are queued, then
+                * don't include unused SG entries.
+                */
+               if (length == 0) {
+                       req->num_pending_sgs -= req->request.num_mapped_sgs - req->num_queued_sgs;
+                       break;
+               }
+
                if (!dwc3_calc_trbs_left(dep))
                        break;
        }
@@ -1169,7 +1219,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
                req->needs_extra_trb = true;
 
                /* prepare normal TRB */
-               dwc3_prepare_one_trb(dep, req, true, 0);
+               dwc3_prepare_one_trb(dep, req, length, true, 0);
 
                /* Now prepare one extra TRB to align transfer size */
                trb = &dep->trb_pool[dep->trb_enqueue];
@@ -1180,6 +1230,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
                                req->request.no_interrupt,
                                req->request.is_last);
        } else if (req->request.zero && req->request.length &&
+                  !usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
                   (IS_ALIGNED(req->request.length, maxp))) {
                struct dwc3     *dwc = dep->dwc;
                struct dwc3_trb *trb;
@@ -1187,18 +1238,29 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
                req->needs_extra_trb = true;
 
                /* prepare normal TRB */
-               dwc3_prepare_one_trb(dep, req, true, 0);
+               dwc3_prepare_one_trb(dep, req, length, true, 0);
 
-               /* Now prepare one extra TRB to handle ZLP */
+               /* Prepare one extra TRB to handle ZLP */
                trb = &dep->trb_pool[dep->trb_enqueue];
                req->num_trbs++;
                __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0,
-                               false, 1, req->request.stream_id,
+                               !req->direction, 1, req->request.stream_id,
                                req->request.short_not_ok,
                                req->request.no_interrupt,
                                req->request.is_last);
+
+               /* Prepare one more TRB to handle MPS alignment for OUT */
+               if (!req->direction) {
+                       trb = &dep->trb_pool[dep->trb_enqueue];
+                       req->num_trbs++;
+                       __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp,
+                                              false, 1, req->request.stream_id,
+                                              req->request.short_not_ok,
+                                              req->request.no_interrupt,
+                                              req->request.is_last);
+               }
        } else {
-               dwc3_prepare_one_trb(dep, req, false, 0);
+               dwc3_prepare_one_trb(dep, req, length, false, 0);
        }
 }
 
@@ -2671,8 +2733,17 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
                                status);
 
        if (req->needs_extra_trb) {
+               unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc);
+
                ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event,
                                status);
+
+               /* Reclaim MPS padding TRB for ZLP */
+               if (!req->direction && req->request.zero && req->request.length &&
+                   !usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
+                   (IS_ALIGNED(req->request.length, maxp)))
+                       ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event, status);
+
                req->needs_extra_trb = false;
        }
 
index 331c951d72dc994ab4f16f4ee9d1c095f046dae6..950c9435beec376d7ca81c5e110af83d47ada626 100644 (file)
@@ -2039,7 +2039,6 @@ static int do_scsi_command(struct fsg_common *common)
        case RELEASE:
        case RESERVE:
        case SEND_DIAGNOSTIC:
-               fallthrough;
 
        default:
 unknown_cmnd:
index 1d900081b1f0ca5e5e01b24d701d1cd7a1459a9f..b4206b0dede54e99ef34263f937aaa9584c41130 100644 (file)
@@ -1181,12 +1181,15 @@ static int ncm_unwrap_ntb(struct gether *port,
        int             ndp_index;
        unsigned        dg_len, dg_len2;
        unsigned        ndp_len;
+       unsigned        block_len;
        struct sk_buff  *skb2;
        int             ret = -EINVAL;
-       unsigned        max_size = le32_to_cpu(ntb_parameters.dwNtbOutMaxSize);
+       unsigned        ntb_max = le32_to_cpu(ntb_parameters.dwNtbOutMaxSize);
+       unsigned        frame_max = le16_to_cpu(ecm_desc.wMaxSegmentSize);
        const struct ndp_parser_opts *opts = ncm->parser_opts;
        unsigned        crc_len = ncm->is_crc ? sizeof(uint32_t) : 0;
        int             dgram_counter;
+       bool            ndp_after_header;
 
        /* dwSignature */
        if (get_unaligned_le32(tmp) != opts->nth_sign) {
@@ -1205,25 +1208,37 @@ static int ncm_unwrap_ntb(struct gether *port,
        }
        tmp++; /* skip wSequence */
 
+       block_len = get_ncm(&tmp, opts->block_length);
        /* (d)wBlockLength */
-       if (get_ncm(&tmp, opts->block_length) > max_size) {
+       if (block_len > ntb_max) {
                INFO(port->func.config->cdev, "OUT size exceeded\n");
                goto err;
        }
 
        ndp_index = get_ncm(&tmp, opts->ndp_index);
+       ndp_after_header = false;
 
        /* Run through all the NDP's in the NTB */
        do {
-               /* NCM 3.2 */
-               if (((ndp_index % 4) != 0) &&
-                               (ndp_index < opts->nth_size)) {
+               /*
+                * NCM 3.2
+                * dwNdpIndex
+                */
+               if (((ndp_index % 4) != 0) ||
+                               (ndp_index < opts->nth_size) ||
+                               (ndp_index > (block_len -
+                                             opts->ndp_size))) {
                        INFO(port->func.config->cdev, "Bad index: %#X\n",
                             ndp_index);
                        goto err;
                }
+               if (ndp_index == opts->nth_size)
+                       ndp_after_header = true;
 
-               /* walk through NDP */
+               /*
+                * walk through NDP
+                * dwSignature
+                */
                tmp = (void *)(skb->data + ndp_index);
                if (get_unaligned_le32(tmp) != ncm->ndp_sign) {
                        INFO(port->func.config->cdev, "Wrong NDP SIGN\n");
@@ -1234,14 +1249,15 @@ static int ncm_unwrap_ntb(struct gether *port,
                ndp_len = get_unaligned_le16(tmp++);
                /*
                 * NCM 3.3.1
+                * wLength
                 * entry is 2 items
                 * item size is 16/32 bits, opts->dgram_item_len * 2 bytes
                 * minimal: struct usb_cdc_ncm_ndpX + normal entry + zero entry
                 * Each entry is a dgram index and a dgram length.
                 */
                if ((ndp_len < opts->ndp_size
-                               + 2 * 2 * (opts->dgram_item_len * 2))
-                               || (ndp_len % opts->ndplen_align != 0)) {
+                               + 2 * 2 * (opts->dgram_item_len * 2)) ||
+                               (ndp_len % opts->ndplen_align != 0)) {
                        INFO(port->func.config->cdev, "Bad NDP length: %#X\n",
                             ndp_len);
                        goto err;
@@ -1258,8 +1274,21 @@ static int ncm_unwrap_ntb(struct gether *port,
 
                do {
                        index = index2;
+                       /* wDatagramIndex[0] */
+                       if ((index < opts->nth_size) ||
+                                       (index > block_len - opts->dpe_size)) {
+                               INFO(port->func.config->cdev,
+                                    "Bad index: %#X\n", index);
+                               goto err;
+                       }
+
                        dg_len = dg_len2;
-                       if (dg_len < 14 + crc_len) { /* ethernet hdr + crc */
+                       /*
+                        * wDatagramLength[0]
+                        * ethernet hdr + crc or larger than max frame size
+                        */
+                       if ((dg_len < 14 + crc_len) ||
+                                       (dg_len > frame_max)) {
                                INFO(port->func.config->cdev,
                                     "Bad dgram length: %#X\n", dg_len);
                                goto err;
@@ -1283,6 +1312,37 @@ static int ncm_unwrap_ntb(struct gether *port,
                        index2 = get_ncm(&tmp, opts->dgram_item_len);
                        dg_len2 = get_ncm(&tmp, opts->dgram_item_len);
 
+                       if (index2 == 0 || dg_len2 == 0)
+                               break;
+
+                       /* wDatagramIndex[1] */
+                       if (ndp_after_header) {
+                               if (index2 < opts->nth_size + opts->ndp_size) {
+                                       INFO(port->func.config->cdev,
+                                            "Bad index: %#X\n", index2);
+                                       goto err;
+                               }
+                       } else {
+                               if (index2 < opts->nth_size + opts->dpe_size) {
+                                       INFO(port->func.config->cdev,
+                                            "Bad index: %#X\n", index2);
+                                       goto err;
+                               }
+                       }
+                       if (index2 > block_len - opts->dpe_size) {
+                               INFO(port->func.config->cdev,
+                                    "Bad index: %#X\n", index2);
+                               goto err;
+                       }
+
+                       /* wDatagramLength[1] */
+                       if ((dg_len2 < 14 + crc_len) ||
+                                       (dg_len2 > frame_max)) {
+                               INFO(port->func.config->cdev,
+                                    "Bad dgram length: %#X\n", dg_len);
+                               goto err;
+                       }
+
                        /*
                         * Copy the data into a new skb.
                         * This ensures the truesize is correct
@@ -1299,9 +1359,6 @@ static int ncm_unwrap_ntb(struct gether *port,
                        ndp_len -= 2 * (opts->dgram_item_len * 2);
 
                        dgram_counter++;
-
-                       if (index2 == 0 || dg_len2 == 0)
-                               break;
                } while (ndp_len > 2 * (opts->dgram_item_len * 2));
        } while (ndp_index);
 
index d94b814328c8bfb447e14947e5b4e34a97d4f31f..184165e27908ed91afb4003cd021582e8726c382 100644 (file)
@@ -753,12 +753,13 @@ static int uasp_alloc_stream_res(struct f_uas *fu, struct uas_stream *stream)
                goto err_sts;
 
        return 0;
+
 err_sts:
-       usb_ep_free_request(fu->ep_status, stream->req_status);
-       stream->req_status = NULL;
-err_out:
        usb_ep_free_request(fu->ep_out, stream->req_out);
        stream->req_out = NULL;
+err_out:
+       usb_ep_free_request(fu->ep_in, stream->req_in);
+       stream->req_in = NULL;
 out:
        return -ENOMEM;
 }
index eaa13fd3dc7f36bd4f3953817037ff3cb818f463..e313c3b8dcb19a2f48dd1a089d14469b1c5490c3 100644 (file)
@@ -14,6 +14,7 @@
 #define __U_F_H__
 
 #include <linux/usb/gadget.h>
+#include <linux/overflow.h>
 
 /* Variable Length Array Macros **********************************************/
 #define vla_group(groupname) size_t groupname##__next = 0
 
 #define vla_item(groupname, type, name, n) \
        size_t groupname##_##name##__offset = ({                               \
-               size_t align_mask = __alignof__(type) - 1;                     \
-               size_t offset = (groupname##__next + align_mask) & ~align_mask;\
-               size_t size = (n) * sizeof(type);                              \
-               groupname##__next = offset + size;                             \
+               size_t offset = 0;                                             \
+               if (groupname##__next != SIZE_MAX) {                           \
+                       size_t align_mask = __alignof__(type) - 1;             \
+                       size_t size = array_size(n, sizeof(type));             \
+                       offset = (groupname##__next + align_mask) &            \
+                                 ~align_mask;                                 \
+                       if (check_add_overflow(offset, size,                   \
+                                              &groupname##__next)) {          \
+                               groupname##__next = SIZE_MAX;                  \
+                               offset = 0;                                    \
+                       }                                                      \
+               }                                                              \
                offset;                                                        \
        })
 
 #define vla_item_with_sz(groupname, type, name, n) \
-       size_t groupname##_##name##__sz = (n) * sizeof(type);                  \
-       size_t groupname##_##name##__offset = ({                               \
-               size_t align_mask = __alignof__(type) - 1;                     \
-               size_t offset = (groupname##__next + align_mask) & ~align_mask;\
-               size_t size = groupname##_##name##__sz;                        \
-               groupname##__next = offset + size;                             \
-               offset;                                                        \
+       size_t groupname##_##name##__sz = array_size(n, sizeof(type));          \
+       size_t groupname##_##name##__offset = ({                                \
+               size_t offset = 0;                                              \
+               if (groupname##__next != SIZE_MAX) {                            \
+                       size_t align_mask = __alignof__(type) - 1;              \
+                       offset = (groupname##__next + align_mask) &             \
+                                 ~align_mask;                                  \
+                       if (check_add_overflow(offset, groupname##_##name##__sz,\
+                                                       &groupname##__next)) {  \
+                               groupname##__next = SIZE_MAX;                   \
+                               offset = 0;                                     \
+                       }                                                       \
+               }                                                               \
+               offset;                                                         \
        })
 
 #define vla_ptr(ptr, groupname, name) \
index fa6793065c7c986e47ebf9335afa7a9004615617..a6426dd1cfefe296b9e8472ae6e9da68abd0c06d 100644 (file)
@@ -328,7 +328,7 @@ static int usba_config_fifo_table(struct usba_udc *udc)
        switch (fifo_mode) {
        default:
                fifo_mode = 0;
-               /* fall through */
+               fallthrough;
        case 0:
                udc->fifo_cfg = NULL;
                n = 0;
index b2638e83bb49898dc10706cdda9d5c10e706b803..a6f7b2594c090b72439120193f57e4de8581e423 100644 (file)
@@ -250,7 +250,7 @@ static int dr_controller_setup(struct fsl_udc *udc)
                break;
        case FSL_USB2_PHY_UTMI_WIDE:
                portctrl |= PORTSCX_PTW_16BIT;
-               /* fall through */
+               fallthrough;
        case FSL_USB2_PHY_UTMI:
        case FSL_USB2_PHY_UTMI_DUAL:
                if (udc->pdata->have_sysif_regs) {
index cfafdd92c2a841d7c425b52a9bb8b8e921fcd5aa..10324a7334fe170ae2cd7fbd21c62ade14d75538 100644 (file)
@@ -2340,12 +2340,12 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
        case PXA250_A0:
        case PXA250_A1:
                /* A0/A1 "not released"; ep 13, 15 unusable */
-               /* fall through */
+               fallthrough;
        case PXA250_B2: case PXA210_B2:
        case PXA250_B1: case PXA210_B1:
        case PXA250_B0: case PXA210_B0:
                /* OUT-DMA is broken ... */
-               /* fall through */
+               fallthrough;
        case PXA250_C0: case PXA210_C0:
                break;
 #elif  defined(CONFIG_ARCH_IXP4XX)
index 6257be4110ca26e5a4ab0a77e06b8b666c978a6e..3575b72018810412e6c0217c1a86d7407f8919aa 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/interrupt.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
+#include <linux/usb/otg.h>
 #include <linux/moduleparam.h>
 #include <linux/dma-mapping.h>
 #include <linux/debugfs.h>
index ce0eaf7d7c12a11f1fd9fb0c76d7275613669bfb..087402aec5cbeb43ab851364d6a99fff96a2b53a 100644 (file)
@@ -14,7 +14,6 @@
  */
 
 /*-------------------------------------------------------------------------*/
-#include <linux/usb/otg.h>
 
 #define        PORT_WAKE_BITS  (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E)
 
index a87c0b26279e71e4492ae377f7652b60dc0df40d..3055d9abfec302c5c931025b5bfa5b2c0d1afc7b 100644 (file)
@@ -1019,7 +1019,7 @@ static int isp116x_hub_control(struct usb_hcd *hcd,
                        spin_lock_irqsave(&isp116x->lock, flags);
                        isp116x_write_reg32(isp116x, HCRHSTATUS, RH_HS_OCIC);
                        spin_unlock_irqrestore(&isp116x->lock, flags);
-                       /* fall through */
+                       fallthrough;
                case C_HUB_LOCAL_POWER:
                        DBG("C_HUB_LOCAL_POWER\n");
                        break;
@@ -1421,10 +1421,10 @@ static int isp116x_bus_suspend(struct usb_hcd *hcd)
                isp116x_write_reg32(isp116x, HCCONTROL,
                                    (val & ~HCCONTROL_HCFS) |
                                    HCCONTROL_USB_RESET);
-               /* fall through */
+               fallthrough;
        case HCCONTROL_USB_RESET:
                ret = -EBUSY;
-               /* fall through */
+               fallthrough;
        default:                /* HCCONTROL_USB_SUSPEND */
                spin_unlock_irqrestore(&isp116x->lock, flags);
                break;
index bd40e597f25663ddc515ce04020835b580aaf194..5f5e8a64c8e2e01761fbf710c298d6e2fe2cc831 100644 (file)
@@ -171,9 +171,8 @@ static int exynos_ohci_probe(struct platform_device *pdev)
        hcd->rsrc_len = resource_size(res);
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq) {
-               dev_err(&pdev->dev, "Failed to get IRQ\n");
-               err = -ENODEV;
+       if (irq < 0) {
+               err = irq;
                goto fail_io;
        }
 
index b8961c0381cfd4fe87eca833834dfd65d0eac786..8c1bbac6d1366d5555873e80cd0a85c780f544ea 100644 (file)
@@ -957,7 +957,8 @@ static void quirk_usb_disable_ehci(struct pci_dev *pdev)
                        ehci_bios_handoff(pdev, op_reg_base, cap, offset);
                        break;
                case 0: /* Illegal reserved cap, set cap=0 so we exit */
-                       cap = 0; /* fall through */
+                       cap = 0;
+                       fallthrough;
                default:
                        dev_warn(&pdev->dev,
                                 "EHCI: unrecognized capability %02x\n",
index fcc5ac5ce8b10b7b61fe6937d4b4d1505950d46d..ccb0156fcebebf2afd72ad4945f5444ad03eda66 100644 (file)
@@ -699,7 +699,7 @@ static void dbc_handle_xfer_event(struct xhci_dbc *dbc, union xhci_trb *event)
        switch (comp_code) {
        case COMP_SUCCESS:
                remain_length = 0;
-       /* FALLTHROUGH */
+               fallthrough;
        case COMP_SHORT_PACKET:
                status = 0;
                break;
index 92e25a62fdb5b7fc8c76656345ab62b0841a95ef..c88bffd68742de8a259482dde93a5b2956507e1b 100644 (file)
@@ -274,7 +274,7 @@ static int xhci_slot_context_show(struct seq_file *s, void *unused)
 
 static int xhci_endpoint_context_show(struct seq_file *s, void *unused)
 {
-       int                     dci;
+       int                     ep_index;
        dma_addr_t              dma;
        struct xhci_hcd         *xhci;
        struct xhci_ep_ctx      *ep_ctx;
@@ -283,9 +283,9 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused)
 
        xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus));
 
-       for (dci = 1; dci < 32; dci++) {
-               ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci);
-               dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params);
+       for (ep_index = 0; ep_index < 31; ep_index++) {
+               ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index);
+               dma = dev->out_ctx->dma + (ep_index + 1) * CTX_SIZE(xhci->hcc_params);
                seq_printf(s, "%pad: %s\n", &dma,
                           xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info),
                                                  le32_to_cpu(ep_ctx->ep_info2),
index c3554e37e09f3db3e936bbdf53360125ceea9b54..c799ca5361d4d9c96a695c4540946150fa6c81f5 100644 (file)
@@ -740,15 +740,6 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci,
 {
        u32 pls = status_reg & PORT_PLS_MASK;
 
-       /* resume state is a xHCI internal state.
-        * Do not report it to usb core, instead, pretend to be U3,
-        * thus usb core knows it's not ready for transfer
-        */
-       if (pls == XDEV_RESUME) {
-               *status |= USB_SS_PORT_LS_U3;
-               return;
-       }
-
        /* When the CAS bit is set then warm reset
         * should be performed on port
         */
@@ -770,6 +761,16 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci,
                 */
                pls |= USB_PORT_STAT_CONNECTION;
        } else {
+               /*
+                * Resume state is an xHCI internal state.  Do not report it to
+                * usb core, instead, pretend to be U3, thus usb core knows
+                * it's not ready for transfer.
+                */
+               if (pls == XDEV_RESUME) {
+                       *status |= USB_SS_PORT_LS_U3;
+                       return;
+               }
+
                /*
                 * If CAS bit isn't set but the Port is already at
                 * Compliance Mode, fake a connection so the USB core
@@ -1483,7 +1484,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                        break;
                case USB_PORT_FEAT_C_SUSPEND:
                        bus_state->port_c_suspend &= ~(1 << wIndex);
-                       /* fall through */
+                       fallthrough;
                case USB_PORT_FEAT_C_RESET:
                case USB_PORT_FEAT_C_BH_PORT_RESET:
                case USB_PORT_FEAT_C_CONNECTION:
index 696fad50b478b22564d917c5dcfc17a553e48bbb..fe405cd38dbc11790b5fd91e41d78f8136c306e9 100644 (file)
@@ -1311,7 +1311,7 @@ static unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
                        interval = xhci_parse_microframe_interval(udev, ep);
                        break;
                }
-               /* Fall through - SS and HS isoc/int have same decoding */
+               fallthrough;    /* SS and HS isoc/int have same decoding */
 
        case USB_SPEED_SUPER_PLUS:
        case USB_SPEED_SUPER:
@@ -1331,7 +1331,7 @@ static unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
                 * since it uses the same rules as low speed interrupt
                 * endpoints.
                 */
-               /* fall through */
+               fallthrough;
 
        case USB_SPEED_LOW:
                if (usb_endpoint_xfer_int(&ep->desc) ||
index 59b1965ad0a3f1f17c3d7d50306f60240eec331d..f97ac9f52bf4d9cc15b244e067e87e918847a249 100644 (file)
 #define RENESAS_RETRY  10000
 #define RENESAS_DELAY  10
 
-#define ROM_VALID_01 0x2013
-#define ROM_VALID_02 0x2026
-
-static int renesas_verify_fw_version(struct pci_dev *pdev, u32 version)
-{
-       switch (version) {
-       case ROM_VALID_01:
-       case ROM_VALID_02:
-               return 0;
-       }
-       dev_err(&pdev->dev, "FW has invalid version :%d\n", version);
-       return -EINVAL;
-}
-
 static int renesas_fw_download_image(struct pci_dev *dev,
                                     const u32 *fw, size_t step, bool rom)
 {
@@ -202,10 +188,7 @@ static int renesas_check_rom_state(struct pci_dev *pdev)
 
        version &= RENESAS_FW_VERSION_FIELD;
        version = version >> RENESAS_FW_VERSION_OFFSET;
-
-       err = renesas_verify_fw_version(pdev, version);
-       if (err)
-               return err;
+       dev_dbg(&pdev->dev, "Found ROM version: %x\n", version);
 
        /*
         * Test if ROM is present and loaded, if so we can skip everything
index 2c255d0620b054d789e6a5b8a044205debd4bbab..a741a38a4c69072ccb10fbb37693304bcc915e80 100644 (file)
@@ -2103,7 +2103,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
                        break;
                xhci_dbg(xhci, "TRB error %u, halted endpoint index = %u\n",
                         trb_comp_code, ep_index);
-               /* else fall through */
+               fallthrough;
        case COMP_STALL_ERROR:
                /* Did we transfer part of the data (middle) phase? */
                if (trb_type == TRB_DATA || trb_type == TRB_NORMAL)
index 014d79334f50e1de0390c287b8144a4e0f583fb4..190923d8b246ee7c65436908bbebd1d6279f19c3 100644 (file)
@@ -1136,7 +1136,7 @@ static struct phy *tegra_xusb_get_phy(struct tegra_xusb *tegra, char *name,
        unsigned int i, phy_count = 0;
 
        for (i = 0; i < tegra->soc->num_types; i++) {
-               if (!strncmp(tegra->soc->phy_types[i].name, "usb2",
+               if (!strncmp(tegra->soc->phy_types[i].name, name,
                                                            strlen(name)))
                        return tegra->phys[phy_count+port];
 
@@ -1258,6 +1258,8 @@ static int tegra_xusb_init_usb_phy(struct tegra_xusb *tegra)
 
        INIT_WORK(&tegra->id_work, tegra_xhci_id_work);
        tegra->id_nb.notifier_call = tegra_xhci_id_notify;
+       tegra->otg_usb2_port = -EINVAL;
+       tegra->otg_usb3_port = -EINVAL;
 
        for (i = 0; i < tegra->num_usb_phys; i++) {
                struct phy *phy = tegra_xusb_get_phy(tegra, "usb2", i);
index 3c41b14ecce720280bb1c37b8493407aff73dd6a..f4cedcaee14b36b42e25b5367d949721a2d2ef9e 100644 (file)
@@ -3236,10 +3236,11 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd,
 
        wait_for_completion(cfg_cmd->completion);
 
-       ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE;
        xhci_free_command(xhci, cfg_cmd);
 cleanup:
        xhci_free_command(xhci, stop_cmd);
+       if (ep->ep_state & EP_SOFT_CLEAR_TOGGLE)
+               ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE;
 }
 
 static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
@@ -4618,7 +4619,7 @@ static unsigned long long xhci_calculate_intel_u1_timeout(
                        break;
                }
                /* Otherwise the calculation is the same as isoc eps */
-               /* fall through */
+               fallthrough;
        case USB_ENDPOINT_XFER_ISOC:
                timeout_ns = xhci_service_interval_to_ns(desc);
                timeout_ns = DIV_ROUND_UP_ULL(timeout_ns * 105, 100);
index 407fe7570f3bc228e27548cd1bfc9c78b82cde0b..f8686139d6f392bd51ee59309faaf466514eb043 100644 (file)
@@ -426,7 +426,7 @@ static int lvs_rh_probe(struct usb_interface *intf,
                        USB_DT_SS_HUB_SIZE, USB_CTRL_GET_TIMEOUT);
        if (ret < (USB_DT_HUB_NONVAR_SIZE + 2)) {
                dev_err(&hdev->dev, "wrong root hub descriptor read %d\n", ret);
-               return ret;
+               return ret < 0 ? ret : -EINVAL;
        }
 
        /* submit urb to poll interrupt endpoint */
index 6e7d34e7fec4338c479d570dd977e01f51049f17..b2e09883c7e2a20e0a319bee894b1ab9389198d0 100644 (file)
@@ -492,7 +492,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
        prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE);
        dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__,
                dev->cntl_buffer[0]);
-       retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL);
+       retval = usb_submit_urb(dev->cntl_urb, GFP_ATOMIC);
        if (retval >= 0)
                timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
        finish_wait(&dev->waitq, &wait);
index c545b27ea56819bd255442d4cd400a069333a426..edb5b63d70634d631e9a473947ff910adc162296 100644 (file)
@@ -975,7 +975,7 @@ static int cppi_channel_program(struct dma_channel *ch,
                musb_dbg(musb, "%cX DMA%d not allocated!",
                                cppi_ch->transmit ? 'T' : 'R',
                                cppi_ch->index);
-               /* FALLTHROUGH */
+               fallthrough;
        case MUSB_DMA_STATUS_FREE:
                break;
        }
index 5a56a03996b1df9d68d3a1b5d59492256e8b52a9..849e0b770130a6bf08033bc38f8d655f56f5c259 100644 (file)
@@ -852,7 +852,7 @@ static void musb_handle_intr_suspend(struct musb *musb, u8 devctl)
        case OTG_STATE_B_IDLE:
                if (!musb->is_active)
                        break;
-               /* fall through */
+               fallthrough;
        case OTG_STATE_B_PERIPHERAL:
                musb_g_suspend(musb);
                musb->is_active = musb->g.b_hnp_enable;
@@ -972,9 +972,8 @@ static void musb_handle_intr_disconnect(struct musb *musb, u8 devctl)
        case OTG_STATE_A_PERIPHERAL:
                musb_hnp_stop(musb);
                musb_root_disconnect(musb);
-               /* FALLTHROUGH */
+               fallthrough;
        case OTG_STATE_B_WAIT_ACON:
-               /* FALLTHROUGH */
        case OTG_STATE_B_PERIPHERAL:
        case OTG_STATE_B_IDLE:
                musb_g_disconnect(musb);
@@ -1009,7 +1008,7 @@ static void musb_handle_intr_reset(struct musb *musb)
                switch (musb->xceiv->otg->state) {
                case OTG_STATE_A_SUSPEND:
                        musb_g_reset(musb);
-                       /* FALLTHROUGH */
+                       fallthrough;
                case OTG_STATE_A_WAIT_BCON:     /* OPT TD.4.7-900ms */
                        /* never use invalid T(a_wait_bcon) */
                        musb_dbg(musb, "HNP: in %s, %d msec timeout",
@@ -1030,7 +1029,7 @@ static void musb_handle_intr_reset(struct musb *musb)
                        break;
                case OTG_STATE_B_IDLE:
                        musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case OTG_STATE_B_PERIPHERAL:
                        musb_g_reset(musb);
                        break;
@@ -1471,7 +1470,7 @@ static int ep_config_from_table(struct musb *musb)
        switch (fifo_mode) {
        default:
                fifo_mode = 0;
-               /* FALLTHROUGH */
+               fallthrough;
        case 0:
                cfg = mode_0_cfg;
                n = ARRAY_SIZE(mode_0_cfg);
@@ -2018,7 +2017,7 @@ static void musb_pm_runtime_check_session(struct musb *musb)
                        musb->quirk_retries--;
                        return;
                }
-               /* fall through */
+               fallthrough;
        case MUSB_QUIRK_A_DISCONNECT_19:
                if (musb->quirk_retries && !musb->flush_irq_work) {
                        musb_dbg(musb,
index 19556c1a8ae878b8f49a2bf6f972dc343420bb2e..30085b2be7b90bf132641e0e726e57b4d5048e8d 100644 (file)
@@ -232,7 +232,7 @@ static int dsps_check_status(struct musb *musb, void *unused)
                        dsps_mod_timer_optional(glue);
                        break;
                }
-               /* fall through */
+               fallthrough;
 
        case OTG_STATE_A_WAIT_BCON:
                /* keep VBUS on for host-only mode */
@@ -242,7 +242,7 @@ static int dsps_check_status(struct musb *musb, void *unused)
                }
                musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
                skip_session = 1;
-               /* fall through */
+               fallthrough;
 
        case OTG_STATE_A_IDLE:
        case OTG_STATE_B_IDLE:
@@ -793,7 +793,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
        case USB_SPEED_SUPER:
                dev_warn(dev, "ignore incorrect maximum_speed "
                                "(super-speed) setting in dts");
-               /* fall through */
+               fallthrough;
        default:
                config->maximum_speed = USB_SPEED_HIGH;
        }
index 0ae3e0be043ed2496f8000b3de4d33e7441fcefb..44d3cb02fa76a8b802242a425504a0b7d5823aaa 100644 (file)
@@ -735,7 +735,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
                        musb_writeb(mbase, MUSB_TESTMODE,
                                        musb->test_mode_nr);
                }
-               /* FALLTHROUGH */
+               fallthrough;
 
        case MUSB_EP0_STAGE_STATUSOUT:
                /* end of sequence #1: write to host (TX state) */
@@ -767,7 +767,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
                 */
                retval = IRQ_HANDLED;
                musb->ep0_state = MUSB_EP0_STAGE_SETUP;
-               /* FALLTHROUGH */
+               fallthrough;
 
        case MUSB_EP0_STAGE_SETUP:
 setup:
index 8b7d22a0c0fba0b8ef00e1fef2674a69c71e41e5..30c5e7de0761c5aa2681eb6050cb14c9fe99ba61 100644 (file)
@@ -360,7 +360,7 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb,
                                qh = first_qh(head);
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
 
                case USB_ENDPOINT_XFER_ISOC:
                case USB_ENDPOINT_XFER_INT:
@@ -1019,7 +1019,7 @@ static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb)
                        musb->ep0_stage = MUSB_EP0_OUT;
                        more = true;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case MUSB_EP0_OUT:
                fifo_count = min_t(size_t, qh->maxpacket,
                                   urb->transfer_buffer_length -
@@ -2222,7 +2222,7 @@ static int musb_urb_enqueue(
                        interval = max_t(u8, epd->bInterval, 1);
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case USB_ENDPOINT_XFER_ISOC:
                /* ISO always uses logarithmic encoding */
                interval = min_t(u8, epd->bInterval, 16);
index cb7ae297a3af009376c7b45357fc8ad0750e38f2..cafc69536e1d787679a14d7c3d74b97da9e34b08 100644 (file)
@@ -211,7 +211,7 @@ void musb_root_disconnect(struct musb *musb)
                        musb->g.is_a_peripheral = 1;
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case OTG_STATE_A_HOST:
                musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
                musb->is_active = 0;
index d62c78b97cadb3f0947c90a535a539550973cd59..4232f1ce3fbfaac8626d3f349c2bec4cd2cb2dc7 100644 (file)
@@ -104,7 +104,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
                        if (error)
                                break;
                        musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
-                       /* Fall through */
+                       fallthrough;
                case OTG_STATE_A_WAIT_VRISE:
                case OTG_STATE_A_WAIT_BCON:
                case OTG_STATE_A_HOST:
index 99890d1bbfcb54dbbbba7e7c9f0a9c6792cf0222..c26683a2702b65ad542588cb16cad5cd7e186137 100644 (file)
@@ -464,7 +464,7 @@ static void musb_do_idle(struct timer_list *t)
                        dev_dbg(musb->controller, "Nothing connected %s, turning off VBUS\n",
                                        usb_otg_state_string(musb->xceiv->otg->state));
                }
-               /* FALLTHROUGH */
+               fallthrough;
        case OTG_STATE_A_IDLE:
                tusb_musb_set_vbus(musb, 0);
        default:
index d4ee3cb721ea8cac0352d0aab0342fa9a7190460..f6d3731581ebdeac4a53c2a1f5b611115896ff32 100644 (file)
@@ -176,6 +176,7 @@ static int ingenic_usb_phy_init(struct usb_phy *phy)
 
        /* Wait for PHY to reset */
        usleep_range(30, 300);
+       reg = readl(priv->base + REG_USBPCR_OFFSET);
        writel(reg & ~USBPCR_POR, priv->base + REG_USBPCR_OFFSET);
        usleep_range(300, 1000);
 
index 871cdccf3a5f1c6ec69d30ad0bd0bd2fa33f3af5..9823bb424abd9abe465c788ef97ab5ff51c74766 100644 (file)
@@ -713,6 +713,7 @@ static const struct usb_device_id id_table_combined[] = {
        { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) },
        { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) },
        { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) },
+       { USB_DEVICE(XSENS_VID, XSENS_MTIUSBCONVERTER_PID) },
        { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
        { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
index e8373528264c3634a9e474f2836a82d2b5b8b7a5..b5ca17a5967a0d6cbefbc925208b65a331b82f5e 100644 (file)
 #define XSENS_AWINDA_DONGLE_PID 0x0102
 #define XSENS_MTW_PID          0x0200  /* Xsens MTw */
 #define XSENS_MTDEVBOARD_PID   0x0300  /* Motion Tracker Development Board */
+#define XSENS_MTIUSBCONVERTER_PID      0x0301  /* MTi USB converter */
 #define XSENS_CONVERTER_PID    0xD00D  /* Xsens USB-serial converter */
 
 /* Xsens devices using FTDI VID */
index 89b3192af3269b5acc80fd8df7e3727585852c50..0c6f160a214ab1ef18d781c8d019e706376b361f 100644 (file)
@@ -1094,14 +1094,18 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
          .driver_info = RSVD(1) | RSVD(3) },
        /* Quectel products using Quectel vendor ID */
-       { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
-         .driver_info = RSVD(4) },
-       { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
-         .driver_info = RSVD(4) },
-       { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95),
-         .driver_info = RSVD(4) },
-       { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
-         .driver_info = RSVD(4) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff),
+         .driver_info = NUMEP2 },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0, 0) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff),
+         .driver_info = NUMEP2 },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff),
+         .driver_info = NUMEP2 },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff),
+         .driver_info = NUMEP2 },
+       { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) },
        { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
          .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
        { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
@@ -1819,6 +1823,8 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) },   /* Simcom SIM7500/SIM7600 MBIM mode */
        { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff),     /* Simcom SIM7500/SIM7600 RNDIS mode */
          .driver_info = RSVD(7) },
+       { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9205, 0xff) },   /* Simcom SIM7070/SIM7080/SIM7090 AT+ECM mode */
+       { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9206, 0xff) },   /* Simcom SIM7070/SIM7080/SIM7090 AT-only mode */
        { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200),
          .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) },
        { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D),
index c8a988d2cfdd357b2c6ea4c469410d2887717fec..15dc25801cdcc52f292313db6d0f5e9e81329d14 100644 (file)
@@ -592,7 +592,7 @@ static unsigned long sddr55_get_capacity(struct us_data *us) {
        case 0x64:
                info->pageshift = 8;
                info->smallpageshift = 1;
-               /* fall through */
+               fallthrough;
        case 0x5d: // 5d is a ROM card with pagesize 512.
                return 0x00200000;
 
index d592071119ba6b84275dbe19916b8eaa20e24c82..8183504e3abbc75fbfd062bb6efbcfea9e616ad6 100644 (file)
@@ -662,8 +662,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
        if (devinfo->resetting) {
                cmnd->result = DID_ERROR << 16;
                cmnd->scsi_done(cmnd);
-               spin_unlock_irqrestore(&devinfo->lock, flags);
-               return 0;
+               goto zombie;
        }
 
        /* Find a free uas-tag */
@@ -688,7 +687,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
                break;
        case DMA_BIDIRECTIONAL:
                cmdinfo->state |= ALLOC_DATA_IN_URB | SUBMIT_DATA_IN_URB;
-               /* fall through */
+               fallthrough;
        case DMA_TO_DEVICE:
                cmdinfo->state |= ALLOC_DATA_OUT_URB | SUBMIT_DATA_OUT_URB;
        case DMA_NONE:
@@ -699,6 +698,16 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
                cmdinfo->state &= ~(SUBMIT_DATA_IN_URB | SUBMIT_DATA_OUT_URB);
 
        err = uas_submit_urbs(cmnd, devinfo);
+       /*
+        * in case of fatal errors the SCSI layer is peculiar
+        * a command that has finished is a success for the purpose
+        * of queueing, no matter how fatal the error
+        */
+       if (err == -ENODEV) {
+               cmnd->result = DID_ERROR << 16;
+               cmnd->scsi_done(cmnd);
+               goto zombie;
+       }
        if (err) {
                /* If we did nothing, give up now */
                if (cmdinfo->state & SUBMIT_STATUS_URB) {
@@ -709,6 +718,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
        }
 
        devinfo->cmnd[idx] = cmnd;
+zombie:
        spin_unlock_irqrestore(&devinfo->lock, flags);
        return 0;
 }
index 220ae2c356eee84d5fa869af9491f3a261967667..5732e9691f08f2f8a3c2661a3feaa46f6dcbbac6 100644 (file)
@@ -2328,7 +2328,7 @@ UNUSUAL_DEV(  0x357d, 0x7788, 0x0114, 0x0114,
                "JMicron",
                "USB to ATA/ATAPI Bridge",
                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
-               US_FL_BROKEN_FUA ),
+               US_FL_BROKEN_FUA | US_FL_IGNORE_UAS ),
 
 /* Reported by Andrey Rahmatullin <wrar@altlinux.org> */
 UNUSUAL_DEV(  0x4102, 0x1020, 0x0100,  0x0100,
index 162b09d69f62ff5b6e5e4529b190afffa3937de8..711ab240058c7d3ef8eebc62240befe19cf71f2c 100644 (file)
  * and don't forget to CC: the USB development list <linux-usb@vger.kernel.org>
  */
 
+/* Reported-by: Till Dörges <doerges@pre-sense.de> */
+UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x9999,
+               "Sony",
+               "PSZ-HA*",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_NO_REPORT_OPCODES),
+
 /* Reported-by: Julian Groß <julian.g@posteo.de> */
 UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
                "LaCie",
@@ -80,6 +87,13 @@ UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999,
                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
                US_FL_BROKEN_FUA),
 
+/* Reported-by: Thinh Nguyen <thinhn@synopsys.com> */
+UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x9999,
+               "PNY",
+               "Pro Elite SSD",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_NO_ATA_1X),
+
 /* Reported-by: Hans de Goede <hdegoede@redhat.com> */
 UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999,
                "VIA",
index e4021e13af40a3b3b440b9eed1fa53887a513fa1..676b525c2a6620afc3a56d7f7539befd4d1e7933 100644 (file)
@@ -61,14 +61,11 @@ enum {
 
 #define PMC_USB_ALTMODE_ORI_SHIFT      1
 #define PMC_USB_ALTMODE_UFP_SHIFT      3
-#define PMC_USB_ALTMODE_ORI_AUX_SHIFT  4
-#define PMC_USB_ALTMODE_ORI_HSL_SHIFT  5
 
 /* DP specific Mode Data bits */
 #define PMC_USB_ALTMODE_DP_MODE_SHIFT  8
 
 /* TBT specific Mode Data bits */
-#define PMC_USB_ALTMODE_HPD_HIGH       BIT(14)
 #define PMC_USB_ALTMODE_TBT_TYPE       BIT(17)
 #define PMC_USB_ALTMODE_CABLE_TYPE     BIT(18)
 #define PMC_USB_ALTMODE_ACTIVE_LINK    BIT(20)
@@ -128,13 +125,19 @@ static int hsl_orientation(struct pmc_usb_port *port)
 static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
 {
        u8 response[4];
+       int ret;
 
        /*
         * Error bit will always be 0 with the USBC command.
-        * Status can be checked from the response message.
+        * Status can be checked from the response message if the
+        * function intel_scu_ipc_dev_command succeeds.
         */
-       intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg, len,
-                                 response, sizeof(response));
+       ret = intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg,
+                                       len, response, sizeof(response));
+
+       if (ret)
+               return ret;
+
        if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {
                if (response[2] & PMC_USB_RESP_STATUS_FATAL)
                        return -EIO;
@@ -179,15 +182,9 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)
        req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT;
        req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT;
 
-       req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT;
-       req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT;
-
        req.mode_data |= (state->mode - TYPEC_STATE_MODAL) <<
                         PMC_USB_ALTMODE_DP_MODE_SHIFT;
 
-       if (data->status & DP_STATUS_HPD_STATE)
-               req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH;
-
        ret = pmc_usb_command(port, (void *)&req, sizeof(req));
        if (ret)
                return ret;
@@ -212,9 +209,6 @@ pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state)
        req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT;
        req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT;
 
-       req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT;
-       req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT;
-
        if (TBT_ADAPTER(data->device_mode) == TBT_ADAPTER_TBT3)
                req.mode_data |= PMC_USB_ALTMODE_TBT_TYPE;
 
@@ -497,6 +491,7 @@ err_remove_ports:
        for (i = 0; i < pmc->num_ports; i++) {
                typec_switch_unregister(pmc->port[i].typec_sw);
                typec_mux_unregister(pmc->port[i].typec_mux);
+               usb_role_switch_unregister(pmc->port[i].usb_sw);
        }
 
        return ret;
@@ -510,6 +505,7 @@ static int pmc_usb_remove(struct platform_device *pdev)
        for (i = 0; i < pmc->num_ports; i++) {
                typec_switch_unregister(pmc->port[i].typec_sw);
                typec_mux_unregister(pmc->port[i].typec_mux);
+               usb_role_switch_unregister(pmc->port[i].usb_sw);
        }
 
        return 0;
index f57d91fd0e092454fc5df9dc807a3a2859f9bb65..bd80e03b2b6f806c6a68c8c30d7089e11ffdb064 100644 (file)
@@ -157,7 +157,7 @@ static enum typec_cc_status tcpci_to_typec_cc(unsigned int cc, bool sink)
        case 0x3:
                if (sink)
                        return TYPEC_CC_RP_3_0;
-               /* fall through */
+               fallthrough;
        case 0x0:
        default:
                return TYPEC_CC_OPEN;
index 3ef37202ee3757597b900dec25b34b823f7424b9..a48e3f90d19610c2dcf577b3c974b54b78ea319a 100644 (file)
@@ -3372,13 +3372,31 @@ static void run_state_machine(struct tcpm_port *port)
                        tcpm_set_state(port, SNK_HARD_RESET_SINK_OFF, 0);
                break;
        case SRC_HARD_RESET_VBUS_OFF:
-               tcpm_set_vconn(port, true);
+               /*
+                * 7.1.5 Response to Hard Resets
+                * Hard Reset Signaling indicates a communication failure has occurred and the
+                * Source Shall stop driving VCONN, Shall remove Rp from the VCONN pin and Shall
+                * drive VBUS to vSafe0V as shown in Figure 7-9.
+                */
+               tcpm_set_vconn(port, false);
                tcpm_set_vbus(port, false);
                tcpm_set_roles(port, port->self_powered, TYPEC_SOURCE,
                               tcpm_data_role_for_source(port));
-               tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER);
+               /*
+                * If tcpc fails to notify vbus off, TCPM will wait for PD_T_SAFE_0V +
+                * PD_T_SRC_RECOVER before turning vbus back on.
+                * From Table 7-12 Sequence Description for a Source Initiated Hard Reset:
+                * 4. Policy Engine waits tPSHardReset after sending Hard Reset Signaling and then
+                * tells the Device Policy Manager to instruct the power supply to perform a
+                * Hard Reset. The transition to vSafe0V Shall occur within tSafe0V (t2).
+                * 5. After tSrcRecover the Source applies power to VBUS in an attempt to
+                * re-establish communication with the Sink and resume USB Default Operation.
+                * The transition to vSafe5V Shall occur within tSrcTurnOn(t4).
+                */
+               tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SAFE_0V + PD_T_SRC_RECOVER);
                break;
        case SRC_HARD_RESET_VBUS_ON:
+               tcpm_set_vconn(port, true);
                tcpm_set_vbus(port, true);
                port->tcpc->set_pd_rx(port->tcpc, true);
                tcpm_set_attached_state(port, true);
@@ -3944,7 +3962,11 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
                tcpm_set_state(port, SNK_HARD_RESET_WAIT_VBUS, 0);
                break;
        case SRC_HARD_RESET_VBUS_OFF:
-               tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, 0);
+               /*
+                * After establishing the vSafe0V voltage condition on VBUS, the Source Shall wait
+                * tSrcRecover before re-applying VCONN and restoring VBUS to vSafe5V.
+                */
+               tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER);
                break;
        case HARD_RESET_SEND:
                break;
index 048381c058a5bfe4dd14aa4a118bc128d30509ef..261131c9e37c63a05b0f52adad5ed10bfae80553 100644 (file)
@@ -288,8 +288,6 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
        struct typec_altmode *alt;
        struct ucsi_dp *dp;
 
-       mutex_lock(&con->lock);
-
        /* We can't rely on the firmware with the capabilities. */
        desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE;
 
@@ -298,15 +296,12 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
        desc->vdo |= all_assignments << 16;
 
        alt = typec_port_register_altmode(con->port, desc);
-       if (IS_ERR(alt)) {
-               mutex_unlock(&con->lock);
+       if (IS_ERR(alt))
                return alt;
-       }
 
        dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
        if (!dp) {
                typec_unregister_altmode(alt);
-               mutex_unlock(&con->lock);
                return ERR_PTR(-ENOMEM);
        }
 
@@ -319,7 +314,5 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
        alt->ops = &ucsi_displayport_ops;
        typec_altmode_set_drvdata(alt, dp);
 
-       mutex_unlock(&con->lock);
-
        return alt;
 }
index affd024190c9116cafb112e7bbc5c7d690cfdf0a..758b988ac518a79bc43618be9d3057d693c247a1 100644 (file)
@@ -146,40 +146,33 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd)
        return UCSI_CCI_LENGTH(cci);
 }
 
-static int ucsi_run_command(struct ucsi *ucsi, u64 command,
-                           void *data, size_t size)
+int ucsi_send_command(struct ucsi *ucsi, u64 command,
+                     void *data, size_t size)
 {
        u8 length;
        int ret;
 
+       mutex_lock(&ucsi->ppm_lock);
+
        ret = ucsi_exec_command(ucsi, command);
        if (ret < 0)
-               return ret;
+               goto out;
 
        length = ret;
 
        if (data) {
                ret = ucsi->ops->read(ucsi, UCSI_MESSAGE_IN, data, size);
                if (ret)
-                       return ret;
+                       goto out;
        }
 
        ret = ucsi_acknowledge_command(ucsi);
        if (ret)
-               return ret;
+               goto out;
 
-       return length;
-}
-
-int ucsi_send_command(struct ucsi *ucsi, u64 command,
-                     void *retval, size_t size)
-{
-       int ret;
-
-       mutex_lock(&ucsi->ppm_lock);
-       ret = ucsi_run_command(ucsi, command, retval, size);
+       ret = length;
+out:
        mutex_unlock(&ucsi->ppm_lock);
-
        return ret;
 }
 EXPORT_SYMBOL_GPL(ucsi_send_command);
@@ -205,7 +198,7 @@ void ucsi_altmode_update_active(struct ucsi_connector *con)
        int i;
 
        command = UCSI_GET_CURRENT_CAM | UCSI_CONNECTOR_NUMBER(con->num);
-       ret = ucsi_run_command(con->ucsi, command, &cur, sizeof(cur));
+       ret = ucsi_send_command(con->ucsi, command, &cur, sizeof(cur));
        if (ret < 0) {
                if (con->ucsi->version > 0x0100) {
                        dev_err(con->ucsi->dev,
@@ -223,14 +216,18 @@ void ucsi_altmode_update_active(struct ucsi_connector *con)
                                            con->partner_altmode[i] == altmode);
 }
 
-static u8 ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid)
+static int ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid)
 {
        u8 mode = 1;
        int i;
 
-       for (i = 0; alt[i]; i++)
+       for (i = 0; alt[i]; i++) {
+               if (i > MODE_DISCOVERY_MAX)
+                       return -ERANGE;
+
                if (alt[i]->svid == svid)
                        mode++;
+       }
 
        return mode;
 }
@@ -265,8 +262,11 @@ static int ucsi_register_altmode(struct ucsi_connector *con,
                        goto err;
                }
 
-               desc->mode = ucsi_altmode_next_mode(con->port_altmode,
-                                                   desc->svid);
+               ret = ucsi_altmode_next_mode(con->port_altmode, desc->svid);
+               if (ret < 0)
+                       return ret;
+
+               desc->mode = ret;
 
                switch (desc->svid) {
                case USB_TYPEC_DP_SID:
@@ -299,8 +299,11 @@ static int ucsi_register_altmode(struct ucsi_connector *con,
                        goto err;
                }
 
-               desc->mode = ucsi_altmode_next_mode(con->partner_altmode,
-                                                   desc->svid);
+               ret = ucsi_altmode_next_mode(con->partner_altmode, desc->svid);
+               if (ret < 0)
+                       return ret;
+
+               desc->mode = ret;
 
                alt = typec_partner_register_altmode(con->partner, desc);
                if (IS_ERR(alt)) {
@@ -354,7 +357,7 @@ ucsi_register_altmodes_nvidia(struct ucsi_connector *con, u8 recipient)
                command |= UCSI_GET_ALTMODE_RECIPIENT(recipient);
                command |= UCSI_GET_ALTMODE_CONNECTOR_NUMBER(con->num);
                command |= UCSI_GET_ALTMODE_OFFSET(i);
-               len = ucsi_run_command(con->ucsi, command, &alt, sizeof(alt));
+               len = ucsi_send_command(con->ucsi, command, &alt, sizeof(alt));
                /*
                 * We are collecting all altmodes first and then registering.
                 * Some type-C device will return zero length data beyond last
@@ -431,7 +434,7 @@ static int ucsi_register_altmodes(struct ucsi_connector *con, u8 recipient)
                command |= UCSI_GET_ALTMODE_RECIPIENT(recipient);
                command |= UCSI_GET_ALTMODE_CONNECTOR_NUMBER(con->num);
                command |= UCSI_GET_ALTMODE_OFFSET(i);
-               len = ucsi_run_command(con->ucsi, command, alt, sizeof(alt));
+               len = ucsi_send_command(con->ucsi, command, alt, sizeof(alt));
                if (len <= 0)
                        return len;
 
@@ -502,7 +505,7 @@ static void ucsi_get_pdos(struct ucsi_connector *con, int is_partner)
        command |= UCSI_GET_PDOS_PARTNER_PDO(is_partner);
        command |= UCSI_GET_PDOS_NUM_PDOS(UCSI_MAX_PDOS - 1);
        command |= UCSI_GET_PDOS_SRC_PDOS;
-       ret = ucsi_run_command(ucsi, command, con->src_pdos,
+       ret = ucsi_send_command(ucsi, command, con->src_pdos,
                               sizeof(con->src_pdos));
        if (ret < 0) {
                dev_err(ucsi->dev, "UCSI_GET_PDOS failed (%d)\n", ret);
@@ -681,7 +684,7 @@ static void ucsi_handle_connector_change(struct work_struct *work)
                 */
                command = UCSI_GET_CAM_SUPPORTED;
                command |= UCSI_CONNECTOR_NUMBER(con->num);
-               ucsi_run_command(con->ucsi, command, NULL, 0);
+               ucsi_send_command(con->ucsi, command, NULL, 0);
        }
 
        if (con->status.change & UCSI_CONSTAT_PARTNER_CHANGE)
@@ -736,20 +739,24 @@ static int ucsi_reset_ppm(struct ucsi *ucsi)
        u32 cci;
        int ret;
 
+       mutex_lock(&ucsi->ppm_lock);
+
        ret = ucsi->ops->async_write(ucsi, UCSI_CONTROL, &command,
                                     sizeof(command));
        if (ret < 0)
-               return ret;
+               goto out;
 
        tmo = jiffies + msecs_to_jiffies(UCSI_TIMEOUT_MS);
 
        do {
-               if (time_is_before_jiffies(tmo))
-                       return -ETIMEDOUT;
+               if (time_is_before_jiffies(tmo)) {
+                       ret = -ETIMEDOUT;
+                       goto out;
+               }
 
                ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci));
                if (ret)
-                       return ret;
+                       goto out;
 
                /* If the PPM is still doing something else, reset it again. */
                if (cci & ~UCSI_CCI_RESET_COMPLETE) {
@@ -757,13 +764,15 @@ static int ucsi_reset_ppm(struct ucsi *ucsi)
                                                     &command,
                                                     sizeof(command));
                        if (ret < 0)
-                               return ret;
+                               goto out;
                }
 
                msleep(20);
        } while (!(cci & UCSI_CCI_RESET_COMPLETE));
 
-       return 0;
+out:
+       mutex_unlock(&ucsi->ppm_lock);
+       return ret;
 }
 
 static int ucsi_role_cmd(struct ucsi_connector *con, u64 command)
@@ -775,9 +784,7 @@ static int ucsi_role_cmd(struct ucsi_connector *con, u64 command)
                u64 c;
 
                /* PPM most likely stopped responding. Resetting everything. */
-               mutex_lock(&con->ucsi->ppm_lock);
                ucsi_reset_ppm(con->ucsi);
-               mutex_unlock(&con->ucsi->ppm_lock);
 
                c = UCSI_SET_NOTIFICATION_ENABLE | con->ucsi->ntfy;
                ucsi_send_command(con->ucsi, c, NULL, 0);
@@ -901,12 +908,15 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
        con->num = index + 1;
        con->ucsi = ucsi;
 
+       /* Delay other interactions with the con until registration is complete */
+       mutex_lock(&con->lock);
+
        /* Get connector capability */
        command = UCSI_GET_CONNECTOR_CAPABILITY;
        command |= UCSI_CONNECTOR_NUMBER(con->num);
-       ret = ucsi_run_command(ucsi, command, &con->cap, sizeof(con->cap));
+       ret = ucsi_send_command(ucsi, command, &con->cap, sizeof(con->cap));
        if (ret < 0)
-               return ret;
+               goto out;
 
        if (con->cap.op_mode & UCSI_CONCAP_OPMODE_DRP)
                cap->data = TYPEC_PORT_DRD;
@@ -938,27 +948,32 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
 
        ret = ucsi_register_port_psy(con);
        if (ret)
-               return ret;
+               goto out;
 
        /* Register the connector */
        con->port = typec_register_port(ucsi->dev, cap);
-       if (IS_ERR(con->port))
-               return PTR_ERR(con->port);
+       if (IS_ERR(con->port)) {
+               ret = PTR_ERR(con->port);
+               goto out;
+       }
 
        /* Alternate modes */
        ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_CON);
-       if (ret)
+       if (ret) {
                dev_err(ucsi->dev, "con%d: failed to register alt modes\n",
                        con->num);
+               goto out;
+       }
 
        /* Get the status */
        command = UCSI_GET_CONNECTOR_STATUS | UCSI_CONNECTOR_NUMBER(con->num);
-       ret = ucsi_run_command(ucsi, command, &con->status,
-                              sizeof(con->status));
+       ret = ucsi_send_command(ucsi, command, &con->status, sizeof(con->status));
        if (ret < 0) {
                dev_err(ucsi->dev, "con%d: failed to get status\n", con->num);
-               return 0;
+               ret = 0;
+               goto out;
        }
+       ret = 0; /* ucsi_send_command() returns length on success */
 
        switch (UCSI_CONSTAT_PARTNER_TYPE(con->status.flags)) {
        case UCSI_CONSTAT_PARTNER_TYPE_UFP:
@@ -983,17 +998,21 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
 
        if (con->partner) {
                ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_SOP);
-               if (ret)
+               if (ret) {
                        dev_err(ucsi->dev,
                                "con%d: failed to register alternate modes\n",
                                con->num);
-               else
+                       ret = 0;
+               } else {
                        ucsi_altmode_update_active(con);
+               }
        }
 
        trace_ucsi_register_port(con->num, &con->status);
 
-       return 0;
+out:
+       mutex_unlock(&con->lock);
+       return ret;
 }
 
 /**
@@ -1009,8 +1028,6 @@ static int ucsi_init(struct ucsi *ucsi)
        int ret;
        int i;
 
-       mutex_lock(&ucsi->ppm_lock);
-
        /* Reset the PPM */
        ret = ucsi_reset_ppm(ucsi);
        if (ret) {
@@ -1021,13 +1038,13 @@ static int ucsi_init(struct ucsi *ucsi)
        /* Enable basic notifications */
        ucsi->ntfy = UCSI_ENABLE_NTFY_CMD_COMPLETE | UCSI_ENABLE_NTFY_ERROR;
        command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy;
-       ret = ucsi_run_command(ucsi, command, NULL, 0);
+       ret = ucsi_send_command(ucsi, command, NULL, 0);
        if (ret < 0)
                goto err_reset;
 
        /* Get PPM capabilities */
        command = UCSI_GET_CAPABILITY;
-       ret = ucsi_run_command(ucsi, command, &ucsi->cap, sizeof(ucsi->cap));
+       ret = ucsi_send_command(ucsi, command, &ucsi->cap, sizeof(ucsi->cap));
        if (ret < 0)
                goto err_reset;
 
@@ -1054,12 +1071,10 @@ static int ucsi_init(struct ucsi *ucsi)
        /* Enable all notifications */
        ucsi->ntfy = UCSI_ENABLE_NTFY_ALL;
        command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy;
-       ret = ucsi_run_command(ucsi, command, NULL, 0);
+       ret = ucsi_send_command(ucsi, command, NULL, 0);
        if (ret < 0)
                goto err_unregister;
 
-       mutex_unlock(&ucsi->ppm_lock);
-
        return 0;
 
 err_unregister:
@@ -1074,8 +1089,6 @@ err_unregister:
 err_reset:
        ucsi_reset_ppm(ucsi);
 err:
-       mutex_unlock(&ucsi->ppm_lock);
-
        return ret;
 }
 
index 9fc4f338e8700ec069d9154cf77ee8ef9880201f..fbfe8f5933af8ffec6f1c53008070ec8c989f8eb 100644 (file)
@@ -78,7 +78,7 @@ static int ucsi_acpi_sync_write(struct ucsi *ucsi, unsigned int offset,
        if (ret)
                goto out_clear_bit;
 
-       if (!wait_for_completion_timeout(&ua->complete, msecs_to_jiffies(5000)))
+       if (!wait_for_completion_timeout(&ua->complete, 60 * HZ))
                ret = -ETIMEDOUT;
 
 out_clear_bit:
@@ -112,11 +112,15 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data)
 
 static int ucsi_acpi_probe(struct platform_device *pdev)
 {
+       struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
        struct ucsi_acpi *ua;
        struct resource *res;
        acpi_status status;
        int ret;
 
+       if (adev->dep_unmet)
+               return -EPROBE_DEFER;
+
        ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL);
        if (!ua)
                return -ENOMEM;
index 2305d425e6c9adbc8ebdbcf4db45770da3710c0d..9d7d642022d1f65b637a150ae1296a8af75eb017 100644 (file)
@@ -461,6 +461,11 @@ static void stub_disconnect(struct usb_device *udev)
        return;
 }
 
+static bool usbip_match(struct usb_device *udev)
+{
+       return true;
+}
+
 #ifdef CONFIG_PM
 
 /* These functions need usb_port_suspend and usb_port_resume,
@@ -486,6 +491,7 @@ struct usb_device_driver stub_driver = {
        .name           = "usbip-host",
        .probe          = stub_probe,
        .disconnect     = stub_disconnect,
+       .match          = usbip_match,
 #ifdef CONFIG_PM
        .suspend        = stub_suspend,
        .resume         = stub_resume,
index 08f267a2aafec962fc89f1f6d3cd0b2a26bc478d..64696d63fe0770221341505201e432bd2bda0130 100644 (file)
@@ -84,7 +84,7 @@ struct ifcvf_hw {
        void __iomem * const *base;
        char config_msix_name[256];
        struct vdpa_callback config_cb;
-
+       unsigned int config_irq;
 };
 
 struct ifcvf_adapter {
index 076d7ac5e723f9f2b227e631ea88526badcdb8f7..8b4028556cb66e42f8f13d294bc88800c2ed673c 100644 (file)
@@ -55,6 +55,7 @@ static void ifcvf_free_irq(struct ifcvf_adapter *adapter, int queues)
                vf->vring[i].irq = -EINVAL;
        }
 
+       devm_free_irq(&pdev->dev, vf->config_irq, vf);
        ifcvf_free_irq_vectors(pdev);
 }
 
@@ -74,10 +75,14 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter)
        snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
                 pci_name(pdev));
        vector = 0;
-       irq = pci_irq_vector(pdev, vector);
-       ret = devm_request_irq(&pdev->dev, irq,
+       vf->config_irq = pci_irq_vector(pdev, vector);
+       ret = devm_request_irq(&pdev->dev, vf->config_irq,
                               ifcvf_config_changed, 0,
                               vf->config_msix_name, vf);
+       if (ret) {
+               IFCVF_ERR(pdev, "Failed to request config irq\n");
+               return ret;
+       }
 
        for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) {
                snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n",
index 9df69d5efe8c7fef4b319be9c24a51464b3d0913..70676a6d16914a377934dca3b3d9b429e56c7b32 100644 (file)
 #define to_mvdev(__vdev) container_of((__vdev), struct mlx5_vdpa_dev, vdev)
 
 #define VALID_FEATURES_MASK                                                                        \
-       (BIT(VIRTIO_NET_F_CSUM) | BIT(VIRTIO_NET_F_GUEST_CSUM) |                                   \
-        BIT(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) | BIT(VIRTIO_NET_F_MTU) | BIT(VIRTIO_NET_F_MAC) |   \
-        BIT(VIRTIO_NET_F_GUEST_TSO4) | BIT(VIRTIO_NET_F_GUEST_TSO6) |                             \
-        BIT(VIRTIO_NET_F_GUEST_ECN) | BIT(VIRTIO_NET_F_GUEST_UFO) | BIT(VIRTIO_NET_F_HOST_TSO4) | \
-        BIT(VIRTIO_NET_F_HOST_TSO6) | BIT(VIRTIO_NET_F_HOST_ECN) | BIT(VIRTIO_NET_F_HOST_UFO) |   \
-        BIT(VIRTIO_NET_F_MRG_RXBUF) | BIT(VIRTIO_NET_F_STATUS) | BIT(VIRTIO_NET_F_CTRL_VQ) |      \
-        BIT(VIRTIO_NET_F_CTRL_RX) | BIT(VIRTIO_NET_F_CTRL_VLAN) |                                 \
-        BIT(VIRTIO_NET_F_CTRL_RX_EXTRA) | BIT(VIRTIO_NET_F_GUEST_ANNOUNCE) |                      \
-        BIT(VIRTIO_NET_F_MQ) | BIT(VIRTIO_NET_F_CTRL_MAC_ADDR) | BIT(VIRTIO_NET_F_HASH_REPORT) |  \
-        BIT(VIRTIO_NET_F_RSS) | BIT(VIRTIO_NET_F_RSC_EXT) | BIT(VIRTIO_NET_F_STANDBY) |           \
-        BIT(VIRTIO_NET_F_SPEED_DUPLEX) | BIT(VIRTIO_F_NOTIFY_ON_EMPTY) |                          \
-        BIT(VIRTIO_F_ANY_LAYOUT) | BIT(VIRTIO_F_VERSION_1) | BIT(VIRTIO_F_ACCESS_PLATFORM) |      \
-        BIT(VIRTIO_F_RING_PACKED) | BIT(VIRTIO_F_ORDER_PLATFORM) | BIT(VIRTIO_F_SR_IOV))
+       (BIT_ULL(VIRTIO_NET_F_CSUM) | BIT_ULL(VIRTIO_NET_F_GUEST_CSUM) |                                   \
+        BIT_ULL(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) | BIT_ULL(VIRTIO_NET_F_MTU) | BIT_ULL(VIRTIO_NET_F_MAC) |   \
+        BIT_ULL(VIRTIO_NET_F_GUEST_TSO4) | BIT_ULL(VIRTIO_NET_F_GUEST_TSO6) |                             \
+        BIT_ULL(VIRTIO_NET_F_GUEST_ECN) | BIT_ULL(VIRTIO_NET_F_GUEST_UFO) | BIT_ULL(VIRTIO_NET_F_HOST_TSO4) | \
+        BIT_ULL(VIRTIO_NET_F_HOST_TSO6) | BIT_ULL(VIRTIO_NET_F_HOST_ECN) | BIT_ULL(VIRTIO_NET_F_HOST_UFO) |   \
+        BIT_ULL(VIRTIO_NET_F_MRG_RXBUF) | BIT_ULL(VIRTIO_NET_F_STATUS) | BIT_ULL(VIRTIO_NET_F_CTRL_VQ) |      \
+        BIT_ULL(VIRTIO_NET_F_CTRL_RX) | BIT_ULL(VIRTIO_NET_F_CTRL_VLAN) |                                 \
+        BIT_ULL(VIRTIO_NET_F_CTRL_RX_EXTRA) | BIT_ULL(VIRTIO_NET_F_GUEST_ANNOUNCE) |                      \
+        BIT_ULL(VIRTIO_NET_F_MQ) | BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR) | BIT_ULL(VIRTIO_NET_F_HASH_REPORT) |  \
+        BIT_ULL(VIRTIO_NET_F_RSS) | BIT_ULL(VIRTIO_NET_F_RSC_EXT) | BIT_ULL(VIRTIO_NET_F_STANDBY) |           \
+        BIT_ULL(VIRTIO_NET_F_SPEED_DUPLEX) | BIT_ULL(VIRTIO_F_NOTIFY_ON_EMPTY) |                          \
+        BIT_ULL(VIRTIO_F_ANY_LAYOUT) | BIT_ULL(VIRTIO_F_VERSION_1) | BIT_ULL(VIRTIO_F_ACCESS_PLATFORM) |      \
+        BIT_ULL(VIRTIO_F_RING_PACKED) | BIT_ULL(VIRTIO_F_ORDER_PLATFORM) | BIT_ULL(VIRTIO_F_SR_IOV))
 
 #define VALID_STATUS_MASK                                                                          \
        (VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK |        \
@@ -149,7 +149,7 @@ static bool mlx5_vdpa_debug;
 
 #define MLX5_LOG_VIO_FLAG(_feature)                                                                \
        do {                                                                                       \
-               if (features & BIT(_feature))                                                      \
+               if (features & BIT_ULL(_feature))                                                  \
                        mlx5_vdpa_info(mvdev, "%s\n", #_feature);                                  \
        } while (0)
 
@@ -750,10 +750,10 @@ static bool vq_is_tx(u16 idx)
 
 static u16 get_features_12_3(u64 features)
 {
-       return (!!(features & BIT(VIRTIO_NET_F_HOST_TSO4)) << 9) |
-              (!!(features & BIT(VIRTIO_NET_F_HOST_TSO6)) << 8) |
-              (!!(features & BIT(VIRTIO_NET_F_CSUM)) << 7) |
-              (!!(features & BIT(VIRTIO_NET_F_GUEST_CSUM)) << 6);
+       return (!!(features & BIT_ULL(VIRTIO_NET_F_HOST_TSO4)) << 9) |
+              (!!(features & BIT_ULL(VIRTIO_NET_F_HOST_TSO6)) << 8) |
+              (!!(features & BIT_ULL(VIRTIO_NET_F_CSUM)) << 7) |
+              (!!(features & BIT_ULL(VIRTIO_NET_F_GUEST_CSUM)) << 6);
 }
 
 static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq)
@@ -1439,13 +1439,13 @@ static u64 mlx_to_vritio_features(u16 dev_features)
        u64 result = 0;
 
        if (dev_features & MLX5_VIRTIO_NET_F_GUEST_CSUM)
-               result |= BIT(VIRTIO_NET_F_GUEST_CSUM);
+               result |= BIT_ULL(VIRTIO_NET_F_GUEST_CSUM);
        if (dev_features & MLX5_VIRTIO_NET_F_CSUM)
-               result |= BIT(VIRTIO_NET_F_CSUM);
+               result |= BIT_ULL(VIRTIO_NET_F_CSUM);
        if (dev_features & MLX5_VIRTIO_NET_F_HOST_TSO6)
-               result |= BIT(VIRTIO_NET_F_HOST_TSO6);
+               result |= BIT_ULL(VIRTIO_NET_F_HOST_TSO6);
        if (dev_features & MLX5_VIRTIO_NET_F_HOST_TSO4)
-               result |= BIT(VIRTIO_NET_F_HOST_TSO4);
+               result |= BIT_ULL(VIRTIO_NET_F_HOST_TSO4);
 
        return result;
 }
@@ -1459,15 +1459,15 @@ static u64 mlx5_vdpa_get_features(struct vdpa_device *vdev)
        dev_features = MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, device_features_bits_mask);
        ndev->mvdev.mlx_features = mlx_to_vritio_features(dev_features);
        if (MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, virtio_version_1_0))
-               ndev->mvdev.mlx_features |= BIT(VIRTIO_F_VERSION_1);
-       ndev->mvdev.mlx_features |= BIT(VIRTIO_F_ACCESS_PLATFORM);
+               ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_VERSION_1);
+       ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_ACCESS_PLATFORM);
        print_features(mvdev, ndev->mvdev.mlx_features, false);
        return ndev->mvdev.mlx_features;
 }
 
 static int verify_min_features(struct mlx5_vdpa_dev *mvdev, u64 features)
 {
-       if (!(features & BIT(VIRTIO_F_ACCESS_PLATFORM)))
+       if (!(features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM)))
                return -EOPNOTSUPP;
 
        return 0;
index 620465c2a1da4569c5ae503d820e8efc982aa26f..1ab1f5cda4ac27431f5a512c60598560e95137d1 100644 (file)
@@ -990,7 +990,7 @@ static long vfio_pci_ioctl(void *device_data,
                case VFIO_PCI_ERR_IRQ_INDEX:
                        if (pci_is_pcie(vdev->pdev))
                                break;
-               /* fall through */
+                       fallthrough;
                default:
                        return -EINVAL;
                }
index c992973cc2d5fa864ab3f38bf544b61418c84a53..5fbf0c1f7433808b4414d91331c1c3f561d0b3ff 100644 (file)
@@ -2439,7 +2439,7 @@ static void *vfio_iommu_type1_open(unsigned long arg)
                break;
        case VFIO_TYPE1_NESTING_IOMMU:
                iommu->nesting = true;
-               /* fall through */
+               fallthrough;
        case VFIO_TYPE1v2_IOMMU:
                iommu->v2 = true;
                break;
index 1f0ca6e44410ac2ec8c47826b7f90eb8ea56694d..0fd3f87e913c7f70e8d670729632f2bff33779cc 100644 (file)
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(vhost_iotlb_free);
  * vhost_iotlb_itree_first - return the first overlapped range
  * @iotlb: the IOTLB
  * @start: start of IOVA range
- * @end: end of IOVA range
+ * @last: last byte in IOVA range
  */
 struct vhost_iotlb_map *
 vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last)
@@ -159,10 +159,10 @@ vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last)
 EXPORT_SYMBOL_GPL(vhost_iotlb_itree_first);
 
 /**
- * vhost_iotlb_itree_first - return the next overlapped range
- * @iotlb: the IOTLB
+ * vhost_iotlb_itree_next - return the next overlapped range
+ * @map: the starting map node
  * @start: start of IOVA range
- * @end: end of IOVA range
+ * @last: last byte IOVA range
  */
 struct vhost_iotlb_map *
 vhost_iotlb_itree_next(struct vhost_iotlb_map *map, u64 start, u64 last)
index 3fab94f8889443ceb67262cd8ef53ad5de4239ac..796fe979f997f0ad65cf43567118e05798a8bcc5 100644 (file)
@@ -353,8 +353,6 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
        struct vdpa_callback cb;
        struct vhost_virtqueue *vq;
        struct vhost_vring_state s;
-       u64 __user *featurep = argp;
-       u64 features;
        u32 idx;
        long r;
 
@@ -381,18 +379,6 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
 
                vq->last_avail_idx = vq_state.avail_index;
                break;
-       case VHOST_GET_BACKEND_FEATURES:
-               features = VHOST_VDPA_BACKEND_FEATURES;
-               if (copy_to_user(featurep, &features, sizeof(features)))
-                       return -EFAULT;
-               return 0;
-       case VHOST_SET_BACKEND_FEATURES:
-               if (copy_from_user(&features, featurep, sizeof(features)))
-                       return -EFAULT;
-               if (features & ~VHOST_VDPA_BACKEND_FEATURES)
-                       return -EOPNOTSUPP;
-               vhost_set_backend_features(&v->vdev, features);
-               return 0;
        }
 
        r = vhost_vring_ioctl(&v->vdev, cmd, argp);
@@ -440,8 +426,20 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
        struct vhost_vdpa *v = filep->private_data;
        struct vhost_dev *d = &v->vdev;
        void __user *argp = (void __user *)arg;
+       u64 __user *featurep = argp;
+       u64 features;
        long r;
 
+       if (cmd == VHOST_SET_BACKEND_FEATURES) {
+               r = copy_from_user(&features, featurep, sizeof(features));
+               if (r)
+                       return r;
+               if (features & ~VHOST_VDPA_BACKEND_FEATURES)
+                       return -EOPNOTSUPP;
+               vhost_set_backend_features(&v->vdev, features);
+               return 0;
+       }
+
        mutex_lock(&d->mutex);
 
        switch (cmd) {
@@ -476,6 +474,10 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
        case VHOST_VDPA_SET_CONFIG_CALL:
                r = vhost_vdpa_set_config_call(v, argp);
                break;
+       case VHOST_GET_BACKEND_FEATURES:
+               features = VHOST_VDPA_BACKEND_FEATURES;
+               r = copy_to_user(featurep, &features, sizeof(features));
+               break;
        default:
                r = vhost_dev_ioctl(&v->vdev, cmd, argp);
                if (r == -ENOIOCTLCMD)
index 5857d4eec9d73f69c5a934e9cff635123773acfd..b45519ca66a7e9a0d0ff5fe9ead216db6297fded 100644 (file)
@@ -2537,7 +2537,7 @@ void vhost_disable_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq)
        if (!vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX)) {
                r = vhost_update_used_flags(vq);
                if (r)
-                       vq_err(vq, "Failed to enable notification at %p: %d\n",
+                       vq_err(vq, "Failed to disable notification at %p: %d\n",
                               &vq->used->flags, r);
        }
 }
index ddc7f5f0401fdc59fb7d7ac9df280641d710b035..8ec19425671fb9d7ae941030e86b6ea3d036df53 100644 (file)
@@ -681,7 +681,7 @@ static int adp8860_probe(struct i2c_client *client,
        switch (ADP8860_MANID(reg_val)) {
        case ADP8863_MANUFID:
                data->gdwn_dis = !!pdata->gdwn_dis;
-               /* fall through */
+               fallthrough;
        case ADP8860_MANUFID:
                data->en_ambl_sens = !!pdata->en_ambl_sens;
                break;
index 5e850cc9f891d0feb85e94a39ffec4217bb08c18..39deb22a4180734bbfe4eb2ae850f29c58618fb9 100644 (file)
@@ -22,52 +22,6 @@ config VGA_CONSOLE
 
          Say Y.
 
-config VGACON_SOFT_SCROLLBACK
-       bool "Enable Scrollback Buffer in System RAM"
-       depends on VGA_CONSOLE
-       default n
-       help
-        The scrollback buffer of the standard VGA console is located in
-        the VGA RAM.  The size of this RAM is fixed and is quite small.
-        If you require a larger scrollback buffer, this can be placed in
-        System RAM which is dynamically allocated during initialization.
-        Placing the scrollback buffer in System RAM will slightly slow
-        down the console.
-
-        If you want this feature, say 'Y' here and enter the amount of
-        RAM to allocate for this buffer.  If unsure, say 'N'.
-
-config VGACON_SOFT_SCROLLBACK_SIZE
-       int "Scrollback Buffer Size (in KB)"
-       depends on VGACON_SOFT_SCROLLBACK
-       range 1 1024
-       default "64"
-       help
-         Enter the amount of System RAM to allocate for scrollback
-         buffers of VGA consoles. Each 64KB will give you approximately
-         16 80x25 screenfuls of scrollback buffer.
-
-config VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT
-       bool "Persistent Scrollback History for each console by default"
-       depends on VGACON_SOFT_SCROLLBACK
-       default n
-       help
-         Say Y here if the scrollback history should persist by default when
-         switching between consoles. Otherwise, the scrollback history will be
-         flushed each time the console is switched. This feature can also be
-         enabled using the boot command line parameter
-         'vgacon.scrollback_persistent=1'.
-
-         This feature might break your tool of choice to flush the scrollback
-         buffer, e.g. clear(1) will work fine but Debian's clear_console(1)
-         will be broken, which might cause security issues.
-         You can use the escape sequence \e[3J instead if this feature is
-         activated.
-
-         Note that a buffer of VGACON_SOFT_SCROLLBACK_SIZE is taken for each
-         created tty device.
-         So if you use a RAM-constrained system, say N here.
-
 config MDA_CONSOLE
        depends on !M68K && !PARISC && ISA
        tristate "MDA text console (dual-headed)"
index a52bb374007342370e003f3e624ff789c5863a6b..17876f0179b5770dacf09d243cf7ad18192a9e08 100644 (file)
@@ -165,214 +165,6 @@ static inline void vga_set_mem_top(struct vc_data *c)
        write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2);
 }
 
-#ifdef CONFIG_VGACON_SOFT_SCROLLBACK
-/* software scrollback */
-struct vgacon_scrollback_info {
-       void *data;
-       int tail;
-       int size;
-       int rows;
-       int cnt;
-       int cur;
-       int save;
-       int restore;
-};
-
-static struct vgacon_scrollback_info *vgacon_scrollback_cur;
-static struct vgacon_scrollback_info vgacon_scrollbacks[MAX_NR_CONSOLES];
-static bool scrollback_persistent = \
-       IS_ENABLED(CONFIG_VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT);
-module_param_named(scrollback_persistent, scrollback_persistent, bool, 0000);
-MODULE_PARM_DESC(scrollback_persistent, "Enable persistent scrollback for all vga consoles");
-
-static void vgacon_scrollback_reset(int vc_num, size_t reset_size)
-{
-       struct vgacon_scrollback_info *scrollback = &vgacon_scrollbacks[vc_num];
-
-       if (scrollback->data && reset_size > 0)
-               memset(scrollback->data, 0, reset_size);
-
-       scrollback->cnt  = 0;
-       scrollback->tail = 0;
-       scrollback->cur  = 0;
-}
-
-static void vgacon_scrollback_init(int vc_num)
-{
-       int pitch = vga_video_num_columns * 2;
-       size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
-       int rows = size / pitch;
-       void *data;
-
-       data = kmalloc_array(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024,
-                            GFP_NOWAIT);
-
-       vgacon_scrollbacks[vc_num].data = data;
-       vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];
-
-       vgacon_scrollback_cur->rows = rows - 1;
-       vgacon_scrollback_cur->size = rows * pitch;
-
-       vgacon_scrollback_reset(vc_num, size);
-}
-
-static void vgacon_scrollback_switch(int vc_num)
-{
-       if (!scrollback_persistent)
-               vc_num = 0;
-
-       if (!vgacon_scrollbacks[vc_num].data) {
-               vgacon_scrollback_init(vc_num);
-       } else {
-               if (scrollback_persistent) {
-                       vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];
-               } else {
-                       size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
-
-                       vgacon_scrollback_reset(vc_num, size);
-               }
-       }
-}
-
-static void vgacon_scrollback_startup(void)
-{
-       vgacon_scrollback_cur = &vgacon_scrollbacks[0];
-       vgacon_scrollback_init(0);
-}
-
-static void vgacon_scrollback_update(struct vc_data *c, int t, int count)
-{
-       void *p;
-
-       if (!vgacon_scrollback_cur->data || !vgacon_scrollback_cur->size ||
-           c->vc_num != fg_console)
-               return;
-
-       p = (void *) (c->vc_origin + t * c->vc_size_row);
-
-       while (count--) {
-               if ((vgacon_scrollback_cur->tail + c->vc_size_row) >
-                   vgacon_scrollback_cur->size)
-                       vgacon_scrollback_cur->tail = 0;
-
-               scr_memcpyw(vgacon_scrollback_cur->data +
-                           vgacon_scrollback_cur->tail,
-                           p, c->vc_size_row);
-
-               vgacon_scrollback_cur->cnt++;
-               p += c->vc_size_row;
-               vgacon_scrollback_cur->tail += c->vc_size_row;
-
-               if (vgacon_scrollback_cur->tail >= vgacon_scrollback_cur->size)
-                       vgacon_scrollback_cur->tail = 0;
-
-               if (vgacon_scrollback_cur->cnt > vgacon_scrollback_cur->rows)
-                       vgacon_scrollback_cur->cnt = vgacon_scrollback_cur->rows;
-
-               vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;
-       }
-}
-
-static void vgacon_restore_screen(struct vc_data *c)
-{
-       c->vc_origin = c->vc_visible_origin;
-       vgacon_scrollback_cur->save = 0;
-
-       if (!vga_is_gfx && !vgacon_scrollback_cur->restore) {
-               scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
-                           c->vc_screenbuf_size > vga_vram_size ?
-                           vga_vram_size : c->vc_screenbuf_size);
-               vgacon_scrollback_cur->restore = 1;
-               vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;
-       }
-}
-
-static void vgacon_scrolldelta(struct vc_data *c, int lines)
-{
-       int start, end, count, soff;
-
-       if (!lines) {
-               vgacon_restore_screen(c);
-               return;
-       }
-
-       if (!vgacon_scrollback_cur->data)
-               return;
-
-       if (!vgacon_scrollback_cur->save) {
-               vgacon_cursor(c, CM_ERASE);
-               vgacon_save_screen(c);
-               c->vc_origin = (unsigned long)c->vc_screenbuf;
-               vgacon_scrollback_cur->save = 1;
-       }
-
-       vgacon_scrollback_cur->restore = 0;
-       start = vgacon_scrollback_cur->cur + lines;
-       end = start + abs(lines);
-
-       if (start < 0)
-               start = 0;
-
-       if (start > vgacon_scrollback_cur->cnt)
-               start = vgacon_scrollback_cur->cnt;
-
-       if (end < 0)
-               end = 0;
-
-       if (end > vgacon_scrollback_cur->cnt)
-               end = vgacon_scrollback_cur->cnt;
-
-       vgacon_scrollback_cur->cur = start;
-       count = end - start;
-       soff = vgacon_scrollback_cur->tail -
-               ((vgacon_scrollback_cur->cnt - end) * c->vc_size_row);
-       soff -= count * c->vc_size_row;
-
-       if (soff < 0)
-               soff += vgacon_scrollback_cur->size;
-
-       count = vgacon_scrollback_cur->cnt - start;
-
-       if (count > c->vc_rows)
-               count = c->vc_rows;
-
-       if (count) {
-               int copysize;
-
-               int diff = c->vc_rows - count;
-               void *d = (void *) c->vc_visible_origin;
-               void *s = (void *) c->vc_screenbuf;
-
-               count *= c->vc_size_row;
-               /* how much memory to end of buffer left? */
-               copysize = min(count, vgacon_scrollback_cur->size - soff);
-               scr_memcpyw(d, vgacon_scrollback_cur->data + soff, copysize);
-               d += copysize;
-               count -= copysize;
-
-               if (count) {
-                       scr_memcpyw(d, vgacon_scrollback_cur->data, count);
-                       d += count;
-               }
-
-               if (diff)
-                       scr_memcpyw(d, s, diff * c->vc_size_row);
-       } else
-               vgacon_cursor(c, CM_MOVE);
-}
-
-static void vgacon_flush_scrollback(struct vc_data *c)
-{
-       size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
-
-       vgacon_scrollback_reset(c->vc_num, size);
-}
-#else
-#define vgacon_scrollback_startup(...) do { } while (0)
-#define vgacon_scrollback_init(...)    do { } while (0)
-#define vgacon_scrollback_update(...)  do { } while (0)
-#define vgacon_scrollback_switch(...)  do { } while (0)
-
 static void vgacon_restore_screen(struct vc_data *c)
 {
        if (c->vc_origin != c->vc_visible_origin)
@@ -386,11 +178,6 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines)
        vga_set_mem_top(c);
 }
 
-static void vgacon_flush_scrollback(struct vc_data *c)
-{
-}
-#endif /* CONFIG_VGACON_SOFT_SCROLLBACK */
-
 static const char *vgacon_startup(void)
 {
        const char *display_desc = NULL;
@@ -573,10 +360,7 @@ static const char *vgacon_startup(void)
        vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH;
        vgacon_yres = vga_scan_lines;
 
-       if (!vga_init_done) {
-               vgacon_scrollback_startup();
-               vga_init_done = true;
-       }
+       vga_init_done = true;
 
        return display_desc;
 }
@@ -869,7 +653,6 @@ static int vgacon_switch(struct vc_data *c)
                        vgacon_doresize(c, c->vc_cols, c->vc_rows);
        }
 
-       vgacon_scrollback_switch(c->vc_num);
        return 0;               /* Redrawing not needed */
 }
 
@@ -1386,7 +1169,6 @@ static bool vgacon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
        oldo = c->vc_origin;
        delta = lines * c->vc_size_row;
        if (dir == SM_UP) {
-               vgacon_scrollback_update(c, t, lines);
                if (c->vc_scr_end + delta >= vga_vram_end) {
                        scr_memcpyw((u16 *) vga_vram_base,
                                    (u16 *) (oldo + delta),
@@ -1450,7 +1232,6 @@ const struct consw vga_con = {
        .con_save_screen = vgacon_save_screen,
        .con_build_attr = vgacon_build_attr,
        .con_invert_region = vgacon_invert_region,
-       .con_flush_scrollback = vgacon_flush_scrollback,
 };
 EXPORT_SYMBOL(vga_con);
 
index 09a9ad901dad8cb7ff1f580eaa80923c9396a51e..bcc92aecf66682838a04f9f8e41eaa96397296d3 100644 (file)
@@ -857,7 +857,7 @@ static void acornfb_parse_dram(char *opt)
                case 'M':
                case 'm':
                        size *= 1024;
-                       /* Fall through */
+                       fallthrough;
                case 'K':
                case 'k':
                        size *= 1024;
index 6f7838979f0a9463840d560512fab732bdd2cf22..ae3d8e8b8d3364acc227157ce9a185883e7bc2c0 100644 (file)
@@ -419,7 +419,7 @@ static int arcfb_ioctl(struct fb_info *info,
                        schedule();
                        finish_wait(&arcfb_waitq, &wait);
                }
-               /* fall through */
+                       fallthrough;
 
                case FBIO_GETCONTROL2:
                {
index 1e252192569a8be75d81ec7496f72a4ecde18cd2..bfd2f00b403b14b89677c5da39393d07cee92508 100644 (file)
@@ -508,7 +508,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
        case 32:
                var->transp.offset = 24;
                var->transp.length = 8;
-               /* fall through */
+               fallthrough;
        case 24:
                if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
                        /* RGB:888 mode */
@@ -633,7 +633,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
                case 2: value |= ATMEL_LCDC_PIXELSIZE_2; break;
                case 4: value |= ATMEL_LCDC_PIXELSIZE_4; break;
                case 8: value |= ATMEL_LCDC_PIXELSIZE_8; break;
-               case 15: /* fall through */
+               case 15:
                case 16: value |= ATMEL_LCDC_PIXELSIZE_16; break;
                case 24: value |= ATMEL_LCDC_PIXELSIZE_24; break;
                case 32: value |= ATMEL_LCDC_PIXELSIZE_32; break;
index 7c4483c7f313a06b5a7401f76c553b611110bb7b..f3d8123d7f363930586acc93039e87a9293ca3f3 100644 (file)
@@ -1208,11 +1208,11 @@ static void radeon_pm_enable_dll_m10(struct radeonfb_info *rinfo)
        case 1:
                if (mc & 0x4)
                        break;
-               /* fall through */
+               fallthrough;
        case 2:
                dll_sleep_mask |= MDLL_R300_RDCK__MRDCKB_SLEEP;
                dll_reset_mask |= MDLL_R300_RDCK__MRDCKB_RESET;
-               /* fall through */
+               fallthrough;
        case 0:
                dll_sleep_mask |= MDLL_R300_RDCK__MRDCKA_SLEEP;
                dll_reset_mask |= MDLL_R300_RDCK__MRDCKA_RESET;
@@ -1221,7 +1221,7 @@ static void radeon_pm_enable_dll_m10(struct radeonfb_info *rinfo)
        case 1:
                if (!(mc & 0x4))
                        break;
-               /* fall through */
+               fallthrough;
        case 2:
                dll_sleep_mask |= MDLL_R300_RDCK__MRDCKD_SLEEP;
                dll_reset_mask |= MDLL_R300_RDCK__MRDCKD_RESET;
index 3df64a9731945cbb508e480206e4d5da9c08655d..15a9ee7cd734d3fa1147a9cacbe65cb06bf5b3e4 100644 (file)
@@ -1476,11 +1476,11 @@ static void init_vgachip(struct fb_info *info)
                mdelay(100);
                /* mode */
                vga_wgfx(cinfo->regbase, CL_GR31, 0x00);
-               /* fall through */
+               fallthrough;
        case BT_GD5480:
                /* from Klaus' NetBSD driver: */
                vga_wgfx(cinfo->regbase, CL_GR2F, 0x00);
-               /* fall through */
+               fallthrough;
        case BT_ALPINE:
                /* put blitter into 542x compat */
                vga_wgfx(cinfo->regbase, CL_GR33, 0x00);
index 9c4f1be856eca46aefa7eec184167b858d456633..2df56bd303d25d125c6a7813ed0bf2787abc1ec9 100644 (file)
@@ -49,6 +49,8 @@
 #include <linux/cuda.h>
 #ifdef CONFIG_PPC_PMAC
 #include <asm/prom.h>
+#endif
+#ifdef CONFIG_BOOTX_TEXT
 #include <asm/btext.h>
 #endif
 
@@ -713,7 +715,7 @@ static int controlfb_blank(int blank_mode, struct fb_info *info)
                        break;
                case FB_BLANK_POWERDOWN:
                        ctrl &= ~0x33;
-                       /* fall through */
+                       fallthrough;
                case FB_BLANK_NORMAL:
                        ctrl |= 0x400;
                        break;
index 4e6cbc24346d308a4042ea0b970fc8be5bdf5656..9725ecd1255ba00503c79c55639b94308e0e0ec2 100644 (file)
@@ -234,7 +234,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
 }
 
 static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
-                      int softback_lines, int fg, int bg)
+                      int fg, int bg)
 {
        struct fb_cursor cursor;
        struct fbcon_ops *ops = info->fbcon_par;
@@ -247,15 +247,6 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 
        cursor.set = 0;
 
-       if (softback_lines) {
-               if (y + softback_lines >= vc->vc_rows) {
-                       mode = CM_ERASE;
-                       ops->cursor_flash = 0;
-                       return;
-               } else
-                       y += softback_lines;
-       }
-
        c = scr_readw((u16 *) vc->vc_pos);
        attribute = get_attribute(info, c);
        src = vc->vc_font.data + ((c & charmask) * (w * vc->vc_font.height));
index 8a31fc2b2258a79c969d1913a7b629daa6983fc7..41f3fa3db6d4ca8c6e156a1bf0f046f69b29ac75 100644 (file)
@@ -122,12 +122,6 @@ static int logo_lines;
 /* logo_shown is an index to vc_cons when >= 0; otherwise follows FBCON_LOGO
    enums.  */
 static int logo_shown = FBCON_LOGO_CANSHOW;
-/* Software scrollback */
-static int fbcon_softback_size = 32768;
-static unsigned long softback_buf, softback_curr;
-static unsigned long softback_in;
-static unsigned long softback_top, softback_end;
-static int softback_lines;
 /* console mappings */
 static int first_fb_vc;
 static int last_fb_vc = MAX_NR_CONSOLES - 1;
@@ -167,8 +161,6 @@ static int margin_color;
 
 static const struct consw fb_con;
 
-#define CM_SOFTBACK    (8)
-
 #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
 
 static int fbcon_set_origin(struct vc_data *);
@@ -373,18 +365,6 @@ static int get_color(struct vc_data *vc, struct fb_info *info,
        return color;
 }
 
-static void fbcon_update_softback(struct vc_data *vc)
-{
-       int l = fbcon_softback_size / vc->vc_size_row;
-
-       if (l > 5)
-               softback_end = softback_buf + l * vc->vc_size_row;
-       else
-               /* Smaller scrollback makes no sense, and 0 would screw
-                  the operation totally */
-               softback_top = 0;
-}
-
 static void fb_flashcursor(struct work_struct *work)
 {
        struct fb_info *info = container_of(work, struct fb_info, queue);
@@ -414,7 +394,7 @@ static void fb_flashcursor(struct work_struct *work)
        c = scr_readw((u16 *) vc->vc_pos);
        mode = (!ops->cursor_flash || ops->cursor_state.enable) ?
                CM_ERASE : CM_DRAW;
-       ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
+       ops->cursor(vc, info, mode, get_color(vc, info, c, 1),
                    get_color(vc, info, c, 0));
        console_unlock();
 }
@@ -471,13 +451,7 @@ static int __init fb_console_setup(char *this_opt)
                }
                
                if (!strncmp(options, "scrollback:", 11)) {
-                       options += 11;
-                       if (*options) {
-                               fbcon_softback_size = simple_strtoul(options, &options, 0);
-                               if (*options == 'k' || *options == 'K') {
-                                       fbcon_softback_size *= 1024;
-                               }
-                       }
+                       pr_warn("Ignoring scrollback size option\n");
                        continue;
                }
                
@@ -1022,31 +996,6 @@ static const char *fbcon_startup(void)
 
        set_blitting_type(vc, info);
 
-       if (info->fix.type != FB_TYPE_TEXT) {
-               if (fbcon_softback_size) {
-                       if (!softback_buf) {
-                               softback_buf =
-                                   (unsigned long)
-                                   kvmalloc(fbcon_softback_size,
-                                           GFP_KERNEL);
-                               if (!softback_buf) {
-                                       fbcon_softback_size = 0;
-                                       softback_top = 0;
-                               }
-                       }
-               } else {
-                       if (softback_buf) {
-                               kvfree((void *) softback_buf);
-                               softback_buf = 0;
-                               softback_top = 0;
-                       }
-               }
-               if (softback_buf)
-                       softback_in = softback_top = softback_curr =
-                           softback_buf;
-               softback_lines = 0;
-       }
-
        /* Setup default font */
        if (!p->fontdata && !vc->vc_font.data) {
                if (!fontname[0] || !(font = find_font(fontname)))
@@ -1220,9 +1169,6 @@ static void fbcon_init(struct vc_data *vc, int init)
        if (logo)
                fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows);
 
-       if (vc == svc && softback_buf)
-               fbcon_update_softback(vc);
-
        if (ops->rotate_font && ops->rotate_font(info, vc)) {
                ops->rotate = FB_ROTATE_UR;
                set_blitting_type(vc, info);
@@ -1385,7 +1331,6 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
 {
        struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
        struct fbcon_ops *ops = info->fbcon_par;
-       int y;
        int c = scr_readw((u16 *) vc->vc_pos);
 
        ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
@@ -1399,16 +1344,8 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
                fbcon_add_cursor_timer(info);
 
        ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1;
-       if (mode & CM_SOFTBACK) {
-               mode &= ~CM_SOFTBACK;
-               y = softback_lines;
-       } else {
-               if (softback_lines)
-                       fbcon_set_origin(vc);
-               y = 0;
-       }
 
-       ops->cursor(vc, info, mode, y, get_color(vc, info, c, 1),
+       ops->cursor(vc, info, mode, get_color(vc, info, c, 1),
                    get_color(vc, info, c, 0));
 }
 
@@ -1479,8 +1416,6 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
 
        if (con_is_visible(vc)) {
                update_screen(vc);
-               if (softback_buf)
-                       fbcon_update_softback(vc);
        }
 }
 
@@ -1618,99 +1553,6 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count)
        scrollback_current = 0;
 }
 
-static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p,
-                                 long delta)
-{
-       int count = vc->vc_rows;
-       unsigned short *d, *s;
-       unsigned long n;
-       int line = 0;
-
-       d = (u16 *) softback_curr;
-       if (d == (u16 *) softback_in)
-               d = (u16 *) vc->vc_origin;
-       n = softback_curr + delta * vc->vc_size_row;
-       softback_lines -= delta;
-       if (delta < 0) {
-               if (softback_curr < softback_top && n < softback_buf) {
-                       n += softback_end - softback_buf;
-                       if (n < softback_top) {
-                               softback_lines -=
-                                   (softback_top - n) / vc->vc_size_row;
-                               n = softback_top;
-                       }
-               } else if (softback_curr >= softback_top
-                          && n < softback_top) {
-                       softback_lines -=
-                           (softback_top - n) / vc->vc_size_row;
-                       n = softback_top;
-               }
-       } else {
-               if (softback_curr > softback_in && n >= softback_end) {
-                       n += softback_buf - softback_end;
-                       if (n > softback_in) {
-                               n = softback_in;
-                               softback_lines = 0;
-                       }
-               } else if (softback_curr <= softback_in && n > softback_in) {
-                       n = softback_in;
-                       softback_lines = 0;
-               }
-       }
-       if (n == softback_curr)
-               return;
-       softback_curr = n;
-       s = (u16 *) softback_curr;
-       if (s == (u16 *) softback_in)
-               s = (u16 *) vc->vc_origin;
-       while (count--) {
-               unsigned short *start;
-               unsigned short *le;
-               unsigned short c;
-               int x = 0;
-               unsigned short attr = 1;
-
-               start = s;
-               le = advance_row(s, 1);
-               do {
-                       c = scr_readw(s);
-                       if (attr != (c & 0xff00)) {
-                               attr = c & 0xff00;
-                               if (s > start) {
-                                       fbcon_putcs(vc, start, s - start,
-                                                   line, x);
-                                       x += s - start;
-                                       start = s;
-                               }
-                       }
-                       if (c == scr_readw(d)) {
-                               if (s > start) {
-                                       fbcon_putcs(vc, start, s - start,
-                                                   line, x);
-                                       x += s - start + 1;
-                                       start = s + 1;
-                               } else {
-                                       x++;
-                                       start++;
-                               }
-                       }
-                       s++;
-                       d++;
-               } while (s < le);
-               if (s > start)
-                       fbcon_putcs(vc, start, s - start, line, x);
-               line++;
-               if (d == (u16 *) softback_end)
-                       d = (u16 *) softback_buf;
-               if (d == (u16 *) softback_in)
-                       d = (u16 *) vc->vc_origin;
-               if (s == (u16 *) softback_end)
-                       s = (u16 *) softback_buf;
-               if (s == (u16 *) softback_in)
-                       s = (u16 *) vc->vc_origin;
-       }
-}
-
 static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
                              int line, int count, int dy)
 {
@@ -1850,31 +1692,6 @@ static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,
        }
 }
 
-static inline void fbcon_softback_note(struct vc_data *vc, int t,
-                                      int count)
-{
-       unsigned short *p;
-
-       if (vc->vc_num != fg_console)
-               return;
-       p = (unsigned short *) (vc->vc_origin + t * vc->vc_size_row);
-
-       while (count) {
-               scr_memcpyw((u16 *) softback_in, p, vc->vc_size_row);
-               count--;
-               p = advance_row(p, 1);
-               softback_in += vc->vc_size_row;
-               if (softback_in == softback_end)
-                       softback_in = softback_buf;
-               if (softback_in == softback_top) {
-                       softback_top += vc->vc_size_row;
-                       if (softback_top == softback_end)
-                               softback_top = softback_buf;
-               }
-       }
-       softback_curr = softback_in;
-}
-
 static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
                enum con_scroll dir, unsigned int count)
 {
@@ -1897,8 +1714,6 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
        case SM_UP:
                if (count > vc->vc_rows)        /* Maximum realistic size */
                        count = vc->vc_rows;
-               if (softback_top)
-                       fbcon_softback_note(vc, t, count);
                if (logo_shown >= 0)
                        goto redraw_up;
                switch (p->scrollmode) {
@@ -2191,6 +2006,9 @@ static void updatescrollmode(struct fbcon_display *p,
        }
 }
 
+#define PITCH(w) (((w) + 7) >> 3)
+#define CALC_FONTSZ(h, p, c) ((h) * (p) * (c)) /* size = height * pitch * charcount */
+
 static int fbcon_resize(struct vc_data *vc, unsigned int width, 
                        unsigned int height, unsigned int user)
 {
@@ -2200,6 +2018,24 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
        struct fb_var_screeninfo var = info->var;
        int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh;
 
+       if (p->userfont && FNTSIZE(vc->vc_font.data)) {
+               int size;
+               int pitch = PITCH(vc->vc_font.width);
+
+               /*
+                * If user font, ensure that a possible change to user font
+                * height or width will not allow a font data out-of-bounds access.
+                * NOTE: must use original charcount in calculation as font
+                * charcount can change and cannot be used to determine the
+                * font data allocated size.
+                */
+               if (pitch <= 0)
+                       return -EINVAL;
+               size = CALC_FONTSZ(vc->vc_font.height, pitch, FNTCHARCNT(vc->vc_font.data));
+               if (size > FNTSIZE(vc->vc_font.data))
+                       return -EINVAL;
+       }
+
        virt_w = FBCON_SWAP(ops->rotate, width, height);
        virt_h = FBCON_SWAP(ops->rotate, height, width);
        virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width,
@@ -2248,14 +2084,6 @@ static int fbcon_switch(struct vc_data *vc)
        info = registered_fb[con2fb_map[vc->vc_num]];
        ops = info->fbcon_par;
 
-       if (softback_top) {
-               if (softback_lines)
-                       fbcon_set_origin(vc);
-               softback_top = softback_curr = softback_in = softback_buf;
-               softback_lines = 0;
-               fbcon_update_softback(vc);
-       }
-
        if (logo_shown >= 0) {
                struct vc_data *conp2 = vc_cons[logo_shown].d;
 
@@ -2579,9 +2407,6 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
        int cnt;
        char *old_data = NULL;
 
-       if (con_is_visible(vc) && softback_lines)
-               fbcon_set_origin(vc);
-
        resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
        if (p->userfont)
                old_data = vc->vc_font.data;
@@ -2607,8 +2432,6 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
                cols /= w;
                rows /= h;
                vc_resize(vc, cols, rows);
-               if (con_is_visible(vc) && softback_buf)
-                       fbcon_update_softback(vc);
        } else if (con_is_visible(vc)
                   && vc->vc_mode == KD_TEXT) {
                fbcon_clear_margins(vc, 0);
@@ -2652,7 +2475,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
        int size;
        int i, csum;
        u8 *new_data, *data = font->data;
-       int pitch = (font->width+7) >> 3;
+       int pitch = PITCH(font->width);
 
        /* Is there a reason why fbconsole couldn't handle any charcount >256?
         * If not this check should be changed to charcount < 256 */
@@ -2668,7 +2491,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
        if (fbcon_invalid_charcount(info, charcount))
                return -EINVAL;
 
-       size = h * pitch * charcount;
+       size = CALC_FONTSZ(h, pitch, charcount);
 
        new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER);
 
@@ -2767,19 +2590,7 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table)
 
 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
 {
-       unsigned long p;
-       int line;
-       
-       if (vc->vc_num != fg_console || !softback_lines)
-               return (u16 *) (vc->vc_origin + offset);
-       line = offset / vc->vc_size_row;
-       if (line >= softback_lines)
-               return (u16 *) (vc->vc_origin + offset -
-                               softback_lines * vc->vc_size_row);
-       p = softback_curr + offset;
-       if (p >= softback_end)
-               p += softback_buf - softback_end;
-       return (u16 *) p;
+       return (u16 *) (vc->vc_origin + offset);
 }
 
 static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos,
@@ -2793,22 +2604,7 @@ static unsigned long fbcon_getxy(struct vc_data *vc, unsigned long pos,
 
                x = offset % vc->vc_cols;
                y = offset / vc->vc_cols;
-               if (vc->vc_num == fg_console)
-                       y += softback_lines;
                ret = pos + (vc->vc_cols - x) * 2;
-       } else if (vc->vc_num == fg_console && softback_lines) {
-               unsigned long offset = pos - softback_curr;
-
-               if (pos < softback_curr)
-                       offset += softback_end - softback_buf;
-               offset /= 2;
-               x = offset % vc->vc_cols;
-               y = offset / vc->vc_cols;
-               ret = pos + (vc->vc_cols - x) * 2;
-               if (ret == softback_end)
-                       ret = softback_buf;
-               if (ret == softback_in)
-                       ret = vc->vc_origin;
        } else {
                /* Should not happen */
                x = y = 0;
@@ -2836,106 +2632,11 @@ static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt)
                        a = ((a) & 0x88ff) | (((a) & 0x7000) >> 4) |
                            (((a) & 0x0700) << 4);
                scr_writew(a, p++);
-               if (p == (u16 *) softback_end)
-                       p = (u16 *) softback_buf;
-               if (p == (u16 *) softback_in)
-                       p = (u16 *) vc->vc_origin;
-       }
-}
-
-static void fbcon_scrolldelta(struct vc_data *vc, int lines)
-{
-       struct fb_info *info = registered_fb[con2fb_map[fg_console]];
-       struct fbcon_ops *ops = info->fbcon_par;
-       struct fbcon_display *disp = &fb_display[fg_console];
-       int offset, limit, scrollback_old;
-
-       if (softback_top) {
-               if (vc->vc_num != fg_console)
-                       return;
-               if (vc->vc_mode != KD_TEXT || !lines)
-                       return;
-               if (logo_shown >= 0) {
-                       struct vc_data *conp2 = vc_cons[logo_shown].d;
-
-                       if (conp2->vc_top == logo_lines
-                           && conp2->vc_bottom == conp2->vc_rows)
-                               conp2->vc_top = 0;
-                       if (logo_shown == vc->vc_num) {
-                               unsigned long p, q;
-                               int i;
-
-                               p = softback_in;
-                               q = vc->vc_origin +
-                                   logo_lines * vc->vc_size_row;
-                               for (i = 0; i < logo_lines; i++) {
-                                       if (p == softback_top)
-                                               break;
-                                       if (p == softback_buf)
-                                               p = softback_end;
-                                       p -= vc->vc_size_row;
-                                       q -= vc->vc_size_row;
-                                       scr_memcpyw((u16 *) q, (u16 *) p,
-                                                   vc->vc_size_row);
-                               }
-                               softback_in = softback_curr = p;
-                               update_region(vc, vc->vc_origin,
-                                             logo_lines * vc->vc_cols);
-                       }
-                       logo_shown = FBCON_LOGO_CANSHOW;
-               }
-               fbcon_cursor(vc, CM_ERASE | CM_SOFTBACK);
-               fbcon_redraw_softback(vc, disp, lines);
-               fbcon_cursor(vc, CM_DRAW | CM_SOFTBACK);
-               return;
        }
-
-       if (!scrollback_phys_max)
-               return;
-
-       scrollback_old = scrollback_current;
-       scrollback_current -= lines;
-       if (scrollback_current < 0)
-               scrollback_current = 0;
-       else if (scrollback_current > scrollback_max)
-               scrollback_current = scrollback_max;
-       if (scrollback_current == scrollback_old)
-               return;
-
-       if (fbcon_is_inactive(vc, info))
-               return;
-
-       fbcon_cursor(vc, CM_ERASE);
-
-       offset = disp->yscroll - scrollback_current;
-       limit = disp->vrows;
-       switch (disp->scrollmode) {
-       case SCROLL_WRAP_MOVE:
-               info->var.vmode |= FB_VMODE_YWRAP;
-               break;
-       case SCROLL_PAN_MOVE:
-       case SCROLL_PAN_REDRAW:
-               limit -= vc->vc_rows;
-               info->var.vmode &= ~FB_VMODE_YWRAP;
-               break;
-       }
-       if (offset < 0)
-               offset += limit;
-       else if (offset >= limit)
-               offset -= limit;
-
-       ops->var.xoffset = 0;
-       ops->var.yoffset = offset * vc->vc_font.height;
-       ops->update_start(info);
-
-       if (!scrollback_current)
-               fbcon_cursor(vc, CM_DRAW);
 }
 
 static int fbcon_set_origin(struct vc_data *vc)
 {
-       if (softback_lines)
-               fbcon_scrolldelta(vc, softback_lines);
        return 0;
 }
 
@@ -2999,8 +2700,6 @@ static void fbcon_modechanged(struct fb_info *info)
 
                fbcon_set_palette(vc, color_table);
                update_screen(vc);
-               if (softback_buf)
-                       fbcon_update_softback(vc);
        }
 }
 
@@ -3411,7 +3110,6 @@ static const struct consw fb_con = {
        .con_font_default       = fbcon_set_def_font,
        .con_font_copy          = fbcon_copy_font,
        .con_set_palette        = fbcon_set_palette,
-       .con_scrolldelta        = fbcon_scrolldelta,
        .con_set_origin         = fbcon_set_origin,
        .con_invert_region      = fbcon_invert_region,
        .con_screen_pos         = fbcon_screen_pos,
@@ -3646,9 +3344,6 @@ static void fbcon_exit(void)
        }
 #endif
 
-       kvfree((void *)softback_buf);
-       softback_buf = 0UL;
-
        for_each_registered_fb(i) {
                int pending = 0;
 
index 20dea853765f5473b0599cef57964a4f09a7ae69..78bb14c03643ee96fbdf05c0670f502888005cb8 100644 (file)
@@ -62,7 +62,7 @@ struct fbcon_ops {
        void (*clear_margins)(struct vc_data *vc, struct fb_info *info,
                              int color, int bottom_only);
        void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode,
-                      int softback_lines, int fg, int bg);
+                      int fg, int bg);
        int  (*update_start)(struct fb_info *info);
        int  (*rotate_font)(struct fb_info *info, struct vc_data *vc);
        struct fb_var_screeninfo var;  /* copy of the current fb_var_screeninfo */
index 5b177131e062d110de9ee4eb64790764e9fe5a92..bbd869efd03bc94ae9387d4355eee28a280fb9c2 100644 (file)
@@ -219,7 +219,7 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info,
 }
 
 static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
-                      int softback_lines, int fg, int bg)
+                      int fg, int bg)
 {
        struct fb_cursor cursor;
        struct fbcon_ops *ops = info->fbcon_par;
@@ -236,15 +236,6 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 
        cursor.set = 0;
 
-       if (softback_lines) {
-               if (y + softback_lines >= vc->vc_rows) {
-                       mode = CM_ERASE;
-                       ops->cursor_flash = 0;
-                       return;
-               } else
-                       y += softback_lines;
-       }
-
        c = scr_readw((u16 *) vc->vc_pos);
        attribute = get_attribute(info, c);
        src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.width));
index 894d01a62f30d71f4056412035b0d8f76f2cb7d7..a34cbe8e98744b12ffee9e45fa834f2d7aab8a4f 100644 (file)
@@ -202,7 +202,7 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info,
 }
 
 static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
-                     int softback_lines, int fg, int bg)
+                     int fg, int bg)
 {
        struct fb_cursor cursor;
        struct fbcon_ops *ops = info->fbcon_par;
@@ -219,15 +219,6 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 
        cursor.set = 0;
 
-       if (softback_lines) {
-               if (y + softback_lines >= vc->vc_rows) {
-                       mode = CM_ERASE;
-                       ops->cursor_flash = 0;
-                       return;
-               } else
-                       y += softback_lines;
-       }
-
        c = scr_readw((u16 *) vc->vc_pos);
        attribute = get_attribute(info, c);
        src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.width));
index 01b87f278d796aa9678651c0afc3a0f196adc2d9..199cbc7abe35315d5adb9c79aaa29ca20eedcd32 100644 (file)
@@ -249,7 +249,7 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info,
 }
 
 static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
-                     int softback_lines, int fg, int bg)
+                     int fg, int bg)
 {
        struct fb_cursor cursor;
        struct fbcon_ops *ops = info->fbcon_par;
@@ -267,15 +267,6 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode,
 
        cursor.set = 0;
 
-       if (softback_lines) {
-               if (y + softback_lines >= vc->vc_rows) {
-                       mode = CM_ERASE;
-                       ops->cursor_flash = 0;
-                       return;
-               } else
-                       y += softback_lines;
-       }
-
        c = scr_readw((u16 *) vc->vc_pos);
        attribute = get_attribute(info, c);
        src = ops->fontbuffer + ((c & charmask) * (w * vc->vc_font.height));
index da7c88ffaa6a8ae11f21524f28aa3026a5b53c85..6815bfb7f5724aec3ba2c9f6c490193090771c1b 100644 (file)
@@ -1306,7 +1306,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd,
        case FBIOGET_CON2FBMAP:
        case FBIOPUT_CON2FBMAP:
                arg = (unsigned long) compat_ptr(arg);
-               /* fall through */
+               fallthrough;
        case FBIOBLANK:
                ret = do_fb_ioctl(info, cmd, arg);
                break;
index 1dfaff0881fb9ded3138c01ee9a808c7035e5295..31b85b71cc377699829de6c1ed99841e74942576 100644 (file)
@@ -80,7 +80,7 @@ static void tile_clear_margins(struct vc_data *vc, struct fb_info *info,
 }
 
 static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode,
-                       int softback_lines, int fg, int bg)
+                       int fg, int bg)
 {
        struct fb_tilecursor cursor;
        int use_sw = vc->vc_cursor_type & CUR_SW;
index 67ebfe5c9f1d8307c105f95b1bd8575c4c6a4d78..a547c21c7e9280b238033634e42094c7f0a47d6c 100644 (file)
@@ -1287,7 +1287,7 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,
                dev_warn(info->dev,
                         "MFB_SET_PIXFMT value of 0x%08x is deprecated.\n",
                         MFB_SET_PIXFMT_OLD);
-               /* fall through */
+               fallthrough;
        case MFB_SET_PIXFMT:
                if (copy_from_user(&pix_fmt, buf, sizeof(pix_fmt)))
                        return -EFAULT;
@@ -1297,7 +1297,7 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,
                dev_warn(info->dev,
                         "MFB_GET_PIXFMT value of 0x%08x is deprecated.\n",
                         MFB_GET_PIXFMT_OLD);
-               /* fall through */
+               fallthrough;
        case MFB_GET_PIXFMT:
                pix_fmt = ad->pix_fmt;
                if (copy_to_user(buf, &pix_fmt, sizeof(pix_fmt)))
index 13ded3a10708457aa912e87f0ec25c3031f68b03..e5475ae1e1587ef5cf7dbd2d504c4cd21e02a6f4 100644 (file)
@@ -534,7 +534,7 @@ static int gxt4500_setcolreg(unsigned int reg, unsigned int red,
                        break;
                case DFA_PIX_32BIT:
                        val |= (reg << 24);
-                       /* fall through */
+                       fallthrough;
                case DFA_PIX_24BIT:
                        val |= (reg << 16) | (reg << 8);
                        break;
index e4c3c8b65da44f9340b0d06394953657f591638f..02411d89cb462e2f98b0960f480f3fafb7abae91 100644 (file)
@@ -648,13 +648,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev)
                ret = synthvid_negotiate_ver(hdev, SYNTHVID_VERSION_WIN10);
                if (!ret)
                        break;
-               /* Fallthrough */
+               fallthrough;
        case VERSION_WIN8:
        case VERSION_WIN8_1:
                ret = synthvid_negotiate_ver(hdev, SYNTHVID_VERSION_WIN8);
                if (!ret)
                        break;
-               /* Fallthrough */
+               fallthrough;
        case VERSION_WS2008:
        case VERSION_WIN7:
                ret = synthvid_negotiate_ver(hdev, SYNTHVID_VERSION_WIN7);
index c65ec7386e87b82207d696d24d1add0b131c72a4..e6f35f8feefcb529f54204c3800b58018705afc1 100644 (file)
@@ -430,7 +430,7 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var,
                break;
        case 9 ... 15:
                bpp = 15;
-               /* fall through */
+               fallthrough;
        case 16:
                if ((1000000 / var->pixclock) > DACSPEED16) {
                        dev_err(info->device, "requested pixclock %i MHz out of range (max. %i MHz at 15/16bpp)\n",
index 01c75c031cb6a523751267af45cdc22acbc78e26..39ebbe026ddf5cc34e1bbf31f5b67d66b971fa85 100644 (file)
@@ -90,8 +90,6 @@ static int var_to_pixfmt(struct fb_var_screeninfo *var)
                        else
                                return PIXFMT_BGR888UNPACK;
                }
-
-               /* fall through */
        }
 
        return -EINVAL;
index 8335da4ca30e28dbcd5fa7fb96bdbd91db26de04..9b0a324bb1b481573727476660a45a2a8eeb04a9 100644 (file)
@@ -896,7 +896,7 @@ void NVCalcStateExt(struct nvidia_par *par,
                if (!par->FlatPanel)
                        state->control = NV_RD32(par->PRAMDAC0, 0x0580) &
                                0xeffffeff;
-               /* fallthrough */
+               fallthrough;
        case NV_ARCH_10:
        case NV_ARCH_20:
        case NV_ARCH_30:
index 5cd0f5f6a4ae733bb7adc750767f66765254925a..4501e848a36f2c8430bb63fc5b39ace05bd785e0 100644 (file)
@@ -141,7 +141,7 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
                /* Clear PALETTE_ACCESS_CNTL in DAC_CNTL */
                out_le32(par->cmap_adr + 0x58,
                         in_le32(par->cmap_adr + 0x58) & ~0x20);
-               /* fall through */
+               fallthrough;
        case cmap_r128:
                /* Set palette index & data */
                out_8(par->cmap_adr + 0xb0, regno);
@@ -211,7 +211,7 @@ static int offb_blank(int blank, struct fb_info *info)
                                /* Clear PALETTE_ACCESS_CNTL in DAC_CNTL */
                                out_le32(par->cmap_adr + 0x58,
                                         in_le32(par->cmap_adr + 0x58) & ~0x20);
-                               /* fall through */
+                               fallthrough;
                        case cmap_r128:
                                /* Set palette index & data */
                                out_8(par->cmap_adr + 0xb0, i);
index fa73acfc1371db5da8e60002d7151a0e44b48d9a..7317c9aad677232545e75b7dbc78ad648c674fcb 100644 (file)
@@ -328,13 +328,13 @@ static int omap_lcdc_setup_plane(int plane, int channel_out,
                        lcdc.bpp = 12;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case OMAPFB_COLOR_YUV422:
                if (lcdc.ext_mode) {
                        lcdc.bpp = 16;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        default:
                /* FIXME: other BPPs.
                 * bpp1: code  0,     size 256
index 0cbcc74fa94392482d81bb9b8ca8f1dfc11feecc..3d090d2d9ed9ee2c5e4015c5c2a0c2e208402810 100644 (file)
@@ -253,7 +253,7 @@ static int _setcolreg(struct fb_info *info, u_int regno, u_int red, u_int green,
                if (fbdev->ctrl->setcolreg)
                        r = fbdev->ctrl->setcolreg(regno, red, green, blue,
                                                        transp, update_hw_pal);
-               /* Fallthrough */
+               fallthrough;
        case OMAPFB_COLOR_RGB565:
        case OMAPFB_COLOR_RGB444:
                if (r != 0)
@@ -443,7 +443,7 @@ static int set_color_mode(struct omapfb_plane_struct *plane,
                return 0;
        case 12:
                var->bits_per_pixel = 16;
-               /* fall through */
+               fallthrough;
        case 16:
                if (plane->fbdev->panel->bpp == 12)
                        plane->color_mode = OMAPFB_COLOR_RGB444;
@@ -1531,27 +1531,27 @@ static void omapfb_free_resources(struct omapfb_device *fbdev, int state)
        case OMAPFB_ACTIVE:
                for (i = 0; i < fbdev->mem_desc.region_cnt; i++)
                        unregister_framebuffer(fbdev->fb_info[i]);
-               /* fall through */
+               fallthrough;
        case 7:
                omapfb_unregister_sysfs(fbdev);
-               /* fall through */
+               fallthrough;
        case 6:
                if (fbdev->panel->disable)
                        fbdev->panel->disable(fbdev->panel);
-               /* fall through */
+               fallthrough;
        case 5:
                omapfb_set_update_mode(fbdev, OMAPFB_UPDATE_DISABLED);
-               /* fall through */
+               fallthrough;
        case 4:
                planes_cleanup(fbdev);
-               /* fall through */
+               fallthrough;
        case 3:
                ctrl_cleanup(fbdev);
-               /* fall through */
+               fallthrough;
        case 2:
                if (fbdev->panel->cleanup)
                        fbdev->panel->cleanup(fbdev->panel);
-               /* fall through */
+               fallthrough;
        case 1:
                dev_set_drvdata(fbdev->dev, NULL);
                kfree(fbdev);
@@ -1854,7 +1854,7 @@ static int __init omapfb_setup(char *options)
                        case 'm':
                        case 'M':
                                vram *= 1024;
-                               /* Fall through */
+                               fallthrough;
                        case 'k':
                        case 'K':
                                vram *= 1024;
index 3920a0db0390c3995a548c21a9dfa21355e0b92d..b2d6e6df2161563667a5d5369cf6f3885ebc56fe 100644 (file)
@@ -1861,7 +1861,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
                if (color_mode == OMAP_DSS_COLOR_YUV2 ||
                        color_mode == OMAP_DSS_COLOR_UYVY)
                        width = width >> 1;
-               /* fall through */
+               fallthrough;
        case OMAP_DSS_ROT_90:
        case OMAP_DSS_ROT_270:
                *offset1 = 0;
@@ -1884,7 +1884,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
                if (color_mode == OMAP_DSS_COLOR_YUV2 ||
                        color_mode == OMAP_DSS_COLOR_UYVY)
                        width = width >> 1;
-               /* fall through */
+               fallthrough;
        case OMAP_DSS_ROT_90 + 4:
        case OMAP_DSS_ROT_270 + 4:
                *offset1 = 0;
index f40be68d5aac975d3880e2b91a42d92276d55cc0..ea8c88aa447716497045132fd6ecd12de5920c19 100644 (file)
@@ -760,7 +760,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
                        r = -ENODEV;
                        break;
                }
-               /* FALLTHROUGH */
+               fallthrough;
 
        case OMAPFB_WAITFORVSYNC:
                DBG("ioctl WAITFORVSYNC\n");
index 836e7b1639ce585f8628dad5f7cae0b17d63e996..a3decc7fadde3b3fae61f3af0daf102c7984f68f 100644 (file)
@@ -882,7 +882,7 @@ int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
                                / (var->bits_per_pixel >> 2);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                screen_width = fix->line_length / (var->bits_per_pixel >> 3);
                break;
index c7c98d8e235928f538e04f805b7fe0faa3daf358..0642555289e06728b2c5ae111edc7a50dd8fc74c 100644 (file)
@@ -233,10 +233,10 @@ static u32 to3264(u32 timing, int bpp, int is64)
        switch (bpp) {
        case 24:
                timing *= 3;
-               /* fall through */
+               fallthrough;
        case 8:
                timing >>= 1;
-               /* fall through */
+               fallthrough;
        case 16:
                timing >>= 1;
        case 32:
index eedfbd3572a8faa41db5a80c2704e7fba5174ff1..47e6a1d0d2293ef1f5a4d7ec0a064153bfcbe9f0 100644 (file)
@@ -60,8 +60,6 @@ static int determine_best_pix_fmt(struct fb_var_screeninfo *var)
                        else
                                return PIX_FMT_BGR1555;
                }
-
-               /* fall through */
        }
 
        /*
@@ -87,8 +85,6 @@ static int determine_best_pix_fmt(struct fb_var_screeninfo *var)
                        else
                                return PIX_FMT_BGR888UNPACK;
                }
-
-               /* fall through */
        }
 
        return -EINVAL;
index a53d24fb718345fc286cfac0665f61042639542e..f1551e00eb12f149e94857d94d1c4747a2d0adb8 100644 (file)
@@ -1614,7 +1614,7 @@ static void set_ctrlr_state(struct pxafb_info *fbi, u_int state)
                 */
                if (old_state != C_DISABLE_PM)
                        break;
-               /* fall through */
+               fallthrough;
 
        case C_ENABLE:
                /*
index 9b3493846f4d912c704eeaaed70248e853702d36..ce55b9d2e862bbfa8e4bc9a80d1806f9cbb23ccc 100644 (file)
@@ -1093,7 +1093,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
                break;
        case 9 ... 15:
                var->green.length = 5;
-               /* fall through */
+               fallthrough;
        case 16:
                var->bits_per_pixel = 16;
                /* The Riva128 supports RGB555 only */
index 9dc925054930e9975271cce86e1bc9b920087039..ba316bd56efd7afabd5d1f050b6939acb9e64b1f 100644 (file)
@@ -284,7 +284,7 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var,
                /* 666 with one bit alpha/transparency */
                var->transp.offset      = 18;
                var->transp.length      = 1;
-               /* fall through */
+               fallthrough;
        case 18:
                var->bits_per_pixel     = 32;
 
@@ -312,7 +312,7 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var,
        case 25:
                var->transp.length      = var->bits_per_pixel - 24;
                var->transp.offset      = 24;
-               /* fall through */
+               fallthrough;
        case 24:
                /* our 24bpp is unpacked, so 32bpp */
                var->bits_per_pixel     = 32;
@@ -809,7 +809,7 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
        case FB_BLANK_POWERDOWN:
                wincon &= ~WINCONx_ENWIN;
                sfb->enabled &= ~(1 << index);
-               /* fall through - to FB_BLANK_NORMAL */
+               fallthrough;    /* to FB_BLANK_NORMAL */
 
        case FB_BLANK_NORMAL:
                /* disable the DMA and display 0x0 (black) */
index bda6cc313c8b96ebf81faa609a04ffd9cbb7685c..e31cf63b0a62d485227307e15117dbe35da26919 100644 (file)
@@ -935,7 +935,7 @@ static void set_ctrlr_state(struct sa1100fb_info *fbi, u_int state)
                 */
                if (old_state != C_DISABLE_PM)
                        break;
-               /* fall through */
+               fallthrough;
 
        case C_ENABLE:
                /*
index 3fd87aeb6c798f7414d48cd2d8d3805c7454ffff..a2442aae7e12538b141d3efc47d830f4b82ba02a 100644 (file)
@@ -1860,7 +1860,7 @@ static int savage_init_hw(struct savagefb_par *par)
                if ((vga_in8(0x3d5, par) & 0xC0) == (0x01 << 6))
                        RamSavage4[1] = 8;
 
-               /*FALLTHROUGH*/
+               fallthrough;
 
        case S3_SAVAGE2000:
                videoRam = RamSavage4[(config1 & 0xE0) >> 5] * 1024;
index 8a27d12e6ea879543b8e569f0f8387ad1f12b177..c1043420dbd3e0e3521f13e32842be4f9765c7bd 100644 (file)
@@ -1594,7 +1594,7 @@ sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl)
        case V4L2_PIX_FMT_NV12:
        case V4L2_PIX_FMT_NV21:
                info->fix.ypanstep = 2;
-               /* Fall through */
+               fallthrough;
        case V4L2_PIX_FMT_NV16:
        case V4L2_PIX_FMT_NV61:
                info->fix.xpanstep = 2;
@@ -2085,7 +2085,7 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
        case V4L2_PIX_FMT_NV12:
        case V4L2_PIX_FMT_NV21:
                info->fix.ypanstep = 2;
-               /* Fall through */
+               fallthrough;
        case V4L2_PIX_FMT_NV16:
        case V4L2_PIX_FMT_NV61:
                info->fix.xpanstep = 2;
index ac140962b1bfba035238750f96404a1cb5a2b414..03c736f6f3d086d2febcdd900b47d1a9171f185e 100644 (file)
@@ -1739,7 +1739,7 @@ static int        sisfb_ioctl(struct fb_info *info, unsigned int cmd,
                if(ivideo->warncount++ < 10)
                        printk(KERN_INFO
                                "sisfb: Deprecated ioctl call received - update your application!\n");
-               /* fall through */
+               fallthrough;
           case SISFB_GET_INFO:  /* For communication with X driver */
                ivideo->sisfb_infoblock.sisfb_id         = SISFB_ID;
                ivideo->sisfb_infoblock.sisfb_version    = VER_MAJOR;
@@ -1793,7 +1793,7 @@ static int        sisfb_ioctl(struct fb_info *info, unsigned int cmd,
                if(ivideo->warncount++ < 10)
                        printk(KERN_INFO
                                "sisfb: Deprecated ioctl call received - update your application!\n");
-               /* fall through */
+               fallthrough;
           case SISFB_GET_VBRSTATUS:
                if(sisfb_CheckVBRetrace(ivideo))
                        return put_user((u32)1, argp);
@@ -1804,7 +1804,7 @@ static int        sisfb_ioctl(struct fb_info *info, unsigned int cmd,
                if(ivideo->warncount++ < 10)
                        printk(KERN_INFO
                                "sisfb: Deprecated ioctl call received - update your application!\n");
-               /* fall through */
+               fallthrough;
           case SISFB_GET_AUTOMAXIMIZE:
                if(ivideo->sisfb_max)
                        return put_user((u32)1, argp);
@@ -1815,7 +1815,7 @@ static int        sisfb_ioctl(struct fb_info *info, unsigned int cmd,
                if(ivideo->warncount++ < 10)
                        printk(KERN_INFO
                                "sisfb: Deprecated ioctl call received - update your application!\n");
-               /* fall through */
+               fallthrough;
           case SISFB_SET_AUTOMAXIMIZE:
                if(get_user(gpu32, argp))
                        return -EFAULT;
index 3dd1b1d76e983a799fd07536ed0edfb68dc7ed7f..6a52eba645596a4b3abab5f16340d3be5e0c8ef1 100644 (file)
@@ -1005,7 +1005,7 @@ static int sm501fb_blank_crt(int blank_mode, struct fb_info *info)
        case FB_BLANK_POWERDOWN:
                ctrl &= ~SM501_DC_CRT_CONTROL_ENABLE;
                sm501_misc_control(fbi->dev->parent, SM501_MISC_DAC_POWER, 0);
-               /* fall through */
+               fallthrough;
 
        case FB_BLANK_NORMAL:
                ctrl |= SM501_DC_CRT_CONTROL_BLANK;
index de953ddb631243ad0ebceeef67e53b6266b12fb0..265865610edc695cad8e3d6196bb81a494a93920 100644 (file)
@@ -999,7 +999,7 @@ stifb_blank(int blank_mode, struct fb_info *info)
        case S9000_ID_HCRX:
                HYPER_ENABLE_DISABLE_DISPLAY(fb, enable);
                break;
-       case S9000_ID_A1659A:   /* fall through */
+       case S9000_ID_A1659A:
        case S9000_ID_TIMBER:
        case CRX24_OVERLAY_PLANES:
        default:
@@ -1157,7 +1157,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
                        dev_name);
                   goto out_err0;
                }
-               /* fall through */
+               fallthrough;
        case S9000_ID_ARTIST:
        case S9000_ID_HCRX:
        case S9000_ID_TIMBER:
index f73e26c18c0901a92fe205c61df13e335720ef5d..f056d80f6359f2dfd82c57fb9e753367bdfa1e45 100644 (file)
@@ -523,7 +523,7 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        case 32:
                var->transp.offset = 24;
                var->transp.length = 8;
-               /* fall through */
+               fallthrough;
        case 24:
                var->red.offset = 16;
                var->green.offset = 8;
index a20eeb8308ffd3047e3d4ce61d003d5aee0b2c95..578d3541e3d6f802d9930036d54a71e0e6362293 100644 (file)
@@ -1121,7 +1121,7 @@ static void vga_8planes_imageblit(struct fb_info *info, const struct fb_image *i
         char oldop = setop(0);
         char oldsr = setsr(0);
         char oldmask = selectmask();
-        const char *cdat = image->data;
+       const unsigned char *cdat = image->data;
        u32 dx = image->dx;
         char __iomem *where;
         int y;
index 3fea01db58d630297c1bb7e72bdc9903c79725ff..4a869402d120d37b1d2476f5e06d08baee1dcd96 100644 (file)
@@ -744,7 +744,7 @@ static void set_lcd_output_path(int set_iga, int output_interface)
                    viaparinfo->chip_info->gfx_chip_name))
                        viafb_write_reg_mask(CR97, VIACR, 0x84,
                                       BIT7 + BIT2 + BIT1 + BIT0);
-               /* fall through */
+               fallthrough;
        case INTERFACE_DVP0:
        case INTERFACE_DVP1:
        case INTERFACE_DFP_HIGH:
index 00307b8693bf567925521cde6ea8b4e65ff9b4aa..5ec51445bee882beb88cefb66dd2f63483a14e8b 100644 (file)
@@ -677,7 +677,7 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's CLOSING state. */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 9673eb12dacd06d5577e312f3dc8f46aa5188ddc..f22ebe89fe137a0733cd6afda15c11238c4a1277 100644 (file)
@@ -234,7 +234,7 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd,
                        return -EINVAL;
                timeout = new_timeout;
                sc1200wdt_write_data(WDTO, timeout);
-               /* fall through - and return the new timeout */
+               fallthrough;    /* and return the new timeout */
 
        case WDIOC_GETTIMEOUT:
                return put_user(timeout * 60, p);
index 184a06a74f83a225c3289a53f2d98197523718f4..c00627825de88ac39aed5ccf87b424c086c1d88e 100644 (file)
@@ -332,7 +332,7 @@ static long wdrtas_ioctl(struct file *file, unsigned int cmd,
                        wdrtas_interval = i;
                else
                        wdrtas_interval = wdrtas_get_interval(i);
-               /* fallthrough */
+               fallthrough;
 
        case WDIOC_GETTIMEOUT:
                return put_user(wdrtas_interval, argp);
index ea6c1e7e3e421a3257c2754ee635705e5e5926b9..41645fe6ad48a2902e5dbb1827b859e0e3e39ecc 100644 (file)
@@ -325,4 +325,14 @@ config XEN_HAVE_VPMU
 config XEN_FRONT_PGDIR_SHBUF
        tristate
 
+config XEN_UNPOPULATED_ALLOC
+       bool "Use unpopulated memory ranges for guest mappings"
+       depends on X86 && ZONE_DEVICE
+       default XEN_BACKEND || XEN_GNTDEV || XEN_DOM0
+       help
+         Use unpopulated memory ranges in order to create mappings for guest
+         memory regions, including grant maps and foreign pages. This avoids
+         having to balloon out RAM regions in order to obtain physical memory
+         space to create such mappings.
+
 endmenu
index c25c9a699b483731d453d8ff6efcf75d4ade4a31..babdca808861da9e5d54c58c4f4523c885159b29 100644 (file)
@@ -41,3 +41,4 @@ xen-gntdev-$(CONFIG_XEN_GNTDEV_DMABUF)        += gntdev-dmabuf.o
 xen-gntalloc-y                         := gntalloc.o
 xen-privcmd-y                          := privcmd.o privcmd-buf.o
 obj-$(CONFIG_XEN_FRONT_PGDIR_SHBUF)    += xen-front-pgdir-shbuf.o
+obj-$(CONFIG_XEN_UNPOPULATED_ALLOC)    += unpopulated-alloc.o
index 37ffccda8bb8791818641f15f9d3639b64781731..51427c752b37b9aa748d1c3194bdd6da93f881f1 100644 (file)
@@ -653,7 +653,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages)
 }
 EXPORT_SYMBOL(free_xenballooned_pages);
 
-#ifdef CONFIG_XEN_PV
+#if defined(CONFIG_XEN_PV) && !defined(CONFIG_XEN_UNPOPULATED_ALLOC)
 static void __init balloon_add_region(unsigned long start_pfn,
                                      unsigned long pages)
 {
@@ -707,7 +707,7 @@ static int __init balloon_init(void)
        register_sysctl_table(xen_root);
 #endif
 
-#ifdef CONFIG_XEN_PV
+#if defined(CONFIG_XEN_PV) && !defined(CONFIG_XEN_UNPOPULATED_ALLOC)
        {
                int i;
 
index 140c7bf33a989948e946f486edd37b560f0ede67..90b8f56fbadb1a3b1fea483cc9f8e9c1847942c7 100644 (file)
@@ -156,7 +156,7 @@ int get_evtchn_to_irq(evtchn_port_t evtchn)
 /* Get info for IRQ */
 struct irq_info *info_for_irq(unsigned irq)
 {
-       return irq_get_handler_data(irq);
+       return irq_get_chip_data(irq);
 }
 
 /* Constructors for packed IRQ information. */
@@ -377,7 +377,7 @@ static void xen_irq_init(unsigned irq)
        info->type = IRQT_UNBOUND;
        info->refcnt = -1;
 
-       irq_set_handler_data(irq, info);
+       irq_set_chip_data(irq, info);
 
        list_add_tail(&info->list, &xen_irq_list_head);
 }
@@ -426,14 +426,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
 
 static void xen_free_irq(unsigned irq)
 {
-       struct irq_info *info = irq_get_handler_data(irq);
+       struct irq_info *info = irq_get_chip_data(irq);
 
        if (WARN_ON(!info))
                return;
 
        list_del(&info->list);
 
-       irq_set_handler_data(irq, NULL);
+       irq_set_chip_data(irq, NULL);
 
        WARN_ON(info->refcnt > 0);
 
@@ -603,7 +603,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
 static void __unbind_from_irq(unsigned int irq)
 {
        evtchn_port_t evtchn = evtchn_from_irq(irq);
-       struct irq_info *info = irq_get_handler_data(irq);
+       struct irq_info *info = irq_get_chip_data(irq);
 
        if (info->refcnt > 0) {
                info->refcnt--;
@@ -1108,7 +1108,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
 
 void unbind_from_irqhandler(unsigned int irq, void *dev_id)
 {
-       struct irq_info *info = irq_get_handler_data(irq);
+       struct irq_info *info = irq_get_chip_data(irq);
 
        if (WARN_ON(!info))
                return;
@@ -1142,7 +1142,7 @@ int evtchn_make_refcounted(evtchn_port_t evtchn)
        if (irq == -1)
                return -ENOENT;
 
-       info = irq_get_handler_data(irq);
+       info = irq_get_chip_data(irq);
 
        if (!info)
                return -ENOENT;
@@ -1170,7 +1170,7 @@ int evtchn_get(evtchn_port_t evtchn)
        if (irq == -1)
                goto done;
 
-       info = irq_get_handler_data(irq);
+       info = irq_get_chip_data(irq);
 
        if (!info)
                goto done;
index 8d06bf1cc3479c5a205b0d2f05782416f0454f3a..523dcdf39cc944d45b8275845bfe2335aae72302 100644 (file)
@@ -801,7 +801,7 @@ int gnttab_alloc_pages(int nr_pages, struct page **pages)
 {
        int ret;
 
-       ret = alloc_xenballooned_pages(nr_pages, pages);
+       ret = xen_alloc_unpopulated_pages(nr_pages, pages);
        if (ret < 0)
                return ret;
 
@@ -836,7 +836,7 @@ EXPORT_SYMBOL_GPL(gnttab_pages_clear_private);
 void gnttab_free_pages(int nr_pages, struct page **pages)
 {
        gnttab_pages_clear_private(nr_pages, pages);
-       free_xenballooned_pages(nr_pages, pages);
+       xen_free_unpopulated_pages(nr_pages, pages);
 }
 EXPORT_SYMBOL_GPL(gnttab_free_pages);
 
index 63abe6c3642b579b528ca21bff0a92a3af89a0c3..b0c73c58f9874a34f81fcd4477cc752cdfdbf381 100644 (file)
@@ -424,7 +424,7 @@ static int alloc_empty_pages(struct vm_area_struct *vma, int numpgs)
        if (pages == NULL)
                return -ENOMEM;
 
-       rc = alloc_xenballooned_pages(numpgs, pages);
+       rc = xen_alloc_unpopulated_pages(numpgs, pages);
        if (rc != 0) {
                pr_warn("%s Could not alloc %d pfns rc:%d\n", __func__,
                        numpgs, rc);
@@ -895,7 +895,7 @@ static void privcmd_close(struct vm_area_struct *vma)
 
        rc = xen_unmap_domain_gfn_range(vma, numgfns, pages);
        if (rc == 0)
-               free_xenballooned_pages(numpgs, pages);
+               xen_free_unpopulated_pages(numpgs, pages);
        else
                pr_crit("unable to unmap MFN range: leaking %d pages. rc=%d\n",
                        numpgs, rc);
index b43b5595e988024832bde33724f34147661857cf..72d725a0ab5ce1f4afcac3684c92a55ebaa5f726 100644 (file)
@@ -1263,7 +1263,7 @@ static void pvcalls_front_changed(struct xenbus_device *dev,
                if (dev->state == XenbusStateClosed)
                        break;
                /* Missed the backend's CLOSING state */
-               /* fall through */
+               fallthrough;
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
diff --git a/drivers/xen/unpopulated-alloc.c b/drivers/xen/unpopulated-alloc.c
new file mode 100644 (file)
index 0000000..3b98dc9
--- /dev/null
@@ -0,0 +1,183 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/errno.h>
+#include <linux/gfp.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/memremap.h>
+#include <linux/slab.h>
+
+#include <asm/page.h>
+
+#include <xen/page.h>
+#include <xen/xen.h>
+
+static DEFINE_MUTEX(list_lock);
+static LIST_HEAD(page_list);
+static unsigned int list_count;
+
+static int fill_list(unsigned int nr_pages)
+{
+       struct dev_pagemap *pgmap;
+       void *vaddr;
+       unsigned int i, alloc_pages = round_up(nr_pages, PAGES_PER_SECTION);
+       int ret;
+
+       pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL);
+       if (!pgmap)
+               return -ENOMEM;
+
+       pgmap->type = MEMORY_DEVICE_GENERIC;
+       pgmap->res.name = "Xen scratch";
+       pgmap->res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+
+       ret = allocate_resource(&iomem_resource, &pgmap->res,
+                               alloc_pages * PAGE_SIZE, 0, -1,
+                               PAGES_PER_SECTION * PAGE_SIZE, NULL, NULL);
+       if (ret < 0) {
+               pr_err("Cannot allocate new IOMEM resource\n");
+               kfree(pgmap);
+               return ret;
+       }
+
+#ifdef CONFIG_XEN_HAVE_PVMMU
+        /*
+         * memremap will build page tables for the new memory so
+         * the p2m must contain invalid entries so the correct
+         * non-present PTEs will be written.
+         *
+         * If a failure occurs, the original (identity) p2m entries
+         * are not restored since this region is now known not to
+         * conflict with any devices.
+         */
+       if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+               xen_pfn_t pfn = PFN_DOWN(pgmap->res.start);
+
+               for (i = 0; i < alloc_pages; i++) {
+                       if (!set_phys_to_machine(pfn + i, INVALID_P2M_ENTRY)) {
+                               pr_warn("set_phys_to_machine() failed, no memory added\n");
+                               release_resource(&pgmap->res);
+                               kfree(pgmap);
+                               return -ENOMEM;
+                       }
+                }
+       }
+#endif
+
+       vaddr = memremap_pages(pgmap, NUMA_NO_NODE);
+       if (IS_ERR(vaddr)) {
+               pr_err("Cannot remap memory range\n");
+               release_resource(&pgmap->res);
+               kfree(pgmap);
+               return PTR_ERR(vaddr);
+       }
+
+       for (i = 0; i < alloc_pages; i++) {
+               struct page *pg = virt_to_page(vaddr + PAGE_SIZE * i);
+
+               BUG_ON(!virt_addr_valid(vaddr + PAGE_SIZE * i));
+               list_add(&pg->lru, &page_list);
+               list_count++;
+       }
+
+       return 0;
+}
+
+/**
+ * xen_alloc_unpopulated_pages - alloc unpopulated pages
+ * @nr_pages: Number of pages
+ * @pages: pages returned
+ * @return 0 on success, error otherwise
+ */
+int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages)
+{
+       unsigned int i;
+       int ret = 0;
+
+       mutex_lock(&list_lock);
+       if (list_count < nr_pages) {
+               ret = fill_list(nr_pages - list_count);
+               if (ret)
+                       goto out;
+       }
+
+       for (i = 0; i < nr_pages; i++) {
+               struct page *pg = list_first_entry_or_null(&page_list,
+                                                          struct page,
+                                                          lru);
+
+               BUG_ON(!pg);
+               list_del(&pg->lru);
+               list_count--;
+               pages[i] = pg;
+
+#ifdef CONFIG_XEN_HAVE_PVMMU
+               if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+                       ret = xen_alloc_p2m_entry(page_to_pfn(pg));
+                       if (ret < 0) {
+                               unsigned int j;
+
+                               for (j = 0; j <= i; j++) {
+                                       list_add(&pages[j]->lru, &page_list);
+                                       list_count++;
+                               }
+                               goto out;
+                       }
+               }
+#endif
+       }
+
+out:
+       mutex_unlock(&list_lock);
+       return ret;
+}
+EXPORT_SYMBOL(xen_alloc_unpopulated_pages);
+
+/**
+ * xen_free_unpopulated_pages - return unpopulated pages
+ * @nr_pages: Number of pages
+ * @pages: pages to return
+ */
+void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages)
+{
+       unsigned int i;
+
+       mutex_lock(&list_lock);
+       for (i = 0; i < nr_pages; i++) {
+               list_add(&pages[i]->lru, &page_list);
+               list_count++;
+       }
+       mutex_unlock(&list_lock);
+}
+EXPORT_SYMBOL(xen_free_unpopulated_pages);
+
+#ifdef CONFIG_XEN_PV
+static int __init init(void)
+{
+       unsigned int i;
+
+       if (!xen_domain())
+               return -ENODEV;
+
+       if (!xen_pv_domain())
+               return 0;
+
+       /*
+        * Initialize with pages from the extra memory regions (see
+        * arch/x86/xen/setup.c).
+        */
+       for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
+               unsigned int j;
+
+               for (j = 0; j < xen_extra_mem[i].n_pfns; j++) {
+                       struct page *pg =
+                               pfn_to_page(xen_extra_mem[i].start_pfn + j);
+
+                       list_add(&pg->lru, &page_list);
+                       list_count++;
+               }
+       }
+
+       return 0;
+}
+subsys_initcall(init);
+#endif
index 7457213b89156a72c6ca822d022f799097e5d42b..f914b72557efb0379cb208c90a715c2fe3006982 100644 (file)
@@ -229,7 +229,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
        case ACPI_NOTIFY_BUS_CHECK:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                        "\nReceived BUS CHECK notification for device\n"));
-               /* Fall Through */
+               fallthrough;
        case ACPI_NOTIFY_DEVICE_CHECK:
                if (event == ACPI_NOTIFY_DEVICE_CHECK)
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
index f2115587855f7d629910f2ec57726227b9aa0844..b500466a6c371f125dc12b2f2bccd8a699c06778 100644 (file)
@@ -545,7 +545,7 @@ static void xen_pcibk_frontend_changed(struct xenbus_device *xdev,
                xenbus_switch_state(xdev, XenbusStateClosed);
                if (xenbus_dev_is_online(xdev))
                        break;
-               /* fall through - if not online */
+               fallthrough;    /* if not online */
        case XenbusStateUnknown:
                dev_dbg(&xdev->dev, "frontend is gone! unregister device\n");
                device_unregister(&xdev->dev);
index 75c0a2e9a6db55b72d284af345548239868205ad..1e8cfd80a4e6b45c066811156b82a9f63ea4c725 100644 (file)
@@ -1185,7 +1185,7 @@ static void scsiback_frontend_changed(struct xenbus_device *dev,
                xenbus_switch_state(dev, XenbusStateClosed);
                if (xenbus_dev_is_online(dev))
                        break;
-               /* fall through - if not online */
+               fallthrough;    /* if not online */
        case XenbusStateUnknown:
                device_unregister(&dev->dev);
                break;
index 786fbb7d8be063f82d65a1fcaef8a627ea10c0b6..2690318ad50f487ad525d1653ee570f0d3772384 100644 (file)
@@ -379,8 +379,14 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,
        int i, j;
 
        for (i = 0; i < nr_pages; i++) {
-               err = gnttab_grant_foreign_access(dev->otherend_id,
-                                                 virt_to_gfn(vaddr), 0);
+               unsigned long gfn;
+
+               if (is_vmalloc_addr(vaddr))
+                       gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr));
+               else
+                       gfn = virt_to_gfn(vaddr);
+
+               err = gnttab_grant_foreign_access(dev->otherend_id, gfn, 0);
                if (err < 0) {
                        xenbus_dev_fatal(dev, err,
                                         "granting access to ring page");
@@ -615,7 +621,7 @@ static int xenbus_map_ring_hvm(struct xenbus_device *dev,
        bool leaked = false;
        unsigned int nr_pages = XENBUS_PAGES(nr_grefs);
 
-       err = alloc_xenballooned_pages(nr_pages, node->hvm.pages);
+       err = xen_alloc_unpopulated_pages(nr_pages, node->hvm.pages);
        if (err)
                goto out_err;
 
@@ -656,7 +662,7 @@ static int xenbus_map_ring_hvm(struct xenbus_device *dev,
                         addr, nr_pages);
  out_free_ballooned_pages:
        if (!leaked)
-               free_xenballooned_pages(nr_pages, node->hvm.pages);
+               xen_free_unpopulated_pages(nr_pages, node->hvm.pages);
  out_err:
        return err;
 }
@@ -852,7 +858,7 @@ static int xenbus_unmap_ring_hvm(struct xenbus_device *dev, void *vaddr)
                               info.addrs);
        if (!rv) {
                vunmap(vaddr);
-               free_xenballooned_pages(nr_pages, node->hvm.pages);
+               xen_free_unpopulated_pages(nr_pages, node->hvm.pages);
        }
        else
                WARN(1, "Leaking %p, size %u page(s)\n", vaddr, nr_pages);
index 15379089853babf0d833271362bb663f1d2e0be6..480944606a3c9910ea8df4a13d3905a51ac11dff 100644 (file)
@@ -401,12 +401,12 @@ static void xenbus_reset_frontend(char *fe, char *be, int be_state)
        case XenbusStateConnected:
                xenbus_printf(XBT_NIL, fe, "state", "%d", XenbusStateClosing);
                xenbus_reset_wait_for_backend(be, XenbusStateClosing);
-               /* fall through */
+               fallthrough;
 
        case XenbusStateClosing:
                xenbus_printf(XBT_NIL, fe, "state", "%d", XenbusStateClosed);
                xenbus_reset_wait_for_backend(be, XenbusStateClosed);
-               /* fall through */
+               fallthrough;
 
        case XenbusStateClosed:
                xenbus_printf(XBT_NIL, fe, "state", "%d", XenbusStateInitialising);
index 7b1077f0abcb0839d89a299de2a9d9d60760943a..34742c6e189e386a5120ad67667faae3031ab25c 100644 (file)
@@ -232,7 +232,7 @@ int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt,
                kfree(pages);
                return -ENOMEM;
        }
-       rc = alloc_xenballooned_pages(nr_pages, pages);
+       rc = xen_alloc_unpopulated_pages(nr_pages, pages);
        if (rc) {
                pr_warn("%s Couldn't balloon alloc %ld pages rc:%d\n", __func__,
                        nr_pages, rc);
@@ -249,7 +249,7 @@ int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt,
        if (!vaddr) {
                pr_warn("%s Couldn't map %ld pages rc:%d\n", __func__,
                        nr_pages, rc);
-               free_xenballooned_pages(nr_pages, pages);
+               xen_free_unpopulated_pages(nr_pages, pages);
                kfree(pages);
                kfree(pfns);
                return -ENOMEM;
index 92cd1d80218d70acc842dc5942581f069e87dbdc..3576123d82990e61dca4b3bbc8dabb1ebd0cea6a 100644 (file)
@@ -213,7 +213,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
                break;
        default:
                WARN_ONCE(1, "unknown lock status code: %d\n", status);
-               /* fall through */
+               fallthrough;
        case P9_LOCK_ERROR:
        case P9_LOCK_GRACE:
                res = -ENOLCK;
index 30d526fecc3f40fbd69c0b216e2f89a6fe44e3e2..05e963402e25f05f62649d9939bfe8f63ea6dcc6 100644 (file)
@@ -18,11 +18,11 @@ static inline unsigned int adfs_readval(unsigned char *p, int len)
 
        switch (len) {
        case 4:         val |= p[3] << 24;
-                       /* fall through */
+               fallthrough;
        case 3:         val |= p[2] << 16;
-                       /* fall through */
+               fallthrough;
        case 2:         val |= p[1] << 8;
-                       /* fall through */
+               fallthrough;
        default:        val |= p[0];
        }
        return val;
@@ -32,11 +32,11 @@ static inline void adfs_writeval(unsigned char *p, int len, unsigned int val)
 {
        switch (len) {
        case 4:         p[3] = val >> 24;
-                       /* fall through */
+               fallthrough;
        case 3:         p[2] = val >> 16;
-                       /* fall through */
+               fallthrough;
        case 2:         p[1] = val >> 8;
-                       /* fall through */
+               fallthrough;
        default:        p[0] = val;
        }
 }
index f708c45d5f664d84475f6a42214d0732c43325b9..29f11e10a7c7d213623063b12b5e98e5bd01a85f 100644 (file)
@@ -420,24 +420,51 @@ affs_mode_to_prot(struct inode *inode)
        u32 prot = AFFS_I(inode)->i_protect;
        umode_t mode = inode->i_mode;
 
+       /*
+        * First, clear all RWED bits for owner, group, other.
+        * Then, recalculate them afresh.
+        *
+        * We'll always clear the delete-inhibit bit for the owner, as that is
+        * the classic single-user mode AmigaOS protection bit and we need to
+        * stay compatible with all scenarios.
+        *
+        * Since multi-user AmigaOS is an extension, we'll only set the
+        * delete-allow bit if any of the other bits in the same user class
+        * (group/other) are used.
+        */
+       prot &= ~(FIBF_NOEXECUTE | FIBF_NOREAD
+                 | FIBF_NOWRITE | FIBF_NODELETE
+                 | FIBF_GRP_EXECUTE | FIBF_GRP_READ
+                 | FIBF_GRP_WRITE   | FIBF_GRP_DELETE
+                 | FIBF_OTR_EXECUTE | FIBF_OTR_READ
+                 | FIBF_OTR_WRITE   | FIBF_OTR_DELETE);
+
+       /* Classic single-user AmigaOS flags. These are inverted. */
        if (!(mode & 0100))
                prot |= FIBF_NOEXECUTE;
        if (!(mode & 0400))
                prot |= FIBF_NOREAD;
        if (!(mode & 0200))
                prot |= FIBF_NOWRITE;
+
+       /* Multi-user extended flags. Not inverted. */
        if (mode & 0010)
                prot |= FIBF_GRP_EXECUTE;
        if (mode & 0040)
                prot |= FIBF_GRP_READ;
        if (mode & 0020)
                prot |= FIBF_GRP_WRITE;
+       if (mode & 0070)
+               prot |= FIBF_GRP_DELETE;
+
        if (mode & 0001)
                prot |= FIBF_OTR_EXECUTE;
        if (mode & 0004)
                prot |= FIBF_OTR_READ;
        if (mode & 0002)
                prot |= FIBF_OTR_WRITE;
+       if (mode & 0007)
+               prot |= FIBF_OTR_DELETE;
 
        AFFS_I(inode)->i_protect = prot;
 }
index a26a0f96c1197a10bd5c4ac33cc8650100fe3c2f..d91b0133d95da5e225e01f3a6e9ef76b89c575d0 100644 (file)
@@ -429,6 +429,24 @@ static int affs_write_begin(struct file *file, struct address_space *mapping,
        return ret;
 }
 
+static int affs_write_end(struct file *file, struct address_space *mapping,
+                         loff_t pos, unsigned int len, unsigned int copied,
+                         struct page *page, void *fsdata)
+{
+       struct inode *inode = mapping->host;
+       int ret;
+
+       ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
+
+       /* Clear Archived bit on file writes, as AmigaOS would do */
+       if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) {
+               AFFS_I(inode)->i_protect &= ~FIBF_ARCHIVED;
+               mark_inode_dirty(inode);
+       }
+
+       return ret;
+}
+
 static sector_t _affs_bmap(struct address_space *mapping, sector_t block)
 {
        return generic_block_bmap(mapping,block,affs_get_block);
@@ -438,7 +456,7 @@ const struct address_space_operations affs_aops = {
        .readpage = affs_readpage,
        .writepage = affs_writepage,
        .write_begin = affs_write_begin,
-       .write_end = generic_write_end,
+       .write_end = affs_write_end,
        .direct_IO = affs_direct_IO,
        .bmap = _affs_bmap
 };
@@ -795,6 +813,12 @@ done:
        if (tmp > inode->i_size)
                inode->i_size = AFFS_I(inode)->mmu_private = tmp;
 
+       /* Clear Archived bit on file writes, as AmigaOS would do */
+       if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) {
+               AFFS_I(inode)->i_protect &= ~FIBF_ARCHIVED;
+               mark_inode_dirty(inode);
+       }
+
 err_first_bh:
        unlock_page(page);
        put_page(page);
index a346cf7659f19804db57d64d6702c5d2130b7230..044412110b52354f927a49603a6f164785cc8e8c 100644 (file)
@@ -93,7 +93,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
        case ST_ROOT:
                inode->i_uid = sbi->s_uid;
                inode->i_gid = sbi->s_gid;
-               /* fall through */
+               fallthrough;
        case ST_USERDIR:
                if (be32_to_cpu(tail->stype) == ST_USERDIR ||
                    affs_test_opt(sbi->s_flags, SF_SETMODE)) {
index 47107c6712a6134fb815066816a9e32389b8dfcd..a100cd9950c8897453c4a25268ba2888be8c0ae6 100644 (file)
@@ -474,7 +474,7 @@ got_root:
        case MUFS_INTLFFS:
        case MUFS_DCFFS:
                affs_set_opt(sbi->s_flags, SF_MUFS);
-               /* fall thru */
+               fallthrough;
        case FS_INTLFFS:
        case FS_DCFFS:
                affs_set_opt(sbi->s_flags, SF_INTL);
@@ -486,7 +486,7 @@ got_root:
                break;
        case MUFS_OFS:
                affs_set_opt(sbi->s_flags, SF_MUFS);
-               /* fall through */
+               fallthrough;
        case FS_OFS:
                affs_set_opt(sbi->s_flags, SF_OFS);
                sb->s_flags |= SB_NOEXEC;
@@ -494,7 +494,7 @@ got_root:
        case MUFS_DCOFS:
        case MUFS_INTLOFS:
                affs_set_opt(sbi->s_flags, SF_MUFS);
-               /* fall through */
+               fallthrough;
        case FS_DCOFS:
        case FS_INTLOFS:
                affs_set_opt(sbi->s_flags, SF_INTL);
index bef413818af7393d0cd42aae8c08435df3a16f9c..a4e9e6e07e9397321f61567a047f3fafb574fa62 100644 (file)
@@ -252,7 +252,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                call->unmarshall++;
 
                /* extract the FID array and its count in two steps */
-               /* fall through */
+               fallthrough;
        case 1:
                _debug("extract FID count");
                ret = afs_extract_data(call, true);
@@ -271,7 +271,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                afs_extract_to_buf(call, call->count * 3 * 4);
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 2:
                _debug("extract FID array");
                ret = afs_extract_data(call, true);
@@ -297,7 +297,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                call->unmarshall++;
 
                /* extract the callback array and its count in two steps */
-               /* fall through */
+               fallthrough;
        case 3:
                _debug("extract CB count");
                ret = afs_extract_data(call, true);
@@ -312,7 +312,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
                iov_iter_discard(&call->def_iter, READ, call->count2 * 3 * 4);
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 4:
                _debug("extract discard %zu/%u",
                       iov_iter_count(call->iter), call->count2 * 3 * 4);
@@ -391,7 +391,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
                afs_extract_to_buf(call, 11 * sizeof(__be32));
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 1:
                _debug("extract UUID");
                ret = afs_extract_data(call, false);
@@ -503,7 +503,7 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call)
                afs_extract_to_buf(call, 11 * sizeof(__be32));
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 1:
                _debug("extract UUID");
                ret = afs_extract_data(call, false);
@@ -618,7 +618,7 @@ static int afs_deliver_yfs_cb_callback(struct afs_call *call)
                call->unmarshall++;
 
                /* extract the FID array and its count in two steps */
-               /* Fall through */
+               fallthrough;
        case 1:
                _debug("extract FID count");
                ret = afs_extract_data(call, true);
@@ -637,7 +637,7 @@ static int afs_deliver_yfs_cb_callback(struct afs_call *call)
                afs_extract_to_buf(call, size);
                call->unmarshall++;
 
-               /* Fall through */
+               fallthrough;
        case 2:
                _debug("extract FID array");
                ret = afs_extract_data(call, false);
index 6f6ed1605cfe30bc9131b898368d50917692662d..371d1488cc549db412a75045b7bfaf5b4d37204e 100644 (file)
@@ -311,7 +311,7 @@ int afs_page_filler(void *data, struct page *page)
        case -ENOBUFS:
                _debug("cache said ENOBUFS");
 
-               /* fall through */
+               fallthrough;
        default:
        go_on:
                req = kzalloc(struct_size(req, array, 1), GFP_KERNEL);
index ffb8575345ca748ecbb2e6fd1c4eef217b8c7375..cb3054c7843ea49355409eec8acb68de82ef4679 100644 (file)
@@ -376,7 +376,6 @@ again:
                spin_unlock(&vnode->lock);
                return;
 
-               /* Fall through */
        default:
                /* Looks like a lock request was withdrawn. */
                spin_unlock(&vnode->lock);
index 5d9ef517cf8162335c592ee2c57338f344e979de..e7e98ad63a91ae8ea126a2ee646814a7ec20ab41 100644 (file)
@@ -161,8 +161,8 @@ responded:
                }
        }
 
-       rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
-       if (rtt_us < server->probe.rtt) {
+       if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) &&
+           rtt_us < server->probe.rtt) {
                server->probe.rtt = rtt_us;
                server->rtt = rtt_us;
                alist->preferred = index;
index acb4d0ca264908704388880e4938f7a0594a9f47..1d95ed9dd86e601f6068ec3bf500ebcc08b9d8e9 100644 (file)
@@ -320,7 +320,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
                        call->tmp_u = htonl(0);
                        afs_extract_to_tmp(call);
                }
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data length */
        case 1:
@@ -348,7 +348,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
                call->bvec[0].bv_page = req->pages[req->index];
                iov_iter_bvec(&call->def_iter, READ, call->bvec, 1, size);
                ASSERTCMP(size, <=, PAGE_SIZE);
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data */
        case 2:
@@ -375,7 +375,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
                /* Discard any excess data the server gave us */
                afs_extract_discard(call, req->actual_len - req->len);
                call->unmarshall = 3;
-               /* Fall through */
+               fallthrough;
 
        case 3:
                _debug("extract discard %zu/%llu",
@@ -388,7 +388,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)
        no_more_data:
                call->unmarshall = 4;
                afs_extract_to_buf(call, (21 + 3 + 6) * 4);
-               /* Fall through */
+               fallthrough;
 
                /* extract the metadata */
        case 4:
@@ -1343,7 +1343,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
        case 0:
                call->unmarshall++;
                afs_extract_to_buf(call, 12 * 4);
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned status record */
        case 1:
@@ -1356,7 +1356,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                xdr_decode_AFSFetchVolumeStatus(&bp, &op->volstatus.vs);
                call->unmarshall++;
                afs_extract_to_tmp(call);
-               /* Fall through */
+               fallthrough;
 
                /* extract the volume name length */
        case 2:
@@ -1371,7 +1371,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the volume name */
        case 3:
@@ -1385,7 +1385,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                _debug("volname '%s'", p);
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the offline message length */
        case 4:
@@ -1400,7 +1400,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the offline message */
        case 5:
@@ -1415,7 +1415,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
 
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the message of the day length */
        case 6:
@@ -1430,7 +1430,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the message of the day */
        case 7:
@@ -1682,7 +1682,7 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the capabilities word count */
        case 1:
@@ -1696,7 +1696,7 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call)
                call->count2 = count;
                afs_extract_discard(call, count * sizeof(__be32));
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract capabilities words */
        case 2:
@@ -1776,7 +1776,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the file status count and array in two steps */
        case 1:
@@ -1794,7 +1794,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->unmarshall++;
        more_counts:
                afs_extract_to_buf(call, 21 * sizeof(__be32));
-               /* Fall through */
+               fallthrough;
 
        case 2:
                _debug("extract status array %u", call->count);
@@ -1824,7 +1824,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->count = 0;
                call->unmarshall++;
                afs_extract_to_tmp(call);
-               /* Fall through */
+               fallthrough;
 
                /* Extract the callback count and array in two steps */
        case 3:
@@ -1841,7 +1841,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->unmarshall++;
        more_cbs:
                afs_extract_to_buf(call, 3 * sizeof(__be32));
-               /* Fall through */
+               fallthrough;
 
        case 4:
                _debug("extract CB array");
@@ -1870,7 +1870,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
 
                afs_extract_to_buf(call, 6 * sizeof(__be32));
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 5:
                ret = afs_extract_data(call, false);
@@ -1974,7 +1974,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data length */
        case 1:
@@ -1992,7 +1992,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)
                acl->size = call->count2;
                afs_extract_begin(call, acl->data, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data */
        case 2:
@@ -2002,7 +2002,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)
 
                afs_extract_to_buf(call, (21 + 6) * 4);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the metadata */
        case 3:
index 792ac711985eb5464d692d5946a3716c67390604..18042b7dab6a8791e3f0b9d1abb2de61b71cccc3 100644 (file)
@@ -401,22 +401,24 @@ struct afs_vlserver {
 #define AFS_VLSERVER_FL_PROBED 0               /* The VL server has been probed */
 #define AFS_VLSERVER_FL_PROBING        1               /* VL server is being probed */
 #define AFS_VLSERVER_FL_IS_YFS 2               /* Server is YFS not AFS */
+#define AFS_VLSERVER_FL_RESPONDING 3           /* VL server is responding */
        rwlock_t                lock;           /* Lock on addresses */
        atomic_t                usage;
+       unsigned int            rtt;            /* Server's current RTT in uS */
 
        /* Probe state */
        wait_queue_head_t       probe_wq;
        atomic_t                probe_outstanding;
        spinlock_t              probe_lock;
        struct {
-               unsigned int    rtt;            /* RTT as ktime/64 */
+               unsigned int    rtt;            /* RTT in uS */
                u32             abort_code;
                short           error;
-               bool            have_result;
-               bool            responded:1;
-               bool            is_yfs:1;
-               bool            not_yfs:1;
-               bool            local_failure:1;
+               unsigned short  flags;
+#define AFS_VLSERVER_PROBE_RESPONDED           0x01 /* At least once response (may be abort) */
+#define AFS_VLSERVER_PROBE_IS_YFS              0x02 /* The peer appears to be YFS */
+#define AFS_VLSERVER_PROBE_NOT_YFS             0x04 /* The peer appears not to be YFS */
+#define AFS_VLSERVER_PROBE_LOCAL_FAILURE       0x08 /* A local failure prevented a probe */
        } probe;
 
        u16                     port;
index 5334f1bd2bca7cdca9c97648e571375a7bd1d558..1d1a8debe4723e4b0d5a69e892cd4389f07ef1c8 100644 (file)
@@ -120,42 +120,42 @@ void afs_prioritise_error(struct afs_error *e, int error, u32 abort_code)
                if (e->error == -ETIMEDOUT ||
                    e->error == -ETIME)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ETIMEDOUT:
        case -ETIME:
                if (e->error == -ENOMEM ||
                    e->error == -ENONET)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ENOMEM:
        case -ENONET:
                if (e->error == -ERFKILL)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ERFKILL:
                if (e->error == -EADDRNOTAVAIL)
                        return;
-               /* Fall through */
+               fallthrough;
        case -EADDRNOTAVAIL:
                if (e->error == -ENETUNREACH)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ENETUNREACH:
                if (e->error == -EHOSTUNREACH)
                        return;
-               /* Fall through */
+               fallthrough;
        case -EHOSTUNREACH:
                if (e->error == -EHOSTDOWN)
                        return;
-               /* Fall through */
+               fallthrough;
        case -EHOSTDOWN:
                if (e->error == -ECONNREFUSED)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ECONNREFUSED:
                if (e->error == -ECONNRESET)
                        return;
-               /* Fall through */
+               fallthrough;
        case -ECONNRESET: /* Responded, but call expired. */
                if (e->responded)
                        return;
index e817fc740ba019bfb27b1e6d9af5a538f1152d79..e8babb62ed44230d2a9de5dc6db3ad0b50bc8710 100644 (file)
@@ -310,6 +310,11 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
                                   alist->preferred == i ? '>' : '-',
                                   &alist->addrs[i].transport);
        }
+       seq_printf(m, " info: fl=%lx rtt=%d\n", vlserver->flags, vlserver->rtt);
+       seq_printf(m, " probe: fl=%x e=%d ac=%d out=%d\n",
+                  vlserver->probe.flags, vlserver->probe.error,
+                  vlserver->probe.abort_code,
+                  atomic_read(&vlserver->probe_outstanding));
        return 0;
 }
 
index 6a0935cb822f3a5e2c65af9e1106ba2757f9efbc..d83f13c44b9213878ddb20ad4c914152994565d5 100644 (file)
@@ -281,7 +281,7 @@ bool afs_select_fileserver(struct afs_operation *op)
        case -ETIME:
                if (op->error != -EDESTADDRREQ)
                        goto iterate_address;
-               /* Fall through */
+               fallthrough;
        case -ERFKILL:
        case -EADDRNOTAVAIL:
        case -ENETUNREACH:
index 8fc8fb406a5a2b26c73995db2e4670709292670b..8be709cb8542aab247fb390063a51bef8eb8849c 100644 (file)
@@ -568,7 +568,7 @@ static void afs_deliver_to_call(struct afs_call *call)
                case -EIO:
                        pr_err("kAFS: Call %u in bad state %u\n",
                               call->debug_id, state);
-                       /* Fall through */
+                       fallthrough;
                case -ENODATA:
                case -EBADMSG:
                case -EMSGSIZE:
@@ -669,7 +669,7 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
                ret = call->ret0;
                call->ret0 = 0;
 
-               /* Fall through */
+               fallthrough;
        case -ECONNABORTED:
                ac->responded = true;
                break;
@@ -872,7 +872,7 @@ void afs_send_empty_reply(struct afs_call *call)
                _debug("oom");
                rxrpc_kernel_abort_call(net->socket, call->rxcall,
                                        RX_USER_ABORT, -ENOMEM, "KOO");
-               /* Fall through */
+               fallthrough;
        default:
                _leave(" [error]");
                return;
index 8fea54eba0c2b2c76f2cb0717b0be67ecad6a6cd..38b2ba1d9ec0dfb3d5e98ad3ab3623089a6425db 100644 (file)
@@ -21,6 +21,7 @@ struct afs_vlserver *afs_alloc_vlserver(const char *name, size_t name_len,
                rwlock_init(&vlserver->lock);
                init_waitqueue_head(&vlserver->probe_wq);
                spin_lock_init(&vlserver->probe_lock);
+               vlserver->rtt = UINT_MAX;
                vlserver->name_len = name_len;
                vlserver->port = port;
                memcpy(vlserver->name, name, name_len);
index e3aa013c21779241e399014b504a3978e5fe7c35..d1c7068b4346f409d954d5d3ecc4ef28cc9e00e5 100644 (file)
 #include "internal.h"
 #include "protocol_yfs.h"
 
-static bool afs_vl_probe_done(struct afs_vlserver *server)
+
+/*
+ * Handle the completion of a set of probes.
+ */
+static void afs_finished_vl_probe(struct afs_vlserver *server)
 {
-       if (!atomic_dec_and_test(&server->probe_outstanding))
-               return false;
+       if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)) {
+               server->rtt = UINT_MAX;
+               clear_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags);
+       }
 
-       wake_up_var(&server->probe_outstanding);
        clear_bit_unlock(AFS_VLSERVER_FL_PROBING, &server->flags);
        wake_up_bit(&server->flags, AFS_VLSERVER_FL_PROBING);
-       return true;
+}
+
+/*
+ * Handle the completion of a probe RPC call.
+ */
+static void afs_done_one_vl_probe(struct afs_vlserver *server, bool wake_up)
+{
+       if (atomic_dec_and_test(&server->probe_outstanding)) {
+               afs_finished_vl_probe(server);
+               wake_up = true;
+       }
+
+       if (wake_up)
+               wake_up_all(&server->probe_wq);
 }
 
 /*
@@ -45,15 +63,20 @@ void afs_vlserver_probe_result(struct afs_call *call)
                server->probe.error = 0;
                goto responded;
        case -ECONNABORTED:
-               if (!server->probe.responded) {
+               if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)) {
                        server->probe.abort_code = call->abort_code;
                        server->probe.error = ret;
                }
                goto responded;
        case -ENOMEM:
        case -ENONET:
-               server->probe.local_failure = true;
-               afs_io_error(call, afs_io_error_vl_probe_fail);
+       case -EKEYEXPIRED:
+       case -EKEYREVOKED:
+       case -EKEYREJECTED:
+               server->probe.flags |= AFS_VLSERVER_PROBE_LOCAL_FAILURE;
+               if (server->probe.error == 0)
+                       server->probe.error = ret;
+               trace_afs_io_error(call->debug_id, ret, afs_io_error_vl_probe_fail);
                goto out;
        case -ECONNRESET: /* Responded, but call expired. */
        case -ERFKILL:
@@ -67,12 +90,12 @@ void afs_vlserver_probe_result(struct afs_call *call)
        default:
                clear_bit(index, &alist->responded);
                set_bit(index, &alist->failed);
-               if (!server->probe.responded &&
+               if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) &&
                    (server->probe.error == 0 ||
                     server->probe.error == -ETIMEDOUT ||
                     server->probe.error == -ETIME))
                        server->probe.error = ret;
-               afs_io_error(call, afs_io_error_vl_probe_fail);
+               trace_afs_io_error(call->debug_id, ret, afs_io_error_vl_probe_fail);
                goto out;
        }
 
@@ -81,39 +104,36 @@ responded:
        clear_bit(index, &alist->failed);
 
        if (call->service_id == YFS_VL_SERVICE) {
-               server->probe.is_yfs = true;
+               server->probe.flags |= AFS_VLSERVER_PROBE_IS_YFS;
                set_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags);
                alist->addrs[index].srx_service = call->service_id;
        } else {
-               server->probe.not_yfs = true;
-               if (!server->probe.is_yfs) {
+               server->probe.flags |= AFS_VLSERVER_PROBE_NOT_YFS;
+               if (!(server->probe.flags & AFS_VLSERVER_PROBE_IS_YFS)) {
                        clear_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags);
                        alist->addrs[index].srx_service = call->service_id;
                }
        }
 
-       rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
-       if (rtt_us < server->probe.rtt) {
+       if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) &&
+           rtt_us < server->probe.rtt) {
                server->probe.rtt = rtt_us;
+               server->rtt = rtt_us;
                alist->preferred = index;
-               have_result = true;
        }
 
        smp_wmb(); /* Set rtt before responded. */
-       server->probe.responded = true;
+       server->probe.flags |= AFS_VLSERVER_PROBE_RESPONDED;
        set_bit(AFS_VLSERVER_FL_PROBED, &server->flags);
+       set_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags);
+       have_result = true;
 out:
        spin_unlock(&server->probe_lock);
 
        _debug("probe [%u][%u] %pISpc rtt=%u ret=%d",
               server_index, index, &alist->addrs[index].transport, rtt_us, ret);
 
-       have_result |= afs_vl_probe_done(server);
-       if (have_result) {
-               server->probe.have_result = true;
-               wake_up_var(&server->probe.have_result);
-               wake_up_all(&server->probe_wq);
-       }
+       afs_done_one_vl_probe(server, have_result);
 }
 
 /*
@@ -151,11 +171,10 @@ static bool afs_do_probe_vlserver(struct afs_net *net,
                        in_progress = true;
                } else {
                        afs_prioritise_error(_e, PTR_ERR(call), ac.abort_code);
+                       afs_done_one_vl_probe(server, false);
                }
        }
 
-       if (!in_progress)
-               afs_vl_probe_done(server);
        return in_progress;
 }
 
@@ -193,7 +212,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist,
 {
        struct wait_queue_entry *waits;
        struct afs_vlserver *server;
-       unsigned int rtt = UINT_MAX;
+       unsigned int rtt = UINT_MAX, rtt_s;
        bool have_responders = false;
        int pref = -1, i;
 
@@ -205,7 +224,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist,
                        server = vllist->servers[i].server;
                        if (!test_bit(AFS_VLSERVER_FL_PROBING, &server->flags))
                                __clear_bit(i, &untried);
-                       if (server->probe.responded)
+                       if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)
                                have_responders = true;
                }
        }
@@ -231,7 +250,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist,
                for (i = 0; i < vllist->nr_servers; i++) {
                        if (test_bit(i, &untried)) {
                                server = vllist->servers[i].server;
-                               if (server->probe.responded)
+                               if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)
                                        goto stop;
                                if (test_bit(AFS_VLSERVER_FL_PROBING, &server->flags))
                                        still_probing = true;
@@ -249,10 +268,11 @@ stop:
        for (i = 0; i < vllist->nr_servers; i++) {
                if (test_bit(i, &untried)) {
                        server = vllist->servers[i].server;
-                       if (server->probe.responded &&
-                           server->probe.rtt < rtt) {
+                       rtt_s = READ_ONCE(server->rtt);
+                       if (test_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags) &&
+                           rtt_s < rtt) {
                                pref = i;
-                               rtt = server->probe.rtt;
+                               rtt = rtt_s;
                        }
 
                        remove_wait_queue(&server->probe_wq, &waits[i]);
index f405ca8b240a5ba7639361a1e55d7fad2b6c845b..c0458c903b310e630e9fe907a780785382cc0bf5 100644 (file)
@@ -192,7 +192,8 @@ pick_server:
        for (i = 0; i < vc->server_list->nr_servers; i++) {
                struct afs_vlserver *s = vc->server_list->servers[i].server;
 
-               if (!test_bit(i, &vc->untried) || !s->probe.responded)
+               if (!test_bit(i, &vc->untried) ||
+                   !test_bit(AFS_VLSERVER_FL_RESPONDING, &s->flags))
                        continue;
                if (s->probe.rtt < rtt) {
                        vc->index = i;
@@ -262,10 +263,14 @@ no_more_servers:
        for (i = 0; i < vc->server_list->nr_servers; i++) {
                struct afs_vlserver *s = vc->server_list->servers[i].server;
 
+               if (test_bit(AFS_VLSERVER_FL_RESPONDING, &s->flags))
+                       e.responded = true;
                afs_prioritise_error(&e, READ_ONCE(s->probe.error),
                                     s->probe.abort_code);
        }
 
+       error = e.error;
+
 failed_set_error:
        vc->error = error;
 failed:
index fd82850cd4244efa5e4daa77d496d7952eca43b4..dc9327332f069067fe1204cab325916054e060bf 100644 (file)
@@ -196,7 +196,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call)
 
                /* Extract the returned uuid, uniquifier, nentries and
                 * blkaddrs size */
-               /* Fall through */
+               fallthrough;
        case 1:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -221,7 +221,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call)
                count = min(call->count, 4U);
                afs_extract_to_buf(call, count * sizeof(__be32));
 
-               /* Fall through - and extract entries */
+               fallthrough;    /* and extract entries */
        case 2:
                ret = afs_extract_data(call, call->count > 4);
                if (ret < 0)
@@ -324,7 +324,7 @@ static int afs_deliver_vl_get_capabilities(struct afs_call *call)
                afs_extract_to_tmp(call);
                call->unmarshall++;
 
-               /* Fall through - and extract the capabilities word count */
+               fallthrough;    /* and extract the capabilities word count */
        case 1:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -337,7 +337,7 @@ static int afs_deliver_vl_get_capabilities(struct afs_call *call)
                call->unmarshall++;
                afs_extract_discard(call, count * sizeof(__be32));
 
-               /* Fall through - and extract capabilities words */
+               fallthrough;    /* and extract capabilities words */
        case 2:
                ret = afs_extract_data(call, false);
                if (ret < 0)
@@ -436,7 +436,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                /* Extract the returned uuid, uniquifier, fsEndpoints count and
                 * either the first fsEndpoint type or the volEndpoints
                 * count if there are no fsEndpoints. */
-               /* Fall through */
+               fallthrough;
        case 1:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -475,7 +475,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                afs_extract_to_buf(call, size);
                call->unmarshall = 2;
 
-               /* Fall through - and extract fsEndpoints[] entries */
+               fallthrough;    /* and extract fsEndpoints[] entries */
        case 2:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -526,7 +526,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                 * extract the type of the next endpoint when we extract the
                 * data of the current one, but this is the first...
                 */
-               /* Fall through */
+               fallthrough;
        case 3:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -552,7 +552,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                afs_extract_to_buf(call, size);
                call->unmarshall = 4;
 
-               /* Fall through - and extract volEndpoints[] entries */
+               fallthrough;    /* and extract volEndpoints[] entries */
        case 4:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -587,7 +587,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call)
                afs_extract_discard(call, 0);
                call->unmarshall = 5;
 
-               /* Fall through - Done */
+               fallthrough;    /* Done */
        case 5:
                ret = afs_extract_data(call, false);
                if (ret < 0)
@@ -663,7 +663,7 @@ static int afs_deliver_yfsvl_get_cell_name(struct afs_call *call)
                afs_extract_to_tmp(call);
                call->unmarshall++;
 
-               /* Fall through - and extract the cell name length */
+               fallthrough;    /* and extract the cell name length */
        case 1:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -685,7 +685,7 @@ static int afs_deliver_yfsvl_get_cell_name(struct afs_call *call)
                afs_extract_begin(call, cell_name, namesz);
                call->unmarshall++;
 
-               /* Fall through - and extract cell name */
+               fallthrough;    /* and extract cell name */
        case 2:
                ret = afs_extract_data(call, true);
                if (ret < 0)
@@ -694,7 +694,7 @@ static int afs_deliver_yfsvl_get_cell_name(struct afs_call *call)
                afs_extract_discard(call, call->count2);
                call->unmarshall++;
 
-               /* Fall through - and extract padding */
+               fallthrough;    /* and extract padding */
        case 3:
                ret = afs_extract_data(call, false);
                if (ret < 0)
index a121c247d95a3d63757cfd9e30557c41faa542e2..4b2265cb18917b5e28078b9b61ca098fab6139a8 100644 (file)
@@ -609,7 +609,7 @@ no_more:
 
        default:
                pr_notice("kAFS: Unexpected error from FS.StoreData %d\n", ret);
-               /* Fall through */
+               fallthrough;
        case -EACCES:
        case -EPERM:
        case -ENOKEY:
index 8c24fdc899e378bc63b77272902c33c9dbad2eea..3b1239b7e90d8cffaa957e30a507dad2b8174afd 100644 (file)
@@ -373,7 +373,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                req->offset = req->pos & (PAGE_SIZE - 1);
                afs_extract_to_tmp64(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data length */
        case 1:
@@ -401,7 +401,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                call->bvec[0].bv_page = req->pages[req->index];
                iov_iter_bvec(&call->def_iter, READ, call->bvec, 1, size);
                ASSERTCMP(size, <=, PAGE_SIZE);
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned data */
        case 2:
@@ -428,7 +428,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                /* Discard any excess data the server gave us */
                afs_extract_discard(call, req->actual_len - req->len);
                call->unmarshall = 3;
-               /* Fall through */
+               fallthrough;
 
        case 3:
                _debug("extract discard %zu/%llu",
@@ -444,7 +444,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                                   sizeof(struct yfs_xdr_YFSFetchStatus) +
                                   sizeof(struct yfs_xdr_YFSCallBack) +
                                   sizeof(struct yfs_xdr_YFSVolSync));
-               /* Fall through */
+               fallthrough;
 
                /* extract the metadata */
        case 4:
@@ -461,7 +461,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call)
                req->file_size = vp->scb.status.size;
 
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 5:
                break;
@@ -1262,7 +1262,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
        case 0:
                call->unmarshall++;
                afs_extract_to_buf(call, sizeof(struct yfs_xdr_YFSFetchVolumeStatus));
-               /* Fall through */
+               fallthrough;
 
                /* extract the returned status record */
        case 1:
@@ -1275,7 +1275,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                xdr_decode_YFSFetchVolumeStatus(&bp, &op->volstatus.vs);
                call->unmarshall++;
                afs_extract_to_tmp(call);
-               /* Fall through */
+               fallthrough;
 
                /* extract the volume name length */
        case 2:
@@ -1290,7 +1290,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the volume name */
        case 3:
@@ -1304,7 +1304,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                _debug("volname '%s'", p);
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the offline message length */
        case 4:
@@ -1319,7 +1319,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the offline message */
        case 5:
@@ -1334,7 +1334,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
 
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the message of the day length */
        case 6:
@@ -1349,7 +1349,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                size = (call->count + 3) & ~3; /* It's padded */
                afs_extract_to_buf(call, size);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the message of the day */
        case 7:
@@ -1363,7 +1363,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call)
                _debug("motd '%s'", p);
 
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 8:
                break;
@@ -1622,7 +1622,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the file status count and array in two steps */
        case 1:
@@ -1640,7 +1640,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->unmarshall++;
        more_counts:
                afs_extract_to_buf(call, sizeof(struct yfs_xdr_YFSFetchStatus));
-               /* Fall through */
+               fallthrough;
 
        case 2:
                _debug("extract status array %u", call->count);
@@ -1670,7 +1670,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->count = 0;
                call->unmarshall++;
                afs_extract_to_tmp(call);
-               /* Fall through */
+               fallthrough;
 
                /* Extract the callback count and array in two steps */
        case 3:
@@ -1687,7 +1687,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                call->unmarshall++;
        more_cbs:
                afs_extract_to_buf(call, sizeof(struct yfs_xdr_YFSCallBack));
-               /* Fall through */
+               fallthrough;
 
        case 4:
                _debug("extract CB array");
@@ -1716,7 +1716,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
 
                afs_extract_to_buf(call, sizeof(struct yfs_xdr_YFSVolSync));
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 5:
                ret = afs_extract_data(call, false);
@@ -1727,7 +1727,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
                xdr_decode_YFSVolSync(&bp, &op->volsync);
 
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 6:
                break;
@@ -1804,7 +1804,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
        case 0:
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the file ACL length */
        case 1:
@@ -1826,7 +1826,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
                        afs_extract_discard(call, size);
                }
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the file ACL */
        case 2:
@@ -1836,7 +1836,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
 
                afs_extract_to_tmp(call);
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the volume ACL length */
        case 3:
@@ -1858,7 +1858,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
                        afs_extract_discard(call, size);
                }
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* Extract the volume ACL */
        case 4:
@@ -1871,7 +1871,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
                                   sizeof(struct yfs_xdr_YFSFetchStatus) +
                                   sizeof(struct yfs_xdr_YFSVolSync));
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
                /* extract the metadata */
        case 5:
@@ -1886,7 +1886,7 @@ static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call)
                xdr_decode_YFSVolSync(&bp, &op->volsync);
 
                call->unmarshall++;
-               /* Fall through */
+               fallthrough;
 
        case 6:
                break;
index 5736bff48e9e9cbfacd9fbbe4738d0643c90e067..d5ec303855669de4e90d7b810c73333d089486fb 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1511,7 +1511,7 @@ static inline void aio_rw_done(struct kiocb *req, ssize_t ret)
                 * may be already running. Just fail this IO with EINTR.
                 */
                ret = -EINTR;
-               /*FALLTHRU*/
+               fallthrough;
        default:
                req->ki_complete(req, ret, 0);
        }
index 74c886f7c51cbe25334d38a9c57fcb2695f05bd4..5ced859dac5396b47b4bf78fc1599e501cc8a135 100644 (file)
@@ -53,7 +53,7 @@ static int autofs_write(struct autofs_sb_info *sbi,
 
        mutex_lock(&sbi->pipe_mutex);
        while (bytes) {
-               wr = kernel_write(file, data, bytes, &file->f_pos);
+               wr = __kernel_write(file, data, bytes, NULL);
                if (wr <= 0)
                        break;
                data += wr;
index f2f9086ebe983269b1611ccaaf9a764f29ab4209..b9c658e0548eb85328be7efcd7285accecbe6535 100644 (file)
@@ -576,7 +576,7 @@ static int load_flat_file(struct linux_binprm *bprm,
                        goto err;
                }
 
-               len = data_len + extra;
+               len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
                len = PAGE_ALIGN(len);
                realdatastart = vm_mmap(NULL, 0, len,
                        PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
@@ -590,7 +590,9 @@ static int load_flat_file(struct linux_binprm *bprm,
                        vm_munmap(textpos, text_len);
                        goto err;
                }
-               datapos = ALIGN(realdatastart, FLAT_DATA_ALIGN);
+               datapos = ALIGN(realdatastart +
+                               MAX_SHARED_LIBS * sizeof(unsigned long),
+                               FLAT_DATA_ALIGN);
 
                pr_debug("Allocated data+bss+stack (%u bytes): %lx\n",
                         data_len + bss_len + stack_len, datapos);
@@ -620,7 +622,7 @@ static int load_flat_file(struct linux_binprm *bprm,
                memp_size = len;
        } else {
 
-               len = text_len + data_len + extra;
+               len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(u32);
                len = PAGE_ALIGN(len);
                textpos = vm_mmap(NULL, 0, len,
                        PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
@@ -635,7 +637,9 @@ static int load_flat_file(struct linux_binprm *bprm,
                }
 
                realdatastart = textpos + ntohl(hdr->data_start);
-               datapos = ALIGN(realdatastart, FLAT_DATA_ALIGN);
+               datapos = ALIGN(realdatastart +
+                               MAX_SHARED_LIBS * sizeof(u32),
+                               FLAT_DATA_ALIGN);
 
                reloc = (__be32 __user *)
                        (datapos + (ntohl(hdr->reloc_start) - text_len));
@@ -652,9 +656,8 @@ static int load_flat_file(struct linux_binprm *bprm,
                                         (text_len + full_data
                                                  - sizeof(struct flat_hdr)),
                                         0);
-                       if (datapos != realdatastart)
-                               memmove((void *)datapos, (void *)realdatastart,
-                                               full_data);
+                       memmove((void *) datapos, (void *) realdatastart,
+                                       full_data);
 #else
                        /*
                         * This is used on MMU systems mainly for testing.
@@ -710,7 +713,8 @@ static int load_flat_file(struct linux_binprm *bprm,
                if (IS_ERR_VALUE(result)) {
                        ret = result;
                        pr_err("Unable to read code+data+bss, errno %d\n", ret);
-                       vm_munmap(textpos, text_len + data_len + extra);
+                       vm_munmap(textpos, text_len + data_len + extra +
+                               MAX_SHARED_LIBS * sizeof(u32));
                        goto err;
                }
        }
index 613920c17ac1ae0e153262210cc5c8c05f5d3770..ea8aaf36647eeae682c89f2c70b9207922002ff2 100644 (file)
@@ -1798,7 +1798,6 @@ static struct btrfs_block_group *btrfs_create_block_group_cache(
 
        cache->fs_info = fs_info;
        cache->full_stripe_len = btrfs_full_stripe_len(fs_info, start);
-       set_free_space_tree_thresholds(cache);
 
        cache->discard_index = BTRFS_DISCARD_INDEX_UNUSED;
 
@@ -1912,6 +1911,8 @@ static int read_one_block_group(struct btrfs_fs_info *info,
        if (ret < 0)
                goto error;
 
+       set_free_space_tree_thresholds(cache);
+
        if (need_clear) {
                /*
                 * When we mount with old space cache, we need to
@@ -2132,6 +2133,7 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used,
                return -ENOMEM;
 
        cache->length = size;
+       set_free_space_tree_thresholds(cache);
        cache->used = bytes_used;
        cache->flags = type;
        cache->last_byte_to_unpin = (u64)-1;
index 70e49d8d4f6c3154e53b217a76c3dd6396725691..cd392da69b8190a69071e041e7802452fa7588f4 100644 (file)
@@ -68,7 +68,7 @@ const char *btrfs_super_csum_driver(u16 csum_type)
                btrfs_csums[csum_type].name;
 }
 
-size_t __const btrfs_get_num_csums(void)
+size_t __attribute_const__ btrfs_get_num_csums(void)
 {
        return ARRAY_SIZE(btrfs_csums);
 }
@@ -1297,6 +1297,8 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
        btrfs_tree_read_unlock_blocking(eb);
        free_extent_buffer(eb);
 
+       btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb_rewin),
+                                      eb_rewin, btrfs_header_level(eb_rewin));
        btrfs_tree_read_lock(eb_rewin);
        __tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm);
        WARN_ON(btrfs_header_nritems(eb_rewin) >
@@ -1370,7 +1372,6 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
 
        if (!eb)
                return NULL;
-       btrfs_tree_read_lock(eb);
        if (old_root) {
                btrfs_set_header_bytenr(eb, eb->start);
                btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV);
@@ -1378,6 +1379,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
                btrfs_set_header_level(eb, old_root->level);
                btrfs_set_header_generation(eb, old_generation);
        }
+       btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb), eb,
+                                      btrfs_header_level(eb));
+       btrfs_tree_read_lock(eb);
        if (tm)
                __tree_mod_log_rewind(fs_info, eb, time_seq, tm);
        else
index 9c7e466f27a9a366c8e3c9f8058581fa58ed0e11..9a72896bed2ee464140734188771a9b319c46b92 100644 (file)
@@ -2262,7 +2262,7 @@ BTRFS_SETGET_STACK_FUNCS(super_uuid_tree_generation, struct btrfs_super_block,
 int btrfs_super_csum_size(const struct btrfs_super_block *s);
 const char *btrfs_super_csum_name(u16 csum_type);
 const char *btrfs_super_csum_driver(u16 csum_type);
-size_t __const btrfs_get_num_csums(void);
+size_t __attribute_const__ btrfs_get_num_csums(void);
 
 
 /*
@@ -2518,7 +2518,7 @@ int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans,
                                    u64 bytenr, u64 num_bytes);
 int btrfs_exclude_logged_extents(struct extent_buffer *eb);
 int btrfs_cross_ref_exist(struct btrfs_root *root,
-                         u64 objectid, u64 offset, u64 bytenr);
+                         u64 objectid, u64 offset, u64 bytenr, bool strict);
 struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
                                             struct btrfs_root *root,
                                             u64 parent, u64 root_objectid,
@@ -2934,7 +2934,7 @@ struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
                                           u64 start, u64 len);
 noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
                              u64 *orig_start, u64 *orig_block_len,
-                             u64 *ram_bytes);
+                             u64 *ram_bytes, bool strict);
 
 void __btrfs_del_delalloc_inode(struct btrfs_root *root,
                                struct btrfs_inode *inode);
index 9ae25f6321579da3b0a982333c848d38d6336e39..9f72b092bc2281c95f45a5f73cff86c14b26c0e7 100644 (file)
@@ -636,16 +636,15 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
        csum_tree_block(eb, result);
 
        if (memcmp_extent_buffer(eb, result, 0, csum_size)) {
-               u32 val;
-               u32 found = 0;
-
-               memcpy(&found, result, csum_size);
+               u8 val[BTRFS_CSUM_SIZE] = { 0 };
 
                read_extent_buffer(eb, &val, 0, csum_size);
                btrfs_warn_rl(fs_info,
-               "%s checksum verify failed on %llu wanted %x found %x level %d",
+       "%s checksum verify failed on %llu wanted " CSUM_FMT " found " CSUM_FMT " level %d",
                              fs_info->sb->s_id, eb->start,
-                             val, found, btrfs_header_level(eb));
+                             CSUM_FMT_VALUE(csum_size, val),
+                             CSUM_FMT_VALUE(csum_size, result),
+                             btrfs_header_level(eb));
                ret = -EUCLEAN;
                goto err;
        }
@@ -3418,6 +3417,8 @@ fail_block_groups:
        btrfs_put_block_group_cache(fs_info);
 
 fail_tree_roots:
+       if (fs_info->data_reloc_root)
+               btrfs_drop_and_free_fs_root(fs_info, fs_info->data_reloc_root);
        free_root_pointers(fs_info, true);
        invalidate_inode_pages2(fs_info->btree_inode->i_mapping);
 
@@ -4551,6 +4552,7 @@ static void btrfs_cleanup_bg_io(struct btrfs_block_group *cache)
                cache->io_ctl.inode = NULL;
                iput(inode);
        }
+       ASSERT(cache->io_ctl.pages == NULL);
        btrfs_put_block_group(cache);
 }
 
index de6fe176fdfb3400c4b0786c9b032f972069d20e..780b9c9a98fe37ae4bed0c93abf3ae414026c1dd 100644 (file)
@@ -400,12 +400,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb,
                        if (type == BTRFS_SHARED_BLOCK_REF_KEY) {
                                ASSERT(eb->fs_info);
                                /*
-                                * Every shared one has parent tree
-                                * block, which must be aligned to
-                                * nodesize.
+                                * Every shared one has parent tree block,
+                                * which must be aligned to sector size.
                                 */
                                if (offset &&
-                                   IS_ALIGNED(offset, eb->fs_info->nodesize))
+                                   IS_ALIGNED(offset, eb->fs_info->sectorsize))
                                        return type;
                        }
                } else if (is_data == BTRFS_REF_TYPE_DATA) {
@@ -414,12 +413,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb,
                        if (type == BTRFS_SHARED_DATA_REF_KEY) {
                                ASSERT(eb->fs_info);
                                /*
-                                * Every shared one has parent tree
-                                * block, which must be aligned to
-                                * nodesize.
+                                * Every shared one has parent tree block,
+                                * which must be aligned to sector size.
                                 */
                                if (offset &&
-                                   IS_ALIGNED(offset, eb->fs_info->nodesize))
+                                   IS_ALIGNED(offset, eb->fs_info->sectorsize))
                                        return type;
                        }
                } else {
@@ -429,8 +427,9 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb,
        }
 
        btrfs_print_leaf((struct extent_buffer *)eb);
-       btrfs_err(eb->fs_info, "eb %llu invalid extent inline ref type %d",
-                 eb->start, type);
+       btrfs_err(eb->fs_info,
+                 "eb %llu iref 0x%lx invalid extent inline ref type %d",
+                 eb->start, (unsigned long)iref, type);
        WARN_ON(1);
 
        return BTRFS_REF_TYPE_INVALID;
@@ -2306,7 +2305,8 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
 
 static noinline int check_committed_ref(struct btrfs_root *root,
                                        struct btrfs_path *path,
-                                       u64 objectid, u64 offset, u64 bytenr)
+                                       u64 objectid, u64 offset, u64 bytenr,
+                                       bool strict)
 {
        struct btrfs_fs_info *fs_info = root->fs_info;
        struct btrfs_root *extent_root = fs_info->extent_root;
@@ -2348,9 +2348,13 @@ static noinline int check_committed_ref(struct btrfs_root *root,
            btrfs_extent_inline_ref_size(BTRFS_EXTENT_DATA_REF_KEY))
                goto out;
 
-       /* If extent created before last snapshot => it's definitely shared */
-       if (btrfs_extent_generation(leaf, ei) <=
-           btrfs_root_last_snapshot(&root->root_item))
+       /*
+        * If extent created before last snapshot => it's shared unless the
+        * snapshot has been deleted. Use the heuristic if strict is false.
+        */
+       if (!strict &&
+           (btrfs_extent_generation(leaf, ei) <=
+            btrfs_root_last_snapshot(&root->root_item)))
                goto out;
 
        iref = (struct btrfs_extent_inline_ref *)(ei + 1);
@@ -2375,7 +2379,7 @@ out:
 }
 
 int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset,
-                         u64 bytenr)
+                         u64 bytenr, bool strict)
 {
        struct btrfs_path *path;
        int ret;
@@ -2386,7 +2390,7 @@ int btrfs_cross_ref_exist(struct btrfs_root *root, u64 objectid, u64 offset,
 
        do {
                ret = check_committed_ref(root, path, objectid,
-                                         offset, bytenr);
+                                         offset, bytenr, strict);
                if (ret && ret != -ENOENT)
                        goto out;
 
@@ -4522,7 +4526,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                return ERR_PTR(-EUCLEAN);
        }
 
-       btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level);
+       btrfs_set_buffer_lockdep_class(owner, buf, level);
        btrfs_tree_lock(buf);
        btrfs_clean_tree_block(buf);
        clear_bit(EXTENT_BUFFER_STALE, &buf->bflags);
index 6def411b2ebad7f506cff6b91e2dc9d4c2a0eacf..a940edb1e64f2e0f895af5a3defaafcfc47b90e3 100644 (file)
@@ -5655,9 +5655,9 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dstv,
        }
 }
 
-int read_extent_buffer_to_user(const struct extent_buffer *eb,
-                              void __user *dstv,
-                              unsigned long start, unsigned long len)
+int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb,
+                                      void __user *dstv,
+                                      unsigned long start, unsigned long len)
 {
        size_t cur;
        size_t offset;
@@ -5677,7 +5677,7 @@ int read_extent_buffer_to_user(const struct extent_buffer *eb,
 
                cur = min(len, (PAGE_SIZE - offset));
                kaddr = page_address(page);
-               if (copy_to_user(dst, kaddr + offset, cur)) {
+               if (copy_to_user_nofault(dst, kaddr + offset, cur)) {
                        ret = -EFAULT;
                        break;
                }
index 00a88f2eb5ab6d50301c0bbf116ad39921039e10..30794ae58498bbc50736796c1a233a297f193c76 100644 (file)
@@ -241,9 +241,9 @@ int memcmp_extent_buffer(const struct extent_buffer *eb, const void *ptrv,
 void read_extent_buffer(const struct extent_buffer *eb, void *dst,
                        unsigned long start,
                        unsigned long len);
-int read_extent_buffer_to_user(const struct extent_buffer *eb,
-                              void __user *dst, unsigned long start,
-                              unsigned long len);
+int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb,
+                                      void __user *dst, unsigned long start,
+                                      unsigned long len);
 void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *src);
 void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb,
                const void *src);
index bb824c7cb7c7d6adc32a10047c638ee7bc35fee2..4507c3d093994f26cac6386f415d632d6a0098a3 100644 (file)
@@ -1571,7 +1571,7 @@ static int check_can_nocow(struct btrfs_inode *inode, loff_t pos,
        }
 
        ret = can_nocow_extent(&inode->vfs_inode, lockstart, &num_bytes,
-                       NULL, NULL, NULL);
+                       NULL, NULL, NULL, false);
        if (ret <= 0) {
                ret = 0;
                if (!nowait)
index ef0fd7afb0b1e8f45674bfd94044aef24a7a2c57..dc82fd0c80cbbab11cabaec665f214074107cff9 100644 (file)
@@ -1186,7 +1186,6 @@ static int __btrfs_wait_cache_io(struct btrfs_root *root,
        ret = update_cache_item(trans, root, inode, path, offset,
                                io_ctl->entries, io_ctl->bitmaps);
 out:
-       io_ctl_free(io_ctl);
        if (ret) {
                invalidate_inode_pages2(inode->i_mapping);
                BTRFS_I(inode)->generation = 0;
@@ -1347,6 +1346,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
         * them out later
         */
        io_ctl_drop_pages(io_ctl);
+       io_ctl_free(io_ctl);
 
        unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0,
                             i_size_read(inode) - 1, &cached_state);
index 8b1f5c8897b750a6c740922e16833117d05ae3e2..6b9faf3b0e96763b897e941051c7c19ded93d2bc 100644 (file)
@@ -22,6 +22,10 @@ void set_free_space_tree_thresholds(struct btrfs_block_group *cache)
        size_t bitmap_size;
        u64 num_bitmaps, total_bitmap_size;
 
+       if (WARN_ON(cache->length == 0))
+               btrfs_warn(cache->fs_info, "block group %llu length is zero",
+                          cache->start);
+
        /*
         * We convert to bitmaps when the disk space required for using extents
         * exceeds that required for using bitmaps.
index 51fcd82d41c0ebec1fceb671dc23e40492941e6f..9570458aa8471dd4d442de81e2e3771f2823921e 100644 (file)
@@ -1610,7 +1610,7 @@ next_slot:
                                goto out_check;
                        ret = btrfs_cross_ref_exist(root, ino,
                                                    found_key.offset -
-                                                   extent_offset, disk_bytenr);
+                                                   extent_offset, disk_bytenr, false);
                        if (ret) {
                                /*
                                 * ret could be -EIO if the above fails to read
@@ -2161,11 +2161,8 @@ static blk_status_t btrfs_submit_bio_start(void *private_data, struct bio *bio,
                                    u64 bio_offset)
 {
        struct inode *inode = private_data;
-       blk_status_t ret = 0;
 
-       ret = btrfs_csum_one_bio(BTRFS_I(inode), bio, 0, 0);
-       BUG_ON(ret); /* -ENOMEM */
-       return 0;
+       return btrfs_csum_one_bio(BTRFS_I(inode), bio, 0, 0);
 }
 
 /*
@@ -6953,6 +6950,8 @@ static struct extent_map *btrfs_new_extent_direct(struct btrfs_inode *inode,
  * @orig_start:        (optional) Return the original file offset of the file extent
  * @orig_len:  (optional) Return the original on-disk length of the file extent
  * @ram_bytes: (optional) Return the ram_bytes of the file extent
+ * @strict:    if true, omit optimizations that might force us into unnecessary
+ *             cow. e.g., don't trust generation number.
  *
  * This function will flush ordered extents in the range to ensure proper
  * nocow checks for (nowait == false) case.
@@ -6967,7 +6966,7 @@ static struct extent_map *btrfs_new_extent_direct(struct btrfs_inode *inode,
  */
 noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
                              u64 *orig_start, u64 *orig_block_len,
-                             u64 *ram_bytes)
+                             u64 *ram_bytes, bool strict)
 {
        struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
        struct btrfs_path *path;
@@ -7045,8 +7044,9 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
         * Do the same check as in btrfs_cross_ref_exist but without the
         * unnecessary search.
         */
-       if (btrfs_file_extent_generation(leaf, fi) <=
-           btrfs_root_last_snapshot(&root->root_item))
+       if (!strict &&
+           (btrfs_file_extent_generation(leaf, fi) <=
+            btrfs_root_last_snapshot(&root->root_item)))
                goto out;
 
        backref_offset = btrfs_file_extent_offset(leaf, fi);
@@ -7082,7 +7082,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
         */
 
        ret = btrfs_cross_ref_exist(root, btrfs_ino(BTRFS_I(inode)),
-                                   key.offset - backref_offset, disk_bytenr);
+                                   key.offset - backref_offset, disk_bytenr,
+                                   strict);
        if (ret) {
                ret = 0;
                goto out;
@@ -7303,7 +7304,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map,
                block_start = em->block_start + (start - em->start);
 
                if (can_nocow_extent(inode, start, &len, &orig_start,
-                                    &orig_block_len, &ram_bytes) == 1 &&
+                                    &orig_block_len, &ram_bytes, false) == 1 &&
                    btrfs_inc_nocow_writers(fs_info, block_start)) {
                        struct extent_map *em2;
 
@@ -7619,10 +7620,8 @@ static blk_status_t btrfs_submit_bio_start_direct_io(void *private_data,
                                    struct bio *bio, u64 offset)
 {
        struct inode *inode = private_data;
-       blk_status_t ret;
-       ret = btrfs_csum_one_bio(BTRFS_I(inode), bio, offset, 1);
-       BUG_ON(ret); /* -ENOMEM */
-       return 0;
+
+       return btrfs_csum_one_bio(BTRFS_I(inode), bio, offset, 1);
 }
 
 static void btrfs_end_dio_bio(struct bio *bio)
@@ -10136,7 +10135,7 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file,
                free_extent_map(em);
                em = NULL;
 
-               ret = can_nocow_extent(inode, start, &len, NULL, NULL, NULL);
+               ret = can_nocow_extent(inode, start, &len, NULL, NULL, NULL, true);
                if (ret < 0) {
                        goto out;
                } else if (ret) {
index bd3511c5ca8126f837f95ddb8ca5a7b7ff763b44..2d9109d9e98f9dae41b29d2969cb9cc1345e26e5 100644 (file)
@@ -2086,9 +2086,14 @@ static noinline int copy_to_sk(struct btrfs_path *path,
                sh.len = item_len;
                sh.transid = found_transid;
 
-               /* copy search result header */
-               if (copy_to_user(ubuf + *sk_offset, &sh, sizeof(sh))) {
-                       ret = -EFAULT;
+               /*
+                * Copy search result header. If we fault then loop again so we
+                * can fault in the pages and -EFAULT there if there's a
+                * problem. Otherwise we'll fault and then copy the buffer in
+                * properly this next time through
+                */
+               if (copy_to_user_nofault(ubuf + *sk_offset, &sh, sizeof(sh))) {
+                       ret = 0;
                        goto out;
                }
 
@@ -2096,10 +2101,14 @@ static noinline int copy_to_sk(struct btrfs_path *path,
 
                if (item_len) {
                        char __user *up = ubuf + *sk_offset;
-                       /* copy the item */
-                       if (read_extent_buffer_to_user(leaf, up,
-                                                      item_off, item_len)) {
-                               ret = -EFAULT;
+                       /*
+                        * Copy the item, same behavior as above, but reset the
+                        * * sk_offset so we copy the full thing again.
+                        */
+                       if (read_extent_buffer_to_user_nofault(leaf, up,
+                                               item_off, item_len)) {
+                               ret = 0;
+                               *sk_offset -= sizeof(sh);
                                goto out;
                        }
 
@@ -2184,6 +2193,11 @@ static noinline int search_ioctl(struct inode *inode,
        key.offset = sk->min_offset;
 
        while (1) {
+               ret = fault_in_pages_writeable(ubuf + sk_offset,
+                                              *buf_size - sk_offset);
+               if (ret)
+                       break;
+
                ret = btrfs_search_forward(root, &key, path, sk->min_transid);
                if (ret != 0) {
                        if (ret > 0)
index 61f44e78e3c9e7a61efc48fb5bae1cd91206cf88..80567c11ec122dc06826c19797a589e63e4e7be9 100644 (file)
@@ -95,9 +95,10 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type)
                         * offset is supposed to be a tree block which
                         * must be aligned to nodesize.
                         */
-                       if (!IS_ALIGNED(offset, eb->fs_info->nodesize))
-                               pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n",
-                                       offset, (unsigned long long)eb->fs_info->nodesize);
+                       if (!IS_ALIGNED(offset, eb->fs_info->sectorsize))
+                               pr_info(
+                       "\t\t\t(parent %llu not aligned to sectorsize %u)\n",
+                                       offset, eb->fs_info->sectorsize);
                        break;
                case BTRFS_EXTENT_DATA_REF_KEY:
                        dref = (struct btrfs_extent_data_ref *)(&iref->offset);
@@ -112,8 +113,9 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type)
                         * must be aligned to nodesize.
                         */
                        if (!IS_ALIGNED(offset, eb->fs_info->nodesize))
-                               pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n",
-                                    offset, (unsigned long long)eb->fs_info->nodesize);
+                               pr_info(
+                       "\t\t\t(parent %llu not aligned to sectorsize %u)\n",
+                                    offset, eb->fs_info->sectorsize);
                        break;
                default:
                        pr_cont("(extent %llu has INVALID ref type %d)\n",
index 5a6cb9db512ebd0fd434792b58b63eb1195dacd5..354ab9985a3426b03ccafaa4fd2f1fb59a2629e0 100644 (file)
@@ -3716,50 +3716,84 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx,
        return 0;
 }
 
+static void scrub_workers_put(struct btrfs_fs_info *fs_info)
+{
+       if (refcount_dec_and_mutex_lock(&fs_info->scrub_workers_refcnt,
+                                       &fs_info->scrub_lock)) {
+               struct btrfs_workqueue *scrub_workers = NULL;
+               struct btrfs_workqueue *scrub_wr_comp = NULL;
+               struct btrfs_workqueue *scrub_parity = NULL;
+
+               scrub_workers = fs_info->scrub_workers;
+               scrub_wr_comp = fs_info->scrub_wr_completion_workers;
+               scrub_parity = fs_info->scrub_parity_workers;
+
+               fs_info->scrub_workers = NULL;
+               fs_info->scrub_wr_completion_workers = NULL;
+               fs_info->scrub_parity_workers = NULL;
+               mutex_unlock(&fs_info->scrub_lock);
+
+               btrfs_destroy_workqueue(scrub_workers);
+               btrfs_destroy_workqueue(scrub_wr_comp);
+               btrfs_destroy_workqueue(scrub_parity);
+       }
+}
+
 /*
  * get a reference count on fs_info->scrub_workers. start worker if necessary
  */
 static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info,
                                                int is_dev_replace)
 {
+       struct btrfs_workqueue *scrub_workers = NULL;
+       struct btrfs_workqueue *scrub_wr_comp = NULL;
+       struct btrfs_workqueue *scrub_parity = NULL;
        unsigned int flags = WQ_FREEZABLE | WQ_UNBOUND;
        int max_active = fs_info->thread_pool_size;
+       int ret = -ENOMEM;
 
-       lockdep_assert_held(&fs_info->scrub_lock);
+       if (refcount_inc_not_zero(&fs_info->scrub_workers_refcnt))
+               return 0;
 
-       if (refcount_read(&fs_info->scrub_workers_refcnt) == 0) {
-               ASSERT(fs_info->scrub_workers == NULL);
-               fs_info->scrub_workers = btrfs_alloc_workqueue(fs_info, "scrub",
-                               flags, is_dev_replace ? 1 : max_active, 4);
-               if (!fs_info->scrub_workers)
-                       goto fail_scrub_workers;
-
-               ASSERT(fs_info->scrub_wr_completion_workers == NULL);
-               fs_info->scrub_wr_completion_workers =
-                       btrfs_alloc_workqueue(fs_info, "scrubwrc", flags,
-                                             max_active, 2);
-               if (!fs_info->scrub_wr_completion_workers)
-                       goto fail_scrub_wr_completion_workers;
+       scrub_workers = btrfs_alloc_workqueue(fs_info, "scrub", flags,
+                                             is_dev_replace ? 1 : max_active, 4);
+       if (!scrub_workers)
+               goto fail_scrub_workers;
 
-               ASSERT(fs_info->scrub_parity_workers == NULL);
-               fs_info->scrub_parity_workers =
-                       btrfs_alloc_workqueue(fs_info, "scrubparity", flags,
+       scrub_wr_comp = btrfs_alloc_workqueue(fs_info, "scrubwrc", flags,
                                              max_active, 2);
-               if (!fs_info->scrub_parity_workers)
-                       goto fail_scrub_parity_workers;
+       if (!scrub_wr_comp)
+               goto fail_scrub_wr_completion_workers;
 
+       scrub_parity = btrfs_alloc_workqueue(fs_info, "scrubparity", flags,
+                                            max_active, 2);
+       if (!scrub_parity)
+               goto fail_scrub_parity_workers;
+
+       mutex_lock(&fs_info->scrub_lock);
+       if (refcount_read(&fs_info->scrub_workers_refcnt) == 0) {
+               ASSERT(fs_info->scrub_workers == NULL &&
+                      fs_info->scrub_wr_completion_workers == NULL &&
+                      fs_info->scrub_parity_workers == NULL);
+               fs_info->scrub_workers = scrub_workers;
+               fs_info->scrub_wr_completion_workers = scrub_wr_comp;
+               fs_info->scrub_parity_workers = scrub_parity;
                refcount_set(&fs_info->scrub_workers_refcnt, 1);
-       } else {
-               refcount_inc(&fs_info->scrub_workers_refcnt);
+               mutex_unlock(&fs_info->scrub_lock);
+               return 0;
        }
-       return 0;
+       /* Other thread raced in and created the workers for us */
+       refcount_inc(&fs_info->scrub_workers_refcnt);
+       mutex_unlock(&fs_info->scrub_lock);
 
+       ret = 0;
+       btrfs_destroy_workqueue(scrub_parity);
 fail_scrub_parity_workers:
-       btrfs_destroy_workqueue(fs_info->scrub_wr_completion_workers);
+       btrfs_destroy_workqueue(scrub_wr_comp);
 fail_scrub_wr_completion_workers:
-       btrfs_destroy_workqueue(fs_info->scrub_workers);
+       btrfs_destroy_workqueue(scrub_workers);
 fail_scrub_workers:
-       return -ENOMEM;
+       return ret;
 }
 
 int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
@@ -3770,9 +3804,6 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
        int ret;
        struct btrfs_device *dev;
        unsigned int nofs_flag;
-       struct btrfs_workqueue *scrub_workers = NULL;
-       struct btrfs_workqueue *scrub_wr_comp = NULL;
-       struct btrfs_workqueue *scrub_parity = NULL;
 
        if (btrfs_fs_closing(fs_info))
                return -EAGAIN;
@@ -3819,13 +3850,17 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
        if (IS_ERR(sctx))
                return PTR_ERR(sctx);
 
+       ret = scrub_workers_get(fs_info, is_dev_replace);
+       if (ret)
+               goto out_free_ctx;
+
        mutex_lock(&fs_info->fs_devices->device_list_mutex);
        dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true);
        if (!dev || (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) &&
                     !is_dev_replace)) {
                mutex_unlock(&fs_info->fs_devices->device_list_mutex);
                ret = -ENODEV;
-               goto out_free_ctx;
+               goto out;
        }
 
        if (!is_dev_replace && !readonly &&
@@ -3834,7 +3869,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
                btrfs_err_in_rcu(fs_info, "scrub: device %s is not writable",
                                rcu_str_deref(dev->name));
                ret = -EROFS;
-               goto out_free_ctx;
+               goto out;
        }
 
        mutex_lock(&fs_info->scrub_lock);
@@ -3843,7 +3878,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
                mutex_unlock(&fs_info->scrub_lock);
                mutex_unlock(&fs_info->fs_devices->device_list_mutex);
                ret = -EIO;
-               goto out_free_ctx;
+               goto out;
        }
 
        down_read(&fs_info->dev_replace.rwsem);
@@ -3854,17 +3889,10 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
                mutex_unlock(&fs_info->scrub_lock);
                mutex_unlock(&fs_info->fs_devices->device_list_mutex);
                ret = -EINPROGRESS;
-               goto out_free_ctx;
+               goto out;
        }
        up_read(&fs_info->dev_replace.rwsem);
 
-       ret = scrub_workers_get(fs_info, is_dev_replace);
-       if (ret) {
-               mutex_unlock(&fs_info->scrub_lock);
-               mutex_unlock(&fs_info->fs_devices->device_list_mutex);
-               goto out_free_ctx;
-       }
-
        sctx->readonly = readonly;
        dev->scrub_ctx = sctx;
        mutex_unlock(&fs_info->fs_devices->device_list_mutex);
@@ -3917,24 +3945,14 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
 
        mutex_lock(&fs_info->scrub_lock);
        dev->scrub_ctx = NULL;
-       if (refcount_dec_and_test(&fs_info->scrub_workers_refcnt)) {
-               scrub_workers = fs_info->scrub_workers;
-               scrub_wr_comp = fs_info->scrub_wr_completion_workers;
-               scrub_parity = fs_info->scrub_parity_workers;
-
-               fs_info->scrub_workers = NULL;
-               fs_info->scrub_wr_completion_workers = NULL;
-               fs_info->scrub_parity_workers = NULL;
-       }
        mutex_unlock(&fs_info->scrub_lock);
 
-       btrfs_destroy_workqueue(scrub_workers);
-       btrfs_destroy_workqueue(scrub_wr_comp);
-       btrfs_destroy_workqueue(scrub_parity);
+       scrub_workers_put(fs_info);
        scrub_put_ctx(sctx);
 
        return ret;
-
+out:
+       scrub_workers_put(fs_info);
 out_free_ctx:
        scrub_free_ctx(sctx);
 
index e529ddb35b87f32bbc2363111f4dd19ade19d347..25967ecaaf0af97fca8ba95830bdfa5599996706 100644 (file)
@@ -625,6 +625,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
                        } else if (strncmp(args[0].from, "lzo", 3) == 0) {
                                compress_type = "lzo";
                                info->compress_type = BTRFS_COMPRESS_LZO;
+                               info->compress_level = 0;
                                btrfs_set_opt(info->mount_opt, COMPRESS);
                                btrfs_clear_opt(info->mount_opt, NODATACOW);
                                btrfs_clear_opt(info->mount_opt, NODATASUM);
index c8df2edafd8558ece7ca334a39812f4b10243510..5be30066563c834a74aef42482b784c758065d16 100644 (file)
@@ -1170,10 +1170,12 @@ int btrfs_sysfs_remove_devices_dir(struct btrfs_fs_devices *fs_devices,
                                          disk_kobj->name);
                }
 
-               kobject_del(&one_device->devid_kobj);
-               kobject_put(&one_device->devid_kobj);
+               if (one_device->devid_kobj.state_initialized) {
+                       kobject_del(&one_device->devid_kobj);
+                       kobject_put(&one_device->devid_kobj);
 
-               wait_for_completion(&one_device->kobj_unregister);
+                       wait_for_completion(&one_device->kobj_unregister);
+               }
 
                return 0;
        }
@@ -1186,10 +1188,12 @@ int btrfs_sysfs_remove_devices_dir(struct btrfs_fs_devices *fs_devices,
                        sysfs_remove_link(fs_devices->devices_kobj,
                                          disk_kobj->name);
                }
-               kobject_del(&one_device->devid_kobj);
-               kobject_put(&one_device->devid_kobj);
+               if (one_device->devid_kobj.state_initialized) {
+                       kobject_del(&one_device->devid_kobj);
+                       kobject_put(&one_device->devid_kobj);
 
-               wait_for_completion(&one_device->kobj_unregister);
+                       wait_for_completion(&one_device->kobj_unregister);
+               }
        }
 
        return 0;
index 20c6ac1a5de7fa3df7b0a8eef384c458c772f201..d2fc292ac61b1dcc06a9f34406fcccf4aa319a1d 100644 (file)
@@ -1636,6 +1636,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
        pending->snap = btrfs_get_new_fs_root(fs_info, objectid, pending->anon_dev);
        if (IS_ERR(pending->snap)) {
                ret = PTR_ERR(pending->snap);
+               pending->snap = NULL;
                btrfs_abort_transaction(trans, ret);
                goto fail;
        }
index 517b44300a05c940586ebcaa69e8881f21a722d0..7b1fee630f97851a35eb0bb34d33d95d1e31b991 100644 (file)
@@ -984,7 +984,7 @@ static int check_inode_item(struct extent_buffer *leaf,
        /* Note for ROOT_TREE_DIR_ITEM, mkfs could set its transid 0 */
        if (btrfs_inode_transid(leaf, iitem) > super_gen + 1) {
                inode_item_err(leaf, slot,
-                       "invalid inode generation: has %llu expect [0, %llu]",
+                       "invalid inode transid: has %llu expect [0, %llu]",
                               btrfs_inode_transid(leaf, iitem), super_gen + 1);
                return -EUCLEAN;
        }
index 696dd861cc3c63324a7488fcf31491ad42e46aac..39da9db352786071eaf57fbdd9cf1d36c1910c28 100644 (file)
@@ -3449,11 +3449,13 @@ fail:
        btrfs_free_path(path);
 out_unlock:
        mutex_unlock(&dir->log_mutex);
-       if (ret == -ENOSPC) {
+       if (err == -ENOSPC) {
                btrfs_set_log_full_commit(trans);
-               ret = 0;
-       } else if (ret < 0)
-               btrfs_abort_transaction(trans, ret);
+               err = 0;
+       } else if (err < 0 && err != -ENOENT) {
+               /* ENOENT can be returned if the entry hasn't been fsynced yet */
+               btrfs_abort_transaction(trans, err);
+       }
 
        btrfs_end_log_trans(root);
 
index ee96c5869f57e2aa2945325446e58e7002ca6341..117b43367629e418ae15a819c6a96b3d24488927 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include <linux/sched.h>
+#include <linux/sched/mm.h>
 #include <linux/bio.h>
 #include <linux/slab.h>
 #include <linux/blkdev.h>
@@ -4462,6 +4463,7 @@ int btrfs_uuid_scan_kthread(void *data)
                        goto skip;
                }
 update_tree:
+               btrfs_release_path(path);
                if (!btrfs_is_empty_uuid(root_item.uuid)) {
                        ret = btrfs_uuid_tree_add(trans, root_item.uuid,
                                                  BTRFS_UUID_KEY_SUBVOL,
@@ -4486,6 +4488,7 @@ update_tree:
                }
 
 skip:
+               btrfs_release_path(path);
                if (trans) {
                        ret = btrfs_end_transaction(trans);
                        trans = NULL;
@@ -4493,7 +4496,6 @@ skip:
                                break;
                }
 
-               btrfs_release_path(path);
                if (key.offset < (u64)-1) {
                        key.offset++;
                } else if (key.type < BTRFS_ROOT_ITEM_KEY) {
@@ -6483,8 +6485,17 @@ static struct btrfs_device *add_missing_dev(struct btrfs_fs_devices *fs_devices,
                                            u64 devid, u8 *dev_uuid)
 {
        struct btrfs_device *device;
+       unsigned int nofs_flag;
 
+       /*
+        * We call this under the chunk_mutex, so we want to use NOFS for this
+        * allocation, however we don't want to change btrfs_alloc_device() to
+        * always do NOFS because we use it in a lot of other GFP_KERNEL safe
+        * places.
+        */
+       nofs_flag = memalloc_nofs_save();
        device = btrfs_alloc_device(NULL, &devid, dev_uuid);
+       memalloc_nofs_restore(nofs_flag);
        if (IS_ERR(device))
                return device;
 
index d468ed9981e06c0281eba58c2bd23fb071b28a40..50bbc99e3d960d1bd4538589510540ed1e2f004d 100644 (file)
@@ -1958,7 +1958,7 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
                 */
                set_buffer_new(bh);
                set_buffer_unwritten(bh);
-               /* FALLTHRU */
+               fallthrough;
        case IOMAP_MAPPED:
                if ((iomap->flags & IOMAP_F_NEW) ||
                    offset >= i_size_read(inode))
index 55ccccf77ceab50cba27ec82f9eb8cb29408ded0..034b3f4fdd3a7f201900298f47b295d5cce7b957 100644 (file)
@@ -887,8 +887,8 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
        int have = ci->i_snap_caps;
 
        if ((have & mask) == mask) {
-               dout("__ceph_caps_issued_mask ino 0x%lx snap issued %s"
-                    " (mask %s)\n", ci->vfs_inode.i_ino,
+               dout("__ceph_caps_issued_mask ino 0x%llx snap issued %s"
+                    " (mask %s)\n", ceph_ino(&ci->vfs_inode),
                     ceph_cap_string(have),
                     ceph_cap_string(mask));
                return 1;
@@ -899,8 +899,8 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
                if (!__cap_is_valid(cap))
                        continue;
                if ((cap->issued & mask) == mask) {
-                       dout("__ceph_caps_issued_mask ino 0x%lx cap %p issued %s"
-                            " (mask %s)\n", ci->vfs_inode.i_ino, cap,
+                       dout("__ceph_caps_issued_mask ino 0x%llx cap %p issued %s"
+                            " (mask %s)\n", ceph_ino(&ci->vfs_inode), cap,
                             ceph_cap_string(cap->issued),
                             ceph_cap_string(mask));
                        if (touch)
@@ -911,8 +911,8 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
                /* does a combination of caps satisfy mask? */
                have |= cap->issued;
                if ((have & mask) == mask) {
-                       dout("__ceph_caps_issued_mask ino 0x%lx combo issued %s"
-                            " (mask %s)\n", ci->vfs_inode.i_ino,
+                       dout("__ceph_caps_issued_mask ino 0x%llx combo issued %s"
+                            " (mask %s)\n", ceph_ino(&ci->vfs_inode),
                             ceph_cap_string(cap->issued),
                             ceph_cap_string(mask));
                        if (touch) {
@@ -2872,7 +2872,7 @@ int ceph_get_caps(struct file *filp, int need, int want,
                        struct cap_wait cw;
                        DEFINE_WAIT_FUNC(wait, woken_wake_function);
 
-                       cw.ino = inode->i_ino;
+                       cw.ino = ceph_ino(inode);
                        cw.tgid = current->tgid;
                        cw.need = need;
                        cw.want = want;
index 97539b497e4c419ccacb9c38a8c554e0eedcdc18..3e3fcda9b276cbf757a9e15d83ff4278ad01743c 100644 (file)
@@ -202,7 +202,7 @@ static int caps_show_cb(struct inode *inode, struct ceph_cap *cap, void *p)
 {
        struct seq_file *s = p;
 
-       seq_printf(s, "0x%-17lx%-17s%-17s\n", inode->i_ino,
+       seq_printf(s, "0x%-17llx%-17s%-17s\n", ceph_ino(inode),
                   ceph_cap_string(cap->issued),
                   ceph_cap_string(cap->implemented));
        return 0;
@@ -247,7 +247,7 @@ static int caps_show(struct seq_file *s, void *p)
 
        spin_lock(&mdsc->caps_list_lock);
        list_for_each_entry(cw, &mdsc->cap_wait_list, list) {
-               seq_printf(s, "%-13d0x%-17lx%-17s%-17s\n", cw->tgid, cw->ino,
+               seq_printf(s, "%-13d0x%-17llx%-17s%-17s\n", cw->tgid, cw->ino,
                                ceph_cap_string(cw->need),
                                ceph_cap_string(cw->want));
        }
index 060bdcc5ce32cfa873dc5b084c6caf02c20e9aca..d72e4a12bb69ada4c2b3739521f4d7f834ae23a6 100644 (file)
@@ -259,9 +259,7 @@ static int __dcache_readdir(struct file *file,  struct dir_context *ctx,
                             dentry, dentry, d_inode(dentry));
                        ctx->pos = di->offset;
                        if (!dir_emit(ctx, dentry->d_name.name,
-                                     dentry->d_name.len,
-                                     ceph_translate_ino(dentry->d_sb,
-                                                        d_inode(dentry)->i_ino),
+                                     dentry->d_name.len, ceph_present_inode(d_inode(dentry)),
                                      d_inode(dentry)->i_mode >> 12)) {
                                dput(dentry);
                                err = 0;
@@ -324,18 +322,21 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
        /* always start with . and .. */
        if (ctx->pos == 0) {
                dout("readdir off 0 -> '.'\n");
-               if (!dir_emit(ctx, ".", 1, 
-                           ceph_translate_ino(inode->i_sb, inode->i_ino),
+               if (!dir_emit(ctx, ".", 1, ceph_present_inode(inode),
                            inode->i_mode >> 12))
                        return 0;
                ctx->pos = 1;
        }
        if (ctx->pos == 1) {
-               ino_t ino = parent_ino(file->f_path.dentry);
+               u64 ino;
+               struct dentry *dentry = file->f_path.dentry;
+
+               spin_lock(&dentry->d_lock);
+               ino = ceph_present_inode(dentry->d_parent->d_inode);
+               spin_unlock(&dentry->d_lock);
+
                dout("readdir off 1 -> '..'\n");
-               if (!dir_emit(ctx, "..", 2,
-                           ceph_translate_ino(inode->i_sb, ino),
-                           inode->i_mode >> 12))
+               if (!dir_emit(ctx, "..", 2, ino, inode->i_mode >> 12))
                        return 0;
                ctx->pos = 2;
        }
@@ -507,9 +508,6 @@ more:
        }
        for (; i < rinfo->dir_nr; i++) {
                struct ceph_mds_reply_dir_entry *rde = rinfo->dir_entries + i;
-               struct ceph_vino vino;
-               ino_t ino;
-               u32 ftype;
 
                BUG_ON(rde->offset < ctx->pos);
 
@@ -519,13 +517,10 @@ more:
                     rde->name_len, rde->name, &rde->inode.in);
 
                BUG_ON(!rde->inode.in);
-               ftype = le32_to_cpu(rde->inode.in->mode) >> 12;
-               vino.ino = le64_to_cpu(rde->inode.in->ino);
-               vino.snap = le64_to_cpu(rde->inode.in->snapid);
-               ino = ceph_vino_to_ino(vino);
 
                if (!dir_emit(ctx, rde->name, rde->name_len,
-                             ceph_translate_ino(inode->i_sb, ino), ftype)) {
+                             ceph_present_ino(inode->i_sb, le64_to_cpu(rde->inode.in->ino)),
+                             le32_to_cpu(rde->inode.in->mode) >> 12)) {
                        dout("filldir stopping us...\n");
                        return 0;
                }
@@ -1161,7 +1156,7 @@ retry:
 
        if (try_async && op == CEPH_MDS_OP_UNLINK &&
            (req->r_dir_caps = get_caps_for_async_unlink(dir, dentry))) {
-               dout("async unlink on %lu/%.*s caps=%s", dir->i_ino,
+               dout("async unlink on %llu/%.*s caps=%s", ceph_ino(dir),
                     dentry->d_name.len, dentry->d_name.name,
                     ceph_cap_string(req->r_dir_caps));
                set_bit(CEPH_MDS_R_ASYNC, &req->r_req_flags);
@@ -1745,7 +1740,7 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
                        case -ENOENT:
                                if (d_really_is_negative(dentry))
                                        valid = 1;
-                               /* Fallthrough */
+                               fallthrough;
                        default:
                                break;
                        }
index d51c3f2fdca0258c0ab11c0c73d09d11a05eb409..3f4c993dfc6fec89267bf529ca89b7f5e36ba4e8 100644 (file)
@@ -252,7 +252,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
        case S_IFREG:
                ceph_fscache_register_inode_cookie(inode);
                ceph_fscache_file_set_cookie(inode, file);
-               /* fall through */
+               fallthrough;
        case S_IFDIR:
                ret = ceph_init_file_info(inode, file, fmode,
                                                S_ISDIR(inode->i_mode));
@@ -630,8 +630,8 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
        } else {
                struct dentry *dn;
 
-               dout("%s d_adding new inode 0x%llx to 0x%lx/%s\n", __func__,
-                       vino.ino, dir->i_ino, dentry->d_name.name);
+               dout("%s d_adding new inode 0x%llx to 0x%llx/%s\n", __func__,
+                       vino.ino, ceph_ino(dir), dentry->d_name.name);
                ceph_dir_clear_ordered(dir);
                ceph_init_inode_acls(inode, as_ctx);
                if (inode->i_state & I_NEW) {
@@ -2507,6 +2507,7 @@ const struct file_operations ceph_file_fops = {
        .mmap = ceph_mmap,
        .fsync = ceph_fsync,
        .lock = ceph_lock,
+       .setlease = simple_nosetlease,
        .flock = ceph_flock,
        .splice_read = generic_file_splice_read,
        .splice_write = iter_file_splice_write,
index 357c937699d567cea31929da1baedd3d30ab036d..d163fa96cb40164a5ff9d6fc3e79ff63d78655a5 100644 (file)
@@ -41,8 +41,10 @@ static void ceph_inode_work(struct work_struct *work);
  */
 static int ceph_set_ino_cb(struct inode *inode, void *data)
 {
-       ceph_inode(inode)->i_vino = *(struct ceph_vino *)data;
-       inode->i_ino = ceph_vino_to_ino(*(struct ceph_vino *)data);
+       struct ceph_inode_info *ci = ceph_inode(inode);
+
+       ci->i_vino = *(struct ceph_vino *)data;
+       inode->i_ino = ceph_vino_to_ino_t(ci->i_vino);
        inode_set_iversion_raw(inode, 0);
        return 0;
 }
@@ -50,17 +52,14 @@ static int ceph_set_ino_cb(struct inode *inode, void *data)
 struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino)
 {
        struct inode *inode;
-       ino_t t = ceph_vino_to_ino(vino);
 
-       inode = iget5_locked(sb, t, ceph_ino_compare, ceph_set_ino_cb, &vino);
+       inode = iget5_locked(sb, (unsigned long)vino.ino, ceph_ino_compare,
+                            ceph_set_ino_cb, &vino);
        if (!inode)
                return ERR_PTR(-ENOMEM);
-       if (inode->i_state & I_NEW)
-               dout("get_inode created new inode %p %llx.%llx ino %llx\n",
-                    inode, ceph_vinop(inode), (u64)inode->i_ino);
 
-       dout("get_inode on %lu=%llx.%llx got %p\n", inode->i_ino, vino.ino,
-            vino.snap, inode);
+       dout("get_inode on %llu=%llx.%llx got %p new %d\n", ceph_present_inode(inode),
+            ceph_vinop(inode), inode, !!(inode->i_state & I_NEW));
        return inode;
 }
 
@@ -2378,7 +2377,7 @@ int ceph_getattr(const struct path *path, struct kstat *stat,
        }
 
        generic_fillattr(inode, stat);
-       stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino);
+       stat->ino = ceph_present_inode(inode);
 
        /*
         * btime on newly-allocated inodes is 0, so if this is still set to
index bc9e95937d7c6a4780a053666868010a51dfde6e..658800605bfb48f2e43fca54e6ef9d82225f8e93 100644 (file)
@@ -372,7 +372,7 @@ struct ceph_quotarealm_inode {
 
 struct cap_wait {
        struct list_head        list;
-       unsigned long           ino;
+       u64                     ino;
        pid_t                   tgid;
        int                     need;
        int                     want;
index 198ddde5c1e6ae38ff9428e7d6f820c9c8785df2..cc2c4d40b0222f77114666410c3fcc30350dd1b0 100644 (file)
@@ -23,12 +23,12 @@ static inline bool ceph_has_realms_with_quotas(struct inode *inode)
 {
        struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
        struct super_block *sb = mdsc->fsc->sb;
+       struct inode *root = d_inode(sb->s_root);
 
        if (atomic64_read(&mdsc->quotarealms_count) > 0)
                return true;
        /* if root is the real CephFS root, we don't have quota realms */
-       if (sb->s_root->d_inode &&
-           (sb->s_root->d_inode->i_ino == CEPH_INO_ROOT))
+       if (root && ceph_ino(root) == CEPH_INO_ROOT)
                return false;
        /* otherwise, we can't know for sure */
        return true;
index 4c3c964b1c543493f3364a856f1165140e51450b..a3995ebe0623e950e4d1266b348d72f8ce3b3768 100644 (file)
@@ -457,15 +457,7 @@ ceph_vino(const struct inode *inode)
        return ceph_inode(inode)->i_vino;
 }
 
-/*
- * ino_t is <64 bits on many architectures, blech.
- *
- *               i_ino (kernel inode)   st_ino (userspace)
- * i386          32                     32
- * x86_64+ino32  64                     32
- * x86_64        64                     64
- */
-static inline u32 ceph_ino_to_ino32(__u64 vino)
+static inline u32 ceph_ino_to_ino32(u64 vino)
 {
        u32 ino = vino & 0xffffffff;
        ino ^= vino >> 32;
@@ -475,34 +467,17 @@ static inline u32 ceph_ino_to_ino32(__u64 vino)
 }
 
 /*
- * kernel i_ino value
+ * Inode numbers in cephfs are 64 bits, but inode->i_ino is 32-bits on
+ * some arches. We generally do not use this value inside the ceph driver, but
+ * we do want to set it to something, so that generic vfs code has an
+ * appropriate value for tracepoints and the like.
  */
-static inline ino_t ceph_vino_to_ino(struct ceph_vino vino)
+static inline ino_t ceph_vino_to_ino_t(struct ceph_vino vino)
 {
-#if BITS_PER_LONG == 32
-       return ceph_ino_to_ino32(vino.ino);
-#else
+       if (sizeof(ino_t) == sizeof(u32))
+               return ceph_ino_to_ino32(vino.ino);
        return (ino_t)vino.ino;
-#endif
-}
-
-/*
- * user-visible ino (stat, filldir)
- */
-#if BITS_PER_LONG == 32
-static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
-{
-       return ino;
-}
-#else
-static inline ino_t ceph_translate_ino(struct super_block *sb, ino_t ino)
-{
-       if (ceph_test_mount_opt(ceph_sb_to_client(sb), INO32))
-               ino = ceph_ino_to_ino32(ino);
-       return ino;
 }
-#endif
-
 
 /* for printf-style formatting */
 #define ceph_vinop(i) ceph_inode(i)->i_vino.ino, ceph_inode(i)->i_vino.snap
@@ -511,11 +486,34 @@ static inline u64 ceph_ino(struct inode *inode)
 {
        return ceph_inode(inode)->i_vino.ino;
 }
+
 static inline u64 ceph_snap(struct inode *inode)
 {
        return ceph_inode(inode)->i_vino.snap;
 }
 
+/**
+ * ceph_present_ino - format an inode number for presentation to userland
+ * @sb: superblock where the inode lives
+ * @ino: inode number to (possibly) convert
+ *
+ * If the user mounted with the ino32 option, then the 64-bit value needs
+ * to be converted to something that can fit inside 32 bits. Note that
+ * internal kernel code never uses this value, so this is entirely for
+ * userland consumption.
+ */
+static inline u64 ceph_present_ino(struct super_block *sb, u64 ino)
+{
+       if (unlikely(ceph_test_mount_opt(ceph_sb_to_client(sb), INO32)))
+               return ceph_ino_to_ino32(ino);
+       return ino;
+}
+
+static inline u64 ceph_present_inode(struct inode *inode)
+{
+       return ceph_present_ino(inode->i_sb, ceph_ino(inode));
+}
+
 static inline int ceph_ino_compare(struct inode *inode, void *data)
 {
        struct ceph_vino *pvino = (struct ceph_vino *)data;
@@ -524,11 +522,16 @@ static inline int ceph_ino_compare(struct inode *inode, void *data)
                ci->i_vino.snap == pvino->snap;
 }
 
+
 static inline struct inode *ceph_find_inode(struct super_block *sb,
                                            struct ceph_vino vino)
 {
-       ino_t t = ceph_vino_to_ino(vino);
-       return ilookup5(sb, t, ceph_ino_compare, &vino);
+       /*
+        * NB: The hashval will be run through the fs/inode.c hash function
+        * anyway, so there is no need to squash the inode number down to
+        * 32-bits first. Just use low-order bits on arches with 32-bit long.
+        */
+       return ilookup5(sb, (unsigned long)vino.ino, ceph_ino_compare, &vino);
 }
 
 
index b296964b8afa6c4319d07b0593bbcfbbcc97a833..b565d83ba89ed93e78bef0b32eb7aa9c136034ae 100644 (file)
@@ -2031,4 +2031,19 @@ static inline bool is_smb1_server(struct TCP_Server_Info *server)
        return strcmp(server->vals->version_string, SMB1_VERSION_STRING) == 0;
 }
 
+static inline bool is_tcon_dfs(struct cifs_tcon *tcon)
+{
+       /*
+        * For SMB1, see MS-CIFS 2.4.55 SMB_COM_TREE_CONNECT_ANDX (0x75) and MS-CIFS 3.3.4.4 DFS
+        * Subsystem Notifies That a Share Is a DFS Share.
+        *
+        * For SMB2+, see MS-SMB2 2.2.10 SMB2 TREE_CONNECT Response and MS-SMB2 3.3.4.14 Server
+        * Application Updates a Share.
+        */
+       if (!tcon || !tcon->ses || !tcon->ses->server)
+               return false;
+       return is_smb1_server(tcon->ses->server) ? tcon->Flags & SMB_SHARE_IS_IN_DFS :
+               tcon->share_flags & (SHI1005_FLAGS_DFS | SHI1005_FLAGS_DFS_ROOT);
+}
+
 #endif /* _CIFS_GLOB_H */
index 0e763d2dcf16648d6465febd8b5f079fd6486e2a..0496934feecb777b6a7ae53a00003278f23517ea 100644 (file)
@@ -581,7 +581,7 @@ should_set_ext_sec_flag(enum securityEnum sectype)
                if (global_secflags &
                    (CIFSSEC_MAY_KRB5 | CIFSSEC_MAY_NTLMSSP))
                        return true;
-               /* Fallthrough */
+               fallthrough;
        default:
                return false;
        }
index a275ee399dcea070fb898c21e5c1e94cda476783..a5731dd6e6566e7f86bac2db176f3c640a4d266f 100644 (file)
@@ -1378,25 +1378,25 @@ static int cifs_parse_security_flavors(char *value,
                return 1;
        case Opt_sec_krb5i:
                vol->sign = true;
-               /* Fallthrough */
+               fallthrough;
        case Opt_sec_krb5:
                vol->sectype = Kerberos;
                break;
        case Opt_sec_ntlmsspi:
                vol->sign = true;
-               /* Fallthrough */
+               fallthrough;
        case Opt_sec_ntlmssp:
                vol->sectype = RawNTLMSSP;
                break;
        case Opt_sec_ntlmi:
                vol->sign = true;
-               /* Fallthrough */
+               fallthrough;
        case Opt_ntlm:
                vol->sectype = NTLM;
                break;
        case Opt_sec_ntlmv2i:
                vol->sign = true;
-               /* Fallthrough */
+               fallthrough;
        case Opt_sec_ntlmv2:
                vol->sectype = NTLMv2;
                break;
@@ -2187,7 +2187,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
                                vol->password = NULL;
                                break;
                        }
-                       /* Fallthrough - to Opt_pass below.*/
+                       fallthrough;    /* to Opt_pass below */
                case Opt_pass:
                        /* Obtain the value string */
                        value = strchr(data, '=');
@@ -4909,7 +4909,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol)
                if (!tcon)
                        continue;
                /* Make sure that requests go through new root servers */
-               if (tcon->share_flags & (SHI1005_FLAGS_DFS | SHI1005_FLAGS_DFS_ROOT)) {
+               if (is_tcon_dfs(tcon)) {
                        put_root_ses(root_ses);
                        set_root_ses(cifs_sb, ses, &root_ses);
                }
index 3989d08396acb077512888e4954fea8964b3d7b5..1f75b25e559a7594739356ae6474d69b47a89d40 100644 (file)
@@ -1017,6 +1017,8 @@ handle_mnt_opt:
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID) {
                rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, true,
                                       full_path, fid);
+               if (rc == -EREMOTE)
+                       rc = 0;
                if (rc) {
                        cifs_dbg(FYI, "%s: Get mode from SID failed. rc=%d\n",
                                 __func__, rc);
@@ -1025,6 +1027,8 @@ handle_mnt_opt:
        } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
                rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, false,
                                       full_path, fid);
+               if (rc == -EREMOTE)
+                       rc = 0;
                if (rc) {
                        cifs_dbg(FYI, "%s: Getting ACL failed with error: %d\n",
                                 __func__, rc);
index 69cd5856621b8af2455f58f07b434ce1f9cee028..de564368a887c23d4de9c6c84ad8de272482d65c 100644 (file)
@@ -798,7 +798,7 @@ cifs_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested)
                        if ((server->sec_kerberos || server->sec_mskerberos) &&
                            (global_secflags & CIFSSEC_MAY_KRB5))
                                return Kerberos;
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        return Unspecified;
                }
@@ -815,7 +815,7 @@ cifs_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested)
                default:
                        break;
                }
-               /* Fallthrough - to attempt LANMAN authentication next */
+               fallthrough;    /* to attempt LANMAN authentication next */
        case CIFS_NEGFLAVOR_LANMAN:
                switch (requested) {
                case LANMAN:
@@ -823,7 +823,7 @@ cifs_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested)
                case Unspecified:
                        if (global_secflags & CIFSSEC_MAY_LANMAN)
                                return LANMAN;
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        return Unspecified;
                }
index 667d70aa335fccfd0cc038bd9d3cafc7635f3afa..96c172d94fba4046f96b6183f82a7f04af2a0bd1 100644 (file)
@@ -1101,7 +1101,7 @@ smb2_select_sectype(struct TCP_Server_Info *server, enum securityEnum requested)
                if ((server->sec_kerberos || server->sec_mskerberos) &&
                        (global_secflags & CIFSSEC_MAY_KRB5))
                        return Kerberos;
-               /* Fallthrough */
+               fallthrough;
        default:
                return Unspecified;
        }
index cb733652ecca6cd0679b57acf3db93efdd4751d4..ca22737272258904575e78b6d9e6fb44816021a1 100644 (file)
@@ -1688,11 +1688,11 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
        switch (whence) {
                case 1:
                        offset += file->f_pos;
-                       /* fall through */
+                       fallthrough;
                case 0:
                        if (offset >= 0)
                                break;
-                       /* fall through */
+                       fallthrough;
                default:
                        return -EINVAL;
        }
index 95341af1a9660dc23aee9e141712c3bf4d1620c7..994ab66a99071356353365825376c35ae1d4f990 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1367,7 +1367,7 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
                        ret = dax_load_hole(&xas, mapping, &entry, vmf);
                        goto finish_iomap;
                }
-               /*FALLTHRU*/
+               fallthrough;
        default:
                WARN_ON_ONCE(1);
                error = -EIO;
index b167d2d0214849a98fd6fe457eb9583fa33bf23c..a768a09430c3a9c0cad71e2f47a8544acafdf9c0 100644 (file)
@@ -177,7 +177,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp)
                goto out;
 
        if (!fops_get(real_fops)) {
-#ifdef MODULE
+#ifdef CONFIG_MODULES
                if (real_fops->owner &&
                    real_fops->owner->state == MODULE_STATE_GOING)
                        goto out;
@@ -312,7 +312,7 @@ static int full_proxy_open(struct inode *inode, struct file *filp)
                goto out;
 
        if (!fops_get(real_fops)) {
-#ifdef MODULE
+#ifdef CONFIG_MODULES
                if (real_fops->owner &&
                    real_fops->owner->state == MODULE_STATE_GOING)
                        goto out;
index 18d81599522f34e5a78011a8326e1ad7614e3254..002123efc6b052346ee8c7093789fbbb08929bd1 100644 (file)
@@ -5817,7 +5817,7 @@ int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua,
                break;
        case -EAGAIN:
                error = 0;
-               /* fall through */
+               fallthrough;
        default:
                __put_lkb(ls, lkb);
                goto out;
index 7d40d78ea8648ecdd11f8ee85f899232c2c5d4ab..ae325541884e3b44332bba1cdf1d357e55e510f6 100644 (file)
@@ -359,7 +359,7 @@ static int z_erofs_extent_lookback(struct z_erofs_maprecorder *m,
                return z_erofs_extent_lookback(m, m->delta[0]);
        case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN:
                map->m_flags &= ~EROFS_MAP_ZIPPED;
-               /* fallthrough */
+               fallthrough;
        case Z_EROFS_VLE_CLUSTER_TYPE_HEAD:
                map->m_la = (lcn << lclusterbits) | m->clusterofs;
                break;
@@ -416,7 +416,7 @@ int z_erofs_map_blocks_iter(struct inode *inode,
        case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN:
                if (endoff >= m.clusterofs)
                        map->m_flags &= ~EROFS_MAP_ZIPPED;
-               /* fallthrough */
+               fallthrough;
        case Z_EROFS_VLE_CLUSTER_TYPE_HEAD:
                if (endoff >= m.clusterofs) {
                        map->m_la = (m.lcn << lclusterbits) | m.clusterofs;
@@ -433,7 +433,7 @@ int z_erofs_map_blocks_iter(struct inode *inode,
                end = (m.lcn << lclusterbits) | m.clusterofs;
                map->m_flags |= EROFS_MAP_FULL_MAPPED;
                m.delta[0] = 1;
-               /* fallthrough */
+               fallthrough;
        case Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD:
                /* get the correspoinding first chunk */
                err = z_erofs_extent_lookback(&m, m.delta[0]);
index e0decff22ae273197b83ec17b38752dbb254941e..8107e06d7f6f56873914c99e6b32cefcd541dc1f 100644 (file)
@@ -1995,9 +1995,9 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
                         * during ep_insert().
                         */
                        if (list_empty(&epi->ffd.file->f_tfile_llink)) {
-                               get_file(epi->ffd.file);
-                               list_add(&epi->ffd.file->f_tfile_llink,
-                                        &tfile_check_list);
+                               if (get_file_rcu(epi->ffd.file))
+                                       list_add(&epi->ffd.file->f_tfile_llink,
+                                                &tfile_check_list);
                        }
                }
        }
index 60378ddf1424b019485ae77940bb08abff39b849..96044f5dbc0e0232386e9bd489dc20ae6ecdf066 100644 (file)
@@ -93,8 +93,10 @@ static vm_fault_t ext2_dax_fault(struct vm_fault *vmf)
        struct inode *inode = file_inode(vmf->vma->vm_file);
        struct ext2_inode_info *ei = EXT2_I(inode);
        vm_fault_t ret;
+       bool write = (vmf->flags & FAULT_FLAG_WRITE) &&
+               (vmf->vma->vm_flags & VM_SHARED);
 
-       if (vmf->flags & FAULT_FLAG_WRITE) {
+       if (write) {
                sb_start_pagefault(inode->i_sb);
                file_update_time(vmf->vma->vm_file);
        }
@@ -103,7 +105,7 @@ static vm_fault_t ext2_dax_fault(struct vm_fault *vmf)
        ret = dax_iomap_fault(vmf, PE_SIZE_PTE, NULL, NULL, &ext2_iomap_ops);
 
        up_read(&ei->dax_sem);
-       if (vmf->flags & FAULT_FLAG_WRITE)
+       if (write)
                sb_end_pagefault(inode->i_sb);
        return ret;
 }
index 80662e1f7889f532bb061479d87d4174712fbc63..415c21f0e75088c61dd9614bf73cf5b2b3859893 100644 (file)
@@ -1241,7 +1241,7 @@ do_indirects:
                                mark_inode_dirty(inode);
                                ext2_free_branches(inode, &nr, &nr+1, 1);
                        }
-                       /* fall through */
+                       fallthrough;
                case EXT2_IND_BLOCK:
                        nr = i_data[EXT2_DIND_BLOCK];
                        if (nr) {
@@ -1249,7 +1249,7 @@ do_indirects:
                                mark_inode_dirty(inode);
                                ext2_free_branches(inode, &nr, &nr+1, 2);
                        }
-                       /* fall through */
+                       fallthrough;
                case EXT2_DIND_BLOCK:
                        nr = i_data[EXT2_TIND_BLOCK];
                        if (nr) {
index dda860562ca346683d88b91e1be889dff6eef9e7..7fab2b3b5b3980964b2f4b5fd186535c6a7692d3 100644 (file)
@@ -587,7 +587,7 @@ static int parse_options(char *options, struct super_block *sb,
                case Opt_xip:
                        ext2_msg(sb, KERN_INFO, "use dax instead of xip");
                        set_opt(opts->s_mount_opt, XIP);
-                       /* Fall through */
+                       fallthrough;
                case Opt_dax:
 #ifdef CONFIG_FS_DAX
                        ext2_msg(sb, KERN_WARNING,
index 3a196d81f59497afa7408af427122ad728c2e3d8..bf596467c234ce052c4b784cea15c30cd7da118d 100644 (file)
@@ -4901,7 +4901,7 @@ static void __ext4_update_other_inode_time(struct super_block *sb,
            (inode->i_state & I_DIRTY_TIME)) {
                struct ext4_inode_info  *ei = EXT4_I(inode);
 
-               inode->i_state &= ~(I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED);
+               inode->i_state &= ~I_DIRTY_TIME;
                spin_unlock(&inode->i_lock);
 
                spin_lock(&ei->i_raw_lock);
index ed2bca0fce9224bba95b8f1ab315e68038f29882..73683e58a08d51ed4a0e64a2c51812653ade0542 100644 (file)
@@ -3550,6 +3550,9 @@ static int check_direct_IO(struct inode *inode, struct iov_iter *iter,
        unsigned long align = offset | iov_iter_alignment(iter);
        struct block_device *bdev = inode->i_sb->s_bdev;
 
+       if (iov_iter_rw(iter) == READ && offset >= i_size_read(inode))
+               return 1;
+
        if (align & blocksize_mask) {
                if (bdev)
                        blkbits = blksize_bits(bdev_logical_block_size(bdev));
index 16322ea5b46305b2e1010cec827f0aa19b4ffb73..d9e52a7f3702fb06c5bf562cf09f154896c1d97b 100644 (file)
@@ -2646,7 +2646,7 @@ static inline void __mark_inode_dirty_flag(struct inode *inode,
        case FI_NEW_INODE:
                if (set)
                        return;
-               /* fall through */
+               fallthrough;
        case FI_DATA_EXIST:
        case FI_INLINE_DOTS:
        case FI_PIN_FILE:
index 9bbaa2614679f84d41062601bdbf0428b8fca21a..cb1b5b61a1dab47f31a6c03c52c4a1d49d02f1b0 100644 (file)
@@ -618,10 +618,10 @@ pgoff_t f2fs_get_next_page_offset(struct dnode_of_data *dn, pgoff_t pgofs)
        switch (dn->max_level) {
        case 3:
                base += 2 * indirect_blks;
-               /* fall through */
+               fallthrough;
        case 2:
                base += 2 * direct_blks;
-               /* fall through */
+               fallthrough;
        case 1:
                base += direct_index;
                break;
@@ -2373,6 +2373,9 @@ static int __f2fs_build_free_nids(struct f2fs_sb_info *sbi,
        if (unlikely(nid >= nm_i->max_nid))
                nid = 0;
 
+       if (unlikely(nid % NAT_ENTRY_PER_BLOCK))
+               nid = NAT_BLOCK_OFFSET(nid) * NAT_ENTRY_PER_BLOCK;
+
        /* Enough entries */
        if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK)
                return 0;
index a65d357f89a9fad7ec74d7716aea268e702c3f4a..e247a5ef3713fb5a1308792fccaec8373ff058f0 100644 (file)
@@ -799,7 +799,7 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
 
                if (__is_large_section(sbi)) {
                        unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
-                       unsigned short valid_blocks =
+                       block_t valid_blocks =
                                get_valid_blocks(sbi, segno, true);
 
                        f2fs_bug_on(sbi, unlikely(!valid_blocks ||
@@ -815,7 +815,7 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
                enum dirty_type dirty_type)
 {
        struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
-       unsigned short valid_blocks;
+       block_t valid_blocks;
 
        if (test_and_clear_bit(segno, dirty_i->dirty_segmap[dirty_type]))
                dirty_i->nr_dirty[dirty_type]--;
@@ -4316,8 +4316,8 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi)
        struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
        struct free_segmap_info *free_i = FREE_I(sbi);
        unsigned int segno = 0, offset = 0, secno;
-       unsigned short valid_blocks;
-       unsigned short blks_per_sec = BLKS_PER_SEC(sbi);
+       block_t valid_blocks;
+       block_t blks_per_sec = BLKS_PER_SEC(sbi);
 
        while (1) {
                /* find dirty segment based on free segmap */
index 2e4c0fa2074b00c7b4ea43715647368bf680d804..19ac5baad50fdcadd886431dece771fcec4efef7 100644 (file)
@@ -362,7 +362,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
        case F_OFD_SETLK:
        case F_OFD_SETLKW:
 #endif
-               /* Fallthrough */
+               fallthrough;
        case F_SETLK:
        case F_SETLKW:
                if (copy_from_user(&flock, argp, sizeof(flock)))
@@ -771,7 +771,7 @@ static void send_sigio_to_task(struct task_struct *p,
                        if (!do_send_sig_info(signum, &si, p, type))
                                break;
                }
-               /* fall-through - fall back on the old plain SIGIO signal */
+                       fallthrough;    /* fall back on the old plain SIGIO signal */
                case 0:
                        do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, type);
        }
index a605c3dddabc76b3c013870b3246b0ddc15af9fa..58b27e4070a30d9d974e3489a6cad1a6ee6a0fc8 100644 (file)
@@ -42,7 +42,6 @@
 struct wb_writeback_work {
        long nr_pages;
        struct super_block *sb;
-       unsigned long *older_than_this;
        enum writeback_sync_modes sync_mode;
        unsigned int tagged_writepages:1;
        unsigned int for_kupdate:1;
@@ -144,7 +143,9 @@ static void inode_io_list_del_locked(struct inode *inode,
                                     struct bdi_writeback *wb)
 {
        assert_spin_locked(&wb->list_lock);
+       assert_spin_locked(&inode->i_lock);
 
+       inode->i_state &= ~I_SYNC_QUEUED;
        list_del_init(&inode->i_io_list);
        wb_io_lists_depopulated(wb);
 }
@@ -1122,7 +1123,9 @@ void inode_io_list_del(struct inode *inode)
        struct bdi_writeback *wb;
 
        wb = inode_to_wb_and_lock_list(inode);
+       spin_lock(&inode->i_lock);
        inode_io_list_del_locked(inode, wb);
+       spin_unlock(&inode->i_lock);
        spin_unlock(&wb->list_lock);
 }
 EXPORT_SYMBOL(inode_io_list_del);
@@ -1172,8 +1175,10 @@ void sb_clear_inode_writeback(struct inode *inode)
  * the case then the inode must have been redirtied while it was being written
  * out and we don't reset its dirtied_when.
  */
-static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
+static void redirty_tail_locked(struct inode *inode, struct bdi_writeback *wb)
 {
+       assert_spin_locked(&inode->i_lock);
+
        if (!list_empty(&wb->b_dirty)) {
                struct inode *tail;
 
@@ -1182,6 +1187,14 @@ static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
                        inode->dirtied_when = jiffies;
        }
        inode_io_list_move_locked(inode, wb, &wb->b_dirty);
+       inode->i_state &= ~I_SYNC_QUEUED;
+}
+
+static void redirty_tail(struct inode *inode, struct bdi_writeback *wb)
+{
+       spin_lock(&inode->i_lock);
+       redirty_tail_locked(inode, wb);
+       spin_unlock(&inode->i_lock);
 }
 
 /*
@@ -1220,16 +1233,13 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t)
 #define EXPIRE_DIRTY_ATIME 0x0001
 
 /*
- * Move expired (dirtied before work->older_than_this) dirty inodes from
+ * Move expired (dirtied before dirtied_before) dirty inodes from
  * @delaying_queue to @dispatch_queue.
  */
 static int move_expired_inodes(struct list_head *delaying_queue,
                               struct list_head *dispatch_queue,
-                              int flags,
-                              struct wb_writeback_work *work)
+                              unsigned long dirtied_before)
 {
-       unsigned long *older_than_this = NULL;
-       unsigned long expire_time;
        LIST_HEAD(tmp);
        struct list_head *pos, *node;
        struct super_block *sb = NULL;
@@ -1237,21 +1247,15 @@ static int move_expired_inodes(struct list_head *delaying_queue,
        int do_sb_sort = 0;
        int moved = 0;
 
-       if ((flags & EXPIRE_DIRTY_ATIME) == 0)
-               older_than_this = work->older_than_this;
-       else if (!work->for_sync) {
-               expire_time = jiffies - (dirtytime_expire_interval * HZ);
-               older_than_this = &expire_time;
-       }
        while (!list_empty(delaying_queue)) {
                inode = wb_inode(delaying_queue->prev);
-               if (older_than_this &&
-                   inode_dirtied_after(inode, *older_than_this))
+               if (inode_dirtied_after(inode, dirtied_before))
                        break;
                list_move(&inode->i_io_list, &tmp);
                moved++;
-               if (flags & EXPIRE_DIRTY_ATIME)
-                       set_bit(__I_DIRTY_TIME_EXPIRED, &inode->i_state);
+               spin_lock(&inode->i_lock);
+               inode->i_state |= I_SYNC_QUEUED;
+               spin_unlock(&inode->i_lock);
                if (sb_is_blkdev_sb(inode->i_sb))
                        continue;
                if (sb && sb != inode->i_sb)
@@ -1289,18 +1293,22 @@ out:
  *                                           |
  *                                           +--> dequeue for IO
  */
-static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work)
+static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work,
+                    unsigned long dirtied_before)
 {
        int moved;
+       unsigned long time_expire_jif = dirtied_before;
 
        assert_spin_locked(&wb->list_lock);
        list_splice_init(&wb->b_more_io, &wb->b_io);
-       moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, work);
+       moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, dirtied_before);
+       if (!work->for_sync)
+               time_expire_jif = jiffies - dirtytime_expire_interval * HZ;
        moved += move_expired_inodes(&wb->b_dirty_time, &wb->b_io,
-                                    EXPIRE_DIRTY_ATIME, work);
+                                    time_expire_jif);
        if (moved)
                wb_io_lists_populated(wb);
-       trace_writeback_queue_io(wb, work, moved);
+       trace_writeback_queue_io(wb, work, dirtied_before, moved);
 }
 
 static int write_inode(struct inode *inode, struct writeback_control *wbc)
@@ -1394,7 +1402,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
                 * writeback is not making progress due to locked
                 * buffers. Skip this inode for now.
                 */
-               redirty_tail(inode, wb);
+               redirty_tail_locked(inode, wb);
                return;
        }
 
@@ -1414,7 +1422,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
                         * retrying writeback of the dirty page/inode
                         * that cannot be performed immediately.
                         */
-                       redirty_tail(inode, wb);
+                       redirty_tail_locked(inode, wb);
                }
        } else if (inode->i_state & I_DIRTY) {
                /*
@@ -1422,10 +1430,11 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
                 * such as delayed allocation during submission or metadata
                 * updates after data IO completion.
                 */
-               redirty_tail(inode, wb);
+               redirty_tail_locked(inode, wb);
        } else if (inode->i_state & I_DIRTY_TIME) {
                inode->dirtied_when = jiffies;
                inode_io_list_move_locked(inode, wb, &wb->b_dirty_time);
+               inode->i_state &= ~I_SYNC_QUEUED;
        } else {
                /* The inode is clean. Remove from writeback lists. */
                inode_io_list_del_locked(inode, wb);
@@ -1472,18 +1481,14 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
        spin_lock(&inode->i_lock);
 
        dirty = inode->i_state & I_DIRTY;
-       if (inode->i_state & I_DIRTY_TIME) {
-               if ((dirty & I_DIRTY_INODE) ||
-                   wbc->sync_mode == WB_SYNC_ALL ||
-                   unlikely(inode->i_state & I_DIRTY_TIME_EXPIRED) ||
-                   unlikely(time_after(jiffies,
-                                       (inode->dirtied_time_when +
-                                        dirtytime_expire_interval * HZ)))) {
-                       dirty |= I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED;
-                       trace_writeback_lazytime(inode);
-               }
-       } else
-               inode->i_state &= ~I_DIRTY_TIME_EXPIRED;
+       if ((inode->i_state & I_DIRTY_TIME) &&
+           ((dirty & I_DIRTY_INODE) ||
+            wbc->sync_mode == WB_SYNC_ALL || wbc->for_sync ||
+            time_after(jiffies, inode->dirtied_time_when +
+                       dirtytime_expire_interval * HZ))) {
+               dirty |= I_DIRTY_TIME;
+               trace_writeback_lazytime(inode);
+       }
        inode->i_state &= ~dirty;
 
        /*
@@ -1669,8 +1674,8 @@ static long writeback_sb_inodes(struct super_block *sb,
                 */
                spin_lock(&inode->i_lock);
                if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) {
+                       redirty_tail_locked(inode, wb);
                        spin_unlock(&inode->i_lock);
-                       redirty_tail(inode, wb);
                        continue;
                }
                if ((inode->i_state & I_SYNC) && wbc.sync_mode != WB_SYNC_ALL) {
@@ -1811,7 +1816,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
        blk_start_plug(&plug);
        spin_lock(&wb->list_lock);
        if (list_empty(&wb->b_io))
-               queue_io(wb, &work);
+               queue_io(wb, &work, jiffies);
        __writeback_inodes_wb(wb, &work);
        spin_unlock(&wb->list_lock);
        blk_finish_plug(&plug);
@@ -1831,7 +1836,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
  * takes longer than a dirty_writeback_interval interval, then leave a
  * one-second gap.
  *
- * older_than_this takes precedence over nr_to_write.  So we'll only write back
+ * dirtied_before takes precedence over nr_to_write.  So we'll only write back
  * all dirty pages if they are all attached to "old" mappings.
  */
 static long wb_writeback(struct bdi_writeback *wb,
@@ -1839,14 +1844,11 @@ static long wb_writeback(struct bdi_writeback *wb,
 {
        unsigned long wb_start = jiffies;
        long nr_pages = work->nr_pages;
-       unsigned long oldest_jif;
+       unsigned long dirtied_before = jiffies;
        struct inode *inode;
        long progress;
        struct blk_plug plug;
 
-       oldest_jif = jiffies;
-       work->older_than_this = &oldest_jif;
-
        blk_start_plug(&plug);
        spin_lock(&wb->list_lock);
        for (;;) {
@@ -1880,14 +1882,14 @@ static long wb_writeback(struct bdi_writeback *wb,
                 * safe.
                 */
                if (work->for_kupdate) {
-                       oldest_jif = jiffies -
+                       dirtied_before = jiffies -
                                msecs_to_jiffies(dirty_expire_interval * 10);
                } else if (work->for_background)
-                       oldest_jif = jiffies;
+                       dirtied_before = jiffies;
 
                trace_writeback_start(wb, work);
                if (list_empty(&wb->b_io))
-                       queue_io(wb, work);
+                       queue_io(wb, work, dirtied_before);
                if (work->sb)
                        progress = writeback_sb_inodes(work->sb, wb, work);
                else
@@ -2182,7 +2184,7 @@ static int __init start_dirtytime_writeback(void)
 __initcall(start_dirtytime_writeback);
 
 int dirtytime_interval_handler(struct ctl_table *table, int write,
-                              void __user *buffer, size_t *lenp, loff_t *ppos)
+                              void *buffer, size_t *lenp, loff_t *ppos)
 {
        int ret;
 
@@ -2289,11 +2291,12 @@ void __mark_inode_dirty(struct inode *inode, int flags)
                inode->i_state |= flags;
 
                /*
-                * If the inode is being synced, just update its dirty state.
-                * The unlocker will place the inode on the appropriate
-                * superblock list, based upon its state.
+                * If the inode is queued for writeback by flush worker, just
+                * update its dirty state. Once the flush worker is done with
+                * the inode it will place it on the appropriate superblock
+                * list, based upon its state.
                 */
-               if (inode->i_state & I_SYNC)
+               if (inode->i_state & I_SYNC_QUEUED)
                        goto out_unlock_inode;
 
                /*
index 7d5c5dd2b1d5af34559dfcca079089aa93ddec37..2834d1afa6e8053e93c6e78122be8d58107a36c9 100644 (file)
@@ -521,7 +521,7 @@ static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param)
        switch (param->type) {
        case fs_value_is_string:
                len = 1 + param->size;
-               /* Fall through */
+               fallthrough;
        case fs_value_is_flag:
                len += strlen(param->key);
                break;
index 2fa3f241b76211e2d0d7ba5e6abd18c5f2d21f26..27a890aa493abf89960c374eaeab31192b662d73 100644 (file)
@@ -412,7 +412,7 @@ SYSCALL_DEFINE5(fsconfig,
                break;
        case FSCONFIG_SET_PATH_EMPTY:
                lookup_flags = LOOKUP_EMPTY;
-               /* fallthru */
+               fallthrough;
        case FSCONFIG_SET_PATH:
                param.type = fs_value_is_filename;
                param.name = getname_flags(_value, lookup_flags, NULL);
index 6611ef3269a80accc9544feeab5a0b4a35e0aa12..43c165e796da2dc200f3239cf41f424f3d409b36 100644 (file)
@@ -3091,11 +3091,10 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
        ssize_t ret = 0;
        struct file *file = iocb->ki_filp;
        struct fuse_file *ff = file->private_data;
-       bool async_dio = ff->fc->async_dio;
        loff_t pos = 0;
        struct inode *inode;
        loff_t i_size;
-       size_t count = iov_iter_count(iter);
+       size_t count = iov_iter_count(iter), shortened = 0;
        loff_t offset = iocb->ki_pos;
        struct fuse_io_priv *io;
 
@@ -3103,17 +3102,9 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
        inode = file->f_mapping->host;
        i_size = i_size_read(inode);
 
-       if ((iov_iter_rw(iter) == READ) && (offset > i_size))
+       if ((iov_iter_rw(iter) == READ) && (offset >= i_size))
                return 0;
 
-       /* optimization for short read */
-       if (async_dio && iov_iter_rw(iter) != WRITE && offset + count > i_size) {
-               if (offset >= i_size)
-                       return 0;
-               iov_iter_truncate(iter, fuse_round_up(ff->fc, i_size - offset));
-               count = iov_iter_count(iter);
-       }
-
        io = kmalloc(sizeof(struct fuse_io_priv), GFP_KERNEL);
        if (!io)
                return -ENOMEM;
@@ -3129,15 +3120,22 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
         * By default, we want to optimize all I/Os with async request
         * submission to the client filesystem if supported.
         */
-       io->async = async_dio;
+       io->async = ff->fc->async_dio;
        io->iocb = iocb;
        io->blocking = is_sync_kiocb(iocb);
 
+       /* optimization for short read */
+       if (io->async && !io->write && offset + count > i_size) {
+               iov_iter_truncate(iter, fuse_round_up(ff->fc, i_size - offset));
+               shortened = count - iov_iter_count(iter);
+               count -= shortened;
+       }
+
        /*
         * We cannot asynchronously extend the size of a file.
         * In such case the aio will behave exactly like sync io.
         */
-       if ((offset + count > i_size) && iov_iter_rw(iter) == WRITE)
+       if ((offset + count > i_size) && io->write)
                io->blocking = true;
 
        if (io->async && io->blocking) {
@@ -3155,6 +3153,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
        } else {
                ret = __fuse_direct_read(io, iter, &pos);
        }
+       iov_iter_reexpand(iter, iov_iter_count(iter) + shortened);
 
        if (io->async) {
                bool blocking = io->blocking;
index 770f3a720db9a44f853c95fe4b7985505f7d83ad..0f69fbd4af664e55fde37b93f6aa83c55aa501e2 100644 (file)
@@ -746,7 +746,7 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
                        }
                        if (n == 0)
                                break;
-               /* fall through - To branching from existing tree */
+                       fallthrough;    /* To branching from existing tree */
                case ALLOC_GROW_DEPTH:
                        if (i > 1 && i < mp->mp_fheight)
                                gfs2_trans_add_meta(ip->i_gl, mp->mp_bh[i-1]);
@@ -757,7 +757,7 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
                                state = ALLOC_DATA;
                        if (n == 0)
                                break;
-               /* fall through - To tree complete, adding data blocks */
+                       fallthrough;    /* To tree complete, adding data blocks */
                case ALLOC_DATA:
                        BUG_ON(n > dblks);
                        BUG_ON(mp->mp_bh[end_of_metadata] == NULL);
index a58333e3980df804478a6c0b3d8e05485338e59f..3763c9ff1406bdbe102db85e2f5a68bf166e5c09 100644 (file)
@@ -901,6 +901,36 @@ static void empty_ail1_list(struct gfs2_sbd *sdp)
        }
 }
 
+/**
+ * drain_bd - drain the buf and databuf queue for a failed transaction
+ * @tr: the transaction to drain
+ *
+ * When this is called, we're taking an error exit for a log write that failed
+ * but since we bypassed the after_commit functions, we need to remove the
+ * items from the buf and databuf queue.
+ */
+static void trans_drain(struct gfs2_trans *tr)
+{
+       struct gfs2_bufdata *bd;
+       struct list_head *head;
+
+       if (!tr)
+               return;
+
+       head = &tr->tr_buf;
+       while (!list_empty(head)) {
+               bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
+               list_del_init(&bd->bd_list);
+               kmem_cache_free(gfs2_bufdata_cachep, bd);
+       }
+       head = &tr->tr_databuf;
+       while (!list_empty(head)) {
+               bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
+               list_del_init(&bd->bd_list);
+               kmem_cache_free(gfs2_bufdata_cachep, bd);
+       }
+}
+
 /**
  * gfs2_log_flush - flush incore transaction(s)
  * @sdp: the filesystem
@@ -1005,6 +1035,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
 
 out:
        if (gfs2_withdrawn(sdp)) {
+               trans_drain(tr);
                /**
                 * If the tr_list is empty, we're withdrawing during a log
                 * flush that targets a transaction, but the transaction was
index 4b67d47a7e00467b087a53f3d44cb15bffee9248..6e173ae378c44fcc3b9b3050182801e6f92824a3 100644 (file)
@@ -1599,7 +1599,7 @@ static int gfs2_quota_get_state(struct super_block *sb, struct qc_state *state)
        case GFS2_QUOTA_ON:
                state->s_state[USRQUOTA].flags |= QCI_LIMITS_ENFORCED;
                state->s_state[GRPQUOTA].flags |= QCI_LIMITS_ENFORCED;
-               /*FALLTHRU*/
+               fallthrough;
        case GFS2_QUOTA_ACCOUNT:
                state->s_state[USRQUOTA].flags |= QCI_ACCT_ENABLED |
                                                  QCI_SYSFILE;
index e1c7eb6eb00a4018b5e97495b3aa93bdc13a2ab8..6d4bf7ea7b3be66d3fcdcb51dd0722d5d35826b3 100644 (file)
@@ -67,6 +67,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
                tr->tr_reserved += gfs2_struct2blk(sdp, revokes);
        INIT_LIST_HEAD(&tr->tr_databuf);
        INIT_LIST_HEAD(&tr->tr_buf);
+       INIT_LIST_HEAD(&tr->tr_list);
        INIT_LIST_HEAD(&tr->tr_ail1_list);
        INIT_LIST_HEAD(&tr->tr_ail2_list);
 
index 61eec628805de23af7d29958aea0f08016f8fbfd..0350dc7821bf951e367da0f0bee090f8fb6a50ce 100644 (file)
@@ -195,7 +195,7 @@ reread:
        switch (sbi->s_vhdr->signature) {
        case cpu_to_be16(HFSPLUS_VOLHEAD_SIGX):
                set_bit(HFSPLUS_SB_HFSX, &sbi->flags);
-               /*FALLTHRU*/
+               fallthrough;
        case cpu_to_be16(HFSPLUS_VOLHEAD_SIG):
                break;
        case cpu_to_be16(HFSP_WRAP_MAGIC):
index e92c4724480cadc8756360802ee9d44e748c0f32..414beb5438836cf4c28935bbdfd376e74078e19f 100644 (file)
@@ -925,6 +925,24 @@ static bool io_wq_worker_cancel(struct io_worker *worker, void *data)
        return match->nr_running && !match->cancel_all;
 }
 
+static inline void io_wqe_remove_pending(struct io_wqe *wqe,
+                                        struct io_wq_work *work,
+                                        struct io_wq_work_node *prev)
+{
+       unsigned int hash = io_get_work_hash(work);
+       struct io_wq_work *prev_work = NULL;
+
+       if (io_wq_is_hashed(work) && work == wqe->hash_tail[hash]) {
+               if (prev)
+                       prev_work = container_of(prev, struct io_wq_work, list);
+               if (prev_work && io_get_work_hash(prev_work) == hash)
+                       wqe->hash_tail[hash] = prev_work;
+               else
+                       wqe->hash_tail[hash] = NULL;
+       }
+       wq_list_del(&wqe->work_list, &work->list, prev);
+}
+
 static void io_wqe_cancel_pending_work(struct io_wqe *wqe,
                                       struct io_cb_cancel_data *match)
 {
@@ -938,8 +956,7 @@ retry:
                work = container_of(node, struct io_wq_work, list);
                if (!match->fn(work, match->data))
                        continue;
-
-               wq_list_del(&wqe->work_list, node, prev);
+               io_wqe_remove_pending(wqe, work, prev);
                spin_unlock_irqrestore(&wqe->lock, flags);
                io_run_cancel(work, wqe);
                match->nr_pending++;
index 91e2cc8414f9a22a12c1f41498ed35ff4670568a..eed0d068904c07464ec7927caee861e4df4015e1 100644 (file)
@@ -1150,7 +1150,7 @@ static void io_prep_async_work(struct io_kiocb *req)
        io_req_init_async(req);
 
        if (req->flags & REQ_F_ISREG) {
-               if (def->hash_reg_file)
+               if (def->hash_reg_file || (req->ctx->flags & IORING_SETUP_IOPOLL))
                        io_wq_hash_work(&req->work, file_inode(req->file));
        } else {
                if (def->unbound_nonreg_file)
@@ -1746,12 +1746,16 @@ static struct io_kiocb *io_req_find_next(struct io_kiocb *req)
        return __io_req_find_next(req);
 }
 
-static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb)
+static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb,
+                               bool twa_signal_ok)
 {
        struct task_struct *tsk = req->task;
        struct io_ring_ctx *ctx = req->ctx;
        int ret, notify;
 
+       if (tsk->flags & PF_EXITING)
+               return -ESRCH;
+
        /*
         * SQPOLL kernel thread doesn't need notification, just a wakeup. For
         * all other cases, use TWA_SIGNAL unconditionally to ensure we're
@@ -1759,7 +1763,7 @@ static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb)
         * will do the job.
         */
        notify = 0;
-       if (!(ctx->flags & IORING_SETUP_SQPOLL))
+       if (!(ctx->flags & IORING_SETUP_SQPOLL) && twa_signal_ok)
                notify = TWA_SIGNAL;
 
        ret = task_work_add(tsk, cb, notify);
@@ -1786,8 +1790,10 @@ static void __io_req_task_cancel(struct io_kiocb *req, int error)
 static void io_req_task_cancel(struct callback_head *cb)
 {
        struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
+       struct io_ring_ctx *ctx = req->ctx;
 
        __io_req_task_cancel(req, -ECANCELED);
+       percpu_ref_put(&ctx->refs);
 }
 
 static void __io_req_task_submit(struct io_kiocb *req)
@@ -1819,7 +1825,7 @@ static void io_req_task_queue(struct io_kiocb *req)
        init_task_work(&req->task_work, io_req_task_submit);
        percpu_ref_get(&req->ctx->refs);
 
-       ret = io_req_task_work_add(req, &req->task_work);
+       ret = io_req_task_work_add(req, &req->task_work, true);
        if (unlikely(ret)) {
                struct task_struct *tsk;
 
@@ -2009,6 +2015,12 @@ static inline unsigned int io_put_rw_kbuf(struct io_kiocb *req)
 
 static inline bool io_run_task_work(void)
 {
+       /*
+        * Not safe to run on exiting task, and the task_work handling will
+        * not add work to such a task.
+        */
+       if (unlikely(current->flags & PF_EXITING))
+               return false;
        if (current->task_works) {
                __set_current_state(TASK_RUNNING);
                task_work_run();
@@ -2048,6 +2060,7 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
 
                req = list_first_entry(done, struct io_kiocb, inflight_entry);
                if (READ_ONCE(req->result) == -EAGAIN) {
+                       req->result = 0;
                        req->iopoll_completed = 0;
                        list_move_tail(&req->inflight_entry, &again);
                        continue;
@@ -2281,50 +2294,43 @@ static bool io_resubmit_prep(struct io_kiocb *req, int error)
                goto end_req;
        }
 
-       ret = io_import_iovec(rw, req, &iovec, &iter, false);
-       if (ret < 0)
-               goto end_req;
-       ret = io_setup_async_rw(req, iovec, inline_vecs, &iter, false);
-       if (!ret)
+       if (!req->io) {
+               ret = io_import_iovec(rw, req, &iovec, &iter, false);
+               if (ret < 0)
+                       goto end_req;
+               ret = io_setup_async_rw(req, iovec, inline_vecs, &iter, false);
+               if (!ret)
+                       return true;
+               kfree(iovec);
+       } else {
                return true;
-       kfree(iovec);
+       }
 end_req:
        req_set_fail_links(req);
        io_req_complete(req, ret);
        return false;
 }
-
-static void io_rw_resubmit(struct callback_head *cb)
-{
-       struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
-       struct io_ring_ctx *ctx = req->ctx;
-       int err;
-
-       err = io_sq_thread_acquire_mm(ctx, req);
-
-       if (io_resubmit_prep(req, err)) {
-               refcount_inc(&req->refs);
-               io_queue_async_work(req);
-       }
-
-       percpu_ref_put(&ctx->refs);
-}
 #endif
 
 static bool io_rw_reissue(struct io_kiocb *req, long res)
 {
 #ifdef CONFIG_BLOCK
+       umode_t mode = file_inode(req->file)->i_mode;
        int ret;
 
+       if (!S_ISBLK(mode) && !S_ISREG(mode))
+               return false;
        if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker())
                return false;
 
-       init_task_work(&req->task_work, io_rw_resubmit);
-       percpu_ref_get(&req->ctx->refs);
+       ret = io_sq_thread_acquire_mm(req->ctx, req);
 
-       ret = io_req_task_work_add(req, &req->task_work);
-       if (!ret)
+       if (io_resubmit_prep(req, ret)) {
+               refcount_inc(&req->refs);
+               io_queue_async_work(req);
                return true;
+       }
+
 #endif
        return false;
 }
@@ -2563,7 +2569,7 @@ static inline void io_rw_done(struct kiocb *kiocb, ssize_t ret)
                 * IO with EINTR.
                 */
                ret = -EINTR;
-               /* fall through */
+               fallthrough;
        default:
                kiocb->ki_complete(kiocb, ret, 0);
        }
@@ -2865,6 +2871,11 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req,
        return iov_iter_count(&req->io->rw.iter);
 }
 
+static inline loff_t *io_kiocb_ppos(struct kiocb *kiocb)
+{
+       return kiocb->ki_filp->f_mode & FMODE_STREAM ? NULL : &kiocb->ki_pos;
+}
+
 /*
  * For files that don't have ->read_iter() and ->write_iter(), handle them
  * by looping over ->read() or ->write() manually.
@@ -2900,10 +2911,10 @@ static ssize_t loop_rw_iter(int rw, struct file *file, struct kiocb *kiocb,
 
                if (rw == READ) {
                        nr = file->f_op->read(file, iovec.iov_base,
-                                             iovec.iov_len, &kiocb->ki_pos);
+                                             iovec.iov_len, io_kiocb_ppos(kiocb));
                } else {
                        nr = file->f_op->write(file, iovec.iov_base,
-                                              iovec.iov_len, &kiocb->ki_pos);
+                                              iovec.iov_len, io_kiocb_ppos(kiocb));
                }
 
                if (iov_iter_is_bvec(iter))
@@ -2984,14 +2995,15 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw,
                                   bool force_nonblock)
 {
        struct io_async_rw *iorw = &req->io->rw;
+       struct iovec *iov;
        ssize_t ret;
 
-       iorw->iter.iov = iorw->fast_iov;
-       ret = __io_import_iovec(rw, req, (struct iovec **) &iorw->iter.iov,
-                               &iorw->iter, !force_nonblock);
+       iorw->iter.iov = iov = iorw->fast_iov;
+       ret = __io_import_iovec(rw, req, &iov, &iorw->iter, !force_nonblock);
        if (unlikely(ret < 0))
                return ret;
 
+       iorw->iter.iov = iov;
        io_req_map_rw(req, iorw->iter.iov, iorw->fast_iov, &iorw->iter);
        return 0;
 }
@@ -3044,7 +3056,7 @@ static int io_async_buf_func(struct wait_queue_entry *wait, unsigned mode,
 
        /* submit ref gets dropped, acquire a new one */
        refcount_inc(&req->refs);
-       ret = io_req_task_work_add(req, &req->task_work);
+       ret = io_req_task_work_add(req, &req->task_work, true);
        if (unlikely(ret)) {
                struct task_struct *tsk;
 
@@ -3118,6 +3130,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
        struct iov_iter __iter, *iter = &__iter;
        ssize_t io_size, ret, ret2;
        size_t iov_count;
+       bool no_async;
 
        if (req->io)
                iter = &req->io->rw.iter;
@@ -3125,6 +3138,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
        ret = io_import_iovec(READ, req, &iovec, iter, !force_nonblock);
        if (ret < 0)
                return ret;
+       iov_count = iov_iter_count(iter);
        io_size = ret;
        req->result = io_size;
        ret = 0;
@@ -3134,11 +3148,11 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
                kiocb->ki_flags &= ~IOCB_NOWAIT;
 
        /* If the file doesn't support async, just async punt */
-       if (force_nonblock && !io_file_supports_async(req->file, READ))
+       no_async = force_nonblock && !io_file_supports_async(req->file, READ);
+       if (no_async)
                goto copy_iov;
 
-       iov_count = iov_iter_count(iter);
-       ret = rw_verify_area(READ, req->file, &kiocb->ki_pos, iov_count);
+       ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), iov_count);
        if (unlikely(ret))
                goto out_free;
 
@@ -3150,14 +3164,19 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
                ret = 0;
                goto out_free;
        } else if (ret == -EAGAIN) {
-               if (!force_nonblock)
+               /* IOPOLL retry should happen for io-wq threads */
+               if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL))
                        goto done;
-               ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
-               if (ret)
-                       goto out_free;
-               return -EAGAIN;
+               /* no retry on NONBLOCK marked file */
+               if (req->file->f_flags & O_NONBLOCK)
+                       goto done;
+               /* some cases will consume bytes even on error returns */
+               iov_iter_revert(iter, iov_count - iov_iter_count(iter));
+               ret = 0;
+               goto copy_iov;
        } else if (ret < 0) {
-               goto out_free;
+               /* make sure -ERESTARTSYS -> -EINTR is done */
+               goto done;
        }
 
        /* read it all, or we did blocking attempt. no retry. */
@@ -3172,6 +3191,8 @@ copy_iov:
                ret = ret2;
                goto out_free;
        }
+       if (no_async)
+               return -EAGAIN;
        /* it's copied and will be cleaned with ->io */
        iovec = NULL;
        /* now use our persistent iterator, if we aren't already */
@@ -3241,6 +3262,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
        ret = io_import_iovec(WRITE, req, &iovec, iter, !force_nonblock);
        if (ret < 0)
                return ret;
+       iov_count = iov_iter_count(iter);
        io_size = ret;
        req->result = io_size;
 
@@ -3257,8 +3279,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
            (req->flags & REQ_F_ISREG))
                goto copy_iov;
 
-       iov_count = iov_iter_count(iter);
-       ret = rw_verify_area(WRITE, req->file, &kiocb->ki_pos, iov_count);
+       ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), iov_count);
        if (unlikely(ret))
                goto out_free;
 
@@ -3290,10 +3311,19 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
         */
        if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT))
                ret2 = -EAGAIN;
+       /* no retry on NONBLOCK marked file */
+       if (ret2 == -EAGAIN && (req->file->f_flags & O_NONBLOCK))
+               goto done;
        if (!force_nonblock || ret2 != -EAGAIN) {
+               /* IOPOLL retry should happen for io-wq threads */
+               if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN)
+                       goto copy_iov;
+done:
                kiocb_done(kiocb, ret2, cs);
        } else {
 copy_iov:
+               /* some cases will consume bytes even on error returns */
+               iov_iter_revert(iter, iov_count - iov_iter_count(iter));
                ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
                if (!ret)
                        return -EAGAIN;
@@ -3495,8 +3525,6 @@ static int __io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
        const char __user *fname;
        int ret;
 
-       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
-               return -EINVAL;
        if (unlikely(sqe->ioprio || sqe->buf_index))
                return -EINVAL;
        if (unlikely(req->flags & REQ_F_FIXED_FILE))
@@ -3523,6 +3551,8 @@ static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 {
        u64 flags, mode;
 
+       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
+               return -EINVAL;
        if (req->flags & REQ_F_NEED_CLEANUP)
                return 0;
        mode = READ_ONCE(sqe->len);
@@ -3537,6 +3567,8 @@ static int io_openat2_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
        size_t len;
        int ret;
 
+       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
+               return -EINVAL;
        if (req->flags & REQ_F_NEED_CLEANUP)
                return 0;
        how = u64_to_user_ptr(READ_ONCE(sqe->addr2));
@@ -3754,7 +3786,7 @@ static int io_epoll_ctl_prep(struct io_kiocb *req,
 #if defined(CONFIG_EPOLL)
        if (sqe->ioprio || sqe->buf_index)
                return -EINVAL;
-       if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
+       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL)))
                return -EINVAL;
 
        req->epoll.epfd = READ_ONCE(sqe->fd);
@@ -3869,7 +3901,7 @@ static int io_fadvise(struct io_kiocb *req, bool force_nonblock)
 
 static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 {
-       if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
+       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL)))
                return -EINVAL;
        if (sqe->ioprio || sqe->buf_index)
                return -EINVAL;
@@ -4566,6 +4598,7 @@ struct io_poll_table {
 static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll,
                           __poll_t mask, task_work_func_t func)
 {
+       bool twa_signal_ok;
        int ret;
 
        /* for instances that support it check for an event match first: */
@@ -4580,13 +4613,21 @@ static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll,
        init_task_work(&req->task_work, func);
        percpu_ref_get(&req->ctx->refs);
 
+       /*
+        * If we using the signalfd wait_queue_head for this wakeup, then
+        * it's not safe to use TWA_SIGNAL as we could be recursing on the
+        * tsk->sighand->siglock on doing the wakeup. Should not be needed
+        * either, as the normal wakeup will suffice.
+        */
+       twa_signal_ok = (poll->head != &req->task->sighand->signalfd_wqh);
+
        /*
         * If this fails, then the task is exiting. When a task exits, the
         * work gets canceled, so just cancel this request as well instead
         * of executing it. We can't safely execute it anyway, as we may not
         * have the needed state needed for it anyway.
         */
-       ret = io_req_task_work_add(req, &req->task_work);
+       ret = io_req_task_work_add(req, &req->task_work, twa_signal_ok);
        if (unlikely(ret)) {
                struct task_struct *tsk;
 
@@ -4875,12 +4916,20 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
        struct async_poll *apoll;
        struct io_poll_table ipt;
        __poll_t mask, ret;
+       int rw;
 
        if (!req->file || !file_can_poll(req->file))
                return false;
        if (req->flags & REQ_F_POLLED)
                return false;
-       if (!def->pollin && !def->pollout)
+       if (def->pollin)
+               rw = READ;
+       else if (def->pollout)
+               rw = WRITE;
+       else
+               return false;
+       /* if we can't nonblock try, then no point in arming a poll handler */
+       if (!io_file_supports_async(req->file, rw))
                return false;
 
        apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);
@@ -5369,6 +5418,8 @@ static int io_async_cancel(struct io_kiocb *req)
 static int io_files_update_prep(struct io_kiocb *req,
                                const struct io_uring_sqe *sqe)
 {
+       if (unlikely(req->ctx->flags & IORING_SETUP_SQPOLL))
+               return -EINVAL;
        if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
                return -EINVAL;
        if (sqe->ioprio || sqe->rw_flags)
@@ -5419,6 +5470,8 @@ static int io_req_defer_prep(struct io_kiocb *req,
        if (unlikely(ret))
                return ret;
 
+       io_prep_async_work(req);
+
        switch (req->opcode) {
        case IORING_OP_NOP:
                break;
@@ -5616,6 +5669,11 @@ static void __io_clean_op(struct io_kiocb *req)
                        io_put_file(req, req->splice.file_in,
                                    (req->splice.flags & SPLICE_F_FD_IN_FIXED));
                        break;
+               case IORING_OP_OPENAT:
+               case IORING_OP_OPENAT2:
+                       if (req->open.filename)
+                               putname(req->open.filename);
+                       break;
                }
                req->flags &= ~REQ_F_NEED_CLEANUP;
        }
@@ -6293,9 +6351,6 @@ static void io_submit_state_start(struct io_submit_state *state,
                                  struct io_ring_ctx *ctx, unsigned int max_ios)
 {
        blk_start_plug(&state->plug);
-#ifdef CONFIG_BLOCK
-       state->plug.nowait = true;
-#endif
        state->comp.nr = 0;
        INIT_LIST_HEAD(&state->comp.list);
        state->comp.ctx = ctx;
@@ -7305,7 +7360,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
                table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT];
                index = i & IORING_FILE_TABLE_MASK;
                if (table->files[index]) {
-                       file = io_file_from_index(ctx, index);
+                       file = table->files[index];
                        err = io_queue_file_removal(data, file);
                        if (err)
                                break;
@@ -7334,6 +7389,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
                        table->files[index] = file;
                        err = io_sqe_file_register(ctx, file, i);
                        if (err) {
+                               table->files[index] = NULL;
                                fput(file);
                                break;
                        }
@@ -7433,9 +7489,6 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx,
 {
        int ret;
 
-       mmgrab(current->mm);
-       ctx->sqo_mm = current->mm;
-
        if (ctx->flags & IORING_SETUP_SQPOLL) {
                ret = -EPERM;
                if (!capable(CAP_SYS_ADMIN))
@@ -7480,10 +7533,6 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx,
        return 0;
 err:
        io_finish_async(ctx);
-       if (ctx->sqo_mm) {
-               mmdrop(ctx->sqo_mm);
-               ctx->sqo_mm = NULL;
-       }
        return ret;
 }
 
@@ -8000,6 +8049,28 @@ static bool io_match_link(struct io_kiocb *preq, struct io_kiocb *req)
        return false;
 }
 
+static inline bool io_match_files(struct io_kiocb *req,
+                                      struct files_struct *files)
+{
+       return (req->flags & REQ_F_WORK_INITIALIZED) && req->work.files == files;
+}
+
+static bool io_match_link_files(struct io_kiocb *req,
+                               struct files_struct *files)
+{
+       struct io_kiocb *link;
+
+       if (io_match_files(req, files))
+               return true;
+       if (req->flags & REQ_F_LINK_HEAD) {
+               list_for_each_entry(link, &req->link_list, link_list) {
+                       if (io_match_files(link, files))
+                               return true;
+               }
+       }
+       return false;
+}
+
 /*
  * We're looking to cancel 'req' because it's holding on to our files, but
  * 'req' could be a link to another request. See if it is, and cancel that
@@ -8074,12 +8145,38 @@ static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req)
        io_timeout_remove_link(ctx, req);
 }
 
+static void io_cancel_defer_files(struct io_ring_ctx *ctx,
+                                 struct files_struct *files)
+{
+       struct io_defer_entry *de = NULL;
+       LIST_HEAD(list);
+
+       spin_lock_irq(&ctx->completion_lock);
+       list_for_each_entry_reverse(de, &ctx->defer_list, list) {
+               if (io_match_link_files(de->req, files)) {
+                       list_cut_position(&list, &ctx->defer_list, &de->list);
+                       break;
+               }
+       }
+       spin_unlock_irq(&ctx->completion_lock);
+
+       while (!list_empty(&list)) {
+               de = list_first_entry(&list, struct io_defer_entry, list);
+               list_del_init(&de->list);
+               req_set_fail_links(de->req);
+               io_put_req(de->req);
+               io_req_complete(de->req, -ECANCELED);
+               kfree(de);
+       }
+}
+
 static void io_uring_cancel_files(struct io_ring_ctx *ctx,
                                  struct files_struct *files)
 {
        if (list_empty_careful(&ctx->inflight_list))
                return;
 
+       io_cancel_defer_files(ctx, files);
        /* cancel all at once, should be faster than doing it one by one*/
        io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true);
 
@@ -8108,6 +8205,8 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx,
                /* cancel this request, or head link requests */
                io_attempt_cancel(ctx, cancel_req);
                io_put_req(cancel_req);
+               /* cancellations _may_ trigger task work */
+               io_run_task_work();
                schedule();
                finish_wait(&ctx->inflight_wait, &wait);
        }
@@ -8533,6 +8632,9 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p,
        ctx->user = user;
        ctx->creds = get_current_cred();
 
+       mmgrab(current->mm);
+       ctx->sqo_mm = current->mm;
+
        /*
         * Account memory _before_ installing the file descriptor. Once
         * the descriptor is installed, it can get closed at any time. Also
index 89f61d93c0bcfddad22c6dda6385bdaa4e8da893..107ee80c356833936487d200fae5825eac90d976 100644 (file)
@@ -127,7 +127,7 @@ iomap_seek_hole_actor(struct inode *inode, loff_t offset, loff_t length,
                                                   SEEK_HOLE);
                if (offset < 0)
                        return length;
-               /* fall through */
+               fallthrough;
        case IOMAP_HOLE:
                *(loff_t *)data = offset;
                return 0;
@@ -175,7 +175,7 @@ iomap_seek_data_actor(struct inode *inode, loff_t offset, loff_t length,
                                                   SEEK_DATA);
                if (offset < 0)
                        return length;
-               /*FALLTHRU*/
+               fallthrough;
        default:
                *(loff_t *)data = offset;
                return 0;
index ab8cdd9e932590ea484f2e45b927e26f244ad2f7..78858f6e95839cb03859fd36d67dfd85d7c6ba74 100644 (file)
@@ -341,7 +341,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
                        rdev = old_decode_dev(je16_to_cpu(jdev.old_id));
                else
                        rdev = new_decode_dev(je32_to_cpu(jdev.new_id));
-               /* fall through */
+               fallthrough;
 
        case S_IFSOCK:
        case S_IFIFO:
index bccfc40b3a74ab002e45a07149afbe09634d8f64..2f6f0b140c05aaa0217e85da7c4211b9aa5d2321 100644 (file)
@@ -1273,7 +1273,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
                        dbg_readinode("symlink's target '%s' cached\n", f->target);
                }
 
-               /* fall through... */
+               fallthrough;
 
        case S_IFBLK:
        case S_IFCHR:
index 4d08edf19c78252ebe3af999bf60e19823d3b8f2..e0d42e977d9afd5aafcd0fb85cce4c9752ef895f 100644 (file)
@@ -137,11 +137,11 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
        switch (whence) {
                case 1:
                        offset += file->f_pos;
-                       /* fall through */
+                       fallthrough;
                case 0:
                        if (offset >= 0)
                                break;
-                       /* fall through */
+                       fallthrough;
                default:
                        return -EINVAL;
        }
index 8fc0542f513264c6fd1eb96581ab888878e99f8b..1f84a03601feca5ef577682572be81808b97e53f 100644 (file)
@@ -1499,7 +1499,7 @@ static void lease_clear_pending(struct file_lock *fl, int arg)
        switch (arg) {
        case F_UNLCK:
                fl->fl_flags &= ~FL_UNLOCK_PENDING;
-               /* fall through */
+               fallthrough;
        case F_RDLCK:
                fl->fl_flags &= ~FL_DOWNGRADE_PENDING;
        }
@@ -2525,7 +2525,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
                cmd = F_SETLKW;
                file_lock->fl_flags |= FL_OFDLCK;
                file_lock->fl_owner = filp;
-               /* Fallthrough */
+               fallthrough;
        case F_SETLKW:
                file_lock->fl_flags |= FL_SLEEP;
        }
@@ -2656,7 +2656,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
                cmd = F_SETLKW64;
                file_lock->fl_flags |= FL_OFDLCK;
                file_lock->fl_owner = filp;
-               /* Fallthrough */
+               fallthrough;
        case F_SETLKW64:
                file_lock->fl_flags |= FL_SLEEP;
        }
index d1a0e2c8b1b486bd2866b388fce595f036abe58b..08108b6d2fa107e3bbc0cc86668fea662db4f2eb 100644 (file)
@@ -753,7 +753,7 @@ out:
        case -ENODEV:
                /* Our extent block devices are unavailable */
                set_bit(NFS_LSEG_UNAVAILABLE, &lseg->pls_flags);
-               /* Fall through */
+               fallthrough;
        case 0:
                return lseg;
        default:
index a12f42e7d8c7c417caeb23b88dcd4542d5424f50..cb52db9a0cfb7006d2fb31d7c309d615b88a7bbe 100644 (file)
@@ -579,6 +579,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
        xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
 
        do {
+               if (entry->label)
+                       entry->label->len = NFS4_MAXLABELLEN;
+
                status = xdr_decode(desc, entry, &stream);
                if (status != 0) {
                        if (status == -EAGAIN)
@@ -1181,7 +1184,7 @@ int nfs_lookup_verify_inode(struct inode *inode, unsigned int flags)
                        /* A NFSv4 OPEN will revalidate later */
                        if (server->caps & NFS_CAP_ATOMIC_OPEN)
                                goto out;
-                       /* Fallthrough */
+                       fallthrough;
                case S_IFDIR:
                        if (server->flags & NFS_MOUNT_NOCTO)
                                break;
index a13e69009f19610c7afe1136cd2d79bb3c475146..7f5aa0403e16743c2266c6308cacb9fec20711ea 100644 (file)
@@ -187,7 +187,7 @@ static int filelayout_async_handle_error(struct rpc_task *task,
                pnfs_error_mark_layout_for_return(inode, lseg);
                pnfs_set_lo_fail(lseg);
                rpc_wake_up(&tbl->slot_tbl_waitq);
-               /* fall through */
+               fallthrough;
        default:
 reset:
                dprintk("%s Retry through MDS. Error %d\n", __func__,
index 965145592750afe3312e9569c666233e386dbda4..a163533446fa359a74474d5f99d7b0c5d6ec4cc7 100644 (file)
@@ -715,7 +715,7 @@ nfs4_ff_layout_stat_io_end_write(struct rpc_task *task,
 }
 
 static void
-ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, int idx)
+ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, u32 idx)
 {
        struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);
 
@@ -724,7 +724,7 @@ ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, int idx)
 }
 
 static void
-ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, int idx)
+ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, u32 idx)
 {
        struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);
 
@@ -734,14 +734,14 @@ ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, int idx)
 
 static struct nfs4_pnfs_ds *
 ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
-                            int start_idx, int *best_idx,
+                            u32 start_idx, u32 *best_idx,
                             bool check_device)
 {
        struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg);
        struct nfs4_ff_layout_mirror *mirror;
        struct nfs4_pnfs_ds *ds;
        bool fail_return = false;
-       int idx;
+       u32 idx;
 
        /* mirrors are initially sorted by efficiency */
        for (idx = start_idx; idx < fls->mirror_array_cnt; idx++) {
@@ -766,21 +766,21 @@ ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
 
 static struct nfs4_pnfs_ds *
 ff_layout_choose_any_ds_for_read(struct pnfs_layout_segment *lseg,
-                                int start_idx, int *best_idx)
+                                u32 start_idx, u32 *best_idx)
 {
        return ff_layout_choose_ds_for_read(lseg, start_idx, best_idx, false);
 }
 
 static struct nfs4_pnfs_ds *
 ff_layout_choose_valid_ds_for_read(struct pnfs_layout_segment *lseg,
-                                  int start_idx, int *best_idx)
+                                  u32 start_idx, u32 *best_idx)
 {
        return ff_layout_choose_ds_for_read(lseg, start_idx, best_idx, true);
 }
 
 static struct nfs4_pnfs_ds *
 ff_layout_choose_best_ds_for_read(struct pnfs_layout_segment *lseg,
-                                 int start_idx, int *best_idx)
+                                 u32 start_idx, u32 *best_idx)
 {
        struct nfs4_pnfs_ds *ds;
 
@@ -791,7 +791,8 @@ ff_layout_choose_best_ds_for_read(struct pnfs_layout_segment *lseg,
 }
 
 static struct nfs4_pnfs_ds *
-ff_layout_get_ds_for_read(struct nfs_pageio_descriptor *pgio, int *best_idx)
+ff_layout_get_ds_for_read(struct nfs_pageio_descriptor *pgio,
+                         u32 *best_idx)
 {
        struct pnfs_layout_segment *lseg = pgio->pg_lseg;
        struct nfs4_pnfs_ds *ds;
@@ -837,7 +838,7 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
        struct nfs_pgio_mirror *pgm;
        struct nfs4_ff_layout_mirror *mirror;
        struct nfs4_pnfs_ds *ds;
-       int ds_idx;
+       u32 ds_idx, i;
 
 retry:
        ff_layout_pg_check_layout(pgio, req);
@@ -863,14 +864,14 @@ retry:
                goto retry;
        }
 
-       mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx);
+       for (i = 0; i < pgio->pg_mirror_count; i++) {
+               mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i);
+               pgm = &pgio->pg_mirrors[i];
+               pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize;
+       }
 
        pgio->pg_mirror_idx = ds_idx;
 
-       /* read always uses only one mirror - idx 0 for pgio layer */
-       pgm = &pgio->pg_mirrors[0];
-       pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize;
-
        if (NFS_SERVER(pgio->pg_inode)->flags &
                        (NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR))
                pgio->pg_maxretrans = io_maxretrans;
@@ -894,7 +895,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
        struct nfs4_ff_layout_mirror *mirror;
        struct nfs_pgio_mirror *pgm;
        struct nfs4_pnfs_ds *ds;
-       int i;
+       u32 i;
 
 retry:
        ff_layout_pg_check_layout(pgio, req);
@@ -1038,7 +1039,7 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs)
 static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr)
 {
        u32 idx = hdr->pgio_mirror_idx + 1;
-       int new_idx = 0;
+       u32 new_idx = 0;
 
        if (ff_layout_choose_any_ds_for_read(hdr->lseg, idx + 1, &new_idx))
                ff_layout_send_layouterror(hdr->lseg);
@@ -1075,7 +1076,7 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
                                           struct nfs4_state *state,
                                           struct nfs_client *clp,
                                           struct pnfs_layout_segment *lseg,
-                                          int idx)
+                                          u32 idx)
 {
        struct pnfs_layout_hdr *lo = lseg->pls_layout;
        struct inode *inode = lo->plh_inode;
@@ -1133,7 +1134,7 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
                nfs4_delete_deviceid(devid->ld, devid->nfs_client,
                                &devid->deviceid);
                rpc_wake_up(&tbl->slot_tbl_waitq);
-               /* fall through */
+               fallthrough;
        default:
                if (ff_layout_avoid_mds_available_ds(lseg))
                        return -NFS4ERR_RESET_TO_PNFS;
@@ -1149,7 +1150,7 @@ reset:
 /* Retry all errors through either pNFS or MDS except for -EJUKEBOX */
 static int ff_layout_async_handle_error_v3(struct rpc_task *task,
                                           struct pnfs_layout_segment *lseg,
-                                          int idx)
+                                          u32 idx)
 {
        struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);
 
@@ -1184,7 +1185,7 @@ static int ff_layout_async_handle_error(struct rpc_task *task,
                                        struct nfs4_state *state,
                                        struct nfs_client *clp,
                                        struct pnfs_layout_segment *lseg,
-                                       int idx)
+                                       u32 idx)
 {
        int vers = clp->cl_nfs_mod->rpc_vers->number;
 
@@ -1211,7 +1212,7 @@ static int ff_layout_async_handle_error(struct rpc_task *task,
 }
 
 static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,
-                                       int idx, u64 offset, u64 length,
+                                       u32 idx, u64 offset, u64 length,
                                        u32 *op_status, int opnum, int error)
 {
        struct nfs4_ff_layout_mirror *mirror;
@@ -1260,7 +1261,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,
                 */
                if (opnum == OP_READ)
                        break;
-               /* Fallthrough */
+               fallthrough;
        default:
                pnfs_error_mark_layout_for_return(lseg->pls_layout->plh_inode,
                                                  lseg);
@@ -1809,7 +1810,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
        loff_t offset = hdr->args.offset;
        int vers;
        struct nfs_fh *fh;
-       int idx = hdr->pgio_mirror_idx;
+       u32 idx = hdr->pgio_mirror_idx;
 
        mirror = FF_LAYOUT_COMP(lseg, idx);
        ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true);
index 66949da0e82779891350964bc45e87872f9a8b78..524812984e2d43d78e275f5c6b08190797e0c3a5 100644 (file)
@@ -651,21 +651,21 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
                switch (lookup_constant(nfs_xprt_protocol_tokens, param->string, -1)) {
                case Opt_xprt_udp6:
                        protofamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_udp:
                        ctx->flags &= ~NFS_MOUNT_TCP;
                        ctx->nfs_server.protocol = XPRT_TRANSPORT_UDP;
                        break;
                case Opt_xprt_tcp6:
                        protofamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_tcp:
                        ctx->flags |= NFS_MOUNT_TCP;
                        ctx->nfs_server.protocol = XPRT_TRANSPORT_TCP;
                        break;
                case Opt_xprt_rdma6:
                        protofamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_rdma:
                        /* vector side protocols to TCP */
                        ctx->flags |= NFS_MOUNT_TCP;
@@ -684,13 +684,13 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
                switch (lookup_constant(nfs_xprt_protocol_tokens, param->string, -1)) {
                case Opt_xprt_udp6:
                        mountfamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_udp:
                        ctx->mount_server.protocol = XPRT_TRANSPORT_UDP;
                        break;
                case Opt_xprt_tcp6:
                        mountfamily = AF_INET6;
-                       /* fall through */
+                       fallthrough;
                case Opt_xprt_tcp:
                        ctx->mount_server.protocol = XPRT_TRANSPORT_TCP;
                        break;
@@ -899,9 +899,11 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
        ctx->version = NFS_DEFAULT_VERSION;
        switch (data->version) {
        case 1:
-               data->namlen = 0; /* fall through */
+               data->namlen = 0;
+               fallthrough;
        case 2:
-               data->bsize = 0; /* fall through */
+               data->bsize = 0;
+               fallthrough;
        case 3:
                if (data->flags & NFS_MOUNT_VER3)
                        goto out_no_v3;
@@ -909,14 +911,14 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
                memcpy(data->root.data, data->old_root.data, NFS2_FHSIZE);
                /* Turn off security negotiation */
                extra_flags |= NFS_MOUNT_SECFLAVOUR;
-               /* fall through */
+               fallthrough;
        case 4:
                if (data->flags & NFS_MOUNT_SECFLAVOUR)
                        goto out_no_sec;
-               /* fall through */
+               fallthrough;
        case 5:
                memset(data->context, 0, sizeof(data->context));
-               /* fall through */
+               fallthrough;
        case 6:
                if (data->flags & NFS_MOUNT_VER3) {
                        if (data->root.size > NFS3_FHSIZE || data->root.size == 0)
index 26c94b32d6f49e15f2c4e4a50d219f6a8592e034..c6c863382f375b5425b7f9949bcda47314a9f754 100644 (file)
@@ -108,7 +108,7 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
                case -EPROTONOSUPPORT:
                        dprintk("NFS_V3_ACL extension not supported; disabling\n");
                        server->caps &= ~NFS_CAP_ACLS;
-                       /* fall through */
+                       fallthrough;
                case -ENOTSUPP:
                        status = -EOPNOTSUPP;
                default:
@@ -228,7 +228,7 @@ static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
                        dprintk("NFS_V3_ACL SETACL RPC not supported"
                                        "(will not retry)\n");
                        server->caps &= ~NFS_CAP_ACLS;
-                       /* fall through */
+                       fallthrough;
                case -ENOTSUPP:
                        status = -EOPNOTSUPP;
        }
index 142225f0af5953c779c6445155f6bcc75929b79f..2b2211d1234e29f30ba23d0a29e74c22f6e03ea7 100644 (file)
@@ -356,7 +356,15 @@ static ssize_t _nfs42_proc_copy(struct file *src,
 
        truncate_pagecache_range(dst_inode, pos_dst,
                                 pos_dst + res->write_res.count);
-
+       spin_lock(&dst_inode->i_lock);
+       NFS_I(dst_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
+                       NFS_INO_REVAL_FORCED | NFS_INO_INVALID_SIZE |
+                       NFS_INO_INVALID_ATTR | NFS_INO_INVALID_DATA);
+       spin_unlock(&dst_inode->i_lock);
+       spin_lock(&src_inode->i_lock);
+       NFS_I(src_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
+                       NFS_INO_REVAL_FORCED | NFS_INO_INVALID_ATIME);
+       spin_unlock(&src_inode->i_lock);
        status = res->write_res.count;
 out:
        if (args->sync)
index a339707654673bd17fb71ec9105b5f50a1c52c15..fdfc77486acee6b34ed9b54c16e7f8e27c2e238d 100644 (file)
@@ -211,7 +211,7 @@ static loff_t nfs4_file_llseek(struct file *filep, loff_t offset, int whence)
                ret = nfs42_proc_llseek(filep, offset, whence);
                if (ret != -ENOTSUPP)
                        return ret;
-               /* Fall through */
+               fallthrough;
        default:
                return nfs_file_llseek(filep, offset, whence);
        }
index 1e7296395d71bfc3144d5a57c6658712d7730c09..62e6eea5c516d8c1a19fd96ea4d749b439875da9 100644 (file)
@@ -520,7 +520,7 @@ static int nfs_idmap_prepare_message(char *desc, struct idmap *idmap,
        switch (token) {
        case Opt_find_uid:
                im->im_type = IDMAP_TYPE_USER;
-               /* Fall through */
+               fallthrough;
        case Opt_find_gid:
                im->im_conv = IDMAP_CONV_NAMETOID;
                ret = match_strlcpy(im->im_name, &substr, IDMAP_NAMESZ);
@@ -528,7 +528,7 @@ static int nfs_idmap_prepare_message(char *desc, struct idmap *idmap,
 
        case Opt_find_user:
                im->im_type = IDMAP_TYPE_USER;
-               /* Fall through */
+               fallthrough;
        case Opt_find_group:
                im->im_conv = IDMAP_CONV_IDTONAME;
                ret = match_int(&substr, &im->im_id);
index dbd01548335b2d034d90df3c4ea56ce4ae4dda64..6e95c85fe395a88b0c93f75a17bfc8c76bcbbbde 100644 (file)
@@ -483,7 +483,7 @@ static int nfs4_do_handle_exception(struct nfs_server *server,
                                                stateid);
                                goto wait_on_recovery;
                        }
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_OPENMODE:
                        if (inode) {
                                int err;
@@ -534,10 +534,10 @@ static int nfs4_do_handle_exception(struct nfs_server *server,
                                ret = -EBUSY;
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_DELAY:
                        nfs_inc_server_stats(server, NFSIOS_DELAY);
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_GRACE:
                case -NFS4ERR_LAYOUTTRYLATER:
                case -NFS4ERR_RECALLCONFLICT:
@@ -1505,7 +1505,7 @@ static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode,
        case NFS4_OPEN_CLAIM_PREVIOUS:
                if (!test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags))
                        break;
-               /* Fall through */
+               fallthrough;
        default:
                return 0;
        }
@@ -2439,7 +2439,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
        case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
        case NFS4_OPEN_CLAIM_DELEG_PREV_FH:
                data->o_arg.open_bitmap = &nfs4_open_noattr_bitmap[0];
-               /* Fall through */
+               fallthrough;
        case NFS4_OPEN_CLAIM_FH:
                task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR];
        }
@@ -3293,8 +3293,10 @@ static int _nfs4_do_setattr(struct inode *inode,
 
        /* Servers should only apply open mode checks for file size changes */
        truncate = (arg->iap->ia_valid & ATTR_SIZE) ? true : false;
-       if (!truncate)
+       if (!truncate) {
+               nfs4_inode_make_writeable(inode);
                goto zero_stateid;
+       }
 
        if (nfs4_copy_delegation_stateid(inode, FMODE_WRITE, &arg->stateid, &delegation_cred)) {
                /* Use that stateid */
@@ -3545,11 +3547,11 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
                        nfs4_free_revoked_stateid(server,
                                        &calldata->arg.stateid,
                                        task->tk_msg.rpc_cred);
-                       /* Fallthrough */
+                       fallthrough;
                case -NFS4ERR_BAD_STATEID:
                        if (calldata->arg.fmode == 0)
                                break;
-                       /* Fallthrough */
+                       fallthrough;
                default:
                        task->tk_status = nfs4_async_handle_exception(task,
                                        server, task->tk_status, &exception);
@@ -6294,7 +6296,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
                nfs4_free_revoked_stateid(data->res.server,
                                data->args.stateid,
                                task->tk_msg.rpc_cred);
-               /* Fallthrough */
+               fallthrough;
        case -NFS4ERR_BAD_STATEID:
        case -NFS4ERR_STALE_STATEID:
        case -ETIMEDOUT:
@@ -6314,7 +6316,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
                        data->res.fattr = NULL;
                        goto out_restart;
                }
-               /* Fallthrough */
+               fallthrough;
        default:
                task->tk_status = nfs4_async_handle_exception(task,
                                data->res.server, task->tk_status,
@@ -6622,13 +6624,13 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
                        if (nfs4_update_lock_stateid(calldata->lsp,
                                        &calldata->res.stateid))
                                break;
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_ADMIN_REVOKED:
                case -NFS4ERR_EXPIRED:
                        nfs4_free_revoked_stateid(calldata->server,
                                        &calldata->arg.stateid,
                                        task->tk_msg.rpc_cred);
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_BAD_STATEID:
                case -NFS4ERR_STALE_STATEID:
                        if (nfs4_sync_lock_stateid(&calldata->arg.stateid,
@@ -7298,7 +7300,12 @@ int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state,
        err = nfs4_set_lock_state(state, fl);
        if (err != 0)
                return err;
-       err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW);
+       do {
+               err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW);
+               if (err != -NFS4ERR_DELAY)
+                       break;
+               ssleep(1);
+       } while (err == -NFS4ERR_DELAY);
        return nfs4_handle_delegation_recall_error(server, state, stateid, fl, err);
 }
 
@@ -8665,7 +8672,7 @@ static void nfs4_get_lease_time_done(struct rpc_task *task, void *calldata)
                dprintk("%s Retry: tk_status %d\n", __func__, task->tk_status);
                rpc_delay(task, NFS4_POLL_RETRY_MIN);
                task->tk_status = 0;
-               /* fall through */
+               fallthrough;
        case -NFS4ERR_RETRY_UNCACHED_REP:
                rpc_restart_call_prepare(task);
                return;
@@ -9113,13 +9120,13 @@ static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nf
        switch(task->tk_status) {
        case 0:
                wake_up_all(&clp->cl_lock_waitq);
-               /* Fallthrough */
+               fallthrough;
        case -NFS4ERR_COMPLETE_ALREADY:
        case -NFS4ERR_WRONG_CRED: /* What to do here? */
                break;
        case -NFS4ERR_DELAY:
                rpc_delay(task, NFS4_POLL_RETRY_MAX);
-               /* fall through */
+               fallthrough;
        case -NFS4ERR_RETRY_UNCACHED_REP:
                return -EAGAIN;
        case -NFS4ERR_BADSESSION:
@@ -9434,10 +9441,10 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
                                        &lrp->args.range,
                                        lrp->args.inode))
                        goto out_restart;
-               /* Fallthrough */
+               fallthrough;
        default:
                task->tk_status = 0;
-               /* Fallthrough */
+               fallthrough;
        case 0:
                break;
        case -NFS4ERR_DELAY:
index b1dba24918f806139108645d424eb48e7af1180c..4bf10792cb5b1049790ec0d0584f263fb3bac96c 100644 (file)
@@ -1530,7 +1530,7 @@ restart:
                default:
                        pr_err("NFS: %s: unhandled error %d\n",
                                        __func__, status);
-                       /* Fall through */
+                       fallthrough;
                case -ENOMEM:
                case -NFS4ERR_DENIED:
                case -NFS4ERR_RECLAIM_BAD:
@@ -1667,7 +1667,7 @@ restart:
                                break;
                        }
                        printk(KERN_ERR "NFS: %s: unhandled error %d\n", __func__, status);
-                       /* Fall through */
+                       fallthrough;
                case -ENOENT:
                case -ENOMEM:
                case -EACCES:
@@ -1683,7 +1683,7 @@ restart:
                                set_bit(ops->state_flag_bit, &state->flags);
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_ADMIN_REVOKED:
                case -NFS4ERR_STALE_STATEID:
                case -NFS4ERR_OLD_STATEID:
@@ -1695,7 +1695,7 @@ restart:
                case -NFS4ERR_EXPIRED:
                case -NFS4ERR_NO_GRACE:
                        nfs4_state_mark_reclaim_nograce(sp->so_server->nfs_client, state);
-                       /* Fall through */
+                       fallthrough;
                case -NFS4ERR_STALE_CLIENTID:
                case -NFS4ERR_BADSESSION:
                case -NFS4ERR_BADSLOT:
@@ -2273,11 +2273,11 @@ again:
        case -ETIMEDOUT:
                if (clnt->cl_softrtry)
                        break;
-               /* Fall through */
+               fallthrough;
        case -NFS4ERR_DELAY:
        case -EAGAIN:
                ssleep(1);
-               /* Fall through */
+               fallthrough;
        case -NFS4ERR_STALE_CLIENTID:
                dprintk("NFS: %s after status %d, retrying\n",
                        __func__, status);
@@ -2289,7 +2289,7 @@ again:
                }
                if (clnt->cl_auth->au_flavor == RPC_AUTH_UNIX)
                        break;
-               /* Fall through */
+               fallthrough;
        case -NFS4ERR_CLID_INUSE:
        case -NFS4ERR_WRONGSEC:
                /* No point in retrying if we already used RPC_AUTH_UNIX */
index 6ea4cac41e46fe3ea30d1c0e8888ec5bb45e8390..6985cacf4700df1759239ddf0e73d44f59806f06 100644 (file)
@@ -711,7 +711,7 @@ static void nfs_pgio_rpcsetup(struct nfs_pgio_header *hdr,
        case FLUSH_COND_STABLE:
                if (nfs_reqs_to_commit(cinfo))
                        break;
-               /* fall through */
+               fallthrough;
        default:
                hdr->args.stable = NFS_FILE_SYNC;
        }
index 40332c758d8466392fdf264d9c0ae8954ec2941e..71f7741126b6dcc5f247d8fd799e9cd488ac382e 100644 (file)
@@ -1541,7 +1541,7 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args,
        case 0:
                if (res->lrs_present)
                        res_stateid = &res->stateid;
-               /* Fallthrough */
+               fallthrough;
        default:
                arg_stateid = &args->stateid;
        }
index 8ceb6425e01aa2f67f5442e83429e6874ed80106..d056ad2fdefd6eb387217712a3c792ad24ebac2b 100644 (file)
@@ -237,7 +237,7 @@ posix_acl_from_nfsacl(struct posix_acl *acl)
                                break;
                        case ACL_MASK:
                                mask = pa;
-                               /* fall through */
+                               fallthrough;
                        case ACL_OTHER:
                                break;
                }
index 9bbaa671c0799d70d8bad77b47dd7e9eb83fdf4c..311e5ce80cfc27bf36c29075927408adf04d772d 100644 (file)
@@ -83,13 +83,13 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp,
                        bex->soff = iomap.addr;
                        break;
                }
-               /*FALLTHRU*/
+               fallthrough;
        case IOMAP_HOLE:
                if (seg->iomode == IOMODE_READ) {
                        bex->es = PNFS_BLOCK_NONE_DATA;
                        break;
                }
-               /*FALLTHRU*/
+               fallthrough;
        case IOMAP_DELALLOC:
        default:
                WARN(1, "pnfsd: filesystem returned %d extent\n", iomap.type);
index 7fbe9840a03e70e5fb536527cbe94e4f3085ddb4..052be5bf9ef50ca21c920f457aa29ed1e1cd6ff9 100644 (file)
@@ -1119,7 +1119,7 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback
                break;
        case -ESERVERFAULT:
                ++session->se_cb_seq_nr;
-               /* Fall through */
+               fallthrough;
        case 1:
        case -NFS4ERR_BADSESSION:
                nfsd4_mark_cb_fault(cb->cb_clp, cb->cb_seq_status);
index e12409eca7cc42facf54b4af0d8a636e6bc7fb0e..a97873f2d22b0def8c96893fc5b8dc697e8d783f 100644 (file)
@@ -681,7 +681,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task)
                        rpc_delay(task, HZ/100); /* 10 mili-seconds */
                        return 0;
                }
-               /* Fallthrough */
+               fallthrough;
        default:
                /*
                 * Unknown error or non-responding client, we'll need to fence.
index a527da3d8052191e81f5424d3fda9e1ddebdc870..eaf50eafa93596f791b2461cd8de5cbdca8436f5 100644 (file)
@@ -428,7 +428,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                                goto out;
                        open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
                        reclaim = true;
-                       /* fall through */
+                       fallthrough;
                case NFS4_OPEN_CLAIM_FH:
                case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
                        status = do_open_fhandle(rqstp, cstate, open);
index 81ed8e8bab3fc786561580f2b752af2919e9208e..c09a2a4281ec93a28ccec489d2b22a788f319467 100644 (file)
@@ -3117,7 +3117,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                break;
        default:                                /* checked by xdr code */
                WARN_ON_ONCE(1);
-               /* fall through */
+               fallthrough;
        case SP4_SSV:
                status = nfserr_encr_alg_unsupp;
                goto out_nolock;
@@ -4532,7 +4532,7 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,
                        rpc_delay(task, 2 * HZ);
                        return 0;
                }
-               /*FALLTHRU*/
+               fallthrough;
        default:
                return 1;
        }
@@ -4597,6 +4597,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
        if (!i_am_nfsd())
                return NULL;
        rqst = kthread_data(current);
+       if (!rqst->rq_lease_breaker)
+               return NULL;
        clp = *(rqst->rq_lease_breaker);
        return dl->dl_stid.sc_client == clp;
 }
@@ -5652,7 +5654,7 @@ static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid)
                break;
        default:
                printk("unknown stateid type %x\n", s->sc_type);
-               /* Fallthrough */
+               fallthrough;
        case NFS4_CLOSED_STID:
        case NFS4_CLOSED_DELEG_STID:
                status = nfserr_bad_stateid;
@@ -6742,7 +6744,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                case NFS4_READW_LT:
                        if (nfsd4_has_session(cstate))
                                fl_flags |= FL_SLEEP;
-                       /* Fallthrough */
+                       fallthrough;
                case NFS4_READ_LT:
                        spin_lock(&fp->fi_lock);
                        nf = find_readable_file_locked(fp);
@@ -6754,7 +6756,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                case NFS4_WRITEW_LT:
                        if (nfsd4_has_session(cstate))
                                fl_flags |= FL_SLEEP;
-                       /* Fallthrough */
+                       fallthrough;
                case NFS4_WRITE_LT:
                        spin_lock(&fp->fi_lock);
                        nf = find_writeable_file_locked(fp);
@@ -6816,7 +6818,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                break;
        case FILE_LOCK_DEFERRED:
                nbl = NULL;
-               /* Fallthrough */
+               fallthrough;
        case -EAGAIN:           /* conflock holds conflicting lock */
                status = nfserr_denied;
                dprintk("NFSD: nfsd4_lock: conflicting lock found!\n");
index 37bc8f5f4514286faed2941df3788e65dfc640e9..c81dbbad8792011847fd7472d21c9498592b379c 100644 (file)
@@ -459,7 +459,7 @@ static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp)
        case FSID_DEV:
                if (!old_valid_dev(exp_sb(exp)->s_dev))
                        return false;
-               /* FALL THROUGH */
+               fallthrough;
        case FSID_MAJOR_MINOR:
        case FSID_ENCODE_DEV:
                return exp_sb(exp)->s_type->fs_flags & FS_REQUIRES_DEV;
@@ -469,7 +469,7 @@ static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp)
        case FSID_UUID16:
                if (!is_root_export(exp))
                        return false;
-               /* fall through */
+               fallthrough;
        case FSID_UUID4_INUM:
        case FSID_UUID16_INUM:
                return exp->ex_uuid != NULL;
index 543bbe0a556e7387c19e7aa40fd6400698766f86..6e0b066480c50428370ffd632d63c06b42208d12 100644 (file)
@@ -314,7 +314,7 @@ nfsd_proc_create(struct svc_rqst *rqstp)
                                        rdev = inode->i_rdev;
                                        attr->ia_valid |= ATTR_SIZE;
 
-                                       /* FALLTHROUGH */
+                                       fallthrough;
                                case S_IFIFO:
                                        /* this is probably a permission check..
                                         * at least IRIX implements perm checking on
index b603dfcdd3615fb6a37e2021e0b07ef14e17f256..f7f6473578afaf6478b0dde4a001f8194b6ba82a 100644 (file)
@@ -221,7 +221,7 @@ int nfsd_vers(struct nfsd_net *nn, int vers, enum vers_op change)
        case NFSD_TEST:
                if (nn->nfsd_versions)
                        return nn->nfsd_versions[vers];
-               /* Fallthrough */
+               fallthrough;
        case NFSD_AVAIL:
                return nfsd_support_version(vers);
        }
index 7d2933b85b6536c0c26a0e9b2beb6e646757dce6..aba5af9df328a411df5d2c9bbb1843dcf1f98ad4 100644 (file)
@@ -1456,7 +1456,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
                                        *created = true;
                                break;
                        }
-                       /* fall through */
+                       fallthrough;
                case NFS4_CREATE_EXCLUSIVE4_1:
                        if (   d_inode(dchild)->i_mtime.tv_sec == v_mtime
                            && d_inode(dchild)->i_atime.tv_sec == v_atime
@@ -1465,7 +1465,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
                                        *created = true;
                                goto set_attr;
                        }
-                       /* fall through */
+                       fallthrough;
                case NFS3_CREATE_GUARDED:
                        err = nfserr_exist;
                }
index fb5a9a8a13cf7d734c0c13f38df097786c5ba5a1..e516ae389ca5bede8bfcf9d3fdc669464a84dd8c 100644 (file)
@@ -519,7 +519,7 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode)
                break;
        case NILFS_IFILE_INO:
                lockdep_set_class(&bmap->b_sem, &nilfs_bmap_mdt_lock_key);
-               /* Fall through */
+               fallthrough;
        default:
                bmap->b_ptr_type = NILFS_BMAP_PTR_VM;
                bmap->b_last_allocated_key = 0;
index 0b453ef8fae5cf55018d4e20580f0e402449a10a..2217f904a7cfb5230b2e66b11660a0dbb1d20d24 100644 (file)
@@ -626,7 +626,7 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs,
                            !(flags & NILFS_SS_SYNDT))
                                goto try_next_pseg;
                        state = RF_DSYNC_ST;
-                       /* Fall through */
+                       fallthrough;
                case RF_DSYNC_ST:
                        if (!(flags & NILFS_SS_SYNDT))
                                goto confused;
index a651e821c2de3e395da124a35099fc1fedd93886..e3726aca28ed63d5441778a4c9bc5b24050d5a18 100644 (file)
@@ -1138,7 +1138,8 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                        nilfs_sc_cstage_set(sci, NILFS_ST_DAT);
                        goto dat_stage;
                }
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_GC:
                if (nilfs_doing_gc()) {
                        head = &sci->sc_gc_inodes;
@@ -1159,7 +1160,8 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                        }
                        sci->sc_stage.gc_inode_ptr = NULL;
                }
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_FILE:
                head = &sci->sc_dirty_files;
                ii = list_prepare_entry(sci->sc_stage.dirty_file_ptr, head,
@@ -1186,7 +1188,7 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                }
                nilfs_sc_cstage_inc(sci);
                sci->sc_stage.flags |= NILFS_CF_IFILE_STARTED;
-               /* Fall through */
+               fallthrough;
        case NILFS_ST_IFILE:
                err = nilfs_segctor_scan_file(sci, sci->sc_root->ifile,
                                              &nilfs_sc_file_ops);
@@ -1197,13 +1199,14 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                err = nilfs_segctor_create_checkpoint(sci);
                if (unlikely(err))
                        break;
-               /* Fall through */
+               fallthrough;
        case NILFS_ST_CPFILE:
                err = nilfs_segctor_scan_file(sci, nilfs->ns_cpfile,
                                              &nilfs_sc_file_ops);
                if (unlikely(err))
                        break;
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_SUFILE:
                err = nilfs_sufile_freev(nilfs->ns_sufile, sci->sc_freesegs,
                                         sci->sc_nfreesegs, &ndone);
@@ -1219,7 +1222,8 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                                              &nilfs_sc_file_ops);
                if (unlikely(err))
                        break;
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_DAT:
  dat_stage:
                err = nilfs_segctor_scan_file(sci, nilfs->ns_dat,
@@ -1230,7 +1234,8 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode)
                        nilfs_sc_cstage_set(sci, NILFS_ST_DONE);
                        return 0;
                }
-               nilfs_sc_cstage_inc(sci);  /* Fall through */
+               nilfs_sc_cstage_inc(sci);
+               fallthrough;
        case NILFS_ST_SR:
                if (mode == SC_LSEG_SR) {
                        /* Appending a super root */
index 559de311deca96e29cb07853e050c4ceefb6dcab..3e01d8f2ab9061faa43f865e1f9f3dc2868e5dbc 100644 (file)
@@ -1147,7 +1147,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
        }
 
        switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) {
-       case FAN_MARK_ADD:              /* fallthrough */
+       case FAN_MARK_ADD:
        case FAN_MARK_REMOVE:
                if (!mask)
                        return -EINVAL;
index 1ef24574f48189ff573ab3662f68bd6f4de79bf0..cea739be77c466be3989c57268860c11cce285fa 100644 (file)
@@ -67,7 +67,7 @@ static void o2quo_fence_self(void)
        default:
                WARN_ON(o2nm_single_cluster->cl_fence_method >=
                        O2NM_FENCE_METHODS);
-               /* fall through */
+               fallthrough;
        case O2NM_FENCE_RESET:
                printk(KERN_ERR "*** ocfs2 is very sorry to be fencing this "
                       "system by restarting ***\n");
index 60dbee457143674cc01651e03f213f53776aeaa1..117db82b10af515bbbfbbac4c9a88b0d88669e91 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -106,25 +106,6 @@ void pipe_double_lock(struct pipe_inode_info *pipe1,
        }
 }
 
-/* Drop the inode semaphore and wait for a pipe event, atomically */
-void pipe_wait(struct pipe_inode_info *pipe)
-{
-       DEFINE_WAIT(rdwait);
-       DEFINE_WAIT(wrwait);
-
-       /*
-        * Pipes are system-local resources, so sleeping on them
-        * is considered a noninteractive wait:
-        */
-       prepare_to_wait(&pipe->rd_wait, &rdwait, TASK_INTERRUPTIBLE);
-       prepare_to_wait(&pipe->wr_wait, &wrwait, TASK_INTERRUPTIBLE);
-       pipe_unlock(pipe);
-       schedule();
-       finish_wait(&pipe->rd_wait, &rdwait);
-       finish_wait(&pipe->wr_wait, &wrwait);
-       pipe_lock(pipe);
-}
-
 static void anon_pipe_buf_release(struct pipe_inode_info *pipe,
                                  struct pipe_buffer *buf)
 {
@@ -1035,12 +1016,52 @@ SYSCALL_DEFINE1(pipe, int __user *, fildes)
        return do_pipe2(fildes, 0);
 }
 
+/*
+ * This is the stupid "wait for pipe to be readable or writable"
+ * model.
+ *
+ * See pipe_read/write() for the proper kind of exclusive wait,
+ * but that requires that we wake up any other readers/writers
+ * if we then do not end up reading everything (ie the whole
+ * "wake_next_reader/writer" logic in pipe_read/write()).
+ */
+void pipe_wait_readable(struct pipe_inode_info *pipe)
+{
+       pipe_unlock(pipe);
+       wait_event_interruptible(pipe->rd_wait, pipe_readable(pipe));
+       pipe_lock(pipe);
+}
+
+void pipe_wait_writable(struct pipe_inode_info *pipe)
+{
+       pipe_unlock(pipe);
+       wait_event_interruptible(pipe->wr_wait, pipe_writable(pipe));
+       pipe_lock(pipe);
+}
+
+/*
+ * This depends on both the wait (here) and the wakeup (wake_up_partner)
+ * holding the pipe lock, so "*cnt" is stable and we know a wakeup cannot
+ * race with the count check and waitqueue prep.
+ *
+ * Normally in order to avoid races, you'd do the prepare_to_wait() first,
+ * then check the condition you're waiting for, and only then sleep. But
+ * because of the pipe lock, we can check the condition before being on
+ * the wait queue.
+ *
+ * We use the 'rd_wait' waitqueue for pipe partner waiting.
+ */
 static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt)
 {
+       DEFINE_WAIT(rdwait);
        int cur = *cnt;
 
        while (cur == *cnt) {
-               pipe_wait(pipe);
+               prepare_to_wait(&pipe->rd_wait, &rdwait, TASK_INTERRUPTIBLE);
+               pipe_unlock(pipe);
+               schedule();
+               finish_wait(&pipe->rd_wait, &rdwait);
+               pipe_lock(pipe);
                if (signal_pending(current))
                        break;
        }
@@ -1050,7 +1071,6 @@ static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt)
 static void wake_up_partner(struct pipe_inode_info *pipe)
 {
        wake_up_interruptible_all(&pipe->rd_wait);
-       wake_up_interruptible_all(&pipe->wr_wait);
 }
 
 static int fifo_open(struct inode *inode, struct file *filp)
index 819428dfa32facda1d27f248fbcde7d4635ca5c9..3ce89216670c9b112fb568bd271a08ad44e35958 100644 (file)
@@ -1081,7 +1081,6 @@ next_zone:
                readop = psz_ftrace_read;
                break;
        case PSTORE_TYPE_CONSOLE:
-               fallthrough;
        case PSTORE_TYPE_PMSG:
                readop = psz_record_read;
                break;
index 5444d3c4d93f37e52827fb895db162848ea6c8cb..47f9e151988b3eda074b4e2eef05273392091a38 100644 (file)
@@ -38,7 +38,7 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
                if ((type == USRQUOTA && uid_eq(current_euid(), make_kuid(current_user_ns(), id))) ||
                    (type == GRPQUOTA && in_egroup_p(make_kgid(current_user_ns(), id))))
                        break;
-               /*FALLTHROUGH*/
+               fallthrough;
        default:
                if (!capable(CAP_SYS_ADMIN))
                        return -EPERM;
index 5db58b8c78d0dd22c1abd5ac27a3d81118d03b31..d3428189f36babdcdde47681f5e279e68b149d6d 100644 (file)
@@ -538,6 +538,14 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
        inc_syscw(current);
        return ret;
 }
+/*
+ * This "EXPORT_SYMBOL_GPL()" is more of a "EXPORT_SYMBOL_DONTUSE()",
+ * but autofs is one of the few internal kernel users that actually
+ * wants this _and_ can be built as a module. So we need to export
+ * this symbol for autofs, even though it really isn't appropriate
+ * for any other kernel modules.
+ */
+EXPORT_SYMBOL_GPL(__kernel_write);
 
 ssize_t kernel_write(struct file *file, const void *buf, size_t count,
                            loff_t *pos)
index 4e6239f33c066ae45860d685860b90492e82cb15..31219c1db17de3589770a683cfedd8ffd0c5095e 100644 (file)
@@ -295,7 +295,7 @@ loff_t seq_lseek(struct file *file, loff_t offset, int whence)
        switch (whence) {
        case SEEK_CUR:
                offset += file->f_pos;
-               /* fall through */
+               fallthrough;
        case SEEK_SET:
                if (offset < 0)
                        break;
index 5b78719be445591b555fd5e57bb6f9df892e1706..456046e158737450055c77283321867f03b23ee0 100644 (file)
@@ -176,7 +176,7 @@ static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info
                if (!nonblock)
                        break;
                ret = -EAGAIN;
-               /* fall through */
+               fallthrough;
        default:
                spin_unlock_irq(&current->sighand->siglock);
                return ret;
index d7c8a7c4db07fff8cfc54a83adefba53207691a0..c3d00dfc7344648be62ac41244b0708ec72148f6 100644 (file)
@@ -563,7 +563,7 @@ static int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_des
                        sd->need_wakeup = false;
                }
 
-               pipe_wait(pipe);
+               pipe_wait_readable(pipe);
        }
 
        return 1;
@@ -1077,7 +1077,7 @@ static int wait_for_space(struct pipe_inode_info *pipe, unsigned flags)
                        return -EAGAIN;
                if (signal_pending(current))
                        return -ERESTARTSYS;
-               pipe_wait(pipe);
+               pipe_wait_writable(pipe);
        }
 }
 
@@ -1454,7 +1454,7 @@ static int ipipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
                        ret = -EAGAIN;
                        break;
                }
-               pipe_wait(pipe);
+               pipe_wait_readable(pipe);
        }
 
        pipe_unlock(pipe);
@@ -1493,7 +1493,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
                        ret = -ERESTARTSYS;
                        break;
                }
-               pipe_wait(pipe);
+               pipe_wait_writable(pipe);
        }
 
        pipe_unlock(pipe);
index 22bfda158f7fdbcfb1b327736dd66a2fba2a3898..6d6cd85c2b4cab69e98116c5809352416c4a8577 100644 (file)
@@ -269,7 +269,7 @@ void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops,
                        break;
                /* No more room on heap so make it un-categorized */
                cat = LPROPS_UNCAT;
-               /* Fall through */
+               fallthrough;
        case LPROPS_UNCAT:
                list_add(&lprops->list, &c->uncat_list);
                break;
@@ -313,7 +313,7 @@ static void ubifs_remove_from_cat(struct ubifs_info *c,
        case LPROPS_FREEABLE:
                c->freeable_cnt -= 1;
                ubifs_assert(c, c->freeable_cnt >= 0);
-               /* Fall through */
+               fallthrough;
        case LPROPS_UNCAT:
        case LPROPS_EMPTY:
        case LPROPS_FRDI_IDX:
index 6023c97c6da2f269894bdd3966a5a415c6345955..25ff91c7e94afae4b36ca731f16ff0f83762a125 100644 (file)
@@ -52,7 +52,7 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from,
                                elen += pc->lengthComponentIdent;
                                break;
                        }
-                       /* Fall through */
+                       fallthrough;
                case 2:
                        if (tolen == 0)
                                return -ENAMETOOLONG;
index e1f1b2e868a7d55cc66b4333ad542573df5a5acc..4931bec1a01cad7f76433ca2ef1b01da3bd0ffa0 100644 (file)
@@ -42,7 +42,7 @@ ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
        case UFS_ST_SUNOS:
                if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT)
                        return fs32_to_cpu(sb, usb1->fs_u0.fs_sun.fs_state);
-               /* Fall Through - to UFS_ST_SUN */
+               fallthrough;    /* to UFS_ST_SUN */
        case UFS_ST_SUN:
                return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state);
        case UFS_ST_SUNx86:
@@ -63,7 +63,7 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
                        usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
                        break;
                }
-               /* Fall Through - to UFS_ST_SUN */
+               fallthrough;    /* to UFS_ST_SUN */
        case UFS_ST_SUN:
                usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
                break;
@@ -197,7 +197,7 @@ ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode)
        case UFS_UID_EFT:
                if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
                        return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
-               /* Fall through */
+               fallthrough;
        default:
                return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid);
        }
@@ -215,7 +215,7 @@ ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value)
                inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value);
                if (value > 0xFFFF)
                        value = 0xFFFF;
-               /* Fall through */
+               fallthrough;
        default:
                inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
                break;
@@ -231,7 +231,7 @@ ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
        case UFS_UID_EFT:
                if (inode->ui_u1.oldids.ui_sgid == 0xFFFF)
                        return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
-               /* Fall through */
+               fallthrough;
        default:
                return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid);
        }
@@ -249,7 +249,7 @@ ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value)
                inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value);
                if (value > 0xFFFF)
                        value = 0xFFFF;
-               /* Fall through */
+               fallthrough;
        default:
                inode->ui_u1.oldids.ui_sgid =  cpu_to_fs16(sb, value);
                break;
index 8fe03b4a0d2b038e99b4920e8539e1f5363e55d8..25aade3441922ac092babcadf1c93bd64f019000 100644 (file)
@@ -384,7 +384,7 @@ fail_nomem:
 
 static int vboxsf_parse_monolithic(struct fs_context *fc, void *data)
 {
-       char *options = data;
+       unsigned char *options = data;
 
        if (options && options[0] == VBSF_MOUNT_SIGNATURE_BYTE_0 &&
                       options[1] == VBSF_MOUNT_SIGNATURE_BYTE_1 &&
index 96bd160da48baf590c9f169a68a6c7212a1bc111..01805754606711d17c54311f91c11087b03fb4dd 100644 (file)
@@ -226,7 +226,7 @@ int vboxsf_getattr(const struct path *path, struct kstat *kstat,
                break;
        case AT_STATX_FORCE_SYNC:
                sf_i->force_restat = 1;
-               /* fall-through */
+               fallthrough;
        default:
                err = vboxsf_inode_revalidate(dentry);
        }
index 8623c815164a65845a7ba65fe9a98ebfb1cacba8..305d4bc07337042e31f95f7c4a2518a4dc11c022 100644 (file)
@@ -653,8 +653,8 @@ xfs_attr_shortform_create(
                ASSERT(ifp->if_flags & XFS_IFINLINE);
        }
        xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK);
-       hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data;
-       hdr->count = 0;
+       hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data;
+       memset(hdr, 0, sizeof(*hdr));
        hdr->totsize = cpu_to_be16(sizeof(*hdr));
        xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
 }
@@ -1036,8 +1036,10 @@ xfs_attr_shortform_verify(
                 * struct xfs_attr_sf_entry has a variable length.
                 * Check the fixed-offset parts of the structure are
                 * within the data buffer.
+                * xfs_attr_sf_entry is defined with a 1-byte variable
+                * array at the end, so we must subtract that off.
                 */
-               if (((char *)sfep + sizeof(*sfep)) >= endp)
+               if (((char *)sfep + sizeof(*sfep) - 1) >= endp)
                        return __this_address;
 
                /* Don't allow names with known bad length. */
index 9c40d597103570d834450a9da177cd8cd4dd4635..1b0a01b06a05d13b4f3cf0193dc1034e6412b9c0 100644 (file)
@@ -6226,7 +6226,7 @@ xfs_bmap_validate_extent(
 
        isrt = XFS_IS_REALTIME_INODE(ip);
        endfsb = irec->br_startblock + irec->br_blockcount - 1;
-       if (isrt) {
+       if (isrt && whichfork == XFS_DATA_FORK) {
                if (!xfs_verify_rtbno(mp, irec->br_startblock))
                        return __this_address;
                if (!xfs_verify_rtbno(mp, endfsb))
index f742a96a2fe1ff03eb667f019d2982fb948683c8..a6b37db55169c784b880bda8361c04602cf1394f 100644 (file)
@@ -688,7 +688,7 @@ xfs_ialloc_ag_alloc(
                args.minalignslop = igeo->cluster_align - 1;
 
                /* Allow space for the inode btree to split. */
-               args.minleft = igeo->inobt_maxlevels - 1;
+               args.minleft = igeo->inobt_maxlevels;
                if ((error = xfs_alloc_vextent(&args)))
                        return error;
 
@@ -736,7 +736,7 @@ xfs_ialloc_ag_alloc(
                /*
                 * Allow space for the inode btree to split.
                 */
-               args.minleft = igeo->inobt_maxlevels - 1;
+               args.minleft = igeo->inobt_maxlevels;
                if ((error = xfs_alloc_vextent(&args)))
                        return error;
        }
index e15129647e00c97143dcfd5b40cf376e3fd8d20f..b7e222befb085fb749bd728ab8559ea305498342 100644 (file)
@@ -110,9 +110,9 @@ xfs_trans_log_inode(
         * to log the timestamps, or will clear already cleared fields in the
         * worst case.
         */
-       if (inode->i_state & (I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED)) {
+       if (inode->i_state & I_DIRTY_TIME) {
                spin_lock(&inode->i_lock);
-               inode->i_state &= ~(I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED);
+               inode->i_state &= ~I_DIRTY_TIME;
                spin_unlock(&inode->i_lock);
        }
 
index c6df01a2a1585d2e16d2dd35f3cf02567ac6a228..7ad3659c5d2a9fc6edd38affbb6ab03c17fcbbac 100644 (file)
@@ -58,7 +58,7 @@
 #define        XFS_IALLOC_SPACE_RES(mp)        \
        (M_IGEO(mp)->ialloc_blks + \
         ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \
-         (M_IGEO(mp)->inobt_maxlevels - 1)))
+         M_IGEO(mp)->inobt_maxlevels))
 
 /*
  * Space reservation values for various transactions.
index 73cafc843cd708bbfc15c3d033a1aa5e977dcbfe..5123f82f247774cb7b2eaec9569ec6b2410395a0 100644 (file)
@@ -1165,7 +1165,7 @@ xfs_insert_file_space(
                goto out_trans_cancel;
 
        do {
-               error = xfs_trans_roll_inode(&tp, ip);
+               error = xfs_defer_finish(&tp);
                if (error)
                        goto out_trans_cancel;
 
index c31cd3be9fb24b33301ab2505ac65251fac70666..a29f78a663ca5427cc40fdea81e4938ce483cf41 100644 (file)
@@ -1223,6 +1223,14 @@ __xfs_filemap_fault(
        return ret;
 }
 
+static inline bool
+xfs_is_write_fault(
+       struct vm_fault         *vmf)
+{
+       return (vmf->flags & FAULT_FLAG_WRITE) &&
+              (vmf->vma->vm_flags & VM_SHARED);
+}
+
 static vm_fault_t
 xfs_filemap_fault(
        struct vm_fault         *vmf)
@@ -1230,7 +1238,7 @@ xfs_filemap_fault(
        /* DAX can shortcut the normal fault path on write faults! */
        return __xfs_filemap_fault(vmf, PE_SIZE_PTE,
                        IS_DAX(file_inode(vmf->vma->vm_file)) &&
-                       (vmf->flags & FAULT_FLAG_WRITE));
+                       xfs_is_write_fault(vmf));
 }
 
 static vm_fault_t
@@ -1243,7 +1251,7 @@ xfs_filemap_huge_fault(
 
        /* DAX can shortcut the normal fault path on write faults! */
        return __xfs_filemap_fault(vmf, pe_size,
-                       (vmf->flags & FAULT_FLAG_WRITE));
+                       xfs_is_write_fault(vmf));
 }
 
 static vm_fault_t
index c6bab4986a658c9f8a650fd4dfbe22fa4a00e009..fe58dbb46962ac09f980cfc3078e3167fe5643d9 100644 (file)
@@ -29,6 +29,9 @@
 /* Slave address for the HDCP registers in the receiver */
 #define DRM_HDCP_DDC_ADDR                      0x3A
 
+/* Value to use at the end of the SHA-1 bytestream used for repeaters */
+#define DRM_HDCP_SHA1_TERMINATOR               0x80
+
 /* HDCP register offsets for HDMI/DVI devices */
 #define DRM_HDCP_DDC_BKSV                      0x00
 #define DRM_HDCP_DDC_RI_PRIME                  0x08
index 4fc9a43ac45a8f3c61b5542ae423747adb21056a..aafd07388eb7bf4dc852fb8ad480742bbbb64403 100644 (file)
@@ -164,6 +164,8 @@ int drm_modeset_lock_all_ctx(struct drm_device *dev,
  * is 0, so no error checking is necessary
  */
 #define DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, flags, ret)               \
+       if (!drm_drv_uses_atomic_modeset(dev))                          \
+               mutex_lock(&dev->mode_config.mutex);                    \
        drm_modeset_acquire_init(&ctx, flags);                          \
 modeset_lock_retry:                                                    \
        ret = drm_modeset_lock_all_ctx(dev, &ctx);                      \
@@ -172,6 +174,7 @@ modeset_lock_retry:                                                 \
 
 /**
  * DRM_MODESET_LOCK_ALL_END - Helper to release and cleanup modeset locks
+ * @dev: drm device
  * @ctx: local modeset acquire context, will be dereferenced
  * @ret: local ret/err/etc variable to track error status
  *
@@ -188,7 +191,7 @@ modeset_lock_retry:                                                 \
  * to that failure. In both of these cases the code between BEGIN/END will not
  * be run, so the failure will reflect the inability to grab the locks.
  */
-#define DRM_MODESET_LOCK_ALL_END(ctx, ret)                             \
+#define DRM_MODESET_LOCK_ALL_END(dev, ctx, ret)                                \
 modeset_lock_fail:                                                     \
        if (ret == -EDEADLK) {                                          \
                ret = drm_modeset_backoff(&ctx);                        \
@@ -196,6 +199,8 @@ modeset_lock_fail:                                                  \
                        goto modeset_lock_retry;                        \
        }                                                               \
        drm_modeset_drop_locks(&ctx);                                   \
-       drm_modeset_acquire_fini(&ctx);
+       drm_modeset_acquire_fini(&ctx);                                 \
+       if (!drm_drv_uses_atomic_modeset(dev))                          \
+               mutex_unlock(&dev->mode_config.mutex);
 
 #endif /* DRM_MODESET_LOCK_H_ */
index 1e4cdc6c7ae20a6ff61bb114fa211496be1f1716..64ae25c59d55bc7f4852199d8293dad5832823b4 100644 (file)
@@ -958,7 +958,7 @@ void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
 acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
                                           u32 val_a, u32 val_b);
 
-#ifdef CONFIG_X86
+#ifndef CONFIG_IA64
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
 static inline void arch_reserve_mem_area(acpi_physical_address addr,
index 4ecf4fed171f0d5e97ec9d41abb9567a6c590c81..b3fc5d3dd8ea16adf672b6bb1a35a0ef791a4719 100644 (file)
@@ -497,13 +497,12 @@ static inline int op_stat_group(unsigned int op)
 
 typedef unsigned int blk_qc_t;
 #define BLK_QC_T_NONE          -1U
-#define BLK_QC_T_EAGAIN                -2U
 #define BLK_QC_T_SHIFT         16
 #define BLK_QC_T_INTERNAL      (1U << 31)
 
 static inline bool blk_qc_t_valid(blk_qc_t cookie)
 {
-       return cookie != BLK_QC_T_NONE && cookie != BLK_QC_T_EAGAIN;
+       return cookie != BLK_QC_T_NONE;
 }
 
 static inline unsigned int blk_qc_t_to_queue_num(blk_qc_t cookie)
index bb5636cc17b91a75c83e6f87b391abc074d0bb70..868e11face00ed0ef8af999cb1aa6d5a2a837f35 100644 (file)
@@ -352,6 +352,8 @@ struct queue_limits {
 typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx,
                               void *data);
 
+void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model);
+
 #ifdef CONFIG_BLK_DEV_ZONED
 
 #define BLK_ALL_ZONES  ((unsigned int)-1)
index ac0c7299d5b8a2aa203037cd9fbc825bf6c29e0c..dd74503f7e5ea997c9075c6fc1097e776af9642b 100644 (file)
@@ -117,11 +117,18 @@ static inline bool bvec_iter_advance(const struct bio_vec *bv,
        return true;
 }
 
+static inline void bvec_iter_skip_zero_bvec(struct bvec_iter *iter)
+{
+       iter->bi_bvec_done = 0;
+       iter->bi_idx++;
+}
+
 #define for_each_bvec(bvl, bio_vec, iter, start)                       \
        for (iter = (start);                                            \
             (iter).bi_size &&                                          \
                ((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \
-            bvec_iter_advance((bio_vec), &(iter), (bvl).bv_len))
+            (bvl).bv_len ? (void)bvec_iter_advance((bio_vec), &(iter), \
+                    (bvl).bv_len) : bvec_iter_skip_zero_bvec(&(iter)))
 
 /* for iterating one bio from start to end */
 #define BVEC_ITER_ALL_INIT (struct bvec_iter)                          \
index fcd84e8d88f44b073a14fc1de8478df2c3807a28..999636d53cf2703f75a27d50f9a3b46d2b3a3c74 100644 (file)
 #define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL
 
 #define DEFINE_CEPH_FEATURE(bit, incarnation, name)                    \
-       static const uint64_t CEPH_FEATURE_##name = (1ULL<<bit);                \
-       static const uint64_t CEPH_FEATUREMASK_##name =                 \
+       static const uint64_t __maybe_unused CEPH_FEATURE_##name = (1ULL<<bit);         \
+       static const uint64_t __maybe_unused CEPH_FEATUREMASK_##name =                  \
                (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
 
 /* this bit is ignored but still advertised by release *when* */
 #define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \
-       static const uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \
-       static const uint64_t DEPRECATED_CEPH_FEATUREMASK_##name =              \
+       static const uint64_t __maybe_unused DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit);      \
+       static const uint64_t __maybe_unused DEPRECATED_CEPH_FEATUREMASK_##name =               \
                (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
 
 /*
index d38c4d7e83bd32391dc99df671f88a1bc068cc30..b354ce58966e2d1f21b340abd3aca7119242b63d 100644 (file)
@@ -429,11 +429,11 @@ put_compat_sigset(compat_sigset_t __user *compat, const sigset_t *set,
        compat_sigset_t v;
        switch (_NSIG_WORDS) {
        case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3];
-               /* fall through */
+               fallthrough;
        case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2];
-               /* fall through */
+               fallthrough;
        case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1];
-               /* fall through */
+               fallthrough;
        case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0];
        }
        return copy_to_user(compat, &v, size) ? -EFAULT : 0;
index 6122efdad6adf3342f41e2d2c98a9ed2e29c2406..ea7b756b1c8f18d94576a3224c1f0a9c40ad8861 100644 (file)
 
 /*
  * __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17.
- * In the meantime, to support 4.6 <= gcc < 5, we implement __has_attribute
+ * In the meantime, to support gcc < 5, we implement __has_attribute
  * by hand.
- *
- * sparse does not support __has_attribute (yet) and defines __GNUC_MINOR__
- * depending on the compiler used to build it; however, these attributes have
- * no semantic effects for sparse, so it does not matter. Also note that,
- * in order to avoid sparse's warnings, even the unsupported ones must be
- * defined to 0.
  */
 #ifndef __has_attribute
 # define __has_attribute(x) __GCC4_has_attribute_##x
index 4b33cb385f96537a918925100f646fd5ebe3ffbc..6e390d58a9f8c5f25406fbc87a48e2fc99415629 100644 (file)
@@ -11,8 +11,8 @@
 # define __iomem       __attribute__((noderef, address_space(__iomem)))
 # define __percpu      __attribute__((noderef, address_space(__percpu)))
 # define __rcu         __attribute__((noderef, address_space(__rcu)))
-extern void __chk_user_ptr(const volatile void __user *);
-extern void __chk_io_ptr(const volatile void __iomem *);
+static inline void __chk_user_ptr(const volatile void __user *ptr) { }
+static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
 /* context/locking */
 # define __must_hold(x)        __attribute__((context(x,1,1)))
 # define __acquires(x) __attribute__((context(x,0,1)))
index 8f141d4c859ce20cf8f6068148d8c78d4e7fb4c4..a911e5d06845497f3e72ee5f7dfa9ec262e4679b 100644 (file)
@@ -956,8 +956,8 @@ static inline int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
        case CPUFREQ_RELATION_C:
                return cpufreq_table_find_index_c(policy, target_freq);
        default:
-               pr_err("%s: Invalid relation: %d\n", __func__, relation);
-               return -EINVAL;
+               WARN_ON_ONCE(1);
+               return 0;
        }
 }
 
index 3215023d485230d804c0a21ea93152df3215c6e0..bf9181cef444d65ec5be0e76a98c619d806665b3 100644 (file)
@@ -142,7 +142,6 @@ enum cpuhp_state {
        /* Must be the last timer callback */
        CPUHP_AP_DUMMY_TIMER_STARTING,
        CPUHP_AP_ARM_XEN_STARTING,
-       CPUHP_AP_ARM_KVMPV_STARTING,
        CPUHP_AP_ARM_CORESIGHT_STARTING,
        CPUHP_AP_ARM_CORESIGHT_CTI_STARTING,
        CPUHP_AP_ARM64_ISNDEP_STARTING,
index b65909ae4e201131a39367fdb593296bef568aca..6175c77bf25e7ae941ccb033121f3bc0c5c407bf 100644 (file)
@@ -75,12 +75,14 @@ struct cpuidle_state {
 };
 
 /* Idle State Flags */
-#define CPUIDLE_FLAG_NONE       (0x00)
-#define CPUIDLE_FLAG_POLLING   BIT(0) /* polling state */
-#define CPUIDLE_FLAG_COUPLED   BIT(1) /* state applies to multiple cpus */
-#define CPUIDLE_FLAG_TIMER_STOP BIT(2) /* timer is stopped on this state */
-#define CPUIDLE_FLAG_UNUSABLE  BIT(3) /* avoid using this state */
-#define CPUIDLE_FLAG_OFF       BIT(4) /* disable this state by default */
+#define CPUIDLE_FLAG_NONE              (0x00)
+#define CPUIDLE_FLAG_POLLING           BIT(0) /* polling state */
+#define CPUIDLE_FLAG_COUPLED           BIT(1) /* state applies to multiple cpus */
+#define CPUIDLE_FLAG_TIMER_STOP        BIT(2) /* timer is stopped on this state */
+#define CPUIDLE_FLAG_UNUSABLE          BIT(3) /* avoid using this state */
+#define CPUIDLE_FLAG_OFF               BIT(4) /* disable this state by default */
+#define CPUIDLE_FLAG_TLB_FLUSHED       BIT(5) /* idle-state flushes TLBs */
+#define CPUIDLE_FLAG_RCU_IDLE          BIT(6) /* idle-state takes care of RCU */
 
 struct cpuidle_device_kobj;
 struct cpuidle_state_kobj;
index 6904d4e0b2e0ad21eed0ef1e2224c386ffbb3f90..43b39ab9de1a9922dca78a3c701f1a677aa9ad67 100644 (file)
@@ -58,6 +58,8 @@ static inline void set_dax_synchronous(struct dax_device *dax_dev)
 {
        __set_dax_synchronous(dax_dev);
 }
+bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
+               int blocksize, sector_t start, sector_t len);
 /*
  * Check if given mapping is supported by the file / underlying device.
  */
@@ -104,6 +106,12 @@ static inline bool dax_synchronous(struct dax_device *dax_dev)
 static inline void set_dax_synchronous(struct dax_device *dax_dev)
 {
 }
+static inline bool dax_supported(struct dax_device *dax_dev,
+               struct block_device *bdev, int blocksize, sector_t start,
+               sector_t len)
+{
+       return false;
+}
 static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
                                struct dax_device *dax_dev)
 {
@@ -189,14 +197,23 @@ static inline void dax_unlock_page(struct page *page, dax_entry_t cookie)
 }
 #endif
 
+#if IS_ENABLED(CONFIG_DAX)
 int dax_read_lock(void);
 void dax_read_unlock(int id);
+#else
+static inline int dax_read_lock(void)
+{
+       return 0;
+}
+
+static inline void dax_read_unlock(int id)
+{
+}
+#endif /* CONFIG_DAX */
 bool dax_alive(struct dax_device *dax_dev);
 void *dax_get_private(struct dax_device *dax_dev);
 long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
                void **kaddr, pfn_t *pfn);
-bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
-               int blocksize, sector_t start, sector_t len);
 size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
                size_t bytes, struct iov_iter *i);
 size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
index ca18da4768e3e89f3de9b43a5b7d72988d14dcf6..9e6ea8931a52eb4f9d61a5d65fae1af3eac26f6d 100644 (file)
@@ -454,6 +454,7 @@ struct dev_links_info {
  * @pm_domain: Provide callbacks that are executed during system suspend,
  *             hibernation, system resume and during runtime PM transitions
  *             along with subsystem-level and driver-level callbacks.
+ * @em_pd:     device's energy model performance domain
  * @pins:      For device pin management.
  *             See Documentation/driver-api/pinctl.rst for details.
  * @msi_list:  Hosts MSI descriptors
index aa9ff9e1c0b3280ce1e362852a48b10b006b98c7..8aa0c7c2608cbb0c79637018913802e5d4f48b93 100644 (file)
@@ -49,6 +49,10 @@ struct _ddebug {
 
 
 #if defined(CONFIG_DYNAMIC_DEBUG_CORE)
+
+/* exported for module authors to exercise >control */
+int dynamic_debug_exec_queries(const char *query, const char *modname);
+
 int ddebug_add_module(struct _ddebug *tab, unsigned int n,
                                const char *modname);
 extern int ddebug_remove_module(const char *mod_name);
@@ -105,7 +109,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
        static_branch_unlikely(&descriptor.key.dd_key_false)
 #endif
 
-#else /* !HAVE_JUMP_LABEL */
+#else /* !CONFIG_JUMP_LABEL */
 
 #define _DPRINTK_KEY_INIT
 
@@ -117,7 +121,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
        unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)
 #endif
 
-#endif
+#endif /* CONFIG_JUMP_LABEL */
 
 #define __dynamic_func_call(id, fmt, func, ...) do {   \
        DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt);         \
@@ -172,10 +176,11 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
                                   KERN_DEBUG, prefix_str, prefix_type, \
                                   rowsize, groupsize, buf, len, ascii)
 
-#else
+#else /* !CONFIG_DYNAMIC_DEBUG_CORE */
 
 #include <linux/string.h>
 #include <linux/errno.h>
+#include <linux/printk.h>
 
 static inline int ddebug_add_module(struct _ddebug *tab, unsigned int n,
                                    const char *modname)
@@ -210,6 +215,13 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val,
                print_hex_dump(KERN_DEBUG, prefix_str, prefix_type,     \
                                rowsize, groupsize, buf, len, ascii);   \
        } while (0)
-#endif
+
+static inline int dynamic_debug_exec_queries(const char *query, const char *modname)
+{
+       pr_warn("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n");
+       return 0;
+}
+
+#endif /* !CONFIG_DYNAMIC_DEBUG_CORE */
 
 #endif
index 57eac5241303af5a66c3f39746f09dbbf3b477c7..a97a12bb2c9ef114722423d5722959a9669c5985 100644 (file)
@@ -8,8 +8,8 @@
 #define EFI_EMBEDDED_FW_PREFIX_LEN             8
 
 /*
- * This struct and efi_embedded_fw_list are private to the efi-embedded fw
- * implementation they are in this header for use by lib/test_firmware.c only!
+ * This struct is private to the efi-embedded fw implementation.
+ * They are in this header for use by lib/test_firmware.c only!
  */
 struct efi_embedded_fw {
        struct list_head list;
@@ -18,8 +18,6 @@ struct efi_embedded_fw {
        size_t length;
 };
 
-extern struct list_head efi_embedded_fw_list;
-
 /**
  * struct efi_embedded_fw_desc - This struct is used by the EFI embedded-fw
  *                               code to search for embedded firmwares.
index efebbffcd5cc971dfc5197e32eea6bbdd991dc2c..159c7476b11b4852b84a095f62bffbe07ecab0d0 100644 (file)
@@ -110,15 +110,30 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs
 #endif
 
 /**
- * syscall_enter_from_user_mode - Check and handle work before invoking
- *                              a syscall
+ * syscall_enter_from_user_mode_prepare - Establish state and enable interrupts
  * @regs:      Pointer to currents pt_regs
- * @syscall:   The syscall number
  *
  * Invoked from architecture specific syscall entry code with interrupts
  * disabled. The calling code has to be non-instrumentable. When the
- * function returns all state is correct and the subsequent functions can be
- * instrumented.
+ * function returns all state is correct, interrupts are enabled and the
+ * subsequent functions can be instrumented.
+ *
+ * This handles lockdep, RCU (context tracking) and tracing state.
+ *
+ * This is invoked when there is extra architecture specific functionality
+ * to be done between establishing state and handling user mode entry work.
+ */
+void syscall_enter_from_user_mode_prepare(struct pt_regs *regs);
+
+/**
+ * syscall_enter_from_user_mode_work - Check and handle work before invoking
+ *                                    a syscall
+ * @regs:      Pointer to currents pt_regs
+ * @syscall:   The syscall number
+ *
+ * Invoked from architecture specific syscall entry code with interrupts
+ * enabled after invoking syscall_enter_from_user_mode_prepare() and extra
+ * architecture specific work.
  *
  * Returns: The original or a modified syscall number
  *
@@ -127,12 +142,30 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs
  * syscall_set_return_value() first.  If neither of those are called and -1
  * is returned, then the syscall will fail with ENOSYS.
  *
- * The following functionality is handled here:
+ * It handles the following work items:
  *
- *  1) Establish state (lockdep, RCU (context tracking), tracing)
- *  2) TIF flag dependent invocations of arch_syscall_enter_tracehook(),
+ *  1) TIF flag dependent invocations of arch_syscall_enter_tracehook(),
  *     __secure_computing(), trace_sys_enter()
- *  3) Invocation of audit_syscall_entry()
+ *  2) Invocation of audit_syscall_entry()
+ */
+long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall);
+
+/**
+ * syscall_enter_from_user_mode - Establish state and check and handle work
+ *                               before invoking a syscall
+ * @regs:      Pointer to currents pt_regs
+ * @syscall:   The syscall number
+ *
+ * Invoked from architecture specific syscall entry code with interrupts
+ * disabled. The calling code has to be non-instrumentable. When the
+ * function returns all state is correct, interrupts are enabled and the
+ * subsequent functions can be instrumented.
+ *
+ * This is combination of syscall_enter_from_user_mode_prepare() and
+ * syscall_enter_from_user_mode_work().
+ *
+ * Returns: The original or a modified syscall number. See
+ * syscall_enter_from_user_mode_work() for further explanation.
  */
 long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall);
 
index 0a355b005bf458dadcec078d3ca2a94e75054f0c..ebfb7cfb65f10bbfd00e6bf63712e9e4720f351a 100644 (file)
@@ -1200,7 +1200,7 @@ static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
                BPF_ANCILLARY(RANDOM);
                BPF_ANCILLARY(VLAN_TPID);
                }
-               /* Fallthrough. */
+               fallthrough;
        default:
                return ftest->code;
        }
index e019ea2f1347e6ebddea6cfeab01047c6af00660..7519ae003a082cfd3d87d7628a91bd8f3b3a9fda 100644 (file)
@@ -2132,6 +2132,10 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src,
  *
  * I_DONTCACHE         Evict inode as soon as it is not used anymore.
  *
+ * I_SYNC_QUEUED       Inode is queued in b_io or b_more_io writeback lists.
+ *                     Used to detect that mark_inode_dirty() should not move
+ *                     inode between dirty lists.
+ *
  * Q: What is the difference between I_WILL_FREE and I_FREEING?
  */
 #define I_DIRTY_SYNC           (1 << 0)
@@ -2149,12 +2153,11 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src,
 #define I_DIO_WAKEUP           (1 << __I_DIO_WAKEUP)
 #define I_LINKABLE             (1 << 10)
 #define I_DIRTY_TIME           (1 << 11)
-#define __I_DIRTY_TIME_EXPIRED 12
-#define I_DIRTY_TIME_EXPIRED   (1 << __I_DIRTY_TIME_EXPIRED)
 #define I_WB_SWITCH            (1 << 13)
 #define I_OVL_INUSE            (1 << 14)
 #define I_CREATING             (1 << 15)
 #define I_DONTCACHE            (1 << 16)
+#define I_SYNC_QUEUED          (1 << 17)
 
 #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
 #define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
index 2eab6d5f6736a518b3202abc5ea2b9fcd842234c..aab0ffc6bac67a074a99590ca348f001d2db4e03 100644 (file)
@@ -120,7 +120,7 @@ static inline bool fs_validate_description(const char *name,
 #define fsparam_u32oct(NAME, OPT) \
                        __fsparam(fs_param_is_u32, NAME, OPT, 0, (void *)8)
 #define fsparam_u32hex(NAME, OPT) \
-                       __fsparam(fs_param_is_u32_hex, NAME, OPT, 0, (void *16))
+                       __fsparam(fs_param_is_u32_hex, NAME, OPT, 0, (void *)16)
 #define fsparam_s32(NAME, OPT) __fsparam(fs_param_is_s32, NAME, OPT, 0, NULL)
 #define fsparam_u64(NAME, OPT) __fsparam(fs_param_is_u64, NAME, OPT, 0, NULL)
 #define fsparam_enum(NAME, OPT, array) __fsparam(fs_param_is_enum, NAME, OPT, 0, array)
index ce2c06f72e863f0271a04e8f0e428d8f0d3ee3f2..e5c2d5cc6e6ad74cde812be7d7e95e756184e9d5 100644 (file)
@@ -85,8 +85,7 @@ static inline int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *val
 extern int ftrace_enabled;
 extern int
 ftrace_enable_sysctl(struct ctl_table *table, int write,
-                    void __user *buffer, size_t *lenp,
-                    loff_t *ppos);
+                    void *buffer, size_t *lenp, loff_t *ppos);
 
 struct ftrace_ops;
 
index 875f71132b1425b494ba9eb538f29543cb857753..c7044a14200ea2744f69c589672b2c7e0fe9b6a4 100644 (file)
@@ -959,34 +959,49 @@ static inline void hid_device_io_stop(struct hid_device *hid) {
  * @max: maximal valid usage->code to consider later (out parameter)
  * @type: input event type (EV_KEY, EV_REL, ...)
  * @c: code which corresponds to this usage and type
+ *
+ * The value pointed to by @bit will be set to NULL if either @type is
+ * an unhandled event type, or if @c is out of range for @type. This
+ * can be used as an error condition.
  */
 static inline void hid_map_usage(struct hid_input *hidinput,
                struct hid_usage *usage, unsigned long **bit, int *max,
-               __u8 type, __u16 c)
+               __u8 type, unsigned int c)
 {
        struct input_dev *input = hidinput->input;
-
-       usage->type = type;
-       usage->code = c;
+       unsigned long *bmap = NULL;
+       unsigned int limit = 0;
 
        switch (type) {
        case EV_ABS:
-               *bit = input->absbit;
-               *max = ABS_MAX;
+               bmap = input->absbit;
+               limit = ABS_MAX;
                break;
        case EV_REL:
-               *bit = input->relbit;
-               *max = REL_MAX;
+               bmap = input->relbit;
+               limit = REL_MAX;
                break;
        case EV_KEY:
-               *bit = input->keybit;
-               *max = KEY_MAX;
+               bmap = input->keybit;
+               limit = KEY_MAX;
                break;
        case EV_LED:
-               *bit = input->ledbit;
-               *max = LED_MAX;
+               bmap = input->ledbit;
+               limit = LED_MAX;
                break;
        }
+
+       if (unlikely(c > limit || !bmap)) {
+               pr_warn_ratelimited("%s: Invalid code %d type %d\n",
+                                   input->name, c, type);
+               *bit = NULL;
+               return;
+       }
+
+       usage->type = type;
+       usage->code = c;
+       *max = limit;
+       *bit = bmap;
 }
 
 /**
@@ -1000,7 +1015,8 @@ static inline void hid_map_usage_clear(struct hid_input *hidinput,
                __u8 type, __u16 c)
 {
        hid_map_usage(hidinput, usage, bit, max, type, c);
-       clear_bit(c, *bit);
+       if (*bit)
+               clear_bit(usage->code, *bit);
 }
 
 /**
index d03071732db4add88eadef01988c6585b23b5955..7c522fdd9ea735280a2cd04ada1507e766967ff6 100644 (file)
 #define I2C_PCA_CON_SI         0x08 /* Serial Interrupt */
 #define I2C_PCA_CON_CR         0x07 /* Clock Rate (MASK) */
 
+/**
+ * struct pca_i2c_bus_settings - The configured PCA i2c bus settings
+ * @mode: Configured i2c bus mode
+ * @tlow: Configured SCL LOW period
+ * @thi: Configured SCL HIGH period
+ * @clock_freq: The configured clock frequency
+ */
+struct pca_i2c_bus_settings {
+       int mode;
+       int tlow;
+       int thi;
+       int clock_freq;
+};
+
 struct i2c_algo_pca_data {
        void                            *data;  /* private low level data */
        void (*write_byte)              (void *data, int reg, int val);
@@ -64,6 +78,7 @@ struct i2c_algo_pca_data {
         * For PCA9665, use the frequency you want here. */
        unsigned int                    i2c_clock;
        unsigned int                    chip;
+       struct pca_i2c_bus_settings             bus_settings;
 };
 
 int i2c_pca_add_bus(struct i2c_adapter *);
index bd5c55755447c5303b7be70588fb41eb9746768d..3ed4e8771b64e78fc9d42eb68de8ea5b171ecc02 100644 (file)
@@ -49,17 +49,18 @@ struct irqtrace_events {
 DECLARE_PER_CPU(int, hardirqs_enabled);
 DECLARE_PER_CPU(int, hardirq_context);
 
-  extern void trace_hardirqs_on_prepare(void);
-  extern void trace_hardirqs_off_finish(void);
-  extern void trace_hardirqs_on(void);
-  extern void trace_hardirqs_off(void);
-# define lockdep_hardirq_context()     (this_cpu_read(hardirq_context))
+extern void trace_hardirqs_on_prepare(void);
+extern void trace_hardirqs_off_finish(void);
+extern void trace_hardirqs_on(void);
+extern void trace_hardirqs_off(void);
+
+# define lockdep_hardirq_context()     (raw_cpu_read(hardirq_context))
 # define lockdep_softirq_context(p)    ((p)->softirq_context)
 # define lockdep_hardirqs_enabled()    (this_cpu_read(hardirqs_enabled))
 # define lockdep_softirqs_enabled(p)   ((p)->softirqs_enabled)
 # define lockdep_hardirq_enter()                       \
 do {                                                   \
-       if (this_cpu_inc_return(hardirq_context) == 1)  \
+       if (__this_cpu_inc_return(hardirq_context) == 1)\
                current->hardirq_threaded = 0;          \
 } while (0)
 # define lockdep_hardirq_threaded()            \
@@ -68,7 +69,7 @@ do {                                          \
 } while (0)
 # define lockdep_hardirq_exit()                        \
 do {                                           \
-       this_cpu_dec(hardirq_context);          \
+       __this_cpu_dec(hardirq_context);        \
 } while (0)
 # define lockdep_softirq_enter()               \
 do {                                           \
@@ -120,17 +121,17 @@ do {                                              \
 #else
 # define trace_hardirqs_on_prepare()           do { } while (0)
 # define trace_hardirqs_off_finish()           do { } while (0)
-# define trace_hardirqs_on()           do { } while (0)
-# define trace_hardirqs_off()          do { } while (0)
-# define lockdep_hardirq_context()     0
-# define lockdep_softirq_context(p)    0
-# define lockdep_hardirqs_enabled()    0
-# define lockdep_softirqs_enabled(p)   0
-# define lockdep_hardirq_enter()       do { } while (0)
-# define lockdep_hardirq_threaded()    do { } while (0)
-# define lockdep_hardirq_exit()                do { } while (0)
-# define lockdep_softirq_enter()       do { } while (0)
-# define lockdep_softirq_exit()                do { } while (0)
+# define trace_hardirqs_on()                   do { } while (0)
+# define trace_hardirqs_off()                  do { } while (0)
+# define lockdep_hardirq_context()             0
+# define lockdep_softirq_context(p)            0
+# define lockdep_hardirqs_enabled()            0
+# define lockdep_softirqs_enabled(p)           0
+# define lockdep_hardirq_enter()               do { } while (0)
+# define lockdep_hardirq_threaded()            do { } while (0)
+# define lockdep_hardirq_exit()                        do { } while (0)
+# define lockdep_softirq_enter()               do { } while (0)
+# define lockdep_softirq_exit()                        do { } while (0)
 # define lockdep_hrtimer_enter(__hrtimer)      false
 # define lockdep_hrtimer_exit(__context)       do { } while (0)
 # define lockdep_posixtimer_enter()            do { } while (0)
@@ -181,26 +182,33 @@ do {                                              \
  * if !TRACE_IRQFLAGS.
  */
 #ifdef CONFIG_TRACE_IRQFLAGS
-#define local_irq_enable() \
-       do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
-#define local_irq_disable() \
-       do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
+
+#define local_irq_enable()                             \
+       do {                                            \
+               trace_hardirqs_on();                    \
+               raw_local_irq_enable();                 \
+       } while (0)
+
+#define local_irq_disable()                            \
+       do {                                            \
+               bool was_disabled = raw_irqs_disabled();\
+               raw_local_irq_disable();                \
+               if (!was_disabled)                      \
+                       trace_hardirqs_off();           \
+       } while (0)
+
 #define local_irq_save(flags)                          \
        do {                                            \
                raw_local_irq_save(flags);              \
-               trace_hardirqs_off();                   \
+               if (!raw_irqs_disabled_flags(flags))    \
+                       trace_hardirqs_off();           \
        } while (0)
 
-
 #define local_irq_restore(flags)                       \
        do {                                            \
-               if (raw_irqs_disabled_flags(flags)) {   \
-                       raw_local_irq_restore(flags);   \
-                       trace_hardirqs_off();           \
-               } else {                                \
+               if (!raw_irqs_disabled_flags(flags))    \
                        trace_hardirqs_on();            \
-                       raw_local_irq_restore(flags);   \
-               }                                       \
+               raw_local_irq_restore(flags);           \
        } while (0)
 
 #define safe_halt()                            \
@@ -214,10 +222,7 @@ do {                                               \
 
 #define local_irq_enable()     do { raw_local_irq_enable(); } while (0)
 #define local_irq_disable()    do { raw_local_irq_disable(); } while (0)
-#define local_irq_save(flags)                                  \
-       do {                                                    \
-               raw_local_irq_save(flags);                      \
-       } while (0)
+#define local_irq_save(flags)  do { raw_local_irq_save(flags); } while (0)
 #define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
 #define safe_halt()            do { raw_safe_halt(); } while (0)
 
index 19ddd43aee68958d64ba789c1e83d2bc1eb44f82..cfb62e9f37be090da5a20e4b99c5d3bc31fe7f7e 100644 (file)
@@ -86,17 +86,17 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
        }
        /* Last block: affect all 32 bits of (c) */
        switch (length) {
-       case 12: c += (u32)k[11]<<24;   /* fall through */
-       case 11: c += (u32)k[10]<<16;   /* fall through */
-       case 10: c += (u32)k[9]<<8;     /* fall through */
-       case 9:  c += k[8];             /* fall through */
-       case 8:  b += (u32)k[7]<<24;    /* fall through */
-       case 7:  b += (u32)k[6]<<16;    /* fall through */
-       case 6:  b += (u32)k[5]<<8;     /* fall through */
-       case 5:  b += k[4];             /* fall through */
-       case 4:  a += (u32)k[3]<<24;    /* fall through */
-       case 3:  a += (u32)k[2]<<16;    /* fall through */
-       case 2:  a += (u32)k[1]<<8;     /* fall through */
+       case 12: c += (u32)k[11]<<24;   fallthrough;
+       case 11: c += (u32)k[10]<<16;   fallthrough;
+       case 10: c += (u32)k[9]<<8;     fallthrough;
+       case 9:  c += k[8];             fallthrough;
+       case 8:  b += (u32)k[7]<<24;    fallthrough;
+       case 7:  b += (u32)k[6]<<16;    fallthrough;
+       case 6:  b += (u32)k[5]<<8;     fallthrough;
+       case 5:  b += k[4];             fallthrough;
+       case 4:  a += (u32)k[3]<<24;    fallthrough;
+       case 3:  a += (u32)k[2]<<16;    fallthrough;
+       case 2:  a += (u32)k[1]<<8;     fallthrough;
        case 1:  a += k[0];
                 __jhash_final(a, b, c);
        case 0: /* Nothing left to add */
@@ -132,8 +132,8 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
 
        /* Handle the last 3 u32's */
        switch (length) {
-       case 3: c += k[2];      /* fall through */
-       case 2: b += k[1];      /* fall through */
+       case 3: c += k[2];      fallthrough;
+       case 2: b += k[1];      fallthrough;
        case 1: a += k[0];
                __jhash_final(a, b, c);
        case 0: /* Nothing left to add */
index 500def620d8f4933a46ebecb453ade196f4ea998..c25b8e41c0ea37147c5a0e4683c7a011dbd0beb8 100644 (file)
  * lower_32_bits - return bits 0-31 of a number
  * @n: the number we're accessing
  */
-#define lower_32_bits(n) ((u32)(n))
+#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
 
 struct completion;
 struct pt_regs;
index 9be1bff4f586a61573ecc8b806b2137e3b187613..8aab327b5539dce97529c09e627288b5ddd7e838 100644 (file)
@@ -373,6 +373,8 @@ void unregister_kretprobes(struct kretprobe **rps, int num);
 void kprobe_flush_task(struct task_struct *tk);
 void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
 
+void kprobe_free_init_mem(void);
+
 int disable_kprobe(struct kprobe *kp);
 int enable_kprobe(struct kprobe *kp);
 
@@ -435,6 +437,9 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num)
 static inline void kprobe_flush_task(struct task_struct *tk)
 {
 }
+static inline void kprobe_free_init_mem(void)
+{
+}
 static inline int disable_kprobe(struct kprobe *kp)
 {
        return -ENOSYS;
index e48b1e453ff5109292f7a735b7e4c73a0caf43b9..161e8164abcf535f30417593b055e3c3c5acf564 100644 (file)
@@ -53,8 +53,6 @@ struct page *ksm_might_need_to_copy(struct page *page,
 
 void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc);
 void ksm_migrate_page(struct page *newpage, struct page *oldpage);
-bool reuse_ksm_page(struct page *page,
-                       struct vm_area_struct *vma, unsigned long address);
 
 #else  /* !CONFIG_KSM */
 
@@ -88,11 +86,6 @@ static inline void rmap_walk_ksm(struct page *page,
 static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
 {
 }
-static inline bool reuse_ksm_page(struct page *page,
-                       struct vm_area_struct *vma, unsigned long address)
-{
-       return false;
-}
 #endif /* CONFIG_MMU */
 #endif /* !CONFIG_KSM */
 
index a23076765b4cc26040bd6b3110f06c1d14724e7b..05e3c2fb3ef7828438c8456cd3553ecaa4561bc6 100644 (file)
@@ -749,25 +749,46 @@ int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
 int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
                              gpa_t gpa, unsigned long len);
 
-#define __kvm_put_guest(kvm, gfn, offset, value, type)                 \
+#define __kvm_get_guest(kvm, gfn, offset, v)                           \
 ({                                                                     \
        unsigned long __addr = gfn_to_hva(kvm, gfn);                    \
-       type __user *__uaddr = (type __user *)(__addr + offset);        \
+       typeof(v) __user *__uaddr = (typeof(__uaddr))(__addr + offset); \
        int __ret = -EFAULT;                                            \
                                                                        \
        if (!kvm_is_error_hva(__addr))                                  \
-               __ret = put_user(value, __uaddr);                       \
+               __ret = get_user(v, __uaddr);                           \
+       __ret;                                                          \
+})
+
+#define kvm_get_guest(kvm, gpa, v)                                     \
+({                                                                     \
+       gpa_t __gpa = gpa;                                              \
+       struct kvm *__kvm = kvm;                                        \
+                                                                       \
+       __kvm_get_guest(__kvm, __gpa >> PAGE_SHIFT,                     \
+                       offset_in_page(__gpa), v);                      \
+})
+
+#define __kvm_put_guest(kvm, gfn, offset, v)                           \
+({                                                                     \
+       unsigned long __addr = gfn_to_hva(kvm, gfn);                    \
+       typeof(v) __user *__uaddr = (typeof(__uaddr))(__addr + offset); \
+       int __ret = -EFAULT;                                            \
+                                                                       \
+       if (!kvm_is_error_hva(__addr))                                  \
+               __ret = put_user(v, __uaddr);                           \
        if (!__ret)                                                     \
                mark_page_dirty(kvm, gfn);                              \
        __ret;                                                          \
 })
 
-#define kvm_put_guest(kvm, gpa, value, type)                           \
+#define kvm_put_guest(kvm, gpa, v)                                     \
 ({                                                                     \
        gpa_t __gpa = gpa;                                              \
        struct kvm *__kvm = kvm;                                        \
+                                                                       \
        __kvm_put_guest(__kvm, __gpa >> PAGE_SHIFT,                     \
-                       offset_in_page(__gpa), (value), type);          \
+                       offset_in_page(__gpa), v);                      \
 })
 
 int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
index 77ccf040a128b1461f9a1762eaf3c6439eabc6eb..5f550eb27f811ad7b73c72d9a84daae3c730c900 100644 (file)
@@ -421,6 +421,7 @@ enum {
        ATA_HORKAGE_NO_DMA_LOG  = (1 << 23),    /* don't use DMA for log read */
        ATA_HORKAGE_NOTRIM      = (1 << 24),    /* don't use TRIM */
        ATA_HORKAGE_MAX_SEC_1024 = (1 << 25),   /* Limit max sects to 1024 */
+       ATA_HORKAGE_MAX_TRIM_128M = (1 << 26),  /* Limit max trim size to 128M */
 
         /* DMA mask for user DMA control: User visible values; DO NOT
            renumber */
index 62a382d1845bd56a2cd7c6f4398056723e39142f..6a584b3e5c74f5bedf9c8cf1695e30585335770b 100644 (file)
@@ -535,19 +535,27 @@ do {                                                                      \
 DECLARE_PER_CPU(int, hardirqs_enabled);
 DECLARE_PER_CPU(int, hardirq_context);
 
+/*
+ * The below lockdep_assert_*() macros use raw_cpu_read() to access the above
+ * per-cpu variables. This is required because this_cpu_read() will potentially
+ * call into preempt/irq-disable and that obviously isn't right. This is also
+ * correct because when IRQs are enabled, it doesn't matter if we accidentally
+ * read the value from our previous CPU.
+ */
+
 #define lockdep_assert_irqs_enabled()                                  \
 do {                                                                   \
-       WARN_ON_ONCE(debug_locks && !this_cpu_read(hardirqs_enabled));  \
+       WARN_ON_ONCE(debug_locks && !raw_cpu_read(hardirqs_enabled));   \
 } while (0)
 
 #define lockdep_assert_irqs_disabled()                                 \
 do {                                                                   \
-       WARN_ON_ONCE(debug_locks && this_cpu_read(hardirqs_enabled));   \
+       WARN_ON_ONCE(debug_locks && raw_cpu_read(hardirqs_enabled));    \
 } while (0)
 
 #define lockdep_assert_in_irq()                                                \
 do {                                                                   \
-       WARN_ON_ONCE(debug_locks && !this_cpu_read(hardirq_context));   \
+       WARN_ON_ONCE(debug_locks && !raw_cpu_read(hardirq_context));    \
 } while (0)
 
 #define lockdep_assert_preemption_enabled()                            \
@@ -555,7 +563,7 @@ do {                                                                        \
        WARN_ON_ONCE(IS_ENABLED(CONFIG_PREEMPT_COUNT)   &&              \
                     debug_locks                        &&              \
                     (preempt_count() != 0              ||              \
-                     !this_cpu_read(hardirqs_enabled)));               \
+                     !raw_cpu_read(hardirqs_enabled)));                \
 } while (0)
 
 #define lockdep_assert_preemption_disabled()                           \
@@ -563,7 +571,7 @@ do {                                                                        \
        WARN_ON_ONCE(IS_ENABLED(CONFIG_PREEMPT_COUNT)   &&              \
                     debug_locks                        &&              \
                     (preempt_count() == 0              &&              \
-                     this_cpu_read(hardirqs_enabled)));                \
+                     raw_cpu_read(hardirqs_enabled)));                 \
 } while (0)
 
 #else
index 83a4a3ca3e8a76f4a80b8740bd8f82b2d68fae59..c619ec6eff4aee113ab5a20381a9662a9df02796 100644 (file)
@@ -173,7 +173,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
 #define roundup_pow_of_two(n)                  \
 (                                              \
        __builtin_constant_p(n) ? (             \
-               (n == 1) ? 1 :                  \
+               ((n) == 1) ? 1 :                \
                (1UL << (ilog2((n) - 1) + 1))   \
                                   ) :          \
        __roundup_pow_of_two(n)                 \
index 5f5b2df06e61045ed276fa9dec99bf087477f688..e5862746751b1e72f17b0f7efe318e470a7ef79a 100644 (file)
@@ -46,11 +46,10 @@ struct vmem_altmap {
  * wakeup is used to coordinate physical address space management (ex:
  * fs truncate/hole punch) vs pinned pages (ex: device dma).
  *
- * MEMORY_DEVICE_DEVDAX:
+ * MEMORY_DEVICE_GENERIC:
  * Host memory that has similar access semantics as System RAM i.e. DMA
- * coherent and supports page pinning. In contrast to
- * MEMORY_DEVICE_FS_DAX, this memory is access via a device-dax
- * character device.
+ * coherent and supports page pinning. This is for example used by DAX devices
+ * that expose memory using a character device.
  *
  * MEMORY_DEVICE_PCI_P2PDMA:
  * Device memory residing in a PCI BAR intended for use with Peer-to-Peer
@@ -60,7 +59,7 @@ enum memory_type {
        /* 0 is reserved to catch uninitialized type fields */
        MEMORY_DEVICE_PRIVATE = 1,
        MEMORY_DEVICE_FS_DAX,
-       MEMORY_DEVICE_DEVDAX,
+       MEMORY_DEVICE_GENERIC,
        MEMORY_DEVICE_PCI_P2PDMA,
 };
 
index da4c65f9435ff13a4addce29dd5a9eb13f46b370..ebf73d4ee969060f38d14d791a0e4c47780d0156 100644 (file)
@@ -281,6 +281,7 @@ struct memstick_host {
 
        struct memstick_dev *card;
        unsigned int        retries;
+       bool removing;
 
        /* Notify the host that some requests are pending. */
        void                (*request)(struct memstick_host *host);
index 1983e08f590624cdc9b87e5d1ce149372f3be2f4..16b799a0522cdc1af304cb08c412506e3b0c1cd7 100644 (file)
@@ -41,6 +41,8 @@ struct writeback_control;
 struct bdi_writeback;
 struct pt_regs;
 
+extern int sysctl_page_lock_unfairness;
+
 void init_mm_internals(void);
 
 #ifndef CONFIG_NEED_MULTIPLE_NODES     /* Don't use mapnrs, do it properly */
@@ -157,11 +159,14 @@ static inline void __mm_zero_struct_page(struct page *page)
 
        switch (sizeof(struct page)) {
        case 80:
-               _pp[9] = 0;     /* fallthrough */
+               _pp[9] = 0;
+               fallthrough;
        case 72:
-               _pp[8] = 0;     /* fallthrough */
+               _pp[8] = 0;
+               fallthrough;
        case 64:
-               _pp[7] = 0;     /* fallthrough */
+               _pp[7] = 0;
+               fallthrough;
        case 56:
                _pp[6] = 0;
                _pp[5] = 0;
@@ -321,6 +326,8 @@ extern unsigned int kobjsize(const void *objp);
 
 #if defined(CONFIG_X86)
 # define VM_PAT                VM_ARCH_1       /* PAT reserves whole VMA at once (x86) */
+#elif defined(CONFIG_PPC)
+# define VM_SAO                VM_ARCH_1       /* Strong Access Ordering (powerpc) */
 #elif defined(CONFIG_PARISC)
 # define VM_GROWSUP    VM_ARCH_1
 #elif defined(CONFIG_IA64)
@@ -1639,7 +1646,7 @@ struct mmu_notifier_range;
 void free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
                unsigned long end, unsigned long floor, unsigned long ceiling);
 int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
-                       struct vm_area_struct *vma);
+                   struct vm_area_struct *vma, struct vm_area_struct *new);
 int follow_pte_pmd(struct mm_struct *mm, unsigned long address,
                   struct mmu_notifier_range *range,
                   pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp);
@@ -2409,7 +2416,7 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn,
 
 extern void set_dma_reserve(unsigned long new_dma_reserve);
 extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long,
-               enum memmap_context, struct vmem_altmap *);
+               enum meminit_context, struct vmem_altmap *);
 extern void setup_per_zone_wmarks(void);
 extern int __meminit init_per_zone_wmark_min(void);
 extern void mem_init(void);
index 496c3ff97cce7abea90e18f4a6cced9be0847769..ed028af3cb19b8f31d4969c78ff6ca0ac123c4d1 100644 (file)
@@ -436,6 +436,16 @@ struct mm_struct {
                 */
                atomic_t mm_count;
 
+               /**
+                * @has_pinned: Whether this mm has pinned any pages.  This can
+                * be either replaced in the future by @pinned_vm when it
+                * becomes stable, or grow into a counter on its own. We're
+                * aggresive on this bit now - even if the pinned pages were
+                * unpinned later on, we'll still keep this bit set for the
+                * lifecycle of this mm just for simplicity.
+                */
+               atomic_t has_pinned;
+
 #ifdef CONFIG_MMU
                atomic_long_t pgtables_bytes;   /* PTE page table pages */
 #endif
index c51a84132d7c08000f00e1edbabf6ceb2cfd8693..03dee12d2b61ce3548ec041e1197caba175df8a3 100644 (file)
@@ -3,10 +3,15 @@
 #define _LINUX_MMU_CONTEXT_H
 
 #include <asm/mmu_context.h>
+#include <asm/mmu.h>
 
 /* Architectures that care about IRQ state in switch_mm can override this. */
 #ifndef switch_mm_irqs_off
 # define switch_mm_irqs_off switch_mm
 #endif
 
+#ifndef leave_mm
+static inline void leave_mm(int cpu) { }
+#endif
+
 #endif
index 8379432f4f2ff119d5b3535be2545d34ed89ce34..0f7a4ff4b0593c72e3403d105de1d1b477001d43 100644 (file)
@@ -824,10 +824,15 @@ bool zone_watermark_ok(struct zone *z, unsigned int order,
                unsigned int alloc_flags);
 bool zone_watermark_ok_safe(struct zone *z, unsigned int order,
                unsigned long mark, int highest_zoneidx);
-enum memmap_context {
-       MEMMAP_EARLY,
-       MEMMAP_HOTPLUG,
+/*
+ * Memory initialization context, use to differentiate memory added by
+ * the platform statically or via memory hotplug interface.
+ */
+enum meminit_context {
+       MEMINIT_EARLY,
+       MEMINIT_HOTPLUG,
 };
+
 extern void init_currently_empty_zone(struct zone *zone, unsigned long start_pfn,
                                     unsigned long size);
 
index 2cc3cf80b49adfc47822856ad4a1d3ad88eded3f..0b17c4322b097c666895fb9f38a589c33fccca45 100644 (file)
@@ -193,7 +193,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
 #define NETIF_F_GSO_MASK       (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
                __NETIF_F_BIT(NETIF_F_GSO_SHIFT))
 
-/* List of IP checksum features. Note that NETIF_F_ HW_CSUM should not be
+/* List of IP checksum features. Note that NETIF_F_HW_CSUM should not be
  * set in features when NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM are set--
  * this would be contradictory
  */
index b0e303f6603f0bb7ef2a45b1d485e13822969382..7bd4fcdd0738a718d8b0f7134523cd87e4dcdb7b 100644 (file)
@@ -1784,6 +1784,7 @@ enum netdev_priv_flags {
  *                             the watchdog (see dev_watchdog())
  *     @watchdog_timer:        List of timers
  *
+ *     @proto_down_reason:     reason a netdev interface is held down
  *     @pcpu_refcnt:           Number of references to this device
  *     @todo_list:             Delayed register/unregister
  *     @link_watch_list:       XXX: need comments on this one
@@ -1848,6 +1849,7 @@ enum netdev_priv_flags {
  *     @udp_tunnel_nic_info:   static structure describing the UDP tunnel
  *                             offload capabilities of the device
  *     @udp_tunnel_nic:        UDP tunnel offload state
+ *     @xdp_state:             stores info on attached XDP BPF programs
  *
  *     FIXME: cleanup struct net_device such that network protocol info
  *     moves out.
index 9a33f171aa822d3a484f6f42f840ad2c7d5dc760..625f491b95de87904892dc52e6e5bf5bba8a57fa 100644 (file)
@@ -9,6 +9,8 @@ struct ip_ct_sctp {
        enum sctp_conntrack state;
 
        __be32 vtag[IP_CT_DIR_MAX];
+       u8 last_dir;
+       u8 flags;
 };
 
 #endif /* _NF_CONNTRACK_SCTP_H */
index 851425c3178f178d3c325773f2a77fa9ec6e3c40..89016d08f6a278d9a7703cc4256c277f05fa7173 100644 (file)
@@ -43,8 +43,7 @@ int nfnetlink_has_listeners(struct net *net, unsigned int group);
 int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid,
                   unsigned int group, int echo, gfp_t flags);
 int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
-int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
-                     int flags);
+int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid);
 
 static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type)
 {
index 9408f3252c8eec1458ba2404262284e274bc02fb..69cb46f7b8d2c41a1692ff1350f5f5e03dbc37a0 100644 (file)
@@ -1611,8 +1611,8 @@ struct nfs_pgio_header {
        __u64                   mds_offset;     /* Filelayout dense stripe */
        struct nfs_page_array   page_array;
        struct nfs_client       *ds_clp;        /* pNFS data server */
-       int                     ds_commit_idx;  /* ds index if ds_clp is set */
-       int                     pgio_mirror_idx;/* mirror index in pgio layer */
+       u32                     ds_commit_idx;  /* ds index if ds_clp is set */
+       u32                     pgio_mirror_idx;/* mirror index in pgio layer */
 };
 
 struct nfs_mds_commit_info {
index 4866f32a02d8d4a00d68cdd43fdf3839819c68e7..014ba3ab2efd8b7b7b1dc58b0d9e9d63bf3d1e90 100644 (file)
@@ -99,11 +99,13 @@ extern struct node *node_devices[];
 typedef  void (*node_registration_func_t)(struct node *);
 
 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA)
-extern int link_mem_sections(int nid, unsigned long start_pfn,
-                            unsigned long end_pfn);
+int link_mem_sections(int nid, unsigned long start_pfn,
+                     unsigned long end_pfn,
+                     enum meminit_context context);
 #else
 static inline int link_mem_sections(int nid, unsigned long start_pfn,
-                                   unsigned long end_pfn)
+                                   unsigned long end_pfn,
+                                   enum meminit_context context)
 {
        return 0;
 }
@@ -128,7 +130,8 @@ static inline int register_one_node(int nid)
                if (error)
                        return error;
                /* link memory sections under this node */
-               error = link_mem_sections(nid, start_pfn, end_pfn);
+               error = link_mem_sections(nid, start_pfn, end_pfn,
+                                         MEMINIT_EARLY);
        }
 
        return error;
index 5e033fe1ff4e9a37a50a05ebca270b3938570a9e..5fda40f97fe916043b8217e8fd8b6a3ccdb0f26f 100644 (file)
@@ -60,7 +60,7 @@ static inline void percpu_down_read(struct percpu_rw_semaphore *sem)
         * anything we did within this RCU-sched read-size critical section.
         */
        if (likely(rcu_sync_is_idle(&sem->rss)))
-               __this_cpu_inc(*sem->read_count);
+               this_cpu_inc(*sem->read_count);
        else
                __percpu_down_read(sem, false); /* Unconditional memory barrier */
        /*
@@ -79,7 +79,7 @@ static inline bool percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
         * Same as in percpu_down_read().
         */
        if (likely(rcu_sync_is_idle(&sem->rss)))
-               __this_cpu_inc(*sem->read_count);
+               this_cpu_inc(*sem->read_count);
        else
                ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */
        preempt_enable();
@@ -103,7 +103,7 @@ static inline void percpu_up_read(struct percpu_rw_semaphore *sem)
         * Same as in percpu_down_read().
         */
        if (likely(rcu_sync_is_idle(&sem->rss))) {
-               __this_cpu_dec(*sem->read_count);
+               this_cpu_dec(*sem->read_count);
        } else {
                /*
                 * slowpath; reader will only ever wake a single blocked
@@ -115,7 +115,7 @@ static inline void percpu_up_read(struct percpu_rw_semaphore *sem)
                 * aggregate zero, as that is the only time it matters) they
                 * will also see our critical section.
                 */
-               __this_cpu_dec(*sem->read_count);
+               this_cpu_dec(*sem->read_count);
                rcuwait_wake_up(&sem->writer);
        }
        preempt_enable();
index e8cbc2e795d530099fe135a51b9e1fcd63e03386..90654cb63e9ed505ea5e08deb63b7bbda75a73c1 100644 (file)
@@ -1427,6 +1427,16 @@ typedef unsigned int pgtbl_mod_mask;
 #define mm_pmd_folded(mm)      __is_defined(__PAGETABLE_PMD_FOLDED)
 #endif
 
+#ifndef p4d_offset_lockless
+#define p4d_offset_lockless(pgdp, pgd, address) p4d_offset(&(pgd), address)
+#endif
+#ifndef pud_offset_lockless
+#define pud_offset_lockless(p4dp, p4d, address) pud_offset(&(p4d), address)
+#endif
+#ifndef pmd_offset_lockless
+#define pmd_offset_lockless(pudp, pud, address) pmd_offset(&(pud), address)
+#endif
+
 /*
  * p?d_leaf() - true if this entry is a final mapping to a physical address.
  * This differs from p?d_huge() by the fact that they are always available (if
index 50afd0d0084caf38fa314004c453a8d9a6695dc0..5d2705f1d01c3d7c2574b0a705aecf0ba27ddedf 100644 (file)
@@ -240,8 +240,9 @@ extern unsigned int pipe_max_size;
 extern unsigned long pipe_user_pages_hard;
 extern unsigned long pipe_user_pages_soft;
 
-/* Drop the inode semaphore and wait for a pipe event, atomically */
-void pipe_wait(struct pipe_inode_info *pipe);
+/* Wait for a pipe to be readable/writable while dropping the pipe lock */
+void pipe_wait_readable(struct pipe_inode_info *);
+void pipe_wait_writable(struct pipe_inode_info *);
 
 struct pipe_inode_info *alloc_pipe_info(void);
 void free_pipe_info(struct pipe_inode_info *);
index 4537f57f9e42f7a1441b54f96f79128d274234cc..3d557bbcd2c712176e774b2a6d9f8c513c9fa950 100644 (file)
@@ -44,19 +44,18 @@ struct powercap_control_type_ops {
 };
 
 /**
- * struct powercap_control_type- Defines a powercap control_type
- * @name:              name of control_type
+ * struct powercap_control_type - Defines a powercap control_type
  * @dev:               device for this control_type
  * @idr:               idr to have unique id for its child
- * @root_node:         Root holding power zones for this control_type
+ * @nr_zones:          counter for number of zones of this type
  * @ops:               Pointer to callback struct
- * @node_lock:         mutex for control type
+ * @lock:              mutex for control type
  * @allocated:         This is possible that client owns the memory
  *                     used by this structure. In this case
  *                     this flag is set to false by framework to
  *                     prevent deallocation during release process.
  *                     Otherwise this flag is set to true.
- * @ctrl_inst:         link to the control_type list
+ * @node:              linked-list node
  *
  * Defines powercap control_type. This acts as a container for power
  * zones, which use same method to control power. E.g. RAPL, RAPL-PCI etc.
@@ -129,7 +128,7 @@ struct powercap_zone_ops {
  *                     this flag is set to false by framework to
  *                     prevent deallocation during release process.
  *                     Otherwise this flag is set to true.
- * @constraint_ptr:    List of constraints for this zone.
+ * @constraints:       List of constraints for this zone.
  *
  * This defines a power zone instance. The fields of this structure are
  * private, and should not be used by client drivers.
index cd6a5c7e56ebaa918bc6854f2ba3469374c03164..cdd73afc4c463cdf3ecc89c2c00bcaa9d61ee5e7 100644 (file)
@@ -623,6 +623,7 @@ struct qed_dev_info {
 #define QED_MFW_VERSION_3_OFFSET       24
 
        u32             flash_size;
+       bool            b_arfs_capable;
        bool            b_inter_pf_switch;
        bool            tx_switching;
        bool            rdma_supported;
index 93ecd930efd316554705aecc3053aea778eec397..afe01e232935fa44c11272442b75da197bd58353 100644 (file)
@@ -1666,7 +1666,7 @@ extern struct task_struct *idle_task(int cpu);
  *
  * Return: 1 if @p is an idle task. 0 otherwise.
  */
-static inline bool is_idle_task(const struct task_struct *p)
+static __always_inline bool is_idle_task(const struct task_struct *p)
 {
        return !!(p->flags & PF_IDLE);
 }
index 01fc4d9c9c5406c11988fd21376f7730472225d5..8a99279a579bc2db0b27e852d2fac73ec888ed53 100644 (file)
@@ -248,6 +248,7 @@ struct uart_port {
 
        unsigned char           hub6;                   /* this should be in the 8250 driver */
        unsigned char           suspended;
+       unsigned char           console_reinit;
        const char              *name;                  /* port name */
        struct attribute_group  *attr_group;            /* port specific attributes */
        const struct attribute_group **tty_groups;      /* all attributes (serial core use only) */
index 6bb1a3f0258c27810c14e8daeac99a77beb33108..7bbc0e9cf084728ba6b28fbfb3ed736ee4a6e576 100644 (file)
@@ -137,11 +137,11 @@ static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
                b3 = b->sig[3]; b2 = b->sig[2];                         \
                r->sig[3] = op(a3, b3);                                 \
                r->sig[2] = op(a2, b2);                                 \
-               /* fall through */                                      \
+               fallthrough;                                            \
        case 2:                                                         \
                a1 = a->sig[1]; b1 = b->sig[1];                         \
                r->sig[1] = op(a1, b1);                                 \
-               /* fall through */                                      \
+               fallthrough;                                            \
        case 1:                                                         \
                a0 = a->sig[0]; b0 = b->sig[0];                         \
                r->sig[0] = op(a0, b0);                                 \
@@ -171,9 +171,9 @@ static inline void name(sigset_t *set)                                      \
        switch (_NSIG_WORDS) {                                          \
        case 4: set->sig[3] = op(set->sig[3]);                          \
                set->sig[2] = op(set->sig[2]);                          \
-               /* fall through */                                      \
+               fallthrough;                                            \
        case 2: set->sig[1] = op(set->sig[1]);                          \
-               /* fall through */                                      \
+               fallthrough;                                            \
        case 1: set->sig[0] = op(set->sig[0]);                          \
                    break;                                              \
        default:                                                        \
@@ -194,7 +194,7 @@ static inline void sigemptyset(sigset_t *set)
                memset(set, 0, sizeof(sigset_t));
                break;
        case 2: set->sig[1] = 0;
-               /* fall through */
+               fallthrough;
        case 1: set->sig[0] = 0;
                break;
        }
@@ -207,7 +207,7 @@ static inline void sigfillset(sigset_t *set)
                memset(set, -1, sizeof(sigset_t));
                break;
        case 2: set->sig[1] = -1;
-               /* fall through */
+               fallthrough;
        case 1: set->sig[0] = -1;
                break;
        }
index 46881d9021241c27ca39e2cf16665cb1e18a0cfa..04a18e01b362e3f113168e7a21cb9e900394db43 100644 (file)
@@ -71,7 +71,7 @@
  *     NETIF_F_IPV6_CSUM - Driver (device) is only able to checksum plain
  *                       TCP or UDP packets over IPv6. These are specifically
  *                       unencapsulated packets of the form IPv6|TCP or
- *                       IPv4|UDP where the Next Header field in the IPv6
+ *                       IPv6|UDP where the Next Header field in the IPv6
  *                       header is either TCP or UDP. IPv6 extension headers
  *                       are not supported with this feature. This feature
  *                       cannot be set in features for a device with
@@ -1056,7 +1056,16 @@ void kfree_skb(struct sk_buff *skb);
 void kfree_skb_list(struct sk_buff *segs);
 void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt);
 void skb_tx_error(struct sk_buff *skb);
+
+#ifdef CONFIG_TRACEPOINTS
 void consume_skb(struct sk_buff *skb);
+#else
+static inline void consume_skb(struct sk_buff *skb)
+{
+       return kfree_skb(skb);
+}
+#endif
+
 void __consume_stateless_skb(struct sk_buff *skb);
 void  __kfree_skb(struct sk_buff *skb);
 extern struct kmem_cache *skbuff_head_cache;
@@ -2658,7 +2667,7 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
  *
  * Using max(32, L1_CACHE_BYTES) makes sense (especially with RPS)
  * to reduce average number of cache lines per packet.
- * get_rps_cpus() for example only access one 64 bytes aligned block :
+ * get_rps_cpu() for example only access one 64 bytes aligned block :
  * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
  */
 #ifndef NET_SKB_PAD
@@ -3214,8 +3223,9 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len)
  *     is untouched. Otherwise it is extended. Returns zero on
  *     success. The skb is freed on error if @free_on_error is true.
  */
-static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
-                                 bool free_on_error)
+static inline int __must_check __skb_put_padto(struct sk_buff *skb,
+                                              unsigned int len,
+                                              bool free_on_error)
 {
        unsigned int size = skb->len;
 
@@ -3238,7 +3248,7 @@ static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
  *     is untouched. Otherwise it is extended. Returns zero on
  *     success. The skb is freed on error.
  */
-static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
+static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int len)
 {
        return __skb_put_padto(skb, len, true);
 }
@@ -3745,19 +3755,19 @@ static inline bool __skb_metadata_differs(const struct sk_buff *skb_a,
 #define __it(x, op) (x -= sizeof(u##op))
 #define __it_diff(a, b, op) (*(u##op *)__it(a, op)) ^ (*(u##op *)__it(b, op))
        case 32: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case 24: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case 16: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case  8: diffs |= __it_diff(a, b, 64);
                break;
        case 28: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case 20: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case 12: diffs |= __it_diff(a, b, 64);
-                /* fall through */
+               fallthrough;
        case  4: diffs |= __it_diff(a, b, 32);
                break;
        }
index 49c5d29cd33c812cb4761ae4a5aad58dc1ac0bf3..cf27b080e148216905d65c8be80630e2fb624784 100644 (file)
@@ -220,6 +220,9 @@ struct ti_sci_rm_core_ops {
                                    u16 *range_start, u16 *range_num);
 };
 
+#define TI_SCI_RESASG_SUBTYPE_IR_OUTPUT                0
+#define TI_SCI_RESASG_SUBTYPE_IA_VINT          0xa
+#define TI_SCI_RESASG_SUBTYPE_GLOBAL_EVENT_SEVT        0xd
 /**
  * struct ti_sci_rm_irq_ops: IRQ management operations
  * @set_irq:           Set an IRQ route between the requested source
@@ -556,6 +559,9 @@ u32 ti_sci_get_num_resources(struct ti_sci_resource *res);
 struct ti_sci_resource *
 devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
                            struct device *dev, u32 dev_id, char *of_prop);
+struct ti_sci_resource *
+devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
+                        u32 dev_id, u32 sub_type);
 
 #else  /* CONFIG_TI_SCI_PROTOCOL */
 
@@ -609,6 +615,13 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
 {
        return ERR_PTR(-EINVAL);
 }
+
+static inline struct ti_sci_resource *
+devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
+                        u32 dev_id, u32 sub_type);
+{
+       return ERR_PTR(-EINVAL);
+}
 #endif /* CONFIG_TI_SCI_PROTOCOL */
 
 #endif /* __TISCI_PROTOCOL_H */
index 3d5c3271a9a8cccc88fd9572cdd1bfba0f3fc21e..a59db2f08e76b7ea6804fdccaa03c3e817b9a9ea 100644 (file)
@@ -25,7 +25,7 @@ static inline void stackleak_task_init(struct task_struct *t)
 
 #ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
 int stack_erasing_sysctl(struct ctl_table *table, int write,
-                       void __user *buffer, size_t *lenp, loff_t *ppos);
+                       void *buffer, size_t *lenp, loff_t *ppos);
 #endif
 
 #else /* !CONFIG_GCC_PLUGIN_STACKLEAK */
index 2e6ca53b9bbd5e9257902809edac87172d103176..18e75974d4e37bd76f6b31d88951a9cededaec63 100644 (file)
@@ -30,6 +30,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
                PGFAULT, PGMAJFAULT,
                PGLAZYFREED,
                PGREFILL,
+               PGREUSE,
                PGSTEAL_KSWAPD,
                PGSTEAL_DIRECT,
                PGSCAN_KSWAPD,
index 91220ace31da964aa165a691d5c916399632133b..7557c1070fd7ffb00b11e21b7fc4995f130e8389 100644 (file)
@@ -312,6 +312,11 @@ static inline void __mod_zone_page_state(struct zone *zone,
 static inline void __mod_node_page_state(struct pglist_data *pgdat,
                        enum node_stat_item item, int delta)
 {
+       if (vmstat_item_in_bytes(item)) {
+               VM_WARN_ON_ONCE(delta & (PAGE_SIZE - 1));
+               delta >>= PAGE_SHIFT;
+       }
+
        node_page_state_add(delta, pgdat, item);
 }
 
index 898c890fc153ff7c1b412b33ce4e1a7085f7d8c5..27fb99cfeb026932b6e26d70334a4ed5389551e3 100644 (file)
@@ -21,6 +21,7 @@ int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int
 #define WQ_FLAG_WOKEN          0x02
 #define WQ_FLAG_BOOKMARK       0x04
 #define WQ_FLAG_CUSTOM         0x08
+#define WQ_FLAG_DONE           0x10
 
 /*
  * A single wait-queue entry structure:
index adcc6a97db6123e7a19ed43e59659f4874b9b5a0..143568d64b207ebd9acd8eb3e420cef286d9f9e9 100644 (file)
@@ -308,7 +308,7 @@ do {                                                                             \
                                                                             \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO):                          \
     R##_e = X##_e;                                                          \
-         /* Fall through */                                                 \
+       fallthrough;                                                         \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL):                           \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF):                              \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO):                                     \
@@ -319,7 +319,7 @@ do {                                                                             \
                                                                             \
   case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL):                          \
     R##_e = Y##_e;                                                          \
-         /* Fall through */                                                 \
+       fallthrough;                                                         \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN):                           \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN):                              \
   case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN):                                     \
@@ -417,7 +417,7 @@ do {                                                        \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF):         \
   case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO):                \
     R##_s = X##_s;                                     \
-       /* Fall through */                              \
+         fallthrough;                                  \
                                                        \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF):         \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL):      \
@@ -431,7 +431,7 @@ do {                                                        \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN):         \
   case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN):                \
     R##_s = Y##_s;                                     \
-       /* Fall through */                              \
+         fallthrough;                                  \
                                                        \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF):      \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO):     \
@@ -497,7 +497,7 @@ do {                                                        \
                                                        \
   case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO):     \
     FP_SET_EXCEPTION(FP_EX_DIVZERO);                   \
-         /* Fall through */                            \
+       fallthrough;                                    \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO):                \
   case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL):      \
     R##_c = FP_CLS_INF;                                        \
index 52ef92049073e3ba060856075c8c399fa3f7fa7d..bbb3f26fbde9788799b996a8227c82cb34703089 100644 (file)
@@ -744,8 +744,6 @@ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb);
  * vb2_core_reqbufs() - Initiate streaming.
  * @q:         pointer to &struct vb2_queue with videobuf2 queue.
  * @memory:    memory type, as defined by &enum vb2_memory.
- * @flags:     auxiliary queue/buffer management flags. Currently, the only
- *             used flag is %V4L2_FLAG_MEMORY_NON_CONSISTENT.
  * @count:     requested buffer count.
  *
  * Videobuf2 core helper to implement VIDIOC_REQBUF() operation. It is called
@@ -770,13 +768,12 @@ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb);
  * Return: returns zero on success; an error code otherwise.
  */
 int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
-                   unsigned int flags, unsigned int *count);
+                   unsigned int *count);
 
 /**
  * vb2_core_create_bufs() - Allocate buffers and any required auxiliary structs
  * @q: pointer to &struct vb2_queue with videobuf2 queue.
  * @memory: memory type, as defined by &enum vb2_memory.
- * @flags: auxiliary queue/buffer management flags.
  * @count: requested buffer count.
  * @requested_planes: number of planes requested.
  * @requested_sizes: array with the size of the planes.
@@ -794,7 +791,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
  * Return: returns zero on success; an error code otherwise.
  */
 int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
-                        unsigned int flags, unsigned int *count,
+                        unsigned int *count,
                         unsigned int requested_planes,
                         const unsigned int requested_sizes[]);
 
index 91eacbdcf33d2b7d38971673e274a63835c0d271..f6abcc0bbd6e7686c24d081c72693bc15b359bad 100644 (file)
@@ -59,7 +59,7 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
 void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
 void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
                           struct sockaddr_rxrpc *);
-u32 rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *);
+bool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *);
 int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
                               rxrpc_user_attach_call_t, unsigned long, gfp_t,
                               unsigned int);
index 929d3ca614d06d5205ad0ee0db3123cd21e30901..b2531df3f65f1958a3fc603a598ee05253b491aa 100644 (file)
@@ -116,6 +116,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
        fl4->saddr = saddr;
        fl4->fl4_dport = dport;
        fl4->fl4_sport = sport;
+       fl4->flowi4_multipath_hash = 0;
 }
 
 /* Reset some input parameters after previous lookup */
index 9205a76d967a03e4162bad03f2f4e53d6e976506..38e4094960cee8112d19bb3e60e8d8ed7f6fa4b4 100644 (file)
@@ -494,7 +494,7 @@ int igmp6_event_report(struct sk_buff *skb);
 
 #ifdef CONFIG_SYSCTL
 int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
-                              void __user *buffer, size_t *lenp, loff_t *ppos);
+                              void *buffer, size_t *lenp, loff_t *ppos);
 int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl,
                                 void __user *oldval, size_t __user *oldlenp,
                                 void __user *newval, size_t newlen);
index bf9491b77d1689092ba02213f9a524fa10cb5ef5..224d194ad29d06a57fc04f42817421a22d5721d8 100644 (file)
@@ -143,6 +143,8 @@ static inline u64 nft_reg_load64(const u32 *sreg)
 static inline void nft_data_copy(u32 *dst, const struct nft_data *src,
                                 unsigned int len)
 {
+       if (len % NFT_REG32_SIZE)
+               dst[len / NFT_REG32_SIZE] = 0;
        memcpy(dst, src, len);
 }
 
index c0411f14fb53b620ac0fbdae45095a958ef5f678..8e0eb2c9c528c93299a905c28a4d08c58badb12b 100644 (file)
@@ -726,7 +726,6 @@ static inline int __nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,
  * @hdrlen: length of family specific header
  * @tb: destination array with maxtype+1 elements
  * @maxtype: maximum attribute type to be expected
- * @validate: validation strictness
  * @extack: extended ACK report struct
  *
  * See nla_parse()
@@ -824,7 +823,6 @@ static inline int nla_validate_deprecated(const struct nlattr *head, int len,
  * @len: length of attribute stream
  * @maxtype: maximum attribute type to be expected
  * @policy: validation policy
- * @validate: validation strictness
  * @extack: extended ACK report struct
  *
  * Validates all attributes in the specified attribute stream against the
index a1a8d45adb42a91857f6c0db94f914afd502f977..6c0806bd8d1e636579a92796965936b872bc8dbc 100644 (file)
@@ -8,6 +8,7 @@ struct netns_nftables {
        struct list_head        tables;
        struct list_head        commit_list;
        struct list_head        module_list;
+       struct list_head        notify_list;
        struct mutex            commit_mutex;
        unsigned int            base_seq;
        u8                      gencursor;
index b33f1aefad0989d05c1a0a9bc4b051b32a0d727b..0bdff38eb4bb7087239990fb7a084365b140860b 100644 (file)
@@ -226,12 +226,14 @@ struct sctp_sock {
                data_ready_signalled:1;
 
        atomic_t pd_mode;
+
+       /* Fields after this point will be skipped on copies, like on accept
+        * and peeloff operations
+        */
+
        /* Receive to here while partial delivery is in effect. */
        struct sk_buff_head pd_lobby;
 
-       /* These must be the last fields, as they will skipped on copies,
-        * like on accept and peeloff operations
-        */
        struct list_head auto_asconf_list;
        int do_auto_asconf;
 };
index 3a41627cbdfe58e6a8bc134c5625278b59eb417c..08537aa14f7c3a2cbd7a9238d93e67561345e36a 100644 (file)
@@ -121,6 +121,9 @@ struct vxlanhdr_gbp {
 #define VXLAN_GBP_POLICY_APPLIED       (BIT(3) << 16)
 #define VXLAN_GBP_ID_MASK              (0xFFFF)
 
+#define VXLAN_GBP_MASK (VXLAN_GBP_DONT_LEARN | VXLAN_GBP_POLICY_APPLIED | \
+                       VXLAN_GBP_ID_MASK)
+
 /*
  * VXLAN Generic Protocol Extension (VXLAN_F_GPE):
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
index da369b12005f892e95376b2ab76fc79d64d02efe..0ac4e7fba086f623535632a82216c3980e78d083 100644 (file)
@@ -566,6 +566,7 @@ struct ocelot_port {
        u8                              ptp_cmd;
        struct sk_buff_head             tx_skbs;
        u8                              ts_id;
+       spinlock_t                      ts_id_lock;
 
        phy_interface_t                 phy_mode;
 
@@ -677,6 +678,7 @@ void ocelot_configure_cpu(struct ocelot *ocelot, int npi,
 int ocelot_init(struct ocelot *ocelot);
 void ocelot_deinit(struct ocelot *ocelot);
 void ocelot_init_port(struct ocelot *ocelot, int port);
+void ocelot_deinit_port(struct ocelot *ocelot, int port);
 
 /* DSA callbacks */
 void ocelot_port_enable(struct ocelot *ocelot, int port,
index 9b1d43d671a3f6b157db24ba3c80b14893f318d0..8c18dc6d3fde5e44f2aba8f87c67096d5dd092d2 100644 (file)
 #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST     0x5B60
 #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_LIMM     0x00010422
 
+#ifndef AUX_IENABLE
+#define AUX_IENABLE                            0x40c
+#endif
+
+#define CTOP_AUX_IACK                          (0xFFFFF800 + 0x088)
+
 #ifndef __ASSEMBLY__
 
 /* In order to increase compilation test coverage */
index 5e3919ffb00c505c1ecd83262b9f310bae59b3a2..fc4fcac72cf7941be6663cf8c970fd93e870b58c 100644 (file)
@@ -1193,6 +1193,8 @@ struct snd_soc_pcm_runtime {
             ((i) < (rtd)->num_cpus + (rtd)->num_codecs) &&             \
                     ((dai) = (rtd)->dais[i]);                          \
             (i)++)
+#define for_each_rtd_dais_rollback(rtd, i, dai)                \
+       for (; (--(i) >= 0) && ((dai) = (rtd)->dais[i]);)
 
 void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd);
 
@@ -1361,6 +1363,8 @@ void snd_soc_unregister_dai(struct snd_soc_dai *dai);
 
 struct snd_soc_dai *snd_soc_find_dai(
        const struct snd_soc_dai_link_component *dlc);
+struct snd_soc_dai *snd_soc_find_dai_with_mutex(
+       const struct snd_soc_dai_link_component *dlc);
 
 #include <sound/soc-dai.h>
 
index 939092dbcb8bf37d9e17529a5081c0692f0f4672..5fb7520343863648160da1564621e83422985d97 100644 (file)
@@ -114,6 +114,8 @@ IF_HAVE_PG_IDLE(PG_idle,            "idle"          )
 
 #if defined(CONFIG_X86)
 #define __VM_ARCH_SPECIFIC_1 {VM_PAT,     "pat"           }
+#elif defined(CONFIG_PPC)
+#define __VM_ARCH_SPECIFIC_1 {VM_SAO,     "sao"           }
 #elif defined(CONFIG_PARISC) || defined(CONFIG_IA64)
 #define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP,      "growsup"       }
 #elif !defined(CONFIG_MMU)
index 059b6e45a02833881bf9f61c13ca523b16266447..c33079b986e86b463b0b13f7b74e7d28c64a1fa0 100644 (file)
@@ -138,11 +138,16 @@ enum rxrpc_recvmsg_trace {
 };
 
 enum rxrpc_rtt_tx_trace {
+       rxrpc_rtt_tx_cancel,
        rxrpc_rtt_tx_data,
+       rxrpc_rtt_tx_no_slot,
        rxrpc_rtt_tx_ping,
 };
 
 enum rxrpc_rtt_rx_trace {
+       rxrpc_rtt_rx_cancel,
+       rxrpc_rtt_rx_lost,
+       rxrpc_rtt_rx_obsolete,
        rxrpc_rtt_rx_ping_response,
        rxrpc_rtt_rx_requested_ack,
 };
@@ -339,10 +344,15 @@ enum rxrpc_tx_point {
        E_(rxrpc_recvmsg_wait,                  "WAIT")
 
 #define rxrpc_rtt_tx_traces \
+       EM(rxrpc_rtt_tx_cancel,                 "CNCE") \
        EM(rxrpc_rtt_tx_data,                   "DATA") \
+       EM(rxrpc_rtt_tx_no_slot,                "FULL") \
        E_(rxrpc_rtt_tx_ping,                   "PING")
 
 #define rxrpc_rtt_rx_traces \
+       EM(rxrpc_rtt_rx_cancel,                 "CNCL") \
+       EM(rxrpc_rtt_rx_obsolete,               "OBSL") \
+       EM(rxrpc_rtt_rx_lost,                   "LOST") \
        EM(rxrpc_rtt_rx_ping_response,          "PONG") \
        E_(rxrpc_rtt_rx_requested_ack,          "RACK")
 
@@ -1087,38 +1097,43 @@ TRACE_EVENT(rxrpc_recvmsg,
 
 TRACE_EVENT(rxrpc_rtt_tx,
            TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why,
-                    rxrpc_serial_t send_serial),
+                    int slot, rxrpc_serial_t send_serial),
 
-           TP_ARGS(call, why, send_serial),
+           TP_ARGS(call, why, slot, send_serial),
 
            TP_STRUCT__entry(
                    __field(unsigned int,               call            )
                    __field(enum rxrpc_rtt_tx_trace,    why             )
+                   __field(int,                        slot            )
                    __field(rxrpc_serial_t,             send_serial     )
                             ),
 
            TP_fast_assign(
                    __entry->call = call->debug_id;
                    __entry->why = why;
+                   __entry->slot = slot;
                    __entry->send_serial = send_serial;
                           ),
 
-           TP_printk("c=%08x %s sr=%08x",
+           TP_printk("c=%08x [%d] %s sr=%08x",
                      __entry->call,
+                     __entry->slot,
                      __print_symbolic(__entry->why, rxrpc_rtt_tx_traces),
                      __entry->send_serial)
            );
 
 TRACE_EVENT(rxrpc_rtt_rx,
            TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
+                    int slot,
                     rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
                     u32 rtt, u32 rto),
 
-           TP_ARGS(call, why, send_serial, resp_serial, rtt, rto),
+           TP_ARGS(call, why, slot, send_serial, resp_serial, rtt, rto),
 
            TP_STRUCT__entry(
                    __field(unsigned int,               call            )
                    __field(enum rxrpc_rtt_rx_trace,    why             )
+                   __field(int,                        slot            )
                    __field(rxrpc_serial_t,             send_serial     )
                    __field(rxrpc_serial_t,             resp_serial     )
                    __field(u32,                        rtt             )
@@ -1128,14 +1143,16 @@ TRACE_EVENT(rxrpc_rtt_rx,
            TP_fast_assign(
                    __entry->call = call->debug_id;
                    __entry->why = why;
+                   __entry->slot = slot;
                    __entry->send_serial = send_serial;
                    __entry->resp_serial = resp_serial;
                    __entry->rtt = rtt;
                    __entry->rto = rto;
                           ),
 
-           TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%u rto=%u",
+           TP_printk("c=%08x [%d] %s sr=%08x rr=%08x rtt=%u rto=%u",
                      __entry->call,
+                     __entry->slot,
                      __print_symbolic(__entry->why, rxrpc_rtt_rx_traces),
                      __entry->send_serial,
                      __entry->resp_serial,
index 10f5d1fa73476a9cb4fb5e21b24d25f3c599500b..e7cbccc7c14cc28c1bb77557583df75974e60dd7 100644 (file)
@@ -20,7 +20,6 @@
                {I_CLEAR,               "I_CLEAR"},             \
                {I_SYNC,                "I_SYNC"},              \
                {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
-               {I_DIRTY_TIME_EXPIRED,  "I_DIRTY_TIME_EXPIRED"}, \
                {I_REFERENCED,          "I_REFERENCED"}         \
        )
 
@@ -498,8 +497,9 @@ DEFINE_WBC_EVENT(wbc_writepage);
 TRACE_EVENT(writeback_queue_io,
        TP_PROTO(struct bdi_writeback *wb,
                 struct wb_writeback_work *work,
+                unsigned long dirtied_before,
                 int moved),
-       TP_ARGS(wb, work, moved),
+       TP_ARGS(wb, work, dirtied_before, moved),
        TP_STRUCT__entry(
                __array(char,           name, 32)
                __field(unsigned long,  older)
@@ -509,19 +509,17 @@ TRACE_EVENT(writeback_queue_io,
                __field(ino_t,          cgroup_ino)
        ),
        TP_fast_assign(
-               unsigned long *older_than_this = work->older_than_this;
                strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32);
-               __entry->older  = older_than_this ?  *older_than_this : 0;
-               __entry->age    = older_than_this ?
-                                 (jiffies - *older_than_this) * 1000 / HZ : -1;
+               __entry->older  = dirtied_before;
+               __entry->age    = (jiffies - dirtied_before) * 1000 / HZ;
                __entry->moved  = moved;
                __entry->reason = work->reason;
                __entry->cgroup_ino     = __trace_wb_assign_cgroup(wb);
        ),
        TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%lu",
                __entry->name,
-               __entry->older, /* older_than_this in jiffies */
-               __entry->age,   /* older_than_this in relative milliseconds */
+               __entry->older, /* dirtied_before in jiffies */
+               __entry->age,   /* dirtied_before in relative milliseconds */
                __entry->moved,
                __print_symbolic(__entry->reason, WB_WORK_REASON),
                (unsigned long)__entry->cgroup_ino
index 5dcd24cb33ea2d6ea69829e6c7ca22d320b1fc77..72ba36be96550bf537fee86b6eecd19a46dc8460 100644 (file)
@@ -79,6 +79,7 @@ enum {
        ETHTOOL_MSG_TSINFO_GET_REPLY,
        ETHTOOL_MSG_CABLE_TEST_NTF,
        ETHTOOL_MSG_CABLE_TEST_TDR_NTF,
+       ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
 
        /* add new constants above here */
        __ETHTOOL_MSG_KERNEL_CNT,
index 3d0d8231dc196891ecee80f63326d9d7db8b0125..7d6687618d80802ce10da1aa4e326b55bd9af014 100644 (file)
@@ -135,7 +135,7 @@ struct in_addr {
  * this socket to prevent accepting spoofed ones.
  */
 #define IP_PMTUDISC_INTERFACE          4
-/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get
+/* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get
  * fragmented if they exeed the interface mtu
  */
 #define IP_PMTUDISC_OMIT               5
index f6d86033c4fa3d21cc7c643c85d443b053c704c9..7d8eced6f459b065c445ba8dcbc107f785dc24fa 100644 (file)
@@ -790,9 +790,10 @@ struct kvm_ppc_resize_hpt {
 #define KVM_VM_PPC_HV 1
 #define KVM_VM_PPC_PR 2
 
-/* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */
-#define KVM_VM_MIPS_TE         0
+/* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */
+#define KVM_VM_MIPS_AUTO       0
 #define KVM_VM_MIPS_VZ         1
+#define KVM_VM_MIPS_TE         2
 
 #define KVM_S390_SIE_PAGE_OFFSET 1
 
@@ -1035,6 +1036,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_LAST_CPU 184
 #define KVM_CAP_SMALLER_MAXPHYADDR 185
 #define KVM_CAP_S390_DIAG318 186
+#define KVM_CAP_STEAL_TIME 187
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
index 42f351c1f5c5333c43a4abde25cb8c43ba277a5f..2b8e12f7a4a6523a8a27a4212e3a09b5286e156f 100644 (file)
@@ -133,7 +133,7 @@ enum nf_tables_msg_types {
  * @NFTA_LIST_ELEM: list element (NLA_NESTED)
  */
 enum nft_list_attributes {
-       NFTA_LIST_UNPEC,
+       NFTA_LIST_UNSPEC,
        NFTA_LIST_ELEM,
        __NFTA_LIST_MAX
 };
index c7b70ff53bc1dd0f3acdd1428138a7a0ca10c0a3..235db7754606d69d132b960e77671af57fe47610 100644 (file)
@@ -191,8 +191,6 @@ enum v4l2_memory {
        V4L2_MEMORY_DMABUF           = 4,
 };
 
-#define V4L2_FLAG_MEMORY_NON_CONSISTENT                (1 << 0)
-
 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
 enum v4l2_colorspace {
        /*
@@ -949,10 +947,7 @@ struct v4l2_requestbuffers {
        __u32                   type;           /* enum v4l2_buf_type */
        __u32                   memory;         /* enum v4l2_memory */
        __u32                   capabilities;
-       union {
-               __u32           flags;
-               __u32           reserved[1];
-       };
+       __u32                   reserved[1];
 };
 
 /* capabilities for struct v4l2_requestbuffers and v4l2_create_buffers */
@@ -2456,9 +2451,6 @@ struct v4l2_dbg_chip_info {
  * @memory:    enum v4l2_memory; buffer memory type
  * @format:    frame format, for which buffers are requested
  * @capabilities: capabilities of this buffer type.
- * @flags:     additional buffer management attributes (ignored unless the
- *             queue has V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS capability
- *             and configured for MMAP streaming I/O).
  * @reserved:  future extensions
  */
 struct v4l2_create_buffers {
@@ -2467,8 +2459,7 @@ struct v4l2_create_buffers {
        __u32                   memory;
        struct v4l2_format      format;
        __u32                   capabilities;
-       __u32                   flags;
-       __u32                   reserved[6];
+       __u32                   reserved[7];
 };
 
 /*
index d7f6af50e200bf34f9d1211376eb92a946f620fb..39df751d0dc43b12fa3299af12ec705f2b560965 100644 (file)
@@ -76,7 +76,11 @@ static inline unsigned long bfn_to_pfn(unsigned long bfn)
 #define bfn_to_local_pfn(bfn)  bfn_to_pfn(bfn)
 
 /* VIRT <-> GUEST conversion */
-#define virt_to_gfn(v)         (pfn_to_gfn(virt_to_phys(v) >> XEN_PAGE_SHIFT))
+#define virt_to_gfn(v)                                                         \
+       ({                                                                     \
+               WARN_ON_ONCE(!virt_addr_valid(v));                              \
+               pfn_to_gfn(virt_to_phys(v) >> XEN_PAGE_SHIFT);                 \
+       })
 #define gfn_to_virt(m)         (__va(gfn_to_pfn(m) << XEN_PAGE_SHIFT))
 
 /* Only used in PV code. But ARM guests are always HVM. */
index 6fb95aa194051fcea50416860971f9ed0d260ab1..6dbdb0b3fd03da472d017c413f5481fb977f88bc 100644 (file)
@@ -2,6 +2,8 @@
 /******************************************************************************
  * Xen balloon functionality
  */
+#ifndef _XEN_BALLOON_H
+#define _XEN_BALLOON_H
 
 #define RETRY_UNLIMITED        0
 
@@ -34,3 +36,5 @@ static inline void xen_balloon_init(void)
 {
 }
 #endif
+
+#endif /* _XEN_BALLOON_H */
index 19a72f591e2bdc86bd0edc99a685def4157b2728..43efba045acc7e2a942e049d4b52b4c97244dc8e 100644 (file)
@@ -52,4 +52,13 @@ bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
 extern u64 xen_saved_max_mem_size;
 #endif
 
+#ifdef CONFIG_XEN_UNPOPULATED_ALLOC
+int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages);
+void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages);
+#else
+#define xen_alloc_unpopulated_pages alloc_xenballooned_pages
+#define xen_free_unpopulated_pages free_xenballooned_pages
+#include <xen/balloon.h>
+#endif
+
 #endif /* _XEN_XEN_H */
index e6dbfb767057df7531fc6528899ec854d6bc77a2..1f97c0328a7ae7b7eaedb2ab0daa4d4e2c29354f 100644 (file)
@@ -297,7 +297,7 @@ static void __init clean_path(char *path, umode_t fmode)
 {
        struct kstat st;
 
-       if (init_stat(path, &st, AT_SYMLINK_NOFOLLOW) &&
+       if (!init_stat(path, &st, AT_SYMLINK_NOFOLLOW) &&
            (st.mode ^ fmode) & S_IFMT) {
                if (S_ISDIR(st.mode))
                        init_rmdir(path);
index ae78fb68d2310543b8d5435ba1bb31d9e4c3c6d2..e880b4ecb31474f4578bf0c7c7d2f74c161eb6ce 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/nmi.h>
 #include <linux/percpu.h>
 #include <linux/kmod.h>
+#include <linux/kprobes.h>
 #include <linux/vmalloc.h>
 #include <linux/kernel_stat.h>
 #include <linux/start_kernel.h>
@@ -303,7 +304,7 @@ static void * __init get_boot_config_from_initrd(u32 *_size, u32 *_csum)
 
 #ifdef CONFIG_BOOT_CONFIG
 
-char xbc_namebuf[XBC_KEYLEN_MAX] __initdata;
+static char xbc_namebuf[XBC_KEYLEN_MAX] __initdata;
 
 #define rest(dst, end) ((end) > (dst) ? (end) - (dst) : 0)
 
@@ -1402,6 +1403,7 @@ static int __ref kernel_init(void *unused)
        kernel_init_freeable();
        /* need to finish all async __init code before freeing the memory */
        async_synchronize_full();
+       kprobe_free_init_mem();
        ftrace_free_init_mem();
        free_initmem();
        mark_readonly();
index d1b8644bfb884c82dbd9f37a715ef25afe503aba..3f312bf2b11638f18cf8117d3ead4ae4a4533690 100644 (file)
@@ -85,7 +85,7 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int write,
 }
 
 static int proc_ipc_sem_dointvec(struct ctl_table *table, int write,
-       void __user *buffer, size_t *lenp, loff_t *ppos)
+       void *buffer, size_t *lenp, loff_t *ppos)
 {
        int ret, semmni;
        struct ipc_namespace *ns = current->nsproxy->ipc_ns;
index 8c0244e0365eb65aa9270d7b5e3a510a70683337..f6c30a85dadf9c0a8a20addb2e1129dfea0ac531 100644 (file)
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1691,7 +1691,7 @@ static long ksys_semctl(int semid, int semnum, int cmd, unsigned long arg, int v
        case IPC_SET:
                if (copy_semid_from_user(&semid64, p, version))
                        return -EFAULT;
-               /* fall through */
+               fallthrough;
        case IPC_RMID:
                return semctl_down(ns, semid, cmd, &semid64);
        default:
@@ -1805,7 +1805,7 @@ static long compat_ksys_semctl(int semid, int semnum, int cmd, int arg, int vers
        case IPC_SET:
                if (copy_compat_semid_from_user(&semid64, p, version))
                        return -EFAULT;
-               /* fallthru */
+               fallthrough;
        case IPC_RMID:
                return semctl_down(ns, semid, cmd, &semid64);
        default:
index f1ed36e3ac9fe3695cd23e0df5a483dfec3fdae9..e25c7c6106bcf79ee9dc18ecc133d3531ef2aecb 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1179,7 +1179,7 @@ static long ksys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf, int ver
        case IPC_SET:
                if (copy_shmid_from_user(&sem64, buf, version))
                        return -EFAULT;
-               /* fallthru */
+               fallthrough;
        case IPC_RMID:
                return shmctl_down(ns, shmid, cmd, &sem64);
        case SHM_LOCK:
@@ -1374,7 +1374,7 @@ static long compat_ksys_shmctl(int shmid, int cmd, void __user *uptr, int versio
        case IPC_SET:
                if (copy_compat_shmid_from_user(&sem64, uptr, version))
                        return -EFAULT;
-               /* fallthru */
+               fallthrough;
        case IPC_RMID:
                return shmctl_down(ns, shmid, cmd, &sem64);
        case SHM_LOCK:
index a10e2997aa6c8afa6672737dc763377f97043edb..333b3bcfc5458fd4b5e45190c90edce17784c46e 100644 (file)
@@ -681,7 +681,7 @@ static struct audit_rule_data *audit_krule_to_data(struct audit_krule *krule)
                                data->values[i] = AUDIT_UID_UNSET;
                                break;
                        }
-                       /* fall through - if set */
+                       fallthrough;    /* if set */
                default:
                        data->values[i] = f->val;
                }
index 83ff127ef7ae43f95b23db4e812b60ce114d0981..e21de4f1754c2c5fcd4eefa7c1703a935ea0420e 100644 (file)
@@ -1794,7 +1794,7 @@ static bool cg_sockopt_is_valid_access(int off, int size,
                        return prog->expected_attach_type ==
                                BPF_CGROUP_GETSOCKOPT;
                case offsetof(struct bpf_sockopt, optname):
-                       /* fallthrough */
+                       fallthrough;
                case offsetof(struct bpf_sockopt, level):
                        if (size != size_default)
                                return false;
index f1c46529929bd397b7f23230e69eddae54eb79b9..6386b7bb98f2c6c7744296d469641323ce6f8130 100644 (file)
@@ -279,7 +279,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu,
                        break;
                default:
                        bpf_warn_invalid_xdp_action(act);
-                       /* fallthrough */
+                       fallthrough;
                case XDP_DROP:
                        xdp_return_frame(xdpf);
                        stats->drop++;
index 78dfff6a501b96c013b0e861ecc662be358d018e..7df28a45c66bf3cbb749be1a5769a46fc457456a 100644 (file)
@@ -1622,7 +1622,6 @@ struct bpf_iter_seq_hash_map_info {
        struct bpf_map *map;
        struct bpf_htab *htab;
        void *percpu_value_buf; // non-zero means percpu hash
-       unsigned long flags;
        u32 bucket_id;
        u32 skip_elems;
 };
@@ -1632,7 +1631,6 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info,
                           struct htab_elem *prev_elem)
 {
        const struct bpf_htab *htab = info->htab;
-       unsigned long flags = info->flags;
        u32 skip_elems = info->skip_elems;
        u32 bucket_id = info->bucket_id;
        struct hlist_nulls_head *head;
@@ -1656,19 +1654,18 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info,
 
                /* not found, unlock and go to the next bucket */
                b = &htab->buckets[bucket_id++];
-               htab_unlock_bucket(htab, b, flags);
+               rcu_read_unlock();
                skip_elems = 0;
        }
 
        for (i = bucket_id; i < htab->n_buckets; i++) {
                b = &htab->buckets[i];
-               flags = htab_lock_bucket(htab, b);
+               rcu_read_lock();
 
                count = 0;
                head = &b->head;
                hlist_nulls_for_each_entry_rcu(elem, n, head, hash_node) {
                        if (count >= skip_elems) {
-                               info->flags = flags;
                                info->bucket_id = i;
                                info->skip_elems = count;
                                return elem;
@@ -1676,7 +1673,7 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info,
                        count++;
                }
 
-               htab_unlock_bucket(htab, b, flags);
+               rcu_read_unlock();
                skip_elems = 0;
        }
 
@@ -1754,14 +1751,10 @@ static int bpf_hash_map_seq_show(struct seq_file *seq, void *v)
 
 static void bpf_hash_map_seq_stop(struct seq_file *seq, void *v)
 {
-       struct bpf_iter_seq_hash_map_info *info = seq->private;
-
        if (!v)
                (void)__bpf_hash_map_seq_show(seq, NULL);
        else
-               htab_unlock_bucket(info->htab,
-                                  &info->htab->buckets[info->bucket_id],
-                                  info->flags);
+               rcu_read_unlock();
 }
 
 static int bpf_iter_init_hash_map(void *priv_data,
index fb878ba3f22f030efbbc9e1f3949443f6ad53337..18f4969552ac2faa4ccf60071d48fb87189492ca 100644 (file)
@@ -226,10 +226,12 @@ static void *map_seq_next(struct seq_file *m, void *v, loff_t *pos)
        else
                prev_key = key;
 
+       rcu_read_lock();
        if (map->ops->map_get_next_key(map, prev_key, key)) {
                map_iter(m)->done = true;
-               return NULL;
+               key = NULL;
        }
+       rcu_read_unlock();
        return key;
 }
 
index 86299a292214a863726fe1efcbc575cd599c90ae..b999e7ff2583b59b52cb864fd804c5f50b2065dd 100644 (file)
@@ -2029,7 +2029,7 @@ bpf_prog_load_check_attach(enum bpf_prog_type prog_type,
        case BPF_PROG_TYPE_EXT:
                if (expected_attach_type)
                        return -EINVAL;
-               /* fallthrough */
+               fallthrough;
        default:
                return 0;
        }
@@ -2634,7 +2634,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link,
        u32 ulen = info->raw_tracepoint.tp_name_len;
        size_t tp_len = strlen(tp_name);
 
-       if (ulen && !ubuf)
+       if (!ulen ^ !ubuf)
                return -EINVAL;
 
        info->raw_tracepoint.tp_name_len = tp_len + 1;
index ef938f17b94433ea820071fc9bea058eae6f9e48..47e74f09fa376f5995c7b5b9fc01d82dc8b33f5e 100644 (file)
@@ -5236,7 +5236,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
                                off_reg == dst_reg ? dst : src);
                        return -EACCES;
                }
-               /* fall-through */
+               fallthrough;
        default:
                break;
        }
@@ -10988,7 +10988,7 @@ static int check_attach_btf_id(struct bpf_verifier_env *env)
        default:
                if (!prog_extension)
                        return -EINVAL;
-               /* fallthrough */
+               fallthrough;
        case BPF_MODIFY_RETURN:
        case BPF_LSM_MAC:
        case BPF_TRACE_FENTRY:
index 1444f3954d750ba685b9423e94522e0243175f90..7c59b096c98aee0a1867ee7c450c9efc99d4e345 100644 (file)
@@ -93,7 +93,7 @@ static int cap_validate_magic(cap_user_header_t header, unsigned *tocopy)
                break;
        case _LINUX_CAPABILITY_VERSION_2:
                warn_deprecated_v2();
-               /* fall through - v3 is otherwise equivalent to v2. */
+               fallthrough;    /* v3 is otherwise equivalent to v2 */
        case _LINUX_CAPABILITY_VERSION_3:
                *tocopy = _LINUX_CAPABILITY_U32S_3;
                break;
index b8d2800bb4b719eb8ad5407823415fe1e0daa8d9..05adfd6fa8bf9dd1137e19520ea8f3b28c5434d2 100644 (file)
@@ -255,11 +255,11 @@ get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat)
                return -EFAULT;
        switch (_NSIG_WORDS) {
        case 4: set->sig[3] = v.sig[6] | (((long)v.sig[7]) << 32 );
-               /* fall through */
+               fallthrough;
        case 3: set->sig[2] = v.sig[4] | (((long)v.sig[5]) << 32 );
-               /* fall through */
+               fallthrough;
        case 2: set->sig[1] = v.sig[2] | (((long)v.sig[3]) << 32 );
-               /* fall through */
+               fallthrough;
        case 1: set->sig[0] = v.sig[0] | (((long)v.sig[1]) << 32 );
        }
 #else
index a790026e42d01006d8c9107e0a6cb303ba818023..cc3c43dfec44937b3b92c70e4eaac20b30227474 100644 (file)
@@ -1046,14 +1046,14 @@ int gdb_serial_stub(struct kgdb_state *ks)
                                return DBG_PASS_EVENT;
                        }
 #endif
-                       /* Fall through */
+                       fallthrough;
                case 'C': /* Exception passing */
                        tmp = gdb_cmd_exception_pass(ks);
                        if (tmp > 0)
                                goto default_handle;
                        if (tmp == 0)
                                break;
-                       /* Fall through - on tmp < 0 */
+                       fallthrough;    /* on tmp < 0 */
                case 'c': /* Continue packet */
                case 's': /* Single step packet */
                        if (kgdb_contthread && kgdb_contthread != current) {
@@ -1062,7 +1062,7 @@ int gdb_serial_stub(struct kgdb_state *ks)
                                break;
                        }
                        dbg_activate_sw_breakpoints();
-                       /* Fall through - to default processing */
+                       fallthrough;    /* to default processing */
                default:
 default_handle:
                        error = kgdb_arch_handle_exception(ks->ex_vector,
index 750497b0003a6decd80a97051aec97347079fd93..f877a0a0d7cf2f36692433d258f663c2c25595ee 100644 (file)
@@ -173,11 +173,11 @@ int kdb_get_kbd_char(void)
        case KT_LATIN:
                if (isprint(keychar))
                        break;          /* printable characters */
-               /* fall through */
+               fallthrough;
        case KT_SPEC:
                if (keychar == K_ENTER)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return -1;      /* ignore unprintables */
        }
index 004c5b6c87f89a9a15abbf935c4a2f96ebb3c275..6226502ce04991d8ba1642ca19c97f37ad5df35f 100644 (file)
@@ -432,7 +432,7 @@ int kdb_getphysword(unsigned long *word, unsigned long addr, size_t size)
                                *word = w8;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                diag = KDB_BADWIDTH;
                kdb_printf("kdb_getphysword: bad width %ld\n", (long) size);
@@ -481,7 +481,7 @@ int kdb_getword(unsigned long *word, unsigned long addr, size_t size)
                                *word = w8;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                diag = KDB_BADWIDTH;
                kdb_printf("kdb_getword: bad width %ld\n", (long) size);
@@ -525,7 +525,7 @@ int kdb_putword(unsigned long addr, unsigned long word, size_t size)
                        diag = kdb_putarea(addr, w8);
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                diag = KDB_BADWIDTH;
                kdb_printf("kdb_putword: bad width %ld\n", (long) size);
index 06582b488e3174be9aeefe7ab68cc33f407a240a..1281c0f0442bc51018b76b2b2e86a79be65829dd 100644 (file)
@@ -84,7 +84,7 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
                              gfp_t gfp)
 {
        unsigned int order;
-       struct page *page;
+       struct page *page = NULL;
        void *addr;
        int ret = -ENOMEM;
 
index fcae019158cad4c63df4305aed1c6308b427b722..6fdb6105e6d6127763ea49df0e2a967bf2a52ce8 100644 (file)
@@ -60,31 +60,56 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall,
                        return ret;
        }
 
+       /* Either of the above might have changed the syscall number */
+       syscall = syscall_get_nr(current, regs);
+
        if (unlikely(ti_work & _TIF_SYSCALL_TRACEPOINT))
                trace_sys_enter(regs, syscall);
 
        syscall_enter_audit(regs, syscall);
 
-       /* The above might have changed the syscall number */
-       return ret ? : syscall_get_nr(current, regs);
+       return ret ? : syscall;
 }
 
-noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
+static __always_inline long
+__syscall_enter_from_user_work(struct pt_regs *regs, long syscall)
 {
        unsigned long ti_work;
 
-       enter_from_user_mode(regs);
-       instrumentation_begin();
-
-       local_irq_enable();
        ti_work = READ_ONCE(current_thread_info()->flags);
        if (ti_work & SYSCALL_ENTER_WORK)
                syscall = syscall_trace_enter(regs, syscall, ti_work);
-       instrumentation_end();
 
        return syscall;
 }
 
+long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall)
+{
+       return __syscall_enter_from_user_work(regs, syscall);
+}
+
+noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
+{
+       long ret;
+
+       enter_from_user_mode(regs);
+
+       instrumentation_begin();
+       local_irq_enable();
+       ret = __syscall_enter_from_user_work(regs, syscall);
+       instrumentation_end();
+
+       return ret;
+}
+
+noinstr void syscall_enter_from_user_mode_prepare(struct pt_regs *regs)
+{
+       enter_from_user_mode(regs);
+       instrumentation_begin();
+       local_irq_enable();
+       instrumentation_end();
+}
+
 /**
  * exit_to_user_mode - Fixup state when exiting to user mode
  *
index 5bfe8e3c6e443d8102abdbb67f39bcd6d2b4902e..7ed5248f0445eadeaac5711a25523978b47aae7e 100644 (file)
@@ -10034,7 +10034,7 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
                case IF_SRC_KERNELADDR:
                case IF_SRC_KERNEL:
                        kernel = 1;
-                       /* fall through */
+                       fallthrough;
 
                case IF_SRC_FILEADDR:
                case IF_SRC_FILE:
index 4d32190861bdc6500730bf296b2f79f7a51ceacf..da8d360fb0326e18a059313c8b21fe93220b5eb5 100644 (file)
@@ -589,7 +589,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
 
                mm->map_count++;
                if (!(tmp->vm_flags & VM_WIPEONFORK))
-                       retval = copy_page_range(mm, oldmm, mpnt);
+                       retval = copy_page_range(mm, oldmm, mpnt, tmp);
 
                if (tmp->vm_ops && tmp->vm_ops->open)
                        tmp->vm_ops->open(tmp);
@@ -1011,6 +1011,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
        mm_pgtables_bytes_init(mm);
        mm->map_count = 0;
        mm->locked_vm = 0;
+       atomic_set(&mm->has_pinned, 0);
        atomic64_set(&mm->pinned_vm, 0);
        memset(&mm->rss_stat, 0, sizeof(mm->rss_stat));
        spin_lock_init(&mm->page_table_lock);
@@ -3014,7 +3015,7 @@ int unshare_files(struct files_struct **displaced)
 }
 
 int sysctl_max_threads(struct ctl_table *table, int write,
-                      void __user *buffer, size_t *lenp, loff_t *ppos)
+                      void *buffer, size_t *lenp, loff_t *ppos)
 {
        struct ctl_table t;
        int ret;
index 908fdf5098c32e088e1adff65d2c4f3f2472ecad..53c67c87f141bb483e1baa7a20546dac9c997263 100644 (file)
@@ -19,7 +19,9 @@
 #include <linux/vmalloc.h>
 #include "gcov.h"
 
-#if (__GNUC__ >= 7)
+#if (__GNUC__ >= 10)
+#define GCOV_COUNTERS                  8
+#elif (__GNUC__ >= 7)
 #define GCOV_COUNTERS                  9
 #elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
 #define GCOV_COUNTERS                  10
index a8e14c80b405bdcf37cd37fb9b74250660513b1c..762a928e18f925074ce9e57672f79c91761d5819 100644 (file)
@@ -173,7 +173,7 @@ irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags
 
                        __irq_wake_thread(desc, action);
 
-                       /* Fall through - to add to randomness */
+                       fallthrough;    /* to add to randomness */
                case IRQ_HANDLED:
                        *flags |= action->flags;
                        break;
index 52ac5391dcc6c5067b222500ebc3f39b1bdd2139..5df903fccb6094b93690cb909afc578743d972e7 100644 (file)
@@ -271,7 +271,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
        case IRQ_SET_MASK_OK:
        case IRQ_SET_MASK_OK_DONE:
                cpumask_copy(desc->irq_common_data.affinity, mask);
-               /* fall through */
+               fallthrough;
        case IRQ_SET_MASK_OK_NOCOPY:
                irq_validate_effective_affinity(data);
                irq_set_thread_affinity(desc);
@@ -868,7 +868,7 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned long flags)
        case IRQ_SET_MASK_OK_DONE:
                irqd_clear(&desc->irq_data, IRQD_TRIGGER_MASK);
                irqd_set(&desc->irq_data, flags);
-               /* fall through */
+               fallthrough;
 
        case IRQ_SET_MASK_OK_NOCOPY:
                flags = irqd_get_trigger_type(&desc->irq_data);
index 30cc217b863184989987f2fa76c76c8bc9a082b4..651a4ad6d711f82d8192d07a6b7616ef9337651f 100644 (file)
@@ -380,6 +380,13 @@ int irq_matrix_alloc(struct irq_matrix *m, const struct cpumask *msk,
        unsigned int cpu, bit;
        struct cpumap *cm;
 
+       /*
+        * Not required in theory, but matrix_find_best_cpu() uses
+        * for_each_cpu() which ignores the cpumask on UP .
+        */
+       if (cpumask_empty(msk))
+               return -EINVAL;
+
        cpu = matrix_find_best_cpu(m, msk);
        if (cpu == UINT_MAX)
                return -ENOSPC;
index 95cb74f7329255da1bede48b22559d2e39ac76a0..4fb15fa96734b464b9f0ee53282bafabc8b90cea 100644 (file)
@@ -684,12 +684,12 @@ bool kallsyms_show_value(const struct cred *cred)
        case 0:
                if (kallsyms_for_perf())
                        return true;
-       /* fallthrough */
+               fallthrough;
        case 1:
                if (security_capable(cred, &init_user_ns, CAP_SYSLOG,
                                     CAP_OPT_NOAUDIT) == 0)
                        return true;
-       /* fallthrough */
+               fallthrough;
        default:
                return false;
        }
index 287b263c9cb95781148bb16d7dbc61e417347709..e995541d277d4e896548883bdccfe26cab94ca27 100644 (file)
@@ -2140,6 +2140,9 @@ static void kill_kprobe(struct kprobe *p)
 
        lockdep_assert_held(&kprobe_mutex);
 
+       if (WARN_ON_ONCE(kprobe_gone(p)))
+               return;
+
        p->flags |= KPROBE_FLAG_GONE;
        if (kprobe_aggrprobe(p)) {
                /*
@@ -2159,9 +2162,10 @@ static void kill_kprobe(struct kprobe *p)
 
        /*
         * The module is going away. We should disarm the kprobe which
-        * is using ftrace.
+        * is using ftrace, because ftrace framework is still available at
+        * MODULE_STATE_GOING notification.
         */
-       if (kprobe_ftrace(p))
+       if (kprobe_ftrace(p) && !kprobe_disabled(p) && !kprobes_all_disarmed)
                disarm_kprobe_ftrace(p);
 }
 
@@ -2419,7 +2423,10 @@ static int kprobes_module_callback(struct notifier_block *nb,
        mutex_lock(&kprobe_mutex);
        for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
                head = &kprobe_table[i];
-               hlist_for_each_entry(p, head, hlist)
+               hlist_for_each_entry(p, head, hlist) {
+                       if (kprobe_gone(p))
+                               continue;
+
                        if (within_module_init((unsigned long)p->addr, mod) ||
                            (checkcore &&
                             within_module_core((unsigned long)p->addr, mod))) {
@@ -2436,6 +2443,7 @@ static int kprobes_module_callback(struct notifier_block *nb,
                                 */
                                kill_kprobe(p);
                        }
+               }
        }
        if (val == MODULE_STATE_GOING)
                remove_module_kprobe_blacklist(mod);
@@ -2452,6 +2460,28 @@ static struct notifier_block kprobe_module_nb = {
 extern unsigned long __start_kprobe_blacklist[];
 extern unsigned long __stop_kprobe_blacklist[];
 
+void kprobe_free_init_mem(void)
+{
+       void *start = (void *)(&__init_begin);
+       void *end = (void *)(&__init_end);
+       struct hlist_head *head;
+       struct kprobe *p;
+       int i;
+
+       mutex_lock(&kprobe_mutex);
+
+       /* Kill all kprobes on initmem */
+       for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
+               head = &kprobe_table[i];
+               hlist_for_each_entry(p, head, hlist) {
+                       if (start <= (void *)p->addr && (void *)p->addr < end)
+                               kill_kprobe(p);
+               }
+       }
+
+       mutex_unlock(&kprobe_mutex);
+}
+
 static int __init init_kprobes(void)
 {
        int i, err = 0;
index 2fad21d345b0e4b635ae4bd4f55b216a5951d288..2facbbd146ec234c27f3a87f08c515a59eec7159 100644 (file)
@@ -3756,7 +3756,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
 
 skip_checks:
        /* we'll do an OFF -> ON transition: */
-       this_cpu_write(hardirqs_enabled, 1);
+       __this_cpu_write(hardirqs_enabled, 1);
        trace->hardirq_enable_ip = ip;
        trace->hardirq_enable_event = ++trace->irq_events;
        debug_atomic_inc(hardirqs_on_events);
@@ -3795,7 +3795,7 @@ void noinstr lockdep_hardirqs_off(unsigned long ip)
                /*
                 * We have done an ON -> OFF transition:
                 */
-               this_cpu_write(hardirqs_enabled, 0);
+               __this_cpu_write(hardirqs_enabled, 0);
                trace->hardirq_disable_ip = ip;
                trace->hardirq_disable_event = ++trace->irq_events;
                debug_atomic_inc(hardirqs_off_events);
@@ -3969,13 +3969,18 @@ static int separate_irq_context(struct task_struct *curr,
 static int mark_lock(struct task_struct *curr, struct held_lock *this,
                             enum lock_usage_bit new_bit)
 {
-       unsigned int new_mask = 1 << new_bit, ret = 1;
+       unsigned int old_mask, new_mask, ret = 1;
 
        if (new_bit >= LOCK_USAGE_STATES) {
                DEBUG_LOCKS_WARN_ON(1);
                return 0;
        }
 
+       if (new_bit == LOCK_USED && this->read)
+               new_bit = LOCK_USED_READ;
+
+       new_mask = 1 << new_bit;
+
        /*
         * If already set then do not dirty the cacheline,
         * nor do any checks:
@@ -3988,13 +3993,22 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
        /*
         * Make sure we didn't race:
         */
-       if (unlikely(hlock_class(this)->usage_mask & new_mask)) {
-               graph_unlock();
-               return 1;
-       }
+       if (unlikely(hlock_class(this)->usage_mask & new_mask))
+               goto unlock;
 
+       old_mask = hlock_class(this)->usage_mask;
        hlock_class(this)->usage_mask |= new_mask;
 
+       /*
+        * Save one usage_traces[] entry and map both LOCK_USED and
+        * LOCK_USED_READ onto the same entry.
+        */
+       if (new_bit == LOCK_USED || new_bit == LOCK_USED_READ) {
+               if (old_mask & (LOCKF_USED | LOCKF_USED_READ))
+                       goto unlock;
+               new_bit = LOCK_USED;
+       }
+
        if (!(hlock_class(this)->usage_traces[new_bit] = save_trace()))
                return 0;
 
@@ -4008,6 +4022,7 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
                        return 0;
        }
 
+unlock:
        graph_unlock();
 
        /*
@@ -4942,12 +4957,20 @@ static void verify_lock_unused(struct lockdep_map *lock, struct held_lock *hlock
 {
 #ifdef CONFIG_PROVE_LOCKING
        struct lock_class *class = look_up_lock_class(lock, subclass);
+       unsigned long mask = LOCKF_USED;
 
        /* if it doesn't have a class (yet), it certainly hasn't been used yet */
        if (!class)
                return;
 
-       if (!(class->usage_mask & LOCK_USED))
+       /*
+        * READ locks only conflict with USED, such that if we only ever use
+        * READ locks, there is no deadlock possible -- RCU.
+        */
+       if (!hlock->read)
+               mask |= LOCKF_USED_READ;
+
+       if (!(class->usage_mask & mask))
                return;
 
        hlock->class_idx = class - lock_classes;
@@ -4977,6 +5000,8 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
 {
        unsigned long flags;
 
+       trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);
+
        if (unlikely(current->lockdep_recursion)) {
                /* XXX allow trylock from NMI ?!? */
                if (lockdep_nmi() && !trylock) {
@@ -5001,7 +5026,6 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
        check_flags(flags);
 
        current->lockdep_recursion++;
-       trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);
        __lock_acquire(lock, subclass, trylock, read, check,
                       irqs_disabled_flags(flags), nest_lock, ip, 0, 0);
        lockdep_recursion_finish();
@@ -5013,13 +5037,15 @@ void lock_release(struct lockdep_map *lock, unsigned long ip)
 {
        unsigned long flags;
 
+       trace_lock_release(lock, ip);
+
        if (unlikely(current->lockdep_recursion))
                return;
 
        raw_local_irq_save(flags);
        check_flags(flags);
+
        current->lockdep_recursion++;
-       trace_lock_release(lock, ip);
        if (__lock_release(lock, ip))
                check_chain_key(current);
        lockdep_recursion_finish();
@@ -5205,8 +5231,6 @@ __lock_acquired(struct lockdep_map *lock, unsigned long ip)
                hlock->holdtime_stamp = now;
        }
 
-       trace_lock_acquired(lock, ip);
-
        stats = get_lock_stats(hlock_class(hlock));
        if (waittime) {
                if (hlock->read)
@@ -5225,6 +5249,8 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip)
 {
        unsigned long flags;
 
+       trace_lock_acquired(lock, ip);
+
        if (unlikely(!lock_stat || !debug_locks))
                return;
 
@@ -5234,7 +5260,6 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip)
        raw_local_irq_save(flags);
        check_flags(flags);
        current->lockdep_recursion++;
-       trace_lock_contended(lock, ip);
        __lock_contended(lock, ip);
        lockdep_recursion_finish();
        raw_local_irq_restore(flags);
@@ -5245,6 +5270,8 @@ void lock_acquired(struct lockdep_map *lock, unsigned long ip)
 {
        unsigned long flags;
 
+       trace_lock_contended(lock, ip);
+
        if (unlikely(!lock_stat || !debug_locks))
                return;
 
index baca699b94e91d0026e86700b6f8678a6629d111..b0be1560ed17a44311ddde40ffb8b43c2ba6894b 100644 (file)
@@ -19,6 +19,7 @@ enum lock_usage_bit {
 #include "lockdep_states.h"
 #undef LOCKDEP_STATE
        LOCK_USED,
+       LOCK_USED_READ,
        LOCK_USAGE_STATES
 };
 
@@ -40,6 +41,7 @@ enum {
 #include "lockdep_states.h"
 #undef LOCKDEP_STATE
        __LOCKF(USED)
+       __LOCKF(USED_READ)
 };
 
 #define LOCKDEP_STATE(__STATE) LOCKF_ENABLED_##__STATE |
index 8bbafe3e5203d03fcf807c8dc9c52fa53a94bea5..70a32a576f3f249c7fd4ffd8f27f8d4e0cd5e3c7 100644 (file)
@@ -45,7 +45,7 @@ EXPORT_SYMBOL_GPL(percpu_free_rwsem);
 
 static bool __percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
 {
-       __this_cpu_inc(*sem->read_count);
+       this_cpu_inc(*sem->read_count);
 
        /*
         * Due to having preemption disabled the decrement happens on
@@ -71,7 +71,7 @@ static bool __percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
        if (likely(!atomic_read_acquire(&sem->block)))
                return true;
 
-       __this_cpu_dec(*sem->read_count);
+       this_cpu_dec(*sem->read_count);
 
        /* Prod writer to re-evaluate readers_active_check() */
        rcuwait_wake_up(&sem->writer);
index 16cb894dc272b13a5501ace7d512b7ccd6c44ed6..d4d3ba6e1728a2a00b5f30d53fbbfe0a8d07829e 100644 (file)
@@ -215,12 +215,13 @@ int padata_do_parallel(struct padata_shell *ps,
        padata->pd = pd;
        padata->cb_cpu = *cb_cpu;
 
-       rcu_read_unlock_bh();
-
        spin_lock(&padata_works_lock);
        padata->seq_nr = ++pd->seq_nr;
        pw = padata_work_alloc();
        spin_unlock(&padata_works_lock);
+
+       rcu_read_unlock_bh();
+
        if (pw) {
                padata_work_init(pw, padata_parallel_worker, padata, 0);
                queue_work(pinst->parallel_wq, &pw->pw_work);
index f33769f97aca59c960d188e24a0a577eaf9c5499..e7aa57fb2fdc33a587befb1c5a2d668224961bdc 100644 (file)
@@ -659,7 +659,7 @@ static void power_down(void)
                break;
        case HIBERNATION_PLATFORM:
                hibernation_platform_enter();
-               /* Fall through */
+               fallthrough;
        case HIBERNATION_SHUTDOWN:
                if (pm_power_off)
                        kernel_power_off();
index db0bed2cae26f1d350a620637a21313466b064cf..ec7e1e85923e43f60ea3c5007cdd8035c9cc0596 100644 (file)
@@ -119,7 +119,7 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
                 * and add, then see if the aggregate has changed.
                 */
                plist_del(node, &c->list);
-               /* fall through */
+               fallthrough;
        case PM_QOS_ADD_REQ:
                plist_node_init(node, new_value);
                plist_add(node, &c->list);
@@ -188,7 +188,7 @@ bool pm_qos_update_flags(struct pm_qos_flags *pqf,
                break;
        case PM_QOS_UPDATE_REQ:
                pm_qos_flags_remove_req(pqf, req);
-               /* fall through */
+               fallthrough;
        case PM_QOS_ADD_REQ:
                req->flags = val;
                INIT_LIST_HEAD(&req->node);
index 835e2df8590ae8fdfef3103785a4ea634e5cacbd..05d3e1375e4cab412fdee26e2276394554a2cd19 100644 (file)
@@ -590,7 +590,7 @@ void exit_tasks_rcu_finish(void) __releases(&tasks_rcu_exit_srcu)
 }
 
 #else /* #ifdef CONFIG_TASKS_RCU */
-static void show_rcu_tasks_classic_gp_kthread(void) { }
+static inline void show_rcu_tasks_classic_gp_kthread(void) { }
 void exit_tasks_rcu_start(void) { }
 void exit_tasks_rcu_finish(void) { exit_tasks_rcu_finish_trace(current); }
 #endif /* #else #ifdef CONFIG_TASKS_RCU */
index 8ce77d9ac716c5bc35ef8f42f21986f6d0a155ee..f78ee759af9cb5a25c3516c1630cf357a88372ed 100644 (file)
@@ -673,6 +673,7 @@ void rcu_idle_enter(void)
        lockdep_assert_irqs_disabled();
        rcu_eqs_enter(false);
 }
+EXPORT_SYMBOL_GPL(rcu_idle_enter);
 
 #ifdef CONFIG_NO_HZ_FULL
 /**
@@ -886,6 +887,7 @@ void rcu_idle_exit(void)
        rcu_eqs_exit(false);
        local_irq_restore(flags);
 }
+EXPORT_SYMBOL_GPL(rcu_idle_exit);
 
 #ifdef CONFIG_NO_HZ_FULL
 /**
index 8471a0f7eb322844d6157e320cedc06f31ec77e5..2d95dc3f46444ece3e21feee786be746c131b512 100644 (file)
@@ -2320,7 +2320,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
                                state = possible;
                                break;
                        }
-                       /* Fall-through */
+                       fallthrough;
                case possible:
                        do_set_cpus_allowed(p, cpu_possible_mask);
                        state = fail;
index 6bf34986f45ce9bda76caca5e3d5744963f3056f..f324dc36fc43de36949d7a0bce547bd3add7c12b 100644 (file)
@@ -54,17 +54,18 @@ __setup("hlt", cpu_idle_nopoll_setup);
 
 static noinline int __cpuidle cpu_idle_poll(void)
 {
+       trace_cpu_idle(0, smp_processor_id());
+       stop_critical_timings();
        rcu_idle_enter();
-       trace_cpu_idle_rcuidle(0, smp_processor_id());
        local_irq_enable();
-       stop_critical_timings();
 
        while (!tif_need_resched() &&
-               (cpu_idle_force_poll || tick_check_broadcast_expired()))
+              (cpu_idle_force_poll || tick_check_broadcast_expired()))
                cpu_relax();
-       start_critical_timings();
-       trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
+
        rcu_idle_exit();
+       start_critical_timings();
+       trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
 
        return 1;
 }
@@ -90,9 +91,14 @@ void __cpuidle default_idle_call(void)
        if (current_clr_polling_and_test()) {
                local_irq_enable();
        } else {
+
+               trace_cpu_idle(1, smp_processor_id());
                stop_critical_timings();
+               rcu_idle_enter();
                arch_cpu_idle();
+               rcu_idle_exit();
                start_critical_timings();
+               trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
        }
 }
 
@@ -158,7 +164,6 @@ static void cpuidle_idle_call(void)
 
        if (cpuidle_not_available(drv, dev)) {
                tick_nohz_idle_stop_tick();
-               rcu_idle_enter();
 
                default_idle_call();
                goto exit_idle;
@@ -178,21 +183,17 @@ static void cpuidle_idle_call(void)
                u64 max_latency_ns;
 
                if (idle_should_enter_s2idle()) {
-                       rcu_idle_enter();
 
                        entered_state = call_cpuidle_s2idle(drv, dev);
                        if (entered_state > 0)
                                goto exit_idle;
 
-                       rcu_idle_exit();
-
                        max_latency_ns = U64_MAX;
                } else {
                        max_latency_ns = dev->forced_idle_latency_limit_ns;
                }
 
                tick_nohz_idle_stop_tick();
-               rcu_idle_enter();
 
                next_state = cpuidle_find_deepest_state(drv, dev, max_latency_ns);
                call_cpuidle(drv, dev, next_state);
@@ -209,8 +210,6 @@ static void cpuidle_idle_call(void)
                else
                        tick_nohz_idle_retain_tick();
 
-               rcu_idle_enter();
-
                entered_state = call_cpuidle(drv, dev, next_state);
                /*
                 * Give the governor an opportunity to reflect on the outcome
@@ -226,8 +225,6 @@ exit_idle:
         */
        if (WARN_ON_ONCE(irqs_disabled()))
                local_irq_enable();
-
-       rcu_idle_exit();
 }
 
 /*
index 007b0a6b015277967ffb9a179e671fb48230d147..1bd7e3af904f6d2724c260483808107d1898a568 100644 (file)
@@ -1219,13 +1219,13 @@ static void __free_domain_allocs(struct s_data *d, enum s_alloc what,
        case sa_rootdomain:
                if (!atomic_read(&d->rd->refcount))
                        free_rootdomain(&d->rd->rcu);
-               /* Fall through */
+               fallthrough;
        case sa_sd:
                free_percpu(d->sd);
-               /* Fall through */
+               fallthrough;
        case sa_sd_storage:
                __sdt_free(cpu_map);
-               /* Fall through */
+               fallthrough;
        case sa_none:
                break;
        }
index 3ee59ce0a323dcad450961a2de31845646f57c1f..676d4af621038afb0764f720df445c589961b986 100644 (file)
@@ -1109,13 +1109,18 @@ out:
 }
 
 #ifdef CONFIG_SECCOMP_FILTER
-static int seccomp_notify_release(struct inode *inode, struct file *file)
+static void seccomp_notify_free(struct seccomp_filter *filter)
+{
+       kfree(filter->notif);
+       filter->notif = NULL;
+}
+
+static void seccomp_notify_detach(struct seccomp_filter *filter)
 {
-       struct seccomp_filter *filter = file->private_data;
        struct seccomp_knotif *knotif;
 
        if (!filter)
-               return 0;
+               return;
 
        mutex_lock(&filter->notify_lock);
 
@@ -1139,9 +1144,15 @@ static int seccomp_notify_release(struct inode *inode, struct file *file)
                complete(&knotif->ready);
        }
 
-       kfree(filter->notif);
-       filter->notif = NULL;
+       seccomp_notify_free(filter);
        mutex_unlock(&filter->notify_lock);
+}
+
+static int seccomp_notify_release(struct inode *inode, struct file *file)
+{
+       struct seccomp_filter *filter = file->private_data;
+
+       seccomp_notify_detach(filter);
        __put_seccomp_filter(filter);
        return 0;
 }
@@ -1488,7 +1499,7 @@ static struct file *init_listener(struct seccomp_filter *filter)
 
 out_notif:
        if (IS_ERR(ret))
-               kfree(filter->notif);
+               seccomp_notify_free(filter);
 out:
        return ret;
 }
@@ -1581,6 +1592,7 @@ out_put_fd:
                        listener_f->private_data = NULL;
                        fput(listener_f);
                        put_unused_fd(listener);
+                       seccomp_notify_detach(prepared);
                } else {
                        fd_install(listener, listener_f);
                        ret = listener;
index 42b67d2cea370af1eb6b40ee76d7ff5cc094e93a..a38b3edc68511c3419a68b96d9867f000bb18d83 100644 (file)
@@ -851,7 +851,7 @@ static int check_kill_permission(int sig, struct kernel_siginfo *info,
                         */
                        if (!sid || sid == task_session(current))
                                break;
-                       /* fall through */
+                       fallthrough;
                default:
                        return -EPERM;
                }
index a8fc9ae1d03d95a436a33379bafb3647122f9696..ce161a8e8d97585c8b1152fec1ea088343cf15d8 100644 (file)
@@ -20,7 +20,7 @@
 static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass);
 
 int stack_erasing_sysctl(struct ctl_table *table, int write,
-                       void __user *buffer, size_t *lenp, loff_t *ppos)
+                       void *buffer, size_t *lenp, loff_t *ppos)
 {
        int ret = 0;
        int state = !static_branch_unlikely(&stack_erasing_bypass);
index ca11af9d815d9d2490e224920df54e77f0fbf92b..ab6c409b1159b1538437198d5a7745766f45e906 100644 (file)
@@ -1753,7 +1753,7 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)
 
                if (who == RUSAGE_CHILDREN)
                        break;
-               /* fall through */
+               fallthrough;
 
        case RUSAGE_SELF:
                thread_group_cputime_adjusted(p, &tgutime, &tgstime);
index 287862f91717a67eb4e13f11d7486dfad42fbe96..afad085960b811fc342202169c9c3d9451a4dce0 100644 (file)
@@ -204,8 +204,7 @@ static int max_extfrag_threshold = 1000;
 
 #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL)
 static int bpf_stats_handler(struct ctl_table *table, int write,
-                            void __user *buffer, size_t *lenp,
-                            loff_t *ppos)
+                            void *buffer, size_t *lenp, loff_t *ppos)
 {
        struct static_key *key = (struct static_key *)table->data;
        static int saved_val;
@@ -2913,6 +2912,14 @@ static struct ctl_table vm_table[] = {
                .proc_handler   = percpu_pagelist_fraction_sysctl_handler,
                .extra1         = SYSCTL_ZERO,
        },
+       {
+               .procname       = "page_lock_unfairness",
+               .data           = &sysctl_page_lock_unfairness,
+               .maxlen         = sizeof(sysctl_page_lock_unfairness),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+       },
 #ifdef CONFIG_MMU
        {
                .procname       = "max_map_count",
index c4038511d5c9e3fad13f06dd04fd7ce24f7a653a..95b6a708b0406b717c130b511d964ebcddc09a2e 100644 (file)
@@ -377,7 +377,7 @@ static bool hrtimer_fixup_activate(void *addr, enum debug_obj_state state)
        switch (state) {
        case ODEBUG_STATE_ACTIVE:
                WARN_ON(1);
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
index 07709ac30439a8e210162535fac7a4be378a0f9a..bf540f5a4115a2bff84ee7c2eb9f1af21385e1cd 100644 (file)
@@ -439,12 +439,12 @@ static struct pid *good_sigevent(sigevent_t * event)
                rtn = pid_task(pid, PIDTYPE_PID);
                if (!rtn || !same_thread_group(rtn, current))
                        return NULL;
-               /* FALLTHRU */
+               fallthrough;
        case SIGEV_SIGNAL:
        case SIGEV_THREAD:
                if (event->sigev_signo <= 0 || event->sigev_signo > SIGRTMAX)
                        return NULL;
-               /* FALLTHRU */
+               fallthrough;
        case SIGEV_NONE:
                return pid;
        default:
index e51778c312f1c51e722a3aa914be71ca94c42885..36d7464c8962543d6b29fa43f3c70d28c3c41362 100644 (file)
@@ -381,7 +381,7 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)
        switch (mode) {
        case TICK_BROADCAST_FORCE:
                tick_broadcast_forced = 1;
-               /* fall through */
+               fallthrough;
        case TICK_BROADCAST_ON:
                cpumask_set_cpu(cpu, tick_broadcast_on);
                if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_mask)) {
index a16764b0116e32e821bb80eb01956d9972158b0f..a50364df10543912c0bfc9f6f40d4c0470de5cc5 100644 (file)
@@ -666,7 +666,7 @@ static bool timer_fixup_activate(void *addr, enum debug_obj_state state)
 
        case ODEBUG_STATE_ACTIVE:
                WARN_ON(1);
-               /* fall through */
+               fallthrough;
        default:
                return false;
        }
index 7ba62d68885aec065731d22ebb267d5a26fac191..4b3a42fc3b24f12a7d70ecb17217485d9539733c 100644 (file)
@@ -745,7 +745,7 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg)
 #endif
        case BLKTRACESTART:
                start = 1;
-               /* fall through */
+               fallthrough;
        case BLKTRACESTOP:
                ret = __blk_trace_startstop(q, start);
                break;
index 275441254bb57b69591b6407067aeea6491e2a06..541453927c82ad4c8ce3cae2a36e42ea3aae8abb 100644 (file)
@@ -2782,6 +2782,7 @@ static void ftrace_remove_trampoline_from_kallsyms(struct ftrace_ops *ops)
 {
        lockdep_assert_held(&ftrace_lock);
        list_del_rcu(&ops->list);
+       synchronize_rcu();
 }
 
 /*
@@ -2862,6 +2863,8 @@ int ftrace_startup(struct ftrace_ops *ops, int command)
                __unregister_ftrace_function(ops);
                ftrace_start_up--;
                ops->flags &= ~FTRACE_OPS_FL_ENABLED;
+               if (ops->flags & FTRACE_OPS_FL_DYNAMIC)
+                       ftrace_trampoline_free(ops);
                return ret;
        }
 
@@ -6990,16 +6993,14 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip,
 {
        int bit;
 
-       if ((op->flags & FTRACE_OPS_FL_RCU) && !rcu_is_watching())
-               return;
-
        bit = trace_test_and_set_recursion(TRACE_LIST_START, TRACE_LIST_MAX);
        if (bit < 0)
                return;
 
        preempt_disable_notrace();
 
-       op->func(ip, parent_ip, op, regs);
+       if (!(op->flags & FTRACE_OPS_FL_RCU) || rcu_is_watching())
+               op->func(ip, parent_ip, op, regs);
 
        preempt_enable_notrace();
        trace_clear_recursion(bit);
@@ -7531,8 +7532,7 @@ static bool is_permanent_ops_registered(void)
 
 int
 ftrace_enable_sysctl(struct ctl_table *table, int write,
-                    void __user *buffer, size_t *lenp,
-                    loff_t *ppos)
+                    void *buffer, size_t *lenp, loff_t *ppos)
 {
        int ret = -ENODEV;
 
index f40d850ebabcc7bb60c47c57898d176fec09dd1e..d3e5de717df2fd82062ab7bba5fe2fc7260912ed 100644 (file)
@@ -3546,13 +3546,15 @@ struct trace_entry *trace_find_next_entry(struct trace_iterator *iter,
        if (iter->ent && iter->ent != iter->temp) {
                if ((!iter->temp || iter->temp_size < iter->ent_size) &&
                    !WARN_ON_ONCE(iter->temp == static_temp_buf)) {
-                       kfree(iter->temp);
-                       iter->temp = kmalloc(iter->ent_size, GFP_KERNEL);
-                       if (!iter->temp)
+                       void *temp;
+                       temp = kmalloc(iter->ent_size, GFP_KERNEL);
+                       if (!temp)
                                return NULL;
+                       kfree(iter->temp);
+                       iter->temp = temp;
+                       iter->temp_size = iter->ent_size;
                }
                memcpy(iter->temp, iter->ent, iter->ent_size);
-               iter->temp_size = iter->ent_size;
                iter->ent = iter->temp;
        }
        entry = __find_next_entry(iter, ent_cpu, NULL, ent_ts);
@@ -3782,14 +3784,14 @@ unsigned long trace_total_entries(struct trace_array *tr)
 
 static void print_lat_help_header(struct seq_file *m)
 {
-       seq_puts(m, "#                  _------=> CPU#            \n"
-                   "#                 / _-----=> irqs-off        \n"
-                   "#                | / _----=> need-resched    \n"
-                   "#                || / _---=> hardirq/softirq \n"
-                   "#                ||| / _--=> preempt-depth   \n"
-                   "#                |||| /     delay            \n"
-                   "#  cmd     pid   ||||| time  |   caller      \n"
-                   "#     \\   /      |||||  \\    |   /         \n");
+       seq_puts(m, "#                    _------=> CPU#            \n"
+                   "#                   / _-----=> irqs-off        \n"
+                   "#                  | / _----=> need-resched    \n"
+                   "#                  || / _---=> hardirq/softirq \n"
+                   "#                  ||| / _--=> preempt-depth   \n"
+                   "#                  |||| /     delay            \n"
+                   "#  cmd     pid     ||||| time  |   caller      \n"
+                   "#     \\   /        |||||  \\    |   /         \n");
 }
 
 static void print_event_info(struct array_buffer *buf, struct seq_file *m)
@@ -3810,26 +3812,26 @@ static void print_func_help_header(struct array_buffer *buf, struct seq_file *m,
 
        print_event_info(buf, m);
 
-       seq_printf(m, "#           TASK-PID   %s  CPU#   TIMESTAMP  FUNCTION\n", tgid ? "TGID     " : "");
-       seq_printf(m, "#              | |     %s    |       |         |\n",      tgid ? "  |      " : "");
+       seq_printf(m, "#           TASK-PID    %s CPU#     TIMESTAMP  FUNCTION\n", tgid ? "   TGID   " : "");
+       seq_printf(m, "#              | |      %s   |         |         |\n",      tgid ? "     |    " : "");
 }
 
 static void print_func_help_header_irq(struct array_buffer *buf, struct seq_file *m,
                                       unsigned int flags)
 {
        bool tgid = flags & TRACE_ITER_RECORD_TGID;
-       const char *space = "          ";
-       int prec = tgid ? 10 : 2;
+       const char *space = "            ";
+       int prec = tgid ? 12 : 2;
 
        print_event_info(buf, m);
 
-       seq_printf(m, "#                          %.*s  _-----=> irqs-off\n", prec, space);
-       seq_printf(m, "#                          %.*s / _----=> need-resched\n", prec, space);
-       seq_printf(m, "#                          %.*s| / _---=> hardirq/softirq\n", prec, space);
-       seq_printf(m, "#                          %.*s|| / _--=> preempt-depth\n", prec, space);
-       seq_printf(m, "#                          %.*s||| /     delay\n", prec, space);
-       seq_printf(m, "#           TASK-PID %.*sCPU#  ||||    TIMESTAMP  FUNCTION\n", prec, "   TGID   ");
-       seq_printf(m, "#              | |   %.*s  |   ||||       |         |\n", prec, "     |    ");
+       seq_printf(m, "#                            %.*s  _-----=> irqs-off\n", prec, space);
+       seq_printf(m, "#                            %.*s / _----=> need-resched\n", prec, space);
+       seq_printf(m, "#                            %.*s| / _---=> hardirq/softirq\n", prec, space);
+       seq_printf(m, "#                            %.*s|| / _--=> preempt-depth\n", prec, space);
+       seq_printf(m, "#                            %.*s||| /     delay\n", prec, space);
+       seq_printf(m, "#           TASK-PID  %.*s CPU#  ||||   TIMESTAMP  FUNCTION\n", prec, "     TGID   ");
+       seq_printf(m, "#              | |    %.*s   |   ||||      |         |\n", prec, "       |    ");
 }
 
 void
index bf44f6bbd0c36c896f7110840043f9bd2befc1fd..78a678eeb140935354283529066bc75c4fd4863e 100644 (file)
@@ -499,7 +499,7 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
                                        ptr++;
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
                        default:
                                parse_error(pe, FILT_ERR_TOO_MANY_PREDS,
                                            next - str);
@@ -1273,7 +1273,7 @@ static int parse_pred(const char *str, void *data,
                switch (op) {
                case OP_NE:
                        pred->not = 1;
-                       /* Fall through */
+                       fallthrough;
                case OP_GLOB:
                case OP_EQ:
                        break;
index 0b933546142e8b371bf42550d3c0026dfdd5128b..1b2ef64902296bd4def5f482a6539946100f460c 100644 (file)
@@ -3865,7 +3865,6 @@ static int parse_var_defs(struct hist_trigger_data *hist_data)
 
                        s = kstrdup(field_str, GFP_KERNEL);
                        if (!s) {
-                               kfree(hist_data->attrs->var_defs.name[n_vars]);
                                ret = -ENOMEM;
                                goto free;
                        }
index 4d1893564912da00d3ec3814820d5cf807349a57..000e9dc224c61376643cf9c400fb01f7ce39631d 100644 (file)
@@ -497,7 +497,7 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu)
 
        trace_find_cmdline(entry->pid, comm);
 
-       trace_seq_printf(s, "%8.8s-%-5d %3d",
+       trace_seq_printf(s, "%8.8s-%-7d %3d",
                         comm, entry->pid, cpu);
 
        return trace_print_lat_fmt(s, entry);
@@ -588,15 +588,15 @@ int trace_print_context(struct trace_iterator *iter)
 
        trace_find_cmdline(entry->pid, comm);
 
-       trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid);
+       trace_seq_printf(s, "%16s-%-7d ", comm, entry->pid);
 
        if (tr->trace_flags & TRACE_ITER_RECORD_TGID) {
                unsigned int tgid = trace_find_tgid(entry->pid);
 
                if (!tgid)
-                       trace_seq_printf(s, "(-----) ");
+                       trace_seq_printf(s, "(-------) ");
                else
-                       trace_seq_printf(s, "(%5d) ", tgid);
+                       trace_seq_printf(s, "(%7d) ", tgid);
        }
 
        trace_seq_printf(s, "[%03d] ", iter->cpu);
@@ -636,7 +636,7 @@ int trace_print_lat_context(struct trace_iterator *iter)
                trace_find_cmdline(entry->pid, comm);
 
                trace_seq_printf(
-                       s, "%16s %5d %3d %d %08x %08lx ",
+                       s, "%16s %7d %3d %d %08x %08lx ",
                        comm, entry->pid, iter->cpu, entry->flags,
                        entry->preempt_count, iter->idx);
        } else {
@@ -917,7 +917,7 @@ static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter,
        S = task_index_to_char(field->prev_state);
        trace_find_cmdline(field->next_pid, comm);
        trace_seq_printf(&iter->seq,
-                        " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n",
+                        " %7d:%3d:%c %s [%03d] %7d:%3d:%c %s\n",
                         field->prev_pid,
                         field->prev_prio,
                         S, delim,
index f10073e6260305d8e271965877d8072ddc537428..f4938040c2286e6be613ca34cd767bee5dcaaeae 100644 (file)
@@ -102,14 +102,14 @@ NOKPROBE_SYMBOL(trace_hardirqs_on_caller);
 
 __visible void trace_hardirqs_off_caller(unsigned long caller_addr)
 {
+       lockdep_hardirqs_off(CALLER_ADDR0);
+
        if (!this_cpu_read(tracing_irq_cpu)) {
                this_cpu_write(tracing_irq_cpu, 1);
                tracer_hardirqs_off(CALLER_ADDR0, caller_addr);
                if (!in_nmi())
                        trace_irq_disable_rcuidle(CALLER_ADDR0, caller_addr);
        }
-
-       lockdep_hardirqs_off(CALLER_ADDR0);
 }
 EXPORT_SYMBOL(trace_hardirqs_off_caller);
 NOKPROBE_SYMBOL(trace_hardirqs_off_caller);
index e068c3c7189a19b46a0694f85d7083bab94f553c..0c781f912f9f0bdf526861fe60afd895e7107419 100644 (file)
@@ -520,8 +520,8 @@ config DEBUG_FS_ALLOW_NONE
 endchoice
 
 source "lib/Kconfig.kgdb"
-
 source "lib/Kconfig.ubsan"
+source "lib/Kconfig.kcsan"
 
 endmenu
 
@@ -1620,8 +1620,6 @@ config PROVIDE_OHCI1394_DMA_INIT
 
 source "samples/Kconfig"
 
-source "lib/Kconfig.kcsan"
-
 config ARCH_HAS_DEVMEM_IS_ALLOWED
        bool
 
index a5f701161f6bd13ce285729256bbbafa2882cb47..649ed44f199c2e9f44d93a41c35ba5f67ec43076 100644 (file)
@@ -31,6 +31,8 @@ static size_t xbc_data_size __initdata;
 static struct xbc_node *last_parent __initdata;
 static const char *xbc_err_msg __initdata;
 static int xbc_err_pos __initdata;
+static int open_brace[XBC_DEPTH_MAX] __initdata;
+static int brace_index __initdata;
 
 static int __init xbc_parse_error(const char *msg, const char *p)
 {
@@ -431,27 +433,27 @@ static char *skip_spaces_until_newline(char *p)
        return p;
 }
 
-static int __init __xbc_open_brace(void)
+static int __init __xbc_open_brace(char *p)
 {
-       /* Mark the last key as open brace */
-       last_parent->next = XBC_NODE_MAX;
+       /* Push the last key as open brace */
+       open_brace[brace_index++] = xbc_node_index(last_parent);
+       if (brace_index >= XBC_DEPTH_MAX)
+               return xbc_parse_error("Exceed max depth of braces", p);
 
        return 0;
 }
 
 static int __init __xbc_close_brace(char *p)
 {
-       struct xbc_node *node;
-
-       if (!last_parent || last_parent->next != XBC_NODE_MAX)
+       brace_index--;
+       if (!last_parent || brace_index < 0 ||
+           (open_brace[brace_index] != xbc_node_index(last_parent)))
                return xbc_parse_error("Unexpected closing brace", p);
 
-       node = last_parent;
-       node->next = 0;
-       do {
-               node = xbc_node_get_parent(node);
-       } while (node && node->next != XBC_NODE_MAX);
-       last_parent = node;
+       if (brace_index == 0)
+               last_parent = NULL;
+       else
+               last_parent = &xbc_nodes[open_brace[brace_index - 1]];
 
        return 0;
 }
@@ -492,8 +494,8 @@ static int __init __xbc_parse_value(char **__v, char **__n)
                        break;
                }
                if (strchr(",;\n#}", c)) {
-                       v = strim(v);
                        *p++ = '\0';
+                       v = strim(v);
                        break;
                }
        }
@@ -661,7 +663,7 @@ static int __init xbc_open_brace(char **k, char *n)
                return ret;
        *k = n;
 
-       return __xbc_open_brace();
+       return __xbc_open_brace(n - 1);
 }
 
 static int __init xbc_close_brace(char **k, char *n)
@@ -681,6 +683,13 @@ static int __init xbc_verify_tree(void)
        int i, depth, len, wlen;
        struct xbc_node *n, *m;
 
+       /* Brace closing */
+       if (brace_index) {
+               n = &xbc_nodes[open_brace[brace_index]];
+               return xbc_parse_error("Brace is not closed",
+                                       xbc_node_get_data(n));
+       }
+
        /* Empty tree */
        if (xbc_node_num == 0) {
                xbc_parse_error("Empty config", xbc_data);
@@ -745,6 +754,7 @@ void __init xbc_destroy_all(void)
        xbc_node_num = 0;
        memblock_free(__pa(xbc_nodes), sizeof(struct xbc_node) * XBC_NODE_MAX);
        xbc_nodes = NULL;
+       brace_index = 0;
 }
 
 /**
@@ -817,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
                                                        q - 2);
                                break;
                        }
-                       /* Fall through */
+                       /* fall through */
                case '=':
                        ret = xbc_parse_kv(&p, q, c);
                        break;
index 1d012e597cc3f9753820b94a5dfc045a7747e908..2d4dfd44b0fa5fdf618dfb5c16a32e53f68e4eea 100644 (file)
@@ -353,8 +353,7 @@ static int check_set(const char **dest, char *src, char *name)
 
 /*
  * Parse words[] as a ddebug query specification, which is a series
- * of (keyword, value) pairs or combined keyword=value terms,
- * chosen from these possibilities:
+ * of (keyword, value) pairs chosen from these possibilities:
  *
  * func <function-name>
  * file <full-pathname>
@@ -373,34 +372,22 @@ static int ddebug_parse_query(char *words[], int nwords,
        unsigned int i;
        int rc = 0;
        char *fline;
-       char *keyword, *arg;
+
+       /* check we have an even number of words */
+       if (nwords % 2 != 0) {
+               pr_err("expecting pairs of match-spec <value>\n");
+               return -EINVAL;
+       }
 
        if (modname)
                /* support $modname.dyndbg=<multiple queries> */
                query->module = modname;
 
-       for (i = 0; i < nwords; i++) {
-               /* accept keyword=arg */
-               vpr_info("%d w:%s\n", i, words[i]);
-
-               keyword = words[i];
-               arg = strchr(keyword, '=');
-               if (arg) {
-                       *arg++ = '\0';
-               } else {
-                       i++; /* next word is arg */
-                       if (!(i < nwords)) {
-                               pr_err("missing arg to keyword: %s\n", keyword);
-                               return -EINVAL;
-                       }
-                       arg = words[i];
-               }
-               vpr_info("%d key:%s arg:%s\n", i, keyword, arg);
-
-               if (!strcmp(keyword, "func")) {
-                       rc = check_set(&query->function, arg, "func");
-               } else if (!strcmp(keyword, "file")) {
-                       if (check_set(&query->filename, arg, "file"))
+       for (i = 0; i < nwords; i += 2) {
+               if (!strcmp(words[i], "func")) {
+                       rc = check_set(&query->function, words[i+1], "func");
+               } else if (!strcmp(words[i], "file")) {
+                       if (check_set(&query->filename, words[i+1], "file"))
                                return -EINVAL;
 
                        /* tail :$info is function or line-range */
@@ -416,18 +403,18 @@ static int ddebug_parse_query(char *words[], int nwords,
                                if (parse_linerange(query, fline))
                                        return -EINVAL;
                        }
-               } else if (!strcmp(keyword, "module")) {
-                       rc = check_set(&query->module, arg, "module");
-               } else if (!strcmp(keyword, "format")) {
-                       string_unescape_inplace(arg, UNESCAPE_SPACE |
+               } else if (!strcmp(words[i], "module")) {
+                       rc = check_set(&query->module, words[i+1], "module");
+               } else if (!strcmp(words[i], "format")) {
+                       string_unescape_inplace(words[i+1], UNESCAPE_SPACE |
                                                            UNESCAPE_OCTAL |
                                                            UNESCAPE_SPECIAL);
-                       rc = check_set(&query->format, arg, "format");
-               } else if (!strcmp(keyword, "line")) {
-                       if (parse_linerange(query, arg))
+                       rc = check_set(&query->format, words[i+1], "format");
+               } else if (!strcmp(words[i], "line")) {
+                       if (parse_linerange(query, words[i+1]))
                                return -EINVAL;
                } else {
-                       pr_err("unknown keyword \"%s\"\n", keyword);
+                       pr_err("unknown keyword \"%s\"\n", words[i]);
                        return -EINVAL;
                }
                if (rc)
@@ -525,7 +512,7 @@ static int ddebug_exec_query(char *query_string, const char *modname)
    last error or number of matching callsites.  Module name is either
    in param (for boot arg) or perhaps in query string.
 */
-int ddebug_exec_queries(char *query, const char *modname)
+static int ddebug_exec_queries(char *query, const char *modname)
 {
        char *split;
        int i, errs = 0, exitcode = 0, rc, nfound = 0;
@@ -557,7 +544,30 @@ int ddebug_exec_queries(char *query, const char *modname)
                return exitcode;
        return nfound;
 }
-EXPORT_SYMBOL_GPL(ddebug_exec_queries);
+
+/**
+ * dynamic_debug_exec_queries - select and change dynamic-debug prints
+ * @query: query-string described in admin-guide/dynamic-debug-howto
+ * @modname: string containing module name, usually &module.mod_name
+ *
+ * This uses the >/proc/dynamic_debug/control reader, allowing module
+ * authors to modify their dynamic-debug callsites. The modname is
+ * canonically struct module.mod_name, but can also be null or a
+ * module-wildcard, for example: "drm*".
+ */
+int dynamic_debug_exec_queries(const char *query, const char *modname)
+{
+       int rc;
+       char *qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL);
+
+       if (!query)
+               return -ENOMEM;
+
+       rc = ddebug_exec_queries(qry, modname);
+       kfree(qry);
+       return rc;
+}
+EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
 
 #define PREFIX_SIZE 64
 
@@ -947,7 +957,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
        list_add(&dt->link, &ddebug_tables);
        mutex_unlock(&ddebug_lock);
 
-       v2pr_info("%u debug prints in module %s\n", n, dt->mod_name);
+       v2pr_info("%3u debug prints in module %s\n", n, dt->mod_name);
        return 0;
 }
 
index 0ba3ea86b5466c102d588327dad3e7e8df092f5d..52e3ed7e4a9b8d331148a7dec6a640c43b0104ba 100644 (file)
@@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
                        break;
                case '\\':
                        d = *pat++;
-                       /*FALLTHROUGH*/
+                       /* fall through */
                default:        /* Literal character */
 literal:
                        if (c == d) {
index 3afb939f2a1cc5a5a04a4c2da71f1f35315b5c0a..ea53b30cf4837969326dac3282e1fd364edbd3a9 100644 (file)
@@ -604,9 +604,6 @@ static void __kobject_del(struct kobject *kobj)
        struct kernfs_node *sd;
        const struct kobj_type *ktype;
 
-       if (!kobj)
-               return;
-
        sd = kobj->sd;
        ktype = get_ktype(kobj);
 
@@ -637,8 +634,12 @@ static void __kobject_del(struct kobject *kobj)
  */
 void kobject_del(struct kobject *kobj)
 {
-       struct kobject *parent = kobj->parent;
+       struct kobject *parent;
+
+       if (!kobj)
+               return;
 
+       parent = kobj->parent;
        __kobject_del(kobj);
        kobject_put(parent);
 }
index 77c85b5251da57a18576b3c0ba96eaf39c0dcc99..be5cfa5a3b570e31dc8cdec19097f1ea6609f689 100644 (file)
@@ -2,6 +2,7 @@
 /* identifiers for device / performance-differentiated memory regions */
 #include <linux/idr.h>
 #include <linux/types.h>
+#include <linux/memregion.h>
 
 static DEFINE_IDA(memregion_ids);
 
index 932345323af092a93fc2690b0ebbf4f7485ae4f3..dfb9981ab7989640b807e6f9809b27465b6d521c 100644 (file)
@@ -49,7 +49,7 @@ static inline void prandom_state_selftest(void)
 }
 #endif
 
-DEFINE_PER_CPU(struct rnd_state, net_rand_state);
+DEFINE_PER_CPU(struct rnd_state, net_rand_state)  __latent_entropy;
 
 /**
  *     prandom_u32_state - seeded pseudo-random number generator.
index 6012c385fb314d810bd8a2ff4f18b9e8a3a517db..4288e0158d47f0f6d0a3f8404592543328c6f947 100644 (file)
@@ -272,6 +272,30 @@ ssize_t strscpy_pad(char *dest, const char *src, size_t count)
 }
 EXPORT_SYMBOL(strscpy_pad);
 
+/**
+ * stpcpy - copy a string from src to dest returning a pointer to the new end
+ *          of dest, including src's %NUL-terminator. May overrun dest.
+ * @dest: pointer to end of string being copied into. Must be large enough
+ *        to receive copy.
+ * @src: pointer to the beginning of string being copied from. Must not overlap
+ *       dest.
+ *
+ * stpcpy differs from strcpy in a key way: the return value is a pointer
+ * to the new %NUL-terminating character in @dest. (For strcpy, the return
+ * value is a pointer to the start of @dest). This interface is considered
+ * unsafe as it doesn't perform bounds checking of the inputs. As such it's
+ * not recommended for usage. Instead, its definition is provided in case
+ * the compiler lowers other libcalls to stpcpy.
+ */
+char *stpcpy(char *__restrict__ dest, const char *__restrict__ src);
+char *stpcpy(char *__restrict__ dest, const char *__restrict__ src)
+{
+       while ((*dest++ = *src++) != '\0')
+               /* nothing */;
+       return --dest;
+}
+EXPORT_SYMBOL(stpcpy);
+
 #ifndef __HAVE_ARCH_STRCAT
 /**
  * strcat - Append one %NUL-terminated string to another
index 9fee2b93a8d18c0d2a343ec4e3d3fd173b3c62d2..06c95505775644d44af3dde867d72131128ee07e 100644 (file)
@@ -26,6 +26,8 @@
 #include <linux/vmalloc.h>
 #include <linux/efi_embedded_fw.h>
 
+MODULE_IMPORT_NS(TEST_FIRMWARE);
+
 #define TEST_FIRMWARE_NAME     "test-firmware.bin"
 #define TEST_FIRMWARE_NUM_REQS 4
 #define TEST_FIRMWARE_BUF_SIZE SZ_1K
@@ -489,6 +491,9 @@ out:
 static DEVICE_ATTR_WO(trigger_request);
 
 #ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
+extern struct list_head efi_embedded_fw_list;
+extern bool efi_embedded_fw_checked;
+
 static ssize_t trigger_request_platform_store(struct device *dev,
                                              struct device_attribute *attr,
                                              const char *buf, size_t count)
@@ -501,6 +506,7 @@ static ssize_t trigger_request_platform_store(struct device *dev,
        };
        struct efi_embedded_fw efi_embedded_fw;
        const struct firmware *firmware = NULL;
+       bool saved_efi_embedded_fw_checked;
        char *name;
        int rc;
 
@@ -513,6 +519,8 @@ static ssize_t trigger_request_platform_store(struct device *dev,
        efi_embedded_fw.data = (void *)test_data;
        efi_embedded_fw.length = sizeof(test_data);
        list_add(&efi_embedded_fw.list, &efi_embedded_fw_list);
+       saved_efi_embedded_fw_checked = efi_embedded_fw_checked;
+       efi_embedded_fw_checked = true;
 
        pr_info("loading '%s'\n", name);
        rc = firmware_request_platform(&firmware, name, dev);
@@ -530,6 +538,7 @@ static ssize_t trigger_request_platform_store(struct device *dev,
        rc = count;
 
 out:
+       efi_embedded_fw_checked = saved_efi_embedded_fw_checked;
        release_firmware(firmware);
        list_del(&efi_embedded_fw.list);
        kfree(name);
index c5a6fef7b45d74fcb2bc6b6d371db005f591f7d5..76c607ee6db5216b0796cf86db829fcf4076a4fa 100644 (file)
@@ -434,7 +434,7 @@ static int __init test_rhltable(unsigned int entries)
                } else {
                        if (WARN(err != -ENOENT, "removed non-existent element, error %d not %d",
                                 err, -ENOENT))
-                       continue;
+                               continue;
                }
        }
 
index c155769559abe27064e609ee80ff60abda8122b9..afb9521ddf91975aa6ebb2e853712f50f3f94cc3 100644 (file)
@@ -1681,7 +1681,8 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 
        switch (*(++fmt)) {
        case 'L':
-               uc = true;              /* fall-through */
+               uc = true;
+               /* fall through */
        case 'l':
                index = guid_index;
                break;
@@ -2218,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
        case 'S':
        case 's':
                ptr = dereference_symbol_descriptor(ptr);
-               /* Fallthrough */
+               /* fall through */
        case 'B':
                return symbol_string(buf, end, ptr, spec, fmt);
        case 'R':
@@ -2467,7 +2468,7 @@ qualifier:
                 * utility, treat it as any other invalid or
                 * unsupported format specifier.
                 */
-               /* Fall-through */
+               /* fall through */
 
        default:
                WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
index 9f336bc07ed610f6944e6617439dd7fd0e51c9e0..65a1aad8c223b95bf442519c9aa12bfd665dccc3 100644 (file)
@@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
 
                        s->lzma2.sequence = SEQ_LZMA_PREPARE;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_LZMA_PREPARE:
                        if (s->lzma2.compressed < RC_INIT_BYTES)
@@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
                        s->lzma2.compressed -= RC_INIT_BYTES;
                        s->lzma2.sequence = SEQ_LZMA_RUN;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_LZMA_RUN:
                        /*
index bd1d182419d7e2c8c12926ac7a69818e45f116a6..32ab2a08b7cbc9ff5a874d1ffe5cfd12d221e901 100644 (file)
@@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
                        if (ret != XZ_OK)
                                return ret;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_START:
                        /* We need one byte of input to continue. */
@@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
                        s->temp.pos = 0;
                        s->sequence = SEQ_BLOCK_HEADER;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_HEADER:
                        if (!fill_temp(s, b))
@@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_BLOCK_UNCOMPRESS;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_UNCOMPRESS:
                        ret = dec_block(s, b);
@@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_BLOCK_PADDING;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_PADDING:
                        /*
@@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_BLOCK_CHECK;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_BLOCK_CHECK:
                        if (s->check_type == XZ_CHECK_CRC32) {
@@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_INDEX_PADDING;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_INDEX_PADDING:
                        while ((s->index.size + (b->in_pos - s->in_start))
@@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
                        s->sequence = SEQ_INDEX_CRC32;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_INDEX_CRC32:
                        ret = crc32_validate(s, b);
@@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
                        s->temp.size = STREAM_HEADER_SIZE;
                        s->sequence = SEQ_STREAM_FOOTER;
 
-               /* Fall through */
+                       /* fall through */
 
                case SEQ_STREAM_FOOTER:
                        if (!fill_temp(s, b))
index 269ee9a796c1a7d2e09be1c194e0f22ec2d06648..db6761ea4deb5949a4c41249ae48145a8ebfc8fb 100644 (file)
@@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
                case set_repeat:
                        if (dctx->litEntropy == 0)
                                return ERROR(dictionary_corrupted);
-               /* fall-through */
+                       /* fall through */
                case set_compressed:
                        if (srcSize < 5)
                                return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
@@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
                switch (zds->stage) {
                case zdss_init:
                        ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
-                                               /* fall-through */
+                       /* fall through */
 
                case zdss_loadHeader: {
                        size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
@@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
                        }
                        zds->stage = zdss_read;
                }
-               /* fall through */
+                       /* fall through */
 
                case zdss_read: {
                        size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
@@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
                        zds->stage = zdss_load;
                        /* pass-through */
                }
-               /* fall through */
+                       /* fall through */
 
                case zdss_load: {
                        size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
@@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
                                /* pass-through */
                        }
                }
-               /* fall through */
+                       /* fall through */
 
                case zdss_flush: {
                        size_t const toFlushSize = zds->outEnd - zds->outStart;
index 1aaea26556cc7e4ab702af1e96262d67a0607cf0..5202e38ab79e8af3c4850c0faf16cfce69ebe3b0 100644 (file)
@@ -988,9 +988,43 @@ void __init pagecache_init(void)
        page_writeback_init();
 }
 
+/*
+ * The page wait code treats the "wait->flags" somewhat unusually, because
+ * we have multiple different kinds of waits, not just the usual "exclusive"
+ * one.
+ *
+ * We have:
+ *
+ *  (a) no special bits set:
+ *
+ *     We're just waiting for the bit to be released, and when a waker
+ *     calls the wakeup function, we set WQ_FLAG_WOKEN and wake it up,
+ *     and remove it from the wait queue.
+ *
+ *     Simple and straightforward.
+ *
+ *  (b) WQ_FLAG_EXCLUSIVE:
+ *
+ *     The waiter is waiting to get the lock, and only one waiter should
+ *     be woken up to avoid any thundering herd behavior. We'll set the
+ *     WQ_FLAG_WOKEN bit, wake it up, and remove it from the wait queue.
+ *
+ *     This is the traditional exclusive wait.
+ *
+ *  (c) WQ_FLAG_EXCLUSIVE | WQ_FLAG_CUSTOM:
+ *
+ *     The waiter is waiting to get the bit, and additionally wants the
+ *     lock to be transferred to it for fair lock behavior. If the lock
+ *     cannot be taken, we stop walking the wait queue without waking
+ *     the waiter.
+ *
+ *     This is the "fair lock handoff" case, and in addition to setting
+ *     WQ_FLAG_WOKEN, we set WQ_FLAG_DONE to let the waiter easily see
+ *     that it now has the lock.
+ */
 static int wake_page_function(wait_queue_entry_t *wait, unsigned mode, int sync, void *arg)
 {
-       int ret;
+       unsigned int flags;
        struct wait_page_key *key = arg;
        struct wait_page_queue *wait_page
                = container_of(wait, struct wait_page_queue, wait);
@@ -999,35 +1033,44 @@ static int wake_page_function(wait_queue_entry_t *wait, unsigned mode, int sync,
                return 0;
 
        /*
-        * If it's an exclusive wait, we get the bit for it, and
-        * stop walking if we can't.
-        *
-        * If it's a non-exclusive wait, then the fact that this
-        * wake function was called means that the bit already
-        * was cleared, and we don't care if somebody then
-        * re-took it.
+        * If it's a lock handoff wait, we get the bit for it, and
+        * stop walking (and do not wake it up) if we can't.
         */
-       ret = 0;
-       if (wait->flags & WQ_FLAG_EXCLUSIVE) {
-               if (test_and_set_bit(key->bit_nr, &key->page->flags))
+       flags = wait->flags;
+       if (flags & WQ_FLAG_EXCLUSIVE) {
+               if (test_bit(key->bit_nr, &key->page->flags))
                        return -1;
-               ret = 1;
+               if (flags & WQ_FLAG_CUSTOM) {
+                       if (test_and_set_bit(key->bit_nr, &key->page->flags))
+                               return -1;
+                       flags |= WQ_FLAG_DONE;
+               }
        }
-       wait->flags |= WQ_FLAG_WOKEN;
 
+       /*
+        * We are holding the wait-queue lock, but the waiter that
+        * is waiting for this will be checking the flags without
+        * any locking.
+        *
+        * So update the flags atomically, and wake up the waiter
+        * afterwards to avoid any races. This store-release pairs
+        * with the load-acquire in wait_on_page_bit_common().
+        */
+       smp_store_release(&wait->flags, flags | WQ_FLAG_WOKEN);
        wake_up_state(wait->private, mode);
 
        /*
         * Ok, we have successfully done what we're waiting for,
         * and we can unconditionally remove the wait entry.
         *
-        * Note that this has to be the absolute last thing we do,
-        * since after list_del_init(&wait->entry) the wait entry
+        * Note that this pairs with the "finish_wait()" in the
+        * waiter, and has to be the absolute last thing we do.
+        * After this list_del_init(&wait->entry) the wait entry
         * might be de-allocated and the process might even have
         * exited.
         */
        list_del_init_careful(&wait->entry);
-       return ret;
+       return (flags & WQ_FLAG_EXCLUSIVE) != 0;
 }
 
 static void wake_up_page_bit(struct page *page, int bit_nr)
@@ -1107,8 +1150,8 @@ enum behavior {
 };
 
 /*
- * Attempt to check (or get) the page bit, and mark the
- * waiter woken if successful.
+ * Attempt to check (or get) the page bit, and mark us done
+ * if successful.
  */
 static inline bool trylock_page_bit_common(struct page *page, int bit_nr,
                                        struct wait_queue_entry *wait)
@@ -1119,13 +1162,17 @@ static inline bool trylock_page_bit_common(struct page *page, int bit_nr,
        } else if (test_bit(bit_nr, &page->flags))
                return false;
 
-       wait->flags |= WQ_FLAG_WOKEN;
+       wait->flags |= WQ_FLAG_WOKEN | WQ_FLAG_DONE;
        return true;
 }
 
+/* How many times do we accept lock stealing from under a waiter? */
+int sysctl_page_lock_unfairness = 5;
+
 static inline int wait_on_page_bit_common(wait_queue_head_t *q,
        struct page *page, int bit_nr, int state, enum behavior behavior)
 {
+       int unfairness = sysctl_page_lock_unfairness;
        struct wait_page_queue wait_page;
        wait_queue_entry_t *wait = &wait_page.wait;
        bool thrashing = false;
@@ -1143,11 +1190,18 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q,
        }
 
        init_wait(wait);
-       wait->flags = behavior == EXCLUSIVE ? WQ_FLAG_EXCLUSIVE : 0;
        wait->func = wake_page_function;
        wait_page.page = page;
        wait_page.bit_nr = bit_nr;
 
+repeat:
+       wait->flags = 0;
+       if (behavior == EXCLUSIVE) {
+               wait->flags = WQ_FLAG_EXCLUSIVE;
+               if (--unfairness < 0)
+                       wait->flags |= WQ_FLAG_CUSTOM;
+       }
+
        /*
         * Do one last check whether we can get the
         * page bit synchronously.
@@ -1170,27 +1224,63 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q,
 
        /*
         * From now on, all the logic will be based on
-        * the WQ_FLAG_WOKEN flag, and the and the page
-        * bit testing (and setting) will be - or has
-        * already been - done by the wake function.
+        * the WQ_FLAG_WOKEN and WQ_FLAG_DONE flag, to
+        * see whether the page bit testing has already
+        * been done by the wake function.
         *
         * We can drop our reference to the page.
         */
        if (behavior == DROP)
                put_page(page);
 
+       /*
+        * Note that until the "finish_wait()", or until
+        * we see the WQ_FLAG_WOKEN flag, we need to
+        * be very careful with the 'wait->flags', because
+        * we may race with a waker that sets them.
+        */
        for (;;) {
+               unsigned int flags;
+
                set_current_state(state);
 
-               if (signal_pending_state(state, current))
+               /* Loop until we've been woken or interrupted */
+               flags = smp_load_acquire(&wait->flags);
+               if (!(flags & WQ_FLAG_WOKEN)) {
+                       if (signal_pending_state(state, current))
+                               break;
+
+                       io_schedule();
+                       continue;
+               }
+
+               /* If we were non-exclusive, we're done */
+               if (behavior != EXCLUSIVE)
                        break;
 
-               if (wait->flags & WQ_FLAG_WOKEN)
+               /* If the waker got the lock for us, we're done */
+               if (flags & WQ_FLAG_DONE)
                        break;
 
-               io_schedule();
+               /*
+                * Otherwise, if we're getting the lock, we need to
+                * try to get it ourselves.
+                *
+                * And if that fails, we'll have to retry this all.
+                */
+               if (unlikely(test_and_set_bit(bit_nr, &page->flags)))
+                       goto repeat;
+
+               wait->flags |= WQ_FLAG_DONE;
+               break;
        }
 
+       /*
+        * If a signal happened, this 'finish_wait()' may remove the last
+        * waiter from the wait-queues, but the PageWaiters bit will remain
+        * set. That's ok. The next wakeup will take care of it, and trying
+        * to do it here would be difficult and prone to races.
+        */
        finish_wait(q, wait);
 
        if (thrashing) {
@@ -1200,12 +1290,20 @@ static inline int wait_on_page_bit_common(wait_queue_head_t *q,
        }
 
        /*
-        * 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.
+        * NOTE! The wait->flags weren't stable until we've done the
+        * 'finish_wait()', and we could have exited the loop above due
+        * to a signal, and had a wakeup event happen after the signal
+        * test but before the 'finish_wait()'.
+        *
+        * So only after the finish_wait() can we reliably determine
+        * if we got woken up or not, so we can now figure out the final
+        * return value based on that state without races.
+        *
+        * Also note that WQ_FLAG_WOKEN is sufficient for a non-exclusive
+        * waiter, but an exclusive one requires WQ_FLAG_DONE.
         */
+       if (behavior == EXCLUSIVE)
+               return wait->flags & WQ_FLAG_DONE ? 0 : -EINTR;
 
        return wait->flags & WQ_FLAG_WOKEN ? 0 : -EINTR;
 }
index ae096ea7583fe72bfebfd2378914e04901d1d4a4..e869c634cc9a683fa739cf2fa4aa99be204df210 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -381,22 +381,13 @@ static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address,
 }
 
 /*
- * FOLL_FORCE or a forced COW break can write even to unwritable pte's,
- * but only after we've gone through a COW cycle and they are dirty.
+ * FOLL_FORCE can write to even unwritable pte's, but only
+ * after we've gone through a COW cycle and they are dirty.
  */
 static inline bool can_follow_write_pte(pte_t pte, unsigned int flags)
 {
-       return pte_write(pte) || ((flags & FOLL_COW) && pte_dirty(pte));
-}
-
-/*
- * A (separate) COW fault might break the page the other way and
- * get_user_pages() would return the page from what is now the wrong
- * VM. So we need to force a COW break at GUP time even for reads.
- */
-static inline bool should_force_cow_break(struct vm_area_struct *vma, unsigned int flags)
-{
-       return is_cow_mapping(vma->vm_flags) && (flags & (FOLL_GET | FOLL_PIN));
+       return pte_write(pte) ||
+               ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte));
 }
 
 static struct page *follow_page_pte(struct vm_area_struct *vma,
@@ -843,7 +834,7 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address,
                        goto unmap;
                *page = pte_page(*pte);
        }
-       if (unlikely(!try_get_page(*page))) {
+       if (unlikely(!try_grab_page(*page, gup_flags))) {
                ret = -ENOMEM;
                goto unmap;
        }
@@ -1067,11 +1058,9 @@ static long __get_user_pages(struct mm_struct *mm,
                                goto out;
                        }
                        if (is_vm_hugetlb_page(vma)) {
-                               if (should_force_cow_break(vma, foll_flags))
-                                       foll_flags |= FOLL_WRITE;
                                i = follow_hugetlb_page(mm, vma, pages, vmas,
                                                &start, &nr_pages, i,
-                                               foll_flags, locked);
+                                               gup_flags, locked);
                                if (locked && *locked == 0) {
                                        /*
                                         * We've got a VM_FAULT_RETRY
@@ -1085,10 +1074,6 @@ static long __get_user_pages(struct mm_struct *mm,
                                continue;
                        }
                }
-
-               if (should_force_cow_break(vma, foll_flags))
-                       foll_flags |= FOLL_WRITE;
-
 retry:
                /*
                 * If we have a pending SIGKILL, don't keep faulting pages and
@@ -1270,6 +1255,9 @@ static __always_inline long __get_user_pages_locked(struct mm_struct *mm,
                BUG_ON(*locked != 1);
        }
 
+       if (flags & FOLL_PIN)
+               atomic_set(&mm->has_pinned, 1);
+
        /*
         * FOLL_PIN and FOLL_GET are mutually exclusive. Traditional behavior
         * is to set FOLL_GET if the caller wants pages[] filled in (but has
@@ -2500,13 +2488,13 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr,
        return 1;
 }
 
-static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
+static int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr, unsigned long end,
                unsigned int flags, struct page **pages, int *nr)
 {
        unsigned long next;
        pmd_t *pmdp;
 
-       pmdp = pmd_offset(&pud, addr);
+       pmdp = pmd_offset_lockless(pudp, pud, addr);
        do {
                pmd_t pmd = READ_ONCE(*pmdp);
 
@@ -2543,13 +2531,13 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
        return 1;
 }
 
-static int gup_pud_range(p4d_t p4d, unsigned long addr, unsigned long end,
+static int gup_pud_range(p4d_t *p4dp, p4d_t p4d, unsigned long addr, unsigned long end,
                         unsigned int flags, struct page **pages, int *nr)
 {
        unsigned long next;
        pud_t *pudp;
 
-       pudp = pud_offset(&p4d, addr);
+       pudp = pud_offset_lockless(p4dp, p4d, addr);
        do {
                pud_t pud = READ_ONCE(*pudp);
 
@@ -2564,20 +2552,20 @@ static int gup_pud_range(p4d_t p4d, unsigned long addr, unsigned long end,
                        if (!gup_huge_pd(__hugepd(pud_val(pud)), addr,
                                         PUD_SHIFT, next, flags, pages, nr))
                                return 0;
-               } else if (!gup_pmd_range(pud, addr, next, flags, pages, nr))
+               } else if (!gup_pmd_range(pudp, pud, addr, next, flags, pages, nr))
                        return 0;
        } while (pudp++, addr = next, addr != end);
 
        return 1;
 }
 
-static int gup_p4d_range(pgd_t pgd, unsigned long addr, unsigned long end,
+static int gup_p4d_range(pgd_t *pgdp, pgd_t pgd, unsigned long addr, unsigned long end,
                         unsigned int flags, struct page **pages, int *nr)
 {
        unsigned long next;
        p4d_t *p4dp;
 
-       p4dp = p4d_offset(&pgd, addr);
+       p4dp = p4d_offset_lockless(pgdp, pgd, addr);
        do {
                p4d_t p4d = READ_ONCE(*p4dp);
 
@@ -2589,7 +2577,7 @@ static int gup_p4d_range(pgd_t pgd, unsigned long addr, unsigned long end,
                        if (!gup_huge_pd(__hugepd(p4d_val(p4d)), addr,
                                         P4D_SHIFT, next, flags, pages, nr))
                                return 0;
-               } else if (!gup_pud_range(p4d, addr, next, flags, pages, nr))
+               } else if (!gup_pud_range(p4dp, p4d, addr, next, flags, pages, nr))
                        return 0;
        } while (p4dp++, addr = next, addr != end);
 
@@ -2617,7 +2605,7 @@ static void gup_pgd_range(unsigned long addr, unsigned long end,
                        if (!gup_huge_pd(__hugepd(pgd_val(pgd)), addr,
                                         PGDIR_SHIFT, next, flags, pages, nr))
                                return;
-               } else if (!gup_p4d_range(pgd, addr, next, flags, pages, nr))
+               } else if (!gup_p4d_range(pgdp, pgd, addr, next, flags, pages, nr))
                        return;
        } while (pgdp++, addr = next, addr != end);
 }
@@ -2675,6 +2663,9 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages,
                                       FOLL_FAST_ONLY)))
                return -EINVAL;
 
+       if (gup_flags & FOLL_PIN)
+               atomic_set(&current->mm->has_pinned, 1);
+
        if (!(gup_flags & FOLL_FAST_ONLY))
                might_lock_read(&current->mm->mmap_lock);
 
@@ -2689,19 +2680,6 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages,
                return -EFAULT;
 
        /*
-        * The FAST_GUP case requires FOLL_WRITE even for pure reads,
-        * because get_user_pages() may need to cause an early COW in
-        * order to avoid confusing the normal COW routines. So only
-        * targets that are already writable are safe to do by just
-        * looking at the page tables.
-        *
-        * NOTE! With FOLL_FAST_ONLY we allow read-only gup_fast() here,
-        * because there is no slow path to fall back on. But you'd
-        * better be careful about possible COW pages - you'll get _a_
-        * COW page, but not necessarily the one you intended to get
-        * depending on what COW event happens after this. COW may break
-        * the page copy in a random direction.
-        *
         * Disable interrupts. The nested form is used, in order to allow
         * full, general purpose use of this routine.
         *
@@ -2714,8 +2692,6 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages,
         */
        if (IS_ENABLED(CONFIG_HAVE_FAST_GUP) && gup_fast_permitted(start, end)) {
                unsigned long fast_flags = gup_flags;
-               if (!(gup_flags & FOLL_FAST_ONLY))
-                       fast_flags |= FOLL_WRITE;
 
                local_irq_save(flags);
                gup_pgd_range(addr, end, fast_flags, pages, &nr_pinned);
index 2ccff8472cd4b63078a93ac530fc9a50bb8b0e92..da397779a6d43a2c12f0ee0a2b2da728831d8030 100644 (file)
@@ -1074,6 +1074,24 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 
        src_page = pmd_page(pmd);
        VM_BUG_ON_PAGE(!PageHead(src_page), src_page);
+
+       /*
+        * If this page is a potentially pinned page, split and retry the fault
+        * with smaller page size.  Normally this should not happen because the
+        * userspace should use MADV_DONTFORK upon pinned regions.  This is a
+        * best effort that the pinned pages won't be replaced by another
+        * random page during the coming copy-on-write.
+        */
+       if (unlikely(is_cow_mapping(vma->vm_flags) &&
+                    atomic_read(&src_mm->has_pinned) &&
+                    page_maybe_dma_pinned(src_page))) {
+               pte_free(dst_mm, pgtable);
+               spin_unlock(src_ptl);
+               spin_unlock(dst_ptl);
+               __split_huge_pmd(vma, src_pmd, addr, false, NULL);
+               return -EAGAIN;
+       }
+
        get_page(src_page);
        page_dup_rmap(src_page, true);
        add_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR);
@@ -1177,6 +1195,16 @@ int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                /* No huge zero pud yet */
        }
 
+       /* Please refer to comments in copy_huge_pmd() */
+       if (unlikely(is_cow_mapping(vma->vm_flags) &&
+                    atomic_read(&src_mm->has_pinned) &&
+                    page_maybe_dma_pinned(pud_page(pud)))) {
+               spin_unlock(src_ptl);
+               spin_unlock(dst_ptl);
+               __split_huge_pud(vma, src_pud, addr);
+               return -EAGAIN;
+       }
+
        pudp_set_wrprotect(src_mm, addr, src_pud);
        pud = pud_mkold(pud_wrprotect(pud));
        set_pud_at(dst_mm, addr, dst_pud, pud);
@@ -1291,12 +1319,13 @@ fallback:
 }
 
 /*
- * FOLL_FORCE or a forced COW break can write even to unwritable pmd's,
- * but only after we've gone through a COW cycle and they are dirty.
+ * FOLL_FORCE can write to even unwritable pmd's, but only
+ * after we've gone through a COW cycle and they are dirty.
  */
 static inline bool can_follow_write_pmd(pmd_t pmd, unsigned int flags)
 {
-       return pmd_write(pmd) || ((flags & FOLL_COW) && pmd_dirty(pmd));
+       return pmd_write(pmd) ||
+              ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pmd_dirty(pmd));
 }
 
 struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
@@ -2021,7 +2050,7 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
                put_page(page);
                add_mm_counter(mm, mm_counter_file(page), -HPAGE_PMD_NR);
                return;
-       } else if (is_huge_zero_pmd(*pmd)) {
+       } else if (pmd_trans_huge(*pmd) && is_huge_zero_pmd(*pmd)) {
                /*
                 * FIXME: Do we want to invalidate secondary mmu by calling
                 * mmu_notifier_invalidate_range() see comments below inside
@@ -2115,30 +2144,34 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
                pte = pte_offset_map(&_pmd, addr);
                BUG_ON(!pte_none(*pte));
                set_pte_at(mm, addr, pte, entry);
-               atomic_inc(&page[i]._mapcount);
-               pte_unmap(pte);
-       }
-
-       /*
-        * Set PG_double_map before dropping compound_mapcount to avoid
-        * false-negative page_mapped().
-        */
-       if (compound_mapcount(page) > 1 && !TestSetPageDoubleMap(page)) {
-               for (i = 0; i < HPAGE_PMD_NR; i++)
+               if (!pmd_migration)
                        atomic_inc(&page[i]._mapcount);
+               pte_unmap(pte);
        }
 
-       lock_page_memcg(page);
-       if (atomic_add_negative(-1, compound_mapcount_ptr(page))) {
-               /* Last compound_mapcount is gone. */
-               __dec_lruvec_page_state(page, NR_ANON_THPS);
-               if (TestClearPageDoubleMap(page)) {
-                       /* No need in mapcount reference anymore */
+       if (!pmd_migration) {
+               /*
+                * Set PG_double_map before dropping compound_mapcount to avoid
+                * false-negative page_mapped().
+                */
+               if (compound_mapcount(page) > 1 &&
+                   !TestSetPageDoubleMap(page)) {
                        for (i = 0; i < HPAGE_PMD_NR; i++)
-                               atomic_dec(&page[i]._mapcount);
+                               atomic_inc(&page[i]._mapcount);
+               }
+
+               lock_page_memcg(page);
+               if (atomic_add_negative(-1, compound_mapcount_ptr(page))) {
+                       /* Last compound_mapcount is gone. */
+                       __dec_lruvec_page_state(page, NR_ANON_THPS);
+                       if (TestClearPageDoubleMap(page)) {
+                               /* No need in mapcount reference anymore */
+                               for (i = 0; i < HPAGE_PMD_NR; i++)
+                                       atomic_dec(&page[i]._mapcount);
+                       }
                }
+               unlock_page_memcg(page);
        }
-       unlock_page_memcg(page);
 
        smp_wmb(); /* make pte visible before pmd */
        pmd_populate(mm, pmd, pgtable);
index a301c2d672bf5246f1ec4bf709374b3b78489189..67fc6383995b430c7b6c6ebb0c01dc2128dbe2b4 100644 (file)
@@ -1250,21 +1250,32 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask,
                int nid, nodemask_t *nodemask)
 {
        unsigned long nr_pages = 1UL << huge_page_order(h);
+       if (nid == NUMA_NO_NODE)
+               nid = numa_mem_id();
 
 #ifdef CONFIG_CMA
        {
                struct page *page;
                int node;
 
-               for_each_node_mask(node, *nodemask) {
-                       if (!hugetlb_cma[node])
-                               continue;
-
-                       page = cma_alloc(hugetlb_cma[node], nr_pages,
-                                        huge_page_order(h), true);
+               if (hugetlb_cma[nid]) {
+                       page = cma_alloc(hugetlb_cma[nid], nr_pages,
+                                       huge_page_order(h), true);
                        if (page)
                                return page;
                }
+
+               if (!(gfp_mask & __GFP_THISNODE)) {
+                       for_each_node_mask(node, *nodemask) {
+                               if (node == nid || !hugetlb_cma[node])
+                                       continue;
+
+                               page = cma_alloc(hugetlb_cma[node], nr_pages,
+                                               huge_page_order(h), true);
+                               if (page)
+                                       return page;
+                       }
+               }
        }
 #endif
 
@@ -3454,6 +3465,22 @@ static unsigned int allowed_mems_nr(struct hstate *h)
 }
 
 #ifdef CONFIG_SYSCTL
+static int proc_hugetlb_doulongvec_minmax(struct ctl_table *table, int write,
+                                         void *buffer, size_t *length,
+                                         loff_t *ppos, unsigned long *out)
+{
+       struct ctl_table dup_table;
+
+       /*
+        * In order to avoid races with __do_proc_doulongvec_minmax(), we
+        * can duplicate the @table and alter the duplicate of it.
+        */
+       dup_table = *table;
+       dup_table.data = out;
+
+       return proc_doulongvec_minmax(&dup_table, write, buffer, length, ppos);
+}
+
 static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
                         struct ctl_table *table, int write,
                         void *buffer, size_t *length, loff_t *ppos)
@@ -3465,9 +3492,8 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
        if (!hugepages_supported())
                return -EOPNOTSUPP;
 
-       table->data = &tmp;
-       table->maxlen = sizeof(unsigned long);
-       ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
+       ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos,
+                                            &tmp);
        if (ret)
                goto out;
 
@@ -3510,9 +3536,8 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
        if (write && hstate_is_gigantic(h))
                return -EINVAL;
 
-       table->data = &tmp;
-       table->maxlen = sizeof(unsigned long);
-       ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
+       ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos,
+                                            &tmp);
        if (ret)
                goto out;
 
index e749e568e1eabc9367c8c731149dfd9473aeadf4..cfa0dba5fd3bc3b6b252acad3720d403b8ceea71 100644 (file)
@@ -1709,7 +1709,7 @@ static void collapse_file(struct mm_struct *mm,
                                xas_unlock_irq(&xas);
                                page_cache_sync_readahead(mapping, &file->f_ra,
                                                          file, index,
-                                                         PAGE_SIZE);
+                                                         end - index);
                                /* drain pagevecs to help isolate_lru_page() */
                                lru_add_drain();
                                page = find_lock_page(mapping, index);
index 0aa2247bddd76dbee9099f2df7f46542f7d6e7e4..9afccc36dbd209e32f27b37ee6414703c40a3b12 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2453,6 +2453,10 @@ int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
                if (vma_is_dax(vma))
                        return 0;
 
+#ifdef VM_SAO
+               if (*vm_flags & VM_SAO)
+                       return 0;
+#endif
 #ifdef VM_SPARC_ADI
                if (*vm_flags & VM_SPARC_ADI)
                        return 0;
@@ -2582,6 +2586,10 @@ struct page *ksm_might_need_to_copy(struct page *page,
                return page;            /* let do_swap_page report the error */
 
        new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
+       if (new_page && mem_cgroup_charge(new_page, vma->vm_mm, GFP_KERNEL)) {
+               put_page(new_page);
+               new_page = NULL;
+       }
        if (new_page) {
                copy_user_highpage(new_page, page, address, vma);
 
@@ -2657,31 +2665,6 @@ again:
                goto again;
 }
 
-bool reuse_ksm_page(struct page *page,
-                   struct vm_area_struct *vma,
-                   unsigned long address)
-{
-#ifdef CONFIG_DEBUG_VM
-       if (WARN_ON(is_zero_pfn(page_to_pfn(page))) ||
-                       WARN_ON(!page_mapped(page)) ||
-                       WARN_ON(!PageLocked(page))) {
-               dump_page(page, "reuse_ksm_page");
-               return false;
-       }
-#endif
-
-       if (PageSwapCache(page) || !page_stable_node(page))
-               return false;
-       /* Prohibit parallel get_ksm_page() */
-       if (!page_ref_freeze(page, 1))
-               return false;
-
-       page_move_anon_rmap(page, vma);
-       page->index = linear_page_index(vma, address);
-       page_ref_unfreeze(page, 1);
-
-       return true;
-}
 #ifdef CONFIG_MIGRATION
 void ksm_migrate_page(struct page *newpage, struct page *oldpage)
 {
index dd1d43cf026deab477489aecc92c33dba12f89c7..0e0d61003fc6f34757ccb7e6bc840f6addc42c65 100644 (file)
@@ -289,9 +289,9 @@ static long madvise_willneed(struct vm_area_struct *vma,
         */
        *prev = NULL;   /* tell sys_madvise we drop mmap_lock */
        get_file(file);
-       mmap_read_unlock(current->mm);
        offset = (loff_t)(start - vma->vm_start)
                        + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
+       mmap_read_unlock(current->mm);
        vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED);
        fput(file);
        mmap_read_lock(current->mm);
@@ -381,9 +381,9 @@ huge_unlock:
                return 0;
        }
 
+regular_page:
        if (pmd_trans_unstable(pmd))
                return 0;
-regular_page:
 #endif
        tlb_change_page_size(tlb, PAGE_SIZE);
        orig_pte = pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
index b807952b4d431b60c52e2fef59a093ed6cc6f373..6877c765b8d037e887770d11e028200981cfb9b5 100644 (file)
@@ -1538,9 +1538,9 @@ static char *memory_stat_format(struct mem_cgroup *memcg)
                       memcg_page_state(memcg, WORKINGSET_ACTIVATE_ANON));
        seq_buf_printf(&s, "workingset_activate_file %lu\n",
                       memcg_page_state(memcg, WORKINGSET_ACTIVATE_FILE));
-       seq_buf_printf(&s, "workingset_restore %lu\n",
+       seq_buf_printf(&s, "workingset_restore_anon %lu\n",
                       memcg_page_state(memcg, WORKINGSET_RESTORE_ANON));
-       seq_buf_printf(&s, "workingset_restore %lu\n",
+       seq_buf_printf(&s, "workingset_restore_file %lu\n",
                       memcg_page_state(memcg, WORKINGSET_RESTORE_FILE));
        seq_buf_printf(&s, "workingset_nodereclaim %lu\n",
                       memcg_page_state(memcg, WORKINGSET_NODERECLAIM));
@@ -6774,6 +6774,9 @@ static void uncharge_batch(const struct uncharge_gather *ug)
        __this_cpu_add(ug->memcg->vmstats_percpu->nr_page_events, ug->nr_pages);
        memcg_check_events(ug->memcg, ug->dummy_page);
        local_irq_restore(flags);
+
+       /* drop reference from uncharge_page */
+       css_put(&ug->memcg->css);
 }
 
 static void uncharge_page(struct page *page, struct uncharge_gather *ug)
@@ -6797,6 +6800,9 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug)
                        uncharge_gather_clear(ug);
                }
                ug->memcg = page->mem_cgroup;
+
+               /* pairs with css_put in uncharge_batch */
+               css_get(&ug->memcg->css);
        }
 
        nr_pages = compound_nr(page);
index 602f4283122f7e9d842fdcbc650ef83cf31ad60d..fcfc4ca36eba80ce51ec6e90e55d44c0e939b6e7 100644 (file)
@@ -73,6 +73,7 @@
 #include <linux/numa.h>
 #include <linux/perf_event.h>
 #include <linux/ptrace.h>
+#include <linux/vmalloc.h>
 
 #include <trace/events/kmem.h>
 
@@ -83,6 +84,7 @@
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
 
+#include "pgalloc-track.h"
 #include "internal.h"
 
 #if defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) && !defined(CONFIG_COMPILE_TEST)
@@ -693,84 +695,218 @@ out:
  * covered by this vma.
  */
 
-static inline unsigned long
-copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
+static unsigned long
+copy_nonpresent_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma,
                unsigned long addr, int *rss)
 {
        unsigned long vm_flags = vma->vm_flags;
        pte_t pte = *src_pte;
        struct page *page;
+       swp_entry_t entry = pte_to_swp_entry(pte);
+
+       if (likely(!non_swap_entry(entry))) {
+               if (swap_duplicate(entry) < 0)
+                       return entry.val;
+
+               /* make sure dst_mm is on swapoff's mmlist. */
+               if (unlikely(list_empty(&dst_mm->mmlist))) {
+                       spin_lock(&mmlist_lock);
+                       if (list_empty(&dst_mm->mmlist))
+                               list_add(&dst_mm->mmlist,
+                                               &src_mm->mmlist);
+                       spin_unlock(&mmlist_lock);
+               }
+               rss[MM_SWAPENTS]++;
+       } else if (is_migration_entry(entry)) {
+               page = migration_entry_to_page(entry);
 
-       /* pte contains position in swap or file, so copy. */
-       if (unlikely(!pte_present(pte))) {
-               swp_entry_t entry = pte_to_swp_entry(pte);
-
-               if (likely(!non_swap_entry(entry))) {
-                       if (swap_duplicate(entry) < 0)
-                               return entry.val;
-
-                       /* make sure dst_mm is on swapoff's mmlist. */
-                       if (unlikely(list_empty(&dst_mm->mmlist))) {
-                               spin_lock(&mmlist_lock);
-                               if (list_empty(&dst_mm->mmlist))
-                                       list_add(&dst_mm->mmlist,
-                                                       &src_mm->mmlist);
-                               spin_unlock(&mmlist_lock);
-                       }
-                       rss[MM_SWAPENTS]++;
-               } else if (is_migration_entry(entry)) {
-                       page = migration_entry_to_page(entry);
-
-                       rss[mm_counter(page)]++;
-
-                       if (is_write_migration_entry(entry) &&
-                                       is_cow_mapping(vm_flags)) {
-                               /*
-                                * COW mappings require pages in both
-                                * parent and child to be set to read.
-                                */
-                               make_migration_entry_read(&entry);
-                               pte = swp_entry_to_pte(entry);
-                               if (pte_swp_soft_dirty(*src_pte))
-                                       pte = pte_swp_mksoft_dirty(pte);
-                               if (pte_swp_uffd_wp(*src_pte))
-                                       pte = pte_swp_mkuffd_wp(pte);
-                               set_pte_at(src_mm, addr, src_pte, pte);
-                       }
-               } else if (is_device_private_entry(entry)) {
-                       page = device_private_entry_to_page(entry);
+               rss[mm_counter(page)]++;
 
+               if (is_write_migration_entry(entry) &&
+                               is_cow_mapping(vm_flags)) {
                        /*
-                        * Update rss count even for unaddressable pages, as
-                        * they should treated just like normal pages in this
-                        * respect.
-                        *
-                        * We will likely want to have some new rss counters
-                        * for unaddressable pages, at some point. But for now
-                        * keep things as they are.
+                        * COW mappings require pages in both
+                        * parent and child to be set to read.
                         */
-                       get_page(page);
-                       rss[mm_counter(page)]++;
-                       page_dup_rmap(page, false);
+                       make_migration_entry_read(&entry);
+                       pte = swp_entry_to_pte(entry);
+                       if (pte_swp_soft_dirty(*src_pte))
+                               pte = pte_swp_mksoft_dirty(pte);
+                       if (pte_swp_uffd_wp(*src_pte))
+                               pte = pte_swp_mkuffd_wp(pte);
+                       set_pte_at(src_mm, addr, src_pte, pte);
+               }
+       } else if (is_device_private_entry(entry)) {
+               page = device_private_entry_to_page(entry);
 
-                       /*
-                        * We do not preserve soft-dirty information, because so
-                        * far, checkpoint/restore is the only feature that
-                        * requires that. And checkpoint/restore does not work
-                        * when a device driver is involved (you cannot easily
-                        * save and restore device driver state).
-                        */
-                       if (is_write_device_private_entry(entry) &&
-                           is_cow_mapping(vm_flags)) {
-                               make_device_private_entry_read(&entry);
-                               pte = swp_entry_to_pte(entry);
-                               if (pte_swp_uffd_wp(*src_pte))
-                                       pte = pte_swp_mkuffd_wp(pte);
-                               set_pte_at(src_mm, addr, src_pte, pte);
-                       }
+               /*
+                * Update rss count even for unaddressable pages, as
+                * they should treated just like normal pages in this
+                * respect.
+                *
+                * We will likely want to have some new rss counters
+                * for unaddressable pages, at some point. But for now
+                * keep things as they are.
+                */
+               get_page(page);
+               rss[mm_counter(page)]++;
+               page_dup_rmap(page, false);
+
+               /*
+                * We do not preserve soft-dirty information, because so
+                * far, checkpoint/restore is the only feature that
+                * requires that. And checkpoint/restore does not work
+                * when a device driver is involved (you cannot easily
+                * save and restore device driver state).
+                */
+               if (is_write_device_private_entry(entry) &&
+                   is_cow_mapping(vm_flags)) {
+                       make_device_private_entry_read(&entry);
+                       pte = swp_entry_to_pte(entry);
+                       if (pte_swp_uffd_wp(*src_pte))
+                               pte = pte_swp_mkuffd_wp(pte);
+                       set_pte_at(src_mm, addr, src_pte, pte);
                }
-               goto out_set_pte;
+       }
+       set_pte_at(dst_mm, addr, dst_pte, pte);
+       return 0;
+}
+
+/*
+ * Copy a present and normal page if necessary.
+ *
+ * NOTE! The usual case is that this doesn't need to do
+ * anything, and can just return a positive value. That
+ * will let the caller know that it can just increase
+ * the page refcount and re-use the pte the traditional
+ * way.
+ *
+ * But _if_ we need to copy it because it needs to be
+ * pinned in the parent (and the child should get its own
+ * copy rather than just a reference to the same page),
+ * we'll do that here and return zero to let the caller
+ * know we're done.
+ *
+ * And if we need a pre-allocated page but don't yet have
+ * one, return a negative error to let the preallocation
+ * code know so that it can do so outside the page table
+ * lock.
+ */
+static inline int
+copy_present_page(struct mm_struct *dst_mm, struct mm_struct *src_mm,
+               pte_t *dst_pte, pte_t *src_pte,
+               struct vm_area_struct *vma, struct vm_area_struct *new,
+               unsigned long addr, int *rss, struct page **prealloc,
+               pte_t pte, struct page *page)
+{
+       struct page *new_page;
+
+       if (!is_cow_mapping(vma->vm_flags))
+               return 1;
+
+       /*
+        * The trick starts.
+        *
+        * What we want to do is to check whether this page may
+        * have been pinned by the parent process.  If so,
+        * instead of wrprotect the pte on both sides, we copy
+        * the page immediately so that we'll always guarantee
+        * the pinned page won't be randomly replaced in the
+        * future.
+        *
+        * To achieve this, we do the following:
+        *
+        * 1. Write-protect the pte if it's writable.  This is
+        *    to protect concurrent write fast-gup with
+        *    FOLL_PIN, so that we'll fail the fast-gup with
+        *    the write bit removed.
+        *
+        * 2. Check page_maybe_dma_pinned() to see whether this
+        *    page may have been pinned.
+        *
+        * The order of these steps is important to serialize
+        * against the fast-gup code (gup_pte_range()) on the
+        * pte check and try_grab_compound_head(), so that
+        * we'll make sure either we'll capture that fast-gup
+        * so we'll copy the pinned page here, or we'll fail
+        * that fast-gup.
+        *
+        * NOTE! Even if we don't end up copying the page,
+        * we won't undo this wrprotect(), because the normal
+        * reference copy will need it anyway.
+        */
+       if (pte_write(pte))
+               ptep_set_wrprotect(src_mm, addr, src_pte);
+
+       /*
+        * These are the "normally we can just copy by reference"
+        * checks.
+        */
+       if (likely(!atomic_read(&src_mm->has_pinned)))
+               return 1;
+       if (likely(!page_maybe_dma_pinned(page)))
+               return 1;
+
+       /*
+        * Uhhuh. It looks like the page might be a pinned page,
+        * and we actually need to copy it. Now we can set the
+        * source pte back to being writable.
+        */
+       if (pte_write(pte))
+               set_pte_at(src_mm, addr, src_pte, pte);
+
+       new_page = *prealloc;
+       if (!new_page)
+               return -EAGAIN;
+
+       /*
+        * We have a prealloc page, all good!  Take it
+        * over and copy the page & arm it.
+        */
+       *prealloc = NULL;
+       copy_user_highpage(new_page, page, addr, vma);
+       __SetPageUptodate(new_page);
+       page_add_new_anon_rmap(new_page, new, addr, false);
+       lru_cache_add_inactive_or_unevictable(new_page, new);
+       rss[mm_counter(new_page)]++;
+
+       /* All done, just insert the new page copy in the child */
+       pte = mk_pte(new_page, new->vm_page_prot);
+       pte = maybe_mkwrite(pte_mkdirty(pte), new);
+       set_pte_at(dst_mm, addr, dst_pte, pte);
+       return 0;
+}
+
+/*
+ * Copy one pte.  Returns 0 if succeeded, or -EAGAIN if one preallocated page
+ * is required to copy this pte.
+ */
+static inline int
+copy_present_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
+               pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma,
+               struct vm_area_struct *new,
+               unsigned long addr, int *rss, struct page **prealloc)
+{
+       unsigned long vm_flags = vma->vm_flags;
+       pte_t pte = *src_pte;
+       struct page *page;
+
+       page = vm_normal_page(vma, addr, pte);
+       if (page) {
+               int retval;
+
+               retval = copy_present_page(dst_mm, src_mm,
+                       dst_pte, src_pte,
+                       vma, new,
+                       addr, rss, prealloc,
+                       pte, page);
+               if (retval <= 0)
+                       return retval;
+
+               get_page(page);
+               page_dup_rmap(page, false);
+               rss[mm_counter(page)]++;
        }
 
        /*
@@ -798,35 +934,51 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
        if (!(vm_flags & VM_UFFD_WP))
                pte = pte_clear_uffd_wp(pte);
 
-       page = vm_normal_page(vma, addr, pte);
-       if (page) {
-               get_page(page);
-               page_dup_rmap(page, false);
-               rss[mm_counter(page)]++;
-       }
-
-out_set_pte:
        set_pte_at(dst_mm, addr, dst_pte, pte);
        return 0;
 }
 
+static inline struct page *
+page_copy_prealloc(struct mm_struct *src_mm, struct vm_area_struct *vma,
+                  unsigned long addr)
+{
+       struct page *new_page;
+
+       new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, addr);
+       if (!new_page)
+               return NULL;
+
+       if (mem_cgroup_charge(new_page, src_mm, GFP_KERNEL)) {
+               put_page(new_page);
+               return NULL;
+       }
+       cgroup_throttle_swaprate(new_page, GFP_KERNEL);
+
+       return new_page;
+}
+
 static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                   pmd_t *dst_pmd, pmd_t *src_pmd, struct vm_area_struct *vma,
+                  struct vm_area_struct *new,
                   unsigned long addr, unsigned long end)
 {
        pte_t *orig_src_pte, *orig_dst_pte;
        pte_t *src_pte, *dst_pte;
        spinlock_t *src_ptl, *dst_ptl;
-       int progress = 0;
+       int progress, ret = 0;
        int rss[NR_MM_COUNTERS];
        swp_entry_t entry = (swp_entry_t){0};
+       struct page *prealloc = NULL;
 
 again:
+       progress = 0;
        init_rss_vec(rss);
 
        dst_pte = pte_alloc_map_lock(dst_mm, dst_pmd, addr, &dst_ptl);
-       if (!dst_pte)
-               return -ENOMEM;
+       if (!dst_pte) {
+               ret = -ENOMEM;
+               goto out;
+       }
        src_pte = pte_offset_map(src_pmd, addr);
        src_ptl = pte_lockptr(src_mm, src_pmd);
        spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
@@ -849,10 +1001,34 @@ again:
                        progress++;
                        continue;
                }
-               entry.val = copy_one_pte(dst_mm, src_mm, dst_pte, src_pte,
+               if (unlikely(!pte_present(*src_pte))) {
+                       entry.val = copy_nonpresent_pte(dst_mm, src_mm,
+                                                       dst_pte, src_pte,
                                                        vma, addr, rss);
-               if (entry.val)
+                       if (entry.val)
+                               break;
+                       progress += 8;
+                       continue;
+               }
+               /* copy_present_pte() will clear `*prealloc' if consumed */
+               ret = copy_present_pte(dst_mm, src_mm, dst_pte, src_pte,
+                                      vma, new, addr, rss, &prealloc);
+               /*
+                * If we need a pre-allocated page for this pte, drop the
+                * locks, allocate, and try again.
+                */
+               if (unlikely(ret == -EAGAIN))
                        break;
+               if (unlikely(prealloc)) {
+                       /*
+                        * pre-alloc page cannot be reused by next time so as
+                        * to strictly follow mempolicy (e.g., alloc_page_vma()
+                        * will allocate page according to address).  This
+                        * could only happen if one pinned pte changed.
+                        */
+                       put_page(prealloc);
+                       prealloc = NULL;
+               }
                progress += 8;
        } while (dst_pte++, src_pte++, addr += PAGE_SIZE, addr != end);
 
@@ -864,17 +1040,30 @@ again:
        cond_resched();
 
        if (entry.val) {
-               if (add_swap_count_continuation(entry, GFP_KERNEL) < 0)
+               if (add_swap_count_continuation(entry, GFP_KERNEL) < 0) {
+                       ret = -ENOMEM;
+                       goto out;
+               }
+               entry.val = 0;
+       } else if (ret) {
+               WARN_ON_ONCE(ret != -EAGAIN);
+               prealloc = page_copy_prealloc(src_mm, vma, addr);
+               if (!prealloc)
                        return -ENOMEM;
-               progress = 0;
+               /* We've captured and resolved the error. Reset, try again. */
+               ret = 0;
        }
        if (addr != end)
                goto again;
-       return 0;
+out:
+       if (unlikely(prealloc))
+               put_page(prealloc);
+       return ret;
 }
 
 static inline int copy_pmd_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                pud_t *dst_pud, pud_t *src_pud, struct vm_area_struct *vma,
+               struct vm_area_struct *new,
                unsigned long addr, unsigned long end)
 {
        pmd_t *src_pmd, *dst_pmd;
@@ -901,7 +1090,7 @@ static inline int copy_pmd_range(struct mm_struct *dst_mm, struct mm_struct *src
                if (pmd_none_or_clear_bad(src_pmd))
                        continue;
                if (copy_pte_range(dst_mm, src_mm, dst_pmd, src_pmd,
-                                               vma, addr, next))
+                                  vma, new, addr, next))
                        return -ENOMEM;
        } while (dst_pmd++, src_pmd++, addr = next, addr != end);
        return 0;
@@ -909,6 +1098,7 @@ static inline int copy_pmd_range(struct mm_struct *dst_mm, struct mm_struct *src
 
 static inline int copy_pud_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                p4d_t *dst_p4d, p4d_t *src_p4d, struct vm_area_struct *vma,
+               struct vm_area_struct *new,
                unsigned long addr, unsigned long end)
 {
        pud_t *src_pud, *dst_pud;
@@ -935,7 +1125,7 @@ static inline int copy_pud_range(struct mm_struct *dst_mm, struct mm_struct *src
                if (pud_none_or_clear_bad(src_pud))
                        continue;
                if (copy_pmd_range(dst_mm, src_mm, dst_pud, src_pud,
-                                               vma, addr, next))
+                                  vma, new, addr, next))
                        return -ENOMEM;
        } while (dst_pud++, src_pud++, addr = next, addr != end);
        return 0;
@@ -943,6 +1133,7 @@ static inline int copy_pud_range(struct mm_struct *dst_mm, struct mm_struct *src
 
 static inline int copy_p4d_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                pgd_t *dst_pgd, pgd_t *src_pgd, struct vm_area_struct *vma,
+               struct vm_area_struct *new,
                unsigned long addr, unsigned long end)
 {
        p4d_t *src_p4d, *dst_p4d;
@@ -957,14 +1148,14 @@ static inline int copy_p4d_range(struct mm_struct *dst_mm, struct mm_struct *src
                if (p4d_none_or_clear_bad(src_p4d))
                        continue;
                if (copy_pud_range(dst_mm, src_mm, dst_p4d, src_p4d,
-                                               vma, addr, next))
+                                  vma, new, addr, next))
                        return -ENOMEM;
        } while (dst_p4d++, src_p4d++, addr = next, addr != end);
        return 0;
 }
 
 int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
-               struct vm_area_struct *vma)
+                   struct vm_area_struct *vma, struct vm_area_struct *new)
 {
        pgd_t *src_pgd, *dst_pgd;
        unsigned long next;
@@ -1019,7 +1210,7 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                if (pgd_none_or_clear_bad(src_pgd))
                        continue;
                if (unlikely(copy_p4d_range(dst_mm, src_mm, dst_pgd, src_pgd,
-                                           vma, addr, next))) {
+                                           vma, new, addr, next))) {
                        ret = -ENOMEM;
                        break;
                }
@@ -2206,7 +2397,8 @@ EXPORT_SYMBOL(vm_iomap_memory);
 
 static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
                                     unsigned long addr, unsigned long end,
-                                    pte_fn_t fn, void *data, bool create)
+                                    pte_fn_t fn, void *data, bool create,
+                                    pgtbl_mod_mask *mask)
 {
        pte_t *pte;
        int err = 0;
@@ -2214,7 +2406,7 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
 
        if (create) {
                pte = (mm == &init_mm) ?
-                       pte_alloc_kernel(pmd, addr) :
+                       pte_alloc_kernel_track(pmd, addr, mask) :
                        pte_alloc_map_lock(mm, pmd, addr, &ptl);
                if (!pte)
                        return -ENOMEM;
@@ -2235,6 +2427,7 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
                                break;
                }
        } while (addr += PAGE_SIZE, addr != end);
+       *mask |= PGTBL_PTE_MODIFIED;
 
        arch_leave_lazy_mmu_mode();
 
@@ -2245,7 +2438,8 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
 
 static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud,
                                     unsigned long addr, unsigned long end,
-                                    pte_fn_t fn, void *data, bool create)
+                                    pte_fn_t fn, void *data, bool create,
+                                    pgtbl_mod_mask *mask)
 {
        pmd_t *pmd;
        unsigned long next;
@@ -2254,7 +2448,7 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud,
        BUG_ON(pud_huge(*pud));
 
        if (create) {
-               pmd = pmd_alloc(mm, pud, addr);
+               pmd = pmd_alloc_track(mm, pud, addr, mask);
                if (!pmd)
                        return -ENOMEM;
        } else {
@@ -2264,7 +2458,7 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud,
                next = pmd_addr_end(addr, end);
                if (create || !pmd_none_or_clear_bad(pmd)) {
                        err = apply_to_pte_range(mm, pmd, addr, next, fn, data,
-                                                create);
+                                                create, mask);
                        if (err)
                                break;
                }
@@ -2274,14 +2468,15 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud,
 
 static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d,
                                     unsigned long addr, unsigned long end,
-                                    pte_fn_t fn, void *data, bool create)
+                                    pte_fn_t fn, void *data, bool create,
+                                    pgtbl_mod_mask *mask)
 {
        pud_t *pud;
        unsigned long next;
        int err = 0;
 
        if (create) {
-               pud = pud_alloc(mm, p4d, addr);
+               pud = pud_alloc_track(mm, p4d, addr, mask);
                if (!pud)
                        return -ENOMEM;
        } else {
@@ -2291,7 +2486,7 @@ static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d,
                next = pud_addr_end(addr, end);
                if (create || !pud_none_or_clear_bad(pud)) {
                        err = apply_to_pmd_range(mm, pud, addr, next, fn, data,
-                                                create);
+                                                create, mask);
                        if (err)
                                break;
                }
@@ -2301,14 +2496,15 @@ static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d,
 
 static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd,
                                     unsigned long addr, unsigned long end,
-                                    pte_fn_t fn, void *data, bool create)
+                                    pte_fn_t fn, void *data, bool create,
+                                    pgtbl_mod_mask *mask)
 {
        p4d_t *p4d;
        unsigned long next;
        int err = 0;
 
        if (create) {
-               p4d = p4d_alloc(mm, pgd, addr);
+               p4d = p4d_alloc_track(mm, pgd, addr, mask);
                if (!p4d)
                        return -ENOMEM;
        } else {
@@ -2318,7 +2514,7 @@ static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd,
                next = p4d_addr_end(addr, end);
                if (create || !p4d_none_or_clear_bad(p4d)) {
                        err = apply_to_pud_range(mm, p4d, addr, next, fn, data,
-                                                create);
+                                                create, mask);
                        if (err)
                                break;
                }
@@ -2331,8 +2527,9 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr,
                                 void *data, bool create)
 {
        pgd_t *pgd;
-       unsigned long next;
+       unsigned long start = addr, next;
        unsigned long end = addr + size;
+       pgtbl_mod_mask mask = 0;
        int err = 0;
 
        if (WARN_ON(addr >= end))
@@ -2343,11 +2540,14 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr,
                next = pgd_addr_end(addr, end);
                if (!create && pgd_none_or_clear_bad(pgd))
                        continue;
-               err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create);
+               err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create, &mask);
                if (err)
                        break;
        } while (pgd++, addr = next, addr != end);
 
+       if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
+               arch_sync_kernel_mappings(start, start + size);
+
        return err;
 }
 
@@ -2622,6 +2822,7 @@ static inline void wp_page_reuse(struct vm_fault *vmf)
        if (ptep_set_access_flags(vma, vmf->address, vmf->pte, entry, 1))
                update_mmu_cache(vma, vmf->address, vmf->pte);
        pte_unmap_unlock(vmf->pte, vmf->ptl);
+       count_vm_event(PGREUSE);
 }
 
 /*
@@ -2927,50 +3128,25 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf)
         * not dirty accountable.
         */
        if (PageAnon(vmf->page)) {
-               int total_map_swapcount;
-               if (PageKsm(vmf->page) && (PageSwapCache(vmf->page) ||
-                                          page_count(vmf->page) != 1))
+               struct page *page = vmf->page;
+
+               /* PageKsm() doesn't necessarily raise the page refcount */
+               if (PageKsm(page) || page_count(page) != 1)
+                       goto copy;
+               if (!trylock_page(page))
+                       goto copy;
+               if (PageKsm(page) || page_mapcount(page) != 1 || page_count(page) != 1) {
+                       unlock_page(page);
                        goto copy;
-               if (!trylock_page(vmf->page)) {
-                       get_page(vmf->page);
-                       pte_unmap_unlock(vmf->pte, vmf->ptl);
-                       lock_page(vmf->page);
-                       vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd,
-                                       vmf->address, &vmf->ptl);
-                       if (!pte_same(*vmf->pte, vmf->orig_pte)) {
-                               update_mmu_tlb(vma, vmf->address, vmf->pte);
-                               unlock_page(vmf->page);
-                               pte_unmap_unlock(vmf->pte, vmf->ptl);
-                               put_page(vmf->page);
-                               return 0;
-                       }
-                       put_page(vmf->page);
-               }
-               if (PageKsm(vmf->page)) {
-                       bool reused = reuse_ksm_page(vmf->page, vmf->vma,
-                                                    vmf->address);
-                       unlock_page(vmf->page);
-                       if (!reused)
-                               goto copy;
-                       wp_page_reuse(vmf);
-                       return VM_FAULT_WRITE;
-               }
-               if (reuse_swap_page(vmf->page, &total_map_swapcount)) {
-                       if (total_map_swapcount == 1) {
-                               /*
-                                * The page is all ours. Move it to
-                                * our anon_vma so the rmap code will
-                                * not search our parent or siblings.
-                                * Protected against the rmap code by
-                                * the page lock.
-                                */
-                               page_move_anon_rmap(vmf->page, vma);
-                       }
-                       unlock_page(vmf->page);
-                       wp_page_reuse(vmf);
-                       return VM_FAULT_WRITE;
                }
-               unlock_page(vmf->page);
+               /*
+                * Ok, we've got the only map reference, and the only
+                * page count reference, and the page is locked,
+                * it's dark out, and we're wearing sunglasses. Hit it.
+                */
+               unlock_page(page);
+               wp_page_reuse(vmf);
+               return VM_FAULT_WRITE;
        } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) ==
                                        (VM_WRITE|VM_SHARED))) {
                return wp_page_shared(vmf);
index e9d5ab5d3ca097ed96fc7050d485dc6a2c07630b..ce3e73e3a5c1bb5d27e9ce281cd246a85256f035 100644 (file)
@@ -729,7 +729,7 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
         * are reserved so nobody should be touching them so we should be safe
         */
        memmap_init_zone(nr_pages, nid, zone_idx(zone), start_pfn,
-                       MEMMAP_HOTPLUG, altmap);
+                        MEMINIT_HOTPLUG, altmap);
 
        set_zone_contiguous(zone);
 }
@@ -1080,7 +1080,8 @@ int __ref add_memory_resource(int nid, struct resource *res)
        }
 
        /* link memory sections under this node.*/
-       ret = link_mem_sections(nid, PFN_DOWN(start), PFN_UP(start + size - 1));
+       ret = link_mem_sections(nid, PFN_DOWN(start), PFN_UP(start + size - 1),
+                               MEMINIT_HOTPLUG);
        BUG_ON(ret);
 
        /* create new memmap entry */
@@ -1575,6 +1576,20 @@ static int __ref __offline_pages(unsigned long start_pfn,
                /* check again */
                ret = walk_system_ram_range(start_pfn, end_pfn - start_pfn,
                                            NULL, check_pages_isolated_cb);
+               /*
+                * per-cpu pages are drained in start_isolate_page_range, but if
+                * there are still pages that are not free, make sure that we
+                * drain again, because when we isolated range we might
+                * have raced with another thread that was adding pages to pcp
+                * list.
+                *
+                * Forward progress should be still guaranteed because
+                * pages on the pcp list can only belong to MOVABLE_ZONE
+                * because has_unmovable_pages explicitly checks for
+                * PageBuddy on freed pages on other zones.
+                */
+               if (ret)
+                       drain_all_pages(zone);
        } while (ret);
 
        /* Ok, all of our target is isolated.
index 03e38b7a38f1a434d5f63294c6675672d9eed227..006dace60b1a9d8e331f34c24dcea9f96036cdb9 100644 (file)
@@ -216,7 +216,7 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
                        return ERR_PTR(-EINVAL);
                }
                break;
-       case MEMORY_DEVICE_DEVDAX:
+       case MEMORY_DEVICE_GENERIC:
                need_devmap_managed = false;
                break;
        case MEMORY_DEVICE_PCI_P2PDMA:
index 34a842a8eb6a7b85b191e58adca66002a1a5072c..04a98bb2f568f6999e121884c04f2ed207612235 100644 (file)
@@ -246,13 +246,13 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma,
                else if (pte_swp_uffd_wp(*pvmw.pte))
                        pte = pte_mkuffd_wp(pte);
 
-               if (unlikely(is_zone_device_page(new))) {
-                       if (is_device_private_page(new)) {
-                               entry = make_device_private_entry(new, pte_write(pte));
-                               pte = swp_entry_to_pte(entry);
-                               if (pte_swp_uffd_wp(*pvmw.pte))
-                                       pte = pte_mkuffd_wp(pte);
-                       }
+               if (unlikely(is_device_private_page(new))) {
+                       entry = make_device_private_entry(new, pte_write(pte));
+                       pte = swp_entry_to_pte(entry);
+                       if (pte_swp_soft_dirty(*pvmw.pte))
+                               pte = pte_swp_mksoft_dirty(pte);
+                       if (pte_swp_uffd_wp(*pvmw.pte))
+                               pte = pte_swp_mkuffd_wp(pte);
                }
 
 #ifdef CONFIG_HUGETLB_PAGE
@@ -668,7 +668,8 @@ void migrate_page_states(struct page *newpage, struct page *page)
 
        copy_page_owner(page, newpage);
 
-       mem_cgroup_migrate(page, newpage);
+       if (!PageHuge(page))
+               mem_cgroup_migrate(page, newpage);
 }
 EXPORT_SYMBOL(migrate_page_states);
 
@@ -1445,7 +1446,7 @@ retry:
                         * Capture required information that might get lost
                         * during migration.
                         */
-                       is_thp = PageTransHuge(page);
+                       is_thp = PageTransHuge(page) && !PageHuge(page);
                        nr_subpages = thp_nr_pages(page);
                        cond_resched();
 
@@ -1471,7 +1472,7 @@ retry:
                                 * we encounter them after the rest of the list
                                 * is processed.
                                 */
-                               if (PageTransHuge(page) && !PageHuge(page)) {
+                               if (is_thp) {
                                        lock_page(page);
                                        rc = split_huge_page_to_list(page, from);
                                        unlock_page(page);
@@ -1480,8 +1481,7 @@ retry:
                                                nr_thp_split++;
                                                goto retry;
                                        }
-                               }
-                               if (is_thp) {
+
                                        nr_thp_failed++;
                                        nr_failed += nr_subpages;
                                        goto out;
@@ -2427,10 +2427,17 @@ again:
                        entry = make_migration_entry(page, mpfn &
                                                     MIGRATE_PFN_WRITE);
                        swp_pte = swp_entry_to_pte(entry);
-                       if (pte_soft_dirty(pte))
-                               swp_pte = pte_swp_mksoft_dirty(swp_pte);
-                       if (pte_uffd_wp(pte))
-                               swp_pte = pte_swp_mkuffd_wp(swp_pte);
+                       if (pte_present(pte)) {
+                               if (pte_soft_dirty(pte))
+                                       swp_pte = pte_swp_mksoft_dirty(swp_pte);
+                               if (pte_uffd_wp(pte))
+                                       swp_pte = pte_swp_mkuffd_wp(swp_pte);
+                       } else {
+                               if (pte_swp_soft_dirty(pte))
+                                       swp_pte = pte_swp_mksoft_dirty(swp_pte);
+                               if (pte_swp_uffd_wp(pte))
+                                       swp_pte = pte_swp_mkuffd_wp(swp_pte);
+                       }
                        set_pte_at(mm, addr, ptep, swp_pte);
 
                        /*
index 93ca2bf30b4fd262fe4a4f432fa01ad96d145e74..884b1216da6a6deead6dbd846d7be9ca9fe64f6d 100644 (file)
@@ -58,11 +58,14 @@ EXPORT_SYMBOL(can_do_mlock);
  */
 void clear_page_mlock(struct page *page)
 {
+       int nr_pages;
+
        if (!TestClearPageMlocked(page))
                return;
 
-       mod_zone_page_state(page_zone(page), NR_MLOCK, -thp_nr_pages(page));
-       count_vm_event(UNEVICTABLE_PGCLEARED);
+       nr_pages = thp_nr_pages(page);
+       mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages);
+       count_vm_events(UNEVICTABLE_PGCLEARED, nr_pages);
        /*
         * The previous TestClearPageMlocked() corresponds to the smp_mb()
         * in __pagevec_lru_add_fn().
@@ -76,7 +79,7 @@ void clear_page_mlock(struct page *page)
                 * We lost the race. the page already moved to evictable list.
                 */
                if (PageUnevictable(page))
-                       count_vm_event(UNEVICTABLE_PGSTRANDED);
+                       count_vm_events(UNEVICTABLE_PGSTRANDED, nr_pages);
        }
 }
 
@@ -93,9 +96,10 @@ void mlock_vma_page(struct page *page)
        VM_BUG_ON_PAGE(PageCompound(page) && PageDoubleMap(page), page);
 
        if (!TestSetPageMlocked(page)) {
-               mod_zone_page_state(page_zone(page), NR_MLOCK,
-                                   thp_nr_pages(page));
-               count_vm_event(UNEVICTABLE_PGMLOCKED);
+               int nr_pages = thp_nr_pages(page);
+
+               mod_zone_page_state(page_zone(page), NR_MLOCK, nr_pages);
+               count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages);
                if (!isolate_lru_page(page))
                        putback_lru_page(page);
        }
@@ -138,7 +142,7 @@ static void __munlock_isolated_page(struct page *page)
 
        /* Did try_to_unlock() succeed or punt? */
        if (!PageMlocked(page))
-               count_vm_event(UNEVICTABLE_PGMUNLOCKED);
+               count_vm_events(UNEVICTABLE_PGMUNLOCKED, thp_nr_pages(page));
 
        putback_lru_page(page);
 }
@@ -154,10 +158,12 @@ static void __munlock_isolated_page(struct page *page)
  */
 static void __munlock_isolation_failed(struct page *page)
 {
+       int nr_pages = thp_nr_pages(page);
+
        if (PageUnevictable(page))
-               __count_vm_event(UNEVICTABLE_PGSTRANDED);
+               __count_vm_events(UNEVICTABLE_PGSTRANDED, nr_pages);
        else
-               __count_vm_event(UNEVICTABLE_PGMUNLOCKED);
+               __count_vm_events(UNEVICTABLE_PGMUNLOCKED, nr_pages);
 }
 
 /**
index fab5e97dc9ca5b10b09984fdde6c90a6bc4daff0..5661fa164f1308ee876e7257e27207f1e697de95 100644 (file)
@@ -5975,7 +5975,7 @@ overlap_memmap_init(unsigned long zone, unsigned long *pfn)
  * done. Non-atomic initialization, single-pass.
  */
 void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
-               unsigned long start_pfn, enum memmap_context context,
+               unsigned long start_pfn, enum meminit_context context,
                struct vmem_altmap *altmap)
 {
        unsigned long pfn, end_pfn = start_pfn + size;
@@ -6007,7 +6007,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
                 * There can be holes in boot-time mem_map[]s handed to this
                 * function.  They do not exist on hotplugged memory.
                 */
-               if (context == MEMMAP_EARLY) {
+               if (context == MEMINIT_EARLY) {
                        if (overlap_memmap_init(zone, &pfn))
                                continue;
                        if (defer_init(nid, pfn, end_pfn))
@@ -6016,7 +6016,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
 
                page = pfn_to_page(pfn);
                __init_single_page(page, pfn, zone, nid);
-               if (context == MEMMAP_HOTPLUG)
+               if (context == MEMINIT_HOTPLUG)
                        __SetPageReserved(page);
 
                /*
@@ -6099,7 +6099,7 @@ void __ref memmap_init_zone_device(struct zone *zone,
                 * check here not to call set_pageblock_migratetype() against
                 * pfn out of zone.
                 *
-                * Please note that MEMMAP_HOTPLUG path doesn't clear memmap
+                * Please note that MEMINIT_HOTPLUG path doesn't clear memmap
                 * because this is done early in section_activate()
                 */
                if (!(pfn & (pageblock_nr_pages - 1))) {
@@ -6137,7 +6137,7 @@ void __meminit __weak memmap_init(unsigned long size, int nid,
                if (end_pfn > start_pfn) {
                        size = end_pfn - start_pfn;
                        memmap_init_zone(size, nid, zone, start_pfn,
-                                        MEMMAP_EARLY, NULL);
+                                        MEMINIT_EARLY, NULL);
                }
        }
 }
index 242c03121d7317b26c88a030bd42d783ac844ab3..63a3db10a8c0c26535e82e620826d70d04a9589b 100644 (file)
@@ -170,6 +170,14 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages)
  * pageblocks we may have modified and return -EBUSY to caller. This
  * prevents two threads from simultaneously working on overlapping ranges.
  *
+ * Please note that there is no strong synchronization with the page allocator
+ * either. Pages might be freed while their page blocks are marked ISOLATED.
+ * In some cases pages might still end up on pcp lists and that would allow
+ * for their allocation even when they are in fact isolated already. Depending
+ * on how strong of a guarantee the caller needs drain_all_pages might be needed
+ * (e.g. __offline_pages will need to call it after check for isolated range for
+ * a next retry).
+ *
  * Return: the number of isolated pageblocks on success and -EBUSY if any part
  * of range cannot be isolated.
  */
index f4709629e6deea6f3ac7cc36baf719905f18d42f..1ed1a349eab83c0eecd0de37358ac83d4ddc7e06 100644 (file)
@@ -1316,7 +1316,7 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr,
 
        /* allocate chunk */
        alloc_size = sizeof(struct pcpu_chunk) +
-               BITS_TO_LONGS(region_size >> PAGE_SHIFT);
+               BITS_TO_LONGS(region_size >> PAGE_SHIFT) * sizeof(unsigned long);
        chunk = memblock_alloc(alloc_size, SMP_CACHE_BYTES);
        if (!chunk)
                panic("%s: Failed to allocate %zu bytes\n", __func__,
index 83cc459edc407fc26392df777bebd15ce5df419b..9425260774a1f0d034d6a3d434ff153b6e7e8440 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1511,9 +1511,14 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                         */
                        entry = make_migration_entry(page, 0);
                        swp_pte = swp_entry_to_pte(entry);
-                       if (pte_soft_dirty(pteval))
+
+                       /*
+                        * pteval maps a zone device page and is therefore
+                        * a swap pte.
+                        */
+                       if (pte_swp_soft_dirty(pteval))
                                swp_pte = pte_swp_mksoft_dirty(swp_pte);
-                       if (pte_uffd_wp(pteval))
+                       if (pte_swp_uffd_wp(pteval))
                                swp_pte = pte_swp_mkuffd_wp(swp_pte);
                        set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte);
                        /*
index 271548ca20f3149b90974224fd767cbec5e42cb2..8e2b35ba93ad173e74b21c38fe3002cf8aceee6c 100644 (file)
@@ -279,11 +279,13 @@ static int shmem_reserve_inode(struct super_block *sb, ino_t *inop)
 
        if (!(sb->s_flags & SB_KERNMOUNT)) {
                spin_lock(&sbinfo->stat_lock);
-               if (!sbinfo->free_inodes) {
-                       spin_unlock(&sbinfo->stat_lock);
-                       return -ENOSPC;
+               if (sbinfo->max_inodes) {
+                       if (!sbinfo->free_inodes) {
+                               spin_unlock(&sbinfo->stat_lock);
+                               return -ENOSPC;
+                       }
+                       sbinfo->free_inodes--;
                }
-               sbinfo->free_inodes--;
                if (inop) {
                        ino = sbinfo->next_ino++;
                        if (unlikely(is_zero_ino(ino)))
index 3160dff6fd76729d2573e8a3680fd12fcaba10d0..f658e86ec8ceeee6567829d48345c7fa9260a237 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1632,6 +1632,10 @@ static void slab_destroy(struct kmem_cache *cachep, struct page *page)
                kmem_cache_free(cachep->freelist_cache, freelist);
 }
 
+/*
+ * Update the size of the caches before calling slabs_destroy as it may
+ * recursively call kfree.
+ */
 static void slabs_destroy(struct kmem_cache *cachep, struct list_head *list)
 {
        struct page *page, *n;
@@ -2153,8 +2157,8 @@ static void do_drain(void *arg)
        spin_lock(&n->list_lock);
        free_block(cachep, ac->entry, ac->avail, node, &list);
        spin_unlock(&n->list_lock);
-       slabs_destroy(cachep, &list);
        ac->avail = 0;
+       slabs_destroy(cachep, &list);
 }
 
 static void drain_cpu_caches(struct kmem_cache *cachep)
@@ -3402,9 +3406,9 @@ free_done:
        }
 #endif
        spin_unlock(&n->list_lock);
-       slabs_destroy(cachep, &list);
        ac->avail -= batchcount;
        memmove(ac->entry, &(ac->entry[batchcount]), sizeof(void *)*ac->avail);
+       slabs_destroy(cachep, &list);
 }
 
 /*
index 68c02b2eecd90334588493cd0b28058c15c4c11d..d4177aecedf6bb7cfd45b74b61b8ce2243eebc68 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -672,12 +672,12 @@ static void slab_fix(struct kmem_cache *s, char *fmt, ...)
 }
 
 static bool freelist_corrupted(struct kmem_cache *s, struct page *page,
-                              void *freelist, void *nextfree)
+                              void **freelist, void *nextfree)
 {
        if ((s->flags & SLAB_CONSISTENCY_CHECKS) &&
-           !check_valid_pointer(s, page, nextfree)) {
-               object_err(s, page, freelist, "Freechain corrupt");
-               freelist = NULL;
+           !check_valid_pointer(s, page, nextfree) && freelist) {
+               object_err(s, page, *freelist, "Freechain corrupt");
+               *freelist = NULL;
                slab_fix(s, "Isolate corrupted freechain");
                return true;
        }
@@ -1494,7 +1494,7 @@ static inline void dec_slabs_node(struct kmem_cache *s, int node,
                                                        int objects) {}
 
 static bool freelist_corrupted(struct kmem_cache *s, struct page *page,
-                              void *freelist, void *nextfree)
+                              void **freelist, void *nextfree)
 {
        return false;
 }
@@ -2184,7 +2184,7 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page,
                 * 'freelist' is already corrupted.  So isolate all objects
                 * starting at 'freelist'.
                 */
-               if (freelist_corrupted(s, page, freelist, nextfree))
+               if (freelist_corrupted(s, page, &freelist, nextfree))
                        break;
 
                do {
index d16d65d9b4e099fe81b2c252f8edc58644428ca5..e7bdf094f76a030aac8a318a81d8f049f3aefd8a 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -494,14 +494,14 @@ void lru_cache_add_inactive_or_unevictable(struct page *page,
 
        unevictable = (vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) == VM_LOCKED;
        if (unlikely(unevictable) && !TestSetPageMlocked(page)) {
+               int nr_pages = thp_nr_pages(page);
                /*
                 * We use the irq-unsafe __mod_zone_page_stat because this
                 * counter is not modified from interrupt context, and the pte
                 * lock is held(spinlock), which implies preemption disabled.
                 */
-               __mod_zone_page_state(page_zone(page), NR_MLOCK,
-                                   thp_nr_pages(page));
-               count_vm_event(UNEVICTABLE_PGMLOCKED);
+               __mod_zone_page_state(page_zone(page), NR_MLOCK, nr_pages);
+               count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages);
        }
        lru_cache_add(page);
 }
index 12f59e641b5e295cf3c97eb0e8bed962af1e4d35..debc94155f74dd8b8f3be8fa32cc8f64fa4ff53a 100644 (file)
@@ -1078,7 +1078,7 @@ start_over:
                        goto nextsi;
                }
                if (size == SWAPFILE_CLUSTER) {
-                       if (!(si->flags & SWP_FS))
+                       if (si->flags & SWP_BLKDEV)
                                n_ret = swap_alloc_cluster(si, swp_entries);
                } else
                        n_ret = scan_swap_map_slots(si, SWAP_HAS_CACHE,
index 99e1796eb8336236d4eacefd2e51ca00d76786b8..466fc3144fffc64f2f4bd59e23ee52eaa032ff9a 100644 (file)
@@ -2615,6 +2615,14 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc)
                unsigned long reclaimed;
                unsigned long scanned;
 
+               /*
+                * This loop can become CPU-bound when target memcgs
+                * aren't eligible for reclaim - either because they
+                * don't have any reclaimable pages, or because their
+                * memory is explicitly protected. Avoid soft lockups.
+                */
+               cond_resched();
+
                mem_cgroup_calculate_protection(target_memcg, memcg);
 
                if (mem_cgroup_below_min(memcg)) {
@@ -4260,8 +4268,14 @@ void check_move_unevictable_pages(struct pagevec *pvec)
        for (i = 0; i < pvec->nr; i++) {
                struct page *page = pvec->pages[i];
                struct pglist_data *pagepgdat = page_pgdat(page);
+               int nr_pages;
+
+               if (PageTransTail(page))
+                       continue;
+
+               nr_pages = thp_nr_pages(page);
+               pgscanned += nr_pages;
 
-               pgscanned++;
                if (pagepgdat != pgdat) {
                        if (pgdat)
                                spin_unlock_irq(&pgdat->lru_lock);
@@ -4280,7 +4294,7 @@ void check_move_unevictable_pages(struct pagevec *pvec)
                        ClearPageUnevictable(page);
                        del_page_from_lru_list(page, lruvec, LRU_UNEVICTABLE);
                        add_page_to_lru_list(page, lruvec, lru);
-                       pgrescued++;
+                       pgrescued += nr_pages;
                }
        }
 
index e670f910cd2f3ba86ae0d75ba4a0f85b7ab907f3..4f7b4ee6aa123cdf10138e7500ea98edcd98f6de 100644 (file)
@@ -1241,6 +1241,7 @@ const char * const vmstat_text[] = {
        "pglazyfreed",
 
        "pgrefill",
+       "pgreuse",
        "pgsteal_kswapd",
        "pgsteal_direct",
        "pgscan_kswapd",
index 3dd7c972677be27b276c44942419a33a79b13214..ec8408d1638fbdf2742a3c07eaeb8ac0511883f5 100644 (file)
@@ -367,7 +367,7 @@ static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        case SIOCSHWTSTAMP:
                if (!net_eq(dev_net(dev), &init_net))
                        break;
-               /* fall through */
+               fallthrough;
        case SIOCGMIIPHY:
        case SIOCGMIIREG:
        case SIOCSMIIREG:
index 3debad93be1a602ca65d523e3d0ac4df1e88b85b..bc8807d9281fd39130ac997ec5eead26e6e4feb4 100644 (file)
@@ -520,7 +520,7 @@ static void xen_9pfs_front_changed(struct xenbus_device *dev,
        case XenbusStateClosed:
                if (dev->state == XenbusStateClosed)
                        break;
-               /* fall through - Missed the backend's CLOSING state */
+               fallthrough;    /* Missed the backend's CLOSING state */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;
index 84367b844b147376a7718fbdc51b2140111c5de5..1cfa9bf1d18713afc7191ddecb256bfb3844154e 100644 (file)
@@ -297,7 +297,7 @@ static int adjust_tp(struct atm_trafprm *tp, unsigned char aal)
                break;
        default:
                pr_warn("AAL problems ... (%d)\n", aal);
-               /* fall through */
+               fallthrough;
        case ATM_AAL5:
                max_sdu = ATM_MAX_AAL5_PDU;
        }
@@ -417,7 +417,7 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
        case ATM_NO_AAL:
                /* ATM_AAL5 is also used in the "0 for default" case */
                vcc->qos.aal = ATM_AAL5;
-               /* fall through */
+               fallthrough;
        case ATM_AAL5:
                error = atm_init_aal5(vcc);
                vcc->stats = &dev->stats.aal5;
index 875fc0bc17800c9bb6528cf6b828e4467d43d73e..b570ef919c28f057fc7dc54c4164b89d572c64b5 100644 (file)
@@ -380,7 +380,7 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
 
                if (mesg->content.normal.no_source_le_narp)
                        break;
-               /* FALL THROUGH */
+               fallthrough;
        case l_arp_update:
                lec_arp_update(priv, mesg->content.normal.mac_addr,
                               mesg->content.normal.atm_addr,
index 94bdc6527ee8a4341bbd3129d26bd9404422c41e..53236986dfe09c377c85f98d176ee7cde0c4bd9a 100644 (file)
@@ -266,7 +266,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                                goto done;
                        }
        }
-       /* fall through */
+               fallthrough;
        case ATM_SETESIF:
        {
                unsigned char esi[ESI_LEN];
@@ -288,7 +288,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                        error = -EPERM;
                        goto done;
                }
-               /* fall through */
+               fallthrough;
        case ATM_GETSTAT:
                size = sizeof(struct atm_dev_stats);
                error = fetch_stats(dev, buf, cmd == ATM_GETSTATZ);
@@ -361,7 +361,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                        error = -EINVAL;
                        goto done;
                }
-               /* fall through */
+               fallthrough;
        case ATM_SETCIRANGE:
        case SONET_GETSTATZ:
        case SONET_SETDIAG:
@@ -371,7 +371,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
                        error = -EPERM;
                        goto done;
                }
-               /* fall through */
+               fallthrough;
        default:
                if (IS_ENABLED(CONFIG_COMPAT) && compat) {
 #ifdef CONFIG_COMPAT
index 0f8495b9eeb1263c1784514f3b8616a724f2662f..717fe657561d909efd69297851cdbf4c0b6e36b2 100644 (file)
@@ -881,6 +881,12 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,
                   ntohl(ogm_packet->seqno), ogm_throughput, ogm_packet->ttl,
                   ogm_packet->version, ntohs(ogm_packet->tvlv_len));
 
+       if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) {
+               batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
+                          "Drop packet: originator packet from ourself\n");
+               return;
+       }
+
        /* If the throughput metric is 0, immediately drop the packet. No need
         * to create orig_node / neigh_node for an unusable route.
         */
@@ -1008,11 +1014,6 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,
        if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
                goto free_skb;
 
-       ogm_packet = (struct batadv_ogm2_packet *)skb->data;
-
-       if (batadv_is_my_mac(bat_priv, ogm_packet->orig))
-               goto free_skb;
-
        batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX);
        batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES,
                           skb->len + ETH_HLEN);
index 91a04ca373dc105a1821449c688d570ba72059ce..c350ab63cd54deff8661bc9c3fb17f4bd5b8dd97 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/lockdep.h>
 #include <linux/netdevice.h>
 #include <linux/netlink.h>
+#include <linux/preempt.h>
 #include <linux/rculist.h>
 #include <linux/rcupdate.h>
 #include <linux/seq_file.h>
@@ -83,11 +84,12 @@ static inline u32 batadv_choose_claim(const void *data, u32 size)
  */
 static inline u32 batadv_choose_backbone_gw(const void *data, u32 size)
 {
-       const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;
+       const struct batadv_bla_backbone_gw *gw;
        u32 hash = 0;
 
-       hash = jhash(&claim->addr, sizeof(claim->addr), hash);
-       hash = jhash(&claim->vid, sizeof(claim->vid), hash);
+       gw = (struct batadv_bla_backbone_gw *)data;
+       hash = jhash(&gw->orig, sizeof(gw->orig), hash);
+       hash = jhash(&gw->vid, sizeof(gw->vid), hash);
 
        return hash % size;
 }
@@ -437,7 +439,10 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
        batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
                           skb->len + ETH_HLEN);
 
-       netif_rx(skb);
+       if (in_interrupt())
+               netif_rx(skb);
+       else
+               netif_rx_ni(skb);
 out:
        if (primary_if)
                batadv_hardif_put(primary_if);
@@ -1576,13 +1581,16 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
 }
 
 /**
- * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup.
+ * batadv_bla_check_duplist() - Check if a frame is in the broadcast dup.
  * @bat_priv: the bat priv with all the soft interface information
- * @skb: contains the bcast_packet to be checked
+ * @skb: contains the multicast packet to be checked
+ * @payload_ptr: pointer to position inside the head buffer of the skb
+ *  marking the start of the data to be CRC'ed
+ * @orig: originator mac address, NULL if unknown
  *
- * check if it is on our broadcast list. Another gateway might
- * have sent the same packet because it is connected to the same backbone,
- * so we have to remove this duplicate.
+ * Check if it is on our broadcast list. Another gateway might have sent the
+ * same packet because it is connected to the same backbone, so we have to
+ * remove this duplicate.
  *
  * This is performed by checking the CRC, which will tell us
  * with a good chance that it is the same packet. If it is furthermore
@@ -1591,19 +1599,17 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
  *
  * Return: true if a packet is in the duplicate list, false otherwise.
  */
-bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
-                                   struct sk_buff *skb)
+static bool batadv_bla_check_duplist(struct batadv_priv *bat_priv,
+                                    struct sk_buff *skb, u8 *payload_ptr,
+                                    const u8 *orig)
 {
-       int i, curr;
-       __be32 crc;
-       struct batadv_bcast_packet *bcast_packet;
        struct batadv_bcast_duplist_entry *entry;
        bool ret = false;
-
-       bcast_packet = (struct batadv_bcast_packet *)skb->data;
+       int i, curr;
+       __be32 crc;
 
        /* calculate the crc ... */
-       crc = batadv_skb_crc32(skb, (u8 *)(bcast_packet + 1));
+       crc = batadv_skb_crc32(skb, payload_ptr);
 
        spin_lock_bh(&bat_priv->bla.bcast_duplist_lock);
 
@@ -1622,8 +1628,21 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
                if (entry->crc != crc)
                        continue;
 
-               if (batadv_compare_eth(entry->orig, bcast_packet->orig))
-                       continue;
+               /* are the originators both known and not anonymous? */
+               if (orig && !is_zero_ether_addr(orig) &&
+                   !is_zero_ether_addr(entry->orig)) {
+                       /* If known, check if the new frame came from
+                        * the same originator:
+                        * We are safe to take identical frames from the
+                        * same orig, if known, as multiplications in
+                        * the mesh are detected via the (orig, seqno) pair.
+                        * So we can be a bit more liberal here and allow
+                        * identical frames from the same orig which the source
+                        * host might have sent multiple times on purpose.
+                        */
+                       if (batadv_compare_eth(entry->orig, orig))
+                               continue;
+               }
 
                /* this entry seems to match: same crc, not too old,
                 * and from another gw. therefore return true to forbid it.
@@ -1639,7 +1658,14 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
        entry = &bat_priv->bla.bcast_duplist[curr];
        entry->crc = crc;
        entry->entrytime = jiffies;
-       ether_addr_copy(entry->orig, bcast_packet->orig);
+
+       /* known originator */
+       if (orig)
+               ether_addr_copy(entry->orig, orig);
+       /* anonymous originator */
+       else
+               eth_zero_addr(entry->orig);
+
        bat_priv->bla.bcast_duplist_curr = curr;
 
 out:
@@ -1648,6 +1674,48 @@ out:
        return ret;
 }
 
+/**
+ * batadv_bla_check_ucast_duplist() - Check if a frame is in the broadcast dup.
+ * @bat_priv: the bat priv with all the soft interface information
+ * @skb: contains the multicast packet to be checked, decapsulated from a
+ *  unicast_packet
+ *
+ * Check if it is on our broadcast list. Another gateway might have sent the
+ * same packet because it is connected to the same backbone, so we have to
+ * remove this duplicate.
+ *
+ * Return: true if a packet is in the duplicate list, false otherwise.
+ */
+static bool batadv_bla_check_ucast_duplist(struct batadv_priv *bat_priv,
+                                          struct sk_buff *skb)
+{
+       return batadv_bla_check_duplist(bat_priv, skb, (u8 *)skb->data, NULL);
+}
+
+/**
+ * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup.
+ * @bat_priv: the bat priv with all the soft interface information
+ * @skb: contains the bcast_packet to be checked
+ *
+ * Check if it is on our broadcast list. Another gateway might have sent the
+ * same packet because it is connected to the same backbone, so we have to
+ * remove this duplicate.
+ *
+ * Return: true if a packet is in the duplicate list, false otherwise.
+ */
+bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
+                                   struct sk_buff *skb)
+{
+       struct batadv_bcast_packet *bcast_packet;
+       u8 *payload_ptr;
+
+       bcast_packet = (struct batadv_bcast_packet *)skb->data;
+       payload_ptr = (u8 *)(bcast_packet + 1);
+
+       return batadv_bla_check_duplist(bat_priv, skb, payload_ptr,
+                                       bcast_packet->orig);
+}
+
 /**
  * batadv_bla_is_backbone_gw_orig() - Check if the originator is a gateway for
  *  the VLAN identified by vid.
@@ -1809,7 +1877,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb,
  * @bat_priv: the bat priv with all the soft interface information
  * @skb: the frame to be checked
  * @vid: the VLAN ID of the frame
- * @is_bcast: the packet came in a broadcast packet type.
+ * @packet_type: the batman packet type this frame came in
  *
  * batadv_bla_rx avoidance checks if:
  *  * we have to race for a claim
@@ -1821,7 +1889,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb,
  * further process the skb.
  */
 bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
-                  unsigned short vid, bool is_bcast)
+                  unsigned short vid, int packet_type)
 {
        struct batadv_bla_backbone_gw *backbone_gw;
        struct ethhdr *ethhdr;
@@ -1843,9 +1911,32 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
                goto handled;
 
        if (unlikely(atomic_read(&bat_priv->bla.num_requests)))
-               /* don't allow broadcasts while requests are in flight */
-               if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast)
-                       goto handled;
+               /* don't allow multicast packets while requests are in flight */
+               if (is_multicast_ether_addr(ethhdr->h_dest))
+                       /* Both broadcast flooding or multicast-via-unicasts
+                        * delivery might send to multiple backbone gateways
+                        * sharing the same LAN and therefore need to coordinate
+                        * which backbone gateway forwards into the LAN,
+                        * by claiming the payload source address.
+                        *
+                        * Broadcast flooding and multicast-via-unicasts
+                        * delivery use the following two batman packet types.
+                        * Note: explicitly exclude BATADV_UNICAST_4ADDR,
+                        * as the DHCP gateway feature will send explicitly
+                        * to only one BLA gateway, so the claiming process
+                        * should be avoided there.
+                        */
+                       if (packet_type == BATADV_BCAST ||
+                           packet_type == BATADV_UNICAST)
+                               goto handled;
+
+       /* potential duplicates from foreign BLA backbone gateways via
+        * multicast-in-unicast packets
+        */
+       if (is_multicast_ether_addr(ethhdr->h_dest) &&
+           packet_type == BATADV_UNICAST &&
+           batadv_bla_check_ucast_duplist(bat_priv, skb))
+               goto handled;
 
        ether_addr_copy(search_claim.addr, ethhdr->h_source);
        search_claim.vid = vid;
@@ -1880,13 +1971,14 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
                goto allow;
        }
 
-       /* if it is a broadcast ... */
-       if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) {
+       /* if it is a multicast ... */
+       if (is_multicast_ether_addr(ethhdr->h_dest) &&
+           (packet_type == BATADV_BCAST || packet_type == BATADV_UNICAST)) {
                /* ... drop it. the responsible gateway is in charge.
                 *
-                * We need to check is_bcast because with the gateway
+                * We need to check packet type because with the gateway
                 * feature, broadcasts (like DHCP requests) may be sent
-                * using a unicast packet type.
+                * using a unicast 4 address packet type. See comment above.
                 */
                goto handled;
        } else {
index 41edb2c4a3277032d807100783d22a404414d49e..a81c41b636f9310d1aa9042dce1451aa62f3e55c 100644 (file)
@@ -35,7 +35,7 @@ static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac)
 
 #ifdef CONFIG_BATMAN_ADV_BLA
 bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
-                  unsigned short vid, bool is_bcast);
+                  unsigned short vid, int packet_type);
 bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
                   unsigned short vid);
 bool batadv_bla_is_backbone_gw(struct sk_buff *skb,
@@ -66,7 +66,7 @@ bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr,
 
 static inline bool batadv_bla_rx(struct batadv_priv *bat_priv,
                                 struct sk_buff *skb, unsigned short vid,
-                                bool is_bcast)
+                                int packet_type)
 {
        return false;
 }
index a18dcc686dc315c621ed0da23dbed218ba1843c5..ef3f85b576c4c7cc6b0a7d2c2c3e987b53218291 100644 (file)
@@ -703,8 +703,10 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len,
 
        chaddr_offset = *header_len + BATADV_DHCP_CHADDR_OFFSET;
        /* store the client address if the message is going to a client */
-       if (ret == BATADV_DHCP_TO_CLIENT &&
-           pskb_may_pull(skb, chaddr_offset + ETH_ALEN)) {
+       if (ret == BATADV_DHCP_TO_CLIENT) {
+               if (!pskb_may_pull(skb, chaddr_offset + ETH_ALEN))
+                       return BATADV_DHCP_NO;
+
                /* check if the DHCP packet carries an Ethernet DHCP */
                p = skb->data + *header_len + BATADV_DHCP_HTYPE_OFFSET;
                if (*p != BATADV_DHCP_HTYPE_ETHERNET)
index bdc4a1fba1c6e3dcd580487b26f8a317fa645b82..ca24a2e522b79f085fc703d03cd355d0e299ce2f 100644 (file)
@@ -51,6 +51,7 @@
 #include <uapi/linux/batadv_packet.h>
 #include <uapi/linux/batman_adv.h>
 
+#include "bridge_loop_avoidance.h"
 #include "hard-interface.h"
 #include "hash.h"
 #include "log.h"
@@ -1434,6 +1435,35 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
        return BATADV_FORW_ALL;
 }
 
+/**
+ * batadv_mcast_forw_send_orig() - send a multicast packet to an originator
+ * @bat_priv: the bat priv with all the soft interface information
+ * @skb: the multicast packet to send
+ * @vid: the vlan identifier
+ * @orig_node: the originator to send the packet to
+ *
+ * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
+ */
+int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
+                               struct sk_buff *skb,
+                               unsigned short vid,
+                               struct batadv_orig_node *orig_node)
+{
+       /* Avoid sending multicast-in-unicast packets to other BLA
+        * gateways - they already got the frame from the LAN side
+        * we share with them.
+        * TODO: Refactor to take BLA into account earlier, to avoid
+        * reducing the mcast_fanout count.
+        */
+       if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) {
+               dev_kfree_skb(skb);
+               return NET_XMIT_SUCCESS;
+       }
+
+       return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0,
+                                      orig_node, vid);
+}
+
 /**
  * batadv_mcast_forw_tt() - forwards a packet to multicast listeners
  * @bat_priv: the bat priv with all the soft interface information
@@ -1471,8 +1501,8 @@ batadv_mcast_forw_tt(struct batadv_priv *bat_priv, struct sk_buff *skb,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_entry->orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid,
+                                           orig_entry->orig_node);
        }
        rcu_read_unlock();
 
@@ -1513,8 +1543,7 @@ batadv_mcast_forw_want_all_ipv4(struct batadv_priv *bat_priv,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
        }
        rcu_read_unlock();
        return ret;
@@ -1551,8 +1580,7 @@ batadv_mcast_forw_want_all_ipv6(struct batadv_priv *bat_priv,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
        }
        rcu_read_unlock();
        return ret;
@@ -1618,8 +1646,7 @@ batadv_mcast_forw_want_all_rtr4(struct batadv_priv *bat_priv,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
        }
        rcu_read_unlock();
        return ret;
@@ -1656,8 +1683,7 @@ batadv_mcast_forw_want_all_rtr6(struct batadv_priv *bat_priv,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
        }
        rcu_read_unlock();
        return ret;
index ebf825991ecd963e3cf284b625b9aa3ed456f2df..3e114bc5ca3bb84b09041aa5b4f522d4388c8a3d 100644 (file)
@@ -46,6 +46,11 @@ enum batadv_forw_mode
 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
                       struct batadv_orig_node **mcast_single_orig);
 
+int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
+                               struct sk_buff *skb,
+                               unsigned short vid,
+                               struct batadv_orig_node *orig_node);
+
 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
                           unsigned short vid);
 
@@ -71,6 +76,16 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
        return BATADV_FORW_ALL;
 }
 
+static inline int
+batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
+                           struct sk_buff *skb,
+                           unsigned short vid,
+                           struct batadv_orig_node *orig_node)
+{
+       kfree_skb(skb);
+       return NET_XMIT_DROP;
+}
+
 static inline int
 batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
                       unsigned short vid)
index 27cdf5e4349a4b36bce1f224a75dbf7c1a0e05cb..9e5c71e406ffc6e3632944b867be274a3ebd4679 100644 (file)
@@ -826,6 +826,10 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
        vid = batadv_get_vid(skb, hdr_len);
        ethhdr = (struct ethhdr *)(skb->data + hdr_len);
 
+       /* do not reroute multicast frames in a unicast header */
+       if (is_multicast_ether_addr(ethhdr->h_dest))
+               return true;
+
        /* check if the destination client was served by this node and it is now
         * roaming. In this case, it means that the node has got a ROAM_ADV
         * message and that it knows the new destination in the mesh to re-route
index 23833a0ba5e6d953f3cad221870bb1245db827f2..cdde943c1b833dc684cae6d1ae90d48d6ee2963a 100644 (file)
@@ -364,9 +364,8 @@ send:
                                goto dropped;
                        ret = batadv_send_skb_via_gw(bat_priv, skb, vid);
                } else if (mcast_single_orig) {
-                       ret = batadv_send_skb_unicast(bat_priv, skb,
-                                                     BATADV_UNICAST, 0,
-                                                     mcast_single_orig, vid);
+                       ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid,
+                                                         mcast_single_orig);
                } else if (forw_mode == BATADV_FORW_SOME) {
                        ret = batadv_mcast_forw_send(bat_priv, skb, vid);
                } else {
@@ -425,10 +424,10 @@ void batadv_interface_rx(struct net_device *soft_iface,
        struct vlan_ethhdr *vhdr;
        struct ethhdr *ethhdr;
        unsigned short vid;
-       bool is_bcast;
+       int packet_type;
 
        batadv_bcast_packet = (struct batadv_bcast_packet *)skb->data;
-       is_bcast = (batadv_bcast_packet->packet_type == BATADV_BCAST);
+       packet_type = batadv_bcast_packet->packet_type;
 
        skb_pull_rcsum(skb, hdr_size);
        skb_reset_mac_header(skb);
@@ -471,7 +470,7 @@ void batadv_interface_rx(struct net_device *soft_iface,
        /* Let the bridge loop avoidance check the packet. If will
         * not handle it, we can safely push it up.
         */
-       if (batadv_bla_rx(bat_priv, skb, vid, is_bcast))
+       if (batadv_bla_rx(bat_priv, skb, vid, packet_type))
                goto out;
 
        if (orig_node)
index 99eb8c6c0fbccee91de7f3853c470301fe26263c..a66f211726e7c98cce2da4a422331c48e1508f82 100644 (file)
@@ -425,7 +425,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
        case BPF_PROG_TYPE_SCHED_CLS:
        case BPF_PROG_TYPE_SCHED_ACT:
                is_l2 = true;
-               /* fall through */
+               fallthrough;
        case BPF_PROG_TYPE_LWT_IN:
        case BPF_PROG_TYPE_LWT_OUT:
        case BPF_PROG_TYPE_LWT_XMIT:
index f9092c71225fd3d91efc594d0a3786ffe468841f..61c94cefa8436d2ed517f009c0f3fbd6d3dec371 100644 (file)
@@ -1288,11 +1288,13 @@ void br_vlan_get_stats(const struct net_bridge_vlan *v,
        }
 }
 
-static int __br_vlan_get_pvid(const struct net_device *dev,
-                             struct net_bridge_port *p, u16 *p_pvid)
+int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
 {
        struct net_bridge_vlan_group *vg;
+       struct net_bridge_port *p;
 
+       ASSERT_RTNL();
+       p = br_port_get_check_rtnl(dev);
        if (p)
                vg = nbp_vlan_group(p);
        else if (netif_is_bridge_master(dev))
@@ -1303,18 +1305,23 @@ static int __br_vlan_get_pvid(const struct net_device *dev,
        *p_pvid = br_get_pvid(vg);
        return 0;
 }
-
-int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
-{
-       ASSERT_RTNL();
-
-       return __br_vlan_get_pvid(dev, br_port_get_check_rtnl(dev), p_pvid);
-}
 EXPORT_SYMBOL_GPL(br_vlan_get_pvid);
 
 int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
 {
-       return __br_vlan_get_pvid(dev, br_port_get_check_rcu(dev), p_pvid);
+       struct net_bridge_vlan_group *vg;
+       struct net_bridge_port *p;
+
+       p = br_port_get_check_rcu(dev);
+       if (p)
+               vg = nbp_vlan_group_rcu(p);
+       else if (netif_is_bridge_master(dev))
+               vg = br_vlan_group_rcu(netdev_priv(dev));
+       else
+               return -EINVAL;
+
+       *p_pvid = br_get_pvid(vg);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(br_vlan_get_pvid_rcu);
 
index ce2767e9cec6582dcb970270ce91be0c6e9799ad..7b0af33bdb97fd6ef1c15c6028993ee942b5806c 100644 (file)
@@ -116,7 +116,7 @@ static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt)
        if (segmented) {
                if (rfml->incomplete_frm == NULL) {
                        /* Initial Segment */
-                       if (cfpkt_peek_head(pkt, rfml->seghead, 6) < 0)
+                       if (cfpkt_peek_head(pkt, rfml->seghead, 6) != 0)
                                goto out;
 
                        rfml->pdu_size = get_unaligned_le16(rfml->seghead+4);
@@ -233,7 +233,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt)
        if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE)
                err = cfpkt_peek_head(pkt, head, 6);
 
-       if (err < 0)
+       if (err != 0)
                goto out;
 
        while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) {
index b93876c57fc48f5b9483c7021b4ba7ce4cd3e5a6..1be4c898b2fa884b96c3363a1dca09279f541e89 100644 (file)
@@ -1086,7 +1086,7 @@ static int j1939_sk_send_loop(struct j1939_priv *priv,  struct sock *sk,
                break;
        case -ERESTARTSYS:
                ret = -EINTR;
-               /* fall through */
+               fallthrough;
        case -EAGAIN: /* OK */
                if (todo_size != size)
                        ret = size - todo_size;
index a8dd956b5e8e1cb66e4d3be1669d8d9bd7e111fd..0cec4152f9797c51b1cf93c2e9efb91d9a71239d 100644 (file)
@@ -860,7 +860,7 @@ static int j1939_xtp_txnext_transmiter(struct j1939_session *session)
                                return ret;
                }
 
-               /* fall through */
+               fallthrough;
        case J1939_TP_CMD_CTS:
        case 0xff: /* did some data */
        case J1939_ETP_CMD_DPO:
@@ -1764,12 +1764,12 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
        case J1939_ETP_CMD_DPO:
                if (skcb->addr.type == J1939_ETP)
                        break;
-               /* fall through */
-       case J1939_TP_CMD_BAM: /* fall through */
+               fallthrough;
+       case J1939_TP_CMD_BAM:
        case J1939_TP_CMD_CTS: /* fall through */
                if (skcb->addr.type != J1939_ETP)
                        break;
-               /* fall through */
+               fallthrough;
        default:
                netdev_info(priv->ndev, "%s: 0x%p: last %02x\n", __func__,
                            session, session->last_cmd);
@@ -1965,8 +1965,8 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)
        switch (cmd) {
        case J1939_ETP_CMD_RTS:
                extd = J1939_ETP;
-               /* fall through */
-       case J1939_TP_CMD_BAM: /* fall through */
+               fallthrough;
+       case J1939_TP_CMD_BAM:
        case J1939_TP_CMD_RTS: /* fall through */
                if (skcb->addr.type != extd)
                        return;
@@ -1987,7 +1987,7 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)
 
        case J1939_ETP_CMD_CTS:
                extd = J1939_ETP;
-               /* fall through */
+               fallthrough;
        case J1939_TP_CMD_CTS:
                if (skcb->addr.type != extd)
                        return;
@@ -2014,7 +2014,7 @@ static void j1939_tp_cmd_recv(struct j1939_priv *priv, struct sk_buff *skb)
 
        case J1939_ETP_CMD_EOMA:
                extd = J1939_ETP;
-               /* fall through */
+               fallthrough;
        case J1939_TP_CMD_EOMA:
                if (skcb->addr.type != extd)
                        return;
@@ -2050,14 +2050,14 @@ int j1939_tp_recv(struct j1939_priv *priv, struct sk_buff *skb)
        switch (skcb->addr.pgn) {
        case J1939_ETP_PGN_DAT:
                skcb->addr.type = J1939_ETP;
-               /* fall through */
+               fallthrough;
        case J1939_TP_PGN_DAT:
                j1939_xtp_rx_dat(priv, skb);
                break;
 
        case J1939_ETP_PGN_CTL:
                skcb->addr.type = J1939_ETP;
-               /* fall through */
+               fallthrough;
        case J1939_TP_PGN_CTL:
                if (skb->len < 8)
                        return 0; /* Don't care. Nothing to extract here */
index 81e1e006c5404ddb3d18c78d4bb89850cde198e1..16a47c0eef374dbe6efbd2bb20f518c25a038761 100644 (file)
@@ -50,35 +50,35 @@ unsigned int ceph_str_hash_rjenkins(const char *str, unsigned int length)
        switch (len) {
        case 11:
                c = c + ((__u32)k[10] << 24);
-               /* fall through */
+               fallthrough;
        case 10:
                c = c + ((__u32)k[9] << 16);
-               /* fall through */
+               fallthrough;
        case 9:
                c = c + ((__u32)k[8] << 8);
                /* the first byte of c is reserved for the length */
-               /* fall through */
+               fallthrough;
        case 8:
                b = b + ((__u32)k[7] << 24);
-               /* fall through */
+               fallthrough;
        case 7:
                b = b + ((__u32)k[6] << 16);
-               /* fall through */
+               fallthrough;
        case 6:
                b = b + ((__u32)k[5] << 8);
-               /* fall through */
+               fallthrough;
        case 5:
                b = b + k[4];
-               /* fall through */
+               fallthrough;
        case 4:
                a = a + ((__u32)k[3] << 24);
-               /* fall through */
+               fallthrough;
        case 3:
                a = a + ((__u32)k[2] << 16);
-               /* fall through */
+               fallthrough;
        case 2:
                a = a + ((__u32)k[1] << 8);
-               /* fall through */
+               fallthrough;
        case 1:
                a = a + k[0];
                /* case 0: nothing left to add */
index 07e5614eb3f161457ac5120c668330734d47031f..7057f8db4f99a1b2092c649a5d55e6375b608077 100644 (file)
@@ -987,7 +987,7 @@ int crush_do_rule(const struct crush_map *map,
                case CRUSH_RULE_CHOOSELEAF_FIRSTN:
                case CRUSH_RULE_CHOOSE_FIRSTN:
                        firstn = 1;
-                       /* fall through */
+                       fallthrough;
                case CRUSH_RULE_CHOOSELEAF_INDEP:
                case CRUSH_RULE_CHOOSE_INDEP:
                        if (wsize == 0)
index 27d6ab11f9ee87a756ee5b6dc23247e4204156c1..bdfd66ba3843146ca2e45fbc5a0e4affcc203758 100644 (file)
@@ -412,7 +412,7 @@ static void ceph_sock_state_change(struct sock *sk)
        switch (sk->sk_state) {
        case TCP_CLOSE:
                dout("%s TCP_CLOSE\n", __func__);
-               /* fall through */
+               fallthrough;
        case TCP_CLOSE_WAIT:
                dout("%s TCP_CLOSE_WAIT\n", __func__);
                con_sock_state_closing(con);
@@ -2751,7 +2751,7 @@ more:
                        switch (ret) {
                        case -EBADMSG:
                                con->error_msg = "bad crc/signature";
-                               /* fall through */
+                               fallthrough;
                        case -EBADE:
                                ret = -EIO;
                                break;
index 3d8c8015e976fe8bb1d9708cd76bce1f1426981c..d633a0aeaa5525f8196eaa7881d258da402ba5d2 100644 (file)
@@ -1307,7 +1307,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
                 * request had a non-zero tid.  Work around this weirdness
                 * by allocating a new message.
                 */
-               /* fall through */
+               fallthrough;
        case CEPH_MSG_MON_MAP:
        case CEPH_MSG_MDS_MAP:
        case CEPH_MSG_OSD_MAP:
index e4fbcad6e7d83c580adc1396aed4bc8e61f9d0a1..7901ab6c79fd2aca7df36a998c2a23df860e2fe4 100644 (file)
@@ -3854,7 +3854,7 @@ static void scan_requests(struct ceph_osd *osd,
                        if (!force_resend && !force_resend_writes)
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case CALC_TARGET_NEED_RESEND:
                        cancel_linger_map_check(lreq);
                        /*
@@ -3891,7 +3891,7 @@ static void scan_requests(struct ceph_osd *osd,
                             !force_resend_writes))
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case CALC_TARGET_NEED_RESEND:
                        cancel_map_check(req);
                        unlink_request(osd, req);
index d42c9ea0c3c03764816d02bcdccc668f61042284..266073e300b5fc21440ea8f8ffc9306a1fc9f370 100644 (file)
@@ -4690,10 +4690,10 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
                break;
        default:
                bpf_warn_invalid_xdp_action(act);
-               /* fall through */
+               fallthrough;
        case XDP_ABORTED:
                trace_xdp_exception(skb->dev, xdp_prog, act);
-               /* fall through */
+               fallthrough;
        case XDP_DROP:
        do_drop:
                kfree_skb(skb);
@@ -6612,12 +6612,13 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
                netdev_err_once(dev, "%s() called with weight %d\n", __func__,
                                weight);
        napi->weight = weight;
-       list_add(&napi->dev_list, &dev->napi_list);
        napi->dev = dev;
 #ifdef CONFIG_NETPOLL
        napi->poll_owner = -1;
 #endif
        set_bit(NAPI_STATE_SCHED, &napi->state);
+       set_bit(NAPI_STATE_NPSVC, &napi->state);
+       list_add_rcu(&napi->dev_list, &dev->napi_list);
        napi_hash_add(napi);
 }
 EXPORT_SYMBOL(netif_napi_add);
@@ -8646,7 +8647,7 @@ int dev_get_port_parent_id(struct net_device *dev,
                if (!first.id_len)
                        first = *ppid;
                else if (memcmp(&first, ppid, sizeof(*ppid)))
-                       return -ENODATA;
+                       return -EOPNOTSUPP;
        }
 
        return err;
index b2cf9b7bb7b8c328259fec9934cf4def07831532..205e92e604ef7ef04fc8379789554cfb6308b9ef 100644 (file)
@@ -322,7 +322,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
                err = net_hwtstamp_validate(ifr);
                if (err)
                        return err;
-               /* fall through */
+               fallthrough;
 
        /*
         *      Unknown or private ioctl
@@ -478,7 +478,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr, bool *need_c
        case SIOCSIFTXQLEN:
                if (!capable(CAP_NET_ADMIN))
                        return -EPERM;
-               /* fall through */
+               fallthrough;
        /*
         *      These ioctl calls:
         *      - require local superuser power.
@@ -503,7 +503,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr, bool *need_c
        case SIOCSHWTSTAMP:
                if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
-               /* fall through */
+               fallthrough;
        case SIOCBONDSLAVEINFOQUERY:
        case SIOCBONDINFOQUERY:
                dev_load(net, ifr->ifr_name);
index e5feb87beca7c48772ad07dec5777bd89c0d7947..80ec1cd81c6475fd6c5dcb37baeb7203b2ef687d 100644 (file)
@@ -6196,8 +6196,8 @@ devlink_trap_action_get_from_info(struct genl_info *info,
 
        val = nla_get_u8(info->attrs[DEVLINK_ATTR_TRAP_ACTION]);
        switch (val) {
-       case DEVLINK_TRAP_ACTION_DROP: /* fall-through */
-       case DEVLINK_TRAP_ACTION_TRAP: /* fall-through */
+       case DEVLINK_TRAP_ACTION_DROP:
+       case DEVLINK_TRAP_ACTION_TRAP:
        case DEVLINK_TRAP_ACTION_MIRROR:
                *p_trap_action = val;
                break;
index b09bebeadf0b2921039413dea5f8be2edb556c65..9704522b08721c7c4cd37cfafb520aab3209fdf0 100644 (file)
@@ -1189,7 +1189,7 @@ static int net_dm_alert_mode_get_from_info(struct genl_info *info,
        val = nla_get_u8(info->attrs[NET_DM_ATTR_ALERT_MODE]);
 
        switch (val) {
-       case NET_DM_ALERT_MODE_SUMMARY: /* fall-through */
+       case NET_DM_ALERT_MODE_SUMMARY:
        case NET_DM_ALERT_MODE_PACKET:
                *p_alert_mode = val;
                break;
index d6b6ced0d451a39c0ccb88ae39dba225ea9f5705..0c01bd8d9d81eb09e9a47ac9cd830a9efe5541dd 100644 (file)
@@ -144,7 +144,7 @@ static void dst_destroy_rcu(struct rcu_head *head)
 
 /* Operations to mark dst as DEAD and clean up the net device referenced
  * by dst:
- * 1. put the dst under loopback interface and discard all tx/rx packets
+ * 1. put the dst under blackhole interface and discard all tx/rx packets
  *    on this route.
  * 2. release the net_device
  * This function should be called when removing routes from the fib tree
index 51678a528f85accf13c065f0337d8262c2fff4e1..7bcfb16854cbb436c3d5068bfd8b96e29b54bf17 100644 (file)
@@ -16,7 +16,7 @@
 #include <net/ip_tunnels.h>
 #include <linux/indirect_call_wrapper.h>
 
-#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+#if defined(CONFIG_IPV6) && defined(CONFIG_IPV6_MULTIPLE_TABLES)
 #ifdef CONFIG_IP_MULTIPLE_TABLES
 #define INDIRECT_CALL_MT(f, f2, f1, ...) \
        INDIRECT_CALL_INET(f, f2, f1, __VA_ARGS__)
index b2df52086445f46617bfe6d865b780a74092522d..21eaf3b182f2fb5a3c1d128ab737a8282125f9fd 100644 (file)
@@ -4838,6 +4838,7 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
        fl4.saddr = params->ipv4_src;
        fl4.fl4_sport = params->sport;
        fl4.fl4_dport = params->dport;
+       fl4.flowi4_multipath_hash = 0;
 
        if (flags & BPF_FIB_LOOKUP_DIRECT) {
                u32 tbid = l3mdev_fib_table_rcu(dev) ? : RT_TABLE_MAIN;
@@ -7065,8 +7066,6 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig,
        bool indirect = BPF_MODE(orig->code) == BPF_IND;
        struct bpf_insn *insn = insn_buf;
 
-       /* We're guaranteed here that CTX is in R6. */
-       *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX);
        if (!indirect) {
                *insn++ = BPF_MOV64_IMM(BPF_REG_2, orig->imm);
        } else {
@@ -7074,6 +7073,8 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig,
                if (orig->imm)
                        *insn++ = BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, orig->imm);
        }
+       /* We're guaranteed here that CTX is in R6. */
+       *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX);
 
        switch (BPF_SIZE(orig->code)) {
        case BPF_B:
@@ -9223,7 +9224,7 @@ sk_reuseport_is_valid_access(int off, int size,
        case bpf_ctx_range(struct sk_reuseport_md, eth_protocol):
                if (size < sizeof_field(struct sk_buff, protocol))
                        return false;
-               /* fall through */
+               fallthrough;
        case bpf_ctx_range(struct sk_reuseport_md, ip_protocol):
        case bpf_ctx_range(struct sk_reuseport_md, bind_inany):
        case bpf_ctx_range(struct sk_reuseport_md, len):
@@ -9522,7 +9523,7 @@ BPF_CALL_1(bpf_skc_to_tcp6_sock, struct sock *, sk)
         * trigger an explicit type generation here.
         */
        BTF_TYPE_EMIT(struct tcp6_sock);
-       if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP &&
+       if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP &&
            sk->sk_family == AF_INET6)
                return (unsigned long)sk;
 
@@ -9540,7 +9541,7 @@ const struct bpf_func_proto bpf_skc_to_tcp6_sock_proto = {
 
 BPF_CALL_1(bpf_skc_to_tcp_sock, struct sock *, sk)
 {
-       if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP)
+       if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP)
                return (unsigned long)sk;
 
        return (unsigned long)NULL;
@@ -9558,12 +9559,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_sock_proto = {
 BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk)
 {
 #ifdef CONFIG_INET
-       if (sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT)
+       if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT)
                return (unsigned long)sk;
 #endif
 
 #if IS_BUILTIN(CONFIG_IPV6)
-       if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_TIME_WAIT)
+       if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_TIME_WAIT)
                return (unsigned long)sk;
 #endif
 
@@ -9582,12 +9583,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto = {
 BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk)
 {
 #ifdef CONFIG_INET
-       if (sk->sk_prot == &tcp_prot  && sk->sk_state == TCP_NEW_SYN_RECV)
+       if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_NEW_SYN_RECV)
                return (unsigned long)sk;
 #endif
 
 #if IS_BUILTIN(CONFIG_IPV6)
-       if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_NEW_SYN_RECV)
+       if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_NEW_SYN_RECV)
                return (unsigned long)sk;
 #endif
 
@@ -9609,7 +9610,7 @@ BPF_CALL_1(bpf_skc_to_udp6_sock, struct sock *, sk)
         * trigger an explicit type generation here.
         */
        BTF_TYPE_EMIT(struct udp6_sock);
-       if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_UDP &&
+       if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_UDP &&
            sk->sk_type == SOCK_DGRAM && sk->sk_family == AF_INET6)
                return (unsigned long)sk;
 
index dcd61aca343eca7247c127a18be840c2d1a79d34..944ab214e5ae85acff024d62e03a21fb952207e9 100644 (file)
@@ -251,10 +251,10 @@ int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp)
        if (refcount_read(&net->count) == 0)
                return NETNSA_NSID_NOT_ASSIGNED;
 
-       spin_lock(&net->nsid_lock);
+       spin_lock_bh(&net->nsid_lock);
        id = __peernet2id(net, peer);
        if (id >= 0) {
-               spin_unlock(&net->nsid_lock);
+               spin_unlock_bh(&net->nsid_lock);
                return id;
        }
 
@@ -264,12 +264,12 @@ int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp)
         * just been idr_remove()'d from there in cleanup_net().
         */
        if (!maybe_get_net(peer)) {
-               spin_unlock(&net->nsid_lock);
+               spin_unlock_bh(&net->nsid_lock);
                return NETNSA_NSID_NOT_ASSIGNED;
        }
 
        id = alloc_netid(net, peer, -1);
-       spin_unlock(&net->nsid_lock);
+       spin_unlock_bh(&net->nsid_lock);
 
        put_net(peer);
        if (id < 0)
@@ -534,20 +534,20 @@ static void unhash_nsid(struct net *net, struct net *last)
        for_each_net(tmp) {
                int id;
 
-               spin_lock(&tmp->nsid_lock);
+               spin_lock_bh(&tmp->nsid_lock);
                id = __peernet2id(tmp, net);
                if (id >= 0)
                        idr_remove(&tmp->netns_ids, id);
-               spin_unlock(&tmp->nsid_lock);
+               spin_unlock_bh(&tmp->nsid_lock);
                if (id >= 0)
                        rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL,
                                          GFP_KERNEL);
                if (tmp == last)
                        break;
        }
-       spin_lock(&net->nsid_lock);
+       spin_lock_bh(&net->nsid_lock);
        idr_destroy(&net->netns_ids);
-       spin_unlock(&net->nsid_lock);
+       spin_unlock_bh(&net->nsid_lock);
 }
 
 static LLIST_HEAD(cleanup_list);
@@ -760,9 +760,9 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh,
                return PTR_ERR(peer);
        }
 
-       spin_lock(&net->nsid_lock);
+       spin_lock_bh(&net->nsid_lock);
        if (__peernet2id(net, peer) >= 0) {
-               spin_unlock(&net->nsid_lock);
+               spin_unlock_bh(&net->nsid_lock);
                err = -EEXIST;
                NL_SET_BAD_ATTR(extack, nla);
                NL_SET_ERR_MSG(extack,
@@ -771,7 +771,7 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh,
        }
 
        err = alloc_netid(net, peer, nsid);
-       spin_unlock(&net->nsid_lock);
+       spin_unlock_bh(&net->nsid_lock);
        if (err >= 0) {
                rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid,
                                  nlh, GFP_KERNEL);
index 093e90e52bc25411806fe2f3d04ca27cab47ec32..2338753e936b7188d7d0ccb350cee8a34dd88172 100644 (file)
@@ -162,7 +162,7 @@ static void poll_napi(struct net_device *dev)
        struct napi_struct *napi;
        int cpu = smp_processor_id();
 
-       list_for_each_entry(napi, &dev->napi_list, dev_list) {
+       list_for_each_entry_rcu(napi, &dev->napi_list, dev_list) {
                if (cmpxchg(&napi->poll_owner, -1, cpu) == -1) {
                        poll_one_napi(napi);
                        smp_store_release(&napi->poll_owner, -1);
index b53b6d38c4dff8b73423f19d7efc84b00166f136..44fdbb9c6e5347c08a624a07aa9fe616ab3ed4ae 100644 (file)
@@ -3430,7 +3430,7 @@ xmit_more:
                net_info_ratelimited("%s xmit error: %d\n",
                                     pkt_dev->odevname, ret);
                pkt_dev->errors++;
-               /* fall through */
+               fallthrough;
        case NETDEV_TX_BUSY:
                /* Retry it next time */
                refcount_dec(&(pkt_dev->skb->users));
@@ -3699,7 +3699,7 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn)
                                   cpu_to_node(cpu),
                                   "kpktgend_%d", cpu);
        if (IS_ERR(p)) {
-               pr_err("kernel_thread() failed for cpu %d\n", t->cpu);
+               pr_err("kthread_create_on_node() failed for cpu %d\n", t->cpu);
                list_del(&t->th_list);
                kfree(t);
                return PTR_ERR(p);
index e18184ffa9c3fa65426979be78257cfaf9776a4c..6faf73d6a0f7431cd96a853b652fce68916c477f 100644 (file)
@@ -820,6 +820,7 @@ void skb_tx_error(struct sk_buff *skb)
 }
 EXPORT_SYMBOL(skb_tx_error);
 
+#ifdef CONFIG_TRACEPOINTS
 /**
  *     consume_skb - free an skbuff
  *     @skb: buffer to free
@@ -837,6 +838,7 @@ void consume_skb(struct sk_buff *skb)
        __kfree_skb(skb);
 }
 EXPORT_SYMBOL(consume_skb);
+#endif
 
 /**
  *     consume_stateless_skb - free an skbuff, assuming it is stateless
index 6a32a1fd34f8cd1306a43f1f14bd6e038ff2efe6..649583158983a9e79ffa236c86dc8a26bb9060fd 100644 (file)
@@ -772,7 +772,6 @@ static void sk_psock_verdict_apply(struct sk_psock *psock,
                sk_psock_skb_redirect(skb);
                break;
        case __SK_DROP:
-               /* fall-through */
        default:
 out_free:
                kfree_skb(skb);
index e4f40b175acb7909602334301dd20c9de50a5e3e..6c5c6b18eff4c5271fd3d510f7a370122ab91964 100644 (file)
@@ -1008,7 +1008,7 @@ set_sndbuf:
                break;
        case SO_TIMESTAMPING_NEW:
                sock_set_flag(sk, SOCK_TSTAMP_NEW);
-               /* fall through */
+               fallthrough;
        case SO_TIMESTAMPING_OLD:
                if (val & ~SOF_TIMESTAMPING_MASK) {
                        ret = -EINVAL;
@@ -3254,7 +3254,7 @@ void sk_common_release(struct sock *sk)
                sk->sk_prot->destroy(sk);
 
        /*
-        * Observation: when sock_common_release is called, processes have
+        * Observation: when sk_common_release is called, processes have
         * no access to socket. But net still has.
         * Step one, detach it from networking:
         *
index 84dde5a2066eaf1a5d008a1cbc03484bcfd86a32..16014ad194066750f3715b7efd8d16c11906287f 100644 (file)
@@ -1426,6 +1426,7 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh,
 {
        const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
        struct nlattr *ieee[DCB_ATTR_IEEE_MAX + 1];
+       int prio;
        int err;
 
        if (!ops)
@@ -1475,6 +1476,13 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh,
                struct dcbnl_buffer *buffer =
                        nla_data(ieee[DCB_ATTR_DCB_BUFFER]);
 
+               for (prio = 0; prio < ARRAY_SIZE(buffer->prio2buffer); prio++) {
+                       if (buffer->prio2buffer[prio] >= DCBX_MAX_BUFFERS) {
+                               err = -EINVAL;
+                               goto err;
+                       }
+               }
+
                err = ops->dcbnl_setbuffer(netdev, buffer);
                if (err)
                        goto err;
index aef72f6a28291faaaddebfaf5b6161ff28848f6d..b9ee1a4a895548aa2d5023441505a59227f4106e 100644 (file)
@@ -608,7 +608,7 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk,
                 */
                if (hc->rx_x_recv > 0)
                        break;
-               /* fall through */
+               fallthrough;
        case CCID3_FBACK_PERIODIC:
                delta = ktime_us_delta(now, hc->rx_tstamp_last_feedback);
                if (delta <= 0)
index afc071ea1271e476520388f8310664d56fa6eb67..788dd629c4204af3178b8283da804c828b6ec1e5 100644 (file)
@@ -1407,7 +1407,8 @@ int dccp_feat_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
         *      Negotiation during connection setup
         */
        case DCCP_LISTEN:
-               server = true;                  /* fall through */
+               server = true;
+               fallthrough;
        case DCCP_REQUESTING:
                switch (opt) {
                case DCCPO_CHANGE_L:
index bd9cfdb67436c226899b7270597b49f2bf88fd4f..2cbb757a894f87ef79d3435865f37a49d313d928 100644 (file)
@@ -64,7 +64,7 @@ static int dccp_rcv_close(struct sock *sk, struct sk_buff *skb)
                 */
                if (dccp_sk(sk)->dccps_role != DCCP_ROLE_CLIENT)
                        break;
-               /* fall through */
+               fallthrough;
        case DCCP_REQUESTING:
        case DCCP_ACTIVE_CLOSEREQ:
                dccp_send_reset(sk, DCCP_RESET_CODE_CLOSED);
@@ -76,7 +76,7 @@ static int dccp_rcv_close(struct sock *sk, struct sk_buff *skb)
                queued = 1;
                dccp_fin(sk, skb);
                dccp_set_state(sk, DCCP_PASSIVE_CLOSE);
-               /* fall through */
+               fallthrough;
        case DCCP_PASSIVE_CLOSE:
                /*
                 * Retransmitted Close: we have already enqueued the first one.
@@ -113,7 +113,7 @@ static int dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
                queued = 1;
                dccp_fin(sk, skb);
                dccp_set_state(sk, DCCP_PASSIVE_CLOSEREQ);
-               /* fall through */
+               fallthrough;
        case DCCP_PASSIVE_CLOSEREQ:
                sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP);
        }
@@ -530,7 +530,7 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
        case DCCP_PKT_DATA:
                if (sk->sk_state == DCCP_RESPOND)
                        break;
-               /* fall through */
+               fallthrough;
        case DCCP_PKT_DATAACK:
        case DCCP_PKT_ACK:
                /*
@@ -684,7 +684,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
                /* Step 8: if using Ack Vectors, mark packet acknowledgeable */
                dccp_handle_ackvec_processing(sk, skb);
                dccp_deliver_input_to_ccids(sk, skb);
-               /* fall through */
+               fallthrough;
        case DCCP_RESPOND:
                queued = dccp_rcv_respond_partopen_state_process(sk, skb,
                                                                 dh, len);
index 51aaba7a5d4562ab019fa87b6c44b0b1d5d9e09d..d24cad05001e52f06889f3e9751eb91d384d2072 100644 (file)
@@ -225,7 +225,7 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
                         * interested. The RX CCID need not parse Ack Vectors,
                         * since it is only interested in clearing old state.
                         */
-                       /* fall through */
+                       fallthrough;
                case DCCPO_MIN_TX_CCID_SPECIFIC ... DCCPO_MAX_TX_CCID_SPECIFIC:
                        if (ccid_hc_tx_parse_options(dp->dccps_hc_tx_ccid, sk,
                                                     pkt_type, opt, value, len))
index 6433187a5cc442bbf8e2eb4ea694343eae11ceb8..50e6d5699bb2979f9a144e3dc62ef6f84aa02661 100644 (file)
@@ -62,7 +62,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
                switch (dcb->dccpd_type) {
                case DCCP_PKT_DATA:
                        set_ack = 0;
-                       /* fall through */
+                       fallthrough;
                case DCCP_PKT_DATAACK:
                case DCCP_PKT_RESET:
                        break;
@@ -72,12 +72,12 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
                        /* Use ISS on the first (non-retransmitted) Request. */
                        if (icsk->icsk_retransmits == 0)
                                dcb->dccpd_seq = dp->dccps_iss;
-                       /* fall through */
+                       fallthrough;
 
                case DCCP_PKT_SYNC:
                case DCCP_PKT_SYNCACK:
                        ackno = dcb->dccpd_ack_seq;
-                       /* fall through */
+                       fallthrough;
                default:
                        /*
                         * Set owner/destructor: some skbs are allocated via
@@ -481,7 +481,7 @@ struct sk_buff *dccp_ctl_make_reset(struct sock *sk, struct sk_buff *rcv_skb)
        case DCCP_RESET_CODE_PACKET_ERROR:
                dhr->dccph_reset_data[0] = rxdh->dccph_type;
                break;
-       case DCCP_RESET_CODE_OPTION_ERROR:      /* fall through */
+       case DCCP_RESET_CODE_OPTION_ERROR:
        case DCCP_RESET_CODE_MANDATORY_ERROR:
                memcpy(dhr->dccph_reset_data, dcb->dccpd_reset_data, 3);
                break;
index d148ab1530e57bde6f115cfbdc428659747f6dd9..6d705d90c6149c4d6043645addd9db94b7d25353 100644 (file)
@@ -101,7 +101,7 @@ void dccp_set_state(struct sock *sk, const int state)
                if (inet_csk(sk)->icsk_bind_hash != NULL &&
                    !(sk->sk_userlocks & SOCK_BINDPORT_LOCK))
                        inet_put_port(sk);
-               /* fall through */
+               fallthrough;
        default:
                if (oldstate == DCCP_OPEN)
                        DCCP_DEC_STATS(DCCP_MIB_CURRESTAB);
@@ -834,7 +834,7 @@ int dccp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
                case DCCP_PKT_CLOSEREQ:
                        if (!(flags & MSG_PEEK))
                                dccp_finish_passive_close(sk);
-                       /* fall through */
+                       fallthrough;
                case DCCP_PKT_RESET:
                        dccp_pr_debug("found fin (%s) ok!\n",
                                      dccp_packet_name(dh->dccph_type));
@@ -960,7 +960,7 @@ static void dccp_terminate_connection(struct sock *sk)
        case DCCP_PARTOPEN:
                dccp_pr_debug("Stop PARTOPEN timer (%p)\n", sk);
                inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
-               /* fall through */
+               fallthrough;
        case DCCP_OPEN:
                dccp_send_close(sk, 1);
 
@@ -969,7 +969,7 @@ static void dccp_terminate_connection(struct sock *sk)
                        next_state = DCCP_ACTIVE_CLOSEREQ;
                else
                        next_state = DCCP_CLOSING;
-               /* fall through */
+               fallthrough;
        default:
                dccp_set_state(sk, next_state);
        }
index 3b53d766789d473a1a2c0d8a790f7515c36548be..5dbd45dc35ad3f44933b1fa1ba29ef4a7578249e 100644 (file)
@@ -623,12 +623,12 @@ static void dn_destroy_sock(struct sock *sk)
                goto disc_reject;
        case DN_RUN:
                scp->state = DN_DI;
-               /* fall through */
+               fallthrough;
        case DN_DI:
        case DN_DR:
 disc_reject:
                dn_nsp_send_disc(sk, NSP_DISCINIT, 0, sk->sk_allocation);
-               /* fall through */
+               fallthrough;
        case DN_NC:
        case DN_NR:
        case DN_RJ:
@@ -642,7 +642,7 @@ disc_reject:
                break;
        default:
                printk(KERN_DEBUG "DECnet: dn_destroy_sock passed socket in invalid state\n");
-               /* fall through */
+               fallthrough;
        case DN_O:
                dn_stop_slow_timer(sk);
 
index c68503a180259467505bd1346995ea1bc00df755..c97bdca5ec30fc223af540363058f9ff94def019 100644 (file)
@@ -483,7 +483,7 @@ static void dn_nsp_disc_conf(struct sock *sk, struct sk_buff *skb)
                break;
        case DN_RUN:
                sk->sk_shutdown |= SHUTDOWN_MASK;
-               /* fall through */
+               fallthrough;
        case DN_CC:
                scp->state = DN_CN;
        }
index 33fefb0aebca4687a3d119f70ba56a587d238b17..4086f9c746af4eb9ce6c42bcf3be2bdfaa2317ee 100644 (file)
@@ -156,7 +156,7 @@ static void dn_rehash_zone(struct dn_zone *dz)
        default:
                printk(KERN_DEBUG "DECnet: dn_rehash_zone: BUG! %d\n",
                       old_divisor);
-               /* fall through */
+               fallthrough;
        case 256:
                new_divisor = 1024;
                new_hashmask = 0x3FF;
index deae519bdeecd986e15e4cf795d9380278eda560..67b5ab2657b7c9c0d20581a499e9f1bbbda798d5 100644 (file)
@@ -75,7 +75,7 @@ static void strip_it(char *str)
                case '\r':
                case ':':
                        *str = 0;
-                       /* Fallthrough */
+                       fallthrough;
                case 0:
                        return;
                }
index 41d60eeefdbd99503d15cfb9546e9ef7b86cd894..16e5f98d4882ef7c2116232b1fa38111083b0277 100644 (file)
@@ -1799,15 +1799,27 @@ int dsa_slave_create(struct dsa_port *port)
 
        dsa_slave_notify(slave_dev, DSA_PORT_REGISTER);
 
-       ret = register_netdev(slave_dev);
+       rtnl_lock();
+
+       ret = register_netdevice(slave_dev);
        if (ret) {
                netdev_err(master, "error %d registering interface %s\n",
                           ret, slave_dev->name);
+               rtnl_unlock();
                goto out_phy;
        }
 
+       ret = netdev_upper_dev_link(master, slave_dev, NULL);
+
+       rtnl_unlock();
+
+       if (ret)
+               goto out_unregister;
+
        return 0;
 
+out_unregister:
+       unregister_netdev(slave_dev);
 out_phy:
        rtnl_lock();
        phylink_disconnect_phy(p->dp->pl);
@@ -1824,16 +1836,18 @@ out_free:
 
 void dsa_slave_destroy(struct net_device *slave_dev)
 {
+       struct net_device *master = dsa_slave_to_master(slave_dev);
        struct dsa_port *dp = dsa_slave_to_port(slave_dev);
        struct dsa_slave_priv *p = netdev_priv(slave_dev);
 
        netif_carrier_off(slave_dev);
        rtnl_lock();
+       netdev_upper_dev_unlink(master, slave_dev);
+       unregister_netdevice(slave_dev);
        phylink_disconnect_phy(dp->pl);
        rtnl_unlock();
 
        dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER);
-       unregister_netdev(slave_dev);
        phylink_destroy(dp->pl);
        gro_cells_destroy(&p->gcells);
        free_percpu(p->stats64);
@@ -2009,7 +2023,7 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused,
        switchdev_work->event = event;
 
        switch (event) {
-       case SWITCHDEV_FDB_ADD_TO_DEVICE: /* fall through */
+       case SWITCHDEV_FDB_ADD_TO_DEVICE:
        case SWITCHDEV_FDB_DEL_TO_DEVICE:
                if (dsa_slave_switchdev_fdb_work_init(switchdev_work, ptr))
                        goto err_fdb_work_init;
index 42f327c06dcacea54458d8a3d6e8cd154da2687a..b4fc05cafaa61e99ca14a564801b42018dd6fb35 100644 (file)
@@ -160,11 +160,14 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb,
        packing(injection, &qos_class, 19,  17, OCELOT_TAG_LEN, PACK, 0);
 
        if (ocelot->ptp && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
+               struct sk_buff *clone = DSA_SKB_CB(skb)->clone;
+
                rew_op = ocelot_port->ptp_cmd;
-               if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
-                       rew_op |= (ocelot_port->ts_id  % 4) << 3;
-                       ocelot_port->ts_id++;
-               }
+               /* Retrieve timestamp ID populated inside skb->cb[0] of the
+                * clone by ocelot_port_add_txtstamp_skb
+                */
+               if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP)
+                       rew_op |= clone->cb[0] << 3;
 
                packing(injection, &rew_op, 125, 117, OCELOT_TAG_LEN, PACK, 0);
        }
index 84f23289475bcb9cacf8db38dbdf372c904d1af2..d93bf2da0f34736be0574c1ff1c9f896d946f832 100644 (file)
@@ -200,7 +200,7 @@ int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info)
        reply_len = ret + ethnl_reply_header_size();
 
        rskb = ethnl_reply_init(reply_len, req_info.dev,
-                               ETHTOOL_MSG_TUNNEL_INFO_GET,
+                               ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
                                ETHTOOL_A_TUNNEL_INFO_HEADER,
                                info, &reply_payload);
        if (!rskb) {
@@ -273,7 +273,7 @@ int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
                                goto cont;
 
                        ehdr = ethnl_dump_put(skb, cb,
-                                             ETHTOOL_MSG_TUNNEL_INFO_GET);
+                                             ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY);
                        if (!ehdr) {
                                ret = -EMSGSIZE;
                                goto out;
index 06c3cd98876076f2223fcdfc434af6074282c6b8..0e4681cf71db84aae57347d9282ea05979aed413 100644 (file)
@@ -76,7 +76,7 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev,
                proto = nla_get_u8(data[IFLA_HSR_PROTOCOL]);
 
        if (proto >= HSR_PROTOCOL_MAX) {
-               NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol\n");
+               NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol");
                return -EINVAL;
        }
 
@@ -84,14 +84,14 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev,
                proto_version = HSR_V0;
        } else {
                if (proto == HSR_PROTOCOL_PRP) {
-                       NL_SET_ERR_MSG_MOD(extack, "PRP version unsupported\n");
+                       NL_SET_ERR_MSG_MOD(extack, "PRP version unsupported");
                        return -EINVAL;
                }
 
                proto_version = nla_get_u8(data[IFLA_HSR_VERSION]);
                if (proto_version > HSR_V1) {
                        NL_SET_ERR_MSG_MOD(extack,
-                                          "Only HSR version 0/1 supported\n");
+                                          "Only HSR version 0/1 supported");
                        return -EINVAL;
                }
        }
index bbe9b3b2d3959fef28d1d94a0bcc0a71077d607d..be6f06adefe0a7ec46afcc3890d2bf387fcf3fba 100644 (file)
@@ -195,7 +195,7 @@ static int lowpan_frag_rx_handlers_result(struct sk_buff *skb,
                net_warn_ratelimited("%s: received unknown dispatch\n",
                                     __func__);
 
-               /* fall-through */
+               fallthrough;
        default:
                /* all others failure */
                return NET_RX_DROP;
index b34d050c968716d80bb1a3db7841086dac80478d..517e6493f5d14f4d6187d9b7746370e06894a4a6 100644 (file)
@@ -35,11 +35,11 @@ static int lowpan_rx_handlers_result(struct sk_buff *skb, lowpan_rx_result res)
                net_warn_ratelimited("%s: received unknown dispatch\n",
                                     __func__);
 
-               /* fall-through */
+               fallthrough;
        case RX_DROP_UNUSABLE:
                kfree_skb(skb);
 
-               /* fall-through */
+               fallthrough;
        case RX_DROP:
                return NET_RX_DROP;
        case RX_QUEUED:
index 41079490a118162e992e44e272b72f3b688093c9..86a23e4a6a50ffce36e5ac1849361f4dd91e6eac 100644 (file)
@@ -362,6 +362,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
        fl4.flowi4_tun_key.tun_id = 0;
        fl4.flowi4_flags = 0;
        fl4.flowi4_uid = sock_net_uid(net, NULL);
+       fl4.flowi4_multipath_hash = 0;
 
        no_addr = idev->ifa_list == NULL;
 
index c89b46fec153b66b972598e0e7279f440cdf6932..ffc5332f139062525e92e1f03b197524842a02f1 100644 (file)
@@ -2121,7 +2121,8 @@ void fib_info_notify_update(struct net *net, struct nl_info *info)
                struct hlist_head *head = &net->ipv4.fib_table_hash[h];
                struct fib_table *tb;
 
-               hlist_for_each_entry_rcu(tb, head, tb_hlist)
+               hlist_for_each_entry_rcu(tb, head, tb_hlist,
+                                        lockdep_rtnl_is_held())
                        __fib_info_notify_update(net, tb, info);
        }
 }
index 4a98dd7362702c32620638227c19bf986551d792..f1bd95f243b3065b705b0e5ccff3acbc5cd21127 100644 (file)
@@ -186,8 +186,8 @@ errout:
 }
 EXPORT_SYMBOL_GPL(inet_diag_msg_attrs_fill);
 
-static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
-                                 struct nlattr **req_nlas)
+static int inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
+                                struct nlattr **req_nlas)
 {
        struct nlattr *nla;
        int remaining;
@@ -195,9 +195,13 @@ static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
        nlmsg_for_each_attr(nla, nlh, hdrlen, remaining) {
                int type = nla_type(nla);
 
+               if (type == INET_DIAG_REQ_PROTOCOL && nla_len(nla) != sizeof(u32))
+                       return -EINVAL;
+
                if (type < __INET_DIAG_REQ_MAX)
                        req_nlas[type] = nla;
        }
+       return 0;
 }
 
 static int inet_diag_get_protocol(const struct inet_diag_req_v2 *req,
@@ -574,7 +578,10 @@ static int inet_diag_cmd_exact(int cmd, struct sk_buff *in_skb,
        int err, protocol;
 
        memset(&dump_data, 0, sizeof(dump_data));
-       inet_diag_parse_attrs(nlh, hdrlen, dump_data.req_nlas);
+       err = inet_diag_parse_attrs(nlh, hdrlen, dump_data.req_nlas);
+       if (err)
+               return err;
+
        protocol = inet_diag_get_protocol(req, &dump_data);
 
        handler = inet_diag_lock_handler(protocol);
@@ -1180,8 +1187,11 @@ static int __inet_diag_dump_start(struct netlink_callback *cb, int hdrlen)
        if (!cb_data)
                return -ENOMEM;
 
-       inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas);
-
+       err = inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas);
+       if (err) {
+               kfree(cb_data);
+               return err;
+       }
        nla = cb_data->inet_diag_nla_bc;
        if (nla) {
                err = inet_diag_bc_audit(nla, skb);
index 61f802d5350c8ed5fcdc1f9ab467221ae0af59cf..e6f2ada9e7d5657b0b6140631663573a6f320b67 100644 (file)
@@ -74,6 +74,7 @@
 #include <net/icmp.h>
 #include <net/checksum.h>
 #include <net/inetpeer.h>
+#include <net/inet_ecn.h>
 #include <net/lwtunnel.h>
 #include <linux/bpf-cgroup.h>
 #include <linux/igmp.h>
@@ -1703,7 +1704,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
        if (IS_ERR(rt))
                return;
 
-       inet_sk(sk)->tos = arg->tos;
+       inet_sk(sk)->tos = arg->tos & ~INET_ECN_MASK;
 
        sk->sk_protocol = ip_hdr(skb)->protocol;
        sk->sk_bound_dev_if = arg->bound_dev_if;
index 75c6013ff9a41f86842d1818b98fe23dde8eeb78..b2ea1a8c5fd66d6b67502caf0bdf9d809981f85a 100644 (file)
@@ -554,6 +554,7 @@ static int ip_tun_parse_opts_vxlan(struct nlattr *attr,
 
                attr = tb[LWTUNNEL_IP_OPT_VXLAN_GBP];
                md->gbp = nla_get_u32(attr);
+               md->gbp &= VXLAN_GBP_MASK;
                info->key.tun_flags |= TUNNEL_VXLAN_OPT;
        }
 
index 7afde8828b4c9c3f17f6ae3beea8d7f7d0b677eb..3f248a19faa30977b7551092b1787bbf887e8d21 100644 (file)
@@ -3,7 +3,7 @@
  * nf_nat_pptp.c
  *
  * NAT support for PPTP (Point to Point Tunneling Protocol).
- * PPTP is a protocol for creating virtual private networks.
+ * PPTP is a protocol for creating virtual private networks.
  * It is a specification defined by Microsoft and some vendors
  * working with Microsoft.  PPTP is built on top of a modified
  * version of the Internet Generic Routing Encapsulation Protocol.
index 6fd4330287c279cb010827cff3790428df73cedc..407956be7deb30040546eb60bc9ae73b20253469 100644 (file)
@@ -610,7 +610,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
        } else if (!ipc.oif) {
                ipc.oif = inet->uc_index;
        } else if (ipv4_is_lbcast(daddr) && inet->uc_index) {
-               /* oif is set, packet is to local broadcast and
+               /* oif is set, packet is to local broadcast
                 * and uc_index is set. oif is most likely set
                 * by sk_bound_dev_if. If uc_index != oif check if the
                 * oif is an L3 master and uc_index is an L3 slave.
index 8ca6bcab7b03d9204fc0de3adca2cdd0c8e0672d..58642b29a499d7a7f4679ffc1d8718974279a535 100644 (file)
@@ -786,8 +786,10 @@ static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flow
                        neigh_event_send(n, NULL);
                } else {
                        if (fib_lookup(net, fl4, &res, 0) == 0) {
-                               struct fib_nh_common *nhc = FIB_RES_NHC(res);
+                               struct fib_nh_common *nhc;
 
+                               fib_select_path(net, &res, fl4, skb);
+                               nhc = FIB_RES_NHC(res);
                                update_or_create_fnhe(nhc, fl4->daddr, new_gw,
                                                0, false,
                                                jiffies + ip_rt_gc_timeout);
@@ -1013,6 +1015,7 @@ out:      kfree_skb(skb);
 static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
 {
        struct dst_entry *dst = &rt->dst;
+       struct net *net = dev_net(dst->dev);
        u32 old_mtu = ipv4_mtu(dst);
        struct fib_result res;
        bool lock = false;
@@ -1033,9 +1036,11 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
                return;
 
        rcu_read_lock();
-       if (fib_lookup(dev_net(dst->dev), fl4, &res, 0) == 0) {
-               struct fib_nh_common *nhc = FIB_RES_NHC(res);
+       if (fib_lookup(net, fl4, &res, 0) == 0) {
+               struct fib_nh_common *nhc;
 
+               fib_select_path(net, &res, fl4, NULL);
+               nhc = FIB_RES_NHC(res);
                update_or_create_fnhe(nhc, fl4->daddr, 0, mtu, lock,
                                      jiffies + ip_rt_mtu_expires);
        }
@@ -2147,6 +2152,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
        fl4.daddr = daddr;
        fl4.saddr = saddr;
        fl4.flowi4_uid = sock_net_uid(net, NULL);
+       fl4.flowi4_multipath_hash = 0;
 
        if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) {
                flkeys = &_flkeys;
@@ -2667,8 +2673,6 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4,
        fib_select_path(net, res, fl4, skb);
 
        dev_out = FIB_RES_DEV(*res);
-       fl4->flowi4_oif = dev_out->ifindex;
-
 
 make_route:
        rth = __mkroute_output(res, fl4, orig_oif, dev_out, flags);
index 76bff79d6fedac0a8494e198675e80ab0b93998a..747f56e0c6368000d318cb9cda02fe8f44dd9e71 100644 (file)
@@ -303,6 +303,7 @@ config IPV6_SEG6_LWTUNNEL
 config IPV6_SEG6_HMAC
        bool "IPv6: Segment Routing HMAC support"
        depends on IPV6
+       select CRYPTO
        select CRYPTO_HMAC
        select CRYPTO_SHA1
        select CRYPTO_SHA256
index 25a90f3f705c7e6d53615f490f36c5722f3bd8b1..4a664ad4f4d4bb2b521f67e8433a06c77bd301ee 100644 (file)
@@ -1993,14 +1993,19 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
 /* Need to own table->tb6_lock */
 int fib6_del(struct fib6_info *rt, struct nl_info *info)
 {
-       struct fib6_node *fn = rcu_dereference_protected(rt->fib6_node,
-                                   lockdep_is_held(&rt->fib6_table->tb6_lock));
-       struct fib6_table *table = rt->fib6_table;
        struct net *net = info->nl_net;
        struct fib6_info __rcu **rtp;
        struct fib6_info __rcu **rtp_next;
+       struct fib6_table *table;
+       struct fib6_node *fn;
+
+       if (rt == net->ipv6.fib6_null_entry)
+               return -ENOENT;
 
-       if (!fn || rt == net->ipv6.fib6_null_entry)
+       table = rt->fib6_table;
+       fn = rcu_dereference_protected(rt->fib6_node,
+                                      lockdep_is_held(&table->tb6_lock));
+       if (!fn)
                return -ENOENT;
 
        WARN_ON(!(fn->fn_flags & RTN_RTINFO));
index 5e7e25e2523ac23b1613bbb01c742480814595fd..fb075d9545b9eccf2e63c7b5727734e79d715d44 100644 (file)
@@ -4202,7 +4202,7 @@ static struct fib6_info *rt6_add_route_info(struct net *net,
                .fc_nlinfo.nl_net = net,
        };
 
-       cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO,
+       cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO;
        cfg.fc_dst = *prefix;
        cfg.fc_gateway = *gwaddr;
 
index fac2135aa47b6ff8c291a807581c63209b1f7629..5b60a4bdd36af0f4ed9159c1cadc3cb31aa2e75e 100644 (file)
@@ -21,6 +21,7 @@
 #include <net/calipso.h>
 #endif
 
+static int two = 2;
 static int flowlabel_reflect_max = 0x7;
 static int auto_flowlabels_min;
 static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX;
@@ -150,7 +151,7 @@ static struct ctl_table ipv6_table_template[] = {
                .mode           = 0644,
                .proc_handler   = proc_rt6_multipath_hash_policy,
                .extra1         = SYSCTL_ZERO,
-               .extra2         = SYSCTL_ONE,
+               .extra2         = &two,
        },
        {
                .procname       = "seg6_flowlabel",
index 6ee9851ac7c6801f4918398ec14d44ccf2f84c1d..a95af62acb52987122562ae2ca84a6902729dc09 100644 (file)
@@ -418,7 +418,7 @@ static void iucv_sock_close(struct sock *sk)
                        sk->sk_state = IUCV_DISCONN;
                        sk->sk_state_change(sk);
                }
-               /* fall through */
+               fallthrough;
 
        case IUCV_DISCONN:
                sk->sk_state = IUCV_CLOSING;
@@ -433,7 +433,7 @@ static void iucv_sock_close(struct sock *sk)
                                        iucv_sock_in_state(sk, IUCV_CLOSED, 0),
                                        timeo);
                }
-               /* fall through */
+               fallthrough;
 
        case IUCV_CLOSING:
                sk->sk_state = IUCV_CLOSED;
@@ -444,7 +444,7 @@ static void iucv_sock_close(struct sock *sk)
 
                skb_queue_purge(&iucv->send_skb_q);
                skb_queue_purge(&iucv->backlog_skb_q);
-               /* fall through */
+               fallthrough;
 
        default:
                iucv_sever_path(sk, 1);
@@ -2111,10 +2111,10 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev,
                        kfree_skb(skb);
                        break;
                }
-               /* fall through - and receive non-zero length data */
+               fallthrough;    /* and receive non-zero length data */
        case (AF_IUCV_FLAG_SHT):
                /* shutdown request */
-               /* fall through - and receive zero length data */
+               fallthrough;    /* and receive zero length data */
        case 0:
                /* plain data frame */
                IUCV_SKB_CB(skb)->class = trans_hdr->iucv_hdr.class;
index e71ca5aec684a42b321f31107e60903644216cbe..864326f150e2fcf76f9022c8ad5bb2cb0ac08a7c 100644 (file)
@@ -154,7 +154,7 @@ int l3mdev_master_upper_ifindex_by_index_rcu(struct net *net, int ifindex)
 EXPORT_SYMBOL_GPL(l3mdev_master_upper_ifindex_by_index_rcu);
 
 /**
- *     l3mdev_fib_table - get FIB table id associated with an L3
+ *     l3mdev_fib_table_rcu - get FIB table id associated with an L3
  *                             master interface
  *     @dev: targeted interface
  */
index 366f76c9003ddd1b125473218cd7daff445bcc80..26d2f8ba70297dde561b73cbf0a01334bdf21054 100644 (file)
@@ -405,18 +405,14 @@ ieee80211_calc_legacy_rate_duration(u16 bitrate, bool short_pre,
        return duration;
 }
 
-u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
-                             struct ieee80211_rx_status *status,
-                             int len)
+static u32 ieee80211_get_rate_duration(struct ieee80211_hw *hw,
+                                      struct ieee80211_rx_status *status,
+                                      u32 *overhead)
 {
-       struct ieee80211_supported_band *sband;
-       const struct ieee80211_rate *rate;
        bool sgi = status->enc_flags & RX_ENC_FLAG_SHORT_GI;
-       bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE;
        int bw, streams;
        int group, idx;
        u32 duration;
-       bool cck;
 
        switch (status->bw) {
        case RATE_INFO_BW_20:
@@ -437,20 +433,6 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
        }
 
        switch (status->encoding) {
-       case RX_ENC_LEGACY:
-               if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ))
-                       return 0;
-
-               sband = hw->wiphy->bands[status->band];
-               if (!sband || status->rate_idx >= sband->n_bitrates)
-                       return 0;
-
-               rate = &sband->bitrates[status->rate_idx];
-               cck = rate->flags & IEEE80211_RATE_MANDATORY_B;
-
-               return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp,
-                                                          cck, len);
-
        case RX_ENC_VHT:
                streams = status->nss;
                idx = status->rate_idx;
@@ -477,51 +459,146 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
 
        duration = airtime_mcs_groups[group].duration[idx];
        duration <<= airtime_mcs_groups[group].shift;
+       *overhead = 36 + (streams << 2);
+
+       return duration;
+}
+
+
+u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
+                             struct ieee80211_rx_status *status,
+                             int len)
+{
+       struct ieee80211_supported_band *sband;
+       u32 duration, overhead = 0;
+
+       if (status->encoding == RX_ENC_LEGACY) {
+               const struct ieee80211_rate *rate;
+               bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE;
+               bool cck;
+
+               if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ))
+                       return 0;
+
+               sband = hw->wiphy->bands[status->band];
+               if (!sband || status->rate_idx >= sband->n_bitrates)
+                       return 0;
+
+               rate = &sband->bitrates[status->rate_idx];
+               cck = rate->flags & IEEE80211_RATE_MANDATORY_B;
+
+               return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp,
+                                                          cck, len);
+       }
+
+       duration = ieee80211_get_rate_duration(hw, status, &overhead);
+       if (!duration)
+               return 0;
+
        duration *= len;
        duration /= AVG_PKT_SIZE;
        duration /= 1024;
 
-       duration += 36 + (streams << 2);
-
-       return duration;
+       return duration + overhead;
 }
 EXPORT_SYMBOL_GPL(ieee80211_calc_rx_airtime);
 
-static u32 ieee80211_calc_tx_airtime_rate(struct ieee80211_hw *hw,
-                                         struct ieee80211_tx_rate *rate,
-                                         u8 band, int len)
+static bool ieee80211_fill_rate_info(struct ieee80211_hw *hw,
+                                    struct ieee80211_rx_status *stat, u8 band,
+                                    struct rate_info *ri)
 {
-       struct ieee80211_rx_status stat = {
-               .band = band,
-       };
+       struct ieee80211_supported_band *sband = hw->wiphy->bands[band];
+       int i;
 
-       if (rate->idx < 0 || !rate->count)
+       if (!ri || !sband)
+           return false;
+
+       stat->bw = ri->bw;
+       stat->nss = ri->nss;
+       stat->rate_idx = ri->mcs;
+
+       if (ri->flags & RATE_INFO_FLAGS_HE_MCS)
+               stat->encoding = RX_ENC_HE;
+       else if (ri->flags & RATE_INFO_FLAGS_VHT_MCS)
+               stat->encoding = RX_ENC_VHT;
+       else if (ri->flags & RATE_INFO_FLAGS_MCS)
+               stat->encoding = RX_ENC_HT;
+       else
+               stat->encoding = RX_ENC_LEGACY;
+
+       if (ri->flags & RATE_INFO_FLAGS_SHORT_GI)
+               stat->enc_flags |= RX_ENC_FLAG_SHORT_GI;
+
+       stat->he_gi = ri->he_gi;
+
+       if (stat->encoding != RX_ENC_LEGACY)
+               return true;
+
+       stat->rate_idx = 0;
+       for (i = 0; i < sband->n_bitrates; i++) {
+               if (ri->legacy != sband->bitrates[i].bitrate)
+                       continue;
+
+               stat->rate_idx = i;
+               return true;
+       }
+
+       return false;
+}
+
+static int ieee80211_fill_rx_status(struct ieee80211_rx_status *stat,
+                                   struct ieee80211_hw *hw,
+                                   struct ieee80211_tx_rate *rate,
+                                   struct rate_info *ri, u8 band, int len)
+{
+       memset(stat, 0, sizeof(*stat));
+       stat->band = band;
+
+       if (ieee80211_fill_rate_info(hw, stat, band, ri))
                return 0;
 
-       if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
-               stat.bw = RATE_INFO_BW_80;
+       if (rate->idx < 0 || !rate->count)
+               return -1;
+
+       if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
+               stat->bw = RATE_INFO_BW_160;
+       else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
+               stat->bw = RATE_INFO_BW_80;
        else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
-               stat.bw = RATE_INFO_BW_40;
+               stat->bw = RATE_INFO_BW_40;
        else
-               stat.bw = RATE_INFO_BW_20;
+               stat->bw = RATE_INFO_BW_20;
 
-       stat.enc_flags = 0;
+       stat->enc_flags = 0;
        if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
-               stat.enc_flags |= RX_ENC_FLAG_SHORTPRE;
+               stat->enc_flags |= RX_ENC_FLAG_SHORTPRE;
        if (rate->flags & IEEE80211_TX_RC_SHORT_GI)
-               stat.enc_flags |= RX_ENC_FLAG_SHORT_GI;
+               stat->enc_flags |= RX_ENC_FLAG_SHORT_GI;
 
-       stat.rate_idx = rate->idx;
+       stat->rate_idx = rate->idx;
        if (rate->flags & IEEE80211_TX_RC_VHT_MCS) {
-               stat.encoding = RX_ENC_VHT;
-               stat.rate_idx = ieee80211_rate_get_vht_mcs(rate);
-               stat.nss = ieee80211_rate_get_vht_nss(rate);
+               stat->encoding = RX_ENC_VHT;
+               stat->rate_idx = ieee80211_rate_get_vht_mcs(rate);
+               stat->nss = ieee80211_rate_get_vht_nss(rate);
        } else if (rate->flags & IEEE80211_TX_RC_MCS) {
-               stat.encoding = RX_ENC_HT;
+               stat->encoding = RX_ENC_HT;
        } else {
-               stat.encoding = RX_ENC_LEGACY;
+               stat->encoding = RX_ENC_LEGACY;
        }
 
+       return 0;
+}
+
+static u32 ieee80211_calc_tx_airtime_rate(struct ieee80211_hw *hw,
+                                         struct ieee80211_tx_rate *rate,
+                                         struct rate_info *ri,
+                                         u8 band, int len)
+{
+       struct ieee80211_rx_status stat;
+
+       if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len))
+               return 0;
+
        return ieee80211_calc_rx_airtime(hw, &stat, len);
 }
 
@@ -536,7 +613,7 @@ u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw,
                struct ieee80211_tx_rate *rate = &info->status.rates[i];
                u32 cur_duration;
 
-               cur_duration = ieee80211_calc_tx_airtime_rate(hw, rate,
+               cur_duration = ieee80211_calc_tx_airtime_rate(hw, rate, NULL,
                                                              info->band, len);
                if (!cur_duration)
                        break;
@@ -572,26 +649,47 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
        if (pubsta) {
                struct sta_info *sta = container_of(pubsta, struct sta_info,
                                                    sta);
+               struct ieee80211_rx_status stat;
                struct ieee80211_tx_rate *rate = &sta->tx_stats.last_rate;
-               u32 airtime;
+               struct rate_info *ri = &sta->tx_stats.last_rate_info;
+               u32 duration, overhead;
+               u8 agg_shift;
 
-               if (!(rate->flags & (IEEE80211_TX_RC_VHT_MCS |
-                                    IEEE80211_TX_RC_MCS)))
-                       ampdu = false;
+               if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len))
+                       return 0;
 
+               if (stat.encoding == RX_ENC_LEGACY || !ampdu)
+                       return ieee80211_calc_rx_airtime(hw, &stat, len);
+
+               duration = ieee80211_get_rate_duration(hw, &stat, &overhead);
                /*
                 * Assume that HT/VHT transmission on any AC except VO will
                 * use aggregation. Since we don't have reliable reporting
-                * of aggregation length, assume an average of 16.
+                * of aggregation length, assume an average size based on the
+                * tx rate.
                 * This will not be very accurate, but much better than simply
-                * assuming un-aggregated tx.
+                * assuming un-aggregated tx in all cases.
                 */
-               airtime = ieee80211_calc_tx_airtime_rate(hw, rate, band,
-                                                        ampdu ? len * 16 : len);
-               if (ampdu)
-                       airtime /= 16;
-
-               return airtime;
+               if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
+                       agg_shift = 1;
+               else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */
+                       agg_shift = 2;
+               else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */
+                       agg_shift = 3;
+               else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
+                       agg_shift = 4;
+               else if (stat.encoding != RX_ENC_HE ||
+                        duration > 20 * 1024) /* <= HE40 MCS6 2S */
+                       agg_shift = 5;
+               else
+                       agg_shift = 6;
+
+               duration *= len;
+               duration /= AVG_PKT_SIZE;
+               duration /= 1024;
+               duration += (overhead >> agg_shift);
+
+               return max_t(u32, duration, 4);
        }
 
        if (!conf)
index ac870309b911733fe8cd099631194b5b30520686..2e400b0ff69614105dcef5c9585ceb4d14eff26b 100644 (file)
@@ -4861,6 +4861,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_supported_band *sband;
        struct cfg80211_chan_def chandef;
        bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ;
+       bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ;
        struct ieee80211_bss *bss = (void *)cbss->priv;
        int ret;
        u32 i;
@@ -4879,7 +4880,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
                ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
        }
 
-       if (!sband->vht_cap.vht_supported && !is_6ghz) {
+       if (!sband->vht_cap.vht_supported && is_5ghz) {
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
                ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
        }
index 836cde516a18c079213d9937e56d91c1f9e248f8..a959ebf568528894f1a459cfeb5bb5889cb65579 100644 (file)
@@ -451,7 +451,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
        else if (status->bw == RATE_INFO_BW_5)
                channel_flags |= IEEE80211_CHAN_QUARTER;
 
-       if (status->band == NL80211_BAND_5GHZ)
+       if (status->band == NL80211_BAND_5GHZ ||
+           status->band == NL80211_BAND_6GHZ)
                channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;
        else if (status->encoding != RX_ENC_LEGACY)
                channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
index 9d398c9daa4c649a02bf9bf959d5e523f46fc700..d5010116cf4d130569f5e62077e74ea7621ee7dd 100644 (file)
@@ -524,7 +524,7 @@ struct ieee80211_sta_rx_stats {
  * @status_stats.retry_failed: # of frames that failed after retry
  * @status_stats.retry_count: # of retries attempted
  * @status_stats.lost_packets: # of lost packets
- * @status_stats.last_tdls_pkt_time: timestamp of last TDLS packet
+ * @status_stats.last_pkt_time: timestamp of last ACKed packet
  * @status_stats.msdu_retries: # of MSDU retries
  * @status_stats.msdu_failed: # of failed MSDUs
  * @status_stats.last_ack: last ack timestamp (jiffies)
@@ -597,7 +597,7 @@ struct sta_info {
                unsigned long filtered;
                unsigned long retry_failed, retry_count;
                unsigned int lost_packets;
-               unsigned long last_tdls_pkt_time;
+               unsigned long last_pkt_time;
                u64 msdu_retries[IEEE80211_NUM_TIDS + 1];
                u64 msdu_failed[IEEE80211_NUM_TIDS + 1];
                unsigned long last_ack;
@@ -611,6 +611,7 @@ struct sta_info {
                u64 packets[IEEE80211_NUM_ACS];
                u64 bytes[IEEE80211_NUM_ACS];
                struct ieee80211_tx_rate last_rate;
+               struct rate_info last_rate_info;
                u64 msdu[IEEE80211_NUM_TIDS + 1];
        } tx_stats;
        u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1];
index adb1d30ce06ef3dffae17c79f27f9e6ead3b2727..0794396a79884bba6a83490c15bd193e15163f82 100644 (file)
@@ -755,12 +755,16 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local,
  *  - current throughput (higher value for higher tpt)?
  */
 #define STA_LOST_PKT_THRESHOLD 50
+#define STA_LOST_PKT_TIME      HZ              /* 1 sec since last ACK */
 #define STA_LOST_TDLS_PKT_THRESHOLD    10
 #define STA_LOST_TDLS_PKT_TIME         (10*HZ) /* 10secs since last ACK */
 
 static void ieee80211_lost_packet(struct sta_info *sta,
                                  struct ieee80211_tx_info *info)
 {
+       unsigned long pkt_time = STA_LOST_PKT_TIME;
+       unsigned int pkt_thr = STA_LOST_PKT_THRESHOLD;
+
        /* If driver relies on its own algorithm for station kickout, skip
         * mac80211 packet loss mechanism.
         */
@@ -773,21 +777,20 @@ static void ieee80211_lost_packet(struct sta_info *sta,
                return;
 
        sta->status_stats.lost_packets++;
-       if (!sta->sta.tdls &&
-           sta->status_stats.lost_packets < STA_LOST_PKT_THRESHOLD)
-               return;
+       if (sta->sta.tdls) {
+               pkt_time = STA_LOST_TDLS_PKT_TIME;
+               pkt_thr = STA_LOST_PKT_THRESHOLD;
+       }
 
        /*
         * If we're in TDLS mode, make sure that all STA_LOST_TDLS_PKT_THRESHOLD
         * of the last packets were lost, and that no ACK was received in the
         * last STA_LOST_TDLS_PKT_TIME ms, before triggering the CQM packet-loss
         * mechanism.
+        * For non-TDLS, use STA_LOST_PKT_THRESHOLD and STA_LOST_PKT_TIME
         */
-       if (sta->sta.tdls &&
-           (sta->status_stats.lost_packets < STA_LOST_TDLS_PKT_THRESHOLD ||
-            time_before(jiffies,
-                        sta->status_stats.last_tdls_pkt_time +
-                        STA_LOST_TDLS_PKT_TIME)))
+       if (sta->status_stats.lost_packets < pkt_thr ||
+           !time_after(jiffies, sta->status_stats.last_pkt_time + pkt_time))
                return;
 
        cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr,
@@ -1033,9 +1036,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
                                        sta->status_stats.lost_packets = 0;
 
                                /* Track when last TDLS packet was ACKed */
-                               if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))
-                                       sta->status_stats.last_tdls_pkt_time =
-                                               jiffies;
+                               sta->status_stats.last_pkt_time = jiffies;
                        } else if (noack_success) {
                                /* nothing to do here, do not account as lost */
                        } else {
@@ -1137,9 +1138,17 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
        struct ieee80211_tx_info *info = status->info;
        struct ieee80211_sta *pubsta = status->sta;
        struct ieee80211_supported_band *sband;
+       struct sta_info *sta;
        int retry_count;
        bool acked, noack_success;
 
+       if (pubsta) {
+               sta = container_of(pubsta, struct sta_info, sta);
+
+               if (status->rate)
+                       sta->tx_stats.last_rate_info = *status->rate;
+       }
+
        if (status->skb)
                return __ieee80211_tx_status(hw, status);
 
@@ -1154,10 +1163,6 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
        noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED);
 
        if (pubsta) {
-               struct sta_info *sta;
-
-               sta = container_of(pubsta, struct sta_info, sta);
-
                if (!acked && !noack_success)
                        sta->status_stats.retry_failed++;
                sta->status_stats.retry_count += retry_count;
@@ -1168,9 +1173,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
                        if (sta->status_stats.lost_packets)
                                sta->status_stats.lost_packets = 0;
 
-                       /* Track when last TDLS packet was ACKed */
-                       if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))
-                               sta->status_stats.last_tdls_pkt_time = jiffies;
+                       /* Track when last packet was ACKed */
+                       sta->status_stats.last_pkt_time = jiffies;
                } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
                        return;
                } else if (noack_success) {
@@ -1259,8 +1263,7 @@ void ieee80211_tx_status_8023(struct ieee80211_hw *hw,
                        if (sta->status_stats.lost_packets)
                                sta->status_stats.lost_packets = 0;
 
-                       if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))
-                               sta->status_stats.last_tdls_pkt_time = jiffies;
+                       sta->status_stats.last_pkt_time = jiffies;
                } else {
                        ieee80211_lost_packet(sta, info);
                }
index c8504ffc71a11a80fb853f2cc382afa03fd6783e..8d3bfc0fe176cbb32ea00e0eab087e5b16d2bd99 100644 (file)
@@ -3353,9 +3353,10 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
                he_chandef.center_freq1 =
                        ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0,
                                                       NL80211_BAND_6GHZ);
-               he_chandef.center_freq2 =
-                       ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1,
-                                                      NL80211_BAND_6GHZ);
+               if (support_80_80 || support_160)
+                       he_chandef.center_freq2 =
+                               ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1,
+                                                              NL80211_BAND_6GHZ);
        }
 
        if (!cfg80211_chandef_valid(&he_chandef)) {
index 9c6045f9c24daf051125248e49660f2eb46e5f49..d1b64d0751f2eb3b2ad57eb56f5f8ef6fbf7d053 100644 (file)
@@ -168,10 +168,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
        /* take some capabilities as-is */
        cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info);
        vht_cap->cap = cap_info;
-       vht_cap->cap &= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 |
-                       IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
-                       IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
-                       IEEE80211_VHT_CAP_RXLDPC |
+       vht_cap->cap &= IEEE80211_VHT_CAP_RXLDPC |
                        IEEE80211_VHT_CAP_VHT_TXOP_PS |
                        IEEE80211_VHT_CAP_HTC_VHT |
                        IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
@@ -180,6 +177,9 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
                        IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
                        IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;
 
+       vht_cap->cap |= min_t(u32, cap_info & IEEE80211_VHT_CAP_MAX_MPDU_MASK,
+                             own_cap.cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK);
+
        /* and some based on our own capabilities */
        switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
        case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ:
index ab52811523e992f33f0855cdb711a2752b602e15..c829e4a7532564d401c0d2d1f90f56c2fe030b2c 100644 (file)
@@ -34,11 +34,11 @@ void ieee802154_xmit_worker(struct work_struct *work)
        if (res)
                goto err_tx;
 
-       ieee802154_xmit_complete(&local->hw, skb, false);
-
        dev->stats.tx_packets++;
        dev->stats.tx_bytes += skb->len;
 
+       ieee802154_xmit_complete(&local->hw, skb, false);
+
        return;
 
 err_tx:
@@ -78,6 +78,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
 
        /* async is priority, otherwise sync is fallback */
        if (local->ops->xmit_async) {
+               unsigned int len = skb->len;
+
                ret = drv_xmit_async(local, skb);
                if (ret) {
                        ieee802154_wake_queue(&local->hw);
@@ -85,7 +87,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
                }
 
                dev->stats.tx_packets++;
-               dev->stats.tx_bytes += skb->len;
+               dev->stats.tx_bytes += len;
        } else {
                local->tx_skb = skb;
                queue_work(local->workqueue, &local->tx_work);
index 6fdd0c9f865a5d73d9d08759fbcc2edd42d628d8..f2868a8a50c302d98bf6fbf3b1b13130e13fa05b 100644 (file)
@@ -1516,7 +1516,7 @@ static void mpls_ifdown(struct net_device *dev, int event)
                        case NETDEV_DOWN:
                        case NETDEV_UNREGISTER:
                                nh_flags |= RTNH_F_DEAD;
-                               /* fall through */
+                               fallthrough;
                        case NETDEV_CHANGE:
                                nh_flags |= RTNH_F_LINKDOWN;
                                break;
index c8820c4156e6834e6d0fb0dd7fc09a97cfa407b1..770da36278480e2479892040b23221ca9db3e839 100644 (file)
@@ -66,6 +66,16 @@ static bool addresses_equal(const struct mptcp_addr_info *a,
        return a->port == b->port;
 }
 
+static bool address_zero(const struct mptcp_addr_info *addr)
+{
+       struct mptcp_addr_info zero;
+
+       memset(&zero, 0, sizeof(zero));
+       zero.family = addr->family;
+
+       return addresses_equal(addr, &zero, false);
+}
+
 static void local_address(const struct sock_common *skc,
                          struct mptcp_addr_info *addr)
 {
@@ -171,9 +181,9 @@ static void check_work_pending(struct mptcp_sock *msk)
 
 static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 {
+       struct mptcp_addr_info remote = { 0 };
        struct sock *sk = (struct sock *)msk;
        struct mptcp_pm_addr_entry *local;
-       struct mptcp_addr_info remote;
        struct pm_nl_pernet *pernet;
 
        pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
@@ -323,10 +333,13 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)
         * addr
         */
        local_address((struct sock_common *)msk, &msk_local);
-       local_address((struct sock_common *)msk, &skc_local);
+       local_address((struct sock_common *)skc, &skc_local);
        if (addresses_equal(&msk_local, &skc_local, false))
                return 0;
 
+       if (address_zero(&skc_local))
+               return 0;
+
        pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
        rcu_read_lock();
@@ -341,7 +354,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)
                return ret;
 
        /* address not found, add to local list */
-       entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+       entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
        if (!entry)
                return -ENOMEM;
 
index 1aad411a0e46162f15907e018c79bb6638076a03..365ba96c84b06dda64eba57b1e811cf9478f97de 100644 (file)
@@ -193,7 +193,6 @@ static void mptcp_check_data_fin_ack(struct sock *sk)
                        sk->sk_state_change(sk);
                        break;
                case TCP_CLOSING:
-                       fallthrough;
                case TCP_LAST_ACK:
                        inet_sk_state_store(sk, TCP_CLOSE);
                        sk->sk_state_change(sk);
@@ -892,7 +891,6 @@ restart:
                goto out;
        }
 
-wait_for_sndbuf:
        __mptcp_flush_join_list(msk);
        ssk = mptcp_subflow_get_send(msk);
        while (!sk_stream_memory_free(sk) ||
@@ -982,7 +980,7 @@ wait_for_sndbuf:
                                 */
                                mptcp_set_timeout(sk, ssk);
                                release_sock(ssk);
-                               goto wait_for_sndbuf;
+                               goto restart;
                        }
                }
        }
@@ -1541,7 +1539,7 @@ static void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)
        case TCP_LISTEN:
                if (!(how & RCV_SHUTDOWN))
                        break;
-               /* fall through */
+               fallthrough;
        case TCP_SYN_SENT:
                tcp_disconnect(ssk, O_NONBLOCK);
                break;
index e8cac2655c827b76ee5327d6a0f44fac6a9f45c7..9ead43f79023bc2cbf9aad4cfb1367a85b6519dc 100644 (file)
@@ -1063,6 +1063,7 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex,
        struct mptcp_sock *msk = mptcp_sk(sk);
        struct mptcp_subflow_context *subflow;
        struct sockaddr_storage addr;
+       int remote_id = remote->id;
        int local_id = loc->id;
        struct socket *sf;
        struct sock *ssk;
@@ -1107,10 +1108,11 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex,
                goto failed;
 
        mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL);
-       pr_debug("msk=%p remote_token=%u local_id=%d", msk, remote_token,
-                local_id);
+       pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk,
+                remote_token, local_id, remote_id);
        subflow->remote_token = remote_token;
        subflow->local_id = local_id;
+       subflow->remote_id = remote_id;
        subflow->request_join = 1;
        subflow->request_bkup = 1;
        mptcp_info2sockaddr(remote, &addr);
@@ -1347,6 +1349,7 @@ static void subflow_ulp_clone(const struct request_sock *req,
                new_ctx->fully_established = 1;
                new_ctx->backup = subflow_req->backup;
                new_ctx->local_id = subflow_req->local_id;
+               new_ctx->remote_id = subflow_req->remote_id;
                new_ctx->token = subflow_req->token;
                new_ctx->thmac = subflow_req->thmac;
        }
index 1f387be7827bed4ebc6c64958f4c43238761cb8f..f1be3e3f6425e253df876ceee8a490e3eed98765 100644 (file)
@@ -474,7 +474,7 @@ static void ncsi_suspend_channel(struct ncsi_dev_priv *ndp)
        switch (nd->state) {
        case ncsi_dev_state_suspend:
                nd->state = ncsi_dev_state_suspend_select;
-               /* Fall through */
+               fallthrough;
        case ncsi_dev_state_suspend_select:
                ndp->pending_req_num = 1;
 
@@ -1302,7 +1302,7 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
        switch (nd->state) {
        case ncsi_dev_state_probe:
                nd->state = ncsi_dev_state_probe_deselect;
-               /* Fall through */
+               fallthrough;
        case ncsi_dev_state_probe_deselect:
                ndp->pending_req_num = 8;
 
index 32b028853a7cf53191618c04dc2eb3c498defabb..dc2e7da2742abde9e72ea5d1400a1e9fb84bd2dc 100644 (file)
@@ -315,7 +315,7 @@ tcp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp)
        switch (skb->ip_summed) {
        case CHECKSUM_NONE:
                skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
-               /* fall through */
+               fallthrough;
        case CHECKSUM_COMPLETE:
 #ifdef CONFIG_IP_VS_IPV6
                if (af == AF_INET6) {
index 153d89647c8747a957b66093ab7f787b58b431b2..68260d91c98870e74ccae77db3b0f496e3d194d2 100644 (file)
@@ -318,7 +318,7 @@ udp_csum_check(int af, struct sk_buff *skb, struct ip_vs_protocol *pp)
                case CHECKSUM_NONE:
                        skb->csum = skb_checksum(skb, udphoff,
                                                 skb->len - udphoff, 0);
-                       /* fall through */
+                       fallthrough;
                case CHECKSUM_COMPLETE:
 #ifdef CONFIG_IP_VS_IPV6
                        if (af == AF_INET6) {
index 832eabecfbddc4418e983e7d2c4846e3c2498c72..c3a4214dc9588ec532b7d276af66a8dcb96a4341 100644 (file)
@@ -851,7 +851,6 @@ static int ctnetlink_done(struct netlink_callback *cb)
 }
 
 struct ctnetlink_filter {
-       u_int32_t cta_flags;
        u8 family;
 
        u_int32_t orig_flags;
@@ -906,10 +905,6 @@ static int ctnetlink_parse_tuple_filter(const struct nlattr * const cda[],
                                         struct nf_conntrack_zone *zone,
                                         u_int32_t flags);
 
-/* applied on filters */
-#define CTA_FILTER_F_CTA_MARK                  (1 << 0)
-#define CTA_FILTER_F_CTA_MARK_MASK             (1 << 1)
-
 static struct ctnetlink_filter *
 ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family)
 {
@@ -930,14 +925,10 @@ ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family)
 #ifdef CONFIG_NF_CONNTRACK_MARK
        if (cda[CTA_MARK]) {
                filter->mark.val = ntohl(nla_get_be32(cda[CTA_MARK]));
-               filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK);
-
-               if (cda[CTA_MARK_MASK]) {
+               if (cda[CTA_MARK_MASK])
                        filter->mark.mask = ntohl(nla_get_be32(cda[CTA_MARK_MASK]));
-                       filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK_MASK);
-               } else {
+               else
                        filter->mark.mask = 0xffffffff;
-               }
        } else if (cda[CTA_MARK_MASK]) {
                err = -EINVAL;
                goto err_filter;
@@ -1117,11 +1108,7 @@ static int ctnetlink_filter_match(struct nf_conn *ct, void *data)
        }
 
 #ifdef CONFIG_NF_CONNTRACK_MARK
-       if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK_MASK)) &&
-           (ct->mark & filter->mark.mask) != filter->mark.val)
-               goto ignore_entry;
-       else if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK)) &&
-                ct->mark != filter->mark.val)
+       if ((ct->mark & filter->mark.mask) != filter->mark.val)
                goto ignore_entry;
 #endif
 
@@ -1404,7 +1391,8 @@ ctnetlink_parse_tuple_filter(const struct nlattr * const cda[],
        if (err < 0)
                return err;
 
-
+       if (l3num != NFPROTO_IPV4 && l3num != NFPROTO_IPV6)
+               return -EOPNOTSUPP;
        tuple->src.l3num = l3num;
 
        if (flags & CTA_FILTER_FLAG(CTA_IP_DST) ||
index 1f44d523b5121c84057f9f66dc902203090dbd57..5105d4250012ceecacba98b008f8c768fcd28dfa 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Connection tracking support for PPTP (Point to Point Tunneling Protocol).
- * PPTP is a protocol for creating virtual private networks.
+ * PPTP is a protocol for creating virtual private networks.
  * It is a specification defined by Microsoft and some vendors
  * working with Microsoft.  PPTP is built on top of a modified
  * version of the Internet Generic Routing Encapsulation Protocol.
index 95f79980348c836b0e2a6813d13a4ef81189be78..47e9319d2cf315768a76899bb403ee44ab72e534 100644 (file)
@@ -565,6 +565,7 @@ static int nf_ct_netns_inet_get(struct net *net)
        int err;
 
        err = nf_ct_netns_do_get(net, NFPROTO_IPV4);
+#if IS_ENABLED(CONFIG_IPV6)
        if (err < 0)
                goto err1;
        err = nf_ct_netns_do_get(net, NFPROTO_IPV6);
@@ -575,6 +576,7 @@ static int nf_ct_netns_inet_get(struct net *net)
 err2:
        nf_ct_netns_put(net, NFPROTO_IPV4);
 err1:
+#endif
        return err;
 }
 
index 4f897b14b6069d4e15df5d22fa89a47e9a892fab..810cca24b399019862f185a65d064aa56aa8a21c 100644 (file)
@@ -62,6 +62,8 @@ static const unsigned int sctp_timeouts[SCTP_CONNTRACK_MAX] = {
        [SCTP_CONNTRACK_HEARTBEAT_ACKED]        = 210 SECS,
 };
 
+#define        SCTP_FLAG_HEARTBEAT_VTAG_FAILED 1
+
 #define sNO SCTP_CONNTRACK_NONE
 #define        sCL SCTP_CONNTRACK_CLOSED
 #define        sCW SCTP_CONNTRACK_COOKIE_WAIT
@@ -369,6 +371,7 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct,
        u_int32_t offset, count;
        unsigned int *timeouts;
        unsigned long map[256 / sizeof(unsigned long)] = { 0 };
+       bool ignore = false;
 
        if (sctp_error(skb, dataoff, state))
                return -NF_ACCEPT;
@@ -427,15 +430,39 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct,
                        /* Sec 8.5.1 (D) */
                        if (sh->vtag != ct->proto.sctp.vtag[dir])
                                goto out_unlock;
-               } else if (sch->type == SCTP_CID_HEARTBEAT ||
-                          sch->type == SCTP_CID_HEARTBEAT_ACK) {
+               } else if (sch->type == SCTP_CID_HEARTBEAT) {
+                       if (ct->proto.sctp.vtag[dir] == 0) {
+                               pr_debug("Setting %d vtag %x for dir %d\n", sch->type, sh->vtag, dir);
+                               ct->proto.sctp.vtag[dir] = sh->vtag;
+                       } else if (sh->vtag != ct->proto.sctp.vtag[dir]) {
+                               if (test_bit(SCTP_CID_DATA, map) || ignore)
+                                       goto out_unlock;
+
+                               ct->proto.sctp.flags |= SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
+                               ct->proto.sctp.last_dir = dir;
+                               ignore = true;
+                               continue;
+                       } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) {
+                               ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
+                       }
+               } else if (sch->type == SCTP_CID_HEARTBEAT_ACK) {
                        if (ct->proto.sctp.vtag[dir] == 0) {
                                pr_debug("Setting vtag %x for dir %d\n",
                                         sh->vtag, dir);
                                ct->proto.sctp.vtag[dir] = sh->vtag;
                        } else if (sh->vtag != ct->proto.sctp.vtag[dir]) {
-                               pr_debug("Verification tag check failed\n");
-                               goto out_unlock;
+                               if (test_bit(SCTP_CID_DATA, map) || ignore)
+                                       goto out_unlock;
+
+                               if ((ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) == 0 ||
+                                   ct->proto.sctp.last_dir == dir)
+                                       goto out_unlock;
+
+                               ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
+                               ct->proto.sctp.vtag[dir] = sh->vtag;
+                               ct->proto.sctp.vtag[!dir] = 0;
+                       } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) {
+                               ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
                        }
                }
 
@@ -470,6 +497,10 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct,
        }
        spin_unlock_bh(&ct->lock);
 
+       /* allow but do not refresh timeout */
+       if (ignore)
+               return NF_ACCEPT;
+
        timeouts = nf_ct_timeout_lookup(ct);
        if (!timeouts)
                timeouts = nf_sctp_pernet(nf_ct_net(ct))->timeouts;
index 6892e497781c12235350ce1f6e3f9d573d6d4ba4..e8c86ee4c1c482a8674a8fd52e696e745b60e9f7 100644 (file)
@@ -1152,7 +1152,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct,
                   && (old_state == TCP_CONNTRACK_SYN_RECV
                       || old_state == TCP_CONNTRACK_ESTABLISHED)
                   && new_state == TCP_CONNTRACK_ESTABLISHED) {
-               /* Set ASSURED if we see see valid ack in ESTABLISHED
+               /* Set ASSURED if we see valid ack in ESTABLISHED
                   after SYN_RECV or a valid answer for a picked up
                   connection. */
                set_bit(IPS_ASSURED_BIT, &ct->status);
index 760ca242281655590ddf0a20ec25c8b73930e06f..af402f458ee020da5946327a23ac6b5f68d7b5a0 100644 (file)
@@ -81,18 +81,6 @@ static bool udp_error(struct sk_buff *skb,
        return false;
 }
 
-static void nf_conntrack_udp_refresh_unreplied(struct nf_conn *ct,
-                                              struct sk_buff *skb,
-                                              enum ip_conntrack_info ctinfo,
-                                              u32 extra_jiffies)
-{
-       if (unlikely(ctinfo == IP_CT_ESTABLISHED_REPLY &&
-                    ct->status & IPS_NAT_CLASH))
-               nf_ct_kill(ct);
-       else
-               nf_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies);
-}
-
 /* Returns verdict for packet, and may modify conntracktype */
 int nf_conntrack_udp_packet(struct nf_conn *ct,
                            struct sk_buff *skb,
@@ -124,12 +112,15 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,
 
                nf_ct_refresh_acct(ct, ctinfo, skb, extra);
 
+               /* never set ASSURED for IPS_NAT_CLASH, they time out soon */
+               if (unlikely((ct->status & IPS_NAT_CLASH)))
+                       return NF_ACCEPT;
+
                /* Also, more likely to be important, and not a probe */
                if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
                        nf_conntrack_event_cache(IPCT_ASSURED, ct);
        } else {
-               nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo,
-                                                  timeouts[UDP_CT_UNREPLIED]);
+               nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED]);
        }
        return NF_ACCEPT;
 }
@@ -206,12 +197,15 @@ int nf_conntrack_udplite_packet(struct nf_conn *ct,
        if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
                nf_ct_refresh_acct(ct, ctinfo, skb,
                                   timeouts[UDP_CT_REPLIED]);
+
+               if (unlikely((ct->status & IPS_NAT_CLASH)))
+                       return NF_ACCEPT;
+
                /* Also, more likely to be important, and not a probe */
                if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
                        nf_conntrack_event_cache(IPCT_ASSURED, ct);
        } else {
-               nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo,
-                                                  timeouts[UDP_CT_UNREPLIED]);
+               nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED]);
        }
        return NF_ACCEPT;
 }
index fd814e514f942d1e0edc46a4da9217c7692a29e1..4603b667973a53a5188150e7aa88bd521fde9f7a 100644 (file)
@@ -684,6 +684,18 @@ nla_put_failure:
        return -1;
 }
 
+struct nftnl_skb_parms {
+       bool report;
+};
+#define NFT_CB(skb)    (*(struct nftnl_skb_parms*)&((skb)->cb))
+
+static void nft_notify_enqueue(struct sk_buff *skb, bool report,
+                              struct list_head *notify_list)
+{
+       NFT_CB(skb).report = report;
+       list_add_tail(&skb->list, notify_list);
+}
+
 static void nf_tables_table_notify(const struct nft_ctx *ctx, int event)
 {
        struct sk_buff *skb;
@@ -715,8 +727,7 @@ static void nf_tables_table_notify(const struct nft_ctx *ctx, int event)
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
-                      ctx->report, GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -815,11 +826,11 @@ static int nf_tables_gettable(struct net *net, struct sock *nlsk,
                                        nlh->nlmsg_seq, NFT_MSG_NEWTABLE, 0,
                                        family, table);
        if (err < 0)
-               goto err;
+               goto err_fill_table_info;
 
-       return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
+       return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
 
-err:
+err_fill_table_info:
        kfree_skb(skb2);
        return err;
 }
@@ -1468,8 +1479,7 @@ static void nf_tables_chain_notify(const struct nft_ctx *ctx, int event)
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
-                      ctx->report, GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -1563,11 +1573,11 @@ static int nf_tables_getchain(struct net *net, struct sock *nlsk,
                                        nlh->nlmsg_seq, NFT_MSG_NEWCHAIN, 0,
                                        family, table, chain);
        if (err < 0)
-               goto err;
+               goto err_fill_chain_info;
 
-       return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
+       return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
 
-err:
+err_fill_chain_info:
        kfree_skb(skb2);
        return err;
 }
@@ -2807,8 +2817,7 @@ static void nf_tables_rule_notify(const struct nft_ctx *ctx,
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
-                      ctx->report, GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -3008,11 +3017,11 @@ static int nf_tables_getrule(struct net *net, struct sock *nlsk,
                                       nlh->nlmsg_seq, NFT_MSG_NEWRULE, 0,
                                       family, table, chain, rule, NULL);
        if (err < 0)
-               goto err;
+               goto err_fill_rule_info;
 
-       return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
+       return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
 
-err:
+err_fill_rule_info:
        kfree_skb(skb2);
        return err;
 }
@@ -3770,7 +3779,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx,
                        goto nla_put_failure;
        }
 
-       if (nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata))
+       if (set->udata &&
+           nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata))
                goto nla_put_failure;
 
        nest = nla_nest_start_noflag(skb, NFTA_SET_DESC);
@@ -3836,8 +3846,7 @@ static void nf_tables_set_notify(const struct nft_ctx *ctx,
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, portid, NFNLGRP_NFTABLES, ctx->report,
-                      gfp_flags);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -3967,11 +3976,11 @@ static int nf_tables_getset(struct net *net, struct sock *nlsk,
 
        err = nf_tables_fill_set(skb2, &ctx, set, NFT_MSG_NEWSET, 0);
        if (err < 0)
-               goto err;
+               goto err_fill_set_info;
 
-       return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
+       return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
 
-err:
+err_fill_set_info:
        kfree_skb(skb2);
        return err;
 }
@@ -4859,24 +4868,18 @@ static int nft_get_set_elem(struct nft_ctx *ctx, struct nft_set *set,
        err = -ENOMEM;
        skb = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
        if (skb == NULL)
-               goto err1;
+               return err;
 
        err = nf_tables_fill_setelem_info(skb, ctx, ctx->seq, ctx->portid,
                                          NFT_MSG_NEWSETELEM, 0, set, &elem);
        if (err < 0)
-               goto err2;
+               goto err_fill_setelem;
 
-       err = nfnetlink_unicast(skb, ctx->net, ctx->portid, MSG_DONTWAIT);
-       /* This avoids a loop in nfnetlink. */
-       if (err < 0)
-               goto err1;
+       return nfnetlink_unicast(skb, ctx->net, ctx->portid);
 
-       return 0;
-err2:
+err_fill_setelem:
        kfree_skb(skb);
-err1:
-       /* this avoids a loop in nfnetlink. */
-       return err == -EAGAIN ? -ENOBUFS : err;
+       return err;
 }
 
 /* called with rcu_read_lock held */
@@ -4964,8 +4967,7 @@ static void nf_tables_setelem_notify(const struct nft_ctx *ctx,
                goto err;
        }
 
-       nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, ctx->report,
-                      GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -6181,10 +6183,11 @@ static int nf_tables_getobj(struct net *net, struct sock *nlsk,
                                      nlh->nlmsg_seq, NFT_MSG_NEWOBJ, 0,
                                      family, table, obj, reset);
        if (err < 0)
-               goto err;
+               goto err_fill_obj_info;
 
-       return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
-err:
+       return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
+
+err_fill_obj_info:
        kfree_skb(skb2);
        return err;
 }
@@ -6279,7 +6282,7 @@ void nft_obj_notify(struct net *net, const struct nft_table *table,
                goto err;
        }
 
-       nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, report, gfp);
+       nft_notify_enqueue(skb, report, &net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -7044,10 +7047,11 @@ static int nf_tables_getflowtable(struct net *net, struct sock *nlsk,
                                            NFT_MSG_NEWFLOWTABLE, 0, family,
                                            flowtable, &flowtable->hook_list);
        if (err < 0)
-               goto err;
+               goto err_fill_flowtable_info;
 
-       return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
-err:
+       return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
+
+err_fill_flowtable_info:
        kfree_skb(skb2);
        return err;
 }
@@ -7088,8 +7092,7 @@ static void nf_tables_flowtable_notify(struct nft_ctx *ctx,
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
-                      ctx->report, GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -7233,10 +7236,11 @@ static int nf_tables_getgen(struct net *net, struct sock *nlsk,
        err = nf_tables_fill_gen_info(skb2, net, NETLINK_CB(skb).portid,
                                      nlh->nlmsg_seq);
        if (err < 0)
-               goto err;
+               goto err_fill_gen_info;
 
-       return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
-err:
+       return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
+
+err_fill_gen_info:
        kfree_skb(skb2);
        return err;
 }
@@ -7697,6 +7701,41 @@ static void nf_tables_commit_release(struct net *net)
        mutex_unlock(&net->nft.commit_mutex);
 }
 
+static void nft_commit_notify(struct net *net, u32 portid)
+{
+       struct sk_buff *batch_skb = NULL, *nskb, *skb;
+       unsigned char *data;
+       int len;
+
+       list_for_each_entry_safe(skb, nskb, &net->nft.notify_list, list) {
+               if (!batch_skb) {
+new_batch:
+                       batch_skb = skb;
+                       len = NLMSG_GOODSIZE - skb->len;
+                       list_del(&skb->list);
+                       continue;
+               }
+               len -= skb->len;
+               if (len > 0 && NFT_CB(skb).report == NFT_CB(batch_skb).report) {
+                       data = skb_put(batch_skb, skb->len);
+                       memcpy(data, skb->data, skb->len);
+                       list_del(&skb->list);
+                       kfree_skb(skb);
+                       continue;
+               }
+               nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES,
+                              NFT_CB(batch_skb).report, GFP_KERNEL);
+               goto new_batch;
+       }
+
+       if (batch_skb) {
+               nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES,
+                              NFT_CB(batch_skb).report, GFP_KERNEL);
+       }
+
+       WARN_ON_ONCE(!list_empty(&net->nft.notify_list));
+}
+
 static int nf_tables_commit(struct net *net, struct sk_buff *skb)
 {
        struct nft_trans *trans, *next;
@@ -7899,6 +7938,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
                }
        }
 
+       nft_commit_notify(net, NETLINK_CB(skb).portid);
        nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN);
        nf_tables_commit_release(net);
 
@@ -8723,6 +8763,7 @@ static int __net_init nf_tables_init_net(struct net *net)
        INIT_LIST_HEAD(&net->nft.tables);
        INIT_LIST_HEAD(&net->nft.commit_list);
        INIT_LIST_HEAD(&net->nft.module_list);
+       INIT_LIST_HEAD(&net->nft.notify_list);
        mutex_init(&net->nft.commit_mutex);
        net->nft.base_seq = 1;
        net->nft.validate_state = NFT_VALIDATE_SKIP;
@@ -8739,6 +8780,7 @@ static void __net_exit nf_tables_exit_net(struct net *net)
        mutex_unlock(&net->nft.commit_mutex);
        WARN_ON_ONCE(!list_empty(&net->nft.tables));
        WARN_ON_ONCE(!list_empty(&net->nft.module_list));
+       WARN_ON_ONCE(!list_empty(&net->nft.notify_list));
 }
 
 static struct pernet_operations nf_tables_net_ops = {
index 5f24edf958309f46afcdfa7428498ca7769841f9..3a2e64e13b227ba9431253e3f8587cc9cd3a7cd6 100644 (file)
@@ -149,10 +149,15 @@ int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error)
 }
 EXPORT_SYMBOL_GPL(nfnetlink_set_err);
 
-int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
-                     int flags)
+int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid)
 {
-       return netlink_unicast(net->nfnl, skb, portid, flags);
+       int err;
+
+       err = nlmsg_unicast(net->nfnl, skb, portid);
+       if (err == -EAGAIN)
+               err = -ENOBUFS;
+
+       return err;
 }
 EXPORT_SYMBOL_GPL(nfnetlink_unicast);
 
index f029924198503cdf81339fe9dbd1cfbe68d7e73b..b35e8d9a5b37ec14cc6eb39e55d0c1ade1791da8 100644 (file)
@@ -356,8 +356,7 @@ __nfulnl_send(struct nfulnl_instance *inst)
                        goto out;
                }
        }
-       nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid,
-                         MSG_DONTWAIT);
+       nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid);
 out:
        inst->qlen = 0;
        inst->skb = NULL;
index dadfc06245a36fd0f253e7e94093778add272f96..d1d8bca03b4f0b9048c7f01a4c16d59247021d09 100644 (file)
@@ -681,7 +681,7 @@ __nfqnl_enqueue_packet(struct net *net, struct nfqnl_instance *queue,
        *packet_id_ptr = htonl(entry->id);
 
        /* nfnetlink_unicast will either free the nskb or add it to a socket */
-       err = nfnetlink_unicast(nskb, net, queue->peer_portid, MSG_DONTWAIT);
+       err = nfnetlink_unicast(nskb, net, queue->peer_portid);
        if (err < 0) {
                if (queue->flags & NFQA_CFG_F_FAIL_OPEN) {
                        failopen = 1;
index 3b9b97aa4b32e3550358033bfb7208091424f261..3a6c84fb2c90dc09e352113e016c0a26e076f272 100644 (file)
@@ -102,7 +102,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
        }
 
        if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) ||
-           ct->status & IPS_SEQ_ADJUST)
+           ct->status & (IPS_SEQ_ADJUST | IPS_NAT_CLASH))
                goto out;
 
        if (!nf_ct_is_confirmed(ct))
index 7bc6537f3ccb58ef084a036216d049723c357734..b37bd02448d8c7b6f399e6cb3515e2e2851ec6fe 100644 (file)
@@ -147,11 +147,11 @@ nft_meta_get_eval_skugid(enum nft_meta_keys key,
 
        switch (key) {
        case NFT_META_SKUID:
-               *dest = from_kuid_munged(&init_user_ns,
+               *dest = from_kuid_munged(sock_net(sk)->user_ns,
                                         sock->file->f_cred->fsuid);
                break;
        case NFT_META_SKGID:
-               *dest = from_kgid_munged(&init_user_ns,
+               *dest = from_kgid_munged(sock_net(sk)->user_ns,
                                         sock->file->f_cred->fsgid);
                break;
        default:
index ed7cb9f747f60fd624d2ddc814bb59d68ea4cc6a..7a2e59638499133e38712c79a035d71c63ea5cd6 100644 (file)
@@ -87,7 +87,9 @@ void nft_payload_eval(const struct nft_expr *expr,
        u32 *dest = &regs->data[priv->dreg];
        int offset;
 
-       dest[priv->len / NFT_REG32_SIZE] = 0;
+       if (priv->len % NFT_REG32_SIZE)
+               dest[priv->len / NFT_REG32_SIZE] = 0;
+
        switch (priv->base) {
        case NFT_PAYLOAD_LL_HEADER:
                if (!skb_mac_header_was_set(skb))
index 4b2834fd17b26e47bce3883b92722bc0180922f8..217ab3644c25b1ae95c1609433fdb964c7d41349 100644 (file)
@@ -218,11 +218,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set,
                               struct nft_rbtree_elem *new,
                               struct nft_set_ext **ext)
 {
+       bool overlap = false, dup_end_left = false, dup_end_right = false;
        struct nft_rbtree *priv = nft_set_priv(set);
        u8 genmask = nft_genmask_next(net);
        struct nft_rbtree_elem *rbe;
        struct rb_node *parent, **p;
-       bool overlap = false;
        int d;
 
        /* Detect overlaps as we descend the tree. Set the flag in these cases:
@@ -238,24 +238,44 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set,
         *
         * b1. _ _ __>|  !_ _ __|  (insert end before existing start)
         * b2. _ _ ___|  !_ _ _>|  (insert end after existing start)
-        * b3. _ _ ___! >|_ _ __|  (insert start after existing end)
+        * b3. _ _ ___! >|_ _ __|  (insert start after existing end, as a leaf)
+        *            '--' no nodes falling in this range
+        * b4.          >|_ _   !  (insert start before existing start)
         *
         * Case a3. resolves to b3.:
         * - if the inserted start element is the leftmost, because the '0'
         *   element in the tree serves as end element
-        * - otherwise, if an existing end is found. Note that end elements are
-        *   always inserted after corresponding start elements.
+        * - otherwise, if an existing end is found immediately to the left. If
+        *   there are existing nodes in between, we need to further descend the
+        *   tree before we can conclude the new start isn't causing an overlap
+        *
+        * or to b4., which, preceded by a3., means we already traversed one or
+        * more existing intervals entirely, from the right.
         *
         * For a new, rightmost pair of elements, we'll hit cases b3. and b2.,
         * in that order.
         *
         * The flag is also cleared in two special cases:
         *
-        * b4. |__ _ _!|<_ _ _   (insert start right before existing end)
-        * b5. |__ _ >|!__ _ _   (insert end right after existing start)
+        * b5. |__ _ _!|<_ _ _   (insert start right before existing end)
+        * b6. |__ _ >|!__ _ _   (insert end right after existing start)
         *
         * which always happen as last step and imply that no further
         * overlapping is possible.
+        *
+        * Another special case comes from the fact that start elements matching
+        * an already existing start element are allowed: insertion is not
+        * performed but we return -EEXIST in that case, and the error will be
+        * cleared by the caller if NLM_F_EXCL is not present in the request.
+        * This way, request for insertion of an exact overlap isn't reported as
+        * error to userspace if not desired.
+        *
+        * However, if the existing start matches a pre-existing start, but the
+        * end element doesn't match the corresponding pre-existing end element,
+        * we need to report a partial overlap. This is a local condition that
+        * can be noticed without need for a tracking flag, by checking for a
+        * local duplicated end for a corresponding start, from left and right,
+        * separately.
         */
 
        parent = NULL;
@@ -272,26 +292,41 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set,
                        if (nft_rbtree_interval_start(new)) {
                                if (nft_rbtree_interval_end(rbe) &&
                                    nft_set_elem_active(&rbe->ext, genmask) &&
-                                   !nft_set_elem_expired(&rbe->ext))
+                                   !nft_set_elem_expired(&rbe->ext) && !*p)
                                        overlap = false;
                        } else {
+                               if (dup_end_left && !*p)
+                                       return -ENOTEMPTY;
+
                                overlap = nft_rbtree_interval_end(rbe) &&
                                          nft_set_elem_active(&rbe->ext,
                                                              genmask) &&
                                          !nft_set_elem_expired(&rbe->ext);
+
+                               if (overlap) {
+                                       dup_end_right = true;
+                                       continue;
+                               }
                        }
                } else if (d > 0) {
                        p = &parent->rb_right;
 
                        if (nft_rbtree_interval_end(new)) {
+                               if (dup_end_right && !*p)
+                                       return -ENOTEMPTY;
+
                                overlap = nft_rbtree_interval_end(rbe) &&
                                          nft_set_elem_active(&rbe->ext,
                                                              genmask) &&
                                          !nft_set_elem_expired(&rbe->ext);
-                       } else if (nft_rbtree_interval_end(rbe) &&
-                                  nft_set_elem_active(&rbe->ext, genmask) &&
+
+                               if (overlap) {
+                                       dup_end_left = true;
+                                       continue;
+                               }
+                       } else if (nft_set_elem_active(&rbe->ext, genmask) &&
                                   !nft_set_elem_expired(&rbe->ext)) {
-                               overlap = true;
+                               overlap = nft_rbtree_interval_end(rbe);
                        }
                } else {
                        if (nft_rbtree_interval_end(rbe) &&
@@ -316,6 +351,8 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set,
                                p = &parent->rb_left;
                        }
                }
+
+               dup_end_left = dup_end_right = false;
        }
 
        if (overlap)
index 19bef176145eb9561261489d4b4c1b9b688231db..606411869698e00067f99c0ce56a7d3657b05f82 100644 (file)
@@ -640,7 +640,7 @@ static void __net_exit recent_proc_net_exit(struct net *net)
        struct recent_table *t;
 
        /* recent_net_exit() is called before recent_mt_destroy(). Make sure
-        * that the parent xt_recent proc entry is is empty before trying to
+        * that the parent xt_recent proc entry is empty before trying to
         * remove it.
         */
        spin_lock_bh(&recent_lock);
index d07de2c0fbc765c01fe4a0bd743664180cd0e9e1..f73a8382c275e0377c2c730c7ed6add3d4c3f93b 100644 (file)
@@ -85,6 +85,7 @@ static void netlbl_domhsh_free_entry(struct rcu_head *entry)
                        kfree(netlbl_domhsh_addr6_entry(iter6));
                }
 #endif /* IPv6 */
+               kfree(ptr->def.addrsel);
        }
        kfree(ptr->domain);
        kfree(ptr);
@@ -537,6 +538,8 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
                                goto add_return;
                }
 #endif /* IPv6 */
+               /* cleanup the new entry since we've moved everything over */
+               netlbl_domhsh_free_entry(&entry->rcu);
        } else
                ret_val = -EINVAL;
 
@@ -580,6 +583,12 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry,
 {
        int ret_val = 0;
        struct audit_buffer *audit_buf;
+       struct netlbl_af4list *iter4;
+       struct netlbl_domaddr4_map *map4;
+#if IS_ENABLED(CONFIG_IPV6)
+       struct netlbl_af6list *iter6;
+       struct netlbl_domaddr6_map *map6;
+#endif /* IPv6 */
 
        if (entry == NULL)
                return -ENOENT;
@@ -597,6 +606,9 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry,
                ret_val = -ENOENT;
        spin_unlock(&netlbl_domhsh_lock);
 
+       if (ret_val)
+               return ret_val;
+
        audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_DEL, audit_info);
        if (audit_buf != NULL) {
                audit_log_format(audit_buf,
@@ -606,40 +618,29 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry,
                audit_log_end(audit_buf);
        }
 
-       if (ret_val == 0) {
-               struct netlbl_af4list *iter4;
-               struct netlbl_domaddr4_map *map4;
-#if IS_ENABLED(CONFIG_IPV6)
-               struct netlbl_af6list *iter6;
-               struct netlbl_domaddr6_map *map6;
-#endif /* IPv6 */
-
-               switch (entry->def.type) {
-               case NETLBL_NLTYPE_ADDRSELECT:
-                       netlbl_af4list_foreach_rcu(iter4,
-                                            &entry->def.addrsel->list4) {
-                               map4 = netlbl_domhsh_addr4_entry(iter4);
-                               cipso_v4_doi_putdef(map4->def.cipso);
-                       }
+       switch (entry->def.type) {
+       case NETLBL_NLTYPE_ADDRSELECT:
+               netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) {
+                       map4 = netlbl_domhsh_addr4_entry(iter4);
+                       cipso_v4_doi_putdef(map4->def.cipso);
+               }
 #if IS_ENABLED(CONFIG_IPV6)
-                       netlbl_af6list_foreach_rcu(iter6,
-                                            &entry->def.addrsel->list6) {
-                               map6 = netlbl_domhsh_addr6_entry(iter6);
-                               calipso_doi_putdef(map6->def.calipso);
-                       }
+               netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) {
+                       map6 = netlbl_domhsh_addr6_entry(iter6);
+                       calipso_doi_putdef(map6->def.calipso);
+               }
 #endif /* IPv6 */
-                       break;
-               case NETLBL_NLTYPE_CIPSOV4:
-                       cipso_v4_doi_putdef(entry->def.cipso);
-                       break;
+               break;
+       case NETLBL_NLTYPE_CIPSOV4:
+               cipso_v4_doi_putdef(entry->def.cipso);
+               break;
 #if IS_ENABLED(CONFIG_IPV6)
-               case NETLBL_NLTYPE_CALIPSO:
-                       calipso_doi_putdef(entry->def.calipso);
-                       break;
+       case NETLBL_NLTYPE_CALIPSO:
+               calipso_doi_putdef(entry->def.calipso);
+               break;
 #endif /* IPv6 */
-               }
-               call_rcu(&entry->rcu, netlbl_domhsh_free_entry);
        }
+       call_rcu(&entry->rcu, netlbl_domhsh_free_entry);
 
        return ret_val;
 }
index b5f30d7d30d06847a6df54080689779f2675d76d..d2d1448274f5616439e8a378258240865dbb098b 100644 (file)
@@ -353,7 +353,7 @@ static void netlink_rcv_wake(struct sock *sk)
 {
        struct netlink_sock *nlk = nlk_sk(sk);
 
-       if (skb_queue_empty(&sk->sk_receive_queue))
+       if (skb_queue_empty_lockless(&sk->sk_receive_queue))
                clear_bit(NETLINK_S_CONGESTED, &nlk->state);
        if (!test_bit(NETLINK_S_CONGESTED, &nlk->state))
                wake_up_interruptible(&nlk->wait);
index 2b3e26f7496f5f8a7e3880379907f4656219704a..641ffbdd977abf208c6a834aceb7636335633682 100644 (file)
@@ -188,7 +188,7 @@ send_attribute:
                goto next;
        case NLA_NESTED:
                type = NL_ATTR_TYPE_NESTED;
-               /* fall through */
+               fallthrough;
        case NLA_NESTED_ARRAY:
                if (pt->type == NLA_NESTED_ARRAY)
                        type = NL_ATTR_TYPE_NESTED_ARRAY;
index 2bef3779f8935eb09e011e3cbd35b97e31f59954..69e58906c32b1e8308cd423dc59eb57670d14638 100644 (file)
@@ -122,7 +122,7 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
 
        case NR_DISCREQ:
                nr_write_internal(sk, NR_DISCACK);
-               /* fall through */
+               fallthrough;
        case NR_DISCACK:
                nr_disconnect(sk, 0);
                break;
index 0891ee02ca4fe03145066852035de38e62a06ee2..78da5eab252a0df1af0b69da54b87b4dc06e98da 100644 (file)
@@ -263,7 +263,7 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic,
        case 3:
                re_sort_routes(nr_node, 0, 1);
                re_sort_routes(nr_node, 1, 2);
-               /* fall through */
+               fallthrough;
        case 2:
                re_sort_routes(nr_node, 0, 1);
        case 1:
@@ -356,7 +356,7 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct n
                                switch (i) {
                                case 0:
                                        nr_node->routes[0] = nr_node->routes[1];
-                                       /* fall through */
+                                       fallthrough;
                                case 1:
                                        nr_node->routes[1] = nr_node->routes[2];
                                case 2:
@@ -479,7 +479,7 @@ static int nr_dec_obs(void)
                                switch (i) {
                                case 0:
                                        s->routes[0] = s->routes[1];
-                                       /* Fallthrough */
+                                       fallthrough;
                                case 1:
                                        s->routes[1] = s->routes[2];
                                case 2:
@@ -526,7 +526,7 @@ void nr_rt_device_down(struct net_device *dev)
                                                switch (i) {
                                                case 0:
                                                        t->routes[0] = t->routes[1];
-                                                       /* fall through */
+                                                       fallthrough;
                                                case 1:
                                                        t->routes[1] = t->routes[2];
                                                case 2:
index 98d393e70de327d95e6c9548c0b2b1f6b6101ed5..a3f1204f1ed27078673b74a4db679ced00366c2d 100644 (file)
@@ -778,7 +778,7 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,
                        }
                }
                /* Non-ICMP, fall thru to initialize if needed. */
-               /* fall through */
+               fallthrough;
        case IP_CT_NEW:
                /* Seen it before?  This can happen for loopback, retrans,
                 * or local packets.
@@ -1540,7 +1540,7 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info,
                switch (type) {
                case OVS_CT_ATTR_FORCE_COMMIT:
                        info->force = true;
-                       /* fall through. */
+                       fallthrough;
                case OVS_CT_ATTR_COMMIT:
                        info->commit = true;
                        break;
index 03942c30d83e67bc412a4748edd70beedb42dfd3..b03d142ec82efa15ff3cfe7d407989e86b5a7251 100644 (file)
@@ -675,7 +675,7 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)
                        case -EINVAL:
                                memset(&key->ip, 0, sizeof(key->ip));
                                memset(&key->ipv6.addr, 0, sizeof(key->ipv6.addr));
-                               /* fall-through */
+                               fallthrough;
                        case -EPROTO:
                                skb->transport_header = skb->network_header;
                                error = 0;
index 479c257ded7335616da35aa5f7880b54aa2f9fe0..2b33e977a905911c30ecc9d1a9920bccad04f23f 100644 (file)
@@ -2170,7 +2170,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
        int skb_len = skb->len;
        unsigned int snaplen, res;
        unsigned long status = TP_STATUS_USER;
-       unsigned short macoff, netoff, hdrlen;
+       unsigned short macoff, hdrlen;
+       unsigned int netoff;
        struct sk_buff *copy_skb = NULL;
        struct timespec64 ts;
        __u32 ts_status;
@@ -2239,6 +2240,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
                }
                macoff = netoff - maclen;
        }
+       if (netoff > USHRT_MAX) {
+               atomic_inc(&po->tp_drops);
+               goto drop_n_restore;
+       }
        if (po->tp_version <= TPACKET_V2) {
                if (macoff + snaplen > po->rx_ring.frame_size) {
                        if (po->copy_thresh &&
@@ -4061,7 +4066,7 @@ static int packet_notifier(struct notifier_block *this,
                case NETDEV_UNREGISTER:
                        if (po->mclist)
                                packet_dev_mclist_delete(dev, &po->mclist);
-                       /* fallthrough */
+                       fallthrough;
 
                case NETDEV_DOWN:
                        if (dev->ifindex == po->ifindex) {
index e47d09aca4af465b335edfc91a95e15e10a31fe0..a1525916885ae9741972e32b16363319edc1aa31 100644 (file)
@@ -368,7 +368,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
                        err = -EINVAL;
                        goto out;
                }
-               /* fall through */
+               fallthrough;
        case PNS_PEP_DISABLE_REQ:
                atomic_set(&pn->tx_credits, 0);
                pep_reply(sk, skb, PN_PIPE_NO_ERROR, NULL, 0, GFP_ATOMIC);
@@ -385,7 +385,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
 
        case PNS_PIPE_ALIGNED_DATA:
                __skb_pull(skb, 1);
-               /* fall through */
+               fallthrough;
        case PNS_PIPE_DATA:
                __skb_pull(skb, 3); /* Pipe data header */
                if (!pn_flow_safe(pn->rx_fc)) {
@@ -417,11 +417,11 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
                err = pipe_rcv_created(sk, skb);
                if (err)
                        break;
-               /* fall through */
+               fallthrough;
        case PNS_PIPE_RESET_IND:
                if (!pn->init_enable)
                        break;
-               /* fall through */
+               fallthrough;
        case PNS_PIPE_ENABLED_IND:
                if (!pn_flow_safe(pn->tx_fc)) {
                        atomic_set(&pn->tx_credits, 1);
@@ -555,7 +555,7 @@ static int pipe_handler_do_rcv(struct sock *sk, struct sk_buff *skb)
        switch (hdr->message_id) {
        case PNS_PIPE_ALIGNED_DATA:
                __skb_pull(skb, 1);
-               /* fall through */
+               fallthrough;
        case PNS_PIPE_DATA:
                __skb_pull(skb, 3); /* Pipe data header */
                if (!pn_flow_safe(pn->rx_fc)) {
index 90c558f89d46565ee5d5845d0ca97c095a8287a8..957aa9263ba4ce10dbb8d94c4e4bbcaef8b6e84b 100644 (file)
@@ -332,8 +332,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
 {
        struct qrtr_hdr_v1 *hdr;
        size_t len = skb->len;
-       int rc = -ENODEV;
-       int confirm_rx;
+       int rc, confirm_rx;
 
        confirm_rx = qrtr_tx_wait(node, to->sq_node, to->sq_port, type);
        if (confirm_rx < 0) {
@@ -357,15 +356,17 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
        hdr->size = cpu_to_le32(len);
        hdr->confirm_rx = !!confirm_rx;
 
-       skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));
-
-       mutex_lock(&node->ep_lock);
-       if (node->ep)
-               rc = node->ep->xmit(node->ep, skb);
-       else
-               kfree_skb(skb);
-       mutex_unlock(&node->ep_lock);
+       rc = skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));
 
+       if (!rc) {
+               mutex_lock(&node->ep_lock);
+               rc = -ENODEV;
+               if (node->ep)
+                       rc = node->ep->xmit(node->ep, skb);
+               else
+                       kfree_skb(skb);
+               mutex_unlock(&node->ep_lock);
+       }
        /* Need to ensure that a subsequent message carries the otherwise lost
         * confirm_rx flag if we dropped this one */
        if (rc && confirm_rx)
index 9a529a01cdc6a10a13d08efcd32947bf22290849..985d0b7713acc5f0f3e31c5944348322e3879c5f 100644 (file)
@@ -934,7 +934,7 @@ static int rds_rm_size(struct msghdr *msg, int num_sgs,
 
                case RDS_CMSG_ZCOPY_COOKIE:
                        zcopy_cookie = true;
-                       /* fall through */
+                       fallthrough;
 
                case RDS_CMSG_RDMA_DEST:
                case RDS_CMSG_RDMA_MAP:
index 0d4fab2be82bdf90deac540cac8181bb9ee00e85..6af786d66b03a9ae764cd34f296da7d1569948c7 100644 (file)
@@ -216,7 +216,7 @@ static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int framety
        switch (frametype) {
        case ROSE_RESET_REQUEST:
                rose_write_internal(sk, ROSE_RESET_CONFIRMATION);
-               /* fall through */
+               fallthrough;
        case ROSE_RESET_CONFIRMATION:
                rose_stop_timer(sk);
                rose_start_idletimer(sk);
index 5277631fa14c6caa1087bf36282a6bbb7936264d..6e35703ff353d731ea07012963931437cf96a7be 100644 (file)
@@ -343,7 +343,7 @@ static int rose_del_node(struct rose_route_struct *rose_route,
                                case 0:
                                        rose_node->neighbour[0] =
                                                rose_node->neighbour[1];
-                                       /* fall through */
+                                       fallthrough;
                                case 1:
                                        rose_node->neighbour[1] =
                                                rose_node->neighbour[2];
@@ -505,7 +505,7 @@ void rose_rt_device_down(struct net_device *dev)
                                switch (i) {
                                case 0:
                                        t->neighbour[0] = t->neighbour[1];
-                                       /* fall through */
+                                       fallthrough;
                                case 1:
                                        t->neighbour[1] = t->neighbour[2];
                                case 2:
index e6725a6de015fb5081fc4c9bb5a62dce70794f56..186c8a889b164018c5ad4a16f82dea756220c04c 100644 (file)
@@ -246,7 +246,7 @@ static int rxrpc_listen(struct socket *sock, int backlog)
                        ret = 0;
                        break;
                }
-               /* Fall through */
+               fallthrough;
        default:
                ret = -EBUSY;
                break;
@@ -545,7 +545,7 @@ static int rxrpc_sendmsg(struct socket *sock, struct msghdr *m, size_t len)
 
                rx->local = local;
                rx->sk.sk_state = RXRPC_CLIENT_BOUND;
-               /* Fall through */
+               fallthrough;
 
        case RXRPC_CLIENT_BOUND:
                if (!m->msg_name &&
@@ -553,7 +553,7 @@ static int rxrpc_sendmsg(struct socket *sock, struct msghdr *m, size_t len)
                        m->msg_name = &rx->connect_srx;
                        m->msg_namelen = sizeof(rx->connect_srx);
                }
-               /* Fall through */
+               fallthrough;
        case RXRPC_SERVER_BOUND:
        case RXRPC_SERVER_LISTENING:
                ret = rxrpc_do_sendmsg(rx, m, len);
index 6d29a3603a3e6e262ca80bf1d137331e1bb5bd7d..884cff7bb169a6add2fce6635aa250d9f6caacf7 100644 (file)
@@ -488,7 +488,6 @@ enum rxrpc_call_flag {
        RXRPC_CALL_RX_LAST,             /* Received the last packet (at rxtx_top) */
        RXRPC_CALL_TX_LAST,             /* Last packet in Tx buffer (at rxtx_top) */
        RXRPC_CALL_SEND_PING,           /* A ping will need to be sent */
-       RXRPC_CALL_PINGING,             /* Ping in process */
        RXRPC_CALL_RETRANS_TIMEOUT,     /* Retransmission due to timeout occurred */
        RXRPC_CALL_BEGAN_RX_TIMER,      /* We began the expect_rx_by timer */
        RXRPC_CALL_RX_HEARD,            /* The peer responded at least once to this call */
@@ -673,9 +672,13 @@ struct rxrpc_call {
        rxrpc_seq_t             ackr_consumed;  /* Highest packet shown consumed */
        rxrpc_seq_t             ackr_seen;      /* Highest packet shown seen */
 
-       /* ping management */
-       rxrpc_serial_t          ping_serial;    /* Last ping sent */
-       ktime_t                 ping_time;      /* Time last ping sent */
+       /* RTT management */
+       rxrpc_serial_t          rtt_serial[4];  /* Serial number of DATA or PING sent */
+       ktime_t                 rtt_sent_at[4]; /* Time packet sent */
+       unsigned long           rtt_avail;      /* Mask of available slots in bits 0-3,
+                                                * Mask of pending samples in 8-11 */
+#define RXRPC_CALL_RTT_AVAIL_MASK      0xf
+#define RXRPC_CALL_RTT_PEND_SHIFT      8
 
        /* transmission-phase ACK management */
        ktime_t                 acks_latest_ts; /* Timestamp of latest ACK received */
@@ -1037,7 +1040,7 @@ static inline bool __rxrpc_abort_eproto(struct rxrpc_call *call,
 /*
  * rtt.c
  */
-void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace,
+void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace, int,
                        rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t);
 unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *, bool);
 void rxrpc_peer_init_rtt(struct rxrpc_peer *);
index 032ed76c0166da24f96a9a77fe954b1697aba52b..ef160566aa9a1e8c4664256c82bb6e7c129fb4bf 100644 (file)
@@ -622,7 +622,7 @@ int rxrpc_reject_call(struct rxrpc_sock *rx)
        case RXRPC_CALL_SERVER_ACCEPTING:
                __rxrpc_abort_call("REJ", call, 1, RX_USER_ABORT, -ECONNABORTED);
                abort = true;
-               /* fall through */
+               fallthrough;
        case RXRPC_CALL_COMPLETE:
                ret = call->error;
                goto out_discard;
index 38a46167523fa435e673483878a4ea145a9c2e8b..a40fae0139423a6672d99a0095bf52d42d2156cb 100644 (file)
@@ -153,6 +153,7 @@ struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *rx, gfp_t gfp,
        call->cong_ssthresh = RXRPC_RXTX_BUFF_SIZE - 1;
 
        call->rxnet = rxnet;
+       call->rtt_avail = RXRPC_CALL_RTT_AVAIL_MASK;
        atomic_inc(&rxnet->nr_calls);
        return call;
 
index f2a1a5dbb5a7bb21d47f33f3e2cf8fd1acd88192..159e3eda7914281de807c362b16aba1ecd78cb1e 100644 (file)
@@ -881,7 +881,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *call)
                        conn->cache_state = RXRPC_CONN_CLIENT_ACTIVE;
                        rxrpc_activate_channels_locked(conn);
                }
-               /* fall through */
+               fallthrough;
        case RXRPC_CONN_CLIENT_ACTIVE:
                if (list_empty(&conn->waiting_calls)) {
                        rxrpc_deactivate_one_channel(conn, channel);
index 767579328a0697b13e120a886ebddda4ec962c81..667c44aa5a63cb1abd90564ac67dccf094a3c0b2 100644 (file)
@@ -608,36 +608,57 @@ unlock:
 }
 
 /*
- * Process a requested ACK.
+ * See if there's a cached RTT probe to complete.
  */
-static void rxrpc_input_requested_ack(struct rxrpc_call *call,
-                                     ktime_t resp_time,
-                                     rxrpc_serial_t orig_serial,
-                                     rxrpc_serial_t ack_serial)
+static void rxrpc_complete_rtt_probe(struct rxrpc_call *call,
+                                    ktime_t resp_time,
+                                    rxrpc_serial_t acked_serial,
+                                    rxrpc_serial_t ack_serial,
+                                    enum rxrpc_rtt_rx_trace type)
 {
-       struct rxrpc_skb_priv *sp;
-       struct sk_buff *skb;
+       rxrpc_serial_t orig_serial;
+       unsigned long avail;
        ktime_t sent_at;
-       int ix;
+       bool matched = false;
+       int i;
 
-       for (ix = 0; ix < RXRPC_RXTX_BUFF_SIZE; ix++) {
-               skb = call->rxtx_buffer[ix];
-               if (!skb)
-                       continue;
+       avail = READ_ONCE(call->rtt_avail);
+       smp_rmb(); /* Read avail bits before accessing data. */
 
-               sent_at = skb->tstamp;
-               smp_rmb(); /* Read timestamp before serial. */
-               sp = rxrpc_skb(skb);
-               if (sp->hdr.serial != orig_serial)
+       for (i = 0; i < ARRAY_SIZE(call->rtt_serial); i++) {
+               if (!test_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &avail))
                        continue;
-               goto found;
-       }
 
-       return;
+               sent_at = call->rtt_sent_at[i];
+               orig_serial = call->rtt_serial[i];
+
+               if (orig_serial == acked_serial) {
+                       clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
+                       smp_mb(); /* Read data before setting avail bit */
+                       set_bit(i, &call->rtt_avail);
+                       if (type != rxrpc_rtt_rx_cancel)
+                               rxrpc_peer_add_rtt(call, type, i, acked_serial, ack_serial,
+                                                  sent_at, resp_time);
+                       else
+                               trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_cancel, i,
+                                                  orig_serial, acked_serial, 0, 0);
+                       matched = true;
+               }
+
+               /* If a later serial is being acked, then mark this slot as
+                * being available.
+                */
+               if (after(acked_serial, orig_serial)) {
+                       trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_obsolete, i,
+                                          orig_serial, acked_serial, 0, 0);
+                       clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
+                       smp_wmb();
+                       set_bit(i, &call->rtt_avail);
+               }
+       }
 
-found:
-       rxrpc_peer_add_rtt(call, rxrpc_rtt_rx_requested_ack,
-                          orig_serial, ack_serial, sent_at, resp_time);
+       if (!matched)
+               trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_lost, 9, 0, acked_serial, 0, 0);
 }
 
 /*
@@ -682,27 +703,11 @@ static void rxrpc_input_check_for_lost_ack(struct rxrpc_call *call)
  */
 static void rxrpc_input_ping_response(struct rxrpc_call *call,
                                      ktime_t resp_time,
-                                     rxrpc_serial_t orig_serial,
+                                     rxrpc_serial_t acked_serial,
                                      rxrpc_serial_t ack_serial)
 {
-       rxrpc_serial_t ping_serial;
-       ktime_t ping_time;
-
-       ping_time = call->ping_time;
-       smp_rmb();
-       ping_serial = READ_ONCE(call->ping_serial);
-
-       if (orig_serial == call->acks_lost_ping)
+       if (acked_serial == call->acks_lost_ping)
                rxrpc_input_check_for_lost_ack(call);
-
-       if (before(orig_serial, ping_serial) ||
-           !test_and_clear_bit(RXRPC_CALL_PINGING, &call->flags))
-               return;
-       if (after(orig_serial, ping_serial))
-               return;
-
-       rxrpc_peer_add_rtt(call, rxrpc_rtt_rx_ping_response,
-                          orig_serial, ack_serial, ping_time, resp_time);
 }
 
 /*
@@ -843,7 +848,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
                struct rxrpc_ackinfo info;
                u8 acks[RXRPC_MAXACKS];
        } buf;
-       rxrpc_serial_t acked_serial;
+       rxrpc_serial_t ack_serial, acked_serial;
        rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt;
        int nr_acks, offset, ioffset;
 
@@ -856,6 +861,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
        }
        offset += sizeof(buf.ack);
 
+       ack_serial = sp->hdr.serial;
        acked_serial = ntohl(buf.ack.serial);
        first_soft_ack = ntohl(buf.ack.firstPacket);
        prev_pkt = ntohl(buf.ack.previousPacket);
@@ -864,31 +870,42 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
        summary.ack_reason = (buf.ack.reason < RXRPC_ACK__INVALID ?
                              buf.ack.reason : RXRPC_ACK__INVALID);
 
-       trace_rxrpc_rx_ack(call, sp->hdr.serial, acked_serial,
+       trace_rxrpc_rx_ack(call, ack_serial, acked_serial,
                           first_soft_ack, prev_pkt,
                           summary.ack_reason, nr_acks);
 
-       if (buf.ack.reason == RXRPC_ACK_PING_RESPONSE)
+       switch (buf.ack.reason) {
+       case RXRPC_ACK_PING_RESPONSE:
                rxrpc_input_ping_response(call, skb->tstamp, acked_serial,
-                                         sp->hdr.serial);
-       if (buf.ack.reason == RXRPC_ACK_REQUESTED)
-               rxrpc_input_requested_ack(call, skb->tstamp, acked_serial,
-                                         sp->hdr.serial);
+                                         ack_serial);
+               rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
+                                        rxrpc_rtt_rx_ping_response);
+               break;
+       case RXRPC_ACK_REQUESTED:
+               rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
+                                        rxrpc_rtt_rx_requested_ack);
+               break;
+       default:
+               if (acked_serial != 0)
+                       rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
+                                                rxrpc_rtt_rx_cancel);
+               break;
+       }
 
        if (buf.ack.reason == RXRPC_ACK_PING) {
-               _proto("Rx ACK %%%u PING Request", sp->hdr.serial);
+               _proto("Rx ACK %%%u PING Request", ack_serial);
                rxrpc_propose_ACK(call, RXRPC_ACK_PING_RESPONSE,
-                                 sp->hdr.serial, true, true,
+                                 ack_serial, true, true,
                                  rxrpc_propose_ack_respond_to_ping);
        } else if (sp->hdr.flags & RXRPC_REQUEST_ACK) {
                rxrpc_propose_ACK(call, RXRPC_ACK_REQUESTED,
-                                 sp->hdr.serial, true, true,
+                                 ack_serial, true, true,
                                  rxrpc_propose_ack_respond_to_ack);
        }
 
        /* Discard any out-of-order or duplicate ACKs (outside lock). */
        if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
-               trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
+               trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial,
                                           first_soft_ack, call->ackr_first_seq,
                                           prev_pkt, call->ackr_prev_seq);
                return;
@@ -904,7 +921,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
 
        /* Discard any out-of-order or duplicate ACKs (inside lock). */
        if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
-               trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
+               trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial,
                                           first_soft_ack, call->ackr_first_seq,
                                           prev_pkt, call->ackr_prev_seq);
                goto out;
@@ -964,7 +981,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
            RXRPC_TX_ANNO_LAST &&
            summary.nr_acks == call->tx_top - hard_ack &&
            rxrpc_is_client_call(call))
-               rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial,
+               rxrpc_propose_ACK(call, RXRPC_ACK_PING, ack_serial,
                                  false, true,
                                  rxrpc_propose_ack_ping_for_lost_reply);
 
@@ -1084,7 +1101,7 @@ static void rxrpc_input_implicit_end_call(struct rxrpc_sock *rx,
        switch (READ_ONCE(call->state)) {
        case RXRPC_CALL_SERVER_AWAIT_ACK:
                rxrpc_call_completed(call);
-               /* Fall through */
+               fallthrough;
        case RXRPC_CALL_COMPLETE:
                break;
        default:
@@ -1243,12 +1260,12 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb)
        case RXRPC_PACKET_TYPE_BUSY:
                if (rxrpc_to_server(sp))
                        goto discard;
-               /* Fall through */
+               fallthrough;
        case RXRPC_PACKET_TYPE_ACK:
        case RXRPC_PACKET_TYPE_ACKALL:
                if (sp->hdr.callNumber == 0)
                        goto bad_message;
-               /* Fall through */
+               fallthrough;
        case RXRPC_PACKET_TYPE_ABORT:
                break;
 
index c8b2097f499c022513d879ed9b8e4ecb6e18454b..ede058f9cc15e9c8d08888bb7ca03bb50c3486ba 100644 (file)
@@ -162,7 +162,7 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net)
                /* Fall through and set IPv4 options too otherwise we don't get
                 * errors from IPv4 packets sent through the IPv6 socket.
                 */
-               /* Fall through */
+               fallthrough;
        case AF_INET:
                /* we want to receive ICMP errors */
                ip_sock_set_recverr(local->socket->sk);
index 1ba43c3df4adb227aab69af0a4979e093e087744..3cfff7922ba820219c82029b0e4d824175f178de 100644 (file)
@@ -123,6 +123,49 @@ static size_t rxrpc_fill_out_ack(struct rxrpc_connection *conn,
        return top - hard_ack + 3;
 }
 
+/*
+ * Record the beginning of an RTT probe.
+ */
+static int rxrpc_begin_rtt_probe(struct rxrpc_call *call, rxrpc_serial_t serial,
+                                enum rxrpc_rtt_tx_trace why)
+{
+       unsigned long avail = call->rtt_avail;
+       int rtt_slot = 9;
+
+       if (!(avail & RXRPC_CALL_RTT_AVAIL_MASK))
+               goto no_slot;
+
+       rtt_slot = __ffs(avail & RXRPC_CALL_RTT_AVAIL_MASK);
+       if (!test_and_clear_bit(rtt_slot, &call->rtt_avail))
+               goto no_slot;
+
+       call->rtt_serial[rtt_slot] = serial;
+       call->rtt_sent_at[rtt_slot] = ktime_get_real();
+       smp_wmb(); /* Write data before avail bit */
+       set_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
+
+       trace_rxrpc_rtt_tx(call, why, rtt_slot, serial);
+       return rtt_slot;
+
+no_slot:
+       trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_no_slot, rtt_slot, serial);
+       return -1;
+}
+
+/*
+ * Cancel an RTT probe.
+ */
+static void rxrpc_cancel_rtt_probe(struct rxrpc_call *call,
+                                  rxrpc_serial_t serial, int rtt_slot)
+{
+       if (rtt_slot != -1) {
+               clear_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
+               smp_wmb(); /* Clear pending bit before setting slot */
+               set_bit(rtt_slot, &call->rtt_avail);
+               trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_cancel, rtt_slot, serial);
+       }
+}
+
 /*
  * Send an ACK call packet.
  */
@@ -136,7 +179,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping,
        rxrpc_serial_t serial;
        rxrpc_seq_t hard_ack, top;
        size_t len, n;
-       int ret;
+       int ret, rtt_slot = -1;
        u8 reason;
 
        if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
@@ -196,18 +239,8 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping,
        if (_serial)
                *_serial = serial;
 
-       if (ping) {
-               call->ping_serial = serial;
-               smp_wmb();
-               /* We need to stick a time in before we send the packet in case
-                * the reply gets back before kernel_sendmsg() completes - but
-                * asking UDP to send the packet can take a relatively long
-                * time.
-                */
-               call->ping_time = ktime_get_real();
-               set_bit(RXRPC_CALL_PINGING, &call->flags);
-               trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_ping, serial);
-       }
+       if (ping)
+               rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_ping);
 
        ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
        conn->params.peer->last_tx_at = ktime_get_seconds();
@@ -221,8 +254,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping,
 
        if (call->state < RXRPC_CALL_COMPLETE) {
                if (ret < 0) {
-                       if (ping)
-                               clear_bit(RXRPC_CALL_PINGING, &call->flags);
+                       rxrpc_cancel_rtt_probe(call, serial, rtt_slot);
                        rxrpc_propose_ACK(call, pkt->ack.reason,
                                          ntohl(pkt->ack.serial),
                                          false, true,
@@ -321,7 +353,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
        struct kvec iov[2];
        rxrpc_serial_t serial;
        size_t len;
-       int ret;
+       int ret, rtt_slot = -1;
 
        _enter(",{%d}", skb->len);
 
@@ -397,6 +429,8 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
        sp->hdr.serial = serial;
        smp_wmb(); /* Set serial before timestamp */
        skb->tstamp = ktime_get_real();
+       if (whdr.flags & RXRPC_REQUEST_ACK)
+               rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data);
 
        /* send the packet by UDP
         * - returns -EMSGSIZE if UDP would have to fragment the packet
@@ -408,12 +442,15 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
        conn->params.peer->last_tx_at = ktime_get_seconds();
 
        up_read(&conn->params.local->defrag_sem);
-       if (ret < 0)
+       if (ret < 0) {
+               rxrpc_cancel_rtt_probe(call, serial, rtt_slot);
                trace_rxrpc_tx_fail(call->debug_id, serial, ret,
                                    rxrpc_tx_point_call_data_nofrag);
-       else
+       } else {
                trace_rxrpc_tx_packet(call->debug_id, &whdr,
                                      rxrpc_tx_point_call_data_nofrag);
+       }
+
        rxrpc_tx_backoff(call, ret);
        if (ret == -EMSGSIZE)
                goto send_fragmentable;
@@ -422,7 +459,6 @@ done:
        if (ret >= 0) {
                if (whdr.flags & RXRPC_REQUEST_ACK) {
                        call->peer->rtt_last_req = skb->tstamp;
-                       trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial);
                        if (call->peer->rtt_count > 1) {
                                unsigned long nowj = jiffies, ack_lost_at;
 
@@ -469,6 +505,8 @@ send_fragmentable:
        sp->hdr.serial = serial;
        smp_wmb(); /* Set serial before timestamp */
        skb->tstamp = ktime_get_real();
+       if (whdr.flags & RXRPC_REQUEST_ACK)
+               rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data);
 
        switch (conn->params.local->srx.transport.family) {
        case AF_INET6:
@@ -487,12 +525,14 @@ send_fragmentable:
                BUG();
        }
 
-       if (ret < 0)
+       if (ret < 0) {
+               rxrpc_cancel_rtt_probe(call, serial, rtt_slot);
                trace_rxrpc_tx_fail(call->debug_id, serial, ret,
                                    rxrpc_tx_point_call_data_frag);
-       else
+       } else {
                trace_rxrpc_tx_packet(call->debug_id, &whdr,
                                      rxrpc_tx_point_call_data_frag);
+       }
        rxrpc_tx_backoff(call, ret);
 
        up_write(&conn->params.local->defrag_sem);
index a852f46d5234d78e7c2e45e3da3965c58f3adc40..be032850ae8ca042cd3b4ab262e6fc25928fe5a0 100644 (file)
@@ -273,7 +273,7 @@ static void rxrpc_store_error(struct rxrpc_peer *peer,
        case SO_EE_ORIGIN_ICMP6:
                if (err == EACCES)
                        err = EHOSTUNREACH;
-               /* Fall through */
+               fallthrough;
        default:
                _proto("Rx Received error report { orig=%u }", ee->ee_origin);
                break;
index ca29976bb193efd37fb9bc7f83cbdd4aa51f1737..68396d05205252177ea9525b43972f1598480e12 100644 (file)
@@ -502,11 +502,21 @@ EXPORT_SYMBOL(rxrpc_kernel_get_peer);
  * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT
  * @sock: The socket on which the call is in progress.
  * @call: The call to query
+ * @_srtt: Where to store the SRTT value.
  *
- * Get the call's peer smoothed RTT.
+ * Get the call's peer smoothed RTT in uS.
  */
-u32 rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call)
+bool rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call,
+                          u32 *_srtt)
 {
-       return call->peer->srtt_us >> 3;
+       struct rxrpc_peer *peer = call->peer;
+
+       if (peer->rtt_count == 0) {
+               *_srtt = 1000000; /* 1S */
+               return false;
+       }
+
+       *_srtt = call->peer->srtt_us >> 3;
+       return true;
 }
 EXPORT_SYMBOL(rxrpc_kernel_get_srtt);
index efecc5a8f67d74a4f1c2ee15d8e72fb3dbea9f41..c4684dde1f160b394ae783c758c8a573e8b3979b 100644 (file)
@@ -776,7 +776,7 @@ out:
        case RXRPC_ACK_DELAY:
                if (ret != -EAGAIN)
                        break;
-               /* Fall through */
+               fallthrough;
        default:
                rxrpc_send_ack_packet(call, false, NULL);
        }
index 928d8b34a3eeee8685edc2f617a47036b9fac0ba..1221b0637a7ecce9f2e7eda92394abe700e2ec9d 100644 (file)
@@ -146,6 +146,7 @@ static void rxrpc_ack_update_rtt(struct rxrpc_peer *peer, long rtt_us)
  * exclusive access to the peer RTT data.
  */
 void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
+                       int rtt_slot,
                        rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
                        ktime_t send_time, ktime_t resp_time)
 {
@@ -162,7 +163,7 @@ void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
                peer->rtt_count++;
        spin_unlock(&peer->rtt_input_lock);
 
-       trace_rxrpc_rtt_rx(call, why, send_serial, resp_serial,
+       trace_rxrpc_rtt_rx(call, why, rtt_slot, send_serial, resp_serial,
                           peer->srtt_us >> 3, peer->rto_j);
 }
 
index 52a24d4ef5d8a841a6e0f1ad58c14873ae03e666..e08130e5746b552ee1b0b948da510af6260587ff 100644 (file)
@@ -1137,7 +1137,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn,
        ret = -ENOMEM;
        ticket = kmalloc(ticket_len, GFP_NOFS);
        if (!ticket)
-               goto temporary_error;
+               goto temporary_error_free_resp;
 
        eproto = tracepoint_string("rxkad_tkt_short");
        abort_code = RXKADPACKETSHORT;
@@ -1230,6 +1230,7 @@ protocol_error:
 
 temporary_error_free_ticket:
        kfree(ticket);
+temporary_error_free_resp:
        kfree(response);
 temporary_error:
        /* Ignore the response packet if we got a temporary error such as
index f3f6da6e4ad29cabd9c767ce63334555f8d952ac..0824e103d037d4bde1547ac62a21840c1e0a36eb 100644 (file)
@@ -241,7 +241,7 @@ static int rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
                        trace_rxrpc_timer(call, rxrpc_timer_init_for_send_reply, now);
                        if (!last)
                                break;
-                       /* Fall through */
+                       fallthrough;
                case RXRPC_CALL_SERVER_SEND_REPLY:
                        call->state = RXRPC_CALL_SERVER_AWAIT_ACK;
                        rxrpc_notify_end_tx(rx, call, notify_end_tx);
@@ -721,13 +721,13 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
                if (p.call.timeouts.normal > 0 && j == 0)
                        j = 1;
                WRITE_ONCE(call->next_rx_timo, j);
-               /* Fall through */
+               fallthrough;
        case 2:
                j = msecs_to_jiffies(p.call.timeouts.idle);
                if (p.call.timeouts.idle > 0 && j == 0)
                        j = 1;
                WRITE_ONCE(call->next_req_timo, j);
-               /* Fall through */
+               fallthrough;
        case 1:
                if (p.call.timeouts.hard > 0) {
                        j = msecs_to_jiffies(p.call.timeouts.hard);
index c1fcd85719d6a7fa86e65ebb89e82e0d931b7ea0..5c568757643b27bbfd31d5991cc6c9b27a5a08bf 100644 (file)
@@ -436,6 +436,25 @@ static void tcf_ife_cleanup(struct tc_action *a)
                kfree_rcu(p, rcu);
 }
 
+static int load_metalist(struct nlattr **tb, bool rtnl_held)
+{
+       int i;
+
+       for (i = 1; i < max_metacnt; i++) {
+               if (tb[i]) {
+                       void *val = nla_data(tb[i]);
+                       int len = nla_len(tb[i]);
+                       int rc;
+
+                       rc = load_metaops_and_vet(i, val, len, rtnl_held);
+                       if (rc != 0)
+                               return rc;
+               }
+       }
+
+       return 0;
+}
+
 static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,
                             bool exists, bool rtnl_held)
 {
@@ -449,10 +468,6 @@ static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,
                        val = nla_data(tb[i]);
                        len = nla_len(tb[i]);
 
-                       rc = load_metaops_and_vet(i, val, len, rtnl_held);
-                       if (rc != 0)
-                               return rc;
-
                        rc = add_metainfo(ife, i, val, len, exists);
                        if (rc)
                                return rc;
@@ -509,6 +524,21 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
        if (!p)
                return -ENOMEM;
 
+       if (tb[TCA_IFE_METALST]) {
+               err = nla_parse_nested_deprecated(tb2, IFE_META_MAX,
+                                                 tb[TCA_IFE_METALST], NULL,
+                                                 NULL);
+               if (err) {
+                       kfree(p);
+                       return err;
+               }
+               err = load_metalist(tb2, rtnl_held);
+               if (err) {
+                       kfree(p);
+                       return err;
+               }
+       }
+
        index = parm->index;
        err = tcf_idr_check_alloc(tn, &index, a, bind);
        if (err < 0) {
@@ -570,15 +600,9 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
        }
 
        if (tb[TCA_IFE_METALST]) {
-               err = nla_parse_nested_deprecated(tb2, IFE_META_MAX,
-                                                 tb[TCA_IFE_METALST], NULL,
-                                                 NULL);
-               if (err)
-                       goto metadata_parse_err;
                err = populate_metalist(ife, tb2, exists, rtnl_held);
                if (err)
                        goto metadata_parse_err;
-
        } else {
                /* if no passed metadata allow list or passed allow-all
                 * then here we process by adding as many supported metadatum
index 536c4bc31be60c35d0881fd3380aaebb42ab2d69..37f1e10f35e0020e4d68773ffcc90e057a202c48 100644 (file)
@@ -156,6 +156,7 @@ tunnel_key_copy_vxlan_opt(const struct nlattr *nla, void *dst, int dst_len,
                struct vxlan_metadata *md = dst;
 
                md->gbp = nla_get_u32(tb[TCA_TUNNEL_KEY_ENC_OPT_VXLAN_GBP]);
+               md->gbp &= VXLAN_GBP_MASK;
        }
 
        return sizeof(struct vxlan_metadata);
index a4f7ef1de7e787a2c4c75d5c8eeae6b7fbb2ee34..fed18fd2c50ba9f85db1f35659ff911ec080f13c 100644 (file)
@@ -1175,8 +1175,10 @@ static int fl_set_vxlan_opt(const struct nlattr *nla, struct fl_flow_key *key,
                return -EINVAL;
        }
 
-       if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP])
+       if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]) {
                md->gbp = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]);
+               md->gbp &= VXLAN_GBP_MASK;
+       }
 
        return sizeof(*md);
 }
@@ -1221,6 +1223,7 @@ static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key,
                }
                if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]) {
                        nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX];
+                       memset(&md->u, 0x00, sizeof(md->u));
                        md->u.index = nla_get_be32(nla);
                }
        } else if (md->version == 2) {
index 0618b63f87c410422ea78733898033caa32272d4..7d37638ee1c7a9dd0706b27a36fbe58cbf234010 100644 (file)
@@ -1670,7 +1670,7 @@ static u32 cake_classify(struct Qdisc *sch, struct cake_tin_data **t,
                case TC_ACT_QUEUED:
                case TC_ACT_TRAP:
                        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
-                       /* fall through */
+                       fallthrough;
                case TC_ACT_SHOT:
                        return 0;
                }
index 265a61d011dfaa7ec0f8fb8aaede920784f690c9..54c417244642a1445c618e6adf0e38b2d4f84565 100644 (file)
@@ -1131,24 +1131,10 @@ EXPORT_SYMBOL(dev_activate);
 
 static void qdisc_deactivate(struct Qdisc *qdisc)
 {
-       bool nolock = qdisc->flags & TCQ_F_NOLOCK;
-
        if (qdisc->flags & TCQ_F_BUILTIN)
                return;
-       if (test_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state))
-               return;
-
-       if (nolock)
-               spin_lock_bh(&qdisc->seqlock);
-       spin_lock_bh(qdisc_lock(qdisc));
 
        set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state);
-
-       qdisc_reset(qdisc);
-
-       spin_unlock_bh(qdisc_lock(qdisc));
-       if (nolock)
-               spin_unlock_bh(&qdisc->seqlock);
 }
 
 static void dev_deactivate_queue(struct net_device *dev,
@@ -1165,6 +1151,30 @@ static void dev_deactivate_queue(struct net_device *dev,
        }
 }
 
+static void dev_reset_queue(struct net_device *dev,
+                           struct netdev_queue *dev_queue,
+                           void *_unused)
+{
+       struct Qdisc *qdisc;
+       bool nolock;
+
+       qdisc = dev_queue->qdisc_sleeping;
+       if (!qdisc)
+               return;
+
+       nolock = qdisc->flags & TCQ_F_NOLOCK;
+
+       if (nolock)
+               spin_lock_bh(&qdisc->seqlock);
+       spin_lock_bh(qdisc_lock(qdisc));
+
+       qdisc_reset(qdisc);
+
+       spin_unlock_bh(qdisc_lock(qdisc));
+       if (nolock)
+               spin_unlock_bh(&qdisc->seqlock);
+}
+
 static bool some_qdisc_is_busy(struct net_device *dev)
 {
        unsigned int i;
@@ -1213,12 +1223,20 @@ void dev_deactivate_many(struct list_head *head)
                dev_watchdog_down(dev);
        }
 
-       /* Wait for outstanding qdisc-less dev_queue_xmit calls.
+       /* Wait for outstanding qdisc-less dev_queue_xmit calls or
+        * outstanding qdisc enqueuing calls.
         * This is avoided if all devices are in dismantle phase :
         * Caller will call synchronize_net() for us
         */
        synchronize_net();
 
+       list_for_each_entry(dev, head, close_list) {
+               netdev_for_each_tx_queue(dev, dev_reset_queue, NULL);
+
+               if (dev_ingress_queue(dev))
+                       dev_reset_queue(dev, dev_ingress_queue(dev), NULL);
+       }
+
        /* Wait for outstanding qdisc_run calls. */
        list_for_each_entry(dev, head, close_list) {
                while (some_qdisc_is_busy(dev)) {
index deac82f3ad7b860b7494901e5084863a3cc13e0c..e89fab6ccb34f733a474111a08128076b8c77198 100644 (file)
@@ -353,23 +353,11 @@ static int red_init(struct Qdisc *sch, struct nlattr *opt,
                              FLOW_BLOCK_BINDER_TYPE_RED_EARLY_DROP,
                              tb[TCA_RED_EARLY_DROP_BLOCK], extack);
        if (err)
-               goto err_early_drop_init;
-
-       err = tcf_qevent_init(&q->qe_mark, sch,
-                             FLOW_BLOCK_BINDER_TYPE_RED_MARK,
-                             tb[TCA_RED_MARK_BLOCK], extack);
-       if (err)
-               goto err_mark_init;
-
-       return 0;
+               return err;
 
-err_mark_init:
-       tcf_qevent_destroy(&q->qe_early_drop, sch);
-err_early_drop_init:
-       del_timer_sync(&q->adapt_timer);
-       red_offload(sch, false);
-       qdisc_put(q->qdisc);
-       return err;
+       return tcf_qevent_init(&q->qe_mark, sch,
+                              FLOW_BLOCK_BINDER_TYPE_RED_MARK,
+                              tb[TCA_RED_MARK_BLOCK], extack);
 }
 
 static int red_change(struct Qdisc *sch, struct nlattr *opt,
index e981992634ddfe9373fe19d4915615bf5c334691..b0ad7687ee2c85de6d9c7264a886af87c553e8b5 100644 (file)
@@ -777,9 +777,11 @@ static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = {
        [TCA_TAPRIO_ATTR_TXTIME_DELAY]               = { .type = NLA_U32 },
 };
 
-static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
+static int fill_sched_entry(struct taprio_sched *q, struct nlattr **tb,
+                           struct sched_entry *entry,
                            struct netlink_ext_ack *extack)
 {
+       int min_duration = length_to_duration(q, ETH_ZLEN);
        u32 interval = 0;
 
        if (tb[TCA_TAPRIO_SCHED_ENTRY_CMD])
@@ -794,7 +796,10 @@ static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
                interval = nla_get_u32(
                        tb[TCA_TAPRIO_SCHED_ENTRY_INTERVAL]);
 
-       if (interval == 0) {
+       /* The interval should allow at least the minimum ethernet
+        * frame to go out.
+        */
+       if (interval < min_duration) {
                NL_SET_ERR_MSG(extack, "Invalid interval for schedule entry");
                return -EINVAL;
        }
@@ -804,8 +809,9 @@ static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
        return 0;
 }
 
-static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry,
-                            int index, struct netlink_ext_ack *extack)
+static int parse_sched_entry(struct taprio_sched *q, struct nlattr *n,
+                            struct sched_entry *entry, int index,
+                            struct netlink_ext_ack *extack)
 {
        struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { };
        int err;
@@ -819,10 +825,10 @@ static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry,
 
        entry->index = index;
 
-       return fill_sched_entry(tb, entry, extack);
+       return fill_sched_entry(q, tb, entry, extack);
 }
 
-static int parse_sched_list(struct nlattr *list,
+static int parse_sched_list(struct taprio_sched *q, struct nlattr *list,
                            struct sched_gate_list *sched,
                            struct netlink_ext_ack *extack)
 {
@@ -847,7 +853,7 @@ static int parse_sched_list(struct nlattr *list,
                        return -ENOMEM;
                }
 
-               err = parse_sched_entry(n, entry, i, extack);
+               err = parse_sched_entry(q, n, entry, i, extack);
                if (err < 0) {
                        kfree(entry);
                        return err;
@@ -862,7 +868,7 @@ static int parse_sched_list(struct nlattr *list,
        return i;
 }
 
-static int parse_taprio_schedule(struct nlattr **tb,
+static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
                                 struct sched_gate_list *new,
                                 struct netlink_ext_ack *extack)
 {
@@ -883,8 +889,8 @@ static int parse_taprio_schedule(struct nlattr **tb,
                new->cycle_time = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME]);
 
        if (tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST])
-               err = parse_sched_list(
-                       tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST], new, extack);
+               err = parse_sched_list(q, tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST],
+                                      new, extack);
        if (err < 0)
                return err;
 
@@ -1176,9 +1182,27 @@ static void taprio_offload_config_changed(struct taprio_sched *q)
        spin_unlock(&q->current_entry_lock);
 }
 
-static void taprio_sched_to_offload(struct taprio_sched *q,
+static u32 tc_map_to_queue_mask(struct net_device *dev, u32 tc_mask)
+{
+       u32 i, queue_mask = 0;
+
+       for (i = 0; i < dev->num_tc; i++) {
+               u32 offset, count;
+
+               if (!(tc_mask & BIT(i)))
+                       continue;
+
+               offset = dev->tc_to_txq[i].offset;
+               count = dev->tc_to_txq[i].count;
+
+               queue_mask |= GENMASK(offset + count - 1, offset);
+       }
+
+       return queue_mask;
+}
+
+static void taprio_sched_to_offload(struct net_device *dev,
                                    struct sched_gate_list *sched,
-                                   const struct tc_mqprio_qopt *mqprio,
                                    struct tc_taprio_qopt_offload *offload)
 {
        struct sched_entry *entry;
@@ -1193,7 +1217,8 @@ static void taprio_sched_to_offload(struct taprio_sched *q,
 
                e->command = entry->command;
                e->interval = entry->interval;
-               e->gate_mask = entry->gate_mask;
+               e->gate_mask = tc_map_to_queue_mask(dev, entry->gate_mask);
+
                i++;
        }
 
@@ -1201,7 +1226,6 @@ static void taprio_sched_to_offload(struct taprio_sched *q,
 }
 
 static int taprio_enable_offload(struct net_device *dev,
-                                struct tc_mqprio_qopt *mqprio,
                                 struct taprio_sched *q,
                                 struct sched_gate_list *sched,
                                 struct netlink_ext_ack *extack)
@@ -1223,7 +1247,7 @@ static int taprio_enable_offload(struct net_device *dev,
                return -ENOMEM;
        }
        offload->enable = 1;
-       taprio_sched_to_offload(q, sched, mqprio, offload);
+       taprio_sched_to_offload(dev, sched, offload);
 
        err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_TAPRIO, offload);
        if (err < 0) {
@@ -1455,7 +1479,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
                goto free_sched;
        }
 
-       err = parse_taprio_schedule(tb, new_admin, extack);
+       err = parse_taprio_schedule(q, tb, new_admin, extack);
        if (err < 0)
                goto free_sched;
 
@@ -1485,7 +1509,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
        }
 
        if (FULL_OFFLOAD_IS_ENABLED(q->flags))
-               err = taprio_enable_offload(dev, mqprio, q, new_admin, extack);
+               err = taprio_enable_offload(dev, q, new_admin, extack);
        else
                err = taprio_disable_offload(dev, q, extack);
        if (err)
index aea2a982984d0283de6bbdfbd3eb7a817cc61e2f..8a58f42d6d1954996b8b8c1ac6925b57100e792b 100644 (file)
@@ -875,7 +875,7 @@ static int sctp_inet6_af_supported(sa_family_t family, struct sctp_sock *sp)
        case AF_INET:
                if (!__ipv6_only_sock(sctp_opt2sk(sp)))
                        return 1;
-               /* fallthru */
+               fallthrough;
        default:
                return 0;
        }
index 577e3bc4ee6f1691cfa93733fbecec23baf4c78e..3fd06a27105ddbfdaf9fc288558d57e471572341 100644 (file)
@@ -912,7 +912,7 @@ static void sctp_outq_flush_ctrl(struct sctp_flush_ctx *ctx)
                case SCTP_CID_ABORT:
                        if (sctp_test_T_bit(chunk))
                                ctx->packet->vtag = ctx->asoc->c.my_vtag;
-                       /* fallthru */
+                       fallthrough;
 
                /* The following chunks are "response" chunks, i.e.
                 * they are generated in response to something we
@@ -927,7 +927,7 @@ static void sctp_outq_flush_ctrl(struct sctp_flush_ctx *ctx)
                case SCTP_CID_ECN_CWR:
                case SCTP_CID_ASCONF_ACK:
                        one_packet = 1;
-                       /* Fall through */
+                       fallthrough;
 
                case SCTP_CID_SACK:
                case SCTP_CID_HEARTBEAT:
@@ -1030,7 +1030,7 @@ static void sctp_outq_flush_data(struct sctp_flush_ctx *ctx,
                if (!ctx->packet || !ctx->packet->has_cookie_echo)
                        return;
 
-               /* fall through */
+               fallthrough;
        case SCTP_STATE_ESTABLISHED:
        case SCTP_STATE_SHUTDOWN_PENDING:
        case SCTP_STATE_SHUTDOWN_RECEIVED:
index 47910470e53283d9a9143120049c43b0b7db1894..c11c24524652c51c78b0ae292d85758bc865d4de 100644 (file)
@@ -2077,7 +2077,7 @@ static enum sctp_ierror sctp_process_unk_param(
                break;
        case SCTP_PARAM_ACTION_DISCARD_ERR:
                retval =  SCTP_IERROR_ERROR;
-               /* Fall through */
+               fallthrough;
        case SCTP_PARAM_ACTION_SKIP_ERR:
                /* Make an ERROR chunk, preparing enough room for
                 * returning multiple unknown parameters.
index 9f36fe911d082e9fa3e3de7096d56323a93d4ba6..aa821e71f05e77532cd42237233820099dc2b80d 100644 (file)
@@ -1516,7 +1516,7 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type,
 
                        if (timer_pending(timer))
                                break;
-                       /* fall through */
+                       fallthrough;
 
                case SCTP_CMD_TIMER_START:
                        timer = &asoc->timers[cmd->obj.to];
index e86620fbd90fd0ecc80b499c6ae058aa4476cc99..c669f8bd1eab2f629bd4bf26a041921d2dcabb44 100644 (file)
@@ -4315,7 +4315,7 @@ enum sctp_disposition sctp_sf_eat_auth(struct net *net,
                        sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
                                        SCTP_CHUNK(err_chunk));
                }
-               /* Fall Through */
+               fallthrough;
        case SCTP_IERROR_AUTH_BAD_KEYID:
        case SCTP_IERROR_BAD_SIG:
                return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
index ec1fba1fbe717ab64a37e8b7cb06e8d0a2186b4e..53d0a4161df3f8174819b33816091b44b757a75f 100644 (file)
@@ -8060,8 +8060,6 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
 
        pr_debug("%s: begins, snum:%d\n", __func__, snum);
 
-       local_bh_disable();
-
        if (snum == 0) {
                /* Search for an available port. */
                int low, high, remaining, index;
@@ -8079,20 +8077,21 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
                                continue;
                        index = sctp_phashfn(net, rover);
                        head = &sctp_port_hashtable[index];
-                       spin_lock(&head->lock);
+                       spin_lock_bh(&head->lock);
                        sctp_for_each_hentry(pp, &head->chain)
                                if ((pp->port == rover) &&
                                    net_eq(net, pp->net))
                                        goto next;
                        break;
                next:
-                       spin_unlock(&head->lock);
+                       spin_unlock_bh(&head->lock);
+                       cond_resched();
                } while (--remaining > 0);
 
                /* Exhausted local port range during search? */
                ret = 1;
                if (remaining <= 0)
-                       goto fail;
+                       return ret;
 
                /* OK, here is the one we will use.  HEAD (the port
                 * hash table list entry) is non-NULL and we hold it's
@@ -8107,7 +8106,7 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
                 * port iterator, pp being NULL.
                 */
                head = &sctp_port_hashtable[sctp_phashfn(net, snum)];
-               spin_lock(&head->lock);
+               spin_lock_bh(&head->lock);
                sctp_for_each_hentry(pp, &head->chain) {
                        if ((pp->port == snum) && net_eq(pp->net, net))
                                goto pp_found;
@@ -8207,10 +8206,7 @@ success:
        ret = 0;
 
 fail_unlock:
-       spin_unlock(&head->lock);
-
-fail:
-       local_bh_enable();
+       spin_unlock_bh(&head->lock);
        return ret;
 }
 
@@ -9224,13 +9220,10 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
 static inline void sctp_copy_descendant(struct sock *sk_to,
                                        const struct sock *sk_from)
 {
-       int ancestor_size = sizeof(struct inet_sock) +
-                           sizeof(struct sctp_sock) -
-                           offsetof(struct sctp_sock, pd_lobby);
-
-       if (sk_from->sk_family == PF_INET6)
-               ancestor_size += sizeof(struct ipv6_pinfo);
+       size_t ancestor_size = sizeof(struct inet_sock);
 
+       ancestor_size += sk_from->sk_prot->obj_size;
+       ancestor_size -= offsetof(struct sctp_sock, pd_lobby);
        __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size);
 }
 
index 290270c821ca47765dc82bd1909810795ad21804..0e7409e469c02df8ba02ef90d9cfa5595c244240 100644 (file)
@@ -116,7 +116,6 @@ static void smc_close_cancel_work(struct smc_sock *smc)
        cancel_work_sync(&smc->conn.close_work);
        cancel_delayed_work_sync(&smc->conn.tx_work);
        lock_sock(sk);
-       sk->sk_state = SMC_CLOSED;
 }
 
 /* terminate smc socket abnormally - active abort
@@ -134,22 +133,22 @@ void smc_close_active_abort(struct smc_sock *smc)
        }
        switch (sk->sk_state) {
        case SMC_ACTIVE:
-               sk->sk_state = SMC_PEERABORTWAIT;
-               smc_close_cancel_work(smc);
-               sk->sk_state = SMC_CLOSED;
-               sock_put(sk); /* passive closing */
-               break;
        case SMC_APPCLOSEWAIT1:
        case SMC_APPCLOSEWAIT2:
+               sk->sk_state = SMC_PEERABORTWAIT;
                smc_close_cancel_work(smc);
+               if (sk->sk_state != SMC_PEERABORTWAIT)
+                       break;
                sk->sk_state = SMC_CLOSED;
-               sock_put(sk); /* postponed passive closing */
+               sock_put(sk); /* (postponed) passive closing */
                break;
        case SMC_PEERCLOSEWAIT1:
        case SMC_PEERCLOSEWAIT2:
        case SMC_PEERFINCLOSEWAIT:
                sk->sk_state = SMC_PEERABORTWAIT;
                smc_close_cancel_work(smc);
+               if (sk->sk_state != SMC_PEERABORTWAIT)
+                       break;
                sk->sk_state = SMC_CLOSED;
                smc_conn_free(&smc->conn);
                release_clcsock = true;
@@ -159,6 +158,8 @@ void smc_close_active_abort(struct smc_sock *smc)
        case SMC_APPFINCLOSEWAIT:
                sk->sk_state = SMC_PEERABORTWAIT;
                smc_close_cancel_work(smc);
+               if (sk->sk_state != SMC_PEERABORTWAIT)
+                       break;
                sk->sk_state = SMC_CLOSED;
                smc_conn_free(&smc->conn);
                release_clcsock = true;
@@ -372,7 +373,7 @@ static void smc_close_passive_work(struct work_struct *work)
        case SMC_PEERCLOSEWAIT1:
                if (rxflags->peer_done_writing)
                        sk->sk_state = SMC_PEERCLOSEWAIT2;
-               /* fall through */
+               fallthrough;
                /* to check for closing */
        case SMC_PEERCLOSEWAIT2:
                if (!smc_cdc_rxed_any_close(conn))
index b42fa3b00d00ae3507efe577fe1cfd5a6abf522b..a406627b1d552949f39611d02aee96da243862ac 100644 (file)
@@ -1356,6 +1356,8 @@ create:
        if (ini->is_smcd) {
                conn->rx_off = sizeof(struct smcd_cdc_msg);
                smcd_cdc_rx_init(conn); /* init tasklet for this conn */
+       } else {
+               conn->rx_off = 0;
        }
 #ifndef KERNEL_HAS_ATOMIC64
        spin_lock_init(&conn->acurs_lock);
@@ -1777,6 +1779,7 @@ int smc_buf_create(struct smc_sock *smc, bool is_smcd)
                list_del(&smc->conn.sndbuf_desc->list);
                mutex_unlock(&smc->conn.lgr->sndbufs_lock);
                smc_buf_free(smc->conn.lgr, false, smc->conn.sndbuf_desc);
+               smc->conn.sndbuf_desc = NULL;
        }
        return rc;
 }
index df5b0a6ea8488ffb53fb5a4aa5b564d557ee4400..3ea33466ebe98c7d39afd442ed37bcaa0fab5b8a 100644 (file)
@@ -841,6 +841,9 @@ int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry)
        struct smc_init_info ini;
        int lnk_idx, rc = 0;
 
+       if (!llc->qp_mtu)
+               goto out_reject;
+
        ini.vlan_id = lgr->vlan_id;
        smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev);
        if (!memcmp(llc->sender_gid, link->peer_gid, SMC_GID_SIZE) &&
@@ -917,10 +920,20 @@ out:
        kfree(qentry);
 }
 
+static bool smc_llc_is_empty_llc_message(union smc_llc_msg *llc)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(llc->raw.data); i++)
+               if (llc->raw.data[i])
+                       return false;
+       return true;
+}
+
 static bool smc_llc_is_local_add_link(union smc_llc_msg *llc)
 {
        if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK &&
-           !llc->add_link.qp_mtu && !llc->add_link.link_num)
+           smc_llc_is_empty_llc_message(llc))
                return true;
        return false;
 }
index dbbe8ea7d395dadf690a4c2dfdf60ed40c49df6d..0c0144604f818a77fed154aafa5c504e9a99e1f9 100644 (file)
@@ -3610,7 +3610,7 @@ int kernel_getsockname(struct socket *sock, struct sockaddr *addr)
 EXPORT_SYMBOL(kernel_getsockname);
 
 /**
- *     kernel_peername - get the address which the socket is connected (kernel space)
+ *     kernel_getpeername - get the address which the socket is connected (kernel space)
  *     @sock: socket
  *     @addr: address holder
  *
@@ -3671,7 +3671,7 @@ int kernel_sendpage_locked(struct sock *sk, struct page *page, int offset,
 EXPORT_SYMBOL(kernel_sendpage_locked);
 
 /**
- *     kernel_shutdown - shut down part of a full-duplex connection (kernel space)
+ *     kernel_sock_shutdown - shut down part of a full-duplex connection (kernel space)
  *     @sock: socket
  *     @how: connection part
  *
index 90b8329fef8242c0d2538a36669c3460e8906309..8b300b74a722178bc0807400e3a807d1fd8078d7 100644 (file)
@@ -137,7 +137,7 @@ gss_krb5_make_confounder(char *p, u32 conflen)
        switch (conflen) {
        case 16:
                *q++ = i++;
-               /* fall through */
+               fallthrough;
        case 8:
                *q++ = i++;
                break;
index d26036a5744320c430b5c3882cf61d5801eddacf..76685abba60fec016a92efe6b08503b92067ae4f 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/sunrpc/svc_xprt.h>
 #include <linux/sunrpc/auth_gss.h>
 #include <linux/sunrpc/gss_err.h>
-#include <linux/sunrpc/auth_gss.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/rpcgss.h>
index a91d1cdad9d7e02a3d4ebeda496fc80669beae27..62e0b6c1e8cf9d47bfa609727599c93bf604bea3 100644 (file)
@@ -1702,7 +1702,7 @@ call_reserveresult(struct rpc_task *task)
        switch (status) {
        case -ENOMEM:
                rpc_delay(task, HZ >> 2);
-               /* fall through */
+               fallthrough;
        case -EAGAIN:   /* woken up; retry */
                task->tk_action = call_retry_reserve;
                return;
@@ -1759,13 +1759,13 @@ call_refreshresult(struct rpc_task *task)
                /* Use rate-limiting and a max number of retries if refresh
                 * had status 0 but failed to update the cred.
                 */
-               /* fall through */
+               fallthrough;
        case -ETIMEDOUT:
                rpc_delay(task, 3*HZ);
-               /* fall through */
+               fallthrough;
        case -EAGAIN:
                status = -EACCES;
-               /* fall through */
+               fallthrough;
        case -EKEYEXPIRED:
                if (!task->tk_cred_retry)
                        break;
@@ -2132,7 +2132,7 @@ call_connect_status(struct rpc_task *task)
                        rpc_force_rebind(clnt);
                        goto out_retry;
                }
-               /* fall through */
+               fallthrough;
        case -ECONNRESET:
        case -ECONNABORTED:
        case -ENETDOWN:
@@ -2146,7 +2146,7 @@ call_connect_status(struct rpc_task *task)
                        break;
                /* retry with existing socket, after a delay */
                rpc_delay(task, 3*HZ);
-               /* fall through */
+               fallthrough;
        case -EADDRINUSE:
        case -ENOTCONN:
        case -EAGAIN:
@@ -2228,7 +2228,7 @@ call_transmit_status(struct rpc_task *task)
                 */
        case -ENOBUFS:
                rpc_delay(task, HZ>>2);
-               /* fall through */
+               fallthrough;
        case -EBADSLT:
        case -EAGAIN:
                task->tk_action = call_transmit;
@@ -2247,7 +2247,7 @@ call_transmit_status(struct rpc_task *task)
                        rpc_call_rpcerror(task, task->tk_status);
                        return;
                }
-               /* fall through */
+               fallthrough;
        case -ECONNRESET:
        case -ECONNABORTED:
        case -EADDRINUSE:
@@ -2313,7 +2313,7 @@ call_bc_transmit_status(struct rpc_task *task)
                break;
        case -ENOBUFS:
                rpc_delay(task, HZ>>2);
-               /* fall through */
+               fallthrough;
        case -EBADSLT:
        case -EAGAIN:
                task->tk_status = 0;
@@ -2380,7 +2380,7 @@ call_status(struct rpc_task *task)
                 * were a timeout.
                 */
                rpc_delay(task, 3*HZ);
-               /* fall through */
+               fallthrough;
        case -ETIMEDOUT:
                break;
        case -ECONNREFUSED:
@@ -2391,7 +2391,7 @@ call_status(struct rpc_task *task)
                break;
        case -EADDRINUSE:
                rpc_delay(task, 3*HZ);
-               /* fall through */
+               fallthrough;
        case -EPIPE:
        case -EAGAIN:
                break;
index c27123e6ba80c1f166c1212aedf6f6385c6b1950..4a67685c83eb4f6d8d1b32f3fe1a2d85617a9ae5 100644 (file)
@@ -982,8 +982,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
        p = xdr_inline_decode(xdr, len);
        if (unlikely(p == NULL))
                goto out_fail;
-       dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid,
-                       req->rq_task->tk_msg.rpc_proc->p_name, (char *)p);
+       dprintk("RPC: %5u RPCB_%s reply: %*pE\n", req->rq_task->tk_pid,
+                       req->rq_task->tk_msg.rpc_proc->p_name, len, (char *)p);
 
        if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len,
                                sap, sizeof(address)) == 0)
index d5805fa1d0660871fe197b45d84b87daafa8f624..c2752e2b9ce34ec3b0964fd79d18ce6080bd8855 100644 (file)
@@ -228,7 +228,7 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining)
 static void svc_flush_bvec(const struct bio_vec *bvec, size_t size, size_t seek)
 {
        struct bvec_iter bi = {
-               .bi_size        = size,
+               .bi_size        = size + seek,
        };
        struct bio_vec bv;
 
index 6ba9d58426291c52f8dea999edc62d49427bc2b8..5a8e47bbfb9f45a925a6eb2fd891fb917a1e09a4 100644 (file)
@@ -1623,7 +1623,7 @@ void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task)
        case -EAGAIN:
                xprt_add_backlog(xprt, task);
                dprintk("RPC:       waiting for request slot\n");
-               /* fall through */
+               fallthrough;
        default:
                task->tk_status = -EAGAIN;
        }
index 75c646743df3ef7ccc1f348eb8914a5f4e330427..ad6e2e4994ce8edd52b920976a27f3bc8ffc0d2c 100644 (file)
@@ -268,7 +268,7 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
        case RDMA_CM_EVENT_DEVICE_REMOVAL:
                pr_info("rpcrdma: removing device %s for %pISpc\n",
                        ep->re_id->device->name, sap);
-               /* fall through */
+               fallthrough;
        case RDMA_CM_EVENT_ADDR_CHANGE:
                ep->re_connect_status = -ENODEV;
                goto disconnected;
@@ -933,6 +933,8 @@ static void rpcrdma_req_reset(struct rpcrdma_req *req)
 
        rpcrdma_regbuf_dma_unmap(req->rl_sendbuf);
        rpcrdma_regbuf_dma_unmap(req->rl_recvbuf);
+
+       frwr_reset(req);
 }
 
 /* ASSUMPTION: the rb_allreqs list is stable for the duration,
index c57aef82940356112094802190adf5e8fe32fc21..554e1bb4c1c7e4cf0c63f2265c5214d07a071c09 100644 (file)
@@ -885,7 +885,7 @@ static int xs_local_send_request(struct rpc_rqst *req)
        default:
                dprintk("RPC:       sendmsg returned unrecognized error %d\n",
                        -status);
-               /* fall through */
+               fallthrough;
        case -EPIPE:
                xs_close(xprt);
                status = -ENOTCONN;
@@ -1436,7 +1436,7 @@ static void xs_tcp_state_change(struct sock *sk)
                xprt->connect_cookie++;
                clear_bit(XPRT_CONNECTED, &xprt->state);
                xs_run_error_worker(transport, XPRT_SOCK_WAKE_DISCONNECT);
-               /* fall through */
+               fallthrough;
        case TCP_CLOSING:
                /*
                 * If the server closed down the connection, make sure that
@@ -2202,7 +2202,7 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
        switch (ret) {
        case 0:
                xs_set_srcport(transport, sock);
-               /* fall through */
+               fallthrough;
        case -EINPROGRESS:
                /* SYN_SENT! */
                if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO)
@@ -2255,7 +2255,7 @@ static void xs_tcp_setup_socket(struct work_struct *work)
        default:
                printk("%s: connect returned unhandled error %d\n",
                        __func__, status);
-               /* fall through */
+               fallthrough;
        case -EADDRNOTAVAIL:
                /* We're probably in TIME_WAIT. Get rid of existing socket,
                 * and retry
index 808b147df7d527bd2da5a9e7c4fdadc5404794aa..6504141104521c744fc81ec658ab9e5eeb361b5b 100644 (file)
@@ -652,7 +652,7 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
                        test_and_set_bit_lock(0, &b->up);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case NETDEV_GOING_DOWN:
                clear_bit_unlock(0, &b->up);
                tipc_reset_bearer(net, b);
index c38babaa4e579bc10a25fba7fb28de833821c700..7c523dc81575e18974969d633dd8782c0d91a47d 100644 (file)
@@ -326,7 +326,8 @@ static void tipc_aead_free(struct rcu_head *rp)
        if (aead->cloned) {
                tipc_aead_put(aead->cloned);
        } else {
-               head = *this_cpu_ptr(aead->tfm_entry);
+               head = *get_cpu_ptr(aead->tfm_entry);
+               put_cpu_ptr(aead->tfm_entry);
                list_for_each_entry_safe(tfm_entry, tmp, &head->list, list) {
                        crypto_free_aead(tfm_entry->tfm);
                        list_del(&tfm_entry->list);
@@ -399,10 +400,15 @@ static void tipc_aead_users_set(struct tipc_aead __rcu *aead, int val)
  */
 static struct crypto_aead *tipc_aead_tfm_next(struct tipc_aead *aead)
 {
-       struct tipc_tfm **tfm_entry = this_cpu_ptr(aead->tfm_entry);
+       struct tipc_tfm **tfm_entry;
+       struct crypto_aead *tfm;
 
+       tfm_entry = get_cpu_ptr(aead->tfm_entry);
        *tfm_entry = list_next_entry(*tfm_entry, list);
-       return (*tfm_entry)->tfm;
+       tfm = (*tfm_entry)->tfm;
+       put_cpu_ptr(tfm_entry);
+
+       return tfm;
 }
 
 /**
index 89257e2a980de39c480278300e89161ae3458766..b1fcd2ad5ecfaca7169cf9e24a4af0add9adc122 100644 (file)
@@ -273,8 +273,8 @@ static struct tipc_member *tipc_group_find_node(struct tipc_group *grp,
        return NULL;
 }
 
-static void tipc_group_add_to_tree(struct tipc_group *grp,
-                                  struct tipc_member *m)
+static int tipc_group_add_to_tree(struct tipc_group *grp,
+                                 struct tipc_member *m)
 {
        u64 nkey, key = (u64)m->node << 32 | m->port;
        struct rb_node **n, *parent = NULL;
@@ -291,10 +291,11 @@ static void tipc_group_add_to_tree(struct tipc_group *grp,
                else if (key > nkey)
                        n = &(*n)->rb_right;
                else
-                       return;
+                       return -EEXIST;
        }
        rb_link_node(&m->tree_node, parent, n);
        rb_insert_color(&m->tree_node, &grp->members);
+       return 0;
 }
 
 static struct tipc_member *tipc_group_create_member(struct tipc_group *grp,
@@ -302,6 +303,7 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp,
                                                    u32 instance, int state)
 {
        struct tipc_member *m;
+       int ret;
 
        m = kzalloc(sizeof(*m), GFP_ATOMIC);
        if (!m)
@@ -314,8 +316,12 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp,
        m->port = port;
        m->instance = instance;
        m->bc_acked = grp->bc_snd_nxt - 1;
+       ret = tipc_group_add_to_tree(grp, m);
+       if (ret < 0) {
+               kfree(m);
+               return NULL;
+       }
        grp->member_cnt++;
-       tipc_group_add_to_tree(grp, m);
        tipc_nlist_add(&grp->dests, m->node);
        m->state = state;
        return m;
@@ -536,7 +542,7 @@ void tipc_group_filter_msg(struct tipc_group *grp, struct sk_buff_head *inputq,
                                update = true;
                                deliver = false;
                        }
-                       /* Fall thru */
+                       fallthrough;
                case TIPC_GRP_BCAST_MSG:
                        m->bc_rcv_nxt++;
                        ack = msg_grp_bc_ack_req(hdr);
index 1075781229739d2ce1cfd65bb2af6987efd6d603..cef38a9101071d8aacf02afbba489ab394be448d 100644 (file)
@@ -532,7 +532,8 @@ bool tipc_link_create(struct net *net, char *if_name, int bearer_id,
  * tipc_link_bc_create - create new link to be used for broadcast
  * @net: pointer to associated network namespace
  * @mtu: mtu to be used initially if no peers
- * @window: send window to be used
+ * @min_win: minimal send window to be used by link
+ * @max_win: maximal send window to be used by link
  * @inputq: queue to put messages ready for delivery
  * @namedq: queue to put binding table update messages ready for delivery
  * @link: return value, pointer to put the created link
@@ -1239,7 +1240,7 @@ static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb,
                        skb_queue_tail(mc_inputq, skb);
                        return true;
                }
-               /* fall through */
+               fallthrough;
        case CONN_MANAGER:
                skb_queue_tail(inputq, skb);
                return true;
index 848fae674532443c6ce5f807a655047adb429e4e..52e93ba4d8e2c5eeb545af24ebb9f6c5c9f4a971 100644 (file)
@@ -150,7 +150,8 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
        if (fragid == FIRST_FRAGMENT) {
                if (unlikely(head))
                        goto err;
-               if (unlikely(skb_unclone(frag, GFP_ATOMIC)))
+               frag = skb_unshare(frag, GFP_ATOMIC);
+               if (unlikely(!frag))
                        goto err;
                head = *headbuf = frag;
                *buf = NULL;
index 07419f36116a8496cc366092177712f2ff941b83..11b27ddc75ba3ef87c195c6822fa7cd1ff2d07e1 100644 (file)
@@ -783,7 +783,7 @@ static __poll_t tipc_poll(struct file *file, struct socket *sock,
        case TIPC_ESTABLISHED:
                if (!tsk->cong_link_cnt && !tsk_conn_cong(tsk))
                        revents |= EPOLLOUT;
-               /* fall through */
+               fallthrough;
        case TIPC_LISTEN:
        case TIPC_CONNECTING:
                if (!skb_queue_empty_lockless(&sk->sk_receive_queue))
@@ -2597,7 +2597,7 @@ static int tipc_connect(struct socket *sock, struct sockaddr *dest,
                 * case is EINPROGRESS, rather than EALREADY.
                 */
                res = -EINPROGRESS;
-               /* fall through */
+               fallthrough;
        case TIPC_CONNECTING:
                if (!timeout) {
                        if (previous == TIPC_CONNECTING)
@@ -2771,18 +2771,18 @@ static int tipc_shutdown(struct socket *sock, int how)
 
        trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " ");
        __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN);
-       sk->sk_shutdown = SEND_SHUTDOWN;
+       sk->sk_shutdown = SHUTDOWN_MASK;
 
        if (sk->sk_state == TIPC_DISCONNECTING) {
                /* Discard any unreceived messages */
                __skb_queue_purge(&sk->sk_receive_queue);
 
-               /* Wake up anyone sleeping in poll */
-               sk->sk_state_change(sk);
                res = 0;
        } else {
                res = -ENOTCONN;
        }
+       /* Wake up anyone sleeping in poll. */
+       sk->sk_state_change(sk);
 
        release_sock(sk);
        return res;
index 181ea6fb56a617e722d9bf617c127fbc3ef73ddd..92784e51ee7d978a6c5b1ccd93814756189be028 100644 (file)
@@ -837,7 +837,7 @@ static int unix_create(struct net *net, struct socket *sock, int protocol,
                 */
        case SOCK_RAW:
                sock->type = SOCK_DGRAM;
-               /* fall through */
+               fallthrough;
        case SOCK_DGRAM:
                sock->ops = &unix_dgram_ops;
                break;
index faf74850a1b52af9dc29d1808b36b26d45886bdf..27026f587fa618c0e2f7e148700807aa120224f1 100644 (file)
@@ -217,6 +217,7 @@ config LIB80211_CRYPT_WEP
 
 config LIB80211_CRYPT_CCMP
        tristate
+       select CRYPTO
        select CRYPTO_AES
        select CRYPTO_CCM
 
index 90f0f82cd9ca76722e529573b4fa0ff9da2055ff..6a6f2f214c10f11b4d6341ed6e533f7c846695d3 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/export.h>
+#include <linux/bitfield.h>
 #include <net/cfg80211.h>
 #include "core.h"
 #include "rdev-ops.h"
@@ -912,6 +913,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
        struct ieee80211_sta_vht_cap *vht_cap;
        struct ieee80211_edmg *edmg_cap;
        u32 width, control_freq, cap;
+       bool support_80_80 = false;
 
        if (WARN_ON(!cfg80211_chandef_valid(chandef)))
                return false;
@@ -957,7 +959,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
                if (!ht_cap->ht_supported &&
                    chandef->chan->band != NL80211_BAND_6GHZ)
                        return false;
-               /* fall through */
+               fallthrough;
        case NL80211_CHAN_WIDTH_20_NOHT:
                prohibited_flags |= IEEE80211_CHAN_NO_20MHZ;
                width = 20;
@@ -979,11 +981,15 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
                        return false;
                break;
        case NL80211_CHAN_WIDTH_80P80:
-               cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
-               if (chandef->chan->band != NL80211_BAND_6GHZ &&
-                   cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
+               cap = vht_cap->cap;
+               support_80_80 =
+                       (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) ||
+                       (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
+                        cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) ||
+                       u32_get_bits(cap, IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) > 1;
+               if (chandef->chan->band != NL80211_BAND_6GHZ && !support_80_80)
                        return false;
-               /* fall through */
+               fallthrough;
        case NL80211_CHAN_WIDTH_80:
                prohibited_flags |= IEEE80211_CHAN_NO_80MHZ;
                width = 80;
@@ -1001,7 +1007,8 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
                        return false;
                cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
                if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
-                   cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
+                   cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ &&
+                   !(vht_cap->cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK))
                        return false;
                break;
        default:
index a6c61a2e6569195088509b102156184b0dd092bb..db7333e20dd7172a98b7942c1ba715d0818d0b6f 100644 (file)
@@ -941,7 +941,7 @@ void cfg80211_cac_event(struct net_device *netdev,
                       sizeof(struct cfg80211_chan_def));
                queue_work(cfg80211_wq, &rdev->propagate_cac_done_wk);
                cfg80211_sched_dfs_chan_update(rdev);
-               /* fall through */
+               fallthrough;
        case NL80211_RADAR_CAC_ABORTED:
                wdev->cac_started = false;
                break;
index c04fc6cf658389bd62379be21c40edb32a72e7b8..2c9e9a2d1688731fa322191ab35a0a17b17f0471 100644 (file)
@@ -2107,7 +2107,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 1:
                if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES,
                            sizeof(u32) * rdev->wiphy.n_cipher_suites,
@@ -2154,7 +2154,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 2:
                if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES,
                                        rdev->wiphy.interface_modes))
@@ -2162,7 +2162,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 3:
                nl_bands = nla_nest_start_noflag(msg,
                                                 NL80211_ATTR_WIPHY_BANDS);
@@ -2189,7 +2189,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                                state->chan_start++;
                                if (state->split)
                                        break;
-                               /* fall through */
+                               fallthrough;
                        default:
                                /* add frequencies */
                                nl_freqs = nla_nest_start_noflag(msg,
@@ -2244,7 +2244,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                        state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 4:
                nl_cmds = nla_nest_start_noflag(msg,
                                                NL80211_ATTR_SUPPORTED_COMMANDS);
@@ -2273,7 +2273,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 5:
                if (rdev->ops->remain_on_channel &&
                    (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) &&
@@ -2291,7 +2291,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 6:
 #ifdef CONFIG_PM
                if (nl80211_send_wowlan(msg, rdev, state->split))
@@ -2302,7 +2302,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 #else
                state->split_start++;
 #endif
-               /* fall through */
+               fallthrough;
        case 7:
                if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES,
                                        rdev->wiphy.software_iftypes))
@@ -2315,7 +2315,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
                state->split_start++;
                if (state->split)
                        break;
-               /* fall through */
+               fallthrough;
        case 8:
                if ((rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) &&
                    nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME,
@@ -5207,7 +5207,7 @@ bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, int attr)
                break;
        default:
                WARN_ON(1);
-               /* fall through */
+               fallthrough;
        case RATE_INFO_BW_20:
                rate_flg = 0;
                break;
@@ -6011,7 +6011,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
 
        if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY])
                params.he_6ghz_capa =
-                       nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
+                       nla_data(info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]);
 
        if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT])
                params.airtime_weight =
index 35b8847a2f6d01f9ac046c038bb93ba830fe7ca1..d8a90d39742357ac8ea48f4e934185591f7310b0 100644 (file)
@@ -2946,6 +2946,9 @@ int regulatory_hint_user(const char *alpha2,
        if (WARN_ON(!alpha2))
                return -EINVAL;
 
+       if (!is_world_regdom(alpha2) && !is_an_alpha2(alpha2))
+               return -EINVAL;
+
        request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
        if (!request)
                return -ENOMEM;
index e67a74488bbe0c554be16b7b8ddbe9e5d8abf13d..04f2d198c2154c20189aa8d83485df7d18fa6ab8 100644 (file)
@@ -1433,7 +1433,7 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
        switch (ftype) {
        case CFG80211_BSS_FTYPE_BEACON:
                ies->from_beacon = true;
-               /* fall through */
+               fallthrough;
        case CFG80211_BSS_FTYPE_UNKNOWN:
                rcu_assign_pointer(tmp.pub.beacon_ies, ies);
                break;
index 985f3c23f0545fe97f5e9ac1f6b7c057031dfa66..079ce320dc1ed7223a3fd2533f24da6d544b9e19 100644 (file)
@@ -205,7 +205,7 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev,
                return err;
        case CFG80211_CONN_ASSOC_FAILED_TIMEOUT:
                *treason = NL80211_TIMEOUT_ASSOC;
-               /* fall through */
+               fallthrough;
        case CFG80211_CONN_ASSOC_FAILED:
                cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
                                     NULL, 0,
@@ -215,7 +215,7 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev,
                cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
                                     NULL, 0,
                                     WLAN_REASON_DEAUTH_LEAVING, false);
-               /* fall through */
+               fallthrough;
        case CFG80211_CONN_ABANDON:
                /* free directly, disconnected event already sent */
                cfg80211_sme_free(wdev);
index dfad1c0f57adb2eb707f8398de3efcf0cfc6d819..6fa99df52f8636d26e6bb882a3dd2c9923ad9eb9 100644 (file)
@@ -95,7 +95,7 @@ u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band)
                /* see 802.11ax D6.1 27.3.23.2 */
                if (chan == 2)
                        return MHZ_TO_KHZ(5935);
-               if (chan <= 253)
+               if (chan <= 233)
                        return MHZ_TO_KHZ(5950 + chan * 5);
                break;
        case NL80211_BAND_60GHZ:
@@ -123,11 +123,13 @@ int ieee80211_freq_khz_to_channel(u32 freq)
                return (freq - 2407) / 5;
        else if (freq >= 4910 && freq <= 4980)
                return (freq - 4000) / 5;
-       else if (freq < 5945)
+       else if (freq < 5925)
                return (freq - 5000) / 5;
+       else if (freq == 5935)
+               return 2;
        else if (freq <= 45000) /* DMG band lower limit */
-               /* see 802.11ax D4.1 27.3.22.2 */
-               return (freq - 5940) / 5;
+               /* see 802.11ax D6.1 27.3.22.2 */
+               return (freq - 5950) / 5;
        else if (freq >= 58320 && freq <= 70200)
                return (freq - 56160) / 2160;
        else
@@ -198,7 +200,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband)
                                sband->bitrates[i].flags |=
                                        IEEE80211_RATE_MANDATORY_G;
                                want--;
-                               /* fall through */
+                               fallthrough;
                        default:
                                sband->bitrates[i].flags |=
                                        IEEE80211_RATE_ERP_G;
@@ -1008,7 +1010,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
                case NL80211_IFTYPE_STATION:
                        if (dev->ieee80211_ptr->use_4addr)
                                break;
-                       /* fall through */
+                       fallthrough;
                case NL80211_IFTYPE_OCB:
                case NL80211_IFTYPE_P2P_CLIENT:
                case NL80211_IFTYPE_ADHOC:
index aa918d7ff6bd0c55fb4a523b78b9bafc43204458..4d2160c989a3b755e165fd4019924d432846222a 100644 (file)
@@ -1334,7 +1334,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
                        wstats.qual.qual = sig + 110;
                        break;
                }
-               /* fall through */
+               fallthrough;
        case CFG80211_SIGNAL_TYPE_UNSPEC:
                if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_SIGNAL)) {
                        wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
@@ -1343,7 +1343,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
                        wstats.qual.qual = sinfo.signal;
                        break;
                }
-               /* fall through */
+               fallthrough;
        default:
                wstats.qual.updated |= IW_QUAL_LEVEL_INVALID;
                wstats.qual.updated |= IW_QUAL_QUAL_INVALID;
index 7fb327632272bb49feac1bbc5b1124460a8ae65a..8e1a49b0c0dc5c58d0a69ffd25525f8d7b07211e 100644 (file)
@@ -98,7 +98,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,
                                        *vc_fac_mask |= X25_MASK_REVERSE;
                                        break;
                                }
-                               /*fall through */
+                               fallthrough;
                        case X25_FAC_THROUGHPUT:
                                facilities->throughput = p[1];
                                *vc_fac_mask |= X25_MASK_THROUGHPUT;
index 4d3bb46aaae0d9b0d5e4c17168b6886b48677d41..e1c4197af468e9284cae2a95f790875746a7f9ac 100644 (file)
@@ -349,7 +349,7 @@ static int x25_state4_machine(struct sock *sk, struct sk_buff *skb, int frametyp
 
                case X25_RESET_REQUEST:
                        x25_write_internal(sk, X25_RESET_CONFIRMATION);
-                       /* fall through */
+                       fallthrough;
                case X25_RESET_CONFIRMATION: {
                        x25_stop_timer(sk);
                        x25->condition = 0x00;
index e97db37354e4f60ad392943b0624b45a7b5c8bf9..b010bfde014907c49973c024fd4df3c548a6018a 100644 (file)
@@ -303,10 +303,10 @@ static int xdp_umem_account_pages(struct xdp_umem *umem)
 
 static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
 {
+       u32 npgs_rem, chunk_size = mr->chunk_size, headroom = mr->headroom;
        bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;
-       u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
        u64 npgs, addr = mr->addr, size = mr->len;
-       unsigned int chunks, chunks_per_page;
+       unsigned int chunks, chunks_rem;
        int err;
 
        if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {
@@ -336,19 +336,18 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
        if ((addr + size) < addr)
                return -EINVAL;
 
-       npgs = size >> PAGE_SHIFT;
+       npgs = div_u64_rem(size, PAGE_SIZE, &npgs_rem);
+       if (npgs_rem)
+               npgs++;
        if (npgs > U32_MAX)
                return -EINVAL;
 
-       chunks = (unsigned int)div_u64(size, chunk_size);
+       chunks = (unsigned int)div_u64_rem(size, chunk_size, &chunks_rem);
        if (chunks == 0)
                return -EINVAL;
 
-       if (!unaligned_chunks) {
-               chunks_per_page = PAGE_SIZE / chunk_size;
-               if (chunks < chunks_per_page || chunks % chunks_per_page)
-                       return -EINVAL;
-       }
+       if (!unaligned_chunks && chunks_rem)
+               return -EINVAL;
 
        if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
                return -EINVAL;
index d5280fd6f9c127b6099f07108a74f76005923e98..d622c2548d2295c0893b1b5fcbd84862f95fb8ea 100644 (file)
@@ -3410,7 +3410,7 @@ decode_session6(struct sk_buff *skb, struct flowi *fl, bool reverse)
                switch (nexthdr) {
                case NEXTHDR_FRAGMENT:
                        onlyproto = 1;
-                       /* fall through */
+                       fallthrough;
                case NEXTHDR_ROUTING:
                case NEXTHDR_HOP:
                case NEXTHDR_DEST:
index 7d71537776785c9537d1ae66ea09a1d2a1e15432..4b22ace52f8051be9a86ba5ad4413aa7718c056d 100644 (file)
@@ -483,7 +483,7 @@ int main(int argc, char **argv)
                                        "Option -%c requires an argument.\n\n",
                                        optopt);
                case 'h':
-                       // fallthrough
+                       fallthrough;
                default:
                        Usage();
                        return 0;
index 60d4a79674b6efd5f82d5f5ac052e9c3bdba8796..504d2e431c60412dd3720ddfe4df9a0c6ae2e338 100755 (executable)
@@ -2639,8 +2639,8 @@ sub process {
 
 # Check if the commit log has what seems like a diff which can confuse patch
                if ($in_commit_log && !$commit_log_has_diff &&
-                   (($line =~ m@^\s+diff\b.*a/[\w/]+@ &&
-                     $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) ||
+                   (($line =~ m@^\s+diff\b.*a/([\w/]+)@ &&
+                     $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) ||
                     $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
                     $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
                        ERROR("DIFF_IN_COMMIT_MSG",
index a698ece43fff0db02bc5086ca3d4f67f8dbfdeb4..4852bf44e913e25b4e69c4b066c068d2254a13d4 100644 (file)
@@ -9,7 +9,7 @@ dtc-objs        := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
 dtc-objs       += dtc-lexer.lex.o dtc-parser.tab.o
 
 # Source files need to get at the userspace version of libfdt_env.h to compile
-HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
+HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
 
 ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
 ifneq ($(CHECK_DT_BINDING)$(CHECK_DTBS),)
index 0096cd9653327584fe62ce56ba158c68875c5067..7ecd2ccba531bb4c46a01b4ecad7ea8078f29027 100644 (file)
@@ -82,6 +82,7 @@ static char *sym_name(const struct sym_entry *s)
 
 static bool is_ignored_symbol(const char *name, char type)
 {
+       /* Symbol names that exactly match to the following are ignored.*/
        static const char * const ignored_symbols[] = {
                /*
                 * Symbols which vary between passes. Passes 1 and 2 must have
@@ -104,6 +105,7 @@ static bool is_ignored_symbol(const char *name, char type)
                NULL
        };
 
+       /* Symbol names that begin with the following are ignored.*/
        static const char * const ignored_prefixes[] = {
                "$",                    /* local symbols for ARM, MIPS, etc. */
                ".LASANPC",             /* s390 kasan local symbols */
@@ -113,6 +115,7 @@ static bool is_ignored_symbol(const char *name, char type)
                NULL
        };
 
+       /* Symbol names that end with the following are ignored.*/
        static const char * const ignored_suffixes[] = {
                "_from_arm",            /* arm */
                "_from_thumb",          /* arm */
@@ -120,9 +123,15 @@ static bool is_ignored_symbol(const char *name, char type)
                NULL
        };
 
+       /* Symbol names that contain the following are ignored.*/
+       static const char * const ignored_matches[] = {
+               ".long_branch.",        /* ppc stub */
+               ".plt_branch.",         /* ppc stub */
+               NULL
+       };
+
        const char * const *p;
 
-       /* Exclude symbols which vary between passes. */
        for (p = ignored_symbols; *p; p++)
                if (!strcmp(name, *p))
                        return true;
@@ -138,6 +147,11 @@ static bool is_ignored_symbol(const char *name, char type)
                        return true;
        }
 
+       for (p = ignored_matches; *p; p++) {
+               if (strstr(name, *p))
+                       return true;
+       }
+
        if (type == 'U' || type == 'u')
                return true;
        /* exclude debugging symbols */
index d4ca8297364f95a5770bab01e1d70211e778fe99..8454649b17bd5a38729a1cdc8e845cb336df78cc 100644 (file)
@@ -66,23 +66,6 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
                fprintf(stderr, "Error in writing or end of file.\n");
 }
 
-/* menu.c */
-void _menu_init(void);
-void menu_warn(struct menu *menu, const char *fmt, ...);
-struct menu *menu_add_menu(void);
-void menu_end_menu(void);
-void menu_add_entry(struct symbol *sym);
-void menu_add_dep(struct expr *dep);
-void menu_add_visibility(struct expr *dep);
-struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
-void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
-void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
-void menu_add_option_modules(void);
-void menu_add_option_defconfig_list(void);
-void menu_add_option_allnoconfig_y(void);
-void menu_finalize(struct menu *parent);
-void menu_set_type(int type);
-
 /* util.c */
 struct file *file_lookup(const char *name);
 void *xmalloc(size_t size);
@@ -109,6 +92,36 @@ void str_append(struct gstr *gs, const char *s);
 void str_printf(struct gstr *gs, const char *fmt, ...);
 const char *str_get(struct gstr *gs);
 
+/* menu.c */
+void _menu_init(void);
+void menu_warn(struct menu *menu, const char *fmt, ...);
+struct menu *menu_add_menu(void);
+void menu_end_menu(void);
+void menu_add_entry(struct symbol *sym);
+void menu_add_dep(struct expr *dep);
+void menu_add_visibility(struct expr *dep);
+struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
+void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
+void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
+void menu_add_option_modules(void);
+void menu_add_option_defconfig_list(void);
+void menu_add_option_allnoconfig_y(void);
+void menu_finalize(struct menu *parent);
+void menu_set_type(int type);
+
+extern struct menu rootmenu;
+
+bool menu_is_empty(struct menu *menu);
+bool menu_is_visible(struct menu *menu);
+bool menu_has_prompt(struct menu *menu);
+const char *menu_get_prompt(struct menu *menu);
+struct menu *menu_get_root_menu(struct menu *menu);
+struct menu *menu_get_parent_menu(struct menu *menu);
+bool menu_has_help(struct menu *menu);
+const char *menu_get_help(struct menu *menu);
+struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
+void menu_get_ext_help(struct menu *menu, struct gstr *help);
+
 /* symbol.c */
 void sym_clear_all_valid(void);
 struct symbol *sym_choice_default(struct symbol *sym);
index f9ab98238aeff1974ebe917bc0eba7f0f32e1be9..9e81be33c40fa02882ed67917a33549d9eb862ea 100644 (file)
@@ -12,20 +12,6 @@ bool conf_get_changed(void);
 void conf_set_changed_callback(void (*fn)(void));
 void conf_set_message_callback(void (*fn)(const char *s));
 
-/* menu.c */
-extern struct menu rootmenu;
-
-bool menu_is_empty(struct menu *menu);
-bool menu_is_visible(struct menu *menu);
-bool menu_has_prompt(struct menu *menu);
-const char * menu_get_prompt(struct menu *menu);
-struct menu * menu_get_root_menu(struct menu *menu);
-struct menu * menu_get_parent_menu(struct menu *menu);
-bool menu_has_help(struct menu *menu);
-const char * menu_get_help(struct menu *menu);
-struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
-void menu_get_ext_help(struct menu *menu, struct gstr *help);
-
 /* symbol.c */
 extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
 
index daf1c1506ec4cc95fece4e87f0bd799b4b9c7bef..e0f9655291665409507d668fdae57e71cb6968c3 100644 (file)
@@ -755,7 +755,6 @@ static void build_conf(struct menu *menu)
                        switch (ptype) {
                        case P_MENU:
                                child_count++;
-                               prompt = prompt;
                                if (single_menu_mode) {
                                        item_make(menu, 'm',
                                                "%s%*c%s",
index 8638785328a7fe082223a1205bff52f00098444e..8ce624a3b54b1f8c5d22a8e07880b26ed2906957 100644 (file)
@@ -1108,6 +1108,11 @@ void ConfigInfoView::menuInfo(void)
                if (showDebug())
                        stream << debug_info(sym);
 
+               struct gstr help_gstr = str_new();
+
+               menu_get_ext_help(_menu, &help_gstr);
+               stream << print_filter(str_get(&help_gstr));
+               str_free(&help_gstr);
        } else if (_menu->prompt) {
                stream << "<big><b>";
                stream << print_filter(_menu->prompt->text);
@@ -1119,11 +1124,11 @@ void ConfigInfoView::menuInfo(void)
                                           expr_print_help, &stream, E_NONE);
                                stream << "<br><br>";
                        }
+
+                       stream << "defined at " << _menu->file->name << ":"
+                              << _menu->lineno << "<br><br>";
                }
        }
-       if (showDebug())
-               stream << "defined at " << _menu->file->name << ":"
-                      << _menu->lineno << "<br><br>";
 
        setText(info);
 }
@@ -1276,7 +1281,7 @@ void ConfigInfoView::clicked(const QUrl &url)
        }
 
        free(result);
-       delete data;
+       delete[] data;
 }
 
 void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
index 19857d18d814db7bd47118b7b967ad4a69810554..1c78ba49ca99232eda46e121f05dba6832c8237f 100755 (executable)
@@ -593,7 +593,10 @@ while ($repeat) {
 }
 
 my %setconfigs;
-my @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP});
+my @preserved_kconfigs;
+if (defined($ENV{'LMC_KEEP'})) {
+       @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP});
+}
 
 sub in_preserved_kconfigs {
     my $kconfig = $config2kfile{$_[0]};
index 32d3f53af10ba85a3f8d9a2c649d1c29a143f483..850f4ccb6afcf1615ffc88ad0776817afb2a6bcb 100755 (executable)
@@ -26,7 +26,11 @@ else
 fi
 
 # ignore userspace tools
-ignore="$ignore ( -path ${tree}tools ) -prune -o"
+if [ -n "$COMPILED_SOURCE" ]; then
+       ignore="$ignore ( -path ./tools ) -prune -o"
+else
+       ignore="$ignore ( -path ${tree}tools ) -prune -o"
+fi
 
 # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH
 if [ "${ALLSOURCE_ARCHS}" = "" ]; then
@@ -92,7 +96,7 @@ all_sources()
 all_compiled_sources()
 {
        realpath -es $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) \
-               include/generated/autoconf.h $(find -name "*.cmd" -exec \
+               include/generated/autoconf.h $(find $ignore -name "*.cmd" -exec \
                grep -Poh '(?(?=^source_.* \K).*|(?=^  \K\S).*(?= \\))' {} \+ |
                awk '!a[$0]++') | sort -u
 }
index 7b0e13ce7dc7b188f3d9f6917853bbaa78a3c643..f919ebd042fd2571d0fe9707346c71a76c5193cf 100644 (file)
@@ -577,7 +577,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
                        stack = NULL;
                        break;
                }
-               /* fall through - to X_NAME */
+               fallthrough;    /* to X_NAME */
        case AA_X_NAME:
                if (xindex & AA_X_CHILD)
                        /* released by caller */
index 30c246a9d4409f7ef90d5e67f2ec94e6d08c766d..fa49b81eb54caf9332728260844422433b6b85d0 100644 (file)
@@ -292,13 +292,13 @@ void aa_apply_modes_to_perms(struct aa_profile *profile, struct aa_perms *perms)
        switch (AUDIT_MODE(profile)) {
        case AUDIT_ALL:
                perms->audit = ALL_PERMS_MASK;
-               /* fall through */
+               fallthrough;
        case AUDIT_NOQUIET:
                perms->quiet = 0;
                break;
        case AUDIT_QUIET:
                perms->audit = 0;
-               /* fall through */
+               fallthrough;
        case AUDIT_QUIET_DENIED:
                perms->quiet = ALL_PERMS_MASK;
                break;
index 43ab0ad45c1b62b8cdd16b956e120dabccc78fee..04375df52fc9a1e89babfad36bfcaa69703fafb1 100644 (file)
@@ -354,7 +354,8 @@ static bool match_exception_partial(struct list_head *exceptions, short type,
 {
        struct dev_exception_item *ex;
 
-       list_for_each_entry_rcu(ex, exceptions, list) {
+       list_for_each_entry_rcu(ex, exceptions, list,
+                               lockdep_is_held(&devcgroup_mutex)) {
                if ((type & DEVCG_DEV_BLOCK) && !(ex->type & DEVCG_DEV_BLOCK))
                        continue;
                if ((type & DEVCG_DEV_CHAR) && !(ex->type & DEVCG_DEV_CHAR))
index 372d163829606d0a16b675c88c13cde551f40b01..b8848f53c8cc23b01e380b9d31c7197e5d2ba9a7 100644 (file)
@@ -223,7 +223,7 @@ static int xattr_verify(enum ima_hooks func, struct integrity_iint_cache *iint,
        case IMA_XATTR_DIGEST_NG:
                /* first byte contains algorithm id */
                hash_start = 1;
-               /* fall through */
+               fallthrough;
        case IMA_XATTR_DIGEST:
                if (iint->flags & IMA_DIGSIG_REQUIRED) {
                        *cause = "IMA-signature-required";
@@ -395,7 +395,7 @@ int ima_appraise_measurement(enum ima_hooks func,
                /* It's fine not to have xattrs when using a modsig. */
                if (try_modsig)
                        break;
-               /* fall through */
+               fallthrough;
        case INTEGRITY_NOLABEL:         /* No security.evm xattr. */
                cause = "missing-HMAC";
                goto out;
index 07f033634b27ad30dd835b0c1b4abb1f7e80ae91..b4de33074b37da402e4547aa6dd02bcb86a1edfe 100644 (file)
@@ -1279,12 +1279,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
                case Opt_uid_gt:
                case Opt_euid_gt:
                        entry->uid_op = &uid_gt;
-                       /* fall through */
+                       fallthrough;
                case Opt_uid_lt:
                case Opt_euid_lt:
                        if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
                                entry->uid_op = &uid_lt;
-                       /* fall through */
+                       fallthrough;
                case Opt_uid_eq:
                case Opt_euid_eq:
                        uid_token = (token == Opt_uid_eq) ||
@@ -1313,11 +1313,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
                        break;
                case Opt_fowner_gt:
                        entry->fowner_op = &uid_gt;
-                       /* fall through */
+                       fallthrough;
                case Opt_fowner_lt:
                        if (token == Opt_fowner_lt)
                                entry->fowner_op = &uid_lt;
-                       /* fall through */
+                       fallthrough;
                case Opt_fowner_eq:
                        ima_log_string_op(ab, "fowner", args[0].from,
                                          entry->fowner_op);
index 41a5f435b793fe2c655f982ae99fa4346db94999..c022ee9e2a4e626fe11b63d2b55503295f088fd9 100644 (file)
@@ -77,7 +77,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
                /* skip ':' and '\0' */
                buf_ptr += 2;
                buflen -= buf_ptr - field_data->data;
-               /* fall through */
+               fallthrough;
        case DATA_FMT_DIGEST:
        case DATA_FMT_HEX:
                if (!buflen)
index 7e0232db1707e5bed552094d03228d60a5e8658d..1fe8b934f656f9b966ae0584436070fea7f911d9 100644 (file)
@@ -465,7 +465,7 @@ key_ref_t search_cred_keyrings_rcu(struct keyring_search_context *ctx)
                case -EAGAIN: /* no key */
                        if (ret)
                                break;
-                       /* fall through */
+                       fallthrough;
                case -ENOKEY: /* negative key */
                        ret = key_ref;
                        break;
@@ -487,7 +487,7 @@ key_ref_t search_cred_keyrings_rcu(struct keyring_search_context *ctx)
                case -EAGAIN: /* no key */
                        if (ret)
                                break;
-                       /* fall through */
+                       fallthrough;
                case -ENOKEY: /* negative key */
                        ret = key_ref;
                        break;
@@ -509,7 +509,7 @@ key_ref_t search_cred_keyrings_rcu(struct keyring_search_context *ctx)
                case -EAGAIN: /* no key */
                        if (ret)
                                break;
-                       /* fall through */
+                       fallthrough;
                case -ENOKEY: /* negative key */
                        ret = key_ref;
                        break;
index e1b9f1a80676e5276c6aad7bb6ccda847a66cedb..2da4404276f0f5a68b0619dd6aa1d06a0fdb7198 100644 (file)
@@ -295,26 +295,26 @@ static int construct_get_dest_keyring(struct key **_dest_keyring)
                                }
                        }
 
-                       /* fall through */
+                       fallthrough;
                case KEY_REQKEY_DEFL_THREAD_KEYRING:
                        dest_keyring = key_get(cred->thread_keyring);
                        if (dest_keyring)
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case KEY_REQKEY_DEFL_PROCESS_KEYRING:
                        dest_keyring = key_get(cred->process_keyring);
                        if (dest_keyring)
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case KEY_REQKEY_DEFL_SESSION_KEYRING:
                        dest_keyring = key_get(cred->session_keyring);
 
                        if (dest_keyring)
                                break;
 
-                       /* fall through */
+                       fallthrough;
                case KEY_REQKEY_DEFL_USER_SESSION_KEYRING:
                        ret = look_up_user_keyrings(NULL, &dest_keyring);
                        if (ret < 0)
index ca901025802a9e0aa5d5709f90bda8ee283aaa02..a340986aa92e1d9e2434f2aaf5c208930a8156cb 100644 (file)
@@ -3606,26 +3606,20 @@ static int selinux_file_ioctl(struct file *file, unsigned int cmd,
 
        switch (cmd) {
        case FIONREAD:
-       /* fall through */
        case FIBMAP:
-       /* fall through */
        case FIGETBSZ:
-       /* fall through */
        case FS_IOC_GETFLAGS:
-       /* fall through */
        case FS_IOC_GETVERSION:
                error = file_has_perm(cred, file, FILE__GETATTR);
                break;
 
        case FS_IOC_SETFLAGS:
-       /* fall through */
        case FS_IOC_SETVERSION:
                error = file_has_perm(cred, file, FILE__SETATTR);
                break;
 
        /* sys_ioctl() checks */
        case FIONBIO:
-       /* fall through */
        case FIOASYNC:
                error = file_has_perm(cred, file, 0);
                break;
@@ -3783,7 +3777,7 @@ static int selinux_file_fcntl(struct file *file, unsigned int cmd,
                        err = file_has_perm(cred, file, FILE__WRITE);
                        break;
                }
-               /* fall through */
+               fallthrough;
        case F_SETOWN:
        case F_SETSIG:
        case F_GETFL:
index 408d306895f8fc5e285ff6a58ddffb2a5ed63bfe..d338962fb0c48427d80088579978289aa5618aa7 100644 (file)
@@ -535,7 +535,7 @@ int mls_compute_sid(struct policydb *p,
                                                  scontext, tcontext);
                }
 
-               /* Fallthrough */
+               fallthrough;
        case AVTAB_CHANGE:
                if ((tclass == p->process_class) || sock)
                        /* Use the process MLS attributes. */
@@ -546,8 +546,6 @@ int mls_compute_sid(struct policydb *p,
        case AVTAB_MEMBER:
                /* Use the process effective MLS attributes. */
                return mls_context_cpy_low(newcontext, scontext);
-
-       /* fall through */
        }
        return -EINVAL;
 }
index 8ffbf951b7ed78b482b5f0131297011634f2cd79..8c0893eb5aa8f0a3ca08a6a10832fda6218da117 100644 (file)
@@ -3365,7 +3365,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
                 * to set mount options simulate setting the
                 * superblock default.
                 */
-               /* Fall through */
+               fallthrough;
        default:
                /*
                 * This isn't an understood special case.
index c16b8c1b03e7dfb97bb2f76e43b5480c80090ab9..4bee32bfe16d1ca88de117e3aedb5cd28f93b58f 100644 (file)
@@ -1240,7 +1240,7 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
                        tomoyo_set_space(head);
                        tomoyo_set_string(head, cond->transit->name);
                }
-               /* fall through */
+               fallthrough;
        case 1:
                {
                        const u16 condc = cond->condc;
@@ -1345,12 +1345,12 @@ static bool tomoyo_print_condition(struct tomoyo_io_buffer *head,
                        }
                }
                head->r.cond_step++;
-               /* fall through */
+               fallthrough;
        case 2:
                if (!tomoyo_flush(head))
                        break;
                head->r.cond_step++;
-               /* fall through */
+               fallthrough;
        case 3:
                if (cond->grant_log != TOMOYO_GRANTLOG_AUTO)
                        tomoyo_io_printf(head, " grant_log=%s",
@@ -1639,7 +1639,7 @@ static void tomoyo_read_domain(struct tomoyo_io_buffer *head)
                                        tomoyo_set_string(head, tomoyo_dif[i]);
                        head->r.index = 0;
                        head->r.step++;
-                       /* fall through */
+                       fallthrough;
                case 1:
                        while (head->r.index < TOMOYO_MAX_ACL_GROUPS) {
                                i = head->r.index++;
@@ -1652,14 +1652,14 @@ static void tomoyo_read_domain(struct tomoyo_io_buffer *head)
                        head->r.index = 0;
                        head->r.step++;
                        tomoyo_set_lf(head);
-                       /* fall through */
+                       fallthrough;
                case 2:
                        if (!tomoyo_read_domain2(head, &domain->acl_info_list))
                                return;
                        head->r.step++;
                        if (!tomoyo_set_lf(head))
                                return;
-                       /* fall through */
+                       fallthrough;
                case 3:
                        head->r.step = 0;
                        if (head->r.print_this_domain_only)
@@ -2088,7 +2088,7 @@ int tomoyo_supervisor(struct tomoyo_request_info *r, const char *fmt, ...)
                /* Check max_learning_entry parameter. */
                if (tomoyo_domain_quota_is_ok(r))
                        break;
-               /* fall through */
+               fallthrough;
        default:
                return 0;
        }
@@ -2710,13 +2710,13 @@ ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head,
                case TOMOYO_DOMAINPOLICY:
                        if (tomoyo_select_domain(head, cp0))
                                continue;
-                       /* fall through */
+                       fallthrough;
                case TOMOYO_EXCEPTIONPOLICY:
                        if (!strcmp(cp0, "select transition_only")) {
                                head->r.print_transition_related_only = true;
                                continue;
                        }
-                       /* fall through */
+                       fallthrough;
                default:
                        if (!tomoyo_manager()) {
                                error = -EPERM;
index 86f7d1b90212a9b0f6bb6ce461d8e95b7a164c32..051f7297877cb963887d88118817779b9464d1ef 100644 (file)
@@ -927,7 +927,7 @@ int tomoyo_path2_perm(const u8 operation, const struct path *path1,
        case TOMOYO_TYPE_LINK:
                if (!d_is_dir(path1->dentry))
                        break;
-               /* fall through */
+               fallthrough;
        case TOMOYO_TYPE_PIVOT_ROOT:
                tomoyo_add_slash(&buf1);
                tomoyo_add_slash(&buf2);
index 3788906421a73d2b34979fbf4fbfbd33fc8010e8..fe27034f28460e5e09c3f8e9029eec52daf114b9 100644 (file)
@@ -329,8 +329,8 @@ int snd_pcm_plugin_build_mulaw(struct snd_pcm_substream *plug,
                snd_BUG();
                return -EINVAL;
        }
-       if (snd_BUG_ON(!snd_pcm_format_linear(format->format)))
-               return -ENXIO;
+       if (!snd_pcm_format_linear(format->format))
+               return -EINVAL;
 
        err = snd_pcm_plugin_build(plug, "Mu-Law<->linear conversion",
                                   src_format, dst_format,
index d9f85f2d66a3d3abb6e3223c71209d219d9f8355..6e27d87b18ed6b9e696321d0fe6767bb553fb60d 100644 (file)
@@ -816,9 +816,9 @@ static void snd_timer_clear_callbacks(struct snd_timer *timer,
  * timer tasklet
  *
  */
-static void snd_timer_tasklet(unsigned long arg)
+static void snd_timer_tasklet(struct tasklet_struct *t)
 {
-       struct snd_timer *timer = (struct snd_timer *) arg;
+       struct snd_timer *timer = from_tasklet(timer, t, task_queue);
        unsigned long flags;
 
        if (timer->card && timer->card->shutdown) {
@@ -967,8 +967,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
        INIT_LIST_HEAD(&timer->ack_list_head);
        INIT_LIST_HEAD(&timer->sack_list_head);
        spin_lock_init(&timer->lock);
-       tasklet_init(&timer->task_queue, snd_timer_tasklet,
-                    (unsigned long)timer);
+       tasklet_setup(&timer->task_queue, snd_timer_tasklet);
        timer->max_instances = 1000; /* default limit per timer */
        if (card != NULL) {
                timer->module = card->module;
index f8586f75441db690134f1913cf4413c97c446e6f..ee1c428b1fd36493feb3732cc47ad38a8b8beb06 100644 (file)
@@ -64,7 +64,7 @@
 #define IT_PKT_HEADER_SIZE_CIP         8 // For 2 CIP header.
 #define IT_PKT_HEADER_SIZE_NO_CIP      0 // Nothing.
 
-static void pcm_period_tasklet(unsigned long data);
+static void pcm_period_tasklet(struct tasklet_struct *t);
 
 /**
  * amdtp_stream_init - initialize an AMDTP stream structure
@@ -94,7 +94,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
        s->flags = flags;
        s->context = ERR_PTR(-1);
        mutex_init(&s->mutex);
-       tasklet_init(&s->period_tasklet, pcm_period_tasklet, (unsigned long)s);
+       tasklet_setup(&s->period_tasklet, pcm_period_tasklet);
        s->packet_index = 0;
 
        init_waitqueue_head(&s->callback_wait);
@@ -441,9 +441,9 @@ static void update_pcm_pointers(struct amdtp_stream *s,
        }
 }
 
-static void pcm_period_tasklet(unsigned long data)
+static void pcm_period_tasklet(struct tasklet_struct *t)
 {
-       struct amdtp_stream *s = (void *)data;
+       struct amdtp_stream *s = from_tasklet(s, t, period_tasklet);
        struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
 
        if (pcm)
index c84b913a9fe010d391740c14013ed743fcf584df..ab8408966ec33650466571153d5936e64d5685c3 100644 (file)
@@ -14,6 +14,7 @@ MODULE_LICENSE("GPL v2");
 #define VENDOR_DIGIDESIGN      0x00a07e
 #define MODEL_CONSOLE          0x000001
 #define MODEL_RACK             0x000002
+#define SPEC_VERSION           0x000001
 
 static int name_card(struct snd_dg00x *dg00x)
 {
@@ -175,14 +176,18 @@ static const struct ieee1394_device_id snd_dg00x_id_table[] = {
        /* Both of 002/003 use the same ID. */
        {
                .match_flags = IEEE1394_MATCH_VENDOR_ID |
+                              IEEE1394_MATCH_VERSION |
                               IEEE1394_MATCH_MODEL_ID,
                .vendor_id = VENDOR_DIGIDESIGN,
+               .version = SPEC_VERSION,
                .model_id = MODEL_CONSOLE,
        },
        {
                .match_flags = IEEE1394_MATCH_VENDOR_ID |
+                              IEEE1394_MATCH_VERSION |
                               IEEE1394_MATCH_MODEL_ID,
                .vendor_id = VENDOR_DIGIDESIGN,
+               .version = SPEC_VERSION,
                .model_id = MODEL_RACK,
        },
        {}
index 5dac0d9fc58e513c9d5de58c81e6c382a056c411..75f2edd8e78fb2b5f92f65f9bb34988b2a4e24f6 100644 (file)
@@ -39,9 +39,6 @@ static const struct snd_tscm_spec model_specs[] = {
                .midi_capture_ports = 2,
                .midi_playback_ports = 4,
        },
-       // This kernel module doesn't support FE-8 because the most of features
-       // can be implemented in userspace without any specific support of this
-       // module.
 };
 
 static int identify_model(struct snd_tscm *tscm)
@@ -211,11 +208,39 @@ static void snd_tscm_remove(struct fw_unit *unit)
 }
 
 static const struct ieee1394_device_id snd_tscm_id_table[] = {
+       // Tascam, FW-1884.
+       {
+               .match_flags = IEEE1394_MATCH_VENDOR_ID |
+                              IEEE1394_MATCH_SPECIFIER_ID |
+                              IEEE1394_MATCH_VERSION,
+               .vendor_id = 0x00022e,
+               .specifier_id = 0x00022e,
+               .version = 0x800000,
+       },
+       // Tascam, FE-8 (.version = 0x800001)
+       // This kernel module doesn't support FE-8 because the most of features
+       // can be implemented in userspace without any specific support of this
+       // module.
+       //
+       // .version = 0x800002 is unknown.
+       //
+       // Tascam, FW-1082.
+       {
+               .match_flags = IEEE1394_MATCH_VENDOR_ID |
+                              IEEE1394_MATCH_SPECIFIER_ID |
+                              IEEE1394_MATCH_VERSION,
+               .vendor_id = 0x00022e,
+               .specifier_id = 0x00022e,
+               .version = 0x800003,
+       },
+       // Tascam, FW-1804.
        {
                .match_flags = IEEE1394_MATCH_VENDOR_ID |
-                              IEEE1394_MATCH_SPECIFIER_ID,
+                              IEEE1394_MATCH_SPECIFIER_ID |
+                              IEEE1394_MATCH_VERSION,
                .vendor_id = 0x00022e,
                .specifier_id = 0x00022e,
+               .version = 0x800004,
        },
        {}
 };
index 333220f0f8afc0a8496c932bcba4657ac7922683..3e9e9ac804f629813b55de6d84cc8e092e0c4e4c 100644 (file)
@@ -127,6 +127,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_init);
 void snd_hdac_device_exit(struct hdac_device *codec)
 {
        pm_runtime_put_noidle(&codec->dev);
+       /* keep balance of runtime PM child_count in parent device */
+       pm_runtime_set_suspended(&codec->dev);
        snd_hdac_bus_remove_device(codec->bus, codec);
        kfree(codec->vendor_name);
        kfree(codec->chip_name);
index 99aec73491676f1b7ba36b10d513573b5275da5a..1c5114dedda92f8e51857309feba50a8bd8728dd 100644 (file)
@@ -54,7 +54,7 @@ static const struct config_entry config_table[] = {
 #endif
 /*
  * Apollolake (Broxton-P)
- * the legacy HDaudio driver is used except on Up Squared (SOF) and
+ * the legacy HDAudio driver is used except on Up Squared (SOF) and
  * Chromebooks (SST)
  */
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
@@ -89,7 +89,7 @@ static const struct config_entry config_table[] = {
        },
 #endif
 /*
- * Skylake and Kabylake use legacy HDaudio driver except for Google
+ * Skylake and Kabylake use legacy HDAudio driver except for Google
  * Chromebooks (SST)
  */
 
@@ -135,7 +135,7 @@ static const struct config_entry config_table[] = {
 #endif
 
 /*
- * Geminilake uses legacy HDaudio driver except for Google
+ * Geminilake uses legacy HDAudio driver except for Google
  * Chromebooks
  */
 /* Geminilake */
@@ -157,7 +157,7 @@ static const struct config_entry config_table[] = {
 
 /*
  * CoffeeLake, CannonLake, CometLake, IceLake, TigerLake use legacy
- * HDaudio driver except for Google Chromebooks and when DMICs are
+ * HDAudio driver except for Google Chromebooks and when DMICs are
  * present. Two cases are required since Coreboot does not expose NHLT
  * tables.
  *
@@ -391,7 +391,7 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci)
        if (pci->class == 0x040300)
                return SND_INTEL_DSP_DRIVER_LEGACY;
        if (pci->class != 0x040100 && pci->class != 0x040380) {
-               dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDA legacy driver\n", pci->class);
+               dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDAudio legacy driver\n", pci->class);
                return SND_INTEL_DSP_DRIVER_LEGACY;
        }
 
index 023c35a2a95139eed93c633b41b2c61934880d99..35e76480306e7edc460df4b8c3886d3ed81e11d6 100644 (file)
@@ -921,10 +921,10 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)
                add_timer(&dpcm->timer);
 }
 
-static void snd_card_asihpi_int_task(unsigned long data)
+static void snd_card_asihpi_int_task(struct tasklet_struct *t)
 {
-       struct hpi_adapter *a = (struct hpi_adapter *)data;
-       struct snd_card_asihpi *asihpi;
+       struct snd_card_asihpi *asihpi = from_tasklet(asihpi, t, t);
+       struct hpi_adapter *a = asihpi->hpi;
 
        WARN_ON(!a || !a->snd_card || !a->snd_card->private_data);
        asihpi = (struct snd_card_asihpi *)a->snd_card->private_data;
@@ -2871,8 +2871,7 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev,
        if (hpi->interrupt_mode) {
                asihpi->pcm_start = snd_card_asihpi_pcm_int_start;
                asihpi->pcm_stop = snd_card_asihpi_pcm_int_stop;
-               tasklet_init(&asihpi->t, snd_card_asihpi_int_task,
-                       (unsigned long)hpi);
+               tasklet_setup(&asihpi->t, snd_card_asihpi_int_task);
                hpi->interrupt_callback = snd_card_asihpi_isr;
        } else {
                asihpi->pcm_start = snd_card_asihpi_pcm_timer_start;
index 496dcde9715d6df1a7fb640f6ee3f025a8a483b0..9790f5108a166859603ca0ff7c98a331f242a100 100644 (file)
@@ -343,7 +343,7 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev,
        struct hpi_message hm;
        struct hpi_response hr;
        struct hpi_adapter adapter;
-       struct hpi_pci pci;
+       struct hpi_pci pci = { 0 };
 
        memset(&adapter, 0, sizeof(adapter));
 
@@ -499,7 +499,7 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev,
        return 0;
 
 err:
-       for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) {
+       while (--idx >= 0) {
                if (pci.ap_mem_base[idx]) {
                        iounmap(pci.ap_mem_base[idx]);
                        pci.ap_mem_base[idx] = NULL;
index 70d775ff967ebed7451b9a65c5e173aa56a58387..c189f70c82cb9a1a9f98aef77ba4e861184e9195 100644 (file)
@@ -537,7 +537,8 @@ static int snd_ca0106_pcm_power_dac(struct snd_ca0106 *chip, int channel_id,
                else
                        /* Power down */
                        chip->spi_dac_reg[reg] |= bit;
-               return snd_ca0106_spi_write(chip, chip->spi_dac_reg[reg]);
+               if (snd_ca0106_spi_write(chip, chip->spi_dac_reg[reg]) != 0)
+                       return -ENXIO;
        }
        return 0;
 }
index e34a4d5d047c18e5eeea9968e0f9915ed7476dc1..36a9dbc33aa01f798aeebefabf29564bdcacec9a 100644 (file)
@@ -2127,9 +2127,10 @@ static int azx_probe(struct pci_dev *pci,
         */
        if (dmic_detect) {
                err = snd_intel_dsp_driver_probe(pci);
-               if (err != SND_INTEL_DSP_DRIVER_ANY &&
-                   err != SND_INTEL_DSP_DRIVER_LEGACY)
+               if (err != SND_INTEL_DSP_DRIVER_ANY && err != SND_INTEL_DSP_DRIVER_LEGACY) {
+                       dev_dbg(&pci->dev, "HDAudio driver not selected, aborting probe\n");
                        return -ENODEV;
+               }
        } else {
                dev_warn(&pci->dev, "dmic_detect option is deprecated, pass snd-intel-dspcfg.dsp_driver=1 option instead\n");
        }
@@ -2745,8 +2746,6 @@ static const struct pci_device_id azx_ids[] = {
          .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI },
        /* Zhaoxin */
        { PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN },
-       /* Loongson */
-       { PCI_DEVICE(0x0014, 0x7a07), .driver_data = AZX_DRIVER_GENERIC },
        { 0, }
 };
 MODULE_DEVICE_TABLE(pci, azx_ids);
index c94553bcca888fd445acbe0916299925adaf97d2..70164d1428d404661120da07b4f1baf3b0185df5 100644 (file)
@@ -179,6 +179,10 @@ static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev)
        struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
 
        if (chip && chip->running) {
+               /* enable controller wake up event */
+               azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
+                          STATESTS_INT_MASK);
+
                azx_stop_chip(chip);
                azx_enter_link_reset(chip);
        }
@@ -200,6 +204,9 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev)
        if (chip && chip->running) {
                hda_tegra_init(hda);
                azx_init_chip(chip, 1);
+               /* disable controller wake up event*/
+               azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
+                          ~STATESTS_INT_MASK);
        }
 
        return 0;
index b8c8490e568b7eab9527af923b3d89ddd3b38cfe..40205008809052a4a28fabb23d4ecac12c56a831 100644 (file)
@@ -2794,6 +2794,7 @@ static void i915_pin_cvt_fixup(struct hda_codec *codec,
                               hda_nid_t cvt_nid)
 {
        if (per_pin) {
+               haswell_verify_D0(codec, per_pin->cvt_nid, per_pin->pin_nid);
                snd_hda_set_dev_select(codec, per_pin->pin_nid,
                               per_pin->dev_id);
                intel_verify_pin_cvt_connect(codec, per_pin);
@@ -3734,6 +3735,7 @@ static int tegra_hdmi_build_pcms(struct hda_codec *codec)
 
 static int patch_tegra_hdmi(struct hda_codec *codec)
 {
+       struct hdmi_spec *spec;
        int err;
 
        err = patch_generic_hdmi(codec);
@@ -3741,6 +3743,10 @@ static int patch_tegra_hdmi(struct hda_codec *codec)
                return err;
 
        codec->patch_ops.build_pcms = tegra_hdmi_build_pcms;
+       spec = codec->spec;
+       spec->chmap.ops.chmap_cea_alloc_validate_get_type =
+               nvhdmi_chmap_cea_alloc_validate_get_type;
+       spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
 
        return 0;
 }
@@ -4263,6 +4269,7 @@ HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI",    patch_i915_glk_hdmi),
 HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi),
 HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI",    patch_i915_icl_hdmi),
 HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI",  patch_i915_tgl_hdmi),
+HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi),
 HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi),
 HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI",        patch_i915_icl_hdmi),
 HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi),
index a1fa983d2a942f8075b8eda4a2e90a45308e955d..d4f17b46589271621bc9f49cb1aa8ad94c2db4d1 100644 (file)
@@ -3427,7 +3427,11 @@ static void alc256_shutup(struct hda_codec *codec)
 
        /* 3k pull low control for Headset jack. */
        /* NOTE: call this before clearing the pin, otherwise codec stalls */
-       alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
+       /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
+        * when booting with headset plugged. So skip setting it for the codec alc257
+        */
+       if (codec->core.vendor_id != 0x10ec0257)
+               alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
 
        if (!spec->no_shutup_pins)
                snd_hda_codec_write(codec, hp_pin, 0,
@@ -5867,6 +5871,39 @@ static void alc275_fixup_gpio4_off(struct hda_codec *codec,
        }
 }
 
+/* Quirk for Thinkpad X1 7th and 8th Gen
+ * The following fixed routing needed
+ * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
+ * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
+ * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
+ */
+static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
+                                         const struct hda_fixup *fix, int action)
+{
+       static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
+       static const hda_nid_t preferred_pairs[] = {
+               0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
+       };
+       struct alc_spec *spec = codec->spec;
+
+       switch (action) {
+       case HDA_FIXUP_ACT_PRE_PROBE:
+               snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
+               spec->gen.preferred_dacs = preferred_pairs;
+               break;
+       case HDA_FIXUP_ACT_BUILD:
+               /* The generic parser creates somewhat unintuitive volume ctls
+                * with the fixed routing above, and the shared DAC2 may be
+                * confusing for PA.
+                * Rename those to unique names so that PA doesn't touch them
+                * and use only Master volume.
+                */
+               rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
+               rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
+               break;
+       }
+}
+
 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
                                         const struct hda_fixup *fix,
                                         int action)
@@ -5959,6 +5996,40 @@ static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
                snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
 }
 
+
+static void alc294_gx502_toggle_output(struct hda_codec *codec,
+                                       struct hda_jack_callback *cb)
+{
+       /* The Windows driver sets the codec up in a very different way where
+        * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
+        */
+       if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
+               alc_write_coef_idx(codec, 0x10, 0x8a20);
+       else
+               alc_write_coef_idx(codec, 0x10, 0x0a20);
+}
+
+static void alc294_fixup_gx502_hp(struct hda_codec *codec,
+                                       const struct hda_fixup *fix, int action)
+{
+       /* Pin 0x21: headphones/headset mic */
+       if (!is_jack_detectable(codec, 0x21))
+               return;
+
+       switch (action) {
+       case HDA_FIXUP_ACT_PRE_PROBE:
+               snd_hda_jack_detect_enable_callback(codec, 0x21,
+                               alc294_gx502_toggle_output);
+               break;
+       case HDA_FIXUP_ACT_INIT:
+               /* Make sure to start in a correct state, i.e. if
+                * headphones have been plugged in before powering up the system
+                */
+               alc294_gx502_toggle_output(codec, NULL);
+               break;
+       }
+}
+
 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
                              const struct hda_fixup *fix, int action)
 {
@@ -5983,6 +6054,7 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
 #include "hp_x360_helper.c"
 
 enum {
+       ALC269_FIXUP_GPIO2,
        ALC269_FIXUP_SONY_VAIO,
        ALC275_FIXUP_SONY_VAIO_GPIO2,
        ALC269_FIXUP_DELL_M101Z,
@@ -6135,9 +6207,13 @@ enum {
        ALC289_FIXUP_DUAL_SPK,
        ALC294_FIXUP_SPK2_TO_DAC1,
        ALC294_FIXUP_ASUS_DUAL_SPK,
+       ALC285_FIXUP_THINKPAD_X1_GEN7,
        ALC285_FIXUP_THINKPAD_HEADSET_JACK,
        ALC294_FIXUP_ASUS_HPE,
        ALC294_FIXUP_ASUS_COEF_1B,
+       ALC294_FIXUP_ASUS_GX502_HP,
+       ALC294_FIXUP_ASUS_GX502_PINS,
+       ALC294_FIXUP_ASUS_GX502_VERBS,
        ALC285_FIXUP_HP_GPIO_LED,
        ALC285_FIXUP_HP_MUTE_LED,
        ALC236_FIXUP_HP_MUTE_LED,
@@ -6156,9 +6232,14 @@ enum {
        ALC269_FIXUP_LEMOTE_A1802,
        ALC269_FIXUP_LEMOTE_A190X,
        ALC256_FIXUP_INTEL_NUC8_RUGGED,
+       ALC255_FIXUP_XIAOMI_HEADSET_MIC,
 };
 
 static const struct hda_fixup alc269_fixups[] = {
+       [ALC269_FIXUP_GPIO2] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc_fixup_gpio2,
+       },
        [ALC269_FIXUP_SONY_VAIO] = {
                .type = HDA_FIXUP_PINCTLS,
                .v.pins = (const struct hda_pintbl[]) {
@@ -6978,6 +7059,8 @@ static const struct hda_fixup alc269_fixups[] = {
        [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
+               .chained = true,
+               .chain_id = ALC269_FIXUP_GPIO2
        },
        [ALC233_FIXUP_ACER_HEADSET_MIC] = {
                .type = HDA_FIXUP_VERBS,
@@ -7280,11 +7363,17 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
        },
+       [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc285_fixup_thinkpad_x1_gen7,
+               .chained = true,
+               .chain_id = ALC269_FIXUP_THINKPAD_ACPI
+       },
        [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = alc_fixup_headset_jack,
                .chained = true,
-               .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1
+               .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
        },
        [ALC294_FIXUP_ASUS_HPE] = {
                .type = HDA_FIXUP_VERBS,
@@ -7297,6 +7386,33 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
        },
+       [ALC294_FIXUP_ASUS_GX502_PINS] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+                       { 0x19, 0x03a11050 }, /* front HP mic */
+                       { 0x1a, 0x01a11830 }, /* rear external mic */
+                       { 0x21, 0x03211020 }, /* front HP out */
+                       { }
+               },
+               .chained = true,
+               .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
+       },
+       [ALC294_FIXUP_ASUS_GX502_VERBS] = {
+               .type = HDA_FIXUP_VERBS,
+               .v.verbs = (const struct hda_verb[]) {
+                       /* set 0x15 to HP-OUT ctrl */
+                       { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
+                       /* unmute the 0x15 amp */
+                       { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
+                       { }
+               },
+               .chained = true,
+               .chain_id = ALC294_FIXUP_ASUS_GX502_HP
+       },
+       [ALC294_FIXUP_ASUS_GX502_HP] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc294_fixup_gx502_hp,
+       },
        [ALC294_FIXUP_ASUS_COEF_1B] = {
                .type = HDA_FIXUP_VERBS,
                .v.verbs = (const struct hda_verb[]) {
@@ -7486,6 +7602,16 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC269_FIXUP_HEADSET_MODE
        },
+       [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
+               .type = HDA_FIXUP_VERBS,
+               .v.verbs = (const struct hda_verb[]) {
+                       { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
+                       { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
+                       { }
+               },
+               .chained = true,
+               .chain_id = ALC289_FIXUP_ASUS_GA401
+       },
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7670,6 +7796,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
        SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
        SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
+       SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
        SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
        SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
@@ -7695,7 +7822,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
        SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
        SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
-       SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
+       SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
+       SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
        SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
        SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
        SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
@@ -7781,6 +7909,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
        SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
        SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
+       SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
        SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
        SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
        SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
@@ -7958,6 +8087,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
        {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
        {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
        {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
+       {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
        {}
 };
 #define ALC225_STANDARD_PINS \
index b4f30028182272f7f2f234e0eb1516619d280a3c..098c69b3b7aaeebc81628da74e0910c1749c5e4e 100644 (file)
@@ -1070,9 +1070,9 @@ getmixer(struct cmdif *cif, short num, unsigned short *rval,
        return 0;
 }
 
-static void riptide_handleirq(unsigned long dev_id)
+static void riptide_handleirq(struct tasklet_struct *t)
 {
-       struct snd_riptide *chip = (void *)dev_id;
+       struct snd_riptide *chip = from_tasklet(chip, t, riptide_tq);
        struct cmdif *cif = chip->cif;
        struct snd_pcm_substream *substream[PLAYBACK_SUBSTREAMS + 1];
        struct snd_pcm_runtime *runtime;
@@ -1843,7 +1843,7 @@ snd_riptide_create(struct snd_card *card, struct pci_dev *pci,
        chip->received_irqs = 0;
        chip->handled_irqs = 0;
        chip->cif = NULL;
-       tasklet_init(&chip->riptide_tq, riptide_handleirq, (unsigned long)chip);
+       tasklet_setup(&chip->riptide_tq, riptide_handleirq);
 
        if ((chip->res_port =
             request_region(chip->port, 64, "RIPTIDE")) == NULL) {
index 227aece17e3908468b285713230dc34b4b0da1dd..dda56ecfd33b950b5a945d6752df9fce0a65d2ac 100644 (file)
@@ -3791,9 +3791,9 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp)
        return 0;
 }
 
-static void hdsp_midi_tasklet(unsigned long arg)
+static void hdsp_midi_tasklet(struct tasklet_struct *t)
 {
-       struct hdsp *hdsp = (struct hdsp *)arg;
+       struct hdsp *hdsp = from_tasklet(hdsp, t, midi_tasklet);
 
        if (hdsp->midi[0].pending)
                snd_hdsp_midi_input_read (&hdsp->midi[0]);
@@ -5182,7 +5182,7 @@ static int snd_hdsp_create(struct snd_card *card,
 
        spin_lock_init(&hdsp->lock);
 
-       tasklet_init(&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long)hdsp);
+       tasklet_setup(&hdsp->midi_tasklet, hdsp_midi_tasklet);
 
        pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev);
        hdsp->firmware_rev &= 0xff;
index 0fa49f4d15cff7a2a2f27f7f3db97e25eb1c1a36..572350aaf18d05133159d27546764957df3103b8 100644 (file)
@@ -2169,9 +2169,9 @@ static int snd_hdspm_create_midi(struct snd_card *card,
 }
 
 
-static void hdspm_midi_tasklet(unsigned long arg)
+static void hdspm_midi_tasklet(struct tasklet_struct *t)
 {
-       struct hdspm *hdspm = (struct hdspm *)arg;
+       struct hdspm *hdspm = from_tasklet(hdspm, t, midi_tasklet);
        int i = 0;
 
        while (i < hdspm->midiPorts) {
@@ -6836,8 +6836,7 @@ static int snd_hdspm_create(struct snd_card *card,
 
        }
 
-       tasklet_init(&hdspm->midi_tasklet,
-                       hdspm_midi_tasklet, (unsigned long) hdspm);
+       tasklet_setup(&hdspm->midi_tasklet, hdspm_midi_tasklet);
 
 
        if (hdspm->io_type != MADIface) {
index b8161a08f2ca98a1b0aae5954dfbf15181561e6e..58bb49fff18471a25126ef1732ecaf7662a7ed24 100644 (file)
@@ -227,14 +227,14 @@ static int snd_ps3_program_dma(struct snd_ps3_card_info *card,
        switch (filltype) {
        case SND_PS3_DMA_FILLTYPE_SILENT_FIRSTFILL:
                silent = 1;
-               /* intentionally fall thru */
+               fallthrough;
        case SND_PS3_DMA_FILLTYPE_FIRSTFILL:
                ch0_kick_event = PS3_AUDIO_KICK_EVENT_ALWAYS;
                break;
 
        case SND_PS3_DMA_FILLTYPE_SILENT_RUNNING:
                silent = 1;
-               /* intentionally fall thru */
+               fallthrough;
        case SND_PS3_DMA_FILLTYPE_RUNNING:
                ch0_kick_event = PS3_AUDIO_KICK_EVENT_SERIALOUT0_EMPTY;
                break;
index 3cb63886195ff5a684ec1a4f4f5a7fc46a9ac897..04acc18f2d72ceeb5f644112d6d06836009eedcc 100644 (file)
@@ -536,7 +536,7 @@ static int mchp_i2s_mcc_hw_params(struct snd_pcm_substream *substream,
                /* cpu is BCLK master */
                mrb |= MCHP_I2SMCC_MRB_CLKSEL_INT;
                set_divs = 1;
-               /* fall through */
+               fallthrough;
        case SND_SOC_DAIFMT_CBM_CFM:
                /* cpu is slave */
                mra |= MCHP_I2SMCC_MRA_MODE_SLAVE;
index c0a28f06b09a7d845d67f2f4a6018952df375113..298689a07168d02e564ea4f84994390567933d9f 100644 (file)
@@ -202,7 +202,7 @@ static int jz4770_codec_set_bias_level(struct snd_soc_component *codec,
                                   REG_CR_VIC_SB_SLEEP, REG_CR_VIC_SB_SLEEP);
                regmap_update_bits(regmap, JZ4770_CODEC_REG_CR_VIC,
                                   REG_CR_VIC_SB, REG_CR_VIC_SB);
-       /* fall-through */
+               fallthrough;
        default:
                break;
        }
index 5fe724728e84e9a5746cdf6839a26bb65ced5d32..e4675cfff7b2f9faf5f9e8dcb6c2b11163928046 100644 (file)
@@ -838,8 +838,8 @@ static int max98373_sdw_probe(struct sdw_slave *slave,
 
        /* Regmap Initialization */
        regmap = devm_regmap_init_sdw(slave, &max98373_sdw_regmap);
-       if (!regmap)
-               return -EINVAL;
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
 
        return max98373_init(slave, regmap);
 }
index f0da55901dcbe3e0c35a30f4452d758e9b795824..b8845f45549ea2d2eb9264b4cee5b1e8f4ddad73 100644 (file)
@@ -401,7 +401,7 @@ static int pcm186x_set_fmt(struct snd_soc_dai *dai, unsigned int format)
                break;
        case SND_SOC_DAIFMT_DSP_A:
                priv->tdm_offset += 1;
-               /* fall through */
+               fallthrough;
                /* DSP_A uses the same basic config as DSP_B
                 * except we need to shift the TDM output by one BCK cycle
                 */
index 5e445fee4ef578ee959630ce37ac8e73c033cce2..821e7395f90f69f7c7e96c146e567a8a2d88dfc9 100644 (file)
@@ -306,6 +306,13 @@ static int pcm3168a_set_dai_sysclk(struct snd_soc_dai *dai,
        struct pcm3168a_priv *pcm3168a = snd_soc_component_get_drvdata(dai->component);
        int ret;
 
+       /*
+        * Some sound card sets 0 Hz as reset,
+        * but it is impossible to set. Ignore it here
+        */
+       if (freq == 0)
+               return 0;
+
        if (freq > PCM3168A_MAX_SYSCLK)
                return -EINVAL;
 
index b0ba0d2acbdd64370ed80e9db71e00e6c390917f..56e952a904a39d1dbb31393dce04c51e158c629e 100644 (file)
@@ -684,8 +684,8 @@ static int rt1308_sdw_probe(struct sdw_slave *slave,
 
        /* Regmap Initialization */
        regmap = devm_regmap_init_sdw(slave, &rt1308_sdw_regmap);
-       if (!regmap)
-               return -EINVAL;
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
 
        rt1308_sdw_init(&slave->dev, regmap, slave);
 
index 4d14048d1197685703ccaa04bc05febbd23839e8..1d24bf0407182c9f33928af8d0e22a9cd3a9b61a 100644 (file)
@@ -452,8 +452,8 @@ static int rt700_sdw_probe(struct sdw_slave *slave,
 
        /* Regmap Initialization */
        sdw_regmap = devm_regmap_init_sdw(slave, &rt700_sdw_regmap);
-       if (!sdw_regmap)
-               return -EINVAL;
+       if (IS_ERR(sdw_regmap))
+               return PTR_ERR(sdw_regmap);
 
        regmap = devm_regmap_init(&slave->dev, NULL,
                &slave->dev, &rt700_regmap);
index 45b928954b580e005d49d9957886e2efe486c124..7efff130a638c9fa9fa7ab8e2a21175a4dc1a733 100644 (file)
@@ -452,8 +452,8 @@ static int rt711_sdw_probe(struct sdw_slave *slave,
 
        /* Regmap Initialization */
        sdw_regmap = devm_regmap_init_sdw(slave, &rt711_sdw_regmap);
-       if (!sdw_regmap)
-               return -EINVAL;
+       if (IS_ERR(sdw_regmap))
+               return PTR_ERR(sdw_regmap);
 
        regmap = devm_regmap_init(&slave->dev, NULL,
                &slave->dev, &rt711_regmap);
index d11b23d6b240a3d895000eddb40312d19563adad..68a36739f1b0d1cfb808b93e81c4b6833423bfc8 100644 (file)
@@ -527,8 +527,8 @@ static int rt715_sdw_probe(struct sdw_slave *slave,
 
        /* Regmap Initialization */
        sdw_regmap = devm_regmap_init_sdw(slave, &rt715_sdw_regmap);
-       if (!sdw_regmap)
-               return -EINVAL;
+       if (IS_ERR(sdw_regmap))
+               return PTR_ERR(sdw_regmap);
 
        regmap = devm_regmap_init(&slave->dev, NULL, &slave->dev,
                &rt715_regmap);
index 5cd50d8411778d62d7fb12e0bfc44b83e42db17f..8efe20605f9be0e3432b2f2556efb70d0c600ef2 100644 (file)
@@ -842,6 +842,18 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
        if (ret)
                goto out;
 
+       if (adcx140->supply_areg == NULL)
+               sleep_cfg_val |= ADCX140_AREG_INTERNAL;
+
+       ret = regmap_write(adcx140->regmap, ADCX140_SLEEP_CFG, sleep_cfg_val);
+       if (ret) {
+               dev_err(adcx140->dev, "setting sleep config failed %d\n", ret);
+               goto out;
+       }
+
+       /* 8.4.3: Wait >= 1ms after entering active mode. */
+       usleep_range(1000, 100000);
+
        pdm_count = device_property_count_u32(adcx140->dev,
                                              "ti,pdm-edge-select");
        if (pdm_count <= ADCX140_NUM_PDM_EDGES && pdm_count > 0) {
@@ -889,18 +901,6 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
        if (ret)
                goto out;
 
-       if (adcx140->supply_areg == NULL)
-               sleep_cfg_val |= ADCX140_AREG_INTERNAL;
-
-       ret = regmap_write(adcx140->regmap, ADCX140_SLEEP_CFG, sleep_cfg_val);
-       if (ret) {
-               dev_err(adcx140->dev, "setting sleep config failed %d\n", ret);
-               goto out;
-       }
-
-       /* 8.4.3: Wait >= 1ms after entering active mode. */
-       usleep_range(1000, 100000);
-
        ret = regmap_update_bits(adcx140->regmap, ADCX140_BIAS_CFG,
                                ADCX140_MIC_BIAS_VAL_MSK |
                                ADCX140_MIC_BIAS_VREF_MSK, bias_cfg);
@@ -980,6 +980,8 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
        if (!adcx140)
                return -ENOMEM;
 
+       adcx140->dev = &i2c->dev;
+
        adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev,
                                                      "reset", GPIOD_OUT_LOW);
        if (IS_ERR(adcx140->gpio_reset))
@@ -1007,7 +1009,7 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
                        ret);
                return ret;
        }
-       adcx140->dev = &i2c->dev;
+
        i2c_set_clientdata(i2c, adcx140);
 
        return devm_snd_soc_register_component(&i2c->dev,
index 038be667c1a61813aa82112d9d2b7b0ac66f409f..fc9ea198ac799047720178693b48ffae8a4d2315 100644 (file)
@@ -3514,6 +3514,8 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *
                return -EINVAL;
        }
 
+       pm_runtime_get_sync(component->dev);
+
        switch (micbias) {
        case 1:
                micdet = &wm8994->micdet[0];
@@ -3561,6 +3563,8 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *
 
        snd_soc_dapm_sync(dapm);
 
+       pm_runtime_put(component->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(wm8994_mic_detect);
@@ -3932,6 +3936,8 @@ int wm8958_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *
                return -EINVAL;
        }
 
+       pm_runtime_get_sync(component->dev);
+
        if (jack) {
                snd_soc_dapm_force_enable_pin(dapm, "CLK_SYS");
                snd_soc_dapm_sync(dapm);
@@ -4000,6 +4006,8 @@ int wm8958_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *
                snd_soc_dapm_sync(dapm);
        }
 
+       pm_runtime_put(component->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(wm8958_mic_detect);
@@ -4193,11 +4201,13 @@ static int wm8994_component_probe(struct snd_soc_component *component)
                        wm8994->hubs.dcs_readback_mode = 2;
                        break;
                }
+               wm8994->hubs.micd_scthr = true;
                break;
 
        case WM8958:
                wm8994->hubs.dcs_readback_mode = 1;
                wm8994->hubs.hp_startup_mode = 1;
+               wm8994->hubs.micd_scthr = true;
 
                switch (control->revision) {
                case 0:
index 891effe220fec71e803dc0e6eb79d756f9aa5acc..0c881846f485faeedb7272aa8513f37cb9f82964 100644 (file)
@@ -1223,6 +1223,9 @@ int wm_hubs_handle_analogue_pdata(struct snd_soc_component *component,
                snd_soc_component_update_bits(component, WM8993_ADDITIONAL_CONTROL,
                                    WM8993_LINEOUT2_FB, WM8993_LINEOUT2_FB);
 
+       if (!hubs->micd_scthr)
+               return 0;
+
        snd_soc_component_update_bits(component, WM8993_MICBIAS,
                            WM8993_JD_SCTHR_MASK | WM8993_JD_THR_MASK |
                            WM8993_MICB1_LVL | WM8993_MICB2_LVL,
index 4b8e5f0d6e32d821b8a1605c3329e816747bcfe4..988b29e6306072ec8b61c0e05121e3b2b9056c0e 100644 (file)
@@ -27,6 +27,7 @@ struct wm_hubs_data {
        int hp_startup_mode;
        int series_startup;
        int no_series_update;
+       bool micd_scthr;
 
        bool no_cache_dac_hp_direct;
        struct list_head dcs_cache;
index 4ae36099ae82f0d146c0cf927113703e4025c5bd..79b861afd98607d8686568ab1759b2fc6e258506 100644 (file)
@@ -708,9 +708,9 @@ static void fsl_esai_trigger_stop(struct fsl_esai *esai_priv, bool tx)
                           ESAI_xFCR_xFR, 0);
 }
 
-static void fsl_esai_hw_reset(unsigned long arg)
+static void fsl_esai_hw_reset(struct tasklet_struct *t)
 {
-       struct fsl_esai *esai_priv = (struct fsl_esai *)arg;
+       struct fsl_esai *esai_priv = from_tasklet(esai_priv, t, task);
        bool tx = true, rx = false, enabled[2];
        unsigned long lock_flags;
        u32 tfcr, rfcr;
@@ -1070,8 +1070,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
                return ret;
        }
 
-       tasklet_init(&esai_priv->task, fsl_esai_hw_reset,
-                    (unsigned long)esai_priv);
+       tasklet_setup(&esai_priv->task, fsl_esai_hw_reset);
 
        pm_runtime_enable(&pdev->dev);
 
index d8b9c6547142055a9815384183a58e120048dd01..404be27c15fed87b1083e2258a91fdb9dfd885c7 100644 (file)
@@ -898,7 +898,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt)
                                        "missing baudclk for master mode\n");
                                return -EINVAL;
                        }
-                       /* fall through */
+                       fallthrough;
                case SND_SOC_DAIFMT_CBM_CFS:
                        ssi->i2s_net |= SSI_SCR_I2S_MODE_MASTER;
                        break;
index fd5dcd6b9f856521223b82388dd9a4dc94ae6dd9..907f5f1f7b445eb2c7f9363c00e90c5a4cf3a020 100644 (file)
@@ -261,13 +261,13 @@ static int hi6210_i2s_hw_params(struct snd_pcm_substream *substream,
        switch (params_format(params)) {
        case SNDRV_PCM_FORMAT_U16_LE:
                signed_data = HII2S_I2S_CFG__S2_CODEC_DATA_FORMAT;
-               /* fall through */
+               fallthrough;
        case SNDRV_PCM_FORMAT_S16_LE:
                bits = HII2S_BITS_16;
                break;
        case SNDRV_PCM_FORMAT_U24_LE:
                signed_data = HII2S_I2S_CFG__S2_CODEC_DATA_FORMAT;
-               /* fall through */
+               fallthrough;
        case SNDRV_PCM_FORMAT_S24_LE:
                bits = HII2S_BITS_24;
                break;
index b1cac7abdc0ab6df91cb82048df1ead8db9aea2f..fba2c795ce0dabea7f61a8633573c50e1fc733e8 100644 (file)
@@ -333,6 +333,17 @@ static int sst_media_open(struct snd_pcm_substream *substream,
        if (ret_val < 0)
                goto out_power_up;
 
+       /*
+        * Make sure the period to be multiple of 1ms to align the
+        * design of firmware. Apply same rule to buffer size to make
+        * sure alsa could always find a value for period size
+        * regardless the buffer size given by user space.
+        */
+       snd_pcm_hw_constraint_step(substream->runtime, 0,
+                          SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 48);
+       snd_pcm_hw_constraint_step(substream->runtime, 0,
+                          SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 48);
+
        /* Make sure, that the period size is always even */
        snd_pcm_hw_constraint_step(substream->runtime, 0,
                           SNDRV_PCM_HW_PARAM_PERIODS, 2);
index 54a66cc6db890234f0fa870300293abce64d7042..d2cda33b65d58da1850c34ec6a5ef75b27a06ec0 100644 (file)
@@ -181,7 +181,7 @@ static int sst_byt_pcm_trigger(struct snd_soc_component *component,
                break;
        case SNDRV_PCM_TRIGGER_SUSPEND:
                pdata->restore_stream = false;
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
                sst_byt_stream_pause(byt, pcm_data->stream);
                break;
index 414ae4bb5224a96d58d2586c2d2d092395ebe988..7ae34b49815c9b6fc873a086e52d8df95ba5176e 100644 (file)
@@ -573,7 +573,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
                        break;
                default:
                        dev_err(dev, "get speaker GPIO failed: %d\n", ret);
-                       /* fall through */
+                       fallthrough;
                case -EPROBE_DEFER:
                        return ret;
                }
index 479992f4e97a35c91d0e2118e809fdb3c2482e8b..fc202747ba837e83352ccdc8b9a6eb310c4e5367 100644 (file)
@@ -591,6 +591,16 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
                                        BYT_RT5640_SSP0_AIF1 |
                                        BYT_RT5640_MCLK_EN),
        },
+       {       /* MPMAN Converter 9, similar hw as the I.T.Works TW891 2-in-1 */
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "MPMAN"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Converter9"),
+               },
+               .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
+                                       BYT_RT5640_MONO_SPEAKER |
+                                       BYT_RT5640_SSP0_AIF1 |
+                                       BYT_RT5640_MCLK_EN),
+       },
        {
                /* MPMAN MPWIN895CL */
                .matches = {
index 4e2897596cea317814e0d7d8d47032f16216e56f..688b5e0a49e323c619c5bb70666751e8fd261253 100644 (file)
@@ -1009,7 +1009,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
                        default:
                                dev_err(&pdev->dev, "Failed to get ext-amp-enable GPIO: %d\n",
                                        ret_val);
-                               /* fall through */
+                               fallthrough;
                        case -EPROBE_DEFER:
                                put_device(codec_dev);
                                return ret_val;
@@ -1029,7 +1029,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
                        default:
                                dev_err(&pdev->dev, "Failed to get hp-detect GPIO: %d\n",
                                        ret_val);
-                               /* fall through */
+                               fallthrough;
                        case -EPROBE_DEFER:
                                put_device(codec_dev);
                                return ret_val;
index ca4900036ead960694d6ec8d2f1d98e638d64eaf..bc50eda297ab7c2968e7257734401e32a2631160 100644 (file)
@@ -181,7 +181,7 @@ static void skl_set_hda_codec_autosuspend_delay(struct snd_soc_card *card)
        struct snd_soc_dai *dai;
 
        for_each_card_rtds(card, rtd) {
-               if (!strstr(rtd->dai_link->codecs->name, "ehdaudio"))
+               if (!strstr(rtd->dai_link->codecs->name, "ehdaudio0D0"))
                        continue;
                dai = asoc_rtd_to_codec(rtd, 0);
                hda_pvt = snd_soc_component_get_drvdata(dai->component);
index 1a696159202971465bd5b18ca6aca98b1105d6d8..b6e63ea13d64e2754ebf5534c7e931d9ebff645a 100644 (file)
@@ -66,6 +66,10 @@ int max98373_trigger(struct snd_pcm_substream *substream, int cmd)
        int j;
        int ret = 0;
 
+       /* set spk pin by playback only */
+       if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+               return 0;
+
        for_each_rtd_codec_dais(rtd, j, codec_dai) {
                struct snd_soc_component *component = codec_dai->component;
                struct snd_soc_dapm_context *dapm =
@@ -86,9 +90,6 @@ int max98373_trigger(struct snd_pcm_substream *substream, int cmd)
                case SNDRV_PCM_TRIGGER_STOP:
                case SNDRV_PCM_TRIGGER_SUSPEND:
                case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-                       /* Make sure no streams are active before disable pin */
-                       if (snd_soc_dai_active(codec_dai) != 1)
-                               break;
                        ret = snd_soc_dapm_disable_pin(dapm, pin_name);
                        if (!ret)
                                snd_soc_dapm_sync(dapm);
index de80e19454c13576d5204e5b1695ede4b6ba16bd..88c3f63bded90f5e2b6093c2c07906da4abf0db5 100644 (file)
@@ -243,92 +243,45 @@ static irqreturn_t hsw_irq(int irq, void *context)
        return ret;
 }
 
-#define CSR_DEFAULT_VALUE 0x8480040E
-#define ISC_DEFAULT_VALUE 0x0
-#define ISD_DEFAULT_VALUE 0x0
-#define IMC_DEFAULT_VALUE 0x7FFF0003
-#define IMD_DEFAULT_VALUE 0x7FFF0003
-#define IPCC_DEFAULT_VALUE 0x0
-#define IPCD_DEFAULT_VALUE 0x0
-#define CLKCTL_DEFAULT_VALUE 0x7FF
-#define CSR2_DEFAULT_VALUE 0x0
-#define LTR_CTRL_DEFAULT_VALUE 0x0
-#define HMD_CTRL_DEFAULT_VALUE 0x0
-
-static void hsw_set_shim_defaults(struct sst_dsp *sst)
-{
-       sst_dsp_shim_write_unlocked(sst, SST_CSR, CSR_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_ISRX, ISC_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_ISRD, ISD_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_IMRX, IMC_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_IMRD, IMD_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_IPCX, IPCC_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_IPCD, IPCD_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_CLKCTL, CLKCTL_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_CSR2, CSR2_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_LTRC, LTR_CTRL_DEFAULT_VALUE);
-       sst_dsp_shim_write_unlocked(sst, SST_HMDC, HMD_CTRL_DEFAULT_VALUE);
-}
-
-/* all clock-gating minus DCLCGE and DTCGE */
-#define SST_VDRTCL2_CG_OTHER   0xB7D
-
 static void hsw_set_dsp_D3(struct sst_dsp *sst)
 {
+       u32 val;
        u32 reg;
 
-       /* disable clock core gating */
+       /* Disable core clock gating (VDRTCTL2.DCLCGE = 0) */
        reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
-       reg &= ~(SST_VDRTCL2_DCLCGE);
+       reg &= ~(SST_VDRTCL2_DCLCGE | SST_VDRTCL2_DTCGE);
        writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2);
 
-       /* stall, reset and set 24MHz XOSC */
-       sst_dsp_shim_update_bits_unlocked(sst, SST_CSR,
-                       SST_CSR_24MHZ_LPCS | SST_CSR_STALL | SST_CSR_RST,
-                       SST_CSR_24MHZ_LPCS | SST_CSR_STALL | SST_CSR_RST);
-
-       /* DRAM power gating all */
-       reg = readl(sst->addr.pci_cfg + SST_VDRTCTL0);
-       reg |= SST_VDRTCL0_ISRAMPGE_MASK |
-               SST_VDRTCL0_DSRAMPGE_MASK;
-       reg &= ~(SST_VDRTCL0_D3SRAMPGD);
-       reg |= SST_VDRTCL0_D3PGD;
-       writel(reg, sst->addr.pci_cfg + SST_VDRTCTL0);
-       udelay(50);
+       /* enable power gating and switch off DRAM & IRAM blocks */
+       val = readl(sst->addr.pci_cfg + SST_VDRTCTL0);
+       val |= SST_VDRTCL0_DSRAMPGE_MASK |
+               SST_VDRTCL0_ISRAMPGE_MASK;
+       val &= ~(SST_VDRTCL0_D3PGD | SST_VDRTCL0_D3SRAMPGD);
+       writel(val, sst->addr.pci_cfg + SST_VDRTCTL0);
 
-       /* PLL shutdown enable */
-       reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
-       reg |= SST_VDRTCL2_APLLSE_MASK;
-       writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2);
+       /* switch off audio PLL */
+       val = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
+       val |= SST_VDRTCL2_APLLSE_MASK;
+       writel(val, sst->addr.pci_cfg + SST_VDRTCTL2);
 
-       /* disable MCLK */
+       /* disable MCLK(clkctl.smos = 0) */
        sst_dsp_shim_update_bits_unlocked(sst, SST_CLKCTL,
-                       SST_CLKCTL_MASK, 0);
-
-       /* switch clock gating */
-       reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
-       reg |= SST_VDRTCL2_CG_OTHER;
-       reg &= ~(SST_VDRTCL2_DTCGE);
-       writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2);
-       /* enable DTCGE separatelly */
-       reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
-       reg |= SST_VDRTCL2_DTCGE;
-       writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2);
+               SST_CLKCTL_MASK, 0);
 
-       /* set shim defaults */
-       hsw_set_shim_defaults(sst);
-
-       /* set D3 */
-       reg = readl(sst->addr.pci_cfg + SST_PMCS);
-       reg |= SST_PMCS_PS_MASK;
-       writel(reg, sst->addr.pci_cfg + SST_PMCS);
+       /* Set D3 state, delay 50 us */
+       val = readl(sst->addr.pci_cfg + SST_PMCS);
+       val |= SST_PMCS_PS_MASK;
+       writel(val, sst->addr.pci_cfg + SST_PMCS);
        udelay(50);
 
-       /* enable clock core gating */
+       /* Enable core clock gating (VDRTCTL2.DCLCGE = 1), delay 50 us */
        reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
-       reg |= SST_VDRTCL2_DCLCGE;
+       reg |= SST_VDRTCL2_DCLCGE | SST_VDRTCL2_DTCGE;
        writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2);
+
        udelay(50);
+
 }
 
 static void hsw_reset(struct sst_dsp *sst)
@@ -346,62 +299,75 @@ static void hsw_reset(struct sst_dsp *sst)
                SST_CSR_RST | SST_CSR_STALL, SST_CSR_STALL);
 }
 
-/* recommended CSR state for power-up */
-#define SST_CSR_D0_MASK (0x18A09C0C | SST_CSR_DCS_MASK)
-
 static int hsw_set_dsp_D0(struct sst_dsp *sst)
 {
-       u32 reg;
+       int tries = 10;
+       u32 reg, fw_dump_bit;
 
-       /* disable clock core gating */
+       /* Disable core clock gating (VDRTCTL2.DCLCGE = 0) */
        reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
-       reg &= ~(SST_VDRTCL2_DCLCGE);
+       reg &= ~(SST_VDRTCL2_DCLCGE | SST_VDRTCL2_DTCGE);
        writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2);
 
-       /* switch clock gating */
-       reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
-       reg |= SST_VDRTCL2_CG_OTHER;
-       reg &= ~(SST_VDRTCL2_DTCGE);
-       writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2);
+       /* Disable D3PG (VDRTCTL0.D3PGD = 1) */
+       reg = readl(sst->addr.pci_cfg + SST_VDRTCTL0);
+       reg |= SST_VDRTCL0_D3PGD;
+       writel(reg, sst->addr.pci_cfg + SST_VDRTCTL0);
 
-       /* set D0 */
+       /* Set D0 state */
        reg = readl(sst->addr.pci_cfg + SST_PMCS);
-       reg &= ~(SST_PMCS_PS_MASK);
+       reg &= ~SST_PMCS_PS_MASK;
        writel(reg, sst->addr.pci_cfg + SST_PMCS);
 
-       /* DRAM power gating none */
-       reg = readl(sst->addr.pci_cfg + SST_VDRTCTL0);
-       reg &= ~(SST_VDRTCL0_ISRAMPGE_MASK |
-               SST_VDRTCL0_DSRAMPGE_MASK);
-       reg |= SST_VDRTCL0_D3SRAMPGD;
-       reg |= SST_VDRTCL0_D3PGD;
-       writel(reg, sst->addr.pci_cfg + SST_VDRTCTL0);
-       mdelay(10);
+       /* check that ADSP shim is enabled */
+       while (tries--) {
+               reg = readl(sst->addr.pci_cfg + SST_PMCS) & SST_PMCS_PS_MASK;
+               if (reg == 0)
+                       goto finish;
+
+               msleep(1);
+       }
+
+       return -ENODEV;
 
-       /* set shim defaults */
-       hsw_set_shim_defaults(sst);
+finish:
+       /* select SSP1 19.2MHz base clock, SSP clock 0, turn off Low Power Clock */
+       sst_dsp_shim_update_bits_unlocked(sst, SST_CSR,
+               SST_CSR_S1IOCS | SST_CSR_SBCS1 | SST_CSR_LPCS, 0x0);
+
+       /* stall DSP core, set clk to 192/96Mhz */
+       sst_dsp_shim_update_bits_unlocked(sst,
+               SST_CSR, SST_CSR_STALL | SST_CSR_DCS_MASK,
+               SST_CSR_STALL | SST_CSR_DCS(4));
 
-       /* restore MCLK */
+       /* Set 24MHz MCLK, prevent local clock gating, enable SSP0 clock */
        sst_dsp_shim_update_bits_unlocked(sst, SST_CLKCTL,
-                       SST_CLKCTL_MASK, SST_CLKCTL_MASK);
+               SST_CLKCTL_MASK | SST_CLKCTL_DCPLCG | SST_CLKCTL_SCOE0,
+               SST_CLKCTL_MASK | SST_CLKCTL_DCPLCG | SST_CLKCTL_SCOE0);
 
-       /* PLL shutdown disable */
+       /* Stall and reset core, set CSR */
+       hsw_reset(sst);
+
+       /* Enable core clock gating (VDRTCTL2.DCLCGE = 1), delay 50 us */
        reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
-       reg &= ~(SST_VDRTCL2_APLLSE_MASK);
+       reg |= SST_VDRTCL2_DCLCGE | SST_VDRTCL2_DTCGE;
        writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2);
 
-       sst_dsp_shim_update_bits_unlocked(sst, SST_CSR,
-                       SST_CSR_D0_MASK, SST_CSR_SBCS0 | SST_CSR_SBCS1 |
-                       SST_CSR_STALL | SST_CSR_DCS(4));
        udelay(50);
 
-       /* enable clock core gating */
+       /* switch on audio PLL */
        reg = readl(sst->addr.pci_cfg + SST_VDRTCTL2);
-       reg |= SST_VDRTCL2_DCLCGE;
+       reg &= ~SST_VDRTCL2_APLLSE_MASK;
        writel(reg, sst->addr.pci_cfg + SST_VDRTCTL2);
 
-       /* clear reset */
-       sst_dsp_shim_update_bits_unlocked(sst, SST_CSR, SST_CSR_RST, 0);
+       /* set default power gating control, enable power gating control for all blocks. that is,
+       can't be accessed, please enable each block before accessing. */
+       reg = readl(sst->addr.pci_cfg + SST_VDRTCTL0);
+       reg |= SST_VDRTCL0_DSRAMPGE_MASK | SST_VDRTCL0_ISRAMPGE_MASK;
+       /* for D0, always enable the block(DSRAM[0]) used for FW dump */
+       fw_dump_bit = 1 << SST_VDRTCL0_DSRAMPGE_SHIFT;
+       writel(reg & ~fw_dump_bit, sst->addr.pci_cfg + SST_VDRTCTL0);
+
 
        /* disable DMA finish function for SSP0 & SSP1 */
        sst_dsp_shim_update_bits_unlocked(sst, SST_CSR2, SST_CSR2_SDFD_SSP1,
@@ -418,6 +384,12 @@ static int hsw_set_dsp_D0(struct sst_dsp *sst)
        sst_dsp_shim_update_bits(sst, SST_IMRD, (SST_IMRD_DONE | SST_IMRD_BUSY |
                                SST_IMRD_SSP0 | SST_IMRD_DMAC), 0x0);
 
+       /* clear IPC registers */
+       sst_dsp_shim_write(sst, SST_IPCX, 0x0);
+       sst_dsp_shim_write(sst, SST_IPCD, 0x0);
+       sst_dsp_shim_write(sst, 0x80, 0x6);
+       sst_dsp_shim_write(sst, 0xe0, 0x300a);
+
        return 0;
 }
 
@@ -443,6 +415,11 @@ static void hsw_sleep(struct sst_dsp *sst)
 {
        dev_dbg(sst->dev, "HSW_PM dsp runtime suspend\n");
 
+       /* put DSP into reset and stall */
+       sst_dsp_shim_update_bits(sst, SST_CSR,
+               SST_CSR_24MHZ_LPCS | SST_CSR_RST | SST_CSR_STALL,
+               SST_CSR_RST | SST_CSR_STALL | SST_CSR_24MHZ_LPCS);
+
        hsw_set_dsp_D3(sst);
        dev_dbg(sst->dev, "HSW_PM dsp runtime suspend exit\n");
 }
index 5dee55e9546bbd936260eaad2d7b986715e511d2..bbe8d782e0af6a1d4f6eed314775602e10d906ee 100644 (file)
@@ -488,7 +488,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
                                                        stream->lpib);
                        snd_hdac_ext_stream_set_lpib(stream, stream->lpib);
                }
-               /* fall through */
+               fallthrough;
 
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
index 36df30915378cca26e80c93ef235f9ac669d1378..c8664ab80d45ad0b0774370221938a9d79f75620 100644 (file)
@@ -58,17 +58,17 @@ int axg_tdm_set_tdm_slots(struct snd_soc_dai *dai, u32 *tx_mask,
        switch (slot_width) {
        case 0:
                slot_width = 32;
-               /* Fall-through */
+               fallthrough;
        case 32:
                fmt |= SNDRV_PCM_FMTBIT_S32_LE;
-               /* Fall-through */
+               fallthrough;
        case 24:
                fmt |= SNDRV_PCM_FMTBIT_S24_LE;
                fmt |= SNDRV_PCM_FMTBIT_S20_LE;
-               /* Fall-through */
+               fallthrough;
        case 16:
                fmt |= SNDRV_PCM_FMTBIT_S16_LE;
-               /* Fall-through */
+               fallthrough;
        case 8:
                fmt |= SNDRV_PCM_FMTBIT_S8;
                break;
@@ -133,7 +133,7 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
        case SND_SOC_DAIFMT_CBS_CFM:
        case SND_SOC_DAIFMT_CBM_CFS:
                dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n");
-               /* Fall-through */
+               fallthrough;
        default:
                return -EINVAL;
        }
index e711abcf8c12483e3e218e58a1789574f3c711cd..d6adf7edea41fbfe378f26faa92b83a76c7a3e24 100644 (file)
@@ -18,6 +18,7 @@
 #define CTRL0_TODDR_SEL_RESAMPLE       BIT(30)
 #define CTRL0_TODDR_EXT_SIGNED         BIT(29)
 #define CTRL0_TODDR_PP_MODE            BIT(28)
+#define CTRL0_TODDR_SYNC_CH            BIT(27)
 #define CTRL0_TODDR_TYPE_MASK          GENMASK(15, 13)
 #define CTRL0_TODDR_TYPE(x)            ((x) << 13)
 #define CTRL0_TODDR_MSB_POS_MASK       GENMASK(12, 8)
@@ -189,10 +190,31 @@ static const struct axg_fifo_match_data axg_toddr_match_data = {
        .dai_drv                = &axg_toddr_dai_drv
 };
 
+static int g12a_toddr_dai_startup(struct snd_pcm_substream *substream,
+                                struct snd_soc_dai *dai)
+{
+       struct axg_fifo *fifo = snd_soc_dai_get_drvdata(dai);
+       int ret;
+
+       ret = axg_toddr_dai_startup(substream, dai);
+       if (ret)
+               return ret;
+
+       /*
+        * Make sure the first channel ends up in the at beginning of the output
+        * As weird as it looks, without this the first channel may be misplaced
+        * in memory, with a random shift of 2 channels.
+        */
+       regmap_update_bits(fifo->map, FIFO_CTRL0, CTRL0_TODDR_SYNC_CH,
+                          CTRL0_TODDR_SYNC_CH);
+
+       return 0;
+}
+
 static const struct snd_soc_dai_ops g12a_toddr_ops = {
        .prepare        = g12a_toddr_dai_prepare,
        .hw_params      = axg_toddr_dai_hw_params,
-       .startup        = axg_toddr_dai_startup,
+       .startup        = g12a_toddr_dai_startup,
        .shutdown       = axg_toddr_dai_shutdown,
 };
 
index d1e09ade0190d67404cf796f12a6e1d0a0413cf2..c4e7307a44374ed6bd329d2aa6c6333dce3646a0 100644 (file)
@@ -488,7 +488,7 @@ static int pxa_ssp_configure_dai_fmt(struct ssp_priv *priv)
 
        case SND_SOC_DAIFMT_DSP_A:
                sspsp |= SSPSP_FSRT;
-               /* fall through */
+               fallthrough;
        case SND_SOC_DAIFMT_DSP_B:
                sscr0 |= SSCR0_MOD | SSCR0_PSP;
                sscr1 |= SSCR1_TRAIL | SSCR1_RWOT;
index 083413abc2f694bedc98237bc6d3e45ebe0958ca..575e2aefefe3d4a4fd75dfe67f8402dbe24fab5d 100644 (file)
@@ -143,6 +143,7 @@ static int apq8016_sbc_platform_probe(struct platform_device *pdev)
 
        card = &data->card;
        card->dev = dev;
+       card->owner = THIS_MODULE;
        card->dapm_widgets = apq8016_sbc_dapm_widgets;
        card->num_dapm_widgets = ARRAY_SIZE(apq8016_sbc_dapm_widgets);
 
index 253549600c5a3f8ee98de0ad225dd38097e7fd62..1a69baefc5cea1c180ca3468147fd58c17db1a1d 100644 (file)
@@ -114,6 +114,7 @@ static int apq8096_platform_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        card->dev = dev;
+       card->owner = THIS_MODULE;
        dev_set_drvdata(dev, card);
        ret = qcom_snd_parse_of(card);
        if (ret)
index 5194d90ddb96467ca8190c4f61fb59156a448b63..fd69cf8b1f23a60f2be67bed1560a47450d86634 100644 (file)
@@ -52,8 +52,10 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
 
        for_each_child_of_node(dev->of_node, np) {
                dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL);
-               if (!dlc)
-                       return -ENOMEM;
+               if (!dlc) {
+                       ret = -ENOMEM;
+                       goto err;
+               }
 
                link->cpus      = &dlc[0];
                link->platforms = &dlc[1];
index 0d10fba53945e69c833de4ab1a7bd8c11b1cc1e0..ab1bf23c21a6847eaacec2978179ee19cc9c0ee0 100644 (file)
@@ -555,6 +555,7 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev)
        card->dapm_widgets = sdm845_snd_widgets;
        card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets);
        card->dev = dev;
+       card->owner = THIS_MODULE;
        dev_set_drvdata(dev, card);
        ret = qcom_snd_parse_of(card);
        if (ret)
index c0c388d4db82912df343c5b6eac87b2bfcfddcef..80c9cf2f254a763f8ebaef3c17894ef7f5efe105 100644 (file)
@@ -96,6 +96,7 @@ static int storm_platform_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        card->dev = &pdev->dev;
+       card->owner = THIS_MODULE;
 
        ret = snd_soc_of_parse_card_name(card, "qcom,model");
        if (ret) {
index 1707414cfa9213c6ebd244c98550666dbff75330..5adb293d0435d150a28b18377b85860698440830 100644 (file)
@@ -229,13 +229,13 @@ static int rockchip_pdm_hw_params(struct snd_pcm_substream *substream,
        switch (params_channels(params)) {
        case 8:
                val |= PDM_PATH3_EN;
-               /* fallthrough */
+               fallthrough;
        case 6:
                val |= PDM_PATH2_EN;
-               /* fallthrough */
+               fallthrough;
        case 4:
                val |= PDM_PATH1_EN;
-               /* fallthrough */
+               fallthrough;
        case 2:
                val |= PDM_PATH0_EN;
                break;
index 80ecb5c7fed0c1a03110a9a16c73d853ae154bc9..df53d4ea808fe57eed7537f73ae60a11f301d203 100644 (file)
@@ -733,7 +733,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
        switch (params_channels(params)) {
        case 6:
                val |= MOD_DC2_EN;
-               /* Fall through */
+               fallthrough;
        case 4:
                val |= MOD_DC1_EN;
                break;
index bd9de77c35f3eac318af8af78d1d394f91749d86..50fc7810723ec22802ebe026cdf976d3c5a068c5 100644 (file)
@@ -198,9 +198,9 @@ static int siu_pcm_rd_set(struct siu_port *port_info,
        return 0;
 }
 
-static void siu_io_tasklet(unsigned long data)
+static void siu_io_tasklet(struct tasklet_struct *t)
 {
-       struct siu_stream *siu_stream = (struct siu_stream *)data;
+       struct siu_stream *siu_stream = from_tasklet(siu_stream, t, tasklet);
        struct snd_pcm_substream *substream = siu_stream->substream;
        struct device *dev = substream->pcm->card->dev;
        struct snd_pcm_runtime *rt = substream->runtime;
@@ -520,10 +520,8 @@ static int siu_pcm_new(struct snd_soc_component *component,
                (*port_info)->pcm = pcm;
 
                /* IO tasklets */
-               tasklet_init(&(*port_info)->playback.tasklet, siu_io_tasklet,
-                            (unsigned long)&(*port_info)->playback);
-               tasklet_init(&(*port_info)->capture.tasklet, siu_io_tasklet,
-                            (unsigned long)&(*port_info)->capture);
+               tasklet_setup(&(*port_info)->playback.tasklet, siu_io_tasklet);
+               tasklet_setup(&(*port_info)->capture.tasklet, siu_io_tasklet);
        }
 
        dev_info(card->dev, "SuperH SIU driver initialized.\n");
index 2fe1b2ec7c8fe6542330ff7036306283f1d19aa5..0544376606781dea199c1a0d29b0306cb0c5afc7 100644 (file)
@@ -618,7 +618,7 @@ int snd_soc_suspend(struct device *dev)
                                                "ASoC: idle_bias_off CODEC on over suspend\n");
                                        break;
                                }
-                               /* fall through */
+                               fallthrough;
 
                        case SND_SOC_BIAS_OFF:
                                snd_soc_component_suspend(component);
@@ -834,6 +834,19 @@ struct snd_soc_dai *snd_soc_find_dai(
 }
 EXPORT_SYMBOL_GPL(snd_soc_find_dai);
 
+struct snd_soc_dai *snd_soc_find_dai_with_mutex(
+       const struct snd_soc_dai_link_component *dlc)
+{
+       struct snd_soc_dai *dai;
+
+       mutex_lock(&client_mutex);
+       dai = snd_soc_find_dai(dlc);
+       mutex_unlock(&client_mutex);
+
+       return dai;
+}
+EXPORT_SYMBOL_GPL(snd_soc_find_dai_with_mutex);
+
 static int soc_dai_link_sanity_check(struct snd_soc_card *card,
                                     struct snd_soc_dai_link *link)
 {
index 91a2551e4cefef822bec350c591d19c600d8ab16..0dbd312aad084a781aaaa4843ce7c364fbe89199 100644 (file)
@@ -412,14 +412,14 @@ void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link)
                supported_codec = false;
 
                for_each_link_cpus(dai_link, i, cpu) {
-                       dai = snd_soc_find_dai(cpu);
+                       dai = snd_soc_find_dai_with_mutex(cpu);
                        if (dai && snd_soc_dai_stream_valid(dai, direction)) {
                                supported_cpu = true;
                                break;
                        }
                }
                for_each_link_codecs(dai_link, i, codec) {
-                       dai = snd_soc_find_dai(codec);
+                       dai = snd_soc_find_dai_with_mutex(codec);
                        if (dai && snd_soc_dai_stream_valid(dai, direction)) {
                                supported_codec = true;
                                break;
index 00ac1cbf6f88091d0885d8f79140de77d9481c69..4c9d4cd8cf0b978bd95531351ad19baa24b3a7a0 100644 (file)
@@ -812,7 +812,7 @@ dynamic:
        return 0;
 
 config_err:
-       for_each_rtd_dais(rtd, i, dai)
+       for_each_rtd_dais_rollback(rtd, i, dai)
                snd_soc_dai_shutdown(dai, substream);
 
        snd_soc_link_shutdown(substream);
index cee99867131879620d292045b9837950e0c03a0d..5b60379237bffda36e2fdefb99de87e58195b683 100644 (file)
@@ -1057,7 +1057,7 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count,
                                        ec->hdr.name);
                                goto err_denum;
                        }
-                       /* fall through */
+                       fallthrough;
                case SND_SOC_TPLG_CTL_ENUM:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT:
@@ -1445,7 +1445,7 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create(
                                        ec->hdr.name);
                                goto err_se;
                        }
-                       /* fall through */
+                       fallthrough;
                case SND_SOC_TPLG_CTL_ENUM:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT:
index df1c6997cb4e28aea17266527d1ec85c0259a739..c6cb8c212eca59e84f3ff9e7092b339a8f5a6d8e 100644 (file)
@@ -310,7 +310,7 @@ static int hda_link_pcm_trigger(struct snd_pcm_substream *substream,
                        return ret;
                }
 
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
                snd_hdac_ext_link_stream_start(link_dev);
@@ -333,7 +333,7 @@ static int hda_link_pcm_trigger(struct snd_pcm_substream *substream,
 
                link_dev->link_prepared = 0;
 
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
                snd_hdac_ext_link_stream_clear(link_dev);
                break;
index d730e437e4ba84d2d447b5dfb06f47a58af21005..71c3f29057a71276596a0a04aa14efdc1f36a165 100644 (file)
@@ -361,7 +361,7 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
                        return ret;
                }
 
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_START:
                if (spcm->stream[substream->stream].suspend_ignored) {
                        /*
@@ -386,7 +386,7 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
                        spcm->stream[substream->stream].suspend_ignored = true;
                        return 0;
                }
-               /* fallthrough */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_STOP:
                stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_STOP;
                ipc_first = true;
index 5c47de96c529860c086c4af3f309b6e5861038f6..57feb473a579caa89a697b90da48d7ba7d426f30 100644 (file)
@@ -446,12 +446,12 @@ static const struct snd_soc_dai_ops ams_delta_dai_ops = {
 /* Will be used if the codec ever has its own digital_mute function */
 static int ams_delta_startup(struct snd_pcm_substream *substream)
 {
-       return ams_delta_digital_mute(NULL, 0, substream->stream);
+       return ams_delta_mute(NULL, 0, substream->stream);
 }
 
 static void ams_delta_shutdown(struct snd_pcm_substream *substream)
 {
-       ams_delta_digital_mute(NULL, 1, substream->stream);
+       ams_delta_mute(NULL, 1, substream->stream);
 }
 
 
index d89b5c928c4d7b979d400454ce0694a94260f11d..dd34504c09ba8178ab5fff4882a3735df46181f6 100644 (file)
@@ -289,7 +289,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
                 * rate is lowered.
                 */
                inv_fs = true;
-               /* fall through */
+               fallthrough;
        case SND_SOC_DAIFMT_DSP_A:
                dev->mode = MOD_DSP_A;
                break;
index 2802a33b9c5f1997a575a6001eb19dc366beb536..ed217b34f846ad160355ae1b1040479e3ab3f1d1 100644 (file)
@@ -46,7 +46,7 @@ static void n810_ext_control(struct snd_soc_dapm_context *dapm)
        switch (n810_jack_func) {
        case N810_JACK_HS:
                line1l = 1;
-               /* fall through */
+               fallthrough;
        case N810_JACK_HP:
                hp = 1;
                break;
index 01abf1be5d788c0d602a7c0d486b33acbd9a55c3..a26588e9c3bc283985bf1fbb6db90baea41bd9b2 100644 (file)
@@ -203,10 +203,10 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,
        switch (channels) {
        case 6:
                dmic->ch_enabled |= OMAP_DMIC_UP3_ENABLE;
-               /* fall through */
+               fallthrough;
        case 4:
                dmic->ch_enabled |= OMAP_DMIC_UP2_ENABLE;
-               /* fall through */
+               fallthrough;
        case 2:
                dmic->ch_enabled |= OMAP_DMIC_UP1_ENABLE;
                break;
index d482b62f314a60dc6cf7183098f247a3f8e7333d..fafb2998ad0df27f00d5fc4ac9d1ec07107e3a40 100644 (file)
@@ -309,19 +309,19 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
                        /* up to 3 channels for capture */
                        return -EINVAL;
                link_mask |= 1 << 4;
-               /* fall through */
+               fallthrough;
        case 4:
                if (stream == SNDRV_PCM_STREAM_CAPTURE)
                        /* up to 3 channels for capture */
                        return -EINVAL;
                link_mask |= 1 << 3;
-               /* fall through */
+               fallthrough;
        case 3:
                link_mask |= 1 << 2;
-               /* fall through */
+               fallthrough;
        case 2:
                link_mask |= 1 << 1;
-               /* fall through */
+               fallthrough;
        case 1:
                link_mask |= 1 << 0;
                break;
index 2176a95201bf8b1341ca06102b49d2010d764f68..a2629ccc1dc843abe1b442f0a36ddfe05dd56a73 100644 (file)
@@ -55,7 +55,7 @@ static void rx51_ext_control(struct snd_soc_dapm_context *dapm)
                break;
        case RX51_JACK_HS:
                hs = 1;
-               /* fall through */
+               fallthrough;
        case RX51_JACK_HP:
                hp = 1;
                break;
index 4b1cd4da3e368e783f49da8e5b9d05283470b5fa..939b33ec39f50e7623906685bb9e7b0037105079 100644 (file)
@@ -134,9 +134,9 @@ txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr)
 
 #define NR_DMA_CHAIN           2
 
-static void txx9aclc_dma_tasklet(unsigned long data)
+static void txx9aclc_dma_tasklet(struct tasklet_struct *t)
 {
-       struct txx9aclc_dmadata *dmadata = (struct txx9aclc_dmadata *)data;
+       struct txx9aclc_dmadata *dmadata = from_tasklet(dmadata, t, tasklet);
        struct dma_chan *chan = dmadata->dma_chan;
        struct dma_async_tx_descriptor *desc;
        struct snd_pcm_substream *substream = dmadata->substream;
@@ -352,8 +352,7 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev,
                        "playback" : "capture");
                return -EBUSY;
        }
-       tasklet_init(&dmadata->tasklet, txx9aclc_dma_tasklet,
-                    (unsigned long)dmadata);
+       tasklet_setup(&dmadata->tasklet, txx9aclc_dma_tasklet);
        return 0;
 }
 
index 568cde64ff8b81a0b82d7f4a5c2350051ca3b7b2..1c1a44e08a676d6ec3602b3f90eb0f897bad0e9d 100644 (file)
@@ -294,7 +294,7 @@ static int zx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
                        zx_i2s_rx_dma_en(zx_i2s->reg_base, true);
                else
                        zx_i2s_tx_dma_en(zx_i2s->reg_base, true);
-       /* fall thru */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_RESUME:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
                if (capture)
@@ -308,7 +308,7 @@ static int zx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
                        zx_i2s_rx_dma_en(zx_i2s->reg_base, false);
                else
                        zx_i2s_tx_dma_en(zx_i2s->reg_base, false);
-       /* fall thru */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_SUSPEND:
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
                if (capture)
index a3a07c0730e691eae7cc9de3b0caf7b597f7f817..b4168bd532b7498be1429960d645ec3fc84aee87 100644 (file)
@@ -218,7 +218,7 @@ static int zx_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
                val = readl_relaxed(zx_spdif->reg_base + ZX_FIFOCTRL);
                val |= ZX_FIFOCTRL_TX_FIFO_RST;
                writel_relaxed(val, zx_spdif->reg_base + ZX_FIFOCTRL);
-       /* fall thru */
+               fallthrough;
        case SNDRV_PCM_TRIGGER_RESUME:
        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
                zx_spdif_cfg_tx(zx_spdif->reg_base, true);
index df639fe031181561290ca8f2295dac1c98e78d9e..e8287a05e36bc492922492544fa90846d5e97fa6 100644 (file)
@@ -344,10 +344,9 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep)
        spin_unlock_irqrestore(&ep->buffer_lock, flags);
 }
 
-static void snd_usbmidi_out_tasklet(unsigned long data)
+static void snd_usbmidi_out_tasklet(struct tasklet_struct *t)
 {
-       struct snd_usb_midi_out_endpoint *ep =
-               (struct snd_usb_midi_out_endpoint *) data;
+       struct snd_usb_midi_out_endpoint *ep = from_tasklet(ep, t, tasklet);
 
        snd_usbmidi_do_output(ep);
 }
@@ -1441,7 +1440,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi,
        }
 
        spin_lock_init(&ep->buffer_lock);
-       tasklet_init(&ep->tasklet, snd_usbmidi_out_tasklet, (unsigned long)ep);
+       tasklet_setup(&ep->tasklet, snd_usbmidi_out_tasklet);
        init_waitqueue_head(&ep->drain_wait);
 
        for (i = 0; i < 0x10; ++i)
index 884e740a785c55af2157ac97cb47ee83e884e39e..3b2dce1043f5a66d85212f68054fefb20e1ffd5a 100644 (file)
@@ -247,9 +247,9 @@ static inline void add_with_wraparound(struct ua101 *ua,
                *value -= ua->playback.queue_length;
 }
 
-static void playback_tasklet(unsigned long data)
+static void playback_tasklet(struct tasklet_struct *t)
 {
-       struct ua101 *ua = (void *)data;
+       struct ua101 *ua = from_tasklet(ua, t, playback_tasklet);
        unsigned long flags;
        unsigned int frames;
        struct ua101_urb *urb;
@@ -1218,8 +1218,7 @@ static int ua101_probe(struct usb_interface *interface,
        spin_lock_init(&ua->lock);
        mutex_init(&ua->mutex);
        INIT_LIST_HEAD(&ua->ready_playback_urbs);
-       tasklet_init(&ua->playback_tasklet,
-                    playback_tasklet, (unsigned long)ua);
+       tasklet_setup(&ua->playback_tasklet, playback_tasklet);
        init_waitqueue_head(&ua->alsa_capture_wait);
        init_waitqueue_head(&ua->rate_feedback_wait);
        init_waitqueue_head(&ua->alsa_playback_wait);
index 5b43e9e40e49b44ac0a37bcaa77e42d8cce83cac..c369c81e74c41f20fb67821283dbfd41dda4b228 100644 (file)
@@ -371,7 +371,6 @@ static const struct usbmix_name_map asus_rog_map[] = {
 };
 
 static const struct usbmix_name_map lenovo_p620_rear_map[] = {
-       { 19, NULL, 2 }, /* FU, Volume */
        { 19, NULL, 12 }, /* FU, Input Gain Pad */
        {}
 };
index 5600751803cfe1bd322b47d3b2c632468f8ba001..b401ee894e1bb6978b595c750d12254e7b775618 100644 (file)
@@ -369,11 +369,13 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
        case USB_ID(0x07fd, 0x0008): /* MOTU M Series */
        case USB_ID(0x31e9, 0x0001): /* Solid State Logic SSL2 */
        case USB_ID(0x31e9, 0x0002): /* Solid State Logic SSL2+ */
+       case USB_ID(0x0499, 0x172f): /* Steinberg UR22C */
        case USB_ID(0x0d9a, 0x00df): /* RTX6001 */
                ep = 0x81;
                ifnum = 2;
                goto add_sync_ep_from_ifnum;
        case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
+       case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
                ep = 0x82;
                ifnum = 0;
                goto add_sync_ep_from_ifnum;
index f4fb002e3ef42594f2498487cdd51eff57d3dc74..23eafd50126f31221d4c7e98cb8fa07168d42ed4 100644 (file)
@@ -2827,14 +2827,24 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 /* Lenovo ThinkStation P620 Rear Line-in, Line-out and Microphone */
 {
        USB_DEVICE(0x17aa, 0x1046),
-       QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Rear",
-                            "Lenovo-ThinkStation-P620-Rear"),
+       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+               .vendor_name = "Lenovo",
+               .product_name = "ThinkStation P620 Rear",
+               .profile_name = "Lenovo-ThinkStation-P620-Rear",
+               .ifnum = QUIRK_ANY_INTERFACE,
+               .type = QUIRK_SETUP_DISABLE_AUTOSUSPEND
+       }
 },
 /* Lenovo ThinkStation P620 Internal Speaker + Front Headset */
 {
        USB_DEVICE(0x17aa, 0x104d),
-       QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Main",
-                            "Lenovo-ThinkStation-P620-Main"),
+       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+               .vendor_name = "Lenovo",
+               .product_name = "ThinkStation P620 Main",
+               .profile_name = "Lenovo-ThinkStation-P620-Main",
+               .ifnum = QUIRK_ANY_INTERFACE,
+               .type = QUIRK_SETUP_DISABLE_AUTOSUSPEND
+       }
 },
 
 /* Native Instruments MK2 series */
@@ -3549,14 +3559,40 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
 {
        /*
         * Pioneer DJ DJM-250MK2
-        * PCM is 8 channels out @ 48 fixed (endpoints 0x01).
-        * The output from computer to the mixer is usable.
+        * PCM is 8 channels out @ 48 fixed (endpoint 0x01)
+        * and 8 channels in @ 48 fixed (endpoint 0x82).
+        *
+        * Both playback and recording is working, even simultaneously.
         *
-        * The input (phono or line to computer) is not working.
-        * It should be at endpoint 0x82 and probably also 8 channels,
-        * but it seems that it works only with Pioneer proprietary software.
-        * Even on officially supported OS, the Audacity was unable to record
-        * and Mixxx to recognize the control vinyls.
+        * Playback channels could be mapped to:
+        *  - CH1
+        *  - CH2
+        *  - AUX
+        *
+        * Recording channels could be mapped to:
+        *  - Post CH1 Fader
+        *  - Post CH2 Fader
+        *  - Cross Fader A
+        *  - Cross Fader B
+        *  - MIC
+        *  - AUX
+        *  - REC OUT
+        *
+        * There is remaining problem with recording directly from PHONO/LINE.
+        * If we map a channel to:
+        *  - CH1 Control Tone PHONO
+        *  - CH1 Control Tone LINE
+        *  - CH2 Control Tone PHONO
+        *  - CH2 Control Tone LINE
+        * it is silent.
+        * There is no signal even on other operating systems with official drivers.
+        * The signal appears only when a supported application is started.
+        * This needs to be investigated yet...
+        * (there is quite a lot communication on the USB in both directions)
+        *
+        * In current version this mixer could be used for playback
+        * and for recording from vinyls (through Post CH* Fader)
+        * but not for DVS (Digital Vinyl Systems) like in Mixxx.
         */
        USB_DEVICE_VENDOR_SPEC(0x2b73, 0x0017),
        .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
@@ -3580,6 +3616,26 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
                                        .rate_max = 48000,
                                        .nr_rates = 1,
                                        .rate_table = (unsigned int[]) { 48000 }
+                                       }
+                       },
+                       {
+                               .ifnum = 0,
+                               .type = QUIRK_AUDIO_FIXED_ENDPOINT,
+                               .data = &(const struct audioformat) {
+                                       .formats = SNDRV_PCM_FMTBIT_S24_3LE,
+                                       .channels = 8, // inputs
+                                       .iface = 0,
+                                       .altsetting = 1,
+                                       .altset_idx = 1,
+                                       .endpoint = 0x82,
+                                       .ep_attr = USB_ENDPOINT_XFER_ISOC|
+                                               USB_ENDPOINT_SYNC_ASYNC|
+                                               USB_ENDPOINT_USAGE_IMPLICIT_FB,
+                                       .rates = SNDRV_PCM_RATE_48000,
+                                       .rate_min = 48000,
+                                       .rate_max = 48000,
+                                       .nr_rates = 1,
+                                       .rate_table = (unsigned int[]) { 48000 }
                                }
                        },
                        {
index abf99b814a0f819a7d1d3ecd6cf268e19c9082d9..892296df131d3fcd3a70c111086293dd379c9d27 100644 (file)
@@ -518,6 +518,15 @@ static int setup_fmt_after_resume_quirk(struct snd_usb_audio *chip,
        return 1;       /* Continue with creating streams and mixer */
 }
 
+static int setup_disable_autosuspend(struct snd_usb_audio *chip,
+                                      struct usb_interface *iface,
+                                      struct usb_driver *driver,
+                                      const struct snd_usb_audio_quirk *quirk)
+{
+       driver->supports_autosuspend = 0;
+       return 1;       /* Continue with creating streams and mixer */
+}
+
 /*
  * audio-interface quirks
  *
@@ -557,6 +566,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
                [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk,
                [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
                [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk,
+               [QUIRK_SETUP_DISABLE_AUTOSUSPEND] = setup_disable_autosuspend,
        };
 
        if (quirk->type < QUIRK_TYPE_COUNT) {
@@ -1493,6 +1503,7 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
                set_format_emu_quirk(subs, fmt);
                break;
        case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
+       case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
                pioneer_djm_set_format_quirk(subs);
                break;
        case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */
@@ -1667,12 +1678,13 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
            && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
                msleep(20);
 
-       /* Zoom R16/24, Logitech H650e, Jabra 550a, Kingston HyperX needs a tiny
-        * delay here, otherwise requests like get/set frequency return as
-        * failed despite actually succeeding.
+       /* Zoom R16/24, Logitech H650e/H570e, Jabra 550a, Kingston HyperX
+        *  needs a tiny delay here, otherwise requests like get/set
+        *  frequency return as failed despite actually succeeding.
         */
        if ((chip->usb_id == USB_ID(0x1686, 0x00dd) ||
             chip->usb_id == USB_ID(0x046d, 0x0a46) ||
+            chip->usb_id == USB_ID(0x046d, 0x0a56) ||
             chip->usb_id == USB_ID(0x0b0e, 0x0349) ||
             chip->usb_id == USB_ID(0x0951, 0x16ad)) &&
            (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
index b91c4c0807eca41fc22753c0cfb6ce3e60b975f8..6839915a01286bb6f9f573055cd91d19eae922a7 100644 (file)
@@ -102,6 +102,7 @@ enum quirk_type {
        QUIRK_AUDIO_ALIGN_TRANSFER,
        QUIRK_AUDIO_STANDARD_MIXER,
        QUIRK_SETUP_FMT_AFTER_RESUME,
+       QUIRK_SETUP_DISABLE_AUTOSUSPEND,
 
        QUIRK_TYPE_COUNT
 };
index 77777192f6508b6f0dfae842d1f4d97c26d1b720..4ffcc5e623c2225bdda15c688d932bd5b5957623 100644 (file)
@@ -9,7 +9,7 @@ menuconfig SND_X86
 if SND_X86
 
 config HDMI_LPE_AUDIO
-       tristate "HDMI audio without HDaudio on Intel Atom platforms"
+       tristate "HDMI audio without HDAudio on Intel Atom platforms"
        depends on DRM_I915
        select SND_PCM
        help
index 56284b98d8f0bc263515543820fb07eafd537b77..d295e406a756ede11baae579189deca328636174 100755 (executable)
@@ -137,6 +137,31 @@ $BOOTCONF $INITRD > $TEMPCONF
 cat $TEMPCONF
 xpass grep \'\"string\"\' $TEMPCONF
 
+echo "Repeat same-key tree"
+cat > $TEMPCONF << EOF
+foo
+bar
+foo { buz }
+EOF
+echo > $INITRD
+
+xpass $BOOTCONF -a $TEMPCONF $INITRD
+$BOOTCONF $INITRD > $OUTFILE
+xpass grep -q "bar" $OUTFILE
+
+
+echo "Remove/keep tailing spaces"
+cat > $TEMPCONF << EOF
+foo = val     # comment
+bar = "val2 " # comment
+EOF
+echo > $INITRD
+
+xpass $BOOTCONF -a $TEMPCONF $INITRD
+$BOOTCONF $INITRD > $OUTFILE
+xfail grep -q val[[:space:]] $OUTFILE
+xpass grep -q val2[[:space:]] $OUTFILE
+
 echo "=== expected failure cases ==="
 for i in samples/bad-* ; do
   xfail $BOOTCONF -a $i $INITRD
index 0a6d09a3e91ff5e923081ff04f3d1f4e6b84567e..39bb322707b4bad9cb049a63e81ed384c710c3cc 100644 (file)
@@ -38,7 +38,7 @@ FEATURE_TESTS = libbfd disassembler-four-args
 FEATURE_DISPLAY = libbfd disassembler-four-args
 
 check_feat := 1
-NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean
+NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean
 ifdef MAKECMDGOALS
 ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
   check_feat := 0
@@ -89,7 +89,7 @@ $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c
 $(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
 $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
 
-clean: bpftool_clean runqslower_clean
+clean: bpftool_clean runqslower_clean resolve_btfids_clean
        $(call QUIET_CLEAN, bpf-progs)
        $(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
               $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
index a88cd442639894a493e2b78d0327585516ab8df5..fe8eb537688b76d29f63d96731ece37a17e82591 100644 (file)
@@ -80,6 +80,7 @@ libbpf-clean:
 clean: libsubcmd-clean libbpf-clean fixdep-clean
        $(call msg,CLEAN,$(BINARY))
        $(Q)$(RM) -f $(BINARY); \
+       $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
        find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
 
 tags:
index 3d0d8231dc196891ecee80f63326d9d7db8b0125..7d6687618d80802ce10da1aa4e326b55bd9af014 100644 (file)
@@ -135,7 +135,7 @@ struct in_addr {
  * this socket to prevent accepting spoofed ones.
  */
 #define IP_PMTUDISC_INTERFACE          4
-/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get
+/* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get
  * fragmented if they exeed the interface mtu
  */
 #define IP_PMTUDISC_OMIT               5
index f6d86033c4fa3d21cc7c643c85d443b053c704c9..7d8eced6f459b065c445ba8dcbc107f785dc24fa 100644 (file)
@@ -790,9 +790,10 @@ struct kvm_ppc_resize_hpt {
 #define KVM_VM_PPC_HV 1
 #define KVM_VM_PPC_PR 2
 
-/* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */
-#define KVM_VM_MIPS_TE         0
+/* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */
+#define KVM_VM_MIPS_AUTO       0
 #define KVM_VM_MIPS_VZ         1
+#define KVM_VM_MIPS_TE         2
 
 #define KVM_S390_SIE_PAGE_OFFSET 1
 
@@ -1035,6 +1036,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_LAST_CPU 184
 #define KVM_CAP_SMALLER_MAXPHYADDR 185
 #define KVM_CAP_S390_DIAG318 186
+#define KVM_CAP_STEAL_TIME 187
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
index 077e7ee69e3d8cb22a671817eececec4a5db7637..3e5dcdd48a4998ddc3b59ee77b376d909e345e84 100644 (file)
@@ -1196,7 +1196,7 @@ union perf_mem_data_src {
 
 #define PERF_MEM_SNOOPX_FWD    0x01 /* forward */
 /* 1 free */
-#define PERF_MEM_SNOOPX_SHIFT  37
+#define PERF_MEM_SNOOPX_SHIFT  38
 
 /* locked instruction */
 #define PERF_MEM_LOCK_NA       0x01 /* not available */
index 0f257139b003e117eee62b82c87e2f66a20f8e36..7703f011838540e66061cd04bb0b1792304ded13 100644 (file)
@@ -130,7 +130,7 @@ static int io_uring_register_files(struct submitter *s)
                                        s->nr_files);
 }
 
-static int gettid(void)
+static int lk_gettid(void)
 {
        return syscall(__NR_gettid);
 }
@@ -281,7 +281,7 @@ static void *submitter_fn(void *data)
        struct io_sq_ring *ring = &s->sq_ring;
        int ret, prepped;
 
-       printf("submitter=%d\n", gettid());
+       printf("submitter=%d\n", lk_gettid());
 
        srand48_r(pthread_self(), &s->rand);
 
index bf8ed134cb8a376d051dac07e9f8ddec1fe6df30..9ae8f4ef0aac27ad88a323c5a3098f880aa806b3 100644 (file)
@@ -59,7 +59,7 @@ FEATURE_USER = .libbpf
 FEATURE_TESTS = libelf libelf-mmap zlib bpf reallocarray
 FEATURE_DISPLAY = libelf zlib bpf
 
-INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi
+INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi
 FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
 
 check_feat := 1
@@ -152,6 +152,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
                           awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
                           sort -u | wc -l)
 VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
+                             awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
                              grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
 CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
@@ -219,6 +220,7 @@ check_abi: $(OUTPUT)libbpf.so
                    awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
                    sort -u > $(OUTPUT)libbpf_global_syms.tmp;           \
                readelf --dyn-syms --wide $(OUTPUT)libbpf.so |           \
+                   awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
                    grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 |             \
                    sort -u > $(OUTPUT)libbpf_versioned_syms.tmp;        \
                diff -u $(OUTPUT)libbpf_global_syms.tmp                  \
index 0ad0b0491e1f2a720bf1a78890242b9b7373d064..7253b833576c05375632b20ce6aa4960b1ee2587 100644 (file)
@@ -5203,8 +5203,8 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj,
        int i, j, nrels, new_sz;
        const struct btf_var_secinfo *vi = NULL;
        const struct btf_type *sec, *var, *def;
+       struct bpf_map *map = NULL, *targ_map;
        const struct btf_member *member;
-       struct bpf_map *map, *targ_map;
        const char *name, *mname;
        Elf_Data *symbols;
        unsigned int moff;
index 3ba566de821c6b60f0c2c7ddea5468e3292e1ff1..5acc18b326061ffb3d66e01704555014dbb8cb03 100644 (file)
@@ -5259,7 +5259,7 @@ static int print_arg_pointer(struct trace_seq *s, const char *format, int plen,
        default:
                ret = 0;
                val = eval_num_arg(data, size, event, arg);
-               trace_seq_printf(s, "%p", (void *)val);
+               trace_seq_printf(s, "%p", (void *)(intptr_t)val);
                break;
        }
 
index e034a8f24f46689a113a3fde6d6c1355e399c69c..90a66891441ab19db2503f5a3e13066733df818a 100644 (file)
@@ -619,7 +619,7 @@ static int add_jump_destinations(struct objtool_file *file)
                if (!is_static_jump(insn))
                        continue;
 
-               if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)
+               if (insn->offset == FAKE_JUMP_OFFSET)
                        continue;
 
                reloc = find_reloc_by_dest_range(file->elf, insn->sec,
index 3f72d8e261f3de3a4836afc899f700ad3ca0ad17..bd50cdff08a88bcd1327a9874612a2d54d528bcf 100644 (file)
@@ -33,6 +33,10 @@ OPTIONS
         - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
          hexadecimal event descriptor.
 
+        - a symbolic or raw PMU event followed by an optional colon
+         and a list of event modifiers, e.g., cpu-cycles:p.  See the
+         linkperf:perf-list[1] man page for details on event modifiers.
+
        - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where
          'param1', 'param2', etc are defined as formats for the PMU in
          /sys/bus/event_source/devices/<pmu>/format/*.
index c9bfefc051fbef6fa0288e842e5bccd3bdc1a13a..db420dd75e4357a106ea456a6ce101c10666758d 100644 (file)
@@ -39,6 +39,10 @@ report::
        - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
          hexadecimal event descriptor.
 
+        - a symbolic or raw PMU event followed by an optional colon
+         and a list of event modifiers, e.g., cpu-cycles:p.  See the
+         linkperf:perf-list[1] man page for details on event modifiers.
+
        - a symbolically formed event like 'pmu/param1=0x3,param2/' where
          param1 and param2 are defined as formats for the PMU in
          /sys/bus/event_source/devices/<pmu>/format/*
@@ -416,6 +420,9 @@ counts for all hardware threads in a core but show the sum counts per
 hardware thread. This is essentially a replacement for the any bit and
 convenient for post processing.
 
+--summary::
+Print summary for interval mode (-I).
+
 EXAMPLES
 --------
 
index 71d830d7b92312f669367828ce8c10c38216caf8..cecce93ccc63600cb857e45c2bb02c6378843e4d 100644 (file)
@@ -66,11 +66,10 @@ static void fdpair(int fds[2])
 /* Block until we're ready to go */
 static void ready(int ready_out, int wakefd)
 {
-       char dummy;
        struct pollfd pollfd = { .fd = wakefd, .events = POLLIN };
 
        /* Tell them we're ready. */
-       if (write(ready_out, &dummy, 1) != 1)
+       if (write(ready_out, "R", 1) != 1)
                err(EXIT_FAILURE, "CLIENT: ready write");
 
        /* Wait for "GO" signal */
@@ -85,6 +84,7 @@ static void *sender(struct sender_context *ctx)
        unsigned int i, j;
 
        ready(ctx->ready_out, ctx->wakefd);
+       memset(data, 'S', sizeof(data));
 
        /* Now pump to every receiver. */
        for (i = 0; i < nr_loops; i++) {
index 8d624aea1c5e546b808db97244c4e2d7b2827bc3..b2924e3181dc3844fa14002463ea4579f5c32e4d 100644 (file)
@@ -162,8 +162,8 @@ static int do_run_multi_threaded(struct target *target,
        init_stats(&event_stats);
        for (i = 0; i < multi_iterations; i++) {
                session = perf_session__new(NULL, false, NULL);
-               if (!session)
-                       return -ENOMEM;
+               if (IS_ERR(session))
+                       return PTR_ERR(session);
 
                atomic_set(&event_count, 0);
                gettimeofday(&start, NULL);
index f91352f847c08fcdbe57ed51305b8aa3e9a311a1..772f1057647ff6274f8c0d1f8b8325dff1df4ad3 100644 (file)
@@ -2452,7 +2452,7 @@ static struct option __record_options[] = {
        OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize,
                    "synthesize non-sample events at the end of output"),
        OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"),
-       OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "record bpf events"),
+       OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "do not record bpf events"),
        OPT_BOOLEAN(0, "strict-freq", &record.opts.strict_freq,
                    "Fail if the specified frequency can't be used"),
        OPT_CALLBACK('F', "freq", &record.opts, "freq or 'max'",
index ece1cddfcd7c79244ede449118fb01aba79de531..3c74c9c0f3c38552e2ec5fa44aa84ec558e13431 100644 (file)
@@ -1332,6 +1332,9 @@ int cmd_report(int argc, const char **argv)
        if (report.mmaps_mode)
                report.tasks_mode = true;
 
+       if (dump_trace)
+               report.tool.ordered_events = false;
+
        if (quiet)
                perf_quiet_option();
 
index 0c7d599fa555ac904bd9d48e48752c1908c15f3c..e6fc297cee91dd868b26fd78af8e32c207c63d56 100644 (file)
@@ -2584,7 +2584,8 @@ static int timehist_sched_change_event(struct perf_tool *tool,
        }
 
        if (!sched->idle_hist || thread->tid == 0) {
-               timehist_update_runtime_stats(tr, t, tprev);
+               if (!cpu_list || test_bit(sample->cpu, cpu_bitmap))
+                       timehist_update_runtime_stats(tr, t, tprev);
 
                if (sched->idle_hist) {
                        struct idle_thread_runtime *itr = (void *)tr;
@@ -2857,6 +2858,9 @@ static void timehist_print_summary(struct perf_sched *sched,
 
        printf("\nIdle stats:\n");
        for (i = 0; i < idle_max_cpu; ++i) {
+               if (cpu_list && !test_bit(i, cpu_bitmap))
+                       continue;
+
                t = idle_threads[i];
                if (!t)
                        continue;
index 483a28ef4ec4feefacb087c761ba11373e0a055b..fddc97cac98415698242cf272420f142ae1fefc5 100644 (file)
@@ -404,7 +404,7 @@ static void read_counters(struct timespec *rs)
 {
        struct evsel *counter;
 
-       if (!stat_config.summary && (read_affinity_counters(rs) < 0))
+       if (!stat_config.stop_read_counter && (read_affinity_counters(rs) < 0))
                return;
 
        evlist__for_each_entry(evsel_list, counter) {
@@ -897,9 +897,9 @@ try_again_reset:
        if (stat_config.walltime_run_table)
                stat_config.walltime_run[run_idx] = t1 - t0;
 
-       if (interval) {
+       if (interval && stat_config.summary) {
                stat_config.interval = 0;
-               stat_config.summary = true;
+               stat_config.stop_read_counter = true;
                init_stats(&walltime_nsecs_stats);
                update_stats(&walltime_nsecs_stats, t1 - t0);
 
@@ -1164,6 +1164,8 @@ static struct option stat_options[] = {
                    "Use with 'percore' event qualifier to show the event "
                    "counts of one hardware thread by sum up total hardware "
                    "threads of same physical core"),
+       OPT_BOOLEAN(0, "summary", &stat_config.summary,
+                      "print summary for interval mode"),
 #ifdef HAVE_LIBPFM
        OPT_CALLBACK(0, "pfm-events", &evsel_list, "event",
                "libpfm4 event selector. use 'perf list' to list available events",
index 994c230027bb2acac076875fae053a78c96c48e8..7c64134472c7750744c216a1240eea1ea7dc6cb7 100644 (file)
@@ -1746,6 +1746,7 @@ int cmd_top(int argc, const char **argv)
                goto out_delete_evlist;
        }
 
+#ifdef HAVE_LIBBPF_SUPPORT
        if (!top.record_opts.no_bpf_event) {
                top.sb_evlist = evlist__new();
 
@@ -1759,6 +1760,7 @@ int cmd_top(int argc, const char **argv)
                        goto out_delete_evlist;
                }
        }
+#endif
 
        if (perf_evlist__start_sb_thread(top.sb_evlist, target)) {
                pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");
index 7e1aa8273935c68615e607fdd79f05e8309fec7a..653b11b2339929a9620209269b5f8e7b0249687f 100644 (file)
@@ -61,7 +61,7 @@
   {
     "EventName": "ex_ret_brn_ind_misp",
     "EventCode": "0xca",
-    "BriefDescription": "Retired Indirect Branch Instructions Mispredicted.",
+    "BriefDescription": "Retired Indirect Branch Instructions Mispredicted."
   },
   {
     "EventName": "ex_ret_mmx_fp_instr.sse_instr",
index de89e5a44ff154cb604a31fd3d08971d57f0d8d9..4b75183da94aee987294128e05f0ec3fb659e1c4 100644 (file)
   {
     "EventName": "ex_ret_fus_brnch_inst",
     "EventCode": "0x1d0",
-    "BriefDescription": "Retired Fused Instructions. The number of fuse-branch instructions retired per cycle. The number of events logged per cycle can vary from 0-8.",
+    "BriefDescription": "Retired Fused Instructions. The number of fuse-branch instructions retired per cycle. The number of events logged per cycle can vary from 0-8."
   }
 ]
index fa86c5f997cc54158aa9ab9c93440c3af06685ad..fc9c158bfa134efa1c9832398c0a62ce0b905f5e 100644 (file)
@@ -137,7 +137,7 @@ static char *fixregex(char *s)
                return s;
 
        /* allocate space for a new string */
-       fixed = (char *) malloc(len + 1);
+       fixed = (char *) malloc(len + esc_count + 1);
        if (!fixed)
                return NULL;
 
index 6cd40810859551581ddf56eb38873ddc33f39d60..a36f49fb4dbea3a220f80074dff357cd88631b86 100644 (file)
@@ -49,6 +49,7 @@ Following tests are defined (with perf commands):
   perf record --call-graph fp kill              (test-record-graph-fp)
   perf record --group -e cycles,instructions kill (test-record-group)
   perf record -e '{cycles,instructions}' kill   (test-record-group1)
+  perf record -e '{cycles/period=1/,instructions/period=2/}:S' kill (test-record-group2)
   perf record -D kill                           (test-record-no-delay)
   perf record -i kill                           (test-record-no-inherit)
   perf record -n kill                           (test-record-no-samples)
diff --git a/tools/perf/tests/attr/test-record-group2 b/tools/perf/tests/attr/test-record-group2
new file mode 100644 (file)
index 0000000..6b9f8d1
--- /dev/null
@@ -0,0 +1,29 @@
+[config]
+command = record
+args    = --no-bpf-event -e '{cycles/period=1234000/,instructions/period=6789000/}:S' kill >/dev/null 2>&1
+ret     = 1
+
+[event-1:base-record]
+fd=1
+group_fd=-1
+config=0|1
+sample_period=1234000
+sample_type=87
+read_format=12
+inherit=0
+freq=0
+
+[event-2:base-record]
+fd=2
+group_fd=1
+config=0|1
+sample_period=6789000
+sample_type=87
+read_format=12
+disabled=0
+inherit=0
+mmap=0
+comm=0
+freq=0
+enable_on_exec=0
+task=0
index da8ec1e8e06481f9296c5ac90741071d07e89776..cc9fbcedb3646eaf9e60fc3a32a5708fcba953e8 100644 (file)
@@ -45,10 +45,13 @@ volatile long the_var;
 #if defined (__x86_64__)
 extern void __test_function(volatile long *ptr);
 asm (
+       ".pushsection .text;"
        ".globl __test_function\n"
+       ".type __test_function, @function;"
        "__test_function:\n"
        "incq (%rdi)\n"
-       "ret\n");
+       "ret\n"
+       ".popsection\n");
 #else
 static void __test_function(volatile long *ptr)
 {
index 5d20bf8397f09d2899f191986f24c601bb313b14..cd77e334e5777d1b6d1fcacf795b132182775973 100644 (file)
@@ -197,7 +197,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void),
                perf_mmap__read_done(&md->core);
        }
 
-       if (count != expect) {
+       if (count != expect * evlist->core.nr_entries) {
                pr_debug("BPF filter result incorrect, expected %d, got %d samples\n", expect, count);
                goto out_delete_evlist;
        }
index 7f9f87a470c3bcef8c2c985d171d26ccda2f2710..aae0fd9045c1c47d4a23681fbf9bb610ce31236e 100644 (file)
@@ -719,7 +719,7 @@ static int test__group2(struct evlist *evlist)
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
-       TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
+       TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
        TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
        TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
        TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
@@ -842,7 +842,7 @@ static int test__group3(struct evlist *evlist __maybe_unused)
        TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
-       TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
+       TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
        TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
        TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
        TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
index fc0838a7abc22f3839dffb2e05910eed35b39258..cd7331aac3bdfb415080f30d124d5e5e92ca8985 100644 (file)
@@ -70,6 +70,9 @@ static struct pmu_event pme_test[] = {
 {
        .metric_expr    = "1/m3",
        .metric_name    = "M3",
+},
+{
+       .name   = NULL,
 }
 };
 
@@ -150,8 +153,10 @@ static int __compute_metric(const char *name, struct value *vals,
                return -ENOMEM;
 
        cpus = perf_cpu_map__new("0");
-       if (!cpus)
+       if (!cpus) {
+               evlist__delete(evlist);
                return -ENOMEM;
+       }
 
        perf_evlist__set_maps(&evlist->core, cpus, NULL);
 
@@ -160,10 +165,11 @@ static int __compute_metric(const char *name, struct value *vals,
                                             false, false,
                                             &metric_events);
        if (err)
-               return err;
+               goto out;
 
-       if (perf_evlist__alloc_stats(evlist, false))
-               return -1;
+       err = perf_evlist__alloc_stats(evlist, false);
+       if (err)
+               goto out;
 
        /* Load the runtime stats with given numbers for events. */
        runtime_stat__init(&st);
@@ -175,13 +181,14 @@ static int __compute_metric(const char *name, struct value *vals,
        if (name2 && ratio2)
                *ratio2 = compute_single(&metric_events, evlist, &st, name2);
 
+out:
        /* ... clenup. */
        metricgroup__rblist_exit(&metric_events);
        runtime_stat__exit(&st);
        perf_evlist__free_stats(evlist);
        perf_cpu_map__put(cpus);
        evlist__delete(evlist);
-       return 0;
+       return err;
 }
 
 static int compute_metric(const char *name, struct value *vals, double *ratio)
index eb19f9a0bc153e597ded35039028bfe77ec05441..d3517a74d95e382ec3bc663c4446a01ef80891c4 100644 (file)
@@ -274,6 +274,7 @@ static int __test__pmu_event_aliases(char *pmu_name, int *count)
        int res = 0;
        bool use_uncore_table;
        struct pmu_events_map *map = __test_pmu_get_events_map();
+       struct perf_pmu_alias *a, *tmp;
 
        if (!map)
                return -1;
@@ -347,6 +348,10 @@ static int __test__pmu_event_aliases(char *pmu_name, int *count)
                          pmu_name, alias->name);
        }
 
+       list_for_each_entry_safe(a, tmp, &aliases, list) {
+               list_del(&a->list);
+               perf_pmu_free_alias(a);
+       }
        free(pmu);
        return res;
 }
index 5c11fe2b30406815f3baaa5946f1d040f5db89d3..714e6830a758fac01c1193baf034f897505ce5b2 100644 (file)
@@ -173,6 +173,7 @@ int test__pmu(struct test *test __maybe_unused, int subtest __maybe_unused)
                ret = 0;
        } while (0);
 
+       perf_pmu__del_formats(&formats);
        test_format_dir_put(format);
        return ret;
 }
index be9c4c0549bc83ae0dc2de335284b96e8908b994..a07626f072087d78738a81139a063597ccf0e02b 100644 (file)
@@ -3629,8 +3629,8 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help,
 {
        int nr_entries = evlist->core.nr_entries;
 
-single_entry:
        if (perf_evlist__single_entry(evlist)) {
+single_entry: {
                struct evsel *first = evlist__first(evlist);
 
                return perf_evsel__hists_browse(first, nr_entries, help,
@@ -3638,6 +3638,7 @@ single_entry:
                                                env, warn_lost_event,
                                                annotation_opts);
        }
+       }
 
        if (symbol_conf.event_group) {
                struct evsel *pos;
index 302a14d0aca9e50d34abed3fffe65b1047554680..93e063f22be50d89495ee62b374aada54d67d4d8 100644 (file)
@@ -182,15 +182,15 @@ static int arm_spe_read_record(struct arm_spe_decoder *decoder)
                        if (payload & BIT(EV_TLB_ACCESS))
                                decoder->record.type |= ARM_SPE_TLB_ACCESS;
 
-                       if ((idx == 1 || idx == 2 || idx == 3) &&
+                       if ((idx == 2 || idx == 4 || idx == 8) &&
                            (payload & BIT(EV_LLC_MISS)))
                                decoder->record.type |= ARM_SPE_LLC_MISS;
 
-                       if ((idx == 1 || idx == 2 || idx == 3) &&
+                       if ((idx == 2 || idx == 4 || idx == 8) &&
                            (payload & BIT(EV_LLC_ACCESS)))
                                decoder->record.type |= ARM_SPE_LLC_ACCESS;
 
-                       if ((idx == 1 || idx == 2 || idx == 3) &&
+                       if ((idx == 2 || idx == 4 || idx == 8) &&
                            (payload & BIT(EV_REMOTE_ACCESS)))
                                decoder->record.type |= ARM_SPE_REMOTE_ACCESS;
 
index c283223fb31f22479ecfa9e46cdc888c902025c4..a2a369e2fbb67eadbf1474d87a1b55e335bb0f8b 100644 (file)
@@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm,
                attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR;
        }
 
-       if (etm->synth_opts.last_branch)
+       if (etm->synth_opts.last_branch) {
                attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
+               /*
+                * We don't use the hardware index, but the sample generation
+                * code uses the new format branch_stack with this field,
+                * so the event attributes must indicate that it's present.
+                */
+               attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
+       }
 
        if (etm->synth_opts.instructions) {
                attr.config = PERF_COUNT_HW_INSTRUCTIONS;
index e3fa3bf7498a2224d546cec1dfabe34028ad6a63..c0768c61eb430d8bb82de79d04073af199708d2a 100644 (file)
@@ -946,6 +946,10 @@ int perf_evlist__create_maps(struct evlist *evlist, struct target *target)
 
        perf_evlist__set_maps(&evlist->core, cpus, threads);
 
+       /* as evlist now has references, put count here */
+       perf_cpu_map__put(cpus);
+       perf_thread_map__put(threads);
+
        return 0;
 
 out_delete_threads:
@@ -1273,11 +1277,12 @@ static int perf_evlist__create_syswide_maps(struct evlist *evlist)
                goto out_put;
 
        perf_evlist__set_maps(&evlist->core, cpus, threads);
-out:
-       return err;
+
+       perf_thread_map__put(threads);
 out_put:
        perf_cpu_map__put(cpus);
-       goto out;
+out:
+       return err;
 }
 
 int evlist__open(struct evlist *evlist)
index fd865002cbbd444c2eee3eed8f092dc1ea7d3c07..459b51e900636e88f882ae64759c8ac3329f46a5 100644 (file)
@@ -976,16 +976,20 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts,
         * We default some events to have a default interval. But keep
         * it a weak assumption overridable by the user.
         */
-       if (!attr->sample_period || (opts->user_freq != UINT_MAX ||
-                                    opts->user_interval != ULLONG_MAX)) {
+       if (!attr->sample_period) {
                if (opts->freq) {
-                       evsel__set_sample_bit(evsel, PERIOD);
                        attr->freq              = 1;
                        attr->sample_freq       = opts->freq;
                } else {
                        attr->sample_period = opts->default_interval;
                }
        }
+       /*
+        * If attr->freq was set (here or earlier), ask for period
+        * to be sampled.
+        */
+       if (attr->freq)
+               evsel__set_sample_bit(evsel, PERIOD);
 
        if (opts->no_samples)
                attr->sample_freq = 0;
index 2a8d245351e747188c690193a5b6f61ca2e99fed..0af4e81c46e2bea4f4698da74c5774be79b62708 100644 (file)
@@ -3017,8 +3017,15 @@ static int intel_pt_synth_events(struct intel_pt *pt,
 
        if (pt->synth_opts.callchain)
                attr.sample_type |= PERF_SAMPLE_CALLCHAIN;
-       if (pt->synth_opts.last_branch)
+       if (pt->synth_opts.last_branch) {
                attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
+               /*
+                * We don't use the hardware index, but the sample generation
+                * code uses the new format branch_stack with this field,
+                * so the event attributes must indicate that it's present.
+                */
+               attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
+       }
 
        if (pt->synth_opts.instructions) {
                attr.config = PERF_COUNT_HW_INSTRUCTIONS;
index 208b813e00ea49219773352ef6e40e7c47757673..85587de027a51880a647441ca866348867577687 100644 (file)
@@ -736,12 +736,6 @@ int machine__process_switch_event(struct machine *machine __maybe_unused,
        return 0;
 }
 
-static int is_bpf_image(const char *name)
-{
-       return strncmp(name, "bpf_trampoline_", sizeof("bpf_trampoline_") - 1) == 0 ||
-              strncmp(name, "bpf_dispatcher_", sizeof("bpf_dispatcher_") - 1) == 0;
-}
-
 static int machine__process_ksymbol_register(struct machine *machine,
                                             union perf_event *event,
                                             struct perf_sample *sample __maybe_unused)
index 1d7210804639fdc0bbc9f17bf9ce838da97a4852..cc0faf8f132194f7a4f9185f3eae37cbece69f2e 100644 (file)
@@ -267,6 +267,22 @@ bool __map__is_bpf_prog(const struct map *map)
        return name && (strstr(name, "bpf_prog_") == name);
 }
 
+bool __map__is_bpf_image(const struct map *map)
+{
+       const char *name;
+
+       if (map->dso->binary_type == DSO_BINARY_TYPE__BPF_IMAGE)
+               return true;
+
+       /*
+        * If PERF_RECORD_KSYMBOL is not included, the dso will not have
+        * type of DSO_BINARY_TYPE__BPF_IMAGE. In such cases, we can
+        * guess the type based on name.
+        */
+       name = map->dso->short_name;
+       return name && is_bpf_image(name);
+}
+
 bool __map__is_ool(const struct map *map)
 {
        return map->dso && map->dso->binary_type == DSO_BINARY_TYPE__OOL;
index 9e312ae2d656339dfe01e97a2e28ca70fe36d267..c2f5d28fe73ac4956fc70e41a500e52059c819bd 100644 (file)
@@ -147,12 +147,14 @@ int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name,
 bool __map__is_kernel(const struct map *map);
 bool __map__is_extra_kernel_map(const struct map *map);
 bool __map__is_bpf_prog(const struct map *map);
+bool __map__is_bpf_image(const struct map *map);
 bool __map__is_ool(const struct map *map);
 
 static inline bool __map__is_kmodule(const struct map *map)
 {
        return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map) &&
-              !__map__is_bpf_prog(map) && !__map__is_ool(map);
+              !__map__is_bpf_prog(map) && !__map__is_ool(map) &&
+              !__map__is_bpf_image(map);
 }
 
 bool map__has_symbols(const struct map *map);
@@ -164,4 +166,9 @@ static inline bool is_entry_trampoline(const char *name)
        return !strcmp(name, ENTRY_TRAMPOLINE_NAME);
 }
 
+static inline bool is_bpf_image(const char *name)
+{
+       return strncmp(name, "bpf_trampoline_", sizeof("bpf_trampoline_") - 1) == 0 ||
+              strncmp(name, "bpf_dispatcher_", sizeof("bpf_dispatcher_") - 1) == 0;
+}
 #endif /* __PERF_MAP_H */
index 8831b964288fa59c125fc3b085fdbc3da7eb3535..ab5030fcfed4e2082c0472ee398ebb429d536a59 100644 (file)
@@ -85,6 +85,7 @@ static void metric_event_delete(struct rblist *rblist __maybe_unused,
 
        list_for_each_entry_safe(expr, tmp, &me->head, nd) {
                free(expr->metric_refs);
+               free(expr->metric_events);
                free(expr);
        }
 
@@ -316,6 +317,7 @@ static int metricgroup__setup_events(struct list_head *groups,
                        if (!metric_refs) {
                                ret = -ENOMEM;
                                free(metric_events);
+                               free(expr);
                                break;
                        }
 
@@ -530,6 +532,9 @@ void metricgroup__print(bool metrics, bool metricgroups, char *filter,
                                                continue;
                                        strlist__add(me->metrics, s);
                                }
+
+                               if (!raw)
+                                       free(s);
                        }
                        free(omg);
                }
@@ -667,7 +672,6 @@ static int __add_metric(struct list_head *metric_list,
                m->has_constraint = metric_no_group || metricgroup__has_constraint(pe);
                INIT_LIST_HEAD(&m->metric_refs);
                m->metric_refs_cnt = 0;
-               *mp = m;
 
                parent = expr_ids__alloc(ids);
                if (!parent) {
@@ -680,6 +684,7 @@ static int __add_metric(struct list_head *metric_list,
                        free(m);
                        return -ENOMEM;
                }
+               *mp = m;
        } else {
                /*
                 * We got here for the referenced metric, via the
@@ -714,8 +719,11 @@ static int __add_metric(struct list_head *metric_list,
         * all the metric's IDs and add it to the parent context.
         */
        if (expr__find_other(pe->metric_expr, NULL, &m->pctx, runtime) < 0) {
-               expr__ctx_clear(&m->pctx);
-               free(m);
+               if (m->metric_refs_cnt == 0) {
+                       expr__ctx_clear(&m->pctx);
+                       free(m);
+                       *mp = NULL;
+               }
                return -EINVAL;
        }
 
@@ -934,7 +942,7 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
 
                ret = add_metric(&list, pe, metric_no_group, &m, NULL, &ids);
                if (ret)
-                       return ret;
+                       goto out;
 
                /*
                 * Process any possible referenced metrics
@@ -943,12 +951,14 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
                ret = resolve_metric(metric_no_group,
                                     &list, map, &ids);
                if (ret)
-                       return ret;
+                       goto out;
        }
 
        /* End of pmu events. */
-       if (!has_match)
-               return -EINVAL;
+       if (!has_match) {
+               ret = -EINVAL;
+               goto out;
+       }
 
        list_for_each_entry(m, &list, nd) {
                if (events->len > 0)
@@ -963,9 +973,14 @@ static int metricgroup__add_metric(const char *metric, bool metric_no_group,
                }
        }
 
+out:
+       /*
+        * add to metric_list so that they can be released
+        * even if it's failed
+        */
        list_splice(&list, metric_list);
        expr_ids__exit(&ids);
-       return 0;
+       return ret;
 }
 
 static int metricgroup__add_metric_list(const char *list, bool metric_no_group,
@@ -1040,7 +1055,7 @@ static int parse_groups(struct evlist *perf_evlist, const char *str,
        ret = metricgroup__add_metric_list(str, metric_no_group,
                                           &extra_events, &metric_list, map);
        if (ret)
-               return ret;
+               goto out;
        pr_debug("adding %s\n", extra_events.buf);
        bzero(&parse_error, sizeof(parse_error));
        ret = __parse_events(perf_evlist, extra_events.buf, &parse_error, fake_pmu);
@@ -1048,11 +1063,11 @@ static int parse_groups(struct evlist *perf_evlist, const char *str,
                parse_events_print_error(&parse_error, extra_events.buf);
                goto out;
        }
-       strbuf_release(&extra_events);
        ret = metricgroup__setup_events(&metric_list, metric_no_merge,
                                        perf_evlist, metric_events);
 out:
        metricgroup__free_metrics(&metric_list);
+       strbuf_release(&extra_events);
        return ret;
 }
 
index 9f7260e691134ef6a1f696d515c768e42d6c7e9d..667cbca1547ac5f6ec1eea4f13fce4866b5dd18d 100644 (file)
@@ -37,6 +37,7 @@
 #include "util/evsel_config.h"
 #include "util/event.h"
 #include "util/pfm.h"
+#include "perf.h"
 
 #define MAX_NAME_LEN 100
 
@@ -410,7 +411,7 @@ static int add_event_tool(struct list_head *list, int *idx,
                return -ENOMEM;
        evsel->tool_event = tool_event;
        if (tool_event == PERF_TOOL_DURATION_TIME)
-               evsel->unit = strdup("ns");
+               evsel->unit = "ns";
        return 0;
 }
 
@@ -1533,19 +1534,23 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
        evsel = __add_event(list, &parse_state->idx, &attr, true,
                            get_config_name(head_config), pmu,
                            &config_terms, auto_merge_stats, NULL);
-       if (evsel) {
-               evsel->unit = info.unit;
-               evsel->scale = info.scale;
-               evsel->per_pkg = info.per_pkg;
-               evsel->snapshot = info.snapshot;
-               evsel->metric_expr = info.metric_expr;
-               evsel->metric_name = info.metric_name;
-               evsel->pmu_name = name ? strdup(name) : NULL;
-               evsel->use_uncore_alias = use_uncore_alias;
-               evsel->percore = config_term_percore(&evsel->config_terms);
-       }
+       if (!evsel)
+               return -ENOMEM;
+
+       evsel->pmu_name = name ? strdup(name) : NULL;
+       evsel->use_uncore_alias = use_uncore_alias;
+       evsel->percore = config_term_percore(&evsel->config_terms);
 
-       return evsel ? 0 : -ENOMEM;
+       if (parse_state->fake_pmu)
+               return 0;
+
+       evsel->unit = info.unit;
+       evsel->scale = info.scale;
+       evsel->per_pkg = info.per_pkg;
+       evsel->snapshot = info.snapshot;
+       evsel->metric_expr = info.metric_expr;
+       evsel->metric_name = info.metric_name;
+       return 0;
 }
 
 int parse_events_multi_pmu_add(struct parse_events_state *parse_state,
@@ -1794,6 +1799,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
                if (*str == 'u') {
                        if (!exclude)
                                exclude = eu = ek = eh = 1;
+                       if (!exclude_GH && !perf_guest)
+                               eG = 1;
                        eu = 0;
                } else if (*str == 'k') {
                        if (!exclude)
index b9fb91fdc5de91771316688c51c827b41c92791b..645bf4f1859fd76b03310913eb0dcebc41a11350 100644 (file)
@@ -511,7 +511,7 @@ PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc
        list = alloc_list();
        ABORT_ON(!list);
        err = parse_events_add_breakpoint(list, &parse_state->idx,
-                                       (void *) $2, $6, $4);
+                                       (void *)(uintptr_t) $2, $6, $4);
        free($6);
        if (err) {
                free(list);
@@ -528,7 +528,7 @@ PE_PREFIX_MEM PE_VALUE '/' PE_VALUE sep_dc
        list = alloc_list();
        ABORT_ON(!list);
        if (parse_events_add_breakpoint(list, &parse_state->idx,
-                                               (void *) $2, NULL, $4)) {
+                                               (void *)(uintptr_t) $2, NULL, $4)) {
                free(list);
                YYABORT;
        }
@@ -544,7 +544,7 @@ PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
        list = alloc_list();
        ABORT_ON(!list);
        err = parse_events_add_breakpoint(list, &parse_state->idx,
-                                       (void *) $2, $4, 0);
+                                       (void *)(uintptr_t) $2, $4, 0);
        free($4);
        if (err) {
                free(list);
@@ -561,7 +561,7 @@ PE_PREFIX_MEM PE_VALUE sep_dc
        list = alloc_list();
        ABORT_ON(!list);
        if (parse_events_add_breakpoint(list, &parse_state->idx,
-                                               (void *) $2, NULL, 0)) {
+                                               (void *)(uintptr_t) $2, NULL, 0)) {
                free(list);
                YYABORT;
        }
index f1688e1f6ed7808d49362f7e13911c832a213967..d41caeb35cf6cb198f7f09ab648cb2ba057a45e4 100644 (file)
@@ -274,7 +274,7 @@ static void perf_pmu_update_alias(struct perf_pmu_alias *old,
 }
 
 /* Delete an alias entry. */
-static void perf_pmu_free_alias(struct perf_pmu_alias *newalias)
+void perf_pmu_free_alias(struct perf_pmu_alias *newalias)
 {
        zfree(&newalias->name);
        zfree(&newalias->desc);
@@ -1354,6 +1354,17 @@ void perf_pmu__set_format(unsigned long *bits, long from, long to)
                set_bit(b, bits);
 }
 
+void perf_pmu__del_formats(struct list_head *formats)
+{
+       struct perf_pmu_format *fmt, *tmp;
+
+       list_for_each_entry_safe(fmt, tmp, formats, list) {
+               list_del(&fmt->list);
+               free(fmt->name);
+               free(fmt);
+       }
+}
+
 static int sub_non_neg(int a, int b)
 {
        if (b > a)
index 44ccbdbb1c3743e91fe7124772a09dd281cb02c2..a64e9c9ce731a1fb9a88392dcd750ffcff1dccd3 100644 (file)
@@ -94,6 +94,7 @@ int perf_pmu__new_format(struct list_head *list, char *name,
                         int config, unsigned long *bits);
 void perf_pmu__set_format(unsigned long *bits, long from, long to);
 int perf_pmu__format_parse(char *dir, struct list_head *head);
+void perf_pmu__del_formats(struct list_head *formats);
 
 struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
 
@@ -113,6 +114,7 @@ void pmu_add_cpu_aliases_map(struct list_head *head, struct perf_pmu *pmu,
 
 struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu);
 bool pmu_uncore_alias_match(const char *pmu_name, const char *name);
+void perf_pmu_free_alias(struct perf_pmu_alias *alias);
 
 int perf_pmu__convert_scale(const char *scale, char **end, double *sval);
 
index a4cc11592f6b38ebf1fb86a31da6e9920b5c6187..ea9aa1d7cf50132088d98ba873043d8e63d5a8d5 100644 (file)
@@ -2,6 +2,7 @@
 #include "debug.h"
 #include "evlist.h"
 #include "evsel.h"
+#include "evsel_config.h"
 #include "parse-events.h"
 #include <errno.h>
 #include <limits.h>
@@ -33,11 +34,24 @@ static struct evsel *evsel__read_sampler(struct evsel *evsel, struct evlist *evl
        return leader;
 }
 
+static u64 evsel__config_term_mask(struct evsel *evsel)
+{
+       struct evsel_config_term *term;
+       struct list_head *config_terms = &evsel->config_terms;
+       u64 term_types = 0;
+
+       list_for_each_entry(term, config_terms, list) {
+               term_types |= 1 << term->type;
+       }
+       return term_types;
+}
+
 static void evsel__config_leader_sampling(struct evsel *evsel, struct evlist *evlist)
 {
        struct perf_event_attr *attr = &evsel->core.attr;
        struct evsel *leader = evsel->leader;
        struct evsel *read_sampler;
+       u64 term_types, freq_mask;
 
        if (!leader->sample_read)
                return;
@@ -47,16 +61,20 @@ static void evsel__config_leader_sampling(struct evsel *evsel, struct evlist *ev
        if (evsel == read_sampler)
                return;
 
+       term_types = evsel__config_term_mask(evsel);
        /*
-        * Disable sampling for all group members other than the leader in
-        * case the leader 'leads' the sampling, except when the leader is an
-        * AUX area event, in which case the 2nd event in the group is the one
-        * that 'leads' the sampling.
+        * Disable sampling for all group members except those with explicit
+        * config terms or the leader. In the case of an AUX area event, the 2nd
+        * event in the group is the one that 'leads' the sampling.
         */
-       attr->freq           = 0;
-       attr->sample_freq    = 0;
-       attr->sample_period  = 0;
-       attr->write_backward = 0;
+       freq_mask = (1 << EVSEL__CONFIG_TERM_FREQ) | (1 << EVSEL__CONFIG_TERM_PERIOD);
+       if ((term_types & freq_mask) == 0) {
+               attr->freq           = 0;
+               attr->sample_freq    = 0;
+               attr->sample_period  = 0;
+       }
+       if ((term_types & (1 << EVSEL__CONFIG_TERM_OVERWRITE)) == 0)
+               attr->write_backward = 0;
 
        /*
         * We don't get a sample for slave events, we make them when delivering
index ffbc9d35a383f717d254c680aabe26ea4e7dc0fd..7a5f03764702bfb56b470e5eb7a6958d2a0ec387 100644 (file)
@@ -87,7 +87,7 @@ static int perf_session__process_compressed_event(struct perf_session *session,
                session->decomp_last = decomp;
        }
 
-       pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
+       pr_debug("decomp (B): %zd to %zd\n", src_size, decomp_size);
 
        return 0;
 }
index 57d0706e1330a239c4678105b865ab60f08cec0d..493ec372fdec4152df02ae02990b4b33effa1a1d 100644 (file)
@@ -117,7 +117,7 @@ static void aggr_printout(struct perf_stat_config *config,
                                cpu_map__id_to_die(id),
                                config->csv_output ? 0 : -3,
                                cpu_map__id_to_cpu(id), config->csv_sep);
-               } else {
+               } else if (id > -1) {
                        fprintf(config->output, "CPU%*d%s",
                                config->csv_output ? 0 : -7,
                                evsel__cpus(evsel)->map[id],
index e1ba6c1b916a635dd3566906d1dbce727797a8ae..924b54d15d5406b98d1236b57a8db0b90d46545d 100644 (file)
@@ -517,7 +517,7 @@ static void print_l1_dcache_misses(struct perf_stat_config *config,
 
        color = get_ratio_color(GRC_CACHE_MISSES, ratio);
 
-       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache hits", ratio);
+       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache accesses", ratio);
 }
 
 static void print_l1_icache_misses(struct perf_stat_config *config,
@@ -538,7 +538,7 @@ static void print_l1_icache_misses(struct perf_stat_config *config,
                ratio = avg / total * 100.0;
 
        color = get_ratio_color(GRC_CACHE_MISSES, ratio);
-       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache hits", ratio);
+       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache accesses", ratio);
 }
 
 static void print_dtlb_cache_misses(struct perf_stat_config *config,
@@ -558,7 +558,7 @@ static void print_dtlb_cache_misses(struct perf_stat_config *config,
                ratio = avg / total * 100.0;
 
        color = get_ratio_color(GRC_CACHE_MISSES, ratio);
-       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache hits", ratio);
+       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache accesses", ratio);
 }
 
 static void print_itlb_cache_misses(struct perf_stat_config *config,
@@ -578,7 +578,7 @@ static void print_itlb_cache_misses(struct perf_stat_config *config,
                ratio = avg / total * 100.0;
 
        color = get_ratio_color(GRC_CACHE_MISSES, ratio);
-       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache hits", ratio);
+       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache accesses", ratio);
 }
 
 static void print_ll_cache_misses(struct perf_stat_config *config,
@@ -598,7 +598,7 @@ static void print_ll_cache_misses(struct perf_stat_config *config,
                ratio = avg / total * 100.0;
 
        color = get_ratio_color(GRC_CACHE_MISSES, ratio);
-       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache hits", ratio);
+       out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache accesses", ratio);
 }
 
 /*
@@ -853,14 +853,16 @@ static void generic_metric(struct perf_stat_config *config,
 double test_generic_metric(struct metric_expr *mexp, int cpu, struct runtime_stat *st)
 {
        struct expr_parse_ctx pctx;
-       double ratio;
+       double ratio = 0.0;
 
        if (prepare_metric(mexp->metric_events, mexp->metric_refs, &pctx, cpu, st) < 0)
-               return 0.;
+               goto out;
 
        if (expr__parse(&ratio, &pctx, mexp->metric_expr, 1))
-               return 0.;
+               ratio = 0.0;
 
+out:
+       expr__ctx_clear(&pctx);
        return ratio;
 }
 
@@ -918,7 +920,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
                if (runtime_stat_n(st, STAT_L1_DCACHE, ctx, cpu) != 0)
                        print_l1_dcache_misses(config, cpu, evsel, avg, out, st);
                else
-                       print_metric(config, ctxp, NULL, NULL, "of all L1-dcache hits", 0);
+                       print_metric(config, ctxp, NULL, NULL, "of all L1-dcache accesses", 0);
        } else if (
                evsel->core.attr.type == PERF_TYPE_HW_CACHE &&
                evsel->core.attr.config ==  ( PERF_COUNT_HW_CACHE_L1I |
@@ -928,7 +930,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
                if (runtime_stat_n(st, STAT_L1_ICACHE, ctx, cpu) != 0)
                        print_l1_icache_misses(config, cpu, evsel, avg, out, st);
                else
-                       print_metric(config, ctxp, NULL, NULL, "of all L1-icache hits", 0);
+                       print_metric(config, ctxp, NULL, NULL, "of all L1-icache accesses", 0);
        } else if (
                evsel->core.attr.type == PERF_TYPE_HW_CACHE &&
                evsel->core.attr.config ==  ( PERF_COUNT_HW_CACHE_DTLB |
@@ -938,7 +940,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
                if (runtime_stat_n(st, STAT_DTLB_CACHE, ctx, cpu) != 0)
                        print_dtlb_cache_misses(config, cpu, evsel, avg, out, st);
                else
-                       print_metric(config, ctxp, NULL, NULL, "of all dTLB cache hits", 0);
+                       print_metric(config, ctxp, NULL, NULL, "of all dTLB cache accesses", 0);
        } else if (
                evsel->core.attr.type == PERF_TYPE_HW_CACHE &&
                evsel->core.attr.config ==  ( PERF_COUNT_HW_CACHE_ITLB |
@@ -948,7 +950,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
                if (runtime_stat_n(st, STAT_ITLB_CACHE, ctx, cpu) != 0)
                        print_itlb_cache_misses(config, cpu, evsel, avg, out, st);
                else
-                       print_metric(config, ctxp, NULL, NULL, "of all iTLB cache hits", 0);
+                       print_metric(config, ctxp, NULL, NULL, "of all iTLB cache accesses", 0);
        } else if (
                evsel->core.attr.type == PERF_TYPE_HW_CACHE &&
                evsel->core.attr.config ==  ( PERF_COUNT_HW_CACHE_LL |
@@ -958,7 +960,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
                if (runtime_stat_n(st, STAT_LL_CACHE, ctx, cpu) != 0)
                        print_ll_cache_misses(config, cpu, evsel, avg, out, st);
                else
-                       print_metric(config, ctxp, NULL, NULL, "of all LL-cache hits", 0);
+                       print_metric(config, ctxp, NULL, NULL, "of all LL-cache accesses", 0);
        } else if (evsel__match(evsel, HARDWARE, HW_CACHE_MISSES)) {
                total = runtime_stat_avg(st, STAT_CACHEREFS, ctx, cpu);
 
index f8778cffd9419b9e43350717fa038485b40a91c3..aa3bed48511b328957cfb7c6bd6b6ac5c013a681 100644 (file)
@@ -113,6 +113,7 @@ struct perf_stat_config {
        bool                     summary;
        bool                     metric_no_group;
        bool                     metric_no_merge;
+       bool                     stop_read_counter;
        FILE                    *output;
        unsigned int             interval;
        unsigned int             timeout;
index 1f5fcb828a212ebad87a94fc0595e9602dc4afbe..5151a8c0b791af18d7cb0fcbca87ebe357a887b7 100644 (file)
@@ -663,6 +663,7 @@ static bool symbol__is_idle(const char *name)
                "exit_idle",
                "mwait_idle",
                "mwait_idle_with_hints",
+               "mwait_idle_with_hints.constprop.0",
                "poll_idle",
                "ppc64_runlatch_off",
                "pseries_dedicated_idle_sleep",
index d2202392ffdbb328b9d08c4995c96faaa1a082fa..48dd2b018c47a7fcbe4a5e78e3d43bfc03d349b2 100644 (file)
@@ -99,7 +99,7 @@ size_t zstd_decompress_stream(struct zstd_data *data, void *src, size_t src_size
        while (input.pos < input.size) {
                ret = ZSTD_decompressStream(data->dstream, &output, &input);
                if (ZSTD_isError(ret)) {
-                       pr_err("failed to decompress (B): %ld -> %ld, dst_size %ld : %s\n",
+                       pr_err("failed to decompress (B): %zd -> %zd, dst_size %zd : %s\n",
                               src_size, output.size, dst_size, ZSTD_getErrorName(ret));
                        break;
                }
index 07ddbfdbcab70606052110cc0bc63ffb3037da7d..6dfce3fd68bc85495b6feb52b8d64aa9bd961446 100644 (file)
@@ -47,7 +47,10 @@ int dump_bpf_hash_map(struct bpf_iter__bpf_map_elem *ctx)
        __u32 seq_num = ctx->meta->seq_num;
        struct bpf_map *map = ctx->map;
        struct key_t *key = ctx->key;
+       struct key_t tmp_key;
        __u64 *val = ctx->value;
+       __u64 tmp_val = 0;
+       int ret;
 
        if (in_test_mode) {
                /* test mode is used by selftests to
@@ -61,6 +64,18 @@ int dump_bpf_hash_map(struct bpf_iter__bpf_map_elem *ctx)
                if (key == (void *)0 || val == (void *)0)
                        return 0;
 
+               /* update the value and then delete the <key, value> pair.
+                * it should not impact the existing 'val' which is still
+                * accessible under rcu.
+                */
+               __builtin_memcpy(&tmp_key, key, sizeof(struct key_t));
+               ret = bpf_map_update_elem(&hashmap1, &tmp_key, &tmp_val, 0);
+               if (ret)
+                       return 0;
+               ret = bpf_map_delete_elem(&hashmap1, &tmp_key);
+               if (ret)
+                       return 0;
+
                key_sum_a += key->a;
                key_sum_b += key->b;
                key_sum_c += key->c;
index 754cf611723ee53f759bcf7a88f989033431ae1a..0d92ebcb335d1b7637641c07594c99cf3312b9fb 100644 (file)
@@ -1274,6 +1274,8 @@ static void __run_parallel(unsigned int tasks,
        pid_t pid[tasks];
        int i;
 
+       fflush(stdout);
+
        for (i = 0; i < tasks; i++) {
                pid[i] = fork();
                if (pid[i] == 0) {
index b1e4dadacd9b40b360fac66c064f14272713d87d..22943b58d752ae12baf9b4db75ceff36ee4b5205 100644 (file)
@@ -618,7 +618,9 @@ int cd_flavor_subdir(const char *exec_name)
        if (!flavor)
                return 0;
        flavor++;
-       fprintf(stdout, "Switching to flavor '%s' subdirectory...\n", flavor);
+       if (env.verbosity > VERBOSE_NONE)
+               fprintf(stdout, "Switching to flavor '%s' subdirectory...\n", flavor);
+
        return chdir(flavor);
 }
 
index b8d14f9db5f9ef32037687e36e981a8226bb12a0..2fc6b3af81a11e9da49d3285faa6bd26ef91f3e2 100644 (file)
@@ -73,7 +73,7 @@ int main(void)
        int i;
        /* Instruction lengths starting at ss_start */
        int ss_size[4] = {
-               3,              /* xor */
+               2,              /* xor */
                2,              /* cpuid */
                5,              /* mov */
                2,              /* rdmsr */
index 7c38a909f8b86cd6417fb88537533351fea9e7e5..8a2fe6d64bf24291e5557038a78b39a6953eee66 100755 (executable)
@@ -1175,6 +1175,51 @@ kci_test_neigh_get()
        echo "PASS: neigh get"
 }
 
+kci_test_bridge_parent_id()
+{
+       local ret=0
+       sysfsnet=/sys/bus/netdevsim/devices/netdevsim
+       probed=false
+
+       if [ ! -w /sys/bus/netdevsim/new_device ] ; then
+               modprobe -q netdevsim
+               check_err $?
+               if [ $ret -ne 0 ]; then
+                       echo "SKIP: bridge_parent_id can't load netdevsim"
+                       return $ksft_skip
+               fi
+               probed=true
+       fi
+
+       echo "10 1" > /sys/bus/netdevsim/new_device
+       while [ ! -d ${sysfsnet}10 ] ; do :; done
+       echo "20 1" > /sys/bus/netdevsim/new_device
+       while [ ! -d ${sysfsnet}20 ] ; do :; done
+       udevadm settle
+       dev10=`ls ${sysfsnet}10/net/`
+       dev20=`ls ${sysfsnet}20/net/`
+
+       ip link add name test-bond0 type bond mode 802.3ad
+       ip link set dev $dev10 master test-bond0
+       ip link set dev $dev20 master test-bond0
+       ip link add name test-br0 type bridge
+       ip link set dev test-bond0 master test-br0
+       check_err $?
+
+       # clean up any leftovers
+       ip link del dev test-br0
+       ip link del dev test-bond0
+       echo 20 > /sys/bus/netdevsim/del_device
+       echo 10 > /sys/bus/netdevsim/del_device
+       $probed && rmmod netdevsim
+
+       if [ $ret -ne 0 ]; then
+               echo "FAIL: bridge_parent_id"
+               return 1
+       fi
+       echo "PASS: bridge_parent_id"
+}
+
 kci_test_rtnl()
 {
        local ret=0
@@ -1224,6 +1269,8 @@ kci_test_rtnl()
        check_err $?
        kci_test_neigh_get
        check_err $?
+       kci_test_bridge_parent_id
+       check_err $?
 
        kci_del_dummy
        return $ret
index a47d1d83221049949c11cb8e292444f5c7d578eb..431296c0f91cf6093c6e7c2fc43c6fba67d354f8 100755 (executable)
@@ -11,7 +11,7 @@
 # result in fragmentation and/or PMTU discovery.
 #
 # You can check with different Orgininator/Link/Responder MTU eg:
-# sh nft_flowtable.sh -o1000 -l500 -r100
+# nft_flowtable.sh -o8000 -l1500 -r2000
 #
 
 
@@ -27,8 +27,7 @@ ns2out=""
 log_netns=$(sysctl -n net.netfilter.nf_log_all_netns)
 
 checktool (){
-       $1 > /dev/null 2>&1
-       if [ $? -ne 0 ];then
+       if ! $1 > /dev/null 2>&1; then
                echo "SKIP: Could not $2"
                exit $ksft_skip
        fi
@@ -87,19 +86,36 @@ omtu=9000
 lmtu=1500
 rmtu=2000
 
+usage(){
+       echo "nft_flowtable.sh [OPTIONS]"
+       echo
+       echo "MTU options"
+       echo "   -o originator"
+       echo "   -l link"
+       echo "   -r responder"
+       exit 1
+}
+
 while getopts "o:l:r:" o
 do
        case $o in
                o) omtu=$OPTARG;;
                l) lmtu=$OPTARG;;
                r) rmtu=$OPTARG;;
+               *) usage;;
        esac
 done
 
-ip -net nsr1 link set veth0 mtu $omtu
+if ! ip -net nsr1 link set veth0 mtu $omtu; then
+       exit 1
+fi
+
 ip -net ns1 link set eth0 mtu $omtu
 
-ip -net nsr2 link set veth1 mtu $rmtu
+if ! ip -net nsr2 link set veth1 mtu $rmtu; then
+       exit 1
+fi
+
 ip -net ns2 link set eth0 mtu $rmtu
 
 # transfer-net between nsr1 and nsr2.
@@ -120,7 +136,10 @@ for i in 1 2; do
   ip -net ns$i route add default via 10.0.$i.1
   ip -net ns$i addr add dead:$i::99/64 dev eth0
   ip -net ns$i route add default via dead:$i::1
-  ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null
+  if ! ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null; then
+       echo "ERROR: Check Originator/Responder values (problem during address addition)"
+       exit 1
+  fi
 
   # don't set ip DF bit for first two tests
   ip netns exec ns$i sysctl net.ipv4.ip_no_pmtu_disc=1 > /dev/null
@@ -178,15 +197,13 @@ if [ $? -ne 0 ]; then
 fi
 
 # test basic connectivity
-ip netns exec ns1 ping -c 1 -q 10.0.2.99 > /dev/null
-if [ $? -ne 0 ];then
+if ! ip netns exec ns1 ping -c 1 -q 10.0.2.99 > /dev/null; then
   echo "ERROR: ns1 cannot reach ns2" 1>&2
   bash
   exit 1
 fi
 
-ip netns exec ns2 ping -c 1 -q 10.0.1.99 > /dev/null
-if [ $? -ne 0 ];then
+if ! ip netns exec ns2 ping -c 1 -q 10.0.1.99 > /dev/null; then
   echo "ERROR: ns2 cannot reach ns1" 1>&2
   exit 1
 fi
@@ -203,7 +220,6 @@ ns2out=$(mktemp)
 make_file()
 {
        name=$1
-       who=$2
 
        SIZE=$((RANDOM % (1024 * 8)))
        TSIZE=$((SIZE * 1024))
@@ -222,8 +238,7 @@ check_transfer()
        out=$2
        what=$3
 
-       cmp "$in" "$out" > /dev/null 2>&1
-       if [ $? -ne 0 ] ;then
+       if ! cmp "$in" "$out" > /dev/null 2>&1; then
                echo "FAIL: file mismatch for $what" 1>&2
                ls -l "$in"
                ls -l "$out"
@@ -260,13 +275,11 @@ test_tcp_forwarding_ip()
 
        wait
 
-       check_transfer "$ns1in" "$ns2out" "ns1 -> ns2"
-       if [ $? -ne 0 ];then
+       if ! check_transfer "$ns1in" "$ns2out" "ns1 -> ns2"; then
                lret=1
        fi
 
-       check_transfer "$ns2in" "$ns1out" "ns1 <- ns2"
-       if [ $? -ne 0 ];then
+       if ! check_transfer "$ns2in" "$ns1out" "ns1 <- ns2"; then
                lret=1
        fi
 
@@ -295,13 +308,12 @@ test_tcp_forwarding_nat()
        return $lret
 }
 
-make_file "$ns1in" "ns1"
-make_file "$ns2in" "ns2"
+make_file "$ns1in"
+make_file "$ns2in"
 
 # First test:
 # No PMTU discovery, nsr1 is expected to fragment packets from ns1 to ns2 as needed.
-test_tcp_forwarding ns1 ns2
-if [ $? -eq 0 ] ;then
+if test_tcp_forwarding ns1 ns2; then
        echo "PASS: flow offloaded for ns1/ns2"
 else
        echo "FAIL: flow offload for ns1/ns2:" 1>&2
@@ -332,9 +344,7 @@ table ip nat {
 }
 EOF
 
-test_tcp_forwarding_nat ns1 ns2
-
-if [ $? -eq 0 ] ;then
+if test_tcp_forwarding_nat ns1 ns2; then
        echo "PASS: flow offloaded for ns1/ns2 with NAT"
 else
        echo "FAIL: flow offload for ns1/ns2 with NAT" 1>&2
@@ -346,8 +356,7 @@ fi
 # Same as second test, but with PMTU discovery enabled.
 handle=$(ip netns exec nsr1 nft -a list table inet filter | grep something-to-grep-for | cut -d \# -f 2)
 
-ip netns exec nsr1 nft delete rule inet filter forward $handle
-if [ $? -ne 0 ] ;then
+if ! ip netns exec nsr1 nft delete rule inet filter forward $handle; then
        echo "FAIL: Could not delete large-packet accept rule"
        exit 1
 fi
@@ -355,8 +364,7 @@ fi
 ip netns exec ns1 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null
 ip netns exec ns2 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null
 
-test_tcp_forwarding_nat ns1 ns2
-if [ $? -eq 0 ] ;then
+if test_tcp_forwarding_nat ns1 ns2; then
        echo "PASS: flow offloaded for ns1/ns2 with NAT and pmtu discovery"
 else
        echo "FAIL: flow offload for ns1/ns2 with NAT and pmtu discovery" 1>&2
@@ -402,8 +410,7 @@ ip -net ns2 route del 192.168.10.1 via 10.0.2.1
 ip -net ns2 route add default via 10.0.2.1
 ip -net ns2 route add default via dead:2::1
 
-test_tcp_forwarding ns1 ns2
-if [ $? -eq 0 ] ;then
+if test_tcp_forwarding ns1 ns2; then
        echo "PASS: ipsec tunnel mode for ns1/ns2"
 else
        echo "FAIL: ipsec tunnel mode for ns1/ns2"
index 91c775c23c66089173d77013f99986e199f30b08..aac4a59f9e2813c460953413e74fa3bd5aaa7e39 100644 (file)
@@ -2,6 +2,7 @@
 hugetlb_vs_thp_test
 subpage_prot
 tempfile
+prot_sao
 segv_errors
 wild_bctr
 large_vm_fork_separation
index 250ce172e0daccc471209ae0576dd2185a63d710..defe488d6bf111b5469e7c9059e0e92c91603360 100644 (file)
@@ -2,7 +2,7 @@
 noarg:
        $(MAKE) -C ../
 
-TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot segv_errors wild_bctr \
+TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors wild_bctr \
                  large_vm_fork_separation bad_accesses pkey_exec_prot \
                  pkey_siginfo stack_expansion_signal stack_expansion_ldst
 
@@ -14,6 +14,8 @@ include ../../lib.mk
 
 $(TEST_GEN_PROGS): ../harness.c ../utils.c
 
+$(OUTPUT)/prot_sao: ../utils.c
+
 $(OUTPUT)/wild_bctr: CFLAGS += -m64
 $(OUTPUT)/large_vm_fork_separation: CFLAGS += -m64
 $(OUTPUT)/bad_accesses: CFLAGS += -m64
diff --git a/tools/testing/selftests/powerpc/mm/prot_sao.c b/tools/testing/selftests/powerpc/mm/prot_sao.c
new file mode 100644 (file)
index 0000000..30b71b1
--- /dev/null
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright 2016, Michael Ellerman, IBM Corp.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
+#include <asm/cputable.h>
+
+#include "utils.h"
+
+#define SIZE (64 * 1024)
+
+int test_prot_sao(void)
+{
+       char *p;
+
+       /*
+        * SAO was introduced in 2.06 and removed in 3.1. It's disabled in
+        * guests/LPARs by default, so also skip if we are running in a guest.
+        */
+       SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06) ||
+               have_hwcap2(PPC_FEATURE2_ARCH_3_1) ||
+               access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK) == 0);
+
+       /*
+        * Ensure we can ask for PROT_SAO.
+        * We can't really verify that it does the right thing, but at least we
+        * confirm the kernel will accept it.
+        */
+       p = mmap(NULL, SIZE, PROT_READ | PROT_WRITE | PROT_SAO,
+                MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+       FAIL_IF(p == MAP_FAILED);
+
+       /* Write to the mapping, to at least cause a fault */
+       memset(p, 0xaa, SIZE);
+
+       return 0;
+}
+
+int main(void)
+{
+       return test_harness(test_prot_sao, "prot-sao");
+}
index 7656c7ce79d905f1b35c112996c8c292618a4c9a..0e73a16874c4c5b121e8bdef48aa889ad5a21e85 100644 (file)
@@ -13,6 +13,7 @@ DESTRUCTIVE_TESTS = alarmtimer-suspend valid-adjtimex adjtick change_skew \
 
 TEST_GEN_PROGS_EXTENDED = $(DESTRUCTIVE_TESTS)
 
+TEST_FILES := settings
 
 include ../lib.mk
 
diff --git a/tools/testing/selftests/timers/settings b/tools/testing/selftests/timers/settings
new file mode 100644 (file)
index 0000000..e7b9417
--- /dev/null
@@ -0,0 +1 @@
+timeout=0
index 6af951900aa39f97772e3e467d1c49d9d330a8ea..312889edb84ab799ed6ef99b5d6b15cca57542ae 100644 (file)
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
        }
 
        if (shift)
-               printf("%u kB hugepages\n", 1 << shift);
+               printf("%u kB hugepages\n", 1 << (shift - 10));
        else
                printf("Default size hugepages\n");
        printf("Mapping %lu Mbytes\n", (unsigned long)length >> 20);
index c41f24b517f401c34fab8ae05a9d4ddf481eaa0b..65c141ebfbbde8ded6f4d9af1ebe879a616b6e95 100644 (file)
@@ -462,6 +462,17 @@ static int test_vsys_x(void)
        return 0;
 }
 
+/*
+ * Debuggers expect ptrace() to be able to peek at the vsyscall page.
+ * Use process_vm_readv() as a proxy for ptrace() to test this.  We
+ * want it to work in the vsyscall=emulate case and to fail in the
+ * vsyscall=xonly case.
+ *
+ * It's worth noting that this ABI is a bit nutty.  write(2) can't
+ * read from the vsyscall page on any kernel version or mode.  The
+ * fact that ptrace() ever worked was a nice courtesy of old kernels,
+ * but the code to support it is fairly gross.
+ */
 static int test_process_vm_readv(void)
 {
 #ifdef __x86_64__
@@ -477,8 +488,12 @@ static int test_process_vm_readv(void)
        remote.iov_len = 4096;
        ret = process_vm_readv(getpid(), &local, 1, &remote, 1, 0);
        if (ret != 4096) {
-               printf("[OK]\tprocess_vm_readv() failed (ret = %d, errno = %d)\n", ret, errno);
-               return 0;
+               /*
+                * We expect process_vm_readv() to work if and only if the
+                * vsyscall page is readable.
+                */
+               printf("[%s]\tprocess_vm_readv() failed (ret = %d, errno = %d)\n", vsyscall_map_r ? "FAIL" : "OK", ret, errno);
+               return vsyscall_map_r ? 1 : 0;
        }
 
        if (vsyscall_map_r) {
@@ -488,6 +503,9 @@ static int test_process_vm_readv(void)
                        printf("[FAIL]\tIt worked but returned incorrect data\n");
                        return 1;
                }
+       } else {
+               printf("[FAIL]\tprocess_rm_readv() succeeded, but it should have failed in this configuration\n");
+               return 1;
        }
 #endif
 
diff --git a/tools/usb/Build b/tools/usb/Build
new file mode 100644 (file)
index 0000000..2ad6f97
--- /dev/null
@@ -0,0 +1,2 @@
+testusb-y += testusb.o
+ffs-test-y += ffs-test.o
index 01d758d73b6db1b442d85387871442cdf9c39017..1b128e551b2e428d0cb5cbb3c862be0e9d7d2963 100644 (file)
@@ -1,14 +1,51 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for USB tools
+include ../scripts/Makefile.include
 
-PTHREAD_LIBS = -lpthread
-WARNINGS = -Wall -Wextra
-CFLAGS = $(WARNINGS) -g -I../include
-LDFLAGS = $(PTHREAD_LIBS)
+bindir ?= /usr/bin
 
-all: testusb ffs-test
-%: %.c
-       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+endif
+
+# Do not use make's built-in rules
+# (this improves performance and avoids hard-to-debug behaviour);
+MAKEFLAGS += -r
+
+override CFLAGS += -O2 -Wall -Wextra -g -D_GNU_SOURCE -I$(OUTPUT)include -I$(srctree)/tools/include
+override LDFLAGS += -lpthread
+
+ALL_TARGETS := testusb ffs-test
+ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
+
+all: $(ALL_PROGRAMS)
+
+export srctree OUTPUT CC LD CFLAGS
+include $(srctree)/tools/build/Makefile.include
+
+TESTUSB_IN := $(OUTPUT)testusb-in.o
+$(TESTUSB_IN): FORCE
+       $(Q)$(MAKE) $(build)=testusb
+$(OUTPUT)testusb: $(TESTUSB_IN)
+       $(QUIET_LINK)$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
+
+FFS_TEST_IN := $(OUTPUT)ffs-test-in.o
+$(FFS_TEST_IN): FORCE
+       $(Q)$(MAKE) $(build)=ffs-test
+$(OUTPUT)ffs-test: $(FFS_TEST_IN)
+       $(QUIET_LINK)$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
 
 clean:
-       $(RM) testusb ffs-test
+       rm -f $(ALL_PROGRAMS)
+       find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete -o -name '\.*.o.cmd' -delete
+
+install: $(ALL_PROGRAMS)
+       install -d -m 755 $(DESTDIR)$(bindir);          \
+       for program in $(ALL_PROGRAMS); do              \
+               install $$program $(DESTDIR)$(bindir);  \
+       done
+
+FORCE:
+
+.PHONY: all install clean FORCE prepare
index 67cd0b88a6b6ff91b0225eb705b84386370eb97c..cf88233b819a0803e7f47dd85552a9275b135a68 100644 (file)
@@ -4332,7 +4332,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
                               struct kvm_io_device *dev)
 {
-       int i;
+       int i, j;
        struct kvm_io_bus *new_bus, *bus;
 
        bus = kvm_get_bus(kvm, bus_idx);
@@ -4349,17 +4349,20 @@ void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
 
        new_bus = kmalloc(struct_size(bus, range, bus->dev_count - 1),
                          GFP_KERNEL_ACCOUNT);
-       if (!new_bus)  {
+       if (new_bus) {
+               memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range));
+               new_bus->dev_count--;
+               memcpy(new_bus->range + i, bus->range + i + 1,
+                      (new_bus->dev_count - i) * sizeof(struct kvm_io_range));
+       } else {
                pr_err("kvm: failed to shrink bus, removing it completely\n");
-               goto broken;
+               for (j = 0; j < bus->dev_count; j++) {
+                       if (j == i)
+                               continue;
+                       kvm_iodevice_destructor(bus->range[j].dev);
+               }
        }
 
-       memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range));
-       new_bus->dev_count--;
-       memcpy(new_bus->range + i, bus->range + i + 1,
-              (new_bus->dev_count - i) * sizeof(struct kvm_io_range));
-
-broken:
        rcu_assign_pointer(kvm->buses[bus_idx], new_bus);
        synchronize_srcu_expedited(&kvm->srcu);
        kfree(bus);